07070100000000000081A400000000000000000000000164DF2CB800000093000000000000000000000000000000000000002800000000dracut-055+suse.347.gdcb9bdbf/.astylerc   lineend=linux
style=linux
indent=spaces=8
convert-tabs
min-conditional-indent=0
max-instatement-indent=120
align-pointer=name
max-code-length=120

 07070100000001000081A400000000000000000000000164DF2CB80000047E000000000000000000000000000000000000002D00000000dracut-055+suse.347.gdcb9bdbf/.dir-locals.el  ; Directory Local Variables
; For more information see (info "(emacs) Directory Variables")
; Sets emacs variables based on mode.
; A list of (major-mode . ((var1 . value1) (var2 . value2)))
; Mode can be nil, which gives default values.
; Characters width is set to 109 for .c and XML but for everything else 79.
; If you update this file make sure to update .vimrc and .editorconfig too.

((c-mode . ((fill-column . 109)
            (c-basic-offset . 8)
            (eval . (c-set-offset 'substatement-open 0))
            (eval . (c-set-offset 'statement-case-open 0))
            (eval . (c-set-offset 'case-label 0))
            (eval . (c-set-offset 'arglist-intro '++))
            (eval . (c-set-offset 'arglist-close 0))
            (eval . (c-set-offset 'arglist-cont-nonempty '(c-lineup-gcc-asm-reg c-lineup-arglist)))))
 (nxml-mode . ((nxml-child-indent . 2)
               (fill-column . 109)))
 (meson-mode . ((meson-indent-basic . 8)))
 (sh-mode . ((sh-basic-offset . 4)
             (sh-indentation . 4)))
 (awk-mode . ((c-basic-offset . 8)))
 (nil . ((indent-tabs-mode . nil)
         (tab-width . 4)
         (fill-column . 79))) )
  07070100000002000081A400000000000000000000000164DF2CB8000003A6000000000000000000000000000000000000002C00000000dracut-055+suse.347.gdcb9bdbf/.editorconfig   # EditorConfig configuration for dracut
# http://EditorConfig.org

# If you update this file make sure to update .dir-locals.el and .vimrc too.

# Top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file, utf-8 charset
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 4
switch_case_indent = true
function_next_line = false
binary_next_line   = true
space_redirects    = true

# Match config files, set indent to spaces with width of eight.
[*.{c,h}]
indent_style = space
indent_size = 8

# Match config files, set indent to spaces with width of four.
[*.sh]
indent_style = space
indent_size = 4
switch_case_indent = true
function_next_line = false
binary_next_line   = true
space_redirects    = true

# Match xml man pages, set indent to spaces with width of two.
[man/*.xml]
indent_style = space
indent_size = 2
  07070100000003000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002600000000dracut-055+suse.347.gdcb9bdbf/.github 07070100000004000081A400000000000000000000000164DF2CB800000149000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/.github/CODEOWNERS  # This is a comment.
# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
*       @aafeijoo-suse @tblume

   07070100000005000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003500000000dracut-055+suse.347.gdcb9bdbf/.github/ISSUE_TEMPLATE  07070100000006000081A400000000000000000000000164DF2CB800000255000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/.github/ISSUE_TEMPLATE/bug_report.md    ---
name: "\U0001F41B Bug report"
about: A report of an error in a recent Dracut version
labels: 'bug'
---

**Describe the bug**
A clear and concise description of what the error is.

**Distribution used**
Which distribution was this behaviour seen in?

**Dracut version**
Which dracut version was this behaviour seen in?

**Init system**
Which init system is being used?

**To Reproduce**
Steps or code to reproduce the behavior.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Additional context**
Add any other context you like about the problem here.
   07070100000007000081A400000000000000000000000164DF2CB8000000DC000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/.github/ISSUE_TEMPLATE/documentation.md ---
name: "\U0001F4D6 Documentation"
about: Suggest an improvement for documentation in Dracut
labels: 'documents'
---

**Describe the documentation**
A clear and concise description of what should be better documented.
07070100000008000081A400000000000000000000000164DF2CB8000000E1000000000000000000000000000000000000004800000000dracut-055+suse.347.gdcb9bdbf/.github/ISSUE_TEMPLATE/feature_request.md   ---
name: "\U00002728 Feature Request"
about: A request for enhancement in Dracut
labels: 'enhancement'
---

**Describe the enhancement**
A clear and concise description of what the enhancement is that you would like to see.
   07070100000009000081A400000000000000000000000164DF2CB800000E1E000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/.github/labeler.yml repository:
  - ./*

github:
  - .github/*
  - .github/**/*

dracut-install:
  - install/*
  - install/**/*

example:
  - examples/*
  - examples/**/*
  - examples/**/**/*

modules:
  - modules.d/*
  - modules.d/**/*

bash:
  - modules.d/00bash/*

bootchart:
  - modules.d/00bootchart/*

dash:
  - modules.d/00dash/*

mksh:
  - modules.d/00mksh/*

systemd:
  - modules.d/00systemd/*

warpclock:
  - modules.d/00warpclock/*

fips:
  - modules.d/01fips/*

systemd-initrd:
  - modules.d/01systemd-initrd/*

caps:
  - modules.d/02caps/*

systemd-networkd:
  - modules.d/02systemd-networkd/*

modsign:
  - modules.d/03modsign/*

rescue:
  - modules.d/03rescue/*

watchdog:
  - modules.d/04watchdog/*

busybox:
  - modules.d/05busybox/*

rngd:
  - modules.d/06rngd/*

i18n:
  - modules.d/10i18n/*

convertfs:
  - modules.d/30convertfs/*

network-legacy:
  - modules.d/35network-legacy/*

network-manager:
 - modules.d/35network-manager/*

network:
  - modules.d/40network/*

ifcfg:
  - modules.d/45ifcfg/*

url-lib:
  - modules.d/45url-lib/*

drm:
  - modules.d/50drm/*

gensplash:
  - modules.d/50gensplash/*

plymouth:
  - modules.d/50plymouth/*

cms:
  - modules.d/80cms/*

lvmmerge:
  - modules.d/80lvmmerge/*

cio_ignore:
  - modules.d/81cio_ignore/*

btrfs:
  - modules.d/90btrfs/*

crypt:
  - modules.d/90crypt/*

dm:
  - modules.d/90dm/*

dmraid:
  - modules.d/90dmraid/*

dmsquash-live:
  - modules.d/90dmsquash-live/*

dmsquash-live-ntfs:
  - modules.d/90dmsquash-live-ntfs/*

kernel-modules:
  - modules.d/90kernel-modules/*

kernel-modules-extra:
  - modules.d/90kernel-modules-extra/*

kernel-network-modules:
  - modules.d/90kernel-network-modules/*

livenet:
  - modules.d/90livenet/*

lvm:
  - modules.d/90lvm/*

mdraid:
  - modules.d/90mdraid/*

multipath:
  - modules.d/90multipath/*

nvdimm:
  - modules.d/90nvdimm/*

ppcmac:
  - modules.d/90ppcmac/*

qemu:
  - modules.d/90qemu/*

qemu-net:
  - modules.d/90qemu-net/*

stratis:
  - modules.d/90stratis/*

crypt-gpg:
  - modules.d/91crypt-gpg/*

crypt-loop:
  - modules.d/91crypt-loop/*

zipl:
  - modules.d/91zipl/*

cifs:
  - modules.d/95cifs/*

dasd:
  - modules.d/95dasd/*

dasd_mod:
  - modules.d/95dasd_mod/*

dasd_rules:
  - modules.d/95dasd_rules/*

dcssblk:
  - modules.d/95dcssblk/*

debug:
  - modules.d/95debug/*

fcoe:
  - modules.d/95fcoe/*

fcoe-uefi:
  - modules.d/95fcoe-uefi/*

fstab-sys:
  - modules.d/95fstab-sys/*

iscsi:
  - modules.d/95iscsi/*

lunmask:
  - modules.d/95lunmask/*

nbd:
  - modules.d/95nbd/*

nfs:
  - modules.d/95nfs/*

nvmf:
  - modules.d/95nvmf/*

qeth_rules:
  - modules.d/95qeth_rules/*

resume:
  - modules.d/95resume/*

rootfs-block:
  - modules.d/95rootfs-block/*

ssh-client:
  - modules.d/95ssh-client/*

terminfo:
  - modules.d/95terminfo/*

udev-rules:
  - modules.d/95udev-rules/*

virtfs:
  - modules.d/95virtfs/*

zfcp:
  - modules.d/95zfcp/*

zfcp_rules:
  - modules.d/95zfcp_rules/*

znet:
  - modules.d/95znet/*

securityfs:
  - modules.d/96securityfs/*

biosdevname:
  - modules.d/97biosdevname/*

masterkey:
- modules.d/97masterkey/*

dracut-systemd:
  - modules.d/98dracut-systemd/*

ecryptfs:
  - modules.d/98ecryptfs/*

integrity:
  - modules.d/98integrity/*

pollcdrom:
  - modules.d/98pollcdrom/*

selinux:
  - modules.d/98selinux/*

syslog:
  - modules.d/98syslog/*

usrmount:
  - modules.d/98usrmount/*

base:
  - modules.d/99base/*

fs-lib:
  - modules.d/99fs-lib/*

img-lib:
  - modules.d/99img-lib/*

memstrack:
  - modules.d/99memstrack/*

shutdown:
  - modules.d/99shutdown/*

squash:
  - modules.d/99squash/*

uefi-lib:
  - modules.d/99uefi-lib/*

test:
  - test/*
  - test/**/*
  0707010000000A000081A400000000000000000000000164DF2CB8000000D0000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/.github/pull_request_template.md    This pull request changes...

## Changes

## Checklist
- [ ] I have tested it locally
- [ ] I have reviewed and updated any documentation if relevant
- [ ] I am providing new code and test(s) for it

Fixes #
0707010000000B000081A400000000000000000000000164DF2CB80000035D000000000000000000000000000000000000003000000000dracut-055+suse.347.gdcb9bdbf/.github/stale.yml   # Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
  - documents
  - enhancement
  - regression
  - wiki
  - bug
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
  This issue is being marked as stale because it has not had any recent activity. 
  It will be closed if no further activity occurs. 
  If this is still an issue in the latest release of Dracut and you would like to keep it open please comment on this issue within the next 7 days. 
  Thank you for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
   0707010000000C000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003000000000dracut-055+suse.347.gdcb9bdbf/.github/workflows   0707010000000D000081A400000000000000000000000164DF2CB80000085C000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/.github/workflows/container.yml name: Container
on:
    schedule:
        -  cron: '30 11 * * *'   # every day at 4:40
    push:
        branches: [ master ]
        paths:
            - 'test/container/**'
            - '.github/workflows/container.yml'
    pull_request:
        branches: [ master ]
        paths:
            - 'test/container/**'
            - '.github/workflows/container.yml'

permissions:
    packages: write
    contents: read

jobs:
    push_to_registry:
        name: Build and push containers image to GitHub Packages
        runs-on: ubuntu-latest
        concurrency:
            group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.config.dockerfile }}
            cancel-in-progress: true
        strategy:
            fail-fast: false
            matrix:
                config:
                    - { dockerfile: 'Dockerfile-Fedora-33',         tag: 'fedora:33' }
                    - { dockerfile: 'Dockerfile-Fedora-latest',     tag: 'fedora:latest' }
                    - { dockerfile: 'Dockerfile-Fedora-rawhide',    tag: 'fedora:rawhide' }
                    - { dockerfile: 'Dockerfile-OpenSuse-latest',   tag: 'opensuse:latest' }
                    - { dockerfile: 'Dockerfile-Arch',              tag: 'arch:latest' }
        steps:
            -   name: Check out the repo
                uses: actions/checkout@v2
            -   name: Set up Docker Buildx
                uses: docker/setup-buildx-action@v1
#                with:
#                    buildkitd-flags: --debug
            -   name: Login to GitHub Container Registry
                uses: docker/login-action@v1
                with:
                    registry: ghcr.io
                    username: ${{ github.repository_owner }}
                    password: ${{ secrets.GITHUB_TOKEN }}
            -   name: Build and Push Container
                uses: docker/build-push-action@v2
                with:
                    file: test/container/${{ matrix.config.dockerfile }}
                    tags: ghcr.io/dracutdevs/${{ matrix.config.tag }}
                    push: ${{ github.event_name == 'push' ||  github.event_name == 'schedule' }}
0707010000000E000081A400000000000000000000000164DF2CB800000A1B000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/.github/workflows/integration.yml   name: Integration Test

on:
    pull_request:
        branches: [ master ]

jobs:
    basic:
        runs-on: ubuntu-latest
        timeout-minutes: 45
        concurrency:
            group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }}
            cancel-in-progress: true
        strategy:
            matrix:
                container: [
                        "fedora:33",
                        "fedora:rawhide",
                        "opensuse:latest",
                        "arch:latest",
                ]
                test: [
                        "04",
                ]
            fail-fast: false
        container:
            image: ghcr.io/dracutdevs/${{ matrix.container }}
            options: "--privileged -v /dev:/dev"
        steps:
            -   name: "Checkout Repository"
                uses: actions/checkout@v2
                with:
                    fetch-depth: 0

            -   name: "${{ matrix.container }} TEST-${{ matrix.test }}"
                run: ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
    test:
        runs-on: ubuntu-latest
        timeout-minutes: 45
        concurrency:
            group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }}
            cancel-in-progress: true
        strategy:
            matrix:
                container: [
                        "fedora:latest",
                ]
                test: [
                        "01",
                        "02",
                        "03",
                        "04",
                        "10",
                        "11",
                        "12",
                        "13",
                        "14",
                        "15",
                        "17",
                        "20",
                        "21",
                        "30",
                        "31",
                        "35",
                        "36",
                        "40",
                        "41",
                        "98",
                ]
            fail-fast: false
        container:
            image: ghcr.io/dracutdevs/${{ matrix.container }}
            options: "--privileged -v /dev:/dev"
        steps:
            -   name: "Checkout Repository"
                uses: actions/checkout@v2
                with:
                    fetch-depth: 0

            -   name: "${{ matrix.container }} TEST-${{ matrix.test }}"
                run: ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
 0707010000000F000081A400000000000000000000000164DF2CB8000000F0000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/.github/workflows/labels.yml    name: "Pull Request Labeler"

on: pull_request_target

jobs:
    triage:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/labeler@main
              with:
                  repo-token: "${{ secrets.GITHUB_TOKEN }}"
07070100000010000081A400000000000000000000000164DF2CB8000002D7000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/.github/workflows/lint.yml  name: Lint

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  lint-c:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: install tools
        run: sudo apt-get install astyle

      - name: indent
        run: make indent-c

      - name: check formatting
        run: git diff --exit-code

  lint-shell:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: shfmt
        uses: luizm/action-sh-checker@v0.2.2
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SHFMT_OPTS: -s # arguments to shfmt.
        with:
          sh_checker_shellcheck_disable: false
          sh_checker_comment: true
 07070100000011000081A400000000000000000000000164DF2CB8000001DA000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/.github/workflows/pr.yml    name: Commisery
on:
  pull_request:
    types: [edited, opened, synchronize, reopened]

jobs:
  commit-message:
    name: Conventional Commit Message Checker (Commisery)
    runs-on: ubuntu-latest
    steps:
    - name: Check-out the repo under $GITHUB_WORKSPACE
      uses: actions/checkout@v2

    - name: Run Commisery
      uses: dracutdevs/commisery-action@master
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        pull_request: ${{ github.event.number }}

  07070100000012000081A400000000000000000000000164DF2CB80000019F000000000000000000000000000000000000002900000000dracut-055+suse.347.gdcb9bdbf/.gitignore  /Makefile.inc
/dracut.8
/dracut-catimages.8
/dracut.conf.5
/dracut.conf.d/*.conf
/dracut-gencmdline.8
/dracut.html
/dracut.kernel.7
/dracut.pc
/dracut-install
/modules.d/99base/switch_root
/test/*/test.log
/test/*/.testdir
test*.img
/.buildpath
/.project
/dracut-version.sh
/install/dracut-install
/*.rpm
/*.[0-9]
/modules.d/98dracut-systemd/*.service.8
/*.sign
*.o
skipcpio/skipcpio
/util/util
/dracut-util
.idea/
 07070100000013000081A400000000000000000000000164DF2CB80000004F000000000000000000000000000000000000002A00000000dracut-055+suse.347.gdcb9bdbf/.kateconfig kate: space-indent on; tab-width 4; indent-width 4; replace-tabs on; eol unix;
 07070100000014000081A400000000000000000000000164DF2CB8000000B0000000000000000000000000000000000000002B00000000dracut-055+suse.347.gdcb9bdbf/.kateproject    {
  "name": "Dracut"
  , "files": [ { "git": 1 } ]
  , "build": {
    "directory": "./"
  , "build": "make -j $(getconf _NPROCESSORS_ONLN) all"
  , "clean": "make clean"
  }
}
07070100000015000081A400000000000000000000000164DF2CB80000085D000000000000000000000000000000000000002700000000dracut-055+suse.347.gdcb9bdbf/.mailmap    Philippe Seewer <philippe.seewer@bfh.ch> 	<philippe.seewer-omB+W0Dpw2o@public.gmane.org>
Seewer Philippe <philippe.seewer@bfh.ch> 	<philippe.seewer@bfh.ch>
Philippe Seewer <philippe.seewer@bfh.ch> 	<philippe.seewer@bfh.ch>
Victor Lowther <victor.lowther@gmail.com> 	<victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Harald Hoyer <harald@redhat.com> 		<harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Harald Hoyer <harald@redhat.com> 		<harald@eeepc.(none)>
Harald Hoyer <harald@redhat.com> 		<harald@hoyer.xyz>
Mike Snitzer <snitzer@redhat.com> 		<msnitzer@redhat.com>
Amerigo Wang <amwang@redhat.com> 		<xiyou.wangcong@gmail.com>
Andrey Borzenkov <arvidjaar@gmail.com> 		<arvidjaar@mail.ru>
Dan Horák <dhorak@redhat.com> 			<dan@danny.cz>
John Reiser <jreiser@bitwagon.com> 		<jreiser@BitWagon.com>
Luca Berra <bluca@vodka.it> 			<bluca@comedia.it>
Dave Young <dyoung@redhat.com>	 		<dyoung@redhat.com>
Dave Young <dyoung@redhat.com>	 		<dave@redhat.com>
Frederick Grose <fgrose@sugarlabs.org> 		<fgrose@gmail.com>
Frederic Crozat <fcrozat@suse.com> 		<fcrozat@mandriva.com>
Shawn W Dunn <sfalken@opensuse.org> 		<sfalken@opensuse.org>
Kyle McMartin <kmcmarti@redhat.com>             <kyle@redhat.com>
Angelo "pallotron" Failla <pallotron@fb.com>     <pallotron@fb.com>
Yu Watanabe <watanabe.yu+github@gmail.com>
Martin Wilck <mwilck@suse.de>   <mwilck@suse.com>
Thomas Renninger <trenn@suse.com>   <trenn@suse.de>
Andrey Borzenkov <arvidjaar@gmail.com>
Cristian Rodríguez <crrodriguez@opensuse.org>
Daniel Drake <drake@endlessm.com> <dsd@laptop.org>
Fabian Vogt <fvogt@suse.com>
Hannes Reinecke <hare@suse.com>  <hare@suse.de>
Julian Wolf <juwolf@suse.com>  <juwolf@suse.de>
Lidong Zhong <lidong.zhong@suse.com> <lzhong@suse.com>
Nikoli <nikoli@gmx.us> <nikoli@lavabit.com>
Peter Robinson <pbrobinson@fedoraproject.org> <pbrobinson@gmail.com>
Xunlei Pang <xlpang@redhat.com> <xpang@redhat.com>
Daniel Molkentin <daniel.molkentin@suse.com> <dmolkentin@suse.com>
Thomas Blume <thomas.blume@suse.com> <Thomas.Blume@suse.com>
Brian C. Lane <bcl@redhat.com> <bcl@brianlane.com>
Tomasz Paweł Gajc <tpgxyz@gmail.com> <tpgxyz@gmail.com>
   07070100000016000081A400000000000000000000000164DF2CB800000521000000000000000000000000000000000000002A00000000dracut-055+suse.347.gdcb9bdbf/.packit.yml # This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# The name of the upstream package
upstream_package_name: dracut

# The upstream tag versioning scheme
upstream_tag_template: "{version}"

# The URL of the upstream project
upstream_project_url: https://github.com/dracutdevs/dracut

# Relative path to a spec file within the upstream repository
specfile_path: pkgbuild/dracut.spec

# Name of the downstream package
downstream_package_name: dracut

# The URL of the downstream project
dist_git_base_url: https://src.fedoraproject.org/

# Sync file(s) from upstream repo to dist-git
synced_files:
  # The dracut spec file is maintained upstream so we sync it downstream.
  - dracut.spec
  # We sync the packit file downstream be able to optionally use the sync-from-downstream command
  - .packit.yaml

# We want new releases to be automatically built on rawhide and have few jobs
# on copr.
create_pr: false
jobs:
- job: propose_downstream
  trigger: release
  metadata:
    dist_git_branches: main

- job: tests
  trigger: pull_request
  metadata:
    targets:
      - fedora-rawhide

- job: copr_build
  trigger: pull_request
  metadata:
    targets:
      - fedora-development

- job: copr_build
  trigger: commit
  metadata:
    targets:
      - fedora-all
      - fedora-development
   07070100000017000081A400000000000000000000000164DF2CB800000403000000000000000000000000000000000000002C00000000dracut-055+suse.347.gdcb9bdbf/.shellcheckrc   # SC2039: In POSIX sh, 'local' is undefined.
# https://github.com/koalaman/shellcheck/wiki/SC2039
disable=SC2039

# SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
# https://github.com/koalaman/shellcheck/wiki/SC2166
disable=SC2166

# SC2154: Variable is referenced but not assigned
# https://github.com/koalaman/shellcheck/wiki/SC2154
disable=SC2154

# SC1091: Not following <file>
# https://github.com/koalaman/shellcheck/wiki/SC1091
disable=SC1091

# SC2174: When used with -p, -m only applies to the deepest directory.
# https://github.com/koalaman/shellcheck/wiki/SC2174
disable=SC2174

# SC3043: In POSIX sh, 'local' is undefined.
# https://github.com/koalaman/shellcheck/wiki/SC3043
# ... but dash supports it
disable=SC3043

# SC3013: In POSIX sh, -ef is undefined.
# https://github.com/koalaman/shellcheck/wiki/SC3013
# ... but dash supports it
disable=SC3013

# SC3045: In POSIX sh, read -p is undefined.
# https://github.com/koalaman/shellcheck/wiki/SC3045
# ... but dash supports it
disable=SC3045
 07070100000018000081A400000000000000000000000164DF2CB800000289000000000000000000000000000000000000002500000000dracut-055+suse.347.gdcb9bdbf/.vimrc  " Vim can use per directory configuration files like this.
" To enable that feature two lines are needed in your ~/.vimrc
" set exrc   " enables per-directory .vimrc files
" set secure   " disable unsafe commands in local .vimrc files
" Characters width is set to 109 for .c and XML but for everything else 79.
" If you update this file make sure to update .dir-locals.el & .editorconfig

set tabstop=4
set shiftwidth=4
set expandtab
set makeprg=GCC_COLORS=\ make
set tw=79
au BufRead,BufNewFile *.xml set tw=109 shiftwidth=2 smarttab
au FileType sh set tw=80 shiftwidth=4 smarttab
au FileType c set tw=109 shiftwidth=8 tabstop=8 smarttab expandtab
   07070100000019000081A400000000000000000000000164DF2CB800002E25000000000000000000000000000000000000002600000000dracut-055+suse.347.gdcb9bdbf/AUTHORS Harald Hoyer <harald@redhat.com>
Victor Lowther <victor.lowther@gmail.com>
Jóhann B. Guðmundsson <johannbg@gmail.com>
Amadeusz Żołnowski <aidecoe@aidecoe.name>
Daniel Molkentin <daniel.molkentin@suse.com>
Hannes Reinecke <hare@suse.com>
Kairui Song <kasong@redhat.com>
Will Woods <wwoods@redhat.com>
Philippe Seewer <philippe.seewer@bfh.ch>
Warren Togami <wtogami@redhat.com>
Dave Young <dyoung@redhat.com>
Jeremy Katz <katzj@redhat.com>
Lukas Nykryn <lnykryn@redhat.com>
David Dillow <dave@thedillows.org>
Lubomir Rintel <lkundrak@v3.sk>
Michal Soltys <soltys@ziu.info>
Colin Guthrie <colin@mageia.org>
Amerigo Wang <amwang@redhat.com>
Thomas Renninger <trenn@suse.com>
Alexander Tsoy <alexander@tsoy.me>
Martin Wilck <mwilck@suse.de>
Frederick Grose <fgrose@sugarlabs.org>
WANG Chao <chaowang@redhat.com>
Yu Watanabe <watanabe.yu+github@gmail.com>
Andrey Borzenkov <arvidjaar@gmail.com>
Hans de Goede <hdegoede@redhat.com>
Jonathan Lebon <jonathan@jlebon.com>
Peter Jones <pjones@redhat.com>
Peter Robinson <pbrobinson@fedoraproject.org>
Andreas Thienemann <andreas@bawue.net>
Frantisek Sumsal <frantisek@sumsal.cz>
Fabian Vogt <fvogt@suse.com>
Nicolas Chauvet <kwizart@gmail.com>
Tomasz Paweł Gajc <tpgxyz@gmail.com>
Zoltán Böszörményi <zboszor@pr.hu>
Beniamino Galvani <bgalvani@redhat.com>
Colin Walters <walters@verbum.org>
John Reiser <jreiser@bitwagon.com>
Luca Berra <bluca@vodka.it>
Xunlei Pang <xlpang@redhat.com>
Brian C. Lane <bcl@redhat.com>
Daniel Drake <drake@endlessm.com>
Renaud Métrich <rmetrich@redhat.com>
Angelo "pallotron" Failla <pallotron@fb.com>
Thomas Blume <thomas.blume@suse.com>
Ville Skyttä <ville.skytta@iki.fi>
Böszörményi Zoltán <zboszor@pr.hu>
Cristian Rodríguez <crrodriguez@opensuse.org>
Dan Horák <dhorak@redhat.com>
Javier Martinez Canillas <javierm@redhat.com>
Ondrej Mosnacek <omosnace@redhat.com>
Baoquan He <bhe@redhat.com>
Brendan Germain <brendan.germain@nasdaqomx.com>
David Tardon <dtardon@redhat.com>
Dusty Mabe <dusty@dustymabe.com>
Jonas Witschel <diabonas@gmx.de>
Leho Kraav <leho@kraav.com>
Marcos Mello <marcosfrm@gmail.com>
Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
Moritz Maxeiner <moritz@ucworks.org>
Nathan Rini <nate@ucar.edu>
Radek Vykydal <rvykydal@redhat.com>
Đoàn Trần Công Danh <congdanhqx@gmail.com>
Fabian Deutsch <fabiand@fedoraproject.org>
Kamil Rytarowski <n54@gmx.com>
Lidong Zhong <lidong.zhong@suse.com>
Marc Grimme <grimme@atix.de>
Mike Gilbert <floppym@gentoo.org>
NeilBrown <neilb@suse.de>
Peter Rajnoha <prajnoha@redhat.com>
Thorsten Behrens <tbehrens@suse.com>
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
q66 <daniel@octaforge.org>
Adam Williamson <awilliam@redhat.com>
Chao Wang <chaowang@redhat.com>
Frederic Crozat <fcrozat@suse.com>
James Lee <jlee@thestaticvoid.com>
Jesse Keating <jkeating@redhat.com>
Milan Broz <mbroz@redhat.com>
Mimi Zohar <zohar@linux.vnet.ibm.com>
Norbert Lange <norbert.lange@andritz.com>
Roberto Sassu <roberto.sassu@polito.it>
Stefan Reimer <it@startux.de>
Takashi Iwai <tiwai@suse.de>
Anton Blanchard <anton@samba.org>
Bill Nottingham <notting@redhat.com>
Chapman Flack <g2@anastigmatix.net>
Chris Leech <cleech@redhat.com>
David Cantrell <dcantrell@redhat.com>
Dennis Gilmore <dennis@ausil.us>
Doan Tran Cong Danh <congdanhqx@gmail.com>
Gaël PORTAY <gael.portay@collabora.com>
Jan Synacek <jsynacek@redhat.com>
Jiri Konecny <jkonecny@redhat.com>
Jon Ander Hernandez <jonan.h@gmail.com>
Juan RP <xtraeme@gmail.com>
Lance Albertson <lance@osuosl.org>
Marian Ganisin <mganisin@redhat.com>
Matthias Gerstner <matthias.gerstner@suse.de>
Max Resch <resch.max@gmail.com>
Michael Ploujnikov <plouj@somanetworks.com>
Pratyush Anand <panand@redhat.com>
Silvio Fricke <silvio.fricke@gmail.com>
Steven Brudenell <steven.brudenell@gmail.com>
Stig Telfer <stelfer@cray.com>
Thomas Backlund <tmb@mageia.org>
Topi Miettinen <toiwoton@gmail.com>
Vasiliy Tolstov <v.tolstov@selfip.ru>
Wim Muskee <wimmuskee@gmail.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Alan Pevec <apevec@redhat.com>
Alex Harpin <development@landsofshadow.co.uk>
Alexey Shabalin <shaba@altlinux.org>
Ankit Kumar <ankit@linux.vnet.ibm.com>
Antony Messerli <amesserl@rackspace.com>
Chao Fan <cfan@redhat.com>
Daniel Cordero <dracut@0xdc.io>
Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Daniel Schaal <farbing@web.de>
Denis Silakov <dsilakov@virtuozzo.com>
Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
Erwan Velu <erwan.velu@enovance.com>
Evgeny Vereshchagin <evvers@ya.ru>
Guido Trentalancia <guido@trentalancia.net>
Hari Bathini <hbathini@linux.vnet.ibm.com>
Ian Dall <ian@beware.dropbear.id.au>
Imran Haider <imran1008@gmail.com>
James Buren <ryuo@frugalware.org>
Jan Macku <jamacku@redhat.com>
Joey Boggs <jboggs@redhat.com>
Julian Wolf <juwolf@suse.com>
Koen Kooi <koen@dominion.thruhere.net>
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Kyle McMartin <kmcmarti@redhat.com>
Luiz Angelo Daros de Luca <luizluca@gmail.com>
Lukas Wunner <lukas@wunner.de>
Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Marko Myllynen <myllynen@redhat.com>
Matthew Thode <mthode@mthode.org>
Michal Koutný <mkoutny@suse.com>
Mike Snitzer <snitzer@redhat.com>
Minfei Huang <mhuang@redhat.com>
Nikoli <nikoli@gmx.us>
Patrick Talbert <ptalbert@redhat.com>
Pedro Monreal <pmgdeb@gmail.com>
Petr Pavlu <petr.pavlu@suse.com>
Pingfan Liu <piliu@redhat.com>
Przemysław Rudy <prudy1@o2.pl>
Robert LeBlanc <robert@leblancnet.us>
Robert Scheck <robert@fedoraproject.org>
Stefan Berger <stefanb@linux.ibm.com>
Stefan Berger <stefanb@us.ibm.com>
Thomas Lange <lange@informatik.uni-koeln.de>
Till Maas <opensource@till.name>
Tony Asleson <tasleson@redhat.com>
Vivek Goyal <vgoyal@redhat.com>
Vladislav Bogdanov <bubble@hoster-ok.com>
Érico Rolim <erico.erc@gmail.com>
наб <nabijaczleweli@nabijaczleweli.xyz>
A. Wilcox <AWilcox@Wilcox-Tech.com>
Adam Alves <adamoa@gmail.com>
Alexander Kurtz <alexander@kurtz.be>
Alexander Miroshnichenko <alex@millerson.name>
Alexander Sosedkin <asosedkin@redhat.com>
Alexander Todorov <atodorov@redhat.com>
Alexey Kodanev <alexey.kodanev@oracle.com>
Andreas Schwab <schwab@suse.de>
Andreas Stieger <astieger@suse.com>
Andrew J. Hesford <ajh@sideband.org>
Andy Lutomirski <luto@mit.edu>
Anjali Kulkarni <anjali.k.kulkarni@oracle.com>
Anssi Hannula <anssi@mageia.org>
Antz <antzz@protonmail.ch>
Arnaud Rebillout <arnaud.rebillout@collabora.com>
Artem Savkov <asavkov@redhat.com>
Attila Bruncsak <bruncsak@users.noreply.github.com>
B. Wilson <x@wilsonb.com>
Ben Howard <ben.howard@redhat.com>
Benjamin Marzinski <bmarzins@redhat.com>
Brandon Philips <brandon@ifup.co>
Bruno E. O. Meneguele <bmeneg@redhat.com>
Bryn M. Reeves <bmr@redhat.com>
Canek Peláez Valdés <caneko@gmail.com>
Carlo Caione <carlo@endlessm.com>
Chad Dupuis <chad.dupuis@cavium.com>
Christian Heinz <christian.ch.heinz@gmail.com>
Cong Wang <amwang@redhat.com>
Dan Fuhry <dfuhry@datto.com>
Dave Jones <davej@redhat.com>
David Disseldorp <ddiss@suse.de>
David Hildenbrand <david@redhat.com>
David Michael <david.michael@coreos.com>
Denis Volkov <denis@simpletexting.net>
Dennis Schridde <devurandom@gmx.net>
Derek Hageman <hageman@inthat.cloud>
Derek Higgins <derekh@redhat.com>
Donovan Tremura <neurognostic@protonmail.ch>
Duane Griffin <duaneg@dghda.com>
Elan Ruusamäe <glen@delfi.ee>
Enno Boland <g@s01.de>
Enzo Matsumiya <ematsumiya@suse.de>
Eugene S. Sobolev <sobolev@protei.ru>
Eugene Syromiatnikov <esyr@redhat.com>
Evgeni Golov <evgeni@golov.de>
Fabian Vogt <fvogt@suse.de>
Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
Florian Gamböck <mail@floga.de>
Frank Deng <frank.deng@oracle.com>
François Cami <fcami@fedoraproject.org>
Gerd von Egidy <gerd.von.egidy@intra2net.com>
Glen Gray <slaine@slaine.org>
GuoChuang <guo.chuang@zte.com.cn>
HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Hendrik Brueckner <brueckner@linux.ibm.com>
Hermann Gausterer <git-dracut-2012@mrq1.org>
Hiroaki Mizuguchi <hiroaki-m@iij.ad.jp>
Hongxu Jia <hongxu.jia@windriver.com>
Hui Wang <john.wanghui@huawei.com>
Ignaz Forster <iforster@suse.com>
Jacob Wen <jian.w.wen@oracle.com>
James Laska <jlaska@redhat.com>
Jan Stodola <jstodola@redhat.com>
Jaroslav Jindrak <dzejrou@gmail.com>
Jason Dana <jasondana@quarksecurity.com>
Jens Heise <46450477+heisej@users.noreply.github.com>
Jeremy Linton <lintonrjeremy@gmail.com>
Jiri Pirko <jiri@resnulli.us>
Joe Lawrence <Joe.Lawrence@stratus.com>
Johannes Thumshirn <jthumshirn@suse.com>
Jonas Jelten <jj@sft.lol>
Jonas Jonsson <jonas@websystem.se>
Jonas Witschel <diabonas@archlinux.org>
Kevin Yung <Kevin.Yung@myob.com>
Lars R. Damerow <lars@pixar.com>
Lars Wendler <polynomial-c@gentoo.org>
Lee Duncan <lduncan@suse.com>
Lennart Poettering <lennart@poettering.net>
Lennert Buytenhek <buytenh@wantstofly.org>
Lev Veyde <lveyde@redhat.com>
Lianbo Jiang <lijiang@redhat.com>
Lucas C. Villa Real <lucasvr@gmail.com>
Major Hayden <major@mhtx.net>
Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Marian Csontos <mcsontos@redhat.com>
Mark Fasheh <mfasheh@suse.de>
Matt <smoothsailing72@hotmail.com>
Matt Smith <shadowfax@gmx.com>
Mei Liu <liumbj@linux.vnet.ibm.com>
Michael Chapman <mike@very.puzzling.org>
Michael McCracken <michael.mccracken@gmail.com>
Michal Schmidt <mschmidt@redhat.com>
Michal Sekletar <msekleta@redhat.com>
Mike Gorse <mgorse@suse.com>
Moritz 'Morty' Strübe <morty@gmx.net>
Munehiro Matsuda <haro@kgt.co.jp>
Nicolas Porcel <nicolasporcel06@gmail.com>
Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Olivier Blin <dev@blino.org>
Ondrej Dubaj <odubaj@redhat.com>
P J P <ppandit@redhat.com>
Paolo Bonzini <pbonzini@redhat.com>
Paul Robins <exp@users.noreply.github.com>
Pavel Zhukov <pzhukov@redhat.com>
Pawel Wieczorkiewicz <pwieczorkiewicz@suse.de>
Pekka Wallendahl <wyrmiyu@gmail.com>
Peter Georg <peter.georg@physik.uni-regensburg.de>
Peter Levine <plevine457@gmail.com>
Petr Tesarik <ptesarik@suse.com>
Petr Vorel <pvorel@suse.cz>
Prarit Bhargava <prarit@redhat.com>
Praveen_Paladugu@Dell.com <Praveen_Paladugu@Dell.com>
Pádraig Brady <P@draigBrady.com>
Quentin Armitage <quentin@armitage.org.uk>
Robert Buchholz <rbu@goodpoint.de>
Ruben Kerkhof <ruben@rubenkerkhof.com>
Rumbaut Thomas <Thomas.Rumbaut@digipolis.gent>
Rusty Bird <rustybird@openmailbox.org>
Sebastian Mitterle <smitterl@redhat.com>
Sergei Iudin <tsipa740@gmail.com>
Sergey Fionov <fionov@gmail.com>
Shawn W Dunn <sfalken@opensuse.org>
Srinivasa T N <seenutn@linux.vnet.ibm.com>
Stijn Hoop <stijn@sandcat.nl>
Sullivan (CTR), Austin <austin.sullivan.ctr@progeny.net>
Thierry Vignaud <thierry.vignaud@gmail.com>
Thilo Bangert <thilo.bangert@gmx.net>
Thomas Abraham <tabraham@suse.com>
Tobias Geerinckx <tobias.geerinckx@gmail.com>
Tobias Klauser <tklauser@distanz.ch>
Tom Gundersen <teg@jklm.no>
Tomasz Torcz <tomek@pipebreaker.pl>
Tong Li <tonli@redhat.com>
Vadim Kuznetsov <vadimk@gentoo.org>
Vaughan Cao <vaughan.cao@oracle.com>
Vladius25 <vkorol2509@icloud.com>
Vratislav Podzimek <vpodzime@redhat.com>
Yang Liu <50459973+ly4096x@users.noreply.github.com>
Yanko Kaneti <yaneti@declera.com>
Zhiguo Deng <bjzgdeng@linux.vnet.ibm.com>
Ziyue Yang <ziyang@redhat.com>
foopub <45460217+foopub@users.noreply.github.com>
gaoyi <ymuemc@163.com>
honza801 <honza801@gmail.com>
jbash aka John Bashinski <jbash@velvet.com>
jloeser <jloeser@suse.de>
johannes <johannes.brechtmann@gmail.com>
jonathan-teh <30538043+jonathan-teh@users.noreply.github.com>
leo-lb <lle-bout@zaclys.net>
logan <logancaldwell23@gmail.com>
masem <matej.semian@gmail.com>
maximilian attems <max@stro.at>
mulhern <amulhern@redhat.com>
mwberry <mwberry@users.noreply.github.com>
nabijaczleweli <nabijaczleweli@gmail.com>
privb0x23 <privb0x23@users.noreply.github.com>
realtime-neil <neil@rtr.ai>
xtraeme <xtraeme@voidlinux.eu>
Дамјан Георгиевски <gdamjan@gmail.com>
   0707010000001A000081A400000000000000000000000164DF2CB8000046AC000000000000000000000000000000000000002600000000dracut-055+suse.347.gdcb9bdbf/COPYING                     GNU GENERAL PUBLIC LICENSE
                       Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.)  You can apply it to
your programs, too.

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

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

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

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

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

                    GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.

    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

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

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

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

                            NO WARRANTY

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

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

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

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

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

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

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

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

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

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

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

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

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
0707010000001B000081A400000000000000000000000164DF2CB800003715000000000000000000000000000000000000002700000000dracut-055+suse.347.gdcb9bdbf/Makefile    -include dracut-version.sh

DRACUT_MAIN_VERSION ?= $(shell env GIT_CEILING_DIRECTORIES=$(CWD)/.. git describe --abbrev=0 --tags --always 2>/dev/null || :)
ifeq ($(DRACUT_MAIN_VERSION),)
DRACUT_MAIN_VERSION = $(DRACUT_VERSION)
endif
DRACUT_FULL_VERSION ?= $(shell env GIT_CEILING_DIRECTORIES=$(CWD)/.. git describe --tags --always 2>/dev/null || :)
ifeq ($(DRACUT_FULL_VERSION),)
DRACUT_FULL_VERSION = $(DRACUT_VERSION)
endif

HAVE_SHELLCHECK ?= $(shell which shellcheck >/dev/null 2>&1 && echo yes)
HAVE_SHFMT ?= $(shell which shfmt >/dev/null  2>&1 && echo yes)
HAVE_RPMBUILD ?= $(shell which rpmbuild >/dev/null  2>&1 && echo yes)

-include Makefile.inc

KVERSION ?= $(shell uname -r)

prefix ?= /usr
libdir ?= ${prefix}/lib
datadir ?= ${prefix}/share
pkglibdir ?= ${libdir}/dracut
sysconfdir ?= ${prefix}/etc
bindir ?= ${prefix}/bin
mandir ?= ${prefix}/share/man
CFLAGS ?= -O2 -g -Wall -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
bashcompletiondir ?= ${datadir}/bash-completion/completions
pkgconfigdatadir ?= $(datadir)/pkgconfig

man1pages = man/lsinitrd.1

man5pages = man/dracut.conf.5

man7pages = man/dracut.cmdline.7 \
            man/dracut.bootup.7 \
            man/dracut.modules.7

man8pages = man/dracut.8 \
            man/dracut-catimages.8 \
            suse/mkinitrd-suse.8 \
            modules.d/98dracut-systemd/dracut-cmdline.service.8 \
            modules.d/98dracut-systemd/dracut-initqueue.service.8 \
            modules.d/98dracut-systemd/dracut-mount.service.8 \
            modules.d/98dracut-systemd/dracut-shutdown.service.8 \
            modules.d/98dracut-systemd/dracut-pre-mount.service.8 \
            modules.d/98dracut-systemd/dracut-pre-pivot.service.8 \
            modules.d/98dracut-systemd/dracut-pre-trigger.service.8 \
            modules.d/98dracut-systemd/dracut-pre-udev.service.8

manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)

.PHONY: install clean archive rpm srpm testimage test all check AUTHORS CONTRIBUTORS doc dracut-version.sh

all: dracut-version.sh dracut.pc dracut-install src/skipcpio/skipcpio dracut-util

%.o : %.c
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $(KMOD_CFLAGS) $< -o $@

DRACUT_INSTALL_OBJECTS = \
        src/install/dracut-install.o \
        src/install/hashmap.o\
        src/install/log.o \
        src/install/strv.o \
        src/install/util.o

# deps generated with gcc -MM
src/install/dracut-install.o: src/install/dracut-install.c src/install/log.h src/install/macro.h \
	src/install/hashmap.h src/install/util.h
src/install/hashmap.o: src/install/hashmap.c src/install/util.h src/install/macro.h src/install/log.h \
	src/install/hashmap.h
src/install/log.o: src/install/log.c src/install/log.h src/install/macro.h src/install/util.h
src/install/util.o: src/install/util.c src/install/util.h src/install/macro.h src/install/log.h
src/install/strv.o: src/install/strv.c src/install/strv.h src/install/util.h src/install/macro.h src/install/log.h

src/install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
	$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(FTS_LIBS) $(KMOD_LIBS)

logtee: src/logtee/logtee.c
	$(CC) $(LDFLAGS) -o $@ $<

dracut-install: src/install/dracut-install
	ln -fs $< $@

SKIPCPIO_OBJECTS = src/skipcpio/skipcpio.o
skipcpio/skipcpio.o: src/skipcpio/skipcpio.c
skipcpio/skipcpio: $(SKIPCPIO_OBJECTS)

UTIL_OBJECTS = src/util/util.o
util/util.o: src/util/util.c
util/util: $(UTIL_OBJECTS)

dracut-util: src/util/util
	cp -a $< $@

.PHONY: indent-c
indent-c:
	astyle -n --quiet --options=.astylerc $(wildcard *.[ch] */*.[ch] src/*/*.[ch])

.PHONY: indent
indent: indent-c
ifeq ($(HAVE_SHFMT),yes)
	shfmt -w -s .
endif

src/dracut-cpio/target/release/dracut-cpio: src/dracut-cpio/src/main.rs
	cargo --offline build --release --manifest-path src/dracut-cpio/Cargo.toml

dracut-cpio: src/dracut-cpio/target/release/dracut-cpio
	ln -fs $< $@

ifeq ($(enable_dracut_cpio),yes)
all: dracut-cpio
endif

doc: $(manpages) dracut.html

ifneq ($(enable_documentation),no)
all: doc
endif

%: %.xml
	@rm -f -- "$@"
	xsltproc -o "$@" -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<

%.xml: %.asc
	@rm -f -- "$@"
	asciidoc -a "version=$(DRACUT_FULL_VERSION)" -d manpage -b docbook -o "$@" $<

dracut.8: man/dracut.8.asc \
	man/dracut.usage.asc

dracut.html: man/dracut.asc $(manpages) docs/dracut.css man/dracut.usage.asc
	@rm -f -- dracut.xml
	asciidoc -a "mainversion=$(DRACUT_MAIN_VERSION)" \
		-a "version=$(DRACUT_FULL_VERSION)" \
		-a numbered \
		-d book -b docbook -o dracut.xml man/dracut.asc
	@rm -f -- dracut.html
	xsltproc -o dracut.html --xinclude -nonet \
		--stringparam custom.css.source docs/dracut.css \
		--stringparam generate.css.header 1 \
		http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
	@rm -f -- dracut.xml

dracut.pc: Makefile.inc Makefile
	@echo "Name: dracut" > dracut.pc
	@echo "Description: dracut" >> dracut.pc
	@echo "Version: $(DRACUT_FULL_VERSION)" >> dracut.pc
	@echo "dracutdir=$(pkglibdir)" >> dracut.pc
	@echo "dracutmodulesdir=$(pkglibdir)/modules.d" >> dracut.pc
	@echo "dracutconfdir=$(pkglibdir)/dracut.conf.d" >> dracut.pc

install: all
	mkdir -p $(DESTDIR)$(pkglibdir)
	mkdir -p $(DESTDIR)$(bindir)
	mkdir -p $(DESTDIR)$(sysconfdir)
	mkdir -p $(DESTDIR)$(pkglibdir)/modules.d
	mkdir -p $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man5 $(DESTDIR)$(mandir)/man7 $(DESTDIR)$(mandir)/man8
	install -m 0755 dracut.sh $(DESTDIR)$(bindir)/dracut
	install -m 0755 dracut-catimages.sh $(DESTDIR)$(bindir)/dracut-catimages
	install -m 0755 lsinitrd.sh $(DESTDIR)$(bindir)/lsinitrd
	install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
	mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
	mkdir -p $(DESTDIR)$(pkglibdir)/dracut.conf.d
	install -m 0755 dracut-init.sh $(DESTDIR)$(pkglibdir)/dracut-init.sh
	install -m 0755 dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions.sh
	install -m 0755 dracut-version.sh $(DESTDIR)$(pkglibdir)/dracut-version.sh
	ln -fs dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
	install -m 0755 dracut-logger.sh $(DESTDIR)$(pkglibdir)/dracut-logger.sh
	install -m 0755 dracut-initramfs-restore.sh $(DESTDIR)$(pkglibdir)/dracut-initramfs-restore
	cp -arx modules.d $(DESTDIR)$(pkglibdir)
ifneq ($(enable_documentation),no)
	for i in $(man1pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man1/$${i##*/}; done
	for i in $(man5pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man5/$${i##*/}; done
	for i in $(man7pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man7/$${i##*/}; done
	for i in $(man8pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man8/$${i##*/}; done
	ln -fs dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.kernel.7
endif
	if [ -n "$(systemdsystemunitdir)" ]; then \
		mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
		ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown.service; \
		mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants; \
		ln -s ../dracut-shutdown.service \
		$(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants/dracut-shutdown.service; \
		mkdir -p $(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants; \
		for i in \
		    dracut-cmdline.service \
		    dracut-initqueue.service \
		    dracut-mount.service \
		    dracut-pre-mount.service \
		    dracut-pre-pivot.service \
		    dracut-pre-trigger.service \
		    dracut-pre-udev.service \
		    ; do \
			ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/$$i $(DESTDIR)$(systemdsystemunitdir); \
			ln -s ../$$i \
			$(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants/$$i; \
		done \
	fi
	if [ -f src/install/dracut-install ]; then \
		install -m 0755 src/install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
	fi
	if [ -f src/skipcpio/skipcpio ]; then \
		install -m 0755 src/skipcpio/skipcpio $(DESTDIR)$(pkglibdir)/skipcpio; \
	fi
	if [ -f dracut-util ]; then \
		install -m 0755 dracut-util $(DESTDIR)$(pkglibdir)/dracut-util; \
	fi
ifeq ($(enable_dracut_cpio),yes)
	install -m 0755 dracut-cpio $(DESTDIR)$(pkglibdir)/dracut-cpio
endif
	mkdir -p $(DESTDIR)${prefix}/lib/kernel/install.d
	install -m 0755 install.d/50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install
	install -m 0755 install.d/51-dracut-rescue.install $(DESTDIR)${prefix}/lib/kernel/install.d/51-dracut-rescue.install
	mkdir -p $(DESTDIR)${bashcompletiondir}
	install -m 0644 shell-completion/bash/dracut $(DESTDIR)${bashcompletiondir}/dracut
	install -m 0644 shell-completion/bash/lsinitrd $(DESTDIR)${bashcompletiondir}/lsinitrd
	mkdir -p $(DESTDIR)${pkgconfigdatadir}
	install -m 0644 dracut.pc $(DESTDIR)${pkgconfigdatadir}/dracut.pc

dracut-version.sh:
	@rm -f dracut-version.sh
	@printf "#!/bin/sh\n# shellcheck disable=SC2034\nDRACUT_VERSION=%s\n" "$(DRACUT_FULL_VERSION)" > dracut-version.sh

clean:
	$(RM) *~
	$(RM) */*~
	$(RM) */*/*~
	$(RM) $(manpages:%=%.xml) dracut.xml
	$(RM) test-*.img
	$(RM) dracut-*.rpm dracut-*.tar.bz2 dracut-*.tar.xz
	$(RM) dracut-version.sh
	$(RM) dracut-install src/install/dracut-install $(DRACUT_INSTALL_OBJECTS)
	$(RM) skipcpio/skipcpio $(SKIPCPIO_OBJECTS)
	$(RM) dracut-util util/util $(UTIL_OBJECTS)
	$(RM) $(manpages) dracut.html
	$(RM) dracut.pc
	$(RM) dracut-cpio src/dracut-cpio/target/release/dracut-cpio*
	$(MAKE) -C test clean

dist: dracut-$(DRACUT_MAIN_VERSION).tar.xz

dracut-$(DRACUT_MAIN_VERSION).tar.xz: doc syncheck
	@echo "DRACUT_VERSION=$(DRACUT_MAIN_VERSION)" > dracut-version.sh
	git archive --format=tar $(DRACUT_MAIN_VERSION) --prefix=dracut-$(DRACUT_MAIN_VERSION)/ > dracut-$(DRACUT_MAIN_VERSION).tar
	mkdir -p dracut-$(DRACUT_MAIN_VERSION)
	for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(DRACUT_MAIN_VERSION)/$${i%/*}"; cp "$$i" "dracut-$(DRACUT_MAIN_VERSION)/$$i"; done
	tar --owner=root --group=root -rf dracut-$(DRACUT_MAIN_VERSION).tar $$(find dracut-$(DRACUT_MAIN_VERSION) -type f)
	rm -fr -- dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut-$(DRACUT_MAIN_VERSION)
	xz -9 dracut-$(DRACUT_MAIN_VERSION).tar
	rm -f -- dracut-$(DRACUT_MAIN_VERSION).tar

ifeq ($(HAVE_RPMBUILD),yes)
rpm: dracut-$(DRACUT_MAIN_VERSION).tar.xz syncheck
	rpmbuild=$$(mktemp -d -p /var/tmp rpmbuild-dracut.XXXXXX); src=$$(pwd); \
	cp dracut-$(DRACUT_MAIN_VERSION).tar.xz "$$rpmbuild"; \
	LC_MESSAGES=C $$src/tools/git2spec.pl $(DRACUT_MAIN_VERSION) "$$rpmbuild" < pkgbuild/dracut.spec > $$rpmbuild/dracut.spec; \
	(cd "$$rpmbuild"; \
	wget https://www.gnu.org/licenses/lgpl-2.1.txt; \
	rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
	        --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
		--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
	( mv "$$rpmbuild"/{,$$(uname -m)/}*.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )

srpm: dracut-$(DRACUT_MAIN_VERSION).tar.xz syncheck
	rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
	cp dracut-$(DRACUT_MAIN_VERSION).tar.xz "$$rpmbuild"; \
	LC_MESSAGES=C $$src/tools/git2spec.pl $(DRACUT_MAIN_VERSION) "$$rpmbuild" < pkgbuild/dracut.spec > $$rpmbuild/dracut.spec; \
	(cd "$$rpmbuild"; \
	[ -f $$src/lgpl-2.1.txt ] && cp $$src/lgpl-2.1.txt . || wget https://www.gnu.org/licenses/lgpl-2.1.txt; \
	rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
	        --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
		--define "_rpmdir $$PWD" -bs dracut.spec; ) && \
	( mv "$$rpmbuild"/*.src.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
else
.PHONY: rpm srpm
rpm: syncheck
srpm: syncheck
endif

syncheck:
	@ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \
                [ "$${i##*/}" = "module-setup.sh" ] && continue; \
                read line < "$$i"; [ "$${line#*bash*}" != "$$line" ] && continue; \
		[ $$V ] && echo "posix syntax check: $$i"; bash --posix -n "$$i" ; ret=$$(($$ret+$$?)); \
		[ $$V ] && echo "checking for [[: $$i"; if grep -Fq '[[ ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains [["; fi; \
		[ $$V ] && echo "checking for echo -n: $$i"; if grep -Fq 'echo -n ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains echo -n"; fi \
	done;exit $$ret
	@ret=0;for i in *.sh modules.d/*/*.sh modules.d/*/module-setup.sh; do \
		[ $$V ] && echo "bash syntax check: $$i"; bash -n "$$i" ; ret=$$(($$ret+$$?)); \
	done;exit $$ret
ifeq ($(HAVE_SHELLCHECK),yes)
ifeq ($(HAVE_SHFMT),yes)
	shellcheck $$(shfmt -f .)
else
	find . -name '*.sh' -print0 | xargs -0 shellcheck
endif
endif

check: all syncheck rpm
	@[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; }
	@$(MAKE) -C test check

testimage: all
	./dracut.sh -N -l -a debug -f test-$(KVERSION).img $(KVERSION)
	@echo wrote  test-$(KVERSION).img

debugtestimage: all
	./dracut.sh --debug -l -a debug -f test-$(KVERSION).img $(KVERSION)
	@echo wrote  test-$(KVERSION).img

testimages: all
	./dracut.sh -l -a debug --kernel-only -f test-kernel-$(KVERSION).img $(KVERSION)
	@echo wrote  test-$(KVERSION).img
	./dracut.sh -l -a debug --no-kernel -f test-dracut.img $(KVERSION)
	@echo wrote  test-dracut.img

debughostimage: all
	./dracut.sh --debug -H -l -f test-$(KVERSION).img $(KVERSION)
	@echo wrote  test-$(KVERSION).img

hostimage: all
	./dracut.sh -H -l -f test-$(KVERSION).img $(KVERSION)
	@echo wrote  test-$(KVERSION).img

efi: all
	./dracut.sh --uefi -H -l -f linux-$(KVERSION).efi $(KVERSION)
	@echo wrote linux-$(KVERSION).efi

AUTHORS:
	git shortlog  --numbered --summary -e |while read a rest || [ -n "$$rest" ]; do echo $$rest;done > AUTHORS

CONTRIBUTORS:
	@git shortlog $(DRACUT_MAIN_VERSION).. --numbered --summary -e |while read a rest || [ -n "$$rest" ]; do echo "- $$rest";done

dracut.html.sign: dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut.html
	gpg-sign-all dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut.html

upload: dracut.html.sign
	kup put dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut-$(DRACUT_MAIN_VERSION).tar.sign /pub/linux/utils/boot/dracut/
	kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/
   0707010000001C000081A400000000000000000000000164DF2CB80001660A000000000000000000000000000000000000002600000000dracut-055+suse.347.gdcb9bdbf/NEWS.md [Rendered view](https://github.com/dracutdevs/dracut/blob/master/NEWS.md)

dracut-055
==========

#### Bug Fixes

* **base:**
    *  add missing `str_replace` to `dracut-dev-lib.sh` ([148e420b](https://github.com/dracutdevs/dracut/commit/148e420be5b5809aa8d5033f47477573bbbf3e60))
    *  split out `dracut-dev-lib.sh` ([c08bc810](https://github.com/dracutdevs/dracut/commit/c08bc8109d4c43beacfa4bcdc20a356102da6d02))
* **bash:**  minor cleanups ([9355cb8e](https://github.com/dracutdevs/dracut/commit/9355cb8ea5024533210067373657dc337d63ecb9))
* **dash:**  minor cleanups ([f4ea5f87](https://github.com/dracutdevs/dracut/commit/f4ea5f8734c4636f7d6db78da76e9525beb9a0ac))
* **dracut:**  pipe hardlink output to `dinfo` ([0a6007bf](https://github.com/dracutdevs/dracut/commit/0a6007bf4f472565d2c0c205a56edea7ba3e3bc3))
* **dracut-functions:**  get_maj_min without get_maj_min_cache_file set ([a277a5fc](https://github.com/dracutdevs/dracut/commit/a277a5fc7acc0a9e8d853f09671495f9d27645c1))
* **dracut-util:**  print error message with trailing newline ([b9b6f0ee](https://github.com/dracutdevs/dracut/commit/b9b6f0ee5b859a562e46a8c4e0dee0261fabf74d))
* **fs-lib:**  install fsck utilities ([12beeac7](https://github.com/dracutdevs/dracut/commit/12beeac741e4429146a674ef4ea9aa0bac10364b))
* **install:**
    *  configure logging earlier ([5eb24aa2](https://github.com/dracutdevs/dracut/commit/5eb24aa21d3ee639f869c2e363b3fb0b98be552b))
    *  sane default --kerneldir ([c1ab3613](https://github.com/dracutdevs/dracut/commit/c1ab36139d416e580e768c29f2addf7ccbc2c612), closes [#1505](https://github.com/dracutdevs/dracut/issues/1505))
* **integrity:**  require ALLOW_METADATA_WRITES to come from EVM config file ([b12d91c4](https://github.com/dracutdevs/dracut/commit/b12d91c431220488fecf7b4be82427e3560560cb))
* **mksh:**  minor cleanups ([6c673298](https://github.com/dracutdevs/dracut/commit/6c673298f36990665467564e6114c9ca2530f584))
* **squash:**  don't mount the mount points if already mounted ([636d6df3](https://github.com/dracutdevs/dracut/commit/636d6df3134dde1dac72241937724bc59deb9303))
* **warpclock:**  minor cleanups ([7d205598](https://github.com/dracutdevs/dracut/commit/7d205598c6a500b58b4d328e824d0446276f7ced))

#### Features

* **dracut.sh:**  detect running in a container ([7275c6f6](https://github.com/dracutdevs/dracut/commit/7275c6f6a0f6808cd939ea5bdf1244c7bd13ba44))
* **install:**  add default value for --firmwaredirs ([4cb086fa](https://github.com/dracutdevs/dracut/commit/4cb086fa2995799b95c0b25bc9a0cf72ba3868ea))

#### Contributors

- Harald Hoyer <harald@redhat.com>
- Jóhann B. Guðmundsson <johannbg@gmail.com>
- Marcos Mello <marcosfrm@gmail.com>
- Kairui Song <kasong@redhat.com>
- Lars Wendler <polynomial-c@gentoo.org>
- Stefan Berger <stefanb@linux.ibm.com>
- Tomasz Paweł Gajc <tpgxyz@gmail.com>

dracut-054
==========

With this release dracut has undergone a major overhaul.

A lot of systemd related modules have been added.

The integration test suite has finally ironed out the flaky behaviour due to the parallel device probing of the kernel,
which bit sometimes in the non-kvm github CI. So, if you see any `/dev/sda` in a setup script with more than two hard drives,
chances are, that the script works on the wrong disk. Same goes for network interfaces.

This release is also fully `shellcheck`'ed with `ShellCheck-0.7.2` and indented with `shfmt` and `astyle`.

The dracut project builds test containers every day for:
* `opensuse/tumbleweed-dnf:latest`
* `archlinux:latest`
* `fedora:rawhide`
* `fedora:latest`
* `fedora:33`

These containers can easily be used to run the integration tests locally without root permissions via `podman`.
We hope this serves as a blueprint for your distribution's CI process.

More information can be found in [docs/HACKING.md](https://github.com/dracutdevs/dracut/blob/master/HACKING.md).

#### Bug Fixes

*   make testsuite pass on OpenSuse and Arch ([8b2afb08](https://github.com/dracutdevs/dracut/commit/8b2afb08baea7fc6e15ece94e287dcc4a008bcc4))
*   cope with distributions with `/usr/etc` files ([3ad3b3a4](https://github.com/dracutdevs/dracut/commit/3ad3b3a40d419c4386b2924f6ac25ab0c355d131))
*   deprecate gummiboot ([5c94cf41](https://github.com/dracutdevs/dracut/commit/5c94cf41e8937b6fbb72c96bc54c84fdf224c711))
*   set vimrc and emacs indention according to .editorconfig ([9012f399](https://github.com/dracutdevs/dracut/commit/9012f3996b1e5f0788f8e80dfdd5c9ab0636c355))
*   correctly handle kernel parameters ([501d82f7](https://github.com/dracutdevs/dracut/commit/501d82f79675a6bf9b37e8250152515863a80236))
*   remove dracut.pc on `make clean` ([d643156d](https://github.com/dracutdevs/dracut/commit/d643156d561d3aca816d75e403149db073617292))
*   honor KVERSION environment in the Makefile ([d8a454a5](https://github.com/dracutdevs/dracut/commit/d8a454a537c6de95033dec7d83c622fdc46c2a4f))
*   always use mkdir -p ([9cf7b1c5](https://github.com/dracutdevs/dracut/commit/9cf7b1c529442d5abd6eaec4399d4ee77b95145e))
* **dracut.sh:**
    *  prevent symbolic links containing `//` ([de0c0872](https://github.com/dracutdevs/dracut/commit/de0c0872fc858fa9ca952f79ea9f00be17c37a4c))
    *  adding missing globalvars for udev ([f35d479d](https://github.com/dracutdevs/dracut/commit/f35d479d2b718da54886a66d3b7af2132215f80a))
    *  sysctl global variables ([3ca9aa1d](https://github.com/dracutdevs/dracut/commit/3ca9aa1d7b24b82e01d16613b86ec3be97c8a1bb))
    *  add global vars for modules-load ([ec4539c6](https://github.com/dracutdevs/dracut/commit/ec4539c6066edf25e52ed8e2d35c4be7ef39f729))
    *  omission is an addition to other omissions in conf files ([96c31333](https://github.com/dracutdevs/dracut/commit/96c313333d1a4f5e2c524a3a11c5b3aab24afc20))
    *  harden dracut against GZIP environment variable ([d8e47e20](https://github.com/dracutdevs/dracut/commit/d8e47e201af4646e2a82e11220ea9c993bd2ed48))
    *   add a missing tmpfilesconfdir global variable ([8849dd8d](https://github.com/dracutdevs/dracut/commit/8849dd8d1a74a46cb761c4d8041e4582d4686724))
    *   include `modules.builtin.alias` in the initramfs ([7f633747](https://github.com/dracutdevs/dracut/commit/7f6337471312486934f9592c1c7c05ed68694454))
    *   install all depmod relevant configuration files ([50a01dd4](https://github.com/dracutdevs/dracut/commit/50a01dd4b28471c0dfa810a705e219963bd5ec3c))
    *   add `modules.builtin.modinfo` to the initramfs ([87c4c178](https://github.com/dracutdevs/dracut/commit/87c4c17850e8bb982f6c07a6d3f58124bb2875de))
    *   search for btrfs devices from actual mount poiont ([3fdc734a](https://github.com/dracutdevs/dracut/commit/3fdc734a5cc8c0b94c1da49439181d540c8a5c43))
* **dracut-functions.sh:**
    *  implement a cache for get_maj_min ([c3bb9d18](https://github.com/dracutdevs/dracut/commit/c3bb9d18dceed7db6d16f9c2a7f682c5934099d7))
    *  word splitting issue for sed in get_ucode_file ([122657b2](https://github.com/dracutdevs/dracut/commit/122657b2fedf13991597830cca4d4ddbc8038233))
* **dracut-logger.sh:**  double dash trigger unknown logger warnings during run ([4fbccde5](https://github.com/dracutdevs/dracut/commit/4fbccde50456f513d388cdfd858018cd889890dc))
* **dracut-install:**
    *  handle $LIB in ldd output parsing ([d1a36d3d](https://github.com/dracutdevs/dracut/commit/d1a36d3d80b0ed71ee814659e18a020c53cee05e))
    *  handle builtin modules ([2536a9ea](https://github.com/dracutdevs/dracut/commit/2536a9eaffbc9cc14c85579a2f537d3f3a1d5659))
* **base:**
    *  suppress calls to getarg in build phase ([6feaaabc](https://github.com/dracutdevs/dracut/commit/6feaaabc221ffbf79f652cbee3eea58f02449c50))
    *  source hooks without exec ([8059bcb2](https://github.com/dracutdevs/dracut/commit/8059bcb2c8df4d60cc2f548d3c53db25d815a7be))
    *  wait_for_dev quote shell variables ([b800edd6](https://github.com/dracutdevs/dracut/commit/b800edd69817b5e46d5f240b96d3b3648267ea21))
    *  adding crc32c for ext3 ([61f45643](https://github.com/dracutdevs/dracut/commit/61f456435879f084a1bf2c8885eaf37070035abf))
* **crypt:**
    *  install all crypto modules in the generic initrd ([10f9e569](https://github.com/dracutdevs/dracut/commit/10f9e569c52654ff54678a626a0f5dd14233716d))
    *  include cryptsetups tmpfile ([a4cc1964](https://github.com/dracutdevs/dracut/commit/a4cc196467e45f093fab7876c1c6b40798058920))
* **crypt-gpg:**
    *  cope with different scdaemon location ([44fd1c13](https://github.com/dracutdevs/dracut/commit/44fd1c13555f2e12bb566c246948629ada27d14d))
* **dbus-broker:**
    *  enable the service ([df1e5f06](https://github.com/dracutdevs/dracut/commit/df1e5f06a5449dcec6749baf742eac6eb1f0aa53))
* **dbus-daemon:**
    *  only error out in install() ([ae4fbb3d](https://github.com/dracutdevs/dracut/commit/ae4fbb3db4136e6e03a1c74d05ecc2a73b916401))
* **dracut-systemd:**
    *  don't refuse root=tmpfs when systemd is used ([a96900a8](https://github.com/dracutdevs/dracut/commit/a96900a82c3a8ec1ed2c6b2cc8862f912093fa0c))
* **examples:**  remove the examples directory and reference to it ([b37c90c8](https://github.com/dracutdevs/dracut/commit/b37c90c8e00155a1f31237ae6cf91a81677c4df5))
* **fips:**
    *  add dh and ecdh ciphers ([543b8014](https://github.com/dracutdevs/dracut/commit/543b8014fc10fc6a92ba83db0dfc994fc1d2129b))
    *  remove old udev version requirements ([be30d987](https://github.com/dracutdevs/dracut/commit/be30d98751cff4ace660215305e2468943a45754))
* **i18n:**
    *  skip if data is missing ([651fe01e](https://github.com/dracutdevs/dracut/commit/651fe01e7937d86bbd471d9621581bed44f23dfa))
* **img-lib:**
    *  ignored null byte in input ([85eb9680](https://github.com/dracutdevs/dracut/commit/85eb96802cb82ec179bd3bc429b0dad2518946c5))
* **integrity:**
    *  properly set up EVM when using an x509 cert ([4bdd7eb2](https://github.com/dracutdevs/dracut/commit/4bdd7eb23a8187c3f19797e47eee8c672cea33ae))
* **iscsi:**
    *  replace sed call with bash internals ([66b920c6](https://github.com/dracutdevs/dracut/commit/66b920c65143f4cac80385a51704ae9483305569))
    *  add iscsid.service requirements ([bb6770f1](https://github.com/dracutdevs/dracut/commit/bb6770f1a413bdc7fd570b260ee28ace1255a195))
    *  only rely on socket activiation ([0eb87d78](https://github.com/dracutdevs/dracut/commit/0eb87d78108aae9aa4692f1edfb33ded50e26409))
* **kernel-modules:**
    *  optionally add /usr/lib/modules.d to initramfs ([92e6a8f8](https://github.com/dracutdevs/dracut/commit/92e6a8f87914322994387e559cf2a00b1760b301))
    *  add watchdog drivers for generic initrd ([3a60c036](https://github.com/dracutdevs/dracut/commit/3a60c036db7caccda95475d33c8d4ce1f615d2c8))
* **mdraid:**
    *  remove dependency statements ([86b75634](https://github.com/dracutdevs/dracut/commit/86b756346a6b7c5cb5f6fda4d12e2a58b6144e40))
* **memstrack:**
    *  correct dependencies ([c2ecc4d1](https://github.com/dracutdevs/dracut/commit/c2ecc4d131876383b47820a2e8d1a6f8a11716d9))
* **multipath:**
    *  stop multipath before udev db cleanup ([3c244c7c](https://github.com/dracutdevs/dracut/commit/3c244c7ca3555b526883dc20104c469b39085cbe))
    *  revise multipathd-stop ([7b8c78ff](https://github.com/dracutdevs/dracut/commit/7b8c78ff43a1f8e3690969e980d3d9d1dcb00c87))
* **nbd:**
    *  assume nbd version >= 3.8 ([6209edeb](https://github.com/dracutdevs/dracut/commit/6209edeb5c7783d94867829bf052aa53c78a1efe))
    *  remove old udev version requirements ([fd15dbad](https://github.com/dracutdevs/dracut/commit/fd15dbad6ebad86a3753a03f98706010f3e36cf7))
    *  make nbd work again with systemd ([77906443](https://github.com/dracutdevs/dracut/commit/7790644362622097aa69107920fd26b688c855d3))
* **network:**
    *  use wicked unit instead of find_binary ([57eefcf7](https://github.com/dracutdevs/dracut/commit/57eefcf70587f06b8874a3b3cf31e9ab70c03227))
    *  user variable for sdnetworkd instead of path ([4982e16d](https://github.com/dracutdevs/dracut/commit/4982e16dd53dcbbcfbd3a6b59013a0d6f893f840))
    *  correct regression in iface_has_carrier ([36af0518](https://github.com/dracutdevs/dracut/commit/36af0518b3fe59442de206c24bbe03be6fc17095))
* **network-legacy:**
    *  add missing options to dhclient.conf ([abfd547a](https://github.com/dracutdevs/dracut/commit/abfd547a85230a4520df65280aaf195f319df464))
    *  silence getargs ([60a34d8b](https://github.com/dracutdevs/dracut/commit/60a34d8b11dd50b2cd4e0e2208bd7c5e0fc48b71))
* **network-manager:**
    *  cope with distributions not using `libexec` ([22d6863e](https://github.com/dracutdevs/dracut/commit/22d6863ef1b2eb2a22264f2bfdb2b9329ab5dfdb))
    *  set timeout via command line option ([8a51ee1f](https://github.com/dracutdevs/dracut/commit/8a51ee1fa61bd3da342be53e35730837afd2caad))
    *  run after dracut-cmdline ([4d03404f](https://github.com/dracutdevs/dracut/commit/4d03404f499064b354a58223895cc47dbb461da5))
    *  create /run directories ([49b61496](https://github.com/dracutdevs/dracut/commit/49b614961dc8684f8512febbf80da489909e4b7f))
    *  use /run/NetworkManager/initrd/neednet in initqueue ([6a37c6f6](https://github.com/dracutdevs/dracut/commit/6a37c6f6302f950df608db3fd45acf9342ee3de2))
    *  only run NetworkManager if rd.neednet=1 ([ac0e8f7d](https://github.com/dracutdevs/dracut/commit/ac0e8f7dcc81432311906c3fca0d4211f6a2f68c))
    *  nm-run.service: don't kill forked processes ([1f21fac6](https://github.com/dracutdevs/dracut/commit/1f21fac646daa46cbe184ef8ff7705842f06ba15))
    *  no default deps for nm-run.service ([ba4bcf5f](https://github.com/dracutdevs/dracut/commit/ba4bcf5f4f11ad624c647ddf4f566997186135e7))
    *  nm-lib.sh does not require bash ([3402142e](https://github.com/dracutdevs/dracut/commit/3402142e344298c8f20fc52a2b064344788f1668))
* **squash:**
    *  post install should be the last step before stripping ([8c8aecdc](https://github.com/dracutdevs/dracut/commit/8c8aecdc63c9389038e78ee712d4809e49add5e1))
* **systemd:**
    *  include all nss libraries ([b3bbf5fb](https://github.com/dracutdevs/dracut/commit/b3bbf5fb6a95cfb69272da0711b5c5e0c6621de9))
    *  include hosts and nsswitch.conf in hostonly mode ([5912f4fb](https://github.com/dracutdevs/dracut/commit/5912f4fbc036cc36b9507c16dddef1ded1556572))
    *  remove old systemd version requirements ([fc53987b](https://github.com/dracutdevs/dracut/commit/fc53987bec1bc71b054d99072f62c1770a44bcca))
* **systemd-hostnamed:**  extra quote ([2aa65234](https://github.com/dracutdevs/dracut/commit/2aa652349ca83198581cccb516a241a8d0e1b4d9))
* **systemd-modules:**  remove dependency on systemd meta module ([afef4557](https://github.com/dracutdevs/dracut/commit/afef455718db69cff3797ca1a6d8bfebd2e86ab3))
* **systemd-modules-load:**
    *  misc repairs ([782ac8f1](https://github.com/dracutdevs/dracut/commit/782ac8f1f6b68edfe59630e9e4ac1673636f3a5e))
* **systemd-networkd:**
    *  make systemd-networkd a proper network provider ([ea779750](https://github.com/dracutdevs/dracut/commit/ea779750c371102c04252b48f1b7d9c7ece7cf93), closes [#737](https://github.com/dracutdevs/dracut/issues/737))
* **systemd-resolved:**  remove nss libraries ([12bef83c](https://github.com/dracutdevs/dracut/commit/12bef83cdaf329e3ee2cc1f282bd9c128ec0fc56))
* **systemd-sysctl:**
    *  sysctl global variables ([02acedd0](https://github.com/dracutdevs/dracut/commit/02acedd09eb7222eaaf0f5256f3ddec26d658360))
* **systemd-sysusers:**
    *  misc fixes and cleanup ([7359ba8a](https://github.com/dracutdevs/dracut/commit/7359ba8acab2652cfff6b845f84a936cdec30f9d))
* **systemd-udev:**  use global vars instead of fixed path ([fd883a58](https://github.com/dracutdevs/dracut/commit/fd883a58d1360f0c6c32f64462fafdd7a54af1ee))
* **systemd-udevd:**  add udev id program files ([562cb77b](https://github.com/dracutdevs/dracut/commit/562cb77b5a28e3f31bc6d327c7712fba661e9a27))
* **systemd-verity:**
    *  incorrect reference to cryptsetup target ([ba92d1fc](https://github.com/dracutdevs/dracut/commit/ba92d1fcad68758004d7b1102fe1905c0f25e63e))
    *  re-naming module to veritysetup ([0267f3c3](https://github.com/dracutdevs/dracut/commit/0267f3c3554efd8f027afaf462347167402f5d6c))
* **tpm2-tss:**  add tpm2 requirement ([8f99fada](https://github.com/dracutdevs/dracut/commit/8f99fadabea8f279a9fe28473dba424eb38f8d60))
* **udev-rules:**
    *  remove sourcing of network link files ([69f4e7cd](https://github.com/dracutdevs/dracut/commit/69f4e7cdc3f7da24e40496b0b2f0f5022cc3376d))
    *  add btrfs udev rules by default ([567c4557](https://github.com/dracutdevs/dracut/commit/567c4557537fe7f477f0f54237df00ebc79e56be))
* **url-lib:**
    *  fix passing args ([5f6be515](https://github.com/dracutdevs/dracut/commit/5f6be51595eab878314d031d9bfebe844b639302))
* **zipl:**
    *  don't depend on grub2 ([6b499ec1](https://github.com/dracutdevs/dracut/commit/6b499ec14b3ff35d5298617b436b64563a2d8c2f))

#### Performance

*   disable initrd compression when squash module is enabled ([7c0bc0b2](https://github.com/dracutdevs/dracut/commit/7c0bc0b2fd167da42035020dae49af94844f053c))

#### Features

*   support ZSTD-compressed kernel modules ([ce9af251](https://github.com/dracutdevs/dracut/commit/ce9af251af5fca08ea206ef980005853a4dac36e))
*   also restore the initramfs from /lib/modules ([33e27fab](https://github.com/dracutdevs/dracut/commit/33e27fab59db60b1ca05a0c5b8a51fccb98578e5))
*   extend Makefile indent target ([e0a0fa61](https://github.com/dracutdevs/dracut/commit/e0a0fa61749152fd5bc837770a02cf22d7e02d40))
*   customize .editorconfig according to shfmt ([1f621aba](https://github.com/dracutdevs/dracut/commit/1f621aba3728a621b83b3b697eae6caadae9d287))
*   squash module follow --compress option ([5d05ffbd](https://github.com/dracutdevs/dracut/commit/5d05ffbd87bc27e27f517ebc3454d50729c687e6))
* **bluetooth:**  implement bluetooth support in initrd ([64ee2a53](https://github.com/dracutdevs/dracut/commit/64ee2a53864576fbedabe6b18fb9aae01b999199))
* **btrfs:**  add 64-btrfs-dm.rules rules ([d4caa86a](https://github.com/dracutdevs/dracut/commit/d4caa86aba35b51dc1adda3ee3a5bae677420082))
* **mkinitrd:**  remove mkinitrd ([43df4ee2](https://github.com/dracutdevs/dracut/commit/43df4ee274e7135aff87868bf3bf2fbab47aa8b4))
* **nbd:**  support ipv6 link local nbds ([b12f8188](https://github.com/dracutdevs/dracut/commit/b12f8188a4ffac312694ebd48a5c99ba885e6467))
* **network-manager:**  run as daemon with D-Bus ([112f03f9](https://github.com/dracutdevs/dracut/commit/112f03f9e225a790cbc6378c70773c6af5e7ee34))
* **qemu:**  include the virtio_mem kernel module ([f3dcb606](https://github.com/dracutdevs/dracut/commit/f3dcb60619671f2d353caaa42d38207172c8b3ba))
* **skipcpio:**  speed up and harden skipcpio ([63033495](https://github.com/dracutdevs/dracut/commit/630334950c9a7a714fdf31b6ff545d804b5df2f2))
* **squash:**
    *  use busybox for early setup if available ([90f269f6](https://github.com/dracutdevs/dracut/commit/90f269f6afe409925bad86f0bd7e9322ad9b4fb0))
    *  install and depmod modules seperately ([5a18b24a](https://github.com/dracutdevs/dracut/commit/5a18b24a8b9c20c98f711963ce5407ceb2f3d57b))
* **systemd-ac-power:**  introducing the systemd-ac-power module ([e7407230](https://github.com/dracutdevs/dracut/commit/e74072306958262f22a9ecf10b928647ebdacf8f))
* **systemd-hostnamed:**  introducing the systemd-hostnamed module ([bf273e3e](https://github.com/dracutdevs/dracut/commit/bf273e3e8632faff68fe19f9d7d7cc42e5a7c480))
* **systemd-initrd:**  add initrd-usr-fs.target ([5eb73610](https://github.com/dracutdevs/dracut/commit/5eb736103d06197f37283bc27815c050adec81ea))
* **systemd-journald:**  introducing the systemd-journald module ([3697891b](https://github.com/dracutdevs/dracut/commit/3697891b754493ecd6b19dbf279701bad3460fcd))
* **systemd-ldconfig:**  introducing the systemd-ldconfig module ([563c434e](https://github.com/dracutdevs/dracut/commit/563c434ecba68c628344c1a684f656cdd8f9f214))
* **systemd-network-management:**  introducing systemd-network-management module ([e942d86c](https://github.com/dracutdevs/dracut/commit/e942d86c9ddad19f9307d58cb2d99169f6e94edb))
* **systemd-resolved:**  introducing the systemd-resolved module ([b7d3caef](https://github.com/dracutdevs/dracut/commit/b7d3caef6780305c553851169ca30b0b05b6ff31))
* **systemd-rfkill:**  introducing the systemd-rfkill module ([21536544](https://github.com/dracutdevs/dracut/commit/215365441e1042793d62c4c9e146be5916ed5aeb))
* **systemd-sysext:**  introducing the systemd-sysext module ([fc88af54](https://github.com/dracutdevs/dracut/commit/fc88af54134ec021be58465b52d1271453c30c55))
* **systemd-timedated:**  introducing the systemd-timedated module ([1c41cc90](https://github.com/dracutdevs/dracut/commit/1c41cc90c52636e03abdf6d0c4fa0f557b7eb449))
* **systemd-timesyncd:**  introducing the systemd-timesyncd module ([2257d545](https://github.com/dracutdevs/dracut/commit/2257d54583d24ca69d10b5e600b986d412a21714))
* **systemd-tmpfiles:**  introducing the systemd-tmpfiles module ([2b61be32](https://github.com/dracutdevs/dracut/commit/2b61be32b890e70b1fce45d984327c27302da9bc))
* **systemd-udevd:**  introducing the systemd-udevd module ([3534789c](https://github.com/dracutdevs/dracut/commit/3534789cc42331bc22cf44d26a1d04db4e010ad9))
* **systemd-verity:**  introducing the systemd-verity module ([3d4dea58](https://github.com/dracutdevs/dracut/commit/3d4dea58f9821e58841d5c738b9935193c680181))
* **tpm2-tss:**  introducing the tpm2-tss module ([8743b073](https://github.com/dracutdevs/dracut/commit/8743b0735692ab3f333815ba311cecdc29d45ecd))

#### Contributors

- Harald Hoyer <harald@redhat.com>
- Jóhann B. Guðmundsson <johannbg@gmail.com>
- Kairui Song <kasong@redhat.com>
- Dusty Mabe <dusty@dustymabe.com>
- Beniamino Galvani <bgalvani@redhat.com>
- Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
- Renaud Métrich <rmetrich@redhat.com>
- Adam Alves <adamoa@gmail.com>
- Daniel Molkentin <daniel.molkentin@suse.com>
- David Hildenbrand <david@redhat.com>
- David Tardon <dtardon@redhat.com>
- Jaroslav Jindrak <dzejrou@gmail.com>
- Jonas Jelten <jj@sft.lol>
- Lennart Poettering <lennart@poettering.net>
- Lev Veyde <lveyde@redhat.com>
- Peter Robinson <pbrobinson@fedoraproject.org>
- Stefan Berger <stefanb@linux.ibm.com>
- Đoàn Trần Công Danh <congdanhqx@gmail.com>

dracut-053
==========

#### Bug Fixes

* **dracut.sh:**
  *  unfreeze /boot on exit ([d87ae137](https://github.com/dracutdevs/dracut/commit/d87ae13721d04a8a2192d896af224ac6965caf70))
  *  proper return code for inst_multiple in dracut-init.sh ([d437970c](https://github.com/dracutdevs/dracut/commit/d437970c013e3287de263a1e60a117b15239896c))
* **fcoe:**
  *  rename rd.nofcoe to rd.fcoe ([6f7823bc](https://github.com/dracutdevs/dracut/commit/6f7823bce65dd4b52497dbb94892b637fd06471a))
  *  rd.nofcoe=0 should disable fcoe ([805b46c2](https://github.com/dracutdevs/dracut/commit/805b46c2a81e04d69fc3af912942568516d05ee7))
* **i18n:**
  *  get rid of `eval` calls ([5387ed24](https://github.com/dracutdevs/dracut/commit/5387ed24c8b33da1214232d57ab1831e117aaba0))
  *  create the keyboard symlinks again ([9e1c7f3d](https://github.com/dracutdevs/dracut/commit/9e1c7f3deadd387adaa97b189593b4ba3d7c6d5a))
* **network-manager:**
  *  run as a service if systemd module is present ([c17c5b76](https://github.com/dracutdevs/dracut/commit/c17c5b7604c8d61dd1c00ee22d44c3a5d7d6dfee))
  *  rework how NM is started in debug mode ([34c73b33](https://github.com/dracutdevs/dracut/commit/34c73b339baa025dfd8916379c4d191be34a8af5))
* **drm:**  skip empty modalias files in drm module setup ([c3f24184](https://github.com/dracutdevs/dracut/commit/c3f241849de6434d063ef92e6880f6b0335c1800))


dracut-052
==========

#### Features

- **dracut:**
  - allow overriding the systemctl command for sysroot with `$SYSTEMCTL` for cross compilation
  - add additional global variables

     Variables like `dbusconfdir` or `systemdnetwork` are now exported
     to the individual modules as global variables. If they are not set
     in the distribution dracut config files, they are set via `pkg-config`

  - A `--no-uefi` option as been added to the CLI options to disable a default `uefi=yes`
    set by a configuration file.

- **kernel-modules:**  add modules from `drivers/memory` for arm
- **network-legacy:**  send dhcp in parallel on all devices via the `single-dhcp` option
- **dbus:**  introduce a meta module for dbus
- **dbus-broker:**  introduce the dbus-broker module
- **dbus-daemon:**  introduce the dbus-daemon module
- **systemd-ask-password:**  introduce the systemd-ask-password module
- **systemd-coredump:**  introduce the systemd-coredump module
- **systemd-modules-load:**  introduce the systemd-modules-load module
- **systemd-repart:**  introduce the systemd-repart module
- **systemd-sysctl:**  introduce the systemd-sysctl module
- **systemd-sysusers:** introduce the systemd-sysuser module

#### Bug Fixes

-   first round of shellcheck for all shell scripts
-   revise all module checks to not error out about missing dependencies
-   use the top-level `/efi` path to address the EFI partition
-   correct the squash quirk
-   use `find_binary` instead of other methods, because `find_binary` honors `dracutsysrootdir`
-   quote globbing in module-setup.sh for `inst_multiple`
-   move ldconfig after library workaround
-   do not set cmdline for uefi images unless asked
- **dracut:**  don't override `PATH`, if `dracutsysrootdir` is set
- **dracut-functions.sh:**  check kernel config from `dracutsysrootdir`
- **dracut-init.sh:**  make inst_libdir_file work with `dracutsysrootdir` set
- **dracut-install:**  allow globbing for multiple sources
- **06dbus:**
  -  do not hardcode path to dbus utils
  -  do not hardcode path to systemd unit
- **uefi**  use efivars fs over the deprecated sysfs entries
- **keyring**  adding shared keyring mode to systemd unit `dracut-pre-pivot.service`
- **35network-manager:**  avoid restarting NetworkManager
- **90kernel-modules:**  install generic crypto modules with hostonly unset
- **99squash:**  use kernel config instead of modprobe to check modules
- **dbus-daemon:**  use uid/gid from sysroot if `dracutsysrootdir` is set
- **kernel-modules:**  add reset controllers for arm
- **kernel-network-modules:**  also install modules from mdio subdirectory
- **mdraid:**
  -  remove the `offroot` option (long deprecated)
  -  add the grow continue service `mdadm-grow-continue`
- **network-legacy:**  silent the check for dhcp leaseinfo
- **network-manager:**  allow override network manager version
- **plymouth:**  install binaries with dependencies
- **shutdown:**  add timeout to umount calls
- **watchdog:**  fix dependencies in `module-setup.sh`

#### Contributors

- Harald Hoyer <harald@redhat.com>
- Jóhann B. Guðmundsson <johannbg@gmail.com>
- Zoltán Böszörményi <zboszor@pr.hu>
- Alexey Shabalin <shaba@altlinux.org>
- Daniel Molkentin <daniel.molkentin@suse.com>
- Luiz Angelo Daros de Luca <luizluca@gmail.com>
- Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
- Alexander Tsoy <alexander@tsoy.me>
- Anjali Kulkarni <anjali.k.kulkarni@oracle.com>
- Beniamino Galvani <bgalvani@redhat.com>
- David Tardon <dtardon@redhat.com>
- Javier Martinez Canillas <javierm@redhat.com>
- Kairui Song <kasong@redhat.com>
- Lukas Nykryn <lnykryn@redhat.com>
- Matthew Thode <mthode@mthode.org>
- Nicolas Chauvet <kwizart@gmail.com>
- Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
- Ondrej Mosnacek <omosnace@redhat.com>
- Peter Levine <plevine457@gmail.com>
- Petr Pavlu <petr.pavlu@suse.com>
- Vladius25 <vkorol2509@icloud.com>
- Yang Liu <50459973+ly4096x@users.noreply.github.com>
- foopub <45460217+foopub@users.noreply.github.com>
- realtime-neil <neil@rtr.ai>


dracut-051
==========

dracut:
- allow running on a cross-compiled rootfs

  dracutsysrootdir is the root directory, file existence checks use it.

  DRACUT_LDCONFIG can override ldconfig with a different one that works
  on the sysroot with foreign binaries.

  DRACUT_LDD can override ldd with a different one that works
  with foreign binaries.

  DRACUT_TESTBIN can override /bin/sh. A cross-compiled sysroot
  may use symlinks that are valid only when running on the target
  so a real file must be provided that exist in the sysroot.

  DRACUT_INSTALL now supports debugging dracut-install in itself
  when run by dracut but without debugging the dracut scripts.
  E.g. DRACUT_INSTALL="valgrind dracut-install or
  DRACUT_INSTALL="dracut-install --debug".

  DRACUT_COMPRESS_BZIP2, DRACUT_COMPRESS_LBZIP2, DRACUT_COMPRESS_LZMA,
  DRACUT_COMPRESS_XZ, DRACUT_COMPRESS_GZIP, DRACUT_COMPRESS_PIGZ,
  DRACUT_COMPRESS_LZOP, DRACUT_COMPRESS_ZSTD, DRACUT_COMPRESS_LZ4,
  DRACUT_COMPRESS_CAT: All of the compression utilities may be
  overridden, to support the native binaries in non-standard places.

  DRACUT_ARCH overrides "uname -m".

  SYSTEMD_VERSION overrides "systemd --version".

  The dracut-install utility was overhauled to support sysroot via
  a new option -r and fixes for clang-analyze. It supports
  cross-compiler-ldd from
  https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f

  DRACUT_INSTALL_PATH was introduced so dracut-install can work with
  a different PATH. In a cross-compiled environment (e.g. Yocto), PATH
  points to natively built binaries that are not in the host's /bin,
  /usr/bin, etc. dracut-install still needs plain /bin and /usr/bin
  that are relative to the cross-compiled sysroot.

  DRACUT_INSTALL_LOG_TARGET and DRACUT_INSTALL_LOG_LEVEL were
  introduced so dracut-install can use different settings from
  DRACUT_LOG_TARGET and DRACUT_LOG_LEVEL.

- don't call fsfreeze on subvol of root file system
- Use TMPDIR (typically /run/user/$UID) if available
- dracut.sh: add check for invalid configuration files
  Emit a warning about possible misconfigured configuration files, where
  the spaces around values are missing for +=""
- dracut-functions: fix find_binary() to return full path
- dracut.sh: FIPS workaround for openssl-libs on Fedora/RHEL
- dracut.sh: fix early microcode detection logic
- dracut.sh: fix ia32 detection for uefi executables
- dracut.sh: Add --version
- dracut.sh: Add --hostonly-nics option
- EFI Mode: only write kernel cmdline to UEFI binary
- Allow $DRACUT_INSTALL to be not an absolute path
- Don't print when a module is explicitly omitted (by default)
- Remove uses of bash (and bash specific syntax) in runtime scripts
- dracut-init.sh: Add a helper for detect device kernel modules
- dracut-functions.sh: Fix check_block_and_slaves_all
- dracut-functions.sh: add a helper to check if kernel module is available

Documentation
- dracut.cmdline.7.asc: clarify usage of `rd.lvm.vg` and `rd.lvm.lv`
- dracut.conf.5.asc: document how to config --no-compress in the config
- fix CI badges in README.md and fix dracut description
- dracut.modules.7.asc: fix typos
- dracut.modules.7.asc: fix reference to insmodpost module
- Add --version to man page
- Adding code of conduct
- Document initqueue/online hook


dracut-install:
- install: also install post weak dependencies of kernel modules
- install: Globbing support for resolving "firmware:"

mkinitrd:
- use vmlinux regex for ppc*, vmlinuz for i686

mkinitrd-suse:
- fix i586 platform detection

modules:

00systemd:
- skip dependency add for non-existent units
- add missing cryptsetup-related targets

05busybox:
- simplify listing of supported utilities

06rngd:
- install dependant libs too
- Do not start inside container

10i18n:
- i18n: Always install /etc/vconsole.conf

35network-legacy:
- dhclient-script: Fix typo in output of  BOUND & BOUND6 cases
- simplify fallback dhcp setup

35network-manager:
- ensure that nm-run.sh is executed when needed
- install libnss DNS and mDNS plugins
- always pull in machinery to read ifcfg files
- set kernel hostname from the command line
- move connection generation to a lib file

40network:
- fix glob matching ipv6 addresses
- net-lib.sh: support infiniband network mac addresses

45url-lib:
- drop NSS if it's not in curl --version

80cms:
- regenerate NetworkManager connections

90btrfs:
- force preload btrfs module
- Install crypto modules in 90kernel-modules

90crypt:
- cryptroot-ask: no warn if /run/cryptsetup exist
- install crypto modules in 90kernel-modules
- try to catch kernel config changes
- fix force on multiple lines
- pull in remote-cryptsetup.target enablement
- cryptroot-ask: unify /etc/crypttab and rd.luks.key

90dmsquash-live:
- iso-scan.sh: Provide an easy reference to iso-scan device

90kernel-modules:
- remove nfit from static module list (see nvdimm module)
- install crypto modules in 90kernel-modules
- add sg kernel module
- add pci_hyperv
- install block drivers more strictly
- install less modules for hostonly mode
- arm: add drivers/hwmon for arm/arm64

90kernel-network-modules
- on't install iscsi related module (use 95iscsi)

90lvm:
- remove unnecessary ${initdir} from lvm_scan.sh
- fix removal of pvscan from udev rules
- do not add newline to cmdline

90multipath:
- add automatic configuration for multipath
  (adds 'rd.multipath=default' to use the default config)
- install kpartx's 11-dm-parts.rules

90nvdimm:
- new module for NVDIMM support

90ppcmac:
- respect DRACUT_ARCH, don't exclude ppcle

90qemu-net:
- in hostonly mode, only install if network is needed
- install less module for strict hostonly mode

91zipl:
- parse-zipl.sh: honor SYSTEMD_READY

95cifs:
- pass rootflags to mount
- install new softdeps (sha512, gcm, ccm, aead2)

95dasd:
- only install /etc/dasd.conf if present

95dcssblk:
- fix script permissions

95fcoe:
- fix pre-trigger stage by replacing exit with return in lldpad.sh
- default rd.nofcoe to false
- don't install if there is no FCoE hostonly devices

95iscsi:
- fix missing space when compiling cmdline args
- fix ipv6 target discovery

95nfs:
- only install rpc services for NFS < 4 when hostonly is strict
- Change the order of NFS servers during the boot
  (next-server option has higher priority than DHCP-server itself)
- install less module if hostonly mode is strict

95nvmf:
- add module for NVMe-oF
- add NVMe over TCP support

95resume:
- do not resume on iSCSI, FCoE or NBD

95rootfs-block:
- mount-root.sh: fix writing fstab file with missing fsck flag
- only write root argument for block device

95zfcp:
- match simplified rd.zfcp format too

95zfcp_rules:
- parse-zfcp.sh: remove rule existence check

95znet:
- add a rd.znet_ifname= option

98dracut-systemd:
- remove memtrace-ko and rd.memdebug=4 support in dracut
- remove cleanup_trace_mem calls
- dracut-initqueue: Print more useful info in case of timeout
- as of v246 of systemd "syslog" and "syslog-console" switches have been deprecated
- don't wait for root device if remote cryptsetup active

99base:
- dracut-lib.sh: quote variables in parameter expansion patterns
- remove memtrace-ko and rd.memdebug=4 support in dracut
- remove cleanup_trace_mem calls
- see new module 99memstrack
- prevent creating unexpected files on the host when running dracut

99memstrack:
- memstrack is a new tool to track the overall memory usage and
  allocation, which can help off load the improve the builtin module
  memory tracing function in dracut.

99squash:
- don't hardcode the squash sub directories
- improve pre-requirements check
- check require module earlier, and properly

new modules:
- nvmf
- watchdog-modules
- dbus
- network-wicked

removed modules:
- stratis

test suite:
- use dd from /dev/zero, instead of creating files with a hole
- TEST-03-USR-MOUNT/test.sh: increase loglevel
- TEST-12-RAID-DEG/create-root.sh: more udevadm settle
- TEST-35-ISCSI-MULTI: bump disk space
- TEST-41-NBD-NM/Makefile: should be based on TEST-40-NBD not TEST-20-NFS
- TEST-99: exclude /etc/dnf/* from check

dracut-050
==========

dracut:
- support for running on a cross-compiled rootfs, see README.cross
- add support for creating secureboot signed UEFI images
- use microcode found in packed cpio images
- `-k/--kmodir` must now contain "lib/modules/$KERNEL_VERSION"
  use DRACUT_KMODDIR_OVERRIDE=1 to ignore this check
- support the EFI Stub loader's splash image feature.
  `--uefi-splash-image <FILE>`

dracut modules:
- remove bashism in various boot scripts
- emergency mode: use sulogin

fcoe:
- add rd.nofcoe option to disable the FCoE module from the command line

10i18n:
- fix keymaps not getting included sometimes
- use eurlatgr as default console font

iscsi:
- add option `rd.iscsi.testroute`

multipath:
- fix udev rules detection of multipath devices

network:
- support NetworkManager

network-legacy:
- fix classless static route parsing
- ifup: fix typo when calling dhclient --timeout
- ifup: nuke pid and lease files if dhclient failed
- fix ip=dhcp,dhcp6
- use $name instead of $env{INTERFACE} (systemd-udevd regression)

shutdown:
- fix for non-systemd reboot/halt/shutdown commands
- set selinux labels
- fix shutdown with console=null

lsinitrd:
- list squash content as well
- handle UEFI created with dracut --uefi
- make lsinitrd usable for images made with Debian mkinitramfs

dracut-install:
- fixed ldd parsing
- install kernel module dependencies of dependencies
- fixed segfault for hashing NULL pointers
- add support for compressed firmware files
- dracut_mkdir(): create parent directories as needed.

configure:
- Find FTS library with --as-needed

test suite:
- lots of cleanups
- add github actions

new modules:
- rngd
- network-manager
- ppcmac - thermal/fan control modules on PowerPC based Macs

dracut-049
==========
lsinitrd:
- record loaded kernel modules when hostonly mode is enabled
  lsinitrd $image -f */lib/dracut/loaded-kernel-modules.txt
- allow to only unpack certain files

kernel-modules:
- add gpio and pinctrl drivers for arm*/aarch64
- add nfit

kernel-network-modules:
- add vlan kernel modules

ifcfg/write-ifcfg.sh:
- aggregate resolv.conf

livenet:
- Enable OverlayFS overlay in sysroot.mount generator.

dmsquash-live:
- Support a flattened squashfs.img
- Remove obsolete osmin.img processing

dracut-systemd:
- Start systemd-vconsole-setup before dracut-cmdline-ask

iscsi:
- do not install all of /etc/iscsi unless hostonly
- start iscsid even w/o systemd

multipath:
- fixed shutdown

network:
- configure NetworkManager to use dhclient

mdraid:
- fixed uuid handling ":" versus "-"

stratis:
- Add additional binaries

new modules:
- 00warpclock
- 99squash
  Adds support for building a squashed initramfs
- 35network-legacy
  the old 40network
- 35network-manager
  alternative to 35network-legacy
- 90kernel-modules-extra
  adds out-of-tree kernel modules

testsuite:
- now runs on travis
- support new qemu device options
- even runs without kvm now

dracut-048
==========

dracut.sh:
- fixed finding of btrfs devices
- harden dracut against BASH_ENV environment variable
- no more prelinking
- scan and install "external" kernel modules
- fixed instmods with zero input
- rdsosreport: best effort to strip out passwords
- introduce tri-state hostonly mode

   Add a new option --hostonly-mode which accept an <mode> parameter, so we have a tri-state hostonly mode:

        * generic: by passing "--no-hostonly" or not passing anything.
                   "--hostonly-mode" has no effect in such case.
        * sloppy: by passing "--hostonly --hostonly-mode sloppy". This
                  is also the default mode when only "--hostonly" is given.
        * strict: by passing "--hostonly --hostonly-mode strict".

    Sloppy mode is the original hostonly mode, the new introduced strict
    mode will allow modules to ignore more drivers or do some extra job to
    save memory and disk space, while making the image less portable.

    Also introduced a helper function "optional_hostonly" to make it
    easier for modules to leverage new hostonly mode.

    To force install modules only in sloppy hostonly mode, use the form:

    hostonly="$(optional_hostonly)" instmods <modules>

dracut-install:
- don't error out, if no modules were installed
- support modules.softdep

lsinitrd.sh:
- fixed zstd file signature

kernel:
- include all pci/host modules
- add mmc/core for arm
- Include Intel Volume Management Device support

plymouth:
- fix detection of plymouth directory

drm:
- make failing installation of drm modules nonfatal
- include virtio DRM drivers in hostonly initramfs

stratis:
- initial Stratis support

crypt:
- correct s390 arch to include arch-specific crypto modules
- add cmdline rd.luks.partuuid
- add timeout option rd.luks.timeout

shutdown:
- sleep a little, if a process was killed

network:
- introduce ip=either6 option

iscsi:
- replace iscsistart with iscsid

qeth_rules:
- new module to copy qeth rules

multipath-hostonly:
- merged back into multipath

mdraid:
- fixed case if rd.md.uuid is in ID_FS_UUID format

dracut-047
==========
dracut.sh:
- sync initramfs to filesystem with fsfreeze
- introduce "--no-hostonly-default-device"
- disable lsinitrd logging when quiet
- add support for Zstandard compression
- fixed relative paths in --kerneldir
- if /boot/vmlinuz-$version exists use /boot/ as default output dir
- make qemu and qemu-net a default module in non-hostonly mode
- fixed relative symlinks
- support microcode updates for all AMD CPU families
- install all modules-load.d regardless of hostonly
- fixed parsing of "-i" and "--include"
- bump kmod version to >= 23
- enable 'early_microcode' by default
- fixed check_block_and_slaves() for nvme

lsinitrd.sh:
- dismiss "cat" error messages

systemd-bootchart:
- removed

i18n:
- install all keymaps for a given locale
- add correct fontmaps

dmsquash-live:
- fixed systemd unit escape

systemd:
- enable core dumps with systemd from initrd
- fixed setting of timeouts for device units
- emergency.service: use Type=idle and fixed task limit

multipath:
- include files from /etc/multipath/conf.d
- do not fail startup on missing configuration
- start daemon after udev settle
- add shutdown script
- parse kernel commandline option 'multipath=off'
- start before local-fs-pre.target

dracut-emergency:
- optionally print filesystem help

network:
- fixed MTU for bond master
- fixed race condition when wait for networks

fcoe:
- handle CNAs with DCB firmware support
- allow to specify the FCoE mode via the fcoe= parameter
- always set AUTO_VLAN for fcoemon
- add shutdown script
- fixup fcoe-genrules.sh for VN2VN mode
- switch back to using fipvlan for bnx2fc
- add timeout mechanism

crypt:
- add basic LUKS detached header support
- escape backslashes for systemd unit names correctly
- put block_uuid.map into initramfs

dmraid:
- do not delete partitions

dasd_mod:
- do not set module parameters if dasd_cio_free is not present

nfs:
- fix mount if IPv4 address is used in /etc/fstab
- support host being a DNS ALIAS

fips:
- fixed creating path to .hmac of kernel based on BOOT_IMAGE
- turn info calls into fips_info calls
- modprobe failures during manual module loading is not fatal


lunmask:
- add module to handle LUN masking

s390:
- add rd.cio_accept

dcssblk:
- add new module for DCSS block devices

zipl:
- add new module to update s390x configuration

iscsi:
- no more iscsid, either iscsistart or iscsid

integrity:
- support loading x509 into the trusted/builtin .evm keyring
- support X.509-only EVM configuration

plymouth:
- improve distro compatibility

dracut-046
==========

dracut.sh:
- bail out if module directory does not exist
  if people want to build the initramfs without kernel modules,
  then --no-kernel should be specified
- add early microcode support for AMD family 16h
- collect also all modaliases modules from sysfs for hostonly modules
- sync initramfs after creation

network:
- wait for IPv6 RA if using none/static IPv6 assignment
- ipv6 improvements
- Handle curl using libnssckbi for TLS
- fix dhcp classless_static_routes
- dhclient: send client-identifier matching hardware address
- don't arping for point-to-point connections
- only bring up wired network interfaces (no wlan and wwan)

mraid:
- mdraid: wait for rd.md.uuid specified devices to be assembled

crypt:
- handle rd.luks.name

crypt-gpg:
- For GnuPG >= 2.1 support OpenPGP smartcards

kernel-install:
- Skip to create initrd if /etc/machine-id is missing or empty

nfs:
- handle rpcbind /run/rpcbind directory

s390:
- various fixes

dmsquash-live:
- add NTFS support

multipath:
- split out multipath-hostonly module

lvmmerge:
- new module, see README.md in the module directory

dracut-systemd:
- fixed dependencies


dracut-045
==========

Important: dracut now requires libkmod for the dracut-install binary helper,
           which nows handles kernel module installing and filtering.

dracut.sh:
- restorecon final image file
- fail hard, if we find modules and modules.dep is missing
- support --tmpdir as a relative path
- add default path for --uefi

dracut-functions.sh:
- fix check_vol_slaves() volume group name stripping

dracut-install:
- catch ldd message "cannot execute binary file"
- added kernel module handling with libkmod
  Added parameters:
    --module,-m
    --mod-filter-path, -p
    --mod-filter-nopath, -P
    --mod-filter-symbol, -s
    --mod-filter-nosymbol, -S
    --mod-filter-noname, -N
    --silent
    --kerneldir
    --firmwaredirs
- fallback to non-hostonly mode if lsmod fails

lsinitrd:
- new option "--unpack"
- new option "--unpackearly"
- and "--verbose"

general initramfs fixes:
- don't remove 99-cmdline-ask on 'hostonly' cleanup
- call dracut-cmdline-ask.service, if /etc/cmdline.d/*.conf exists
- break at switch_root only for bare rd.break
- add rd.emergency=[reboot|poweroff|halt]
  specifies what action to execute in case of a critical failure
- rd.memdebug=4 gives information, about kernel module memory consumption
  during loading

dmsquash-live:
- fixed livenet-generator execution flag
  and include only, if systemd is used
- fixed dmsquash-live-root.sh for cases where the fstype of the liveimage is squashfs
- fixed typo for rootfs.img
- enable the use of the OverlayFS for the LiveOS root filesystem
  Patch notes:
    Integrate the option to use an OverlayFS as the root filesystem
    into the 90dmsquash-live module for testing purposes.

    The rd.live.overlay.overlayfs option allows one to request an
    OverlayFS overlay.  If a persistent overlay is detected at the
    standard LiveOS path, the overlay & type detected will be used.

    Tested primarily with transient, in-RAM overlay boots on vfat-
    formatted Live USB devices, with persistent overlay directories
    on ext4-formatted Live USB devices, and with embedded, persistent
    overlay directories on vfat-formatted devices. (Persistent overlay
    directories on a vfat-formatted device must be in an embedded
    filesystem that supports the creation of trusted.* extended
    attributes, and must provide valid d_type in readdir responses.)

    The rd.live.overlay.readonly option, which allows a persistent
    overlayfs to be mounted read only through a higher level transient
    overlay directory, has been implemented through the multiple lower
    layers feature of OverlayFS.

    The default transient DM overlay size has been adjusted up to 32 GiB.
    This change supports comparison of transient Device-mapper vs.
    transient OverlayFS overlay performance.  A transient DM overlay
    is a sparse file in memory, so this setting does not consume more
    RAM for legacy applications.  It does permit a user to use all of
    the available root filesystem storage, and fails gently when it is
    consumed, as the available free root filesystem storage on a typical
    LiveOS build is only a few GiB.  Thus, when booted on other-
    than-small RAM systems, the transient DM overlay should not overflow.

    OverlayFS offers the potential to use all of the available free RAM
    or all of the available free disc storage (on non-vfat-devices)
    in its overlay, even beyond the root filesystem available space,
    because the OverlayFS root filesystem is a union of directories on
    two different partitions.

    This patch also cleans up some message spew at shutdown, shortens
    the execution path in a couple of places, and uses persistent
    DM targets where required.

dmraid:
- added "nowatch" option in udev rule, otherwise udev would reread partitions for raid members
- allow booting from degraded MD RAID arrays

shutdown:
- handle readonly /run on shutdown

kernel-modules:
- add all HID drivers, regardless of hostonly mode
  people swap keyboards sometimes and should be able to enter their disk password
- add usb-storage
  To save the rdsosreport.txt to a USB stick, the usb-storage module is needed.
- add xennet
- add nvme

systemd:
- add /etc/machine-info
- fixed systemd-escape call for names beginning with "-"
- install missing drop-in configuration files for
    /etc/systemd/{journal.conf,system.conf}

filesystems:
- add support to F2FS filesystem (fsck and modules)

network:
- fix carrier detection
- correctly set mac address for ip=...:<mtu>:<mac>
- fixed vlan, bonding, bridging, team logic
  call ifup for the slaves and assemble afterwards
- add mtu to list of variables to store in override
- for rd.neednet=0 a bootdev is not needed anymore
- dhclient-script.sh: add classless-static-routes support
- support for iBFT IPv6
- support macaddr in brackets [] (commit 740c46c0224a187d6b5a42b4aa56e173238884cc)
- use arping2, if available
- support multiple default gateways from DHCP server
- fixup VLAN handling
- enhance team support
- differ between ipv6 local and global tentative
- ipv6: wait for a router advertised route
- add 'mtu' parameter for bond options
- use 'ip' instead of 'brctl'

nbd:
- add systemd generator
- use export names instead of port numbers, because port number based
  exports are deprecated and were removed.

fcoe:
- no more /dev/shm state copying

multipath:
- check all /dev/mapper devices if they are multipath devices, not only mpath*

fips:
- fixed .hmac installation in FIPS mode

plymouth:
- also trigger the acpi subsystem

syslog:
- add imjournal.so to read systemd journal
- move start from udev to initqueue/online

caps:
- make it a non default module

livenet:
- support nfs:// urls in livenet-generator

nfs:
- install all nfs modules non-hostonly

crypt:
- support keyfiles embedded in the initramfs

testsuite:
- add TEST-70-BONDBRIDGETEAMVLAN
- make "-cpu host" the default

dracut-044
==========
creation:
- better udev & systemd dir detection
- split dracut-functions.sh in dracut-init.sh and dracut-functions.sh
  dracut-functions.sh can now be sourced by external tools
- detect all btrfs devices needed
- added flag file if initqueue is needed
- don't overwrite anything, if initramfs image file creation failed
- if no compressor is specified, try to find a suitable one
- drop scanning kernel config for CONFIG_MICROCODE_*_EARLY
- remove "_EARLY" from CONFIG_MICROCODE_* checks
- dracut.sh: add command line option for install_i18_all
  --no-hostonly-i18n -> install_i18n_all=yes
  --hostonly-i18n -> install_i18n_all=no
- --no-reproducible to turn off reproducible mode
- dracut-function.sh can now be sourced from outside of dracut
- dracut-init.sh contains all functions, which only can be used from
  within the dracut infrastructure
- support --mount with just mountpoint as a parameter
- removed action_on_fail support
- removed host_modalias concept
- do not create microcode, if no firmware is available
- skip gpg files in microcode generation

initramfs:
- ensure pre-mount (and resume) run before root fsck
- add --online option to initqueue

qemu:
- fixed virtual machine detection

lvm:
- remove all quirk arguments for lvm >= 2.2.221

dmsquash:
- fixup for checkisomd5
- increase timeout for checkisomd5
- use non-persistent metadata snapshots for transient overlays.
- overflow support for persistent snapshot.
- use non-persistent metadata snapshots.
- avoid an overlay for persistent, uncompressed, read-write live installations.

multipath:
- multipath.conf included in hostonly mode
- install all multipath path selector kernel modules

iSCSI:
- use the iBFT initiator name, if found and set
- iscsid now present in the initramfs
- iscsistart is done with systemd-run asynchrone to do things in
  paralllel. Also restarted for every new interface which shows up.
- If rd.iscsi.waitnet (default) is set, iscsistart is done only
  after all interfaces are up.
- If not all interfaces are up and rd.iscsi.testroute (default) is set,
  the route to a iscsi target IP is checked and skipped, if there is none.
- If all things fail, we issue a "dummy" interface iscsiroot to retry
  everything in the initqueue/timeout.

network:
- added DHCP RENEW/REBIND
- IPv4 DHCP lease time now optional (bootp)
- IPv6 nfs parsing
- fixed IPv6 route parsing
- rd.peerdns=0 parameter to disable DHCP nameserver setting
- detect duplicate IPv4 addresses for static addresses
- if interfaces are specified with its enx* name, bind the correspondent MAC to the interface name
- if multiple "ip=" are present on the kernel command line "rd.neednet=1" is assumed
- add options to tweak timeouts
     rd.net.dhcp.retry=<cnt>
         If this option is set, dracut will try to connect via dhcp
         <cnt> times before failing. Default is 1.

     rd.net.timeout.dhcp=<arg>
         If this option is set, dhclient is called with "-timeout <arg>".

     rd.net.timeout.iflink=<seconds>
         Wait <seconds> until link shows up. Default is 60 seconds.

     rd.net.timeout.ifup=<seconds>
         Wait <seconds> until link has state "UP". Default is 20 seconds.

     rd.net.timeout.route=<seconds>
         Wait <seconds> until route shows up. Default is 20 seconds.

     rd.net.timeout.ipv6dad=<seconds>
         Wait <seconds> until IPv6 DAD is finished. Default is 50 seconds.

     rd.net.timeout.ipv6auto=<seconds>
         Wait <seconds> until IPv6 automatic addresses are assigned.
         Default is 40 seconds.

     rd.net.timeout.carrier=<seconds>
         Wait <seconds> until carrier is recognized. Default is 5 seconds.

IMA:
- load signed certificates in the IMA keyring, see modules.d/98integrity/README
- load EVM public key in the kernel _evm keyring

FCoE:
    fcoe: start with fcoemon instead of fipvlan

dracut-043
==========
- add missing dmsquash-generator

dracut-042
==========
- fixed dmsetup shutdown
- new kernel command line option "rd.live.overlay.thin"
    This option changes the underlying mechanism for the overlay in the
    dmsquash module.
    Instead of a plain dm snapshot a dm thin snapshot is used. The advantage
    of the thin snapshot is, that the TRIM command is recognized, which
    means that at runtime, only the occupied blocks will be claimed from
    memory, and freed blocks will really be freed in ram.
- dmsquash: Add squashfs support to rd.live.fsimg
    Previously rd.live.fsimg only supported filesystems residing in
    (compressed) archives.
    Now rd.live.fsimg can also be used when a squashfs image is used.
    This is achieved by extracting the rootfs image from the squashfs and
    then continue with the default routines for rd.live.fsimg.
- lvm: add support for LVM system id
- split up the systemd dracut module
    Basic systemd functionality is in 00systemd now.
    Switching root and the initrd.target is in 00systemd-initrd.
    Dracut additions to the systemd initrd are in 98dracut-systemd.
- support for creating a UEFI boot executable via argument "--uefi"
    With an EFI stub, the kernel, the initramfs and a kernel cmdline can be
    glued together to a single UEFI executable, which can be booted by a
    UEFI BIOS.
- network: split out kernel-network-modules, now in 90kernel-network-modules
- support for ethernet point-to-point connections configured via DHCP
- kernel-modules: install all HID drivers
- dracut.pc pkg-config file
- mount /dev, /dev/shm and /run noexec

dracut-041
==========
- fixed the shutdown loop
- fixed gzip compression for versions, which do not have --rsyncable
- fixed ifcfg generation for persistent interface names
- multipath:
  * new option to turn off multipath "rd.multipath=0" completly
  * preload scsi dh modules
  * start multipathd via systemd service
- do not fail, if user pressed ESC during media check
- fixed systemd-journal by symlinking /var/log to /run/initramfs/log
- initrd-release moved to /usr/lib
- lots of iSCSI fixes
- new "rd.timeout" to specify the systemd JobTimeoutSec for devices
- if $initrd/etc/cmdline.d/* has a "root=" and the kernel cmdline does not,
  generate a mount unit for it
- increased the initqueue timeout for non systemd initramfs to 180s
- $initrd/etc/cmdline.d/ hostonly files are now generated for NFS
- make use of systemd-hibernate-resume, if available
- fixed ldconfig parsing for hwcap output
- network: add support for comma separated autoconf options like ip=eth0:auto6,dhcp
- new parameter "rd.live.overlay.size" to specify the overlay for live images
- changed the test suite for the new sfdisk syntax
- added cache tools for dm-cache setups

dracut-040
==========
- fixed dracut module dependency checks
- fixed test suite

dracut-039
==========
- DRACUT_PATH can now be used to specify the PATH used by dracut
  to search for binaries instead of the default
  /usr/sbin:/sbin:/usr/bin:/bin
  This should be set in the distribution config file
  /usr/lib/dracut/dracut.conf.d/01-dist.conf
- add "--loginstall <DIR>" and loginstall="<DIR>" options
  to record all files, which are installed from the host fs
- "rd.writable.fsimg" - support for read/write filesystem images
- "rd.route" kernel command line parameter added
- "--install-optional" and install_optional_items added
- find plymouth pkglibdir on debian
- torrent support for live images
  root=live:torrent://example.com/liveboot.img.torrent
  and generally added as a download handler
- disable microcode, if the kernel does not support it
- speed up ldconfig_paths()
- more ARM modules
- fixed inst*() functions and "-H" handling
- fixed bridge setup
- added --force-drivers parameter and force_drivers=+ config option
  to enforce driver loading at early boot time
- documented "iso-scan/filename" usage in grub
- various bugfixes

dracut-038
==========
- "rd.cmdline=ask" will ask the user on the console to enter additional
  kernel command line parameters
- "rd.hostonly=0" removes all "hostonly" added custom files,
  which is useful in combination with "rd.auto" or other specific parameters,
  if you want to boot on the same hardware, but the compiled in configuration
  does not match your setup anymore
- inst* functions and dracut-install now accept the "-H" flag, which logs all
  installed files to /lib/dracut/hostonly-files. This is used to remove those
  files, if rd.hostonly is given on the kernel command line
- strstr now only does literal string match,
  please use strglob and strglobin for globs
- fixed unpacking of the microcode image on shutdown
- added systemd-gpt-auto-generator
- fcoe: wait for lldpad to be ready
- network: handle "ip=dhcp6"
- network: DCHPv6: set valid_lft and preferred_lft
- dm: support dm-cache
- fstab: do not mount and fsck from fstab if using systemd
- break at switch_root only for bare rd.break and not for any rd.break=...
- nbd: make use of "--systemd-mark", otherwise it gets killed on switch_root
- fcoe-uefi: fixed cmdline parameter generation
- iscsi: deprecate "ip=ibft", use "rd.iscsi.ibft[=1]" from now on
- "lsinitrd -m" now only lists the dracut modules of the image
- a lot of small bugfixes

dracut-037
==========
- dracut: hostonly_cmdline variable and command line switch
    Toggle hostonly cmdline storing in the initramfs
    --hostonly-cmdline:
        Store kernel command line arguments needed in the initramfs
    --no-hostonly-cmdline:
        Do not store kernel command line arguments needed in the initramfs
- dracut: --mount now understands full fstab lines
- dracut now also includes drivers from the /lib/modules/<version>/updates directory
- dracut: only set the owner of files to 0:0, if generated as non-root
- dracut now directly writes to the initramfs file
- dracut: call lz4 with the legacy flag (linux kernel does not support the new format)
- systemd: rootfs-generator generates JobTimeout=0 units for the root device
- systemd: added the systemd-sysctl service
- systemd: add 80-net-setup-link.rules and .link files for persistent interface renaming
- systemd: make dracut-shutdown.service failure non-fatal
- network: various IPv6 fixes
- network: DCHCP for IPv6
- network: understand ip=.....:<dns1>:<dns2>
- network: parse ibft nameserver settings
- shutdown: if kexec fails, just reboot
- lvm: handle one LV at a time with lvchange
- module-setup.sh:
    New functions require_binaries() and require_any_binary() to be used
    in the check() section of module-setup.sh.
- a lot of small bugfixes

Contributions from:
Harald Hoyer
Alexander Tsoy
Till Maas
Amadeusz Żołnowski
Brian C. Lane
Colin Guthrie
Dave Young
WANG Chao
Shawn W Dunn

dracut-036
==========
- fixed skipcpio signature checking

dracut-035
==========
- changed dracut tarball compression to xz
- new argument "--rebuild"
- add lzo, lz4 compression
- install: install all binaries with <name> found in PATH
- lsinitrd can now handle initramfs images with an early cpio prepended
  (microcode, ACPI tables)
- mkinitrd-suse added as a compat stub for dracut
- lvm: install thin utils for non-hostonly
- resume: fix swap detection in hostonly
- avoid loading unnecessary 32-bit libraries for 64-bit initrds
- crypt: wait for systemd password agents
- crypt: skip crypt swaps with password files
- network: before doing dhcp, dracut now checks, if the link has a carrier
- network: dhclient-script.sh now sets the lease time
- network: include usbnet drivers
- network: include all ethernet drivers
- network: add rd.bootif=0 to ignore BOOTIF
- i18n: introduce i18n_install_all, to install everything i18n related
- support SuSE DASD configurations
- support SuSE zfcp configurations
- support SuSE compressed KEYMAP= setting
- usrmount: always install the module,
  so always mount /usr from within the initramfs
- test/TEST-17-LVM-THIN: new test case for lvm thin pools
- "halt" the machine in systemd mode for die()

dracut-034
==========
- do not run dhcp on parts of assembled network interfaces (bond, bridge)
- add option to turn on/off prelinking
    --prelink, --noprelink
    do_prelink=[yes|no]
- add ACPI table overriding
- do not log to syslog/kmsg/journal for UID != 0
- lvm/mdraid: Fix LVM on MD activation
- bcache module removed (now in bcache-tools upstream)
- mdadm: also install configs from /etc/mdadm.conf.d
- fixes for mdadm-3.2.6+
- mkinitrd: better compat support for SUSE
- fcoe: add FCoE UEFI boot device support
- rootfs-block: add support for the rootfallback= kernel cmdline option

Contributions from:
Thomas Renninger
Alexander Tsoy
Peter Rajnoha
WANG Chao
Harald Hoyer


dracut-033
==========
- improved hostonly device recognition
- improved hostonly module recognition
- add dracut.css for dracut.html
- do not install udev rules from /etc in generic mode
- fixed LABEL= parsing for swap devices
- fixed iBFT network setup
- url-lib.sh: handle 0-size files with curl
- dracut.asc: document debugging dracut on shutdown
- if rd.md=0, use dmraid for imsm and ddf
- skip empty dracut modules
- removed caching of kernel cmdline
- fixed iso-scan, if the loop device driver is a kernel module
- bcache: support new blkid
- fixed ifup udev rules
- ifup with dhcp, if no "ip=" specified for the interface

Contributions from:
WANG Chao
Colin Walters
Harald Hoyer


dracut-032
==========
- add parameter --print-cmdline
    This prints the kernel command line parameters for the current disk
    layout.
    $ dracut --print-cmdline
    rd.luks.uuid=luks-e68c8906-6542-4a26-83c4-91b4dd9f0471
    rd.lvm.lv=debian/root rd.lvm.lv=debian/usr root=/dev/mapper/debian-root
    rootflags=rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered
    rootfstype=ext4
- dracut.sh: add --persistent-policy option and persistent_policy conf option
    --persistent-policy <policy>:
        Use <policy> to address disks and partitions.
        <policy> can be any directory name found in /dev/disk.
        E.g. "by-uuid", "by-label"
- dracut now creates the initramfs without udevadm
  that means the udev database does not have to populated
  and the initramfs can be built in a chroot with
  /sys /dev /proc mounted
- renamed dracut_install() to inst_multiple() for consistent naming
- if $libdirs is unset, fall back to ld.so.cache paths
- always assemble /usr device in initramfs
- bash module added (disable it, if you really want dash)
- continue to boot, if the main loop times out, in systemd mode
- removed inst*() shell pure versions, dracut-install binary is in charge now
- fixed ifcfg file generation for vlan
- do not include adjtime and localtime anymore
- fixed generation of zfcp.conf of CMS setups
- install vt102 terminfo
  dracut_install() is still there for backwards compat
- do not strip files in FIPS mode
- fixed iBFT interface configuration
- fs-lib: install fsck and fsck.ext*
- shutdown: fixed killall_proc_mountpoint()
- network: also wait for ethernet interfaces to setup
- fixed checking for FIPS mode

Contributions from:
Harald Hoyer
WANG Chao
Baoquan He
Daniel Schaal
Dave Young
James Lee
Radek Vykydal


dracut-031
==========
- do not include the resume dracut module in hostonly mode,
  if no swap is present
- don't warn twice about omitted modules
- use systemd-cat for logging on systemd systems, if logfile is unset
- fixed PARTUUID parsing
- support kernel module signing keys
- do not install the usrmount dracut module in hostonly mode,
  if /sbin/init does not live in /usr
- add debian udev rule files
- add support for bcache
- network: handle bootif style interfaces
  e.g. ip=77-77-6f-6f-64-73:dhcp
- add support for kmod static devnodes
- add vlan support for iBFT

Contributions from:
Harald Hoyer
Amadeusz Żołnowski
Brandon Philips
Colin Walters
James Lee
Kyle McMartin
Peter Jones

dracut-030
==========
- support new persistent network interface names
- fix findmnt calls, prevents hang on stale NFS mounts
- add systemd.slice and slice.target units
- major shell cleanup
- support root=PARTLABEL= and root=PARTUUID=
- terminfo: only install l/linux v/vt100 and v/vt220
- unset all LC_* and LANG, 10% faster
- fixed dependency loop for dracut-cmdline.service
- do not wait_for_dev for the root devices
- do not wait_for_dev for devices, if dracut-initqueue is not needed
- support early microcode loading with --early-microcode
- dmraid, let dmraid setup its own partitions
- sosreport renamed to rdsosreport

Contributions from:
Harald Hoyer
Konrad Rzeszutek Wilk
WANG Chao

dracut-029
==========
- wait for IPv6 autoconfiguration
- i18n: make the default font configurable
  To set the default font for your distribution, add
  i18n_default_font="latarcyrheb-sun16"
  to your /lib/dracut/dracut.conf.d/01-dist.conf distribution config.
- proper handle "rd.break" in systemd mode before switch-root
- systemd: make unit files symlinks
- build without dash requirement
- add dracut-shutdown.service.8 manpage
- handle MACs for "ip="
  "ip=77-77-6f-6f-64-73:dhcp"
- don't explode when mixing BOOTIF and ip=
- 90lvm/module-setup.sh: redirect error message of lvs to /dev/null

Contributions from:
Harald Hoyer
Will Woods
Baoquan He

dracut-028
==========
- full integration of crypto devs in systemd logic
- support for bridge over team and vlan tagged team
- support multiple bonding interfaces
- new kernel command line param "rd.action_on_fail"
  to control the emergency action
- support for bridge over a vlan tagged interface
- support for "iso-scan/filename" kernel parameter
- lsinitrd got some love and does not use "file" anymore
- fixed issue with noexec mounted tmp dirs
- FIPS mode fixed
- dracut_install got some love
- fixed some /usr mounting problems
- ifcfg dracut module got some love and fixes
- default installed font is now latarcyrheb-sun16
- new parameters rd.live.dir and rd.live.squashimg
- lvm: add tools for thin provisioning
- also install non-hwcap libs
- setup correct system time and time zone in initrd
- s390: fixed cms setup
- add systemd-udevd persistent network interface naming

Contributions from:
Harald Hoyer
Kamil Rytarowski
WANG Chao
Baoquan He
Adam Williamson
Colin Guthrie
Dan Horák
Dave Young
Dennis Gilmore
Dennis Schridde

dracut-027
==========
- dracut now has bash-completion
- require bash version 4
- systemd module now requires systemd >= 199
- dracut makes use of native systemd initrd units
- added hooks for new-kernel-pkg and kernel-install
- hostonly is now default for fedora
- comply with the BootLoaderSpec paths
  http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec
- added rescue module
- host_fs_types is now a hashmap
- new dracut argument "--regenerate-all"
- new dracut argument "--noimageifnotneeded"
- new man page dracut.bootup
- install all host filesystem drivers
- use -D_FILE_OFFSET_BITS=64 to build dracut-install

dracut-026
==========
- introduce /usr/lib/dracut/dracut.conf.d/ drop-in directory

  /usr/lib/dracut/dracut.conf.d/*.conf can be overwritten by the same
  filenames in /etc/dracut.conf.d.

  Packages should use /usr/lib/dracut/dracut.conf.d rather than
  /etc/dracut.conf.d for drop-in configuration files.

  /etc/dracut.conf and /etc/dracut.conf.d belong to the system administrator.

- uses systemd-198 native initrd units
- totally rely on the fstab-generator in systemd mode for block devices
- dracut systemd now uses dracut.target rather than basic.target
- dracut systemd services optimize themselves away
- fixed hostonly parameter generation
- turn off curl globbing (fixes IPv6)
- modify the udev rules on install and not runtime time
- enable initramfs building without kernel modules (fixed regression)
- in the initqueue/timeout,
  reset the main loop counter, as we see new udev events or initqueue/work
- fixed udev rule installation

dracut-025
==========
- do not strip signed kernel modules
- add sosreport script and generate /run/initramfs/sosreport.txt
- make short uuid specification for allow-discards work
- turn off RateLimit for the systemd journal
- fixed MAC address assignment
- add systemd checkisomd5 service
- splitout drm kernel modules from plymouth module
- add 'swapoff' to initramfs to fix shutdown/reboot
- add team device support
- add pre-shutdown hook
- kill all processes in shutdown and report remaining ones
- "--device" changed to "--add-device" and "add_device=" added for conf files
- add memory usage trace to different hook points
- cope with optional field #7 in /proc/self/mountinfo
- lots of small bugfixes

dracut-024
==========
- new dracut option "--device"
- new dracut kernel command line options "rd.auto"
- new dracut kernel command line options "rd.noverifyssl"
- new dracut option "--kernel-cmdline" and "kernel_cmdline" option for default parameters
- fixes for systemd and crypto
- fix for kexec in shutdown, if not included in initramfs
- create the initramfs non-world readable
- prelink/preunlink in the initramfs
- strip binaries in the initramfs by default now
- various FIPS fixes
- various dracut-install fixes

dracut-023
==========
- resume from hibernate fixes
- -N option for --no-hostonly
- support for systemd crypto handling
- new dracut module "crypt-loop"
- deprecate the old kernel command line options
- more documentation
- honor CFLAGS for dracut-install build
- multipath fixes
- / is mounted according to rootflags parameter but forced ro at first.
  Later it is remounted according to /etc/fstab + rootflags parameter
  and "ro"/"rw".
- support for xfs / reiserfs separate journal device
- new "ro_mnt" option to force ro mount of / and /usr
- root on cifs support
- dracut-install: fixed issue for /var/tmp containing a symlink
- only lazy resolve with ldd, if the /var/tmp partition is not mounted with "noexec"
- i18n: fixed inclusion of "include" keymaps

dracut-022
==========
- fixed host-only kernel module bug

dracut-021
==========
- fixed systemd in the initramfs (requires systemd >= 187)
- dracut-install: massive speedup with /var on the same filesystem with COW copy
- dracut-install: moved to /usr/lib/dracut until it becomes a general purpose tool
- new options: "rd.usrmount.ro" and "rd.skipfsck"
- less mount/umount
- apply "ro" on the kernel command line also to /usr
- mount according to fstab, if neither "ro" or "rw" is specified
- skip fsck for xfs and btrfs. remount is enough
- give emergency_shell if /usr mount failed
- dracut now uses getopt:
  * options can be position independent now!!
  * we can now use --option=<arg>
- added option "--kver=<kernel-version>", and the image location can be omitted
  # dracut --kver 3.5.0-0.rc7.git1.2.fc18.x86_64
- dracut.sh: for --include copy also the symbolic links
- man pages: lsinitrd and mkinitrd added
- network: We do not support renaming in the kernel namespace anymore (as udev does
  that not anymore). So, if a user wants to use ifname, he has to rename
  to a custom namespace. "eth[0-9]+" is not allowed anymore. !!!!!
- resume: moved the resume process to the initqueue.
  This should prevent accidently mounting the root file system.
- testsuite: add support for: make V=1 TESTS="01 20 40" check
    $ sudo make V=1 clean check
    now runs the testsuite in verbose mode

    $ sudo make TESTS="01 20 40" clean check
    now only runs the 01, 20 and 40 tests.

dracut-020
==========
- changed rd.dasd kernel parameter
- arm kernel modules added to kernel-modules
- make udevdir systemdutildir systemdsystemunitdir global vars
  your distribution should ship those settings in
  /etc/dracut.conf.d/01-distro.conf
  see dracut.conf.d/fedora.conf.example
- kernel modules are now only handled with /sys/modules and modules.dep
- systemd fixups
- mdraid: wait for md devices to be clean, before shutdown
- ifup fixed for ipv6
- add PARTUUID as root=PARTUUID=<partition uuid> parameter
- fixed instmods() return code and set pipefail globally
- add 04watchdog dracut module
- dracut-shutdown.service: fixed ordering to be before shutdown.target
- make use of "ln -r" instead of shell functions, if new coreutils is installed
- network: support vlan tagged bonding
- new dracut module qemu and qemu-net to install all kernel driver
- fs-lib/fs-lib.sh: removed test mounting of btrfs and xfs
- no more "mknod" in the initramfs!!
- replaced all "tr" calls with "sed"
- speedup with lazy kernel module dependency resolving
- lots of speedup optimizations and last but not least
- dracut-install:
  - new binary to significanlty speedup the installation process
  - dracut-functions.sh makes use of it, if installed


dracut-019
==========
- initqueue/online hook
- fixes for ifcfg write out
- rootfs-block: avoid remount when options don't change
- Debian multiarch support
- virtfs root filesystem support
- cope with systemd-udevd
- mount tmpfs with strictatime
- include all kernel/drivers/net/phy drivers
- add debug_on() and debug_off() functions
- add arguments for source_hook() and source_all()
- cleanup hook
- plymouth: get consoledev from /sys/class/tty/console/active
- experimental systemd dracut module for systemd in the initramfs
- install xhci-hcd kernel module
- dracut: new "--mount" option
- lsinitrd: new option --printsize
- ARM storage kernel modules added
- s390 cms conf file support
- /etc/initrd-release in the initrd
- vlan support
- full bonding and bridge support
- removed scsi_wait_scan kernel module from standard install
- support rd.luks.allow-discards and honor options in crypttab
- lots of bugfixes

dracut-018
==========
- lvm: ignore lvm mirrors
- lsinitrd: handle LZMA images
- iscsi: add rd.iscsi.param
- iscsi: add iscsi interface binding
- new module cms to read and handle z-Series cms config files
- fixed fstab.sys handling
- new dracut option "--tmpdir"
- new dracut option "--no-hostonly"
- nbd: name based nbd connects
- converted manpage and documentation source to asciidoc
- write-ifcfg fixes and cleanups
- ifup is now done in the initqueue
- netroot cleanup
- initqueue/online is now for hooks, which require network
- no more /tmp/root.info
- 98pollcdrom: factored out the ugly cdrom polling in the main loop
- simplified rd.luks.uuid testing
- removed "egrep" and "ls" calls
- speedup kernel module installation
- make bzip2 optional
- lots of bugfixes

dracut-017
==========
- a _lot_ faster than dracut-016 in image creation
- systemd service dracut-shutdown.service
- livenet fixes
- ssh-client module install fix
- root=iscsi:... fixed
- lots of restructuring and optimizing in dracut-functions.sh
- usrmount: honor fs_passno in /etc/fstab
- renamed all shell scripts to .sh
- new option "--omit-drivers" and config option "omit_drivers"
- hostonly mode fixups

dracut-016
==========
- fixed lsinitrd
- honor binaries in sbin first
- fixed usrmount module
- added systemd service for shutdown
- fixed terminfo on distros with /usr/share/terminfo
- reload udev rules after "pre-trigger" hook
- improved test suite
- new parameter "--omit-drivers" and new conf param omit_drivers
- "--offroot" support for mdraid
- new libs: net-lib.sh, nfs-lib.sh, url-lib.sh, img-lib.sh
  full of functions to use in your dracut module

dracut-015
==========
- hostonly mode automatically adds command line options for root and /usr
- --add-fstab --mount parameters
- ssh-client module
- --ctty option: add job control
- cleanup /run/initramfs
- convertfs module
- /sbin/ifup can be called directly
- support kernel modules compressed with xz
- s390 iscsi modules added
- terminfo module
- lsinitrd can handle concatened images
- lsinitrd can sort by size

dracut-014
==========
- new dracut arguments:
  --lvmconf
  --nolvmconf
  --fscks [LIST]
  --nofscks
- new .conf options:
  install_items
  fscks
  nofscks
- new kernel options:
  rd.md.ddf
  rd.md.waitclean
  plymouth.enable
- dracut move from /sbin to /usr/bin
- dracut modules dir moved from /usr/share/dracut to /usr/lib/dracut
- profiling with "dracut --profile"
- new TEST-16-DMSQUASH, test for Fedora LiveCDs
- speedup of initramfs creation
- ask_for_password fallback to CLI
- mdraid completely switched to incremental assembly
- no more cdrom polling
- "switch_root" breakpoint is now very late
- /dev/live is gone
- /dev/root is gone
- fs-lib dracut module for fscks added
- xen dracut module removed
- usb mass storage kernel drivers now included
- usrmount dracut module added:
  mount /usr if found in /sysroot/etc/fstab
- only include fsck helper needed for hostonly
- fcoe: support for bnx2fc
- support iSCSI drivers: qla4xxx, cxgb3i, cxgb4i, bnx2i, be2iscsi
- fips-aesni dracut module added
- add install_items to dracut.conf
    install_items+=" <file>[ <file> ...] "
- speedup internal testsuite
- internal testsuite: store temporary data in a temporary dir

dracut-013
==========
- speedup of initramfs creation
- fixed inst_dir for symbolic links
- add unix kernel module

dracut-012
==========
- better fsck handling
- fixed wait condition for LVM volumes
- fix for hardlinks (welcome Debian! :-)
- shutdown bugfixes
- automatic busybox symlink creation
- try to mount /usr, if init points to a path in /usr
- btrfs with multiple devices
- "--force-add" option for dracut, to force-add dracut modules,
  without hostonly checks
- lsinitrd also display the initramfs size in human readable form
- livenet module, to mount live-isos over http
- masterkey,ecryptfs,integrity security modules
- initqueue/timeout queue e.g. for starting degraded raids
- "make rpm" creates an rpm with an increasing release number from any
  git checkout
- support lvm mirrors
- start degraded lvm mirrors after a timeout
- start degraded md raids after a timeout
- getarg() now returns wildcards without file matching to the current fs
- lots of bugfixes

dracut-011
==========
- use udev-168 features for shutting down udev
- introduce "--prefix" to put all initramfs files in e.g "/run/initramfs"
- new shutdown script (called by systemd >= 030) to disassemble the root device
- lots of bugfixes
- new module for gpg-encrypted keys - 91crypt-gpg

dracut-010
==========
- lots of bugfixes
- plymouth: use /run/plymouth/pid instead of /run/initramfs/plymouth
- add "/lib/firmware/updates" to default firmware path

dracut-009
==========
- dracut generator
  - dracut-logger
  - xz compression
  - better argument handling

- initramfs
  - hooks moved to /lib/dracut/hooks in initramfs
  - rd.driver.{blacklist|pre|post} accept comma separated driver list
  - iSCSI: iSCSI Boot Firmware Table (iBFT) support
  - support for /run
  - live image: support for generic rootfs.img (instead of ext3fs.img)
  - caps module
  - FCoE: EDD support

dracut-008
==========
- removed --ignore-kernel-modules option (no longer necessary)
- renamed kernel command line arguments to follow the rd. naming scheme
- merged check, install, installkernel to module-setup.sh
- support for bzip2 and xz compressed initramfs images.
- source code beautification
- lots of documentation
- lsinitrd: "catinitrd" functionality
- dracut: --list-modules
- lvm: support for dynamic LVM SNAPSHOT root volume
- 95fstab-sys: mount all /etc/fstab.sys volumes before switch_root
- 96insmodpost dracut module
- rd.shell=1 per default
- rootfs-block:mount-root.sh add fsck
- busybox shell replacements module
- honor old "real_init="
- 97biosdevname dracut module

dracut-007
==========
- module i18n is no longer fedora/red hat specific (Amadeusz Żołnowski)
- distribution specific conf file
- bootchartd support
- debug module now has fsck
- use "hardlink", if available, to save some space
- /etc/dracut.conf can be overwritten by settings in /etc/dracut.conf.d/*.conf
- gentoo splash module
- --ignore-kernel-modules option
- crypto keys on external devices support
- bugfixes

dracut-006
==========
- fixed mdraid with IMSM
- fixed dracut manpages
- dmraid parse different error messages
- add cdrom polling mechanism for slow cdroms
- add module btrfs
- add btrfsctl scan for btrfs multi-devices (raid)
- teach dmsquash live-root to use rootflags
- trigger udev with action=add
- fixed add_drivers handling
- add sr_mod
- use pigz instead of gzip, if available
- boot from LVM mirrors and snapshots
- iscsi: add support for multiple netroot=iscsi:
- Support old version of module-init-tools
- got rid of rdnetdebug
- fixed "ip=auto6"
- dracut.conf: use "+=" as default for config variables
- bugfixes

dracut-005
==========
- dcb support to dracut's FCoE support
- add readonly overlay support for dmsquash
- add keyboard kernel modules
- dracut.conf: added add_dracutmodules
- add /etc/dracut.conf.d
- add preliminary IPv6 support
- bugfixes

dracut-004
==========
- dracut-lib: read multiple lines from $init/etc/cmdline
- lsinitrd and mkinitrd
- dmsquash: add support for loopmounted *.iso files
- lvm: add rd_LVM_LV and "--poll n"
- user suspend support
- add additional drivers in host-only mode, too
- improved emergency shell
- support for compressed kernel modules
- support for loading Xen modules
- rdloaddriver kernel command line parameter
- man pages for dracut-catimages and dracut-gencmdline
- bugfixes

dracut-003
==========
- add debian package modules
- add dracut.conf manpage
- add module 90multipath
- add module 01fips
- crypt: ignore devices in /etc/crypttab (root is not in there)
  unless rd_NO_CRYPTTAB is specified
- kernel-modules: add scsi_dh scsi_dh_rdac scsi_dh_emc
- add multinic support
- add s390 zfcp support
- add s390 dasd support
- add s390 network support
- fixed dracut-gencmdline for root=UUID or LABEL
- do not destroy assembled raid arrays if mdadm.conf present
- mount /dev/shm
- let udevd not resolve group and user names
- moved network from udev to initqueue
- improved debug output: specifying "rdinitdebug" now logs
  to dmesg, console and /init.log
- strip kernel modules which have no x bit set
- redirect stdin, stdout, stderr all RW to /dev/console
  so the user can use "less" to view /init.log and dmesg
- add new device mapper udev rules and dmeventd
- fixed dracut-gencmdline for root=UUID or LABEL
- do not destroy assembled raid arrays if mdadm.conf present
- mount /dev/shm
- let udevd not resolve group and user names
- preserve timestamps of tools on initramfs generation
- generate symlinks for binaries correctly
- moved network from udev to initqueue
- mount nfs3 with nfsvers=3 option and retry with nfsvers=2
- fixed nbd initqueue-finished
- improved debug output: specifying "rdinitdebug" now logs
  to dmesg, console and /init.log
- strip kernel modules which have no x bit set
- redirect stdin, stdout, stderr all RW to /dev/console
  so the user can use "less" to view /init.log and dmesg
- make install of new dm/lvm udev rules optionally
- add new device mapper udev rules and dmeventd
- Fix LiveCD boot regression
- bail out if selinux policy could not be loaded and
  selinux=0 not specified on kernel command line
- do not cleanup dmraids
- copy over lvm.conf

dracut-002
==========
- add ifname= argument for persistent netdev names
- new /initqueue-finished to check if the main loop can be left
- copy mdadm.conf if --mdadmconf set or mdadmconf in dracut.conf
- plymouth: use plymouth-populate-initrd
- add add_drivers for dracut and dracut.conf
- add modprobe scsi_wait_scan to be sure everything was scanned
- fix for several problems with md raid containers
- fix for selinux policy loading
- fix for mdraid for IMSM
- fix for bug, which prevents installing 61-persistent-storage.rules (bug #520109)
- fix for missing grep for md

dracut-001
==========
- better --hostonly checks
- better lvm/mdraid/dmraid handling
- fcoe booting support
    Supported cmdline formats:
    fcoe=<networkdevice>:<dcb|nodcb>
    fcoe=<macaddress>:<dcb|nodcb>

    Note currently only nodcb is supported, the dcb option is reserved for
    future use.

    Note letters in the macaddress must be lowercase!

    Examples:
    fcoe=eth0:nodcb
    fcoe=4A:3F:4C:04:F8:D7:nodcb

- Syslog support for dracut
    This module provides syslog functionality in the initrd.
    This is especially interesting when complex configuration being
    used to provide access to the device the rootfs resides on.


dracut-0.9
==========
- let plymouth attach to the terminal (nice text output now)
- new kernel command line parameter "rdinfo" show dracut output, even when
  "quiet" is specified
- rd_LUKS_UUID is now handled correctly
- dracut-gencmdline: rd_LUKS_UUID and rd_MD_UUID is now correctly generated
- now generates initrd-generic with around 15MB
- smaller bugfixes

dracut-0.8
==========
- iSCSI with username and password
- support for live images (dmsquashed live images)
- iscsi_firmware fixes
- smaller images
- bugfixes

dracut-0.7
==========
- dracut:     strip binaries in initramfs

           --strip
                  strip binaries in the initramfs (default)

           --nostrip
                  do not strip binaries in the initramfs
- dracut-catimages

    Usage: ./dracut-catimages [OPTION]... <initramfs> <base image>
    [<image>...]
    Creates initial ramdisk image by concatenating several images from the
    command
    line and /boot/dracut/

      -f, --force           Overwrite existing initramfs file.
      -i, --imagedir        Directory with additional images to add
                            (default: /boot/dracut/)
      -o, --overlaydir      Overlay directory, which contains files that
                            will be used to create an additional image
      --nooverlay           Do not use the overlay directory
      --noimagedir          Do not use the additional image directory
      -h, --help            This message
      --debug               Output debug information of the build process
      -v, --verbose         Verbose output during the build process

- s390 dasd support

dracut-0.6
==========
- dracut: add --kernel-only and --no-kernel arguments

           --kernel-only
                  only install kernel drivers and firmware files

           --no-kernel
                  do not install kernel drivers and firmware files

    All kernel module related install commands moved from "install"
    to "installkernel".

    For "--kernel-only" all installkernel scripts of the specified
    modules are used, regardless of any checks, so that all modules
    which might be needed by any dracut generic image are in.

    The basic idea is to create two images. One image with the kernel
    modules and one without. So if the kernel changes, you only have
    to replace one image.

    Grub and the kernel can handle multiple images, so grub entry can
    look like this:

    title Fedora (2.6.29.5-191.fc11.i586)
            root (hd0,0)
            kernel /vmlinuz-2.6.29.5-191.fc11.i586 ro rhgb quiet
            initrd /initrd-20090722.img /initrd-kernel-2.6.29.5-191.fc11.i586.img /initrd-config.img

    initrd-20090722.img
      the image provided by the initrd rpm
      one old backup version is kept like with the kernel

    initrd-kernel-2.6.29.5-191.fc11.i586.img
      the image provided by the kernel rpm

    initrd-config.img
      optional image with local configuration files

- dracut: add --kmoddir directory, where to look for kernel modules

           -k, --kmoddir [DIR]
                  specify the directory, where to look for kernel modules



dracut-0.5
==========
- more generic (all plymouth modules, all keyboards, all console fonts)
- more kernel command line parameters (see also man dracut(8))
- a helper tool, which generates the kernel command line (dracut-gencmdline)
- bridged network boot
- a lot of new command line parameter

dracut-0.4
==========
- bugfixes
- firmware loading support
- new internal queue (initqueue)
    initqueue now loops until /dev/root exists or root is mounted

    init now has the following points to inject scripts:

    /cmdline/*.sh
       scripts for command line parsing

    /pre-udev/*.sh
       scripts to run before udev is started

    /pre-trigger/*.sh
       scripts to run before the main udev trigger is pulled

    /initqueue/*.sh
       runs in parallel to the udev trigger
       Udev events can add scripts here with /sbin/initqueue.
       If /sbin/initqueue is called with the "--onetime" option, the script
       will be removed after it was run.
       If /initqueue/work is created and udev >= 143 then this loop can
       process the jobs in parallel to the udevtrigger.
       If the udev queue is empty and no root device is found or no root
       filesystem was mounted, the user will be dropped to a shell after
       a timeout.
       Scripts can remove themselves from the initqueue by "rm $job".

    /pre-mount/*.sh
       scripts to run before the root filesystem is mounted
       NFS is an exception, because it has no device node to be created
       and mounts in the udev events

    /mount/*.sh
       scripts to mount the root filesystem
       NFS is an exception, because it has no device node to be created
       and mounts in the udev events
       If the udev queue is empty and no root device is found or no root
       filesystem was mounted, the user will be dropped to a shell after
       a timeout.

    /pre-pivot/*.sh
       scripts to run before the real init is executed and the initramfs
       disappears
       All processes started before should be killed here.

    The behaviour of the dmraid module demonstrates how to use the new
    mechanism. If it detects a device which is part of a raidmember from a
    udev rule, it installs a job to scan for dmraid devices, if the udev
    queue is empty. After a scan, it removes itsself from the queue.



dracut-0.3
==========

- first public version

  0707010000001D000081A400000000000000000000000164DF2CB800000A69000000000000000000000000000000000000002800000000dracut-055+suse.347.gdcb9bdbf/README.md   dracut
====

dracut is an event driven initramfs infrastructure.

[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](.github/CODE_OF_CONDUCT.md)
[![Fedora-32](https://github.com/dracutdevs/dracut/workflows/Fedora-32/badge.svg?branch=master)](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-32)
[![Fedora-33](https://github.com/dracutdevs/dracut/workflows/Fedora-33/badge.svg?branch=master)](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-33)
[![Fedora-latest](https://github.com/dracutdevs/dracut/workflows/Fedora-latest/badge.svg?branch=master)](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-latest)

dracut (the tool) is used to create an initramfs image by copying tools
and files from an installed system and combining it with the
dracut framework, usually found in /usr/lib/dracut/modules.d.

Unlike other implementations, dracut hard-codes as little
as possible into the initramfs. The initramfs has
(basically) one purpose in life -- getting the rootfs mounted so that
we can transition to the real rootfs.  This is all driven off of
device availability.  Therefore, instead of scripts hard-coded to do
various things, we depend on udev to create device nodes for us and
then when we have the rootfs's device node, we mount and carry on.
This helps to keep the time required in the initramfs as little as
possible so that things like a 5 second boot aren't made impossible as
a result of the very existence of an initramfs.

Most of the initramfs generation functionality in dracut is provided by a bunch
of generator modules that are sourced by the main dracut script to install
specific functionality into the initramfs.  They live in the modules.d
subdirectory, and use functionality provided by dracut-functions to do their
work.

Currently dracut lives on github.com and kernel.org.

The tarballs can be found here:
	http://www.kernel.org/pub/linux/utils/boot/dracut/
	ftp://ftp.kernel.org/pub/linux/utils/boot/dracut/

Git:
        https://github.com/dracutdevs/dracut.git
        http://git.kernel.org/?p=boot/dracut/dracut.git

Project Documentation:
	http://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html

Project Wiki:
	http://dracut.wiki.kernel.org

See the github issue tracker for things which still need to be done and HACKING.md
for some instructions on how to get started.  There is also a mailing list
that is being used for the discussion -- initramfs@vger.kernel.org.
It is a typical vger list, send mail to majordomo@vger.kernel.org with body
of 'subscribe initramfs email@host.com'


Licensed under the GPLv2
   0707010000001E000081ED00000000000000000000000164DF2CB800001092000000000000000000000000000000000000002800000000dracut-055+suse.347.gdcb9bdbf/configure   #!/bin/bash

# We don't support srcdir != builddir
echo \#buildapi-variable-no-builddir > /dev/null

prefix=/usr

enable_documentation=yes
enable_dracut_cpio=no

CC="${CC:-cc}"
PKG_CONFIG="${PKG_CONFIG:-pkg-config}"

# Little helper function for reading args from the commandline.
# it automatically handles -a b and -a=b variants, and returns 1 if
# we need to shift $3.
read_arg() {
    # $1 = arg name
    # $2 = arg value
    # $3 = arg parameter
    local rematch='^[^=]*=(.*)$'
    if [[ $2 =~ $rematch ]]; then
        read -r "$1" <<< "${BASH_REMATCH[1]}"
    else
        read -r "$1" <<< "$3"
        # There is no way to shift our callers args, so
        # return 1 to indicate they should do it instead.
        return 1
    fi
    return 0
}

while (($# > 0)); do
    case "${1%%=*}" in
        --prefix) read_arg prefix "$@" || shift ;;
        --libdir) read_arg libdir "$@" || shift ;;
        --datadir) read_arg datadir "$@" || shift ;;
        --sysconfdir) read_arg sysconfdir "$@" || shift ;;
        --sbindir) read_arg sbindir "$@" || shift ;;
        --mandir) read_arg mandir "$@" || shift ;;
        --disable-documentation) enable_documentation=no ;;
        --program-prefix) read_arg programprefix "$@" || shift ;;
        --exec-prefix) read_arg execprefix "$@" || shift ;;
        --bindir) read_arg bindir "$@" || shift ;;
        --includedir) read_arg includedir "$@" || shift ;;
        --libexecdir) read_arg libexecdir "$@" || shift ;;
        --localstatedir) read_arg localstatedir "$@" || shift ;;
        --sharedstatedir) read_arg sharedstatedir "$@" || shift ;;
        --infodir) read_arg infodir "$@" || shift ;;
        --systemdsystemunitdir) read_arg systemdsystemunitdir "$@" || shift ;;
        --bashcompletiondir) read_arg bashcompletiondir "$@" || shift ;;
        --enable-dracut-cpio) enable_dracut_cpio=yes ;;
        *) echo "Ignoring unknown option '$1'" ;;
    esac
    shift
done

if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then
    echo "dracut needs pkg-config and libkmod >= 23." >&2
    exit 1
fi

cat << EOF > conftest.c
#include <fts.h>
int main() {
	return 0;
}
EOF

# shellcheck disable=SC2086
${CC} $CFLAGS $LDFLAGS conftest.c > /dev/null 2>&1
ret=$?
rm -f conftest.c a.out

# musl doesn't have fts.h included
if test $ret -ne 0; then
    echo "dracut needs fts development files." >&2
    exit 1
fi

cat << EOF > conftest.c
#include <fts.h>
int main(void) {
	fts_open(0, 0, 0);
	return 0;
}
EOF

found=no
for lib in "-lc" "-lfts"; do
    # shellcheck disable=SC2086
    ${CC} $CFLAGS $LDFLAGS conftest.c -Wl,$lib > /dev/null 2>&1
    ret=$?
    if test $ret -eq 0; then
        FTS_LIBS="$lib"
        found=yes
        break
    fi
done
rm -f conftest.c a.out

if test $found = no; then
    echo "dracut couldn't find usable fts library" >&2
    exit 1
fi

if test "$enable_dracut_cpio" = "yes"; then
    cargo --version > /dev/null
    ret=$?
    if test $ret -ne 0; then
        echo "dracut couldn't find cargo for dracut-cpio build"
        exit 1
    fi
fi

cat > Makefile.inc.$$ << EOF
prefix ?= ${prefix}
libdir ?= ${libdir:-${prefix}/lib}
datadir ?= ${datadir:-${prefix}/share}
sysconfdir ?= ${sysconfdir:-${prefix}/etc}
sbindir ?= ${sbindir:-${prefix}/sbin}
mandir ?= ${mandir:-${prefix}/share/man}
enable_documentation ?= ${enable_documentation:-yes}
enable_dracut_cpio ?= ${enable_dracut_cpio}
bindir ?= ${bindir:-${prefix}/bin}
KMOD_CFLAGS ?= $(${PKG_CONFIG} --cflags " libkmod >= 23 ")
KMOD_LIBS ?= $(${PKG_CONFIG} --libs " libkmod >= 23 ")
FTS_LIBS ?= ${FTS_LIBS}
EOF

{
    [[ $programprefix ]] && echo "programprefix ?= ${programprefix}"
    [[ $execprefix ]] && echo "execprefix ?= ${execprefix}"
    [[ $includedir ]] && echo "includedir ?= ${includedir}"
    [[ $libexecdir ]] && echo "libexecdir ?= ${libexecdir}"
    [[ $localstatedir ]] && echo "localstatedir ?= ${localstatedir}"
    [[ $sharedstatedir ]] && echo "sharedstatedir ?= ${sharedstatedir}"
    [[ $infodir ]] && echo "infodir ?= ${infodir}"
    [[ $systemdsystemunitdir ]] && echo "systemdsystemunitdir ?= ${systemdsystemunitdir}"
    [[ $bashcompletiondir ]] && echo "bashcompletiondir ?= ${bashcompletiondir}"
} >> Makefile.inc.$$

mv Makefile.inc.$$ Makefile.inc
  0707010000001F000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002300000000dracut-055+suse.347.gdcb9bdbf/docs    07070100000020000081A400000000000000000000000164DF2CB800000E62000000000000000000000000000000000000002B00000000dracut-055+suse.347.gdcb9bdbf/docs/BASH.md    # BASH Notes

## basename
Don't use `basename`, use:
```shell
  file=${path##*/}
```

## dirname
Don't use `dirname`, use:
```shell
  dir=${path%/*}
```

## shopt
If you set `shopt` in a function, reset to its default state with `trap`:
```shell
func() {
  trap "$(shopt -p nullglob globstar)" RETURN
  shopt -q -s nullglob globstar
}
```

## find, grep, print0, -0, -z

Don't use `find` in `for` loops, because filenames can contain spaces.
Try to use `globstar` and `nullglob` or null byte terminated strings.

Instead of:
```shell
func() {
    for file in $(find /usr/lib* -type f -name 'lib*.a' -print0 ); do
      echo $file
    done
}
```

use:
```shell
func() {
    trap "$(shopt -p nullglob globstar)" RETURN
    shopt -q -s nullglob globstar

    for file in /usr/lib*/**/lib*.a; do
      [[ -f $file ]] || continue
      echo "$file"
    done
}
```

Or collect the filenames in an array, if you need them more than once:
```shell
func() {
    trap "$(shopt -p nullglob globstar)" RETURN
    shopt -q -s nullglob globstar

    filenames=( /usr/lib*/**/lib*.a )

    for file in "${filenames[@]}"; do
      [[ -f $file ]] || continue
      echo "$file"
    done
}
```

Or, if you really want to use `find`, use `-print0` and an array:
```shell
func() {
    mapfile -t -d '' filenames < <(find /usr/lib* -type f -name 'lib*.a' -print0)
    for file in "${filenames[@]}"; do
      echo "$file"
    done
}
```

Note: `-d ''` is the same as `-d $'\0'` and sets the null byte as the delimiter.

or:
```shell
func() {
    find /usr/lib* -type f -name 'lib*.a' -print0 | while read -r -d '' file; do
      echo "$file"
    done
}
```

or
```shell
func() {
    while read -r -d '' file; do
      echo "$file"
    done < <(find /usr/lib* -type f -name 'lib*.a' -print0)
}
```

Use the tool options for null terminated strings, like `-print0`, `-0`, `-z`, etc.

## prefix or suffix array elements

Instead of:
```shell
func() {
  other-cmd $(for k in "$@"; do echo "prefix-$k"; done)
}
```
do
```shell
func() {
  other-cmd "${@/#/prefix-}"
}
```

or suffix:
```shell
func() {
  other-cmd "${@/%/-suffix}"
}
```

## Join array elements with a separator char

Here we have an associate array `_drivers`, where we want to print the keys separated by ',':
```shell
    if [[ ${!_drivers[*]} ]]; then
        echo "rd.driver.pre=$(IFS=, ;echo "${!_drivers[*]}")" > "${initdir}"/etc/cmdline.d/00-watchdog.conf
    fi
```

## Optional parameters to commands

If you want to call a command `cmd` with an option, if a variable is set, rather than doing:

```shell
func() {
  local param="$1"

  if [[ $param ]]; then
    param="--this-special-option $param"
  fi

  cmd $param
}
```

do it like this:

```shell
func() {
  local param="$1"

  cmd ${param:+--this-special-option "$param"}
}

# cmd --this-special-option 'abc'
func 'abc'

# cmd
func ''

# cmd
func
```

If you want to specify the option even with an empty string do this:

```shell
func() {
  local -a special_params

  if [[ ${1+_} ]]; then
    # only declare `param` if $1 is set (even as null string)
    local param="$1"
  fi

  # check if `param` is set (even as null string)
  if [[ ${param+_} ]]; then
    special_params=( --this-special-option "${param}" )
  fi

  cmd ${param+"${special_params[@]}"}
}

# cmd --this-special-option 'abc'
func 'abc'

# cmd --this-special-option ''
func ''

# cmd
func
```

Or more simple, if you only have to set an option:
```shell
func() {
  if [[ ${1+_} ]]; then
    # only declare `param` if $1 is set (even as null string)
    local param="$1"
  fi

  cmd ${param+--this-special-option}
}

# cmd --this-special-option
func 'abc'

# cmd --this-special-option
func ''

# cmd
func
```

  07070100000021000081A400000000000000000000000164DF2CB800000F01000000000000000000000000000000000000003600000000dracut-055+suse.347.gdcb9bdbf/docs/CODE_OF_CONDUCT.md # Dracut Code of Conduct

This code of conduct outlines our expectations for participants within the Dracut community, as well as steps for reporting unacceptable behavior.
We are committed to providing a welcoming and inspiring community for all and expect our code of conduct to be honored. 
Anyone who violates this code of conduct may be banned from the community.

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others’ private information, such as a physical or email address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainer responsible for enforcement Harald Hoyer <harald@redhat.com>. 
All complaints will be reviewed and investigated promptly and fairly and will result in a response that is deemed necessary and appropriate to the circumstances.
Project maintainers are obligated to respect the privacy and security of the reporter of any incident.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. 
Translations are available at https://www.contributor-covenant.org/translations.
   07070100000022000081A400000000000000000000000164DF2CB80000277D000000000000000000000000000000000000002E00000000dracut-055+suse.347.gdcb9bdbf/docs/HACKING.md # Dracut Developer Guidelines

## git

Currently dracut lives on github.com and kernel.org.

* https://github.com/dracutdevs/dracut.git
* https://git.kernel.org/pub/scm/boot/dracut/dracut.git

Pull requests should be filed preferably on github nowadays.

### Code Format

It is recommended, that you install a plugin for your editor, which reads in `.editorconfig`.
Additionally `emacs` and `vim` config files are provided for convenience.

To reformat C files use `astyle`:
```console
$ astyle --options=.astylerc <FILE>
```

For convenience there is also a Makefile `indent-c` target `make indent-c`.

To reformat shell files use `shfmt`:

```console
$ shfmt_version=3.2.4
$ wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O shfmt
$ chmod u+x shfmt
$ ./shfmt -w -s .
```

or

```console
$ GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt
$ $GOPATH/bin/shfmt -w -s .
```

or if `shfmt` is already in your `PATH`, use `make indent`.

Some IDEs already have support for shfmt.

For convenience the `make indent` Makefile target also calls shfmt, if it is in `$PATH`.

### Commit Messages

Commit messages should answer these questions:

* What?: a short summary of what you changed in the subject line.
* Why?: what the intended outcome of the change is (arguably the most important piece of information that should go into a message).
* How?: if multiple approaches for achieving your goal were available, you also want to explain why you chose the used implementation strategy.
  Note that you should not explain how your change achieves your goal in your commit message.
  That should be obvious from the code itself.
  If you cannot achieve that clarity with the used programming language, use comments within the code instead.

The commit message is primarily the place for documenting the why.

Commit message titles should follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).

Format is `<type>[optional scope]: <description>`, where `type` is one of:

* fix: A bug fix
* feat: A new feature
* perf: A code change that improves performance
* refactor: A code change that neither fixes a bug nor adds a feature
* style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
* test: Adding missing tests or correcting existing tests
* docs: Documentation only changes
* revert: Reverts a previous commit
* chore: Other changes that don't modify src or test files
* build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
* ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)

`scope` should be the module name (without numbers) or:

* cli: for the dracut command line interface
* rt: for the dracut initramfs runtime logic
* functions: for general purpose dracut functions

Commit messages are checked with [Commisery](https://github.com/tomtom-international/commisery).

## Writing modules

Some general rules for writing modules:

* Use one of the inst family of functions to actually install files
  on to the initramfs.  They handle mangling the pathnames and (for binaries,
  scripts, and kernel modules) installing dependencies as appropriate so
  you do not have to.
* Scripts that end up on the initramfs should be POSIX compliant. dracut
  will try to use /bin/dash as /bin/sh for the initramfs if it is available,
  so you should install it on your system -- dash aims for strict POSIX
  compliance to the extent possible.
* Hooks MUST be POSIX compliant -- they are sourced by the init script,
  and having a bashism break your user's ability to boot really sucks.
* Generator modules should have a two digit numeric prefix -- they run in
  ascending sort order. Anything in the 90-99 range is stuff that dracut
  relies on, so try not to break those hooks.
* Hooks must have a .sh extension.
* Generator modules are described in more detail later on.
* We have some breakpoints for debugging your hooks.  If you pass 'rdbreak'
  as a kernel parameter, the initramfs will drop to a shell just before
  switching to a new root. You can pass 'rdbreak=hookpoint', and the initramfs
  will break just before hooks in that hookpoint run.

Also, there is an attempt to keep things as distribution-agnostic as
possible.  Every distribution has their own tool here and it's not
something which is really interesting to have separate across them.
So contributions to help decrease the distro-dependencies are welcome.

Most of the functionality that dracut implements are actually implemented
by dracut modules.  dracut modules live in modules.d, and have the following
structure:

```
dracut_install_dir/modules.d/
	00modname/
		module-setup.sh
		check
		<other files as needed by the hook>
```

`00modname`: The name of the module prefixed by a two-digit numeric sort code.
	   The numeric code must be present and in the range of 00 - 99.
	   Modules with lower numbers are installed first.  This is important
	   because the dracut install functions (which install files onto
	   the initrd) refuse to overwrite already installed files. This makes
	   it easy for an earlier module to override the functionality of a
	   later module, so that you can have a distro or system specific
	   module override or modify the functionality of a generic module
	   without having to patch the more generic module.

`module-setup.sh`:
	 dracut sources this script to install the functionality that a
	 module implements onto the initrd.  For the most part, this amounts
	 to copying files from the host system onto the initrd in a controlled
	 manner.

`install()`:
	 This function of module-setup.sh is called to install all
	 non-kernel files. dracut supplies several install functions that are
	 specialized for different file types.  Browse through dracut-functions
	 fore more details.  dracut also provides a $moddir variable if you
	 need to install a file from the module directory, such as an initrd
	 hook, a udev rule, or a specialized executable.

`installkernel()`:
	 This function of module-setup.sh is called to install all
	 kernel related files.


`check()`:
       dracut calls this function to check and see if a module can be installed
       on the initrd.

       When called without options, check should check to make sure that
       any files it needs to install into the initrd from the host system
       are present.  It should exit with a 0 if they are, and a 1 if they are
       not.

       When called with $hostonly set, it should perform the same check
       that it would without it set, and it should also check to see if the
       functionality the module implements is being used on the host system.
       For example, if this module handles installing support for LUKS
       encrypted volumes, it should return 0 if all the tools to handle
       encrpted volumes are available and the host system has the root
       partition on an encrypted volume, 1 otherwise.

`depends()`:
       This function should output a list of dracut modules
       that it relies upon.  An example would be the nfs and iscsi modules,
       which rely on the network module to detect and configure network
       interfaces.

Any other files in the module will not be touched by dracut directly.

You are encouraged to provide a README that describes what the module is for.


### Hooks

init has the following hook points to inject scripts:

`/lib/dracut/hooks/cmdline/*.sh`
   scripts for command line parsing

`/lib/dracut/hooks/pre-udev/*.sh`
   scripts to run before udev is started

`/lib/dracut/hooks/pre-trigger/*.sh`
   scripts to run before the main udev trigger is pulled

`/lib/dracut/hooks/initqueue/*.sh`
   runs in parallel to the udev trigger
   Udev events can add scripts here with /sbin/initqueue.
   If /sbin/initqueue is called with the "--onetime" option, the script
   will be removed after it was run.
   If /lib/dracut/hooks/initqueue/work is created and udev >= 143 then
   this loop can process the jobs in parallel to the udevtrigger.
   If the udev queue is empty and no root device is found or no root
   filesystem was mounted, the user will be dropped to a shell after
   a timeout.
   Scripts can remove themselves from the initqueue by "rm $job".

`/lib/dracut/hooks/pre-mount/*.sh`
   scripts to run before the root filesystem is mounted
   Network filesystems like NFS that do not use device files are an
   exception. Root can be mounted already at this point.

`/lib/dracut/hooks/mount/*.sh`
   scripts to mount the root filesystem
   If the udev queue is empty and no root device is found or no root
   filesystem was mounted, the user will be dropped to a shell after
   a timeout.

`/lib/dracut/hooks/pre-pivot/*.sh`
   scripts to run before latter initramfs cleanups

`/lib/dracut/hooks/cleanup/*.sh`
   scripts to run before the real init is executed and the initramfs
   disappears
   All processes started before should be killed here.


## Testsuite

### Rootless in a container with podman

```console
$ cd <DRACUT_SOURCE>
$ podman pull [CONTAINER]
$ podman run --rm -it \
    --cap-add=SYS_PTRACE --user 0 \
    -v /dev:/dev -v ./:/dracut:z \
    [CONTAINER] \
    bash -l
# cd /dracut
# ./configure
# make -j $(getconf _NPROCESSORS_ONLN)
# cd test
# make V=1 SKIP="16 60 61" clean check
```

with `[CONTAINER]` being one of the
[github `dracutdevs` containers](https://github.com/orgs/dracutdevs/packages),
e.g. `ghcr.io/dracutdevs/fedora:latest`.

### On bare metal

For the testsuite to pass, you will have to install at least the software packages
mentioned in the `test/container` Dockerfiles.

```
$ sudo make clean check
```

in verbose mode:
```
$ sudo make V=1 clean check
```

only specific test:
```
$ sudo make TESTS="01 20 40" clean check
```
only runs the 01, 20 and 40 tests.

debug a specific test case:
```
$ cd TEST-01-BASIC
$ sudo make clean setup run
```
... change some kernel parameters in `test.sh` ...
```
$ sudo make run
```
to run the test without doing the setup.
   07070100000023000081A400000000000000000000000164DF2CB8000007C9000000000000000000000000000000000000003000000000dracut-055+suse.347.gdcb9bdbf/docs/README.cross   Dracut supports running against a sysroot directory that is different
from the actual root (/) directory of the running system. It is most
useful for creating/bootstrapping a new system that may or may not be
using the same CPU architecture as the host system, i.e. building a
whole Linux system with a cross-compiler framework like Yocto.

The user-visible frontend change is the introduction of a new option
called "-r" or "--sysroot". It expects a directory that contains the
complete Linux system that has all the files (kernel drivers, firmware,
executables, libraries and others) necessary to construct the initramfs.

E.g: dracut --sysroot /path/to/sysroot initramfs.img kernelversion

To support this, a new global variable was introduced inside dracut.
This variable is called "dracutsysrootdir" and all the files installed
into the initramfs image is searched relative to the sysroot directory.
This variable can also be set externally to dracut without using option
-r/--sysroot.

There are other details that are necessary to tweak to be able to
run on cross-compiled (a.k.a. foreign) binaries.

dracut uses these crucial utilities during its operation:

ldd
===
It lists dynamic library dependencies for executables or libraries

ldconfig
========
It creates /etc/ld.so.cache, i.e. the cached information about libraries
known to the system.

These utilities the way they exist on the host system only work on
the host system.

To support cross-compiled binaries, a different ldd variant is needed that
works on those binaries. One such ldd script is found at
https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f

ldconfig in GLIBC as is does support a sysroot with its -r option.

Extra environment variables needed to run dracut on the sysroot are
documented in the dracut(8) man page.

For the Plymouth boot splash to be added to the initramfs image,
this gitlab PR is needed for Plymouth:
https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/72
   07070100000024000081A400000000000000000000000164DF2CB8000001B4000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/docs/README.generic To build a generic initramfs, you have to install the following software packages:
 * device-mapper
 * cryptsetup-luks
 * rpcbind nfs-utils
 * lvm2
 * iscsi-initiator-utils
 * nbd
 * mdadm
 * net-tools iproute

Generic initramfs'es are huge (usually over 10 megs in size uncompressed), but
should be able to automatically boot any bootable configuration with appropriate
boot flags (root device, network configuration information, etc.)07070100000025000081A400000000000000000000000164DF2CB8000000AF000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/docs/README.kernel  "dracut --kernel-only" is to build an initrd with only kernel modules and firmware files.
"dracut --kernel-only" only executes "installkernel" in the modules subdirectories.

 07070100000026000081A400000000000000000000000164DF2CB8000006F9000000000000000000000000000000000000002E00000000dracut-055+suse.347.gdcb9bdbf/docs/RELEASE.md # Conducting A Successful Release

This documents contains the necessary steps to conduct a successful release.

1. Add all items to `NEWS.md`

    Get a first template with [`clog`](https://github.com/clog-tool/clog-cli)
    ```console
    $ clog -F -r https://github.com/dracutdevs/dracut
    ```

2. Update the contributors list in NEWS.md

   Produce the list with:
   ```console
   $ make CONTRIBUTORS
   ```

   Append the list to the section in `NEWS.md`

3. Update AUTHORS

   ```console
   $ make AUTHORS
   ```

4. Check in AUTHORS and NEWS.md

   ```console
   $ git ci -m "docs: update NEWS.md and AUTHORS" NEWS.md AUTHORS
   ```

5. Tag the release and push

   ```console
   $ VERSION=052
   $ git tag -s "$VERSION"
   $ git push --tags
   ```

   Add the section from `NEWS.md` to the git tag message.

6. Push git to kernel.org

   With:
   ```console
   $ git remote add kernelorg ssh://gitolite@ra.kernel.org/pub/scm/boot/dracut/dracut.git
   ```

   Push to kernel.org git:
   ```console
   $ git push --atomic kernelorg master "$VERSION"
   ```


7. Sign and upload tarballs to kernel.org

   ```console
   $ make upload
   ```

   This requires `kup` and a kernel.org account.
   Wait until the tarballs are synced to http://www.kernel.org/pub/linux/utils/boot/dracut/ .

8. Create a new release on github (https://github.com/dracutdevs/dracut/releases/new)
   - Add the section from `NEWS.md` to the release.
   - Attach the tarballs and signature file from http://www.kernel.org/pub/linux/utils/boot/dracut/ to the github release.

9. Close the github milestone and open a new one (https://github.com/dracutdevs/dracut/milestones)
10. Ensure that announcement was sent and reached the linux-initramfs mailinglist (https://www.spinics.net/lists/linux-initramfs/)
   07070100000027000081A400000000000000000000000164DF2CB8000001A7000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/docs/SECURITY.md    Security is very important to us. If you discover any issue regarding security, we'd appreciate a non-public disclosure of
the information, so  please disclose the information responsibly by sending an email to Harald Hoyer harald@redhat.com and not by creating a GitHub issue. 
We will respond swiftly to fix verifiable security issues with the disclosure being coordinated with distributions and relevant security teams.
 07070100000028000081A400000000000000000000000164DF2CB8000039C0000000000000000000000000000000000000002E00000000dracut-055+suse.347.gdcb9bdbf/docs/dracut.css <?xml version="1.0"?>
<style>

body, h1, h2, h3, h4, h5, h6, pre, li, div {
	line-height: 1.29em;
}

body {
	background-color: white;
	margin:0 auto;
	font-family: "liberation sans", "Myriad ", "Bitstream Vera Sans", "Lucida Grande", "Luxi Sans", "Trebuchet MS", helvetica, verdana, arial, sans-serif;
	font-size:12px;
	max-width:55em;
	color:black;
}

/* desktop styles */
body.desktop {
	margin-left: 26em;
}

body.desktop .book > .toc {
	display:block;
	width:24em;
	height:99%;
	position:fixed;
	overflow:auto;
	top:0px;
	left:0px;
	padding-left:1em;
	background-color:#EEEEEE;
}

.toc {
	line-height:1.35em;
}

.toc .glossary,
.toc .chapter, .toc .appendix {
	margin-top:1em;
}

.toc .part {
	margin-top:1em;
	display:block;
}

span.glossary,
span.appendix {
	display:block;
	margin-top:0.5em;
}

div {
	padding-top:0px;
}

div.section {
	padding-top:1em;
}

p, div.para, div.formalpara {
	padding-top:0px;
	margin-top:0.3em;
	padding-bottom:0px;
	margin-bottom:1em;
}

/*Links*/
a {
	outline: none;
}

a:link {
	text-decoration:none;
	border-bottom: 1px dotted ;
	color:#3366cc;
}

a:visited {
	text-decoration:none;
	border-bottom: 1px dotted ;
	color:#003366;
}

div.longdesc-link {
	float:right;
	color:#999;
}

.toc a, .qandaset a {
	font-weight:normal;
}

/*headings*/
h1, h2, h3, h4, h5, h6 {
	color: #336699;
	margin-top: 0em;
	margin-bottom: 0em;
	background-color: transparent;
}

h1 {
	font-size:2.0em;
}

.titlepage h1.title {
	font-size: 3.0em;
	padding-top: 1em;
	text-align:left;
}

.book > .titlepage h1.title {
	text-align:center;
}

.article > .titlepage h1.title {
	text-align:center;
}

.set .titlepage > div > div > h1.title {
	text-align:center;
}

.producttitle {
	margin-top: 0em;
	margin-bottom: 0em;
	font-size: 3.0em;
	font-weight: bold;
	color: white;
	text-align: center;
	padding: 0.7em;
}

.titlepage .corpauthor {
	margin-top: 1em;
	text-align: center;
}

.section h1.title {
	font-size: 1.6em;
	padding: 0em;
	color: #336699;
	text-align: left;
	background: white;
}

h2 {
	font-size:1.6em;
}


h2.subtitle, h3.subtitle {
	margin-top: 1em;
	margin-bottom: 1em;
	font-size: 1.4em;
	text-align: center;
}

.preface > div > div > div > h2.title {
	margin-top: 1em;
	font-size: 2.0em;
}

.appendix h2 {
	margin-top: 1em;
	font-size: 2.0em;
}



h3 {
	font-size:1.3em;
	padding-top:0em;
	padding-bottom:0em;
}
h4 {
	font-size:1.1em;
	padding-top:0em;
	padding-bottom:0em;
}

h5 {
	font-size:1em;
}

h6 {
	font-size:1em;
}

h5.formalpara {
	font-size:1em;
	margin-top:2em;
	margin-bottom:.8em;
}

.abstract h6 {
	margin-top:1em;
	margin-bottom:.5em;
	font-size:2em;
}

/*element rules*/
hr {
	border-collapse: collapse;
	border-style:none;
	border-top: 1px dotted #ccc;
	width:100%;
	margin-top: 3em;
}

/* web site rules */
ul.languages, .languages li {
	display:inline;
	padding:0em;
}

.languages li a {
	padding:0em .5em;
	text-decoration: none;
}

.languages li p, .languages li div.para {
	display:inline;
}

.languages li a:link, .languages li a:visited {
	color:#444;
}

.languages li a:hover, .languages li a:focus, .languages li a:active {
	color:black;
}

ul.languages {
	display:block;
	background-color:#eee;
	padding:.5em;
}

/*supporting stylesheets*/

/*unique to the webpage only*/
.books {
	position:relative;
}

.versions li {
	width:100%;
	clear:both;
	display:block;
}

a.version {
	font-size:2em;
	text-decoration:none;
	width:100%;
	display:block;
	padding:1em 0em .2em 0em;
	clear:both;
}

a.version:before {
	content:"Version";
	font-size:smaller;
}

a.version:visited, a.version:link {
	color:#666;
}

a.version:focus, a.version:hover {
	color:black;
}

.books {
	display:block;
	position:relative;
	clear:both;
	width:100%;
}

.books li {
	display:block;
	width:200px;
	float:left;
	position:relative;
	clear: none ;
}

.books .html {
	width:170px;
	display:block;
}

.books .pdf {
	position:absolute;
	left:170px;
	top:0px;
	font-size:smaller;
}

.books .pdf:link, .books .pdf:visited {
	color:#555;
}

.books .pdf:hover, .books .pdf:focus {
	color:#000;
}

.books li a {
	text-decoration:none;
}

.books li a:hover {
	color:black;
}

/*products*/
.products li {
	display: block;
	width:300px;
	float:left;
}

.products li a {
	width:300px;
	padding:.5em 0em;
}

.products ul {
	clear:both;
}

/*revision history*/
.revhistory {
	display:block;
}

.revhistory table {
	background-color:transparent;
	border-color:#fff;
	padding:0em;
	margin: 0;
	border-collapse:collapse;
	border-style:none;
}

.revhistory td {
	text-align :left;
	padding:0em;
	border: none;
	border-top: 1px solid #fff;
	font-weight: bold;
}

.revhistory .simplelist td {
	font-weight: normal;
}

.revhistory .simplelist {
	margin-bottom: 1.5em;
	margin-left: 1em;
}

.revhistory table th {
	display: none;
}


/*credits*/
.authorgroup div {
	clear:both;
	text-align: center;
}

h3.author {
	margin: 0em;
	padding: 0em;
	padding-top: 1em;
}

.authorgroup h4 {
	padding: 0em;
	margin: 0em;
	padding-top: 1em;
	margin-top: 1em;
}

.author, 
.editor, 
.translator, 
.othercredit,
.contrib {
	display: block;
}

.revhistory .author {
	display: inline;
}

.othercredit h3 {
	padding-top: 1em;
}


.othercredit {
	margin:0em;
	padding:0em;
}

.releaseinfo {
	clear: both;
}

.copyright {
	margin-top: 1em;
}

/* qanda sets */
.answer {
	margin-bottom:1em;
	border-bottom:1px dotted #ccc;
}

.qandaset .toc {
	border-bottom:1px dotted #ccc;
}

.question {
	font-weight:bold;
}

.answer .data, .question .data {
	padding-left: 2.6em;
}

.answer label, .question label {
	float:left;
	font-weight:bold;
}


/*Lists*/
ul {
	padding-left:1.6em;
	list-style-type: circle;
}

ul ul {
	list-style-type: circle;
}

ol {
	list-style-image:none;
	list-style-type: decimal;
}

ol ol {
	list-style-type: lower-alpha;
}

ol.arabic {
	list-style-type: decimal;
}

ol.loweralpha {
	list-style-type: lower-alpha;
}

ol.lowerroman {
	list-style-type: lower-roman;
}

ol.upperalpha {
	list-style-type: upper-alpha;
}

ol.upperroman {
	list-style-type: upper-roman;
}

dt {
	font-weight:bold;
	margin-bottom:0em;
	padding-bottom:0em;
}

dd {
	margin:0em;
	margin-left:2em;
	padding-top:0em;
	padding-bottom: 1em;
}

li {
	padding-top:0px;
	margin-top:0em;
	padding-bottom:0px;
	margin-bottom:0.4em;
}

li p, li div.para {
	padding-top:0px;
	margin-top:0em;
	padding-bottom:0px;
	margin-bottom:0.3em;
}

/*images*/
img {
	display:block;
	margin: 2em 0;
}

.inlinemediaobject, .inlinemediaobject img {
	display:inline;
	margin:0em;
}

.figure img {
	display:block;
	margin:0;
}

.figure .title {
	margin:0em;
	margin-bottom:2em;
	padding:0px;
}

/*document modes*/
.confidential {
	background-color:#900;
	color:White;
	padding:.5em .5em;
	text-transform:uppercase;
	text-align:center;
}

.longdesc-link {
	display:none;
}

.longdesc {
	display:none;
}

.prompt {
	padding:0em .3em;
}

/*user interface styles*/
.screen .replaceable {
}

.guibutton, .guilabel {
	font-family: "liberation mono", "bitstream vera mono", "dejavu mono", monospace;
	font-weight: bold;
	white-space: nowrap;
}

.example {
	background-color: #ffffff;
	border-left: 3px solid #aaaaaa;
	padding-top: 1em;
	padding-bottom: 0.1em;
}

.example h6 {
	padding-left: 10px;
}

.example-contents {
	padding-left: 10px;
	background-color: #ffffff;
}

.example-contents .para {
/*	 padding: 10px;*/
}

/*terminal/console text*/
.computeroutput, 
.option {
	font-family:"liberation mono", "bitstream vera mono", "dejavu mono", monospace;
	font-weight:bold;
}

.replaceable {
	font-family:"liberation mono", "bitstream vera mono", "dejavu mono", monospace;
	font-style: italic;
}

.command, .filename, .keycap, .classname, .literal {
	font-family:"liberation mono", "bitstream vera mono", "dejavu mono", monospace;
	font-weight:bold;
}

/* no bold in toc */
.toc * {
	font-weight: inherit;
}

pre {
	font-family:"liberation mono", "bitstream vera mono", "dejavu mono", monospace;
	display:block;
	background-color: #f5f5f5;
	color: #000000;
	border: 1px solid #aaaaaa;
	margin-bottom: 0.3em;
	padding:.5em 1em;
	white-space: pre-wrap; /* css-3 */
	white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
	white-space: -pre-wrap; /* Opera 4-6 */
	white-space: -o-pre-wrap; /* Opera 7 */
	word-wrap: break-word; /* Internet Explorer 5.5+ */
	font-size: 0.9em;
}

pre .replaceable, 
pre .keycap {
}

code {
	font-family:"liberation mono", "bitstream vera mono", "dejavu mono", monospace;
	white-space: nowrap;
	font-weight:bold;
}

.parameter code {
	display: inline;
	white-space: pre-wrap; /* css-3 */
	white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
	white-space: -pre-wrap; /* Opera 4-6 */
	white-space: -o-pre-wrap; /* Opera 7 */
	word-wrap: break-word; /* Internet Explorer 5.5+ */
}


div.warning, div.note, div.important {
	color: black;
	margin: 0em;
	padding: 0em;
	background: none;
	background-color: white;
	margin-bottom: 1em;
	padding-left: 1em;
	border-left: 2px solid #aaaaaa;
}

div.warning h2, div.note h2,div.important h2 {
	margin: 0em;
	padding: 0em;
	color: #eeeeec;
	padding-top: 0px;
	padding-bottom: 0px;
	height: 1.4em;
	line-height: 1.4em;
	font-size: 1.4em;
	display:inline;
}

div.admonition_header {
	clear: both;
	margin: 0em;
	padding: 0em;
	margin-top: -3.3em;
	padding-left: 58px;
	line-height: 1.0em;
	font-size: 1.0em;
}


div.warning p, div.warning div.para,
div.note p, div.note div.para,
div.important p, div.important div.para {
	padding: 0em;
	margin: 0em;
}

div.admonition {
	border: none;
	border-left: 1px solid #aaaaaa;
	border-right: 1px solid #aaaaaa;
	padding:0em;
	margin:0em;
	padding-top: 1.5em;
	padding-bottom: 1em;
	padding-left: 2em;
	padding-right: 1em;
	background-color: #eeeeec;
	-moz-border-radius: 0px;
	-webkit-border-radius: 0px;
	border-radius: 0px;
}

/*Page Title*/
#title  {
	display:block;
	height:45px;
	padding-bottom:1em;
	margin:0em;
}

#title a.left{
	display:inline;
	border:none;
}

#title a.left img{
	border:none;
	float:left;
	margin:0em;
	margin-top:.7em;
}

#title a.right {
	padding-bottom:1em;
}

#title a.right img {
	border:none;
	float:right;
	margin:0em;
	margin-top:.7em;
}

/*Table*/
table {
	border:1px solid #6c614b;
	width:100%;
	border-collapse:collapse;
}

table.simplelist, .calloutlist table {
	border-style: none;
}

table th {
	text-align:left;
	background-color:#6699cc;
	padding:.3em .5em;
	color:white;
}

table td {
	padding:.15em .5em;
}

table tr.even td {
	background-color:#f5f5f5;
}

table th p:first-child, table td p:first-child, table  li p:first-child,
table th div.para:first-child, table td div.para:first-child, table  li div.para:first-child {
	margin-top:0em;
	padding-top:0em;
	display:inline;
}

th, td {
	border-style:none;
	vertical-align: top;
	border: 1px solid #000;
}

.simplelist th, .simplelist td {
	border: none;
}

table table td {
	border-bottom:1px dotted #aaa;
	background-color:white;
	padding:.6em 0em;
}

table table {
	border:1px solid white;
}

td.remarkval {
	color:#444;
}

td.fieldval {
	font-weight:bold;
}

.lbname, .lbtype, .lbdescr, .lbdriver, .lbhost {
	color:white;
	font-weight:bold;
	background-color:#999;
	width:120px;
}

td.remarkval {
	width:230px;
}

td.tname {
	font-weight:bold;
}

th.dbfield {
	width:120px;
}

th.dbtype {
	width:70px;
}

th.dbdefault {
	width:70px;
}

th.dbnul {
	width:70px;
}

th.dbkey {
	width:70px;
}

span.book {
	margin-top:4em;
	display:block;
}

span.chapter {
	display:block;
	margin-top:0.5em;
}

table.simplelist td, .calloutlist table td {
	border-style: none;
}

/*Breadcrumbs*/
#breadcrumbs ul li.first:before {
	content:" ";
}

#breadcrumbs {
	color:#900;
	padding:3px;
	margin-bottom:25px;
}

#breadcrumbs ul {
	margin-left:0;
	padding-left:0;
	display:inline;
	border:none;
}

#breadcrumbs ul li {
	margin-left:0;
	padding-left:2px;
	border:none;
	list-style:none;
	display:inline;
}

#breadcrumbs ul li:before {
	content:"\0020 \0020 \0020 \00BB \0020";
	color:#333;
}

/*index*/
.glossary h3, 
.index h3 {
	font-size: 2em;
	color:#aaa;
	margin:0em;
}

.indexdiv {
	margin-bottom:1em;
}

.glossary dt,
.index dt {
	color:#444;
	padding-top:.5em;
}

.glossary dl dl dt, 
.index dl dl dt {
	color:#777;
	font-weight:normal;
	padding-top:0em;
}

.index dl dl dt:before {
	content:"- ";
	color:#ccc;
}

/*changes*/
.footnote {
	font-size: .7em;
	margin:0em;
	color:#222;
}

table .footnote {
}

sup {
	color:#999;
	margin:0em;
	padding:0em;
	line-height: .4em;
	font-size: 1em;
	padding-left:0em;
}

.footnote {
	position:relative;
}

.footnote sup  {
	color:#e3dcc0;
	position:absolute;
	left: .4em;
}

.footnote sup a:link, 
.footnote sup a:visited {
	color:#92917d;
	text-decoration:none;
}

.footnote:hover sup a {
	text-decoration:none;
}

.footnote p,.footnote div.para {
	padding-left:2em;
}

.footnote a:link, 
.footnote a:visited {
	color:#00537c;
}

.footnote a:hover {
}

/**/
div.chapter {
	margin-top:3em;
}

div.section {
	margin-top:1em;
}

div.note .replaceable, 
div.important .replaceable, 
div.warning .replaceable, 
div.note .keycap, 
div.important .keycap, 
div.warning .keycap
{
}

ul li p:last-child, ul li div.para:last-child {
	margin-bottom:0em;
	padding-bottom:0em;
}


/* Dirty EVIL Mozilla hack for round corners */
pre {
	-moz-border-radius:11px;
	-webkit-border-radius:11px;
	border-radius: 11px;
}

.example {
	-moz-border-radius:0px;
	-webkit-border-radius:0px;
	border-radius: 0px;
}

.package, .citetitle {
	font-style: italic;
}

.titlepage .edition {
	color: #336699;
	background-color: transparent;
	margin-top: 1em;
	margin-bottom: 1em;
	font-size: 1.4em;
	font-weight: bold;
	text-align: center;
}

span.remark {
	background-color: #ff00ff;
}

.foreignphrase {
	font-style: inherit;
}

dt {
	clear:both;
}

dt img {
	border-style: none;
	max-width: 112px;
}

dt object {
	max-width: 112px;
}

dt .inlinemediaobject, dt object {
	display: inline;
	float: left;
	margin-bottom: 1em;
	padding-right: 1em;
	width: 112px;
}

dl:after {
	display: block;
	clear: both;
	content: "";
}

.toc dd {
	padding-bottom: 0em;
	margin-bottom: 1em;
	padding-left: 1.3em;
	margin-left: 0em;
}

div.toc > dl > dt {
	padding-bottom: 0em;
	margin-bottom: 0em;
	margin-top: 1em;
}


.strikethrough {
	text-decoration: line-through;
}

.underline {
	text-decoration: underline;
}

.calloutlist img, .callout {
	padding: 0em;
	margin: 0em;
	width: 12pt;
	display: inline;
	vertical-align: middle;
}

.stepalternatives {
	list-style-image: none;
	list-style-type: none;
}


a:link {
	color:#0066cc;
}

a:hover, a:active {
	color:#003366;
}

a:visited {
	color:#6699cc;
}


h1 {
	color:#3c6eb4
}

.section h1.title {
	color:#3c6eb4;
}


h2,h3,h4,h5,h6 {
	color:#3c6eb4;
}

table {
	border:1px solid #3c6eb4;
}

table th {
	background-color:#3c6eb4;
}


table tr.even td {
	background-color:#f5f5f5;
}

.revhistory table th {
	color:#3c6eb4;
}

.titlepage .edition {
	color: #3c6eb4;
}

</style>07070100000029000081A400000000000000000000000164DF2CB8000018D8000000000000000000000000000000000000002E00000000dracut-055+suse.347.gdcb9bdbf/docs/dracut.png PNG

   IHDR   U   B   &&y  IDATxZxH=#0snMPZ333n3332c!0:N-9>?fh;_G1Jg=F<{'鰰Ə؏]):55m--υB-lmՑ#G>"Y}@ ><<zTTT AL&-ʕ+(J /~WKIÇ@x7084aYM>۶g̙3(z[[~	#}-<a	W~ڀ2~;	V.#50쳘}뭷099)+909\}[yo'<zg*#	t*ӧ04`0M$2KyLͥH./:Q[DKmXFda`eH&. >۾;2@<
9ر;k.d%1z#Aģ]D:[D&_D0``6ঁZǩ^~ecp<3Sgsi&c HQy;[K 9ELO_|ʧDK7o/+nf4ƨ_y\W618Mq|YKK=@^ٻqP4t7n@zk[D%M"F15u6,..j4J.01؄jĵPA$@2.["2^dsx|GSS=A{?X<*Fggwqf+PauwZND7ho/;]ZZ"ϞX%t6UDt#WpTDx"i\魄YƫgV[?6(Y⍍#&[[[.*Ǐ<>^Sss
)P(ׇ	3ypDڄq}TLL%&R(yPJ 9n&0)[k]I{4^<e1;ea_zO]zPB:G#JSD?חwg30ӀC툅& bBA[ATK91Vy=`ֻù:  |gGO@-LI䕌\\zt5VG"`d#94ME"dնW?*0j#c7Gϗ^89y;vX0o{P*=`_k["Ke,.,kTJxݭ,#l\yp]A<\|&kw0*p3lkPCy P׀'y_FMc0`b]yt:MW	$EW܄.g.+䢊S$v3-T`wWk
l.&E1sCA]h SS&}<JfX*bEؙX_)j+[s z1}.LCst#ŕ샒qUahuu5/B7T4kɟÄ2ySD?YJ3upJyG[5Kc555B8tmA}ꩧv	+IdMbٹ̣,g-ϲ89i.͜*^D ׃H$t&16Z~jLDZ:%J9JIXc`Y
BA;=%iI> 1+&_"/ )lk0mR(h+9="lima`\5X
EQJi2-o[VTTH!ϡ@H
6UD0`GW^^ZKS>/OlatoԨj|Z2P*x>~ E (3/ΎkYݫmᇪe7vvvҽ`RTFd^TLMfIHd'mewC0|lf֠P`@Yۊv)p^:,.ŵx*g=2#MƂ["P,(l;zĽy`B<	W<6HL_,xeTJZj)WIhXѣRX:;'KsճP0aYZЛ%Zfa?8+زzTD4%vWܿ@UbaFjBf@9('Uǃ6	ǎbZ^3 !3vQ=ѝ`\呑Il* bALɬP%#9@`H2mO?OmKS+ZTPVS4;;r$Be@)#P\(T6T:w@-51WkeI}\A,Sڃ{Gyq[
pD.`2N)*1*FL,hPKʩRm]=܏239@Vsc+[ gmAx(ɉu[.&zksc*ǒU'U%{GGmR[2Z]Sca/ݬVܿ97PIYL2x8~6?a,JtTV /b)k.Vr4b)ō5m}>,gנHmyAzV"DgNrQ[xCwu.nB6z$'o@V `1J2ͬjt]S%l>CMbhD$DcA@<lbNkEe\DZ V k
]*mqxoiq	f~Q|fp]q߾pOA	]UUU5RKaQh4AػEɱ1GZU|d;&333@/u	>|4+e>8::4`tFNhXUɱ5g``@}vsW[nCCuzZ>3tg	PX,hYmM6 [|PFK"qV^1%D&7\SK:Q
	t^^Y;Tǂ5tYɦ1UtRońqUw3e:>V' ˀ<aJbuTU+9<q%8yi#x?d' %t@/ד {K[l)VVuj5UB1+IWl/%wan~F<|0/.[[qQWWGO·$iܹL6xW	$${٫sоVoRpQ9dEee Ikf/+v4{իw0&t=6|+5x덷qy蚛q>+LqqmdLڬ|CC
JϼٷwK&{JȞ		= յ8Bܫtv` @0h,_Ѣ];6[v,KG?{O4+FTWA70C[@p}j`/Wwo.=MBiG2PשSDndgye'_~}o:T1+{@?<3щBg.J./ve##pa1 PB°<Ⱥn"CP6EK)ȹ3?}gom˘<5Bx@'(y:  mޡW-dIy[ʯ_Xrk{fڙ5KXȣ:
ĭbY	iWE@VXXIÝc[:P]/<=Eտ3π%e}v\2	Q
V(I*GI_V !oG%j9l>=X
Wl_K?X暈,(/2HawO5'N`)w7~6aMC 	*cٞ6>a?)"{h&"yqsH};p w9VVq@Ӥ%am"]A&U!TF,  xaq 9Xtax.mڣhmo6km۶m1=>{NISۗԩ`<meR6(0`	T`ɨl0zOjK1xjw\:+bk59&1Z<`<NC{'/twwz2Py0ϻmmmq
=d[WW3d~9%Z9 fl(W3[R]5kVi[Av_~ɆVP 31V6 zbi_a( ^>4|yg|M:~[,uoEUఱAJobٛ~ڌYm&M:VsrQ&Bu|US$
`(\BfyL"N
ک£BIM5M6˟$38{y=)5nr&,Gvo( L@1f#GN8yjg!gjTH,fprO;Udd
3h,&(@Vy3UqbX6f4X*"#sr+r}݅p}TܱڪgJ'奇i ! vP	 5Wv4͞7vƵ* 2Q@	b0.bxgwKg{L@_*~;	fʶ.-c nXR,K4j.P)jH뽘5gPV>ep݇'*apG ų88 վ^
Ͼ7S@ALY~8 " dcohKKˉ֦nI]amZA$o;{P<&Dr-?W@F395`)$i]^§xʁ
XxƂ [5?y`	k*Eluvvsk#CQϫ)ETtJZniݒ?|/X6Cv7߼fh*Kݒ
zX655\p{ﲾTZCMOiKVY IC*}LhGqw6Tm~$Kf-.hlwŰ`uecdud\Ľ  _N@9#8?|sZzoq$- $ 4pރ&hnn@[i# t9q;^@.s=Hϗz~1Oj*ݳ>{4}!i+Wer80n[tN*`T~@9",X<Q5gXʋwiPT%X{>O̕SW*Ȉ>~uzidi[$ĴfI"b+3#	 RT\c#OE6w[!{:T8DVl`W$Ԣ9E<TTI}O%0n̍ȤOR@}W*]|A?gp9;#=ZiY=)t*֮ޚz~D.83+iUh8`YZ?NH)Mo-}\q@>G:PP}pM0;If,6Ter|Goqũ 7,w03i@&)S,3i/+F-1>Md? >  4j:? EP:uQ	٣    IENDB`0707010000002A000081A400000000000000000000000164DF2CB800011159000000000000000000000000000000000000002E00000000dracut-055+suse.347.gdcb9bdbf/docs/dracut.svg <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   version="1.0"
   width="85.316391"
   height="65.840691"
   id="svg2963"
   inkscape:version="0.48.0 r9654"
   sodipodi:docname="dracut.svg">
  <metadata
     id="metadata98">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title />
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <sodipodi:namedview
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1"
     objecttolerance="10"
     gridtolerance="10"
     guidetolerance="10"
     inkscape:pageopacity="0"
     inkscape:pageshadow="2"
     inkscape:window-width="1600"
     inkscape:window-height="1125"
     id="namedview96"
     showgrid="false"
     inkscape:zoom="4.3457604"
     inkscape:cx="29.014935"
     inkscape:cy="10.744263"
     inkscape:window-x="0"
     inkscape:window-y="25"
     inkscape:window-maximized="1"
     inkscape:current-layer="svg2963"
     fit-margin-top="4"
     fit-margin-left="4"
     fit-margin-right="4"
     fit-margin-bottom="4" />
  <defs
     id="defs3">
    <radialGradient
       cx="605.71429"
       cy="486.64789"
       r="117.14286"
       fx="605.71429"
       fy="486.64789"
       id="radialGradient6719"
       xlink:href="#linearGradient5060"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)" />
    <linearGradient
       id="linearGradient5060">
      <stop
         style="stop-color:#000000;stop-opacity:1"
         offset="0"
         id="stop5062" />
      <stop
         style="stop-color:#000000;stop-opacity:0"
         offset="1"
         id="stop5064" />
    </linearGradient>
    <radialGradient
       cx="605.71429"
       cy="486.64789"
       r="117.14286"
       fx="605.71429"
       fy="486.64789"
       id="radialGradient6717"
       xlink:href="#linearGradient5060"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)" />
    <linearGradient
       id="linearGradient5048">
      <stop
         style="stop-color:#000000;stop-opacity:0"
         offset="0"
         id="stop5050" />
      <stop
         style="stop-color:#000000;stop-opacity:1"
         offset="0.5"
         id="stop5056" />
      <stop
         style="stop-color:#000000;stop-opacity:0"
         offset="1"
         id="stop5052" />
    </linearGradient>
    <linearGradient
       x1="302.85715"
       y1="366.64789"
       x2="302.85715"
       y2="609.50507"
       id="linearGradient6715"
       xlink:href="#linearGradient5048"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)" />
    <linearGradient
       id="linearGradient4995">
      <stop
         style="stop-color:#de9523;stop-opacity:1"
         offset="0"
         id="stop4997" />
      <stop
         style="stop-color:#a36d18;stop-opacity:1"
         offset="1"
         id="stop4999" />
    </linearGradient>
    <linearGradient
       id="linearGradient4987">
      <stop
         style="stop-color:#a0670c;stop-opacity:1"
         offset="0"
         id="stop4989" />
      <stop
         style="stop-color:#a0670c;stop-opacity:0"
         offset="1"
         id="stop4991" />
    </linearGradient>
    <linearGradient
       id="linearGradient4979">
      <stop
         style="stop-color:#fbf0e0;stop-opacity:1"
         offset="0"
         id="stop4981" />
      <stop
         style="stop-color:#f0ce99;stop-opacity:1"
         offset="1"
         id="stop4983" />
    </linearGradient>
    <linearGradient
       id="linearGradient4222">
      <stop
         style="stop-color:#ffffff;stop-opacity:1"
         offset="0"
         id="stop4224" />
      <stop
         style="stop-color:#ffffff;stop-opacity:0.68639052"
         offset="1"
         id="stop4226" />
    </linearGradient>
    <linearGradient
       id="linearGradient4210">
      <stop
         style="stop-color:#eaba6f;stop-opacity:1"
         offset="0"
         id="stop4212" />
      <stop
         style="stop-color:#b97a1b;stop-opacity:1"
         offset="1"
         id="stop4214" />
    </linearGradient>
    <linearGradient
       id="linearGradient4192">
      <stop
         style="stop-color:#e9b96e;stop-opacity:1"
         offset="0"
         id="stop4194" />
      <stop
         style="stop-color:#f1d19e;stop-opacity:1"
         offset="1"
         id="stop4196" />
    </linearGradient>
    <linearGradient
       id="linearGradient4182">
      <stop
         style="stop-color:#a36d18;stop-opacity:1"
         offset="0"
         id="stop4184" />
      <stop
         style="stop-color:#d79020;stop-opacity:1"
         offset="1"
         id="stop4186" />
    </linearGradient>
    <linearGradient
       x1="30.062469"
       y1="13.444801"
       x2="17.696169"
       y2="12.333632"
       id="linearGradient2269"
       xlink:href="#linearGradient4979"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       x1="36.288929"
       y1="14.661557"
       x2="47.065834"
       y2="15.267649"
       id="linearGradient2274"
       xlink:href="#linearGradient4995"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       x1="25.381256"
       y1="24.720648"
       x2="24.119167"
       y2="16.17037"
       id="linearGradient2277"
       xlink:href="#linearGradient4192"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1,0,0,0.986355,0,0.316638)" />
    <linearGradient
       x1="16.148972"
       y1="12.636667"
       x2="34.193642"
       y2="12.636667"
       id="linearGradient2280"
       xlink:href="#linearGradient4182"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1,0,0,1.039184,0,-0.04057054)" />
    <linearGradient
       x1="21.906841"
       y1="9.7577486"
       x2="22.071806"
       y2="16.020695"
       id="linearGradient2282"
       xlink:href="#linearGradient4987"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       x1="18.706615"
       y1="19.912336"
       x2="30.014812"
       y2="47.388485"
       id="linearGradient2285"
       xlink:href="#linearGradient4222"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       x1="24.990499"
       y1="34.004856"
       x2="24.990499"
       y2="22.585211"
       id="linearGradient2288"
       xlink:href="#linearGradient4210"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       x1="27.366341"
       y1="26.580296"
       x2="31.335964"
       y2="30.557772"
       id="linearGradient2852"
       xlink:href="#linearGradient2846"
       gradientUnits="userSpaceOnUse" />
    <radialGradient
       cx="24.130018"
       cy="37.967922"
       r="16.528622"
       fx="24.130018"
       fy="37.967922"
       id="radialGradient2842"
       xlink:href="#linearGradient4477"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1,0,0,0.237968,0,28.93278)" />
    <linearGradient
       x1="18.292673"
       y1="13.602121"
       x2="17.500893"
       y2="25.743469"
       id="linearGradient2372"
       xlink:href="#linearGradient2366"
       gradientUnits="userSpaceOnUse" />
    <radialGradient
       cx="24.130018"
       cy="37.967922"
       r="16.528622"
       fx="24.130018"
       fy="37.967922"
       id="radialGradient4493"
       xlink:href="#linearGradient4487"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1,0,0,0.237968,0,28.93278)" />
    <radialGradient
       cx="15.414371"
       cy="13.078408"
       r="6.65625"
       fx="15.414371"
       fy="13.078408"
       id="radialGradient4473"
       xlink:href="#linearGradient4467"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(2.592963,0,0,2.252104,-25.05975,-18.941)" />
    <radialGradient
       cx="18.240929"
       cy="21.817987"
       r="8.3085051"
       fx="18.240929"
       fy="21.817987"
       id="radialGradient4460"
       xlink:href="#linearGradient4454"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       x1="30.65625"
       y1="34"
       x2="33.21875"
       y2="31.0625"
       id="linearGradient4446"
       xlink:href="#linearGradient4440"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1.334593,0,0,1.291292,-6.973842,-7.460658)" />
    <linearGradient
       id="linearGradient4440">
      <stop
         style="stop-color:#7d7d7d;stop-opacity:1"
         offset="0"
         id="stop4442" />
      <stop
         style="stop-color:#b1b1b1;stop-opacity:1"
         offset="0.5"
         id="stop4448" />
      <stop
         style="stop-color:#686868;stop-opacity:1"
         offset="1"
         id="stop4444" />
    </linearGradient>
    <linearGradient
       id="linearGradient4454">
      <stop
         style="stop-color:#729fcf;stop-opacity:0.20784314"
         offset="0"
         id="stop4456" />
      <stop
         style="stop-color:#729fcf;stop-opacity:0.6761905"
         offset="1"
         id="stop4458" />
    </linearGradient>
    <linearGradient
       id="linearGradient4467">
      <stop
         style="stop-color:#ffffff;stop-opacity:1"
         offset="0"
         id="stop4469" />
      <stop
         style="stop-color:#ffffff;stop-opacity:0.24761905"
         offset="1"
         id="stop4471" />
    </linearGradient>
    <linearGradient
       id="linearGradient4477">
      <stop
         style="stop-color:#000000;stop-opacity:1"
         offset="0"
         id="stop4479" />
      <stop
         style="stop-color:#000000;stop-opacity:0"
         offset="1"
         id="stop4481" />
    </linearGradient>
    <linearGradient
       id="linearGradient4487">
      <stop
         style="stop-color:#ffffff;stop-opacity:1"
         offset="0"
         id="stop4489" />
      <stop
         style="stop-color:#ffffff;stop-opacity:0"
         offset="1"
         id="stop4491" />
    </linearGradient>
    <linearGradient
       id="linearGradient2366">
      <stop
         style="stop-color:#ffffff;stop-opacity:1"
         offset="0"
         id="stop2368" />
      <stop
         style="stop-color:#ffffff;stop-opacity:0.21904762"
         offset="0.5"
         id="stop2374" />
      <stop
         style="stop-color:#ffffff;stop-opacity:1"
         offset="1"
         id="stop2370" />
    </linearGradient>
    <linearGradient
       id="linearGradient2846">
      <stop
         style="stop-color:#8a8a8a;stop-opacity:1"
         offset="0"
         id="stop2848" />
      <stop
         style="stop-color:#484848;stop-opacity:1"
         offset="1"
         id="stop2850" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient2064"
       id="linearGradient5790"
       gradientUnits="userSpaceOnUse"
       x1="18.048874"
       y1="25.461344"
       x2="22.211937"
       y2="12.143078"
       gradientTransform="matrix(0.940224,0,0,0.931632,1.331811,5.401537)" />
    <linearGradient
       id="linearGradient2064">
      <stop
         id="stop2066"
         offset="0"
         style="stop-color:white;stop-opacity:1;" />
      <stop
         style="stop-color:#555753;stop-opacity:0.60000002;"
         offset="0.5"
         id="stop2070" />
      <stop
         id="stop2068"
         offset="1"
         style="stop-color:#555753;stop-opacity:0;" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient8631"
       id="linearGradient5865"
       x1="24"
       y1="36.638382"
       x2="25.818018"
       y2="6.8314762"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       id="linearGradient8631">
      <stop
         id="stop8633"
         offset="0"
         style="stop-color:#eeeeec;stop-opacity:1" />
      <stop
         style="stop-color:#eeeeec;stop-opacity:1;"
         offset="0.2"
         id="stop8637" />
      <stop
         id="stop8635"
         offset="1"
         style="stop-color:#babdb6;stop-opacity:1" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient5690"
       id="linearGradient8603"
       x1="20.304037"
       y1="24.035707"
       x2="18.498415"
       y2="40.647167"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       id="linearGradient5690">
      <stop
         style="stop-color:white;stop-opacity:1;"
         offset="0"
         id="stop5692" />
      <stop
         style="stop-color:#888a85;stop-opacity:0.59848487"
         offset="1"
         id="stop5694" />
    </linearGradient>
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient8625"
       id="radialGradient8676"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1.662477,0,0,1.61358,-4.989175,-18.65647)"
       cx="7.4792061"
       cy="30.36071"
       fx="7.4792061"
       fy="30.36071"
       r="0.53125" />
    <linearGradient
       id="linearGradient8625">
      <stop
         id="stop8627"
         offset="0"
         style="stop-color:white;stop-opacity:1" />
      <stop
         id="stop8629"
         offset="1"
         style="stop-color:#babdb6;stop-opacity:1" />
    </linearGradient>
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient8613"
       id="radialGradient8678"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1.662477,0,0,1.61358,-4.989175,-18.65647)"
       cx="7.5177727"
       cy="30.573555"
       fx="7.5177727"
       fy="30.573555"
       r="0.53125" />
    <linearGradient
       id="linearGradient8613">
      <stop
         style="stop-color:#babdb6;stop-opacity:1"
         offset="0"
         id="stop8615" />
      <stop
         style="stop-color:#2e3436;stop-opacity:1"
         offset="1"
         id="stop8617" />
    </linearGradient>
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient9641"
       id="radialGradient8680"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1.662477,0,0,1.61358,-4.989175,-18.65647)"
       cx="7.4893188"
       cy="30.337601"
       fx="7.4893188"
       fy="30.337601"
       r="0.53125" />
    <linearGradient
       id="linearGradient9641">
      <stop
         style="stop-color:white;stop-opacity:1"
         offset="0"
         id="stop9643" />
      <stop
         style="stop-color:#888a85;stop-opacity:1"
         offset="1"
         id="stop9645" />
    </linearGradient>
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient8613"
       id="radialGradient8682"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1.662477,0,0,1.61358,-4.989175,-18.65647)"
       cx="7.5177727"
       cy="30.573555"
       fx="7.5177727"
       fy="30.573555"
       r="0.53125" />
    <linearGradient
       id="linearGradient3375">
      <stop
         style="stop-color:#babdb6;stop-opacity:1"
         offset="0"
         id="stop3377" />
      <stop
         style="stop-color:#2e3436;stop-opacity:1"
         offset="1"
         id="stop3379" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient8710"
       id="linearGradient9649"
       gradientUnits="userSpaceOnUse"
       x1="40.617188"
       y1="30.554688"
       x2="40.710938"
       y2="30.359375"
       gradientTransform="matrix(0.866025,-0.5,0.5,0.866025,-38.79233,11.403385)" />
    <linearGradient
       id="linearGradient8710">
      <stop
         style="stop-color:black;stop-opacity:1;"
         offset="0"
         id="stop8712" />
      <stop
         style="stop-color:white;stop-opacity:1;"
         offset="1"
         id="stop8714" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient8710"
       id="linearGradient9654"
       gradientUnits="userSpaceOnUse"
       x1="40.617188"
       y1="30.554688"
       x2="40.710938"
       y2="30.359375"
       gradientTransform="matrix(0.707107,0.527555,-0.707107,0.527555,29.0058,-20.09196)" />
    <linearGradient
       id="linearGradient3386">
      <stop
         style="stop-color:black;stop-opacity:1;"
         offset="0"
         id="stop3388" />
      <stop
         style="stop-color:white;stop-opacity:1;"
         offset="1"
         id="stop3390" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient2899-4"
       id="linearGradient5655-6"
       gradientUnits="userSpaceOnUse"
       x1="53.812813"
       y1="43.573235"
       x2="-2.8138931"
       y2="35.500015"
       gradientTransform="translate(0,50)" />
    <linearGradient
       id="linearGradient2899-4">
      <stop
         id="stop2901-1"
         offset="0"
         style="stop-color:#555753;stop-opacity:1" />
      <stop
         id="stop2903-2"
         offset="1"
         style="stop-color:#2e3436;stop-opacity:1" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient2967-8"
       id="linearGradient2973-8"
       x1="12.5"
       y1="43.1875"
       x2="12.5"
       y2="34.045513"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       inkscape:collect="always"
       id="linearGradient2967-8">
      <stop
         style="stop-color:white;stop-opacity:1;"
         offset="0"
         id="stop2969-9" />
      <stop
         style="stop-color:white;stop-opacity:0;"
         offset="1"
         id="stop2971-2" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient2909-8"
       id="linearGradient4711-8"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1,0,0,1.42294,10.5,-14.95703)"
       x1="15.335379"
       y1="33.06237"
       x2="20.329321"
       y2="36.37693" />
    <linearGradient
       id="linearGradient2909-8">
      <stop
         style="stop-color:white;stop-opacity:0;"
         offset="0"
         id="stop2911-8" />
      <stop
         id="stop2917-6"
         offset="0.5"
         style="stop-color:white;stop-opacity:1;" />
      <stop
         style="stop-color:white;stop-opacity:0;"
         offset="1"
         id="stop2913-8" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient2909-8"
       id="linearGradient4713-3"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1,0,0,1.42294,-0.875,-15.04578)"
       x1="15.335379"
       y1="33.06237"
       x2="20.329321"
       y2="36.37693" />
    <linearGradient
       id="linearGradient3406">
      <stop
         style="stop-color:white;stop-opacity:0;"
         offset="0"
         id="stop3408" />
      <stop
         id="stop3410"
         offset="0.5"
         style="stop-color:white;stop-opacity:1;" />
      <stop
         style="stop-color:white;stop-opacity:0;"
         offset="1"
         id="stop3412" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient2909-8"
       id="linearGradient3845"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(0.459833,0,-0.391165,1.370105,40.62503,-13.29892)"
       x1="15.335379"
       y1="33.06237"
       x2="20.329321"
       y2="36.37693" />
    <linearGradient
       id="linearGradient3415">
      <stop
         style="stop-color:white;stop-opacity:0;"
         offset="0"
         id="stop3417" />
      <stop
         id="stop3419"
         offset="0.5"
         style="stop-color:white;stop-opacity:1;" />
      <stop
         style="stop-color:white;stop-opacity:0;"
         offset="1"
         id="stop3421" />
    </linearGradient>
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient5740-4"
       id="radialGradient5748-9"
       cx="25.251999"
       cy="16.47991"
       fx="25.251999"
       fy="16.47991"
       r="21.980215"
       gradientTransform="matrix(1.032991,-0.596398,0.575121,0.99614,-11.609134,6.2008493)"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       id="linearGradient5740-4">
      <stop
         style="stop-color:#d0d0cb;stop-opacity:1;"
         offset="0"
         id="stop5742-2" />
      <stop
         style="stop-color:#babdb6;stop-opacity:1"
         offset="1"
         id="stop5744-2" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient2839-7"
       id="linearGradient7658-1"
       gradientUnits="userSpaceOnUse"
       x1="27.057796"
       y1="12.669416"
       x2="32.042896"
       y2="31.219666" />
    <linearGradient
       id="linearGradient2839-7">
      <stop
         style="stop-color:white;stop-opacity:0.25773194;"
         offset="0"
         id="stop2841-4" />
      <stop
         id="stop2847-3"
         offset="0.5472973"
         style="stop-color:white;stop-opacity:1;" />
      <stop
         style="stop-color:white;stop-opacity:0.24705882;"
         offset="0.66243607"
         id="stop2849-1" />
      <stop
         id="stop2851-4"
         offset="0.875"
         style="stop-color:white;stop-opacity:0.83505154;" />
      <stop
         style="stop-color:white;stop-opacity:0;"
         offset="1"
         id="stop2843-6" />
    </linearGradient>
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient9613-9"
       id="radialGradient8623-2"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1.389748,0,0,1.348872,-2.91982,-10.63815)"
       cx="7.5191436"
       cy="30.304251"
       fx="7.5191436"
       fy="30.304251"
       r="0.53125" />
    <linearGradient
       id="linearGradient9613-9">
      <stop
         style="stop-color:white;stop-opacity:1"
         offset="0"
         id="stop9615-4" />
      <stop
         id="stop9619-3"
         offset="0.5"
         style="stop-color:white;stop-opacity:1;" />
      <stop
         style="stop-color:#cccfca;stop-opacity:1"
         offset="1"
         id="stop9617-5" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient2064-6"
       id="linearGradient5790-3"
       gradientUnits="userSpaceOnUse"
       x1="18.048874"
       y1="25.461344"
       x2="22.211937"
       y2="12.143078"
       gradientTransform="matrix(0.940224,0,0,0.931632,1.957236,-3.9520937)" />
    <linearGradient
       id="linearGradient2064-6">
      <stop
         id="stop2066-0"
         offset="0"
         style="stop-color:white;stop-opacity:1;" />
      <stop
         style="stop-color:#555753;stop-opacity:0.60000002;"
         offset="0.5"
         id="stop2070-5" />
      <stop
         id="stop2068-0"
         offset="1"
         style="stop-color:#555753;stop-opacity:0;" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient3468-4"
       id="linearGradient3474-4"
       x1="24.748737"
       y1="35.354588"
       x2="24.998737"
       y2="14.997767"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1,0,0,0.995556,0.625425,-9.284744)" />
    <linearGradient
       id="linearGradient3468-4">
      <stop
         style="stop-color:#fdfdfc;stop-opacity:1"
         offset="0"
         id="stop3470-9" />
      <stop
         style="stop-color:white;stop-opacity:0.37121212"
         offset="1"
         id="stop3472-9" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient8631-9"
       id="linearGradient5865-1"
       x1="24"
       y1="36.638382"
       x2="25.818018"
       y2="6.8314762"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       id="linearGradient8631-9">
      <stop
         id="stop8633-6"
         offset="0"
         style="stop-color:#eeeeec;stop-opacity:1" />
      <stop
         style="stop-color:#eeeeec;stop-opacity:1;"
         offset="0.2"
         id="stop8637-2" />
      <stop
         id="stop8635-5"
         offset="1"
         style="stop-color:#babdb6;stop-opacity:1" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient5690-4"
       id="linearGradient8603-0"
       x1="20.304037"
       y1="24.035707"
       x2="18.498415"
       y2="40.647167"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       id="linearGradient5690-4">
      <stop
         style="stop-color:white;stop-opacity:1;"
         offset="0"
         id="stop5692-0" />
      <stop
         style="stop-color:#888a85;stop-opacity:0.59848487"
         offset="1"
         id="stop5694-9" />
    </linearGradient>
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient8613-9"
       id="radialGradient8619-8"
       cx="7.5177727"
       cy="30.573555"
       fx="7.5177727"
       fy="30.573555"
       r="0.53125"
       gradientTransform="matrix(1.662477,0,0,1.61358,-4.989175,-18.65647)"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       id="linearGradient8613-9">
      <stop
         style="stop-color:#babdb6;stop-opacity:1"
         offset="0"
         id="stop8615-6" />
      <stop
         style="stop-color:#2e3436;stop-opacity:1"
         offset="1"
         id="stop8617-1" />
    </linearGradient>
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient9633-2"
       id="radialGradient8664-0"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1.569487,0,0,1.523325,-4.288627,-15.92107)"
       cx="7.5336008"
       cy="30.307562"
       fx="7.5336008"
       fy="30.307562"
       r="0.53125" />
    <linearGradient
       id="linearGradient9633-2">
      <stop
         style="stop-color:#eeeeec;stop-opacity:1"
         offset="0"
         id="stop9635-8" />
      <stop
         style="stop-color:#888a85;stop-opacity:1"
         offset="1"
         id="stop9639-3" />
    </linearGradient>
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient8613-9"
       id="radialGradient8666-9"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1.662477,0,0,1.61358,-4.989175,-18.65647)"
       cx="7.5177727"
       cy="30.573555"
       fx="7.5177727"
       fy="30.573555"
       r="0.53125" />
    <linearGradient
       id="linearGradient3466">
      <stop
         style="stop-color:#babdb6;stop-opacity:1"
         offset="0"
         id="stop3468" />
      <stop
         style="stop-color:#2e3436;stop-opacity:1"
         offset="1"
         id="stop3470" />
    </linearGradient>
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient8625-5"
       id="radialGradient3847"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1.662477,0,0,1.61358,-4.989175,-18.65647)"
       cx="7.4792061"
       cy="30.36071"
       fx="7.4792061"
       fy="30.36071"
       r="0.53125" />
    <linearGradient
       id="linearGradient8625-5">
      <stop
         id="stop8627-5"
         offset="0"
         style="stop-color:white;stop-opacity:1" />
      <stop
         id="stop8629-2"
         offset="1"
         style="stop-color:#babdb6;stop-opacity:1" />
    </linearGradient>
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient8613-9"
       id="radialGradient8678-2"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1.662477,0,0,1.61358,-4.989175,-18.65647)"
       cx="7.5177727"
       cy="30.573555"
       fx="7.5177727"
       fy="30.573555"
       r="0.53125" />
    <linearGradient
       id="linearGradient3477">
      <stop
         style="stop-color:#babdb6;stop-opacity:1"
         offset="0"
         id="stop3479" />
      <stop
         style="stop-color:#2e3436;stop-opacity:1"
         offset="1"
         id="stop3481" />
    </linearGradient>
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient9641-4"
       id="radialGradient8680-0"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1.662477,0,0,1.61358,-4.989175,-18.65647)"
       cx="7.4893188"
       cy="30.337601"
       fx="7.4893188"
       fy="30.337601"
       r="0.53125" />
    <linearGradient
       id="linearGradient9641-4">
      <stop
         style="stop-color:white;stop-opacity:1"
         offset="0"
         id="stop9643-2" />
      <stop
         style="stop-color:#888a85;stop-opacity:1"
         offset="1"
         id="stop9645-2" />
    </linearGradient>
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient8613-9"
       id="radialGradient8682-2"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1.662477,0,0,1.61358,-4.989175,-18.65647)"
       cx="7.5177727"
       cy="30.573555"
       fx="7.5177727"
       fy="30.573555"
       r="0.53125" />
    <linearGradient
       id="linearGradient3488">
      <stop
         style="stop-color:#babdb6;stop-opacity:1"
         offset="0"
         id="stop3490" />
      <stop
         style="stop-color:#2e3436;stop-opacity:1"
         offset="1"
         id="stop3492" />
    </linearGradient>
    <linearGradient
       gradientTransform="translate(0.625425,-5.3536307)"
       inkscape:collect="always"
       xlink:href="#linearGradient8710-7"
       id="linearGradient8716-4"
       x1="40.617188"
       y1="30.554688"
       x2="40.710938"
       y2="30.359375"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       id="linearGradient8710-7">
      <stop
         style="stop-color:black;stop-opacity:1;"
         offset="0"
         id="stop8712-0" />
      <stop
         style="stop-color:white;stop-opacity:1;"
         offset="1"
         id="stop8714-4" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient8710-7"
       id="linearGradient9605-0"
       gradientUnits="userSpaceOnUse"
       x1="40.617188"
       y1="30.554688"
       x2="40.710938"
       y2="30.359375"
       gradientTransform="matrix(0.602867,-0.797841,0.797841,0.602867,-40.500685,39.274099)" />
    <linearGradient
       id="linearGradient3499">
      <stop
         style="stop-color:black;stop-opacity:1;"
         offset="0"
         id="stop3501" />
      <stop
         style="stop-color:white;stop-opacity:1;"
         offset="1"
         id="stop3503" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient8710-7"
       id="linearGradient3837"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(0.866025,-0.5,0.5,0.866025,-38.166905,2.0497543)"
       x1="40.617188"
       y1="30.554688"
       x2="40.710938"
       y2="30.359375" />
    <linearGradient
       id="linearGradient3506">
      <stop
         style="stop-color:black;stop-opacity:1;"
         offset="0"
         id="stop3508" />
      <stop
         style="stop-color:white;stop-opacity:1;"
         offset="1"
         id="stop3510" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient8710-7"
       id="linearGradient9654-8"
       gradientUnits="userSpaceOnUse"
       x1="40.617188"
       y1="30.554688"
       x2="40.710938"
       y2="30.359375"
       gradientTransform="matrix(0.707107,0.527555,-0.707107,0.527555,29.631226,-29.445591)" />
    <linearGradient
       id="linearGradient3513">
      <stop
         style="stop-color:black;stop-opacity:1;"
         offset="0"
         id="stop3515" />
      <stop
         style="stop-color:white;stop-opacity:1;"
         offset="1"
         id="stop3517" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient2986-0"
       id="linearGradient3839"
       gradientUnits="userSpaceOnUse"
       gradientTransform="translate(0.625425,-5.3536307)"
       x1="21.9375"
       y1="39"
       x2="21.9375"
       y2="37.995617" />
    <linearGradient
       inkscape:collect="always"
       id="linearGradient2986-0">
      <stop
         style="stop-color:black;stop-opacity:1;"
         offset="0"
         id="stop2988-7" />
      <stop
         style="stop-color:black;stop-opacity:0;"
         offset="1"
         id="stop2990-5" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient2902-1"
       id="linearGradient2910-9"
       x1="22.101398"
       y1="27.658131"
       x2="22.971142"
       y2="20.903238"
       gradientUnits="userSpaceOnUse"
       gradientTransform="translate(0.625425,-3.3536307)" />
    <linearGradient
       inkscape:collect="always"
       id="linearGradient2902-1">
      <stop
         style="stop-color:black;stop-opacity:1;"
         offset="0"
         id="stop2905-4" />
      <stop
         style="stop-color:black;stop-opacity:0;"
         offset="1"
         id="stop2907-9" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient2916-1"
       id="linearGradient2922-2"
       x1="24.847851"
       y1="28.908398"
       x2="24.847851"
       y2="25.757175"
       gradientUnits="userSpaceOnUse"
       gradientTransform="translate(0.625425,-3.3536307)" />
    <linearGradient
       inkscape:collect="always"
       id="linearGradient2916-1">
      <stop
         style="stop-color:white;stop-opacity:1;"
         offset="0"
         id="stop2918-5" />
      <stop
         style="stop-color:white;stop-opacity:0;"
         offset="1"
         id="stop2920-9" />
    </linearGradient>
    <linearGradient
       y2="25.757175"
       x2="24.847851"
       y1="28.908398"
       x1="24.847851"
       gradientTransform="translate(0.625425,-3.3536307)"
       gradientUnits="userSpaceOnUse"
       id="linearGradient3576"
       xlink:href="#linearGradient2916-1"
       inkscape:collect="always" />
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient4477"
       id="radialGradient3511"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1,0,0,0.237968,0,28.93278)"
       cx="24.130018"
       cy="37.967922"
       fx="24.130018"
       fy="37.967922"
       r="16.528622" />
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient2846"
       id="linearGradient3514"
       gradientUnits="userSpaceOnUse"
       x1="27.366341"
       y1="26.580296"
       x2="31.335964"
       y2="30.557772" />
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient4440"
       id="linearGradient3516"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1.334593,0,0,1.291292,-6.973842,-7.460658)"
       x1="30.65625"
       y1="34"
       x2="33.21875"
       y2="31.0625" />
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient2366"
       id="linearGradient3518"
       gradientUnits="userSpaceOnUse"
       x1="18.292673"
       y1="13.602121"
       x2="17.500893"
       y2="25.743469" />
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient4487"
       id="radialGradient3520"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1,0,0,0.237968,0,28.93278)"
       cx="24.130018"
       cy="37.967922"
       fx="24.130018"
       fy="37.967922"
       r="16.528622" />
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient4454"
       id="radialGradient3522"
       gradientUnits="userSpaceOnUse"
       cx="18.240929"
       cy="21.817987"
       fx="18.240929"
       fy="21.817987"
       r="8.3085051" />
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient4467"
       id="radialGradient3524"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(2.592963,0,0,2.252104,-25.05975,-18.941)"
       cx="15.414371"
       cy="13.078408"
       fx="15.414371"
       fy="13.078408"
       r="6.65625" />
  </defs>
  <g
     id="g6707"
     style="display:inline"
     transform="matrix(0.0370386,0,0,0.03670958,74.545662,41.635225)">
    <rect
       id="rect6709"
       style="opacity:0.40206185;color:#000000;fill:url(#linearGradient6715);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
       y="-150.69685"
       x="-1559.2523"
       height="478.35718"
       width="1339.6335" />
    <path
       inkscape:connector-curvature="0"
       id="path6711"
       style="opacity:0.40206185;color:#000000;fill:url(#radialGradient6717);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
       d="m -219.61876,-150.68038 c 0,0 0,478.33079 0,478.33079 142.874166,0.90045 345.40022,-107.16966 345.40014,-239.196175 0,-132.026537 -159.436816,-239.134595 -345.40014,-239.134615 z" />
    <path
       inkscape:connector-curvature="0"
       id="path6713"
       style="opacity:0.40206185;color:#000000;fill:url(#radialGradient6719);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
       d="m -1559.2523,-150.68038 c 0,0 0,478.33079 0,478.33079 -142.8742,0.90045 -345.4002,-107.16966 -345.4002,-239.196175 0,-132.026537 159.4368,-239.134595 345.4002,-239.134615 z" />
  </g>
  <g
     transform="matrix(1.2957479,0,0,1.2957479,9.1984201,1.0434641)"
     style="display:inline"
     id="g3292">
    <path
       inkscape:connector-curvature="0"
       sodipodi:nodetypes="cccssscccc"
       id="path2784"
       d="m 16.110953,16.552805 c -0.573581,0 -1.02837,0.431821 -1.02837,0.989859 l -0.940223,3.230801 c -2.859962,1.276514 -4.6423552,3.099073 -4.6423552,5.123976 0,3.856957 6.4790242,6.987239 14.4853222,6.98724 8.006296,0 14.514705,-3.130284 14.514704,-6.98724 0,-2.039034 -1.835591,-3.875388 -4.730501,-5.153089 l -0.940224,-3.201688 c 0,-0.558038 -0.454788,-0.989859 -1.02837,-0.989859 l -15.689983,0 z"
       style="fill:none;stroke:url(#linearGradient5790);stroke-width:1.00000012;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
    <path
       transform="translate(0,4)"
       d="m 16.125,13 c -0.362612,0 -0.59375,0.214848 -0.59375,0.53125 a 0.44198593,0.44198593 0 0 1 0,0.125 l -0.9375,3.25 a 0.44198593,0.44198593 0 0 1 -0.25,0.28125 c -1.389902,0.620369 -2.498509,1.378237 -3.25,2.1875 -0.751491,0.809263 -1.15625,1.64948 -1.15625,2.53125 0,1.680455 1.454964,3.3092 4,4.53125 2.545036,1.22205 6.116607,2 10.0625,2 3.945892,0 7.517463,-0.77795 10.0625,-2 2.545037,-1.22205 4,-2.850795 4,-4.53125 0,-0.887751 -0.393776,-1.747213 -1.15625,-2.5625 -0.762474,-0.815287 -1.905355,-1.566441 -3.3125,-2.1875 a 0.44198593,0.44198593 0 0 1 -0.25,-0.28125 l -0.9375,-3.21875 a 0.44198593,0.44198593 0 0 1 0,-0.125 C 32.406249,13.214846 32.175114,13 31.8125,13 L 16.125,13 z"
       id="path5857"
       style="fill:url(#linearGradient5865);fill-opacity:1;stroke:none;display:inline"
       inkscape:original="M 16.125 12.5625 C 15.55142 12.5625 15.09375 12.973212 15.09375 13.53125 L 14.15625 16.78125 C 11.296288 18.057765 9.5 19.881347 9.5 21.90625 C 9.5 25.763206 15.993702 28.874999 24 28.875 C 32.006296 28.874999 38.500001 25.763206 38.5 21.90625 C 38.5 19.867215 36.67616 18.027701 33.78125 16.75 L 32.84375 13.53125 C 32.843748 12.973212 32.386082 12.5625 31.8125 12.5625 L 16.125 12.5625 z "
       inkscape:radius="-0.44194174"
       sodipodi:type="inkscape:offset" />
    <path
       transform="matrix(0.449978,0,0,0.349909,16.36363,16.21469)"
       d="m 24.748736,25.107418 c 0,2.367553 -3.482407,4.286835 -7.778174,4.286835 -4.295767,0 -7.7781744,-1.919282 -7.7781744,-4.286835 0,-2.367553 3.4824074,-4.286835 7.7781744,-4.286835 4.295767,0 7.778174,1.919282 7.778174,4.286835 z"
       sodipodi:ry="4.2868347"
       sodipodi:rx="7.7781744"
       sodipodi:cy="25.107418"
       sodipodi:cx="16.970562"
       id="path8595"
       style="opacity:0.9;color:#000000;fill:#000000;fill-opacity:0.05303028;fill-rule:nonzero;stroke:url(#linearGradient8603);stroke-width:2.52015233;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:1.4;marker:none;visibility:visible;display:inline;overflow:visible"
       sodipodi:type="arc" />
    <path
       transform="matrix(-2.628602,0,0,1.777765,31.79309,-36.77739)"
       d="m 8.15625,30.578125 c 0,0.284772 -0.2378487,0.515625 -0.53125,0.515625 -0.2934013,0 -0.53125,-0.230853 -0.53125,-0.515625 0,-0.284772 0.2378487,-0.515625 0.53125,-0.515625 0.2934013,0 0.53125,0.230853 0.53125,0.515625 z"
       sodipodi:ry="0.515625"
       sodipodi:rx="0.53125"
       sodipodi:cy="30.578125"
       sodipodi:cx="7.625"
       id="path8668"
       style="color:#000000;fill:url(#radialGradient8676);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
       sodipodi:type="arc" />
    <path
       transform="matrix(1.411772,0,0,0.969697,0.985233,-12.15152)"
       d="m 8.15625,30.578125 c 0,0.284772 -0.2378487,0.515625 -0.53125,0.515625 -0.2934013,0 -0.53125,-0.230853 -0.53125,-0.515625 0,-0.284772 0.2378487,-0.515625 0.53125,-0.515625 0.2934013,0 0.53125,0.230853 0.53125,0.515625 z"
       sodipodi:ry="0.515625"
       sodipodi:rx="0.53125"
       sodipodi:cy="30.578125"
       sodipodi:cx="7.625"
       id="path8670"
       style="color:#000000;fill:url(#radialGradient8678);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
       sodipodi:type="arc" />
    <path
       transform="matrix(-2.628602,0,0,1.777765,56.3029,-36.77739)"
       d="m 8.15625,30.578125 c 0,0.284772 -0.2378487,0.515625 -0.53125,0.515625 -0.2934013,0 -0.53125,-0.230853 -0.53125,-0.515625 0,-0.284772 0.2378487,-0.515625 0.53125,-0.515625 0.2934013,0 0.53125,0.230853 0.53125,0.515625 z"
       sodipodi:ry="0.515625"
       sodipodi:rx="0.53125"
       sodipodi:cy="30.578125"
       sodipodi:cx="7.625"
       id="path8672"
       style="color:#000000;fill:url(#radialGradient8680);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
       sodipodi:type="arc" />
    <path
       transform="matrix(1.411772,0,0,0.969697,25.49504,-12.15152)"
       d="m 8.15625,30.578125 c 0,0.284772 -0.2378487,0.515625 -0.53125,0.515625 -0.2934013,0 -0.53125,-0.230853 -0.53125,-0.515625 0,-0.284772 0.2378487,-0.515625 0.53125,-0.515625 0.2934013,0 0.53125,0.230853 0.53125,0.515625 z"
       sodipodi:ry="0.515625"
       sodipodi:rx="0.53125"
       sodipodi:cy="30.578125"
       sodipodi:cx="7.625"
       id="path8674"
       style="color:#000000;fill:url(#radialGradient8682);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
       sodipodi:type="arc" />
    <path
       inkscape:connector-curvature="0"
       id="path9647"
       d="m 11.263531,17.446473 0.972937,-0.06482"
       style="opacity:0.4;fill:none;stroke:url(#linearGradient9649);stroke-width:0.29999995;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
    <path
       inkscape:connector-curvature="0"
       id="path9652"
       d="m 36.124038,17.147874 0.314427,0.688634"
       style="opacity:0.4;fill:none;stroke:url(#linearGradient9654);stroke-width:0.29999998;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
    <g
       transform="translate(0.625425,-54.351101)"
       id="g5672-9"
       style="display:inline">
      <path
         inkscape:connector-curvature="0"
         style="color:#000000;fill:url(#linearGradient5655-6);fill-opacity:1;fill-rule:nonzero;stroke:#2e3436;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:1.4;marker:none;visibility:visible;display:inline;overflow:visible"
         d="m 4.5182287,80.500013 38.9635393,0 c 0.564099,0 1.018229,0.45413 1.018229,1.018229 l 0,2.963543 c 0,1.315584 -0.450231,3.018228 -2.455729,3.018228 L 40.5,87.5 l 0,1 -33,0 0,-1 -1.8567713,1.3e-5 c -1.2712053,0 -2.1432282,-0.884627 -2.1432282,-2.255665 l 0,-3.726106 c 0,-0.564099 0.4541297,-1.018229 1.0182282,-1.018229 z"
         id="rect2010-0"
         sodipodi:nodetypes="ccccccccccccc" />
      <path
         inkscape:connector-curvature="0"
         sodipodi:nodetypes="ccccccc"
         id="path2076-3"
         d="m 4.59375,31.59375 0,3.729743 c 0,0.599619 0.3756505,1.104854 0.8863276,1.104854 l 36.9463294,0 c 0.512469,0 0.979843,-0.507235 0.979843,-1.016466 l 0,-3.818131 -38.8125,0 z"
         style="opacity:0.1;color:#000000;fill:none;stroke:url(#linearGradient2973-8);stroke-width:0.99999988;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:1.4;marker:none;visibility:visible;display:inline;overflow:visible"
         transform="translate(0,50)" />
      <g
         id="g4706-3"
         style="opacity:0.5"
         transform="translate(0,50)">
        <path
           inkscape:connector-curvature="0"
           inkscape:export-ydpi="90"
           inkscape:export-xdpi="90"
           inkscape:export-filename="/home/lapo/Desktop/uhm.png"
           sodipodi:nodetypes="ccccc"
           id="path2907-3"
           d="m 26.144738,32.088747 c 0,0 -1.502602,5.533939 -3.226175,5.911253 0,0 6.231378,-0.125771 6.231378,-0.125771 1.387072,-0.317461 3.358758,-5.785482 3.358758,-5.785482 l -6.363961,0 z"
           style="opacity:0.10952382;fill:url(#linearGradient4711-8);fill-opacity:1;fill-rule:evenodd;stroke:none" />
        <path
           inkscape:connector-curvature="0"
           style="opacity:0.10952382;fill:url(#linearGradient4713-3);fill-opacity:1;fill-rule:evenodd;stroke:none"
           d="m 14.769738,32 c 0,0 -1.502602,5.533939 -3.226175,5.911253 0,0 6.231378,-0.125771 6.231378,-0.125771 C 19.162013,37.468021 21.133699,32 21.133699,32 l -6.363961,0 z"
           id="path2892-7"
           sodipodi:nodetypes="ccccc"
           inkscape:export-filename="/home/lapo/Desktop/uhm.png"
           inkscape:export-xdpi="90"
           inkscape:export-ydpi="90" />
        <path
           inkscape:connector-curvature="0"
           style="opacity:0.10952382;fill:url(#linearGradient3845);fill-opacity:1;fill-rule:evenodd;stroke:none"
           d="m 34.886139,32 c 0,0 -2.212224,5.328458 -3.108503,5.691761 0,0 2.899969,-0.121101 2.899969,-0.121101 C 35.402697,37.264987 37.8125,32 37.8125,32 l -2.926361,0 z"
           id="path2896-3"
           sodipodi:nodetypes="ccccc"
           inkscape:export-filename="/home/lapo/Desktop/uhm.png"
           inkscape:export-xdpi="90"
           inkscape:export-ydpi="90" />
      </g>
    </g>
    <path
       inkscape:connector-curvature="0"
       inkscape:export-ydpi="90"
       inkscape:export-xdpi="90"
       inkscape:export-filename="/home/lapo/Desktop/uhm.png"
       sodipodi:nodetypes="cczzcczzc"
       id="rect1879-2"
       d="m 12.318553,5.1451573 24.572566,0 c 1.68417,0 2.396517,0.117479 3.040019,2.385005 l 5.074491,17.8811187 c 0.501024,1.765471 -1.355848,2.735101 -3.040018,2.735101 l -34.721555,0 c -1.868408,0 -3.489383,-1.181417 -3.040018,-2.735101 L 9.45447,7.2578663 c 0.568301,-1.964905 1.179912,-2.112709 2.864083,-2.112709 z"
       style="fill:url(#radialGradient5748-9);fill-opacity:1;stroke:#888a85;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0;display:inline" />
    <path
       d="m 11.6875,11 c -0.826242,0 -1.28475,0.06523 -1.5625,0.25 -0.2777497,0.184768 -0.5402012,0.558525 -0.8125,1.5 l -5.25,18.125 c -0.1708248,0.590628 0.031475,1.039316 0.5,1.4375 C 5.0310253,32.710684 5.7975106,33.000001 6.625,33 l 34.71875,0 c 0.744655,0 1.538941,-0.2482 2.03125,-0.625 0.492309,-0.3768 0.731017,-0.796077 0.53125,-1.5 L 38.84375,13 C 38.534499,11.910283 38.220548,11.458908 37.90625,11.25 37.591952,11.041092 37.112699,11 36.28125,11 L 11.6875,11 z"
       id="path5806-6"
       style="opacity:0.46240599;fill:url(#linearGradient7658-1);fill-opacity:1;stroke:none;display:inline"
       inkscape:original="M 11.6875 10.5 C 10.00333 10.5 9.4120513 10.660095 8.84375 12.625 L 3.59375 30.75 C 3.1443849 32.303684 4.7565918 33.500002 6.625 33.5 L 41.34375 33.5 C 43.02792 33.5 44.876024 32.515471 44.375 30.75 L 39.3125 12.875 C 38.668998 10.607474 37.965419 10.5 36.28125 10.5 L 11.6875 10.5 z "
       inkscape:radius="-0.5"
       sodipodi:type="inkscape:offset"
       transform="translate(0.625425,-5.3536307)" />
    <path
       transform="matrix(-2.628602,0,0,1.777765,28.418516,-29.131021)"
       d="m 8.15625,30.578125 c 0,0.284772 -0.2378487,0.515625 -0.53125,0.515625 -0.2934013,0 -0.53125,-0.230853 -0.53125,-0.515625 0,-0.284772 0.2378487,-0.515625 0.53125,-0.515625 0.2934013,0 0.53125,0.230853 0.53125,0.515625 z"
       sodipodi:ry="0.515625"
       sodipodi:rx="0.53125"
       sodipodi:cy="30.578125"
       sodipodi:cx="7.625"
       id="path8621-5"
       style="color:#000000;fill:url(#radialGradient8623-2);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
       sodipodi:type="arc" />
    <path
       inkscape:connector-curvature="0"
       sodipodi:nodetypes="cccssscccc"
       id="path2784-2"
       d="m 16.736379,7.1991743 c -0.573581,0 -1.02837,0.431821 -1.02837,0.9898587 l -0.940223,3.230801 c -2.859962,1.276514 -4.642356,3.099073 -4.642356,5.123976 0,3.856957 6.479025,6.987239 14.485323,6.98724 8.006296,0 14.514705,-3.130284 14.514704,-6.98724 0,-2.039034 -1.835591,-3.875388 -4.730501,-5.153089 L 33.454732,8.189033 c 0,-0.5580377 -0.454788,-0.9898587 -1.02837,-0.9898587 l -15.689983,0 z"
       style="fill:none;stroke:url(#linearGradient5790-3);stroke-width:1.00000012;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;display:inline" />
    <path
       inkscape:connector-curvature="0"
       sodipodi:nodetypes="csccsccsccscc"
       id="path3394-6"
       d="m 12.312926,6.1463743 c -0.803124,0 -1.097169,0.07051 -1.218751,0.155556 -0.121582,0.08504 -0.357707,0.40212 -0.6875,1.306667 l -5.25,18.1377857 c -0.13372,0.366765 -0.05483,0.533865 0.3125,0.84 0.367327,0.306136 1.066693,0.56 1.78125,0.560001 l 34.718751,0 c 0.639793,0 1.393345,-0.237954 1.78125,-0.52889 0.387905,-0.290935 0.488311,-0.382809 0.3125,-0.871111 l -5.0625,-17.8577857 c -0.377206,-1.04766 -0.68208,-1.439297 -0.84375,-1.555556 -0.16167,-0.116259 -0.443711,-0.186667 -1.25,-0.186667 l -24.59375,0 z"
       style="fill:none;stroke:url(#linearGradient3474-4);stroke-width:1.00000036;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0;display:inline" />
    <g
       style="opacity:0.3028571;display:inline"
       transform="translate(7.625425,-6.353631)"
       id="g5657-5">
      <rect
         style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#eeeeec;stroke-width:1.00000024;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:1.4;marker:none;visibility:visible;display:inline;overflow:visible"
         id="rect5641-8"
         width="14.000004"
         height="1.9999924"
         x="18.499996"
         y="35.500008"
         rx="0.75130093"
         ry="0.74712253" />
      <rect
         style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
         id="rect5645-7"
         width="1"
         height="1"
         x="19"
         y="36" />
      <rect
         style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
         id="rect5647-9"
         width="1"
         height="1"
         x="22"
         y="36" />
      <rect
         style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
         id="rect5649-6"
         width="1"
         height="1"
         x="24"
         y="36" />
      <rect
         style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
         id="rect5651-0"
         width="1"
         height="1"
         x="26"
         y="36" />
      <rect
         style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
         id="rect5653-4"
         width="2"
         height="1"
         x="29"
         y="36" />
    </g>
    <path
       d="m 16.125,13 c -0.362612,0 -0.59375,0.214848 -0.59375,0.53125 a 0.44198593,0.44198593 0 0 1 0,0.125 l -0.9375,3.25 a 0.44198593,0.44198593 0 0 1 -0.25,0.28125 c -1.389902,0.620369 -2.498509,1.378237 -3.25,2.1875 -0.751491,0.809263 -1.15625,1.64948 -1.15625,2.53125 0,1.680455 1.454964,3.3092 4,4.53125 2.545036,1.22205 6.116607,2 10.0625,2 3.945892,0 7.517463,-0.77795 10.0625,-2 2.545037,-1.22205 4,-2.850795 4,-4.53125 0,-0.887751 -0.393776,-1.747213 -1.15625,-2.5625 -0.762474,-0.815287 -1.905355,-1.566441 -3.3125,-2.1875 a 0.44198593,0.44198593 0 0 1 -0.25,-0.28125 l -0.9375,-3.21875 a 0.44198593,0.44198593 0 0 1 0,-0.125 C 32.406249,13.214846 32.175114,13 31.8125,13 L 16.125,13 z"
       id="path5857-1"
       style="fill:url(#linearGradient5865-1);fill-opacity:1;stroke:none;display:inline"
       inkscape:original="M 16.125 12.5625 C 15.55142 12.5625 15.09375 12.973212 15.09375 13.53125 L 14.15625 16.78125 C 11.296288 18.057765 9.5 19.881347 9.5 21.90625 C 9.5 25.763206 15.993702 28.874999 24 28.875 C 32.006296 28.874999 38.500001 25.763206 38.5 21.90625 C 38.5 19.867215 36.67616 18.027701 33.78125 16.75 L 32.84375 13.53125 C 32.843748 12.973212 32.386082 12.5625 31.8125 12.5625 L 16.125 12.5625 z "
       inkscape:radius="-0.44194174"
       sodipodi:type="inkscape:offset"
       transform="translate(0.625425,-5.3536307)" />
    <path
       transform="matrix(0.449978,0,0,0.349909,16.989056,6.8610593)"
       d="m 24.748736,25.107418 c 0,2.367553 -3.482407,4.286835 -7.778174,4.286835 -4.295767,0 -7.7781744,-1.919282 -7.7781744,-4.286835 0,-2.367553 3.4824074,-4.286835 7.7781744,-4.286835 4.295767,0 7.778174,1.919282 7.778174,4.286835 z"
       sodipodi:ry="4.2868347"
       sodipodi:rx="7.7781744"
       sodipodi:cy="25.107418"
       sodipodi:cx="16.970562"
       id="path8595-0"
       style="opacity:0.9;color:#000000;fill:#000000;fill-opacity:0.05303028;fill-rule:nonzero;stroke:url(#linearGradient8603-0);stroke-width:2.52015233;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:1.4;marker:none;visibility:visible;display:inline;overflow:visible"
       sodipodi:type="arc" />
    <path
       transform="matrix(1.411772,0,0,0.969697,-2.389342,-4.5051457)"
       d="m 8.15625,30.578125 c 0,0.284772 -0.2378487,0.515625 -0.53125,0.515625 -0.2934013,0 -0.53125,-0.230853 -0.53125,-0.515625 0,-0.284772 0.2378487,-0.515625 0.53125,-0.515625 0.2934013,0 0.53125,0.230853 0.53125,0.515625 z"
       sodipodi:ry="0.515625"
       sodipodi:rx="0.53125"
       sodipodi:cy="30.578125"
       sodipodi:cx="7.625"
       id="path8611-4"
       style="color:#000000;fill:url(#radialGradient8619-8);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
       sodipodi:type="arc" />
    <path
       transform="matrix(-2.628602,0,0,1.777765,61.41852,-29.131021)"
       d="m 8.15625,30.578125 c 0,0.284772 -0.2378487,0.515625 -0.53125,0.515625 -0.2934013,0 -0.53125,-0.230853 -0.53125,-0.515625 0,-0.284772 0.2378487,-0.515625 0.53125,-0.515625 0.2934013,0 0.53125,0.230853 0.53125,0.515625 z"
       sodipodi:ry="0.515625"
       sodipodi:rx="0.53125"
       sodipodi:cy="30.578125"
       sodipodi:cx="7.625"
       id="path8660-8"
       style="color:#000000;fill:url(#radialGradient8664-0);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.46259445;marker:none;visibility:visible;display:inline;overflow:visible"
       sodipodi:type="arc" />
    <path
       transform="matrix(1.411772,0,0,0.969697,30.610656,-4.5051457)"
       d="m 8.15625,30.578125 c 0,0.284772 -0.2378487,0.515625 -0.53125,0.515625 -0.2934013,0 -0.53125,-0.230853 -0.53125,-0.515625 0,-0.284772 0.2378487,-0.515625 0.53125,-0.515625 0.2934013,0 0.53125,0.230853 0.53125,0.515625 z"
       sodipodi:ry="0.515625"
       sodipodi:rx="0.53125"
       sodipodi:cy="30.578125"
       sodipodi:cx="7.625"
       id="path8662-7"
       style="color:#000000;fill:url(#radialGradient8666-9);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
       sodipodi:type="arc" />
    <path
       transform="matrix(-2.628602,0,0,1.777765,32.418516,-46.131021)"
       d="m 8.15625,30.578125 c 0,0.284772 -0.2378487,0.515625 -0.53125,0.515625 -0.2934013,0 -0.53125,-0.230853 -0.53125,-0.515625 0,-0.284772 0.2378487,-0.515625 0.53125,-0.515625 0.2934013,0 0.53125,0.230853 0.53125,0.515625 z"
       sodipodi:ry="0.515625"
       sodipodi:rx="0.53125"
       sodipodi:cy="30.578125"
       sodipodi:cx="7.625"
       id="path8668-0"
       style="color:#000000;fill:url(#radialGradient3847);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
       sodipodi:type="arc" />
    <path
       transform="matrix(1.411772,0,0,0.969697,1.610658,-21.505151)"
       d="m 8.15625,30.578125 c 0,0.284772 -0.2378487,0.515625 -0.53125,0.515625 -0.2934013,0 -0.53125,-0.230853 -0.53125,-0.515625 0,-0.284772 0.2378487,-0.515625 0.53125,-0.515625 0.2934013,0 0.53125,0.230853 0.53125,0.515625 z"
       sodipodi:ry="0.515625"
       sodipodi:rx="0.53125"
       sodipodi:cy="30.578125"
       sodipodi:cx="7.625"
       id="path8670-8"
       style="color:#000000;fill:url(#radialGradient8678-2);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
       sodipodi:type="arc" />
    <path
       transform="matrix(-2.628602,0,0,1.777765,56.928326,-46.131021)"
       d="m 8.15625,30.578125 c 0,0.284772 -0.2378487,0.515625 -0.53125,0.515625 -0.2934013,0 -0.53125,-0.230853 -0.53125,-0.515625 0,-0.284772 0.2378487,-0.515625 0.53125,-0.515625 0.2934013,0 0.53125,0.230853 0.53125,0.515625 z"
       sodipodi:ry="0.515625"
       sodipodi:rx="0.53125"
       sodipodi:cy="30.578125"
       sodipodi:cx="7.625"
       id="path8672-6"
       style="color:#000000;fill:url(#radialGradient8680-0);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
       sodipodi:type="arc" />
    <path
       transform="matrix(1.411772,0,0,0.969697,26.120466,-21.505151)"
       d="m 8.15625,30.578125 c 0,0.284772 -0.2378487,0.515625 -0.53125,0.515625 -0.2934013,0 -0.53125,-0.230853 -0.53125,-0.515625 0,-0.284772 0.2378487,-0.515625 0.53125,-0.515625 0.2934013,0 0.53125,0.230853 0.53125,0.515625 z"
       sodipodi:ry="0.515625"
       sodipodi:rx="0.53125"
       sodipodi:cy="30.578125"
       sodipodi:cx="7.625"
       id="path8674-2"
       style="color:#000000;fill:url(#radialGradient8682-2);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
       sodipodi:type="arc" />
    <path
       inkscape:connector-curvature="0"
       id="path8700-4"
       d="m 40.953535,24.90777 0.874999,0.430332"
       style="opacity:0.4;fill:none;stroke:url(#linearGradient8716-4);stroke-width:0.29999995;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
    <path
       inkscape:connector-curvature="0"
       id="path9603-7"
       d="M 7.955611,25.342275 8.826456,24.903597"
       style="opacity:0.4;fill:none;stroke:url(#linearGradient9605-0);stroke-width:0.29999995;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
    <path
       inkscape:connector-curvature="0"
       id="path9647-9"
       d="m 11.888957,8.092842 0.972937,-0.06482"
       style="opacity:0.4;fill:none;stroke:url(#linearGradient3837);stroke-width:0.29999995;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
    <path
       inkscape:connector-curvature="0"
       id="path9652-3"
       d="M 36.749464,7.7942433 37.063891,8.482877"
       style="opacity:0.4;fill:none;stroke:url(#linearGradient9654-8);stroke-width:0.29999998;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
    <rect
       y="32.64637"
       x="8.6254234"
       height="1"
       width="32.03125"
       id="rect2984-9"
       style="opacity:0.12000002;color:#000000;fill:url(#linearGradient3839);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.68183619;marker:none;visibility:visible;display:inline;overflow:visible" />
    <path
       inkscape:connector-curvature="0"
       sodipodi:nodetypes="ccccccccc"
       id="path1997-2"
       d="M 11.08558,9.728724 7.476823,22.322131 c 1.446871,0.699749 3.773602,1.491299 3.578427,3.857369 l 26.870059,0 c 0.569515,-1.892216 2.575117,-3.158131 4.046257,-3.283131 L 38.123532,9.728724 32.975561,7.1697163 l -18.031223,0 -3.858758,2.5590077 z"
       style="opacity:0.12000002;color:#000000;fill:none;stroke:url(#linearGradient2910-9);stroke-width:1.00000036;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
    <path
       inkscape:connector-curvature="0"
       style="opacity:0.83428572;color:#000000;fill:none;stroke:url(#linearGradient3576);stroke-width:1.00000036;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible"
       d="m 8.601823,21.697131 c 1.446871,0.699749 3.178933,1.433241 3.4257,3.357369 l 25.455844,0 c 0.569515,-1.892216 2.017059,-2.908131 3.488199,-3.033131 L 8.601823,21.697131 z"
       id="path2912-8"
       sodipodi:nodetypes="ccccc" />
  </g>
  <path
     style="fill:none;stroke:#000000;stroke-width:5.27750492;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
     d="M 27.080872,31.163331 54.27344,12.844129"
     id="path3526"
     inkscape:connector-curvature="0"
     sodipodi:nodetypes="cc" />
  <g
     id="g4855"
     transform="matrix(1.320705,0,0,1.320705,18.139953,1.1689971)">
    <g
       id="g1772">
      <path
         inkscape:connector-curvature="0"
         id="path4475"
         style="opacity:0.17112301;color:#000000;fill:url(#radialGradient3511);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
         transform="matrix(1.446431,0,0,1.51999,-10.97453,-17.75168)"
         d="m 40.65864,37.967922 a 16.528622,3.9332814 0 1 1 -33.0572434,0 16.528622,3.9332814 0 1 1 33.0572434,0 z" />
      <path
         inkscape:connector-curvature="0"
         id="path2844"
         style="color:#000000;fill:#dcdcdc;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient3514);stroke-width:2.00000095;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible"
         d="m 18.627569,3.1435548 c -8.13913,0 -14.7448008,6.6056711 -14.7448008,14.7448012 0,8.13913 6.6056708,14.744802 14.7448008,14.744802 3.479555,0 6.551001,-1.384393 9.073723,-3.402647 -0.205377,1.006881 -0.07803,2.035368 0.756144,2.759925 l 10.964084,9.52741 c 1.233416,1.071329 3.087462,0.93096 4.15879,-0.302457 1.071328,-1.233418 0.930959,-3.087462 -0.302457,-4.15879 L 32.313769,27.529188 c -0.671527,-0.583279 -1.492878,-0.755969 -2.306238,-0.642722 1.9867,-2.512422 3.364839,-5.548803 3.364839,-8.99811 0,-8.1391301 -6.605671,-14.7448012 -14.744801,-14.7448012 z m -0.07562,1.2261833 c 7.639459,0 13.291775,4.7889505 13.291775,13.2917749 0,8.675113 -5.81669,13.291775 -13.291775,13.291775 -7.302949,0 -13.2917734,-5.478092 -13.2917734,-13.291775 0,-7.9841069 5.8246384,-13.291775 13.2917734,-13.2917749 z" />
      <path
         inkscape:connector-curvature="0"
         id="path4430"
         style="color:#000000;fill:#dcdcdc;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.00000036;marker:none;visibility:visible;display:inline;overflow:visible"
         d="m 18.602905,3.0803551 c -8.16544,0 -14.7924642,6.627024 -14.7924642,14.7924639 0,8.16544 6.6270242,14.792464 14.7924642,14.792464 3.490803,0 6.572177,-1.388867 9.103055,-3.413645 -0.206041,1.010136 -0.07829,2.041947 0.758587,2.768846 l 10.999526,9.558207 c 1.237403,1.074792 3.097442,0.93397 4.172233,-0.303435 1.074791,-1.237404 0.933968,-3.097442 -0.303435,-4.172233 L 32.333346,27.544815 c -0.673698,-0.585164 -1.497704,-0.758413 -2.313693,-0.644799 1.993122,-2.520544 3.375716,-5.56674 3.375716,-9.027197 0,-8.1654399 -6.627024,-14.7924639 -14.792464,-14.7924639 z m -0.07586,3.1860692 c 6.281108,2e-7 11.378818,5.0977107 11.378818,11.3788187 0,6.281108 -5.09771,11.378818 -11.378818,11.378818 -6.281108,0 -11.3788184,-5.09771 -11.3788184,-11.378818 2e-7,-6.281108 5.0977104,-11.3788187 11.3788184,-11.3788187 z" />
      <path
         inkscape:connector-curvature="0"
         id="path4438"
         style="color:#000000;fill:url(#linearGradient3516);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
         d="m 39.507004,41.57769 c -0.478672,-2.273187 1.39733,-4.811422 3.584053,-4.788375 0,0 -10.760367,-9.258111 -10.760367,-9.258111 -2.944791,-0.05671 -4.269502,2.272616 -3.776814,4.599922 l 10.953128,9.446564 z" />
      <path
         inkscape:connector-curvature="0"
         id="path4450"
         style="color:#000000;fill:none;stroke:url(#linearGradient3518);stroke-width:0.8027336;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible"
         transform="matrix(1.245743,0,0,1.245743,-3.425346,-6.177033)"
         d="m 28.549437,18.920233 a 11.048544,11.048544 0 1 1 -22.0970883,0 11.048544,11.048544 0 1 1 22.0970883,0 z" />
      <path
         inkscape:connector-curvature="0"
         id="path4485"
         style="color:#000000;fill:url(#radialGradient3520);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
         transform="matrix(0.497764,0,0,0.609621,8.973526,15.61929)"
         d="m 40.65864,37.967922 a 16.528622,3.9332814 0 1 1 -33.0572434,0 16.528622,3.9332814 0 1 1 33.0572434,0 z" />
      <rect
         id="rect4495"
         style="opacity:0.43315507;color:#000000;fill:none;stroke:#ffffff;stroke-width:1.00003111;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible"
         transform="matrix(0.752986,0.658037,-0.648902,0.760872,0,0)"
         y="0.14086054"
         x="40.373337"
         ry="1.8879365"
         rx="2.1366608"
         height="4.4404783"
         width="19.048439" />
      <path
         inkscape:connector-curvature="0"
         id="path4452"
         style="color:#000000;fill:url(#radialGradient3522);fill-opacity:1;fill-rule:evenodd;stroke:#3063a3;stroke-width:0.71499395;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dashoffset:0;marker:none;visibility:visible"
         transform="matrix(1.398614,0,0,1.398614,-6.224338,-8.298958)"
         d="m 25.897786,18.478292 a 8.3085051,8.3085051 0 1 1 -16.61701,0 8.3085051,8.3085051 0 1 1 16.61701,0 z" />
      <path
         inkscape:connector-curvature="0"
         id="path4462"
         style="opacity:0.83422457;color:#000000;fill:url(#radialGradient3524);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
         d="m 18.156915,7.3966938 c -5.20759,0 -9.4245469,4.2169572 -9.4245469,9.4245472 0,1.503975 0.4203072,2.887773 1.0471719,4.149903 1.25238,0.461613 2.582757,0.775683 3.994767,0.775683 6.170955,0 11.099282,-4.861637 11.480106,-10.937129 C 23.523449,8.7641668 21.044374,7.3966938 18.156915,7.3966938 z" />
    </g>
  </g>
</svg>
   0707010000002B000081ED00000000000000000000000164DF2CB800000E6D000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/dracut-catimages.sh #!/bin/bash --norc
#
# Copyright 2009 Red Hat, Inc.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

dwarning() {
    echo "Warning: $*" >&2
}

dinfo() {
    [[ $beverbose ]] && echo "$@" >&2
}

derror() {
    echo "Error: $*" >&2
}

usage() {
    #                                                   80x25 linebreak here ^
    cat << EOF
Usage: $0 [OPTION]... <initramfs> <base image> [<image>...]
Creates initial ramdisk image by concatenating several images from the command
line and /boot/dracut/

  -f, --force           Overwrite existing initramfs file.
  -i, --imagedir        Directory with additional images to add
                        (default: /boot/dracut/)
  -o, --overlaydir      Overlay directory, which contains files that
                        will be used to create an additional image
  --nooverlay           Do not use the overlay directory
  --noimagedir          Do not use the additional image directory
  -h, --help            This message
  --debug               Output debug information of the build process
  -v, --verbose         Verbose output during the build process
EOF
}

imagedir=/boot/dracut/
overlay=/var/lib/dracut/overlay

while (($# > 0)); do
    case $1 in
        -f | --force) force=yes ;;
        -i | --imagedir)
            imagedir=$2
            shift
            ;;
        -o | --overlaydir)
            overlay=$2
            shift
            ;;
        --nooverlay)
            no_overlay=yes
            shift
            ;;
        --noimagedir)
            no_imagedir=yes
            shift
            ;;
        -h | --help)
            usage
            exit 1
            ;;
        --debug) export debug="yes" ;;
        -v | --verbose) beverbose="yes" ;;
        -*)
            printf "\nUnknown option: %s\n\n" "$1" >&2
            usage
            exit 1
            ;;
        *) break ;;
    esac
    shift
done

outfile=$1
shift

if [[ -z $outfile ]]; then
    derror "No output file specified."
    usage
    exit 1
fi

baseimage=$1
shift

if [[ -z $baseimage ]]; then
    derror "No base image specified."
    usage
    exit 1
fi

if [[ -f $outfile && ! $force ]]; then
    derror "Will not override existing initramfs ($outfile) without --force"
    exit 1
fi

if [[ ! $no_imagedir && ! -d $imagedir ]]; then
    derror "Image directory $overlay is not a directory"
    exit 1
fi

if [[ ! $no_overlay && ! -d $overlay ]]; then
    derror "Overlay $overlay is not a directory"
    exit 1
fi

if [[ ! $no_overlay ]]; then
    ofile="$imagedir/90-overlay.img"
    dinfo "Creating image $ofile from directory $overlay"
    type pigz &> /dev/null && gzip=pigz || gzip=gzip
    (
        cd "$overlay" || return 1
        find . | cpio --quiet -H newc -o | $gzip -9 > "$ofile"
    )
fi

if [[ ! $no_imagedir ]]; then
    for i in "$imagedir/"*.img; do
        [[ -f $i ]] && images+=("$i")
    done
fi

images+=("$@")

dinfo "Using base image $baseimage"
cat -- "$baseimage" > "$outfile"

for i in "${images[@]}"; do
    dinfo "Appending $i"
    cat -- "$i" >> "$outfile"
done

dinfo "Created $outfile"

exit 0
   0707010000002C000081ED00000000000000000000000164DF2CB800007BC7000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/dracut-functions.sh #!/bin/bash
#
# functions used by dracut and other tools.
#
# Copyright 2005-2009 Red Hat, Inc.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
export LC_MESSAGES=C

# is_func <command>
# Check whether $1 is a function.
is_func() {
    [[ "$(type -t "$1")" == "function" ]]
}

# Generic substring function.  If $2 is in $1, return 0.
strstr() { [[ $1 == *"$2"* ]]; }
# Generic glob matching function. If glob pattern $2 matches anywhere in $1, OK
strglobin() { [[ $1 == *$2* ]]; }
# Generic glob matching function. If glob pattern $2 matches all of $1, OK
# shellcheck disable=SC2053
strglob() { [[ $1 == $2 ]]; }
# returns OK if $1 contains literal string $2 at the beginning, and isn't empty
str_starts() { [ "${1#"$2"*}" != "$1" ]; }
# returns OK if $1 contains literal string $2 at the end, and isn't empty
str_ends() { [ "${1%*"$2"}" != "$1" ]; }

# find a binary.  If we were not passed the full path directly,
# search in the usual places to find the binary.
find_binary() {
    local _delim
    local _path
    local l
    local p
    [[ -z ${1##/*} ]] || _delim="/"

    if [[ $1 == *.so* ]]; then
        # shellcheck disable=SC2154
        for l in $libdirs; do
            _path="${l}${_delim}${1}"
            if { $DRACUT_LDD "${dracutsysrootdir}${_path}" &> /dev/null; }; then
                printf "%s\n" "${_path}"
                return 0
            fi
        done
        _path="${_delim}${1}"
        if { $DRACUT_LDD "${dracutsysrootdir}${_path}" &> /dev/null; }; then
            printf "%s\n" "${_path}"
            return 0
        fi
    fi
    if [[ $1 == */* ]]; then
        _path="${_delim}${1}"
        if [[ -L ${dracutsysrootdir}${_path} ]] || [[ -x ${dracutsysrootdir}${_path} ]]; then
            printf "%s\n" "${_path}"
            return 0
        fi
    fi
    for p in $DRACUT_PATH; do
        _path="${p}${_delim}${1}"
        if [[ -L ${dracutsysrootdir}${_path} ]] || [[ -x ${dracutsysrootdir}${_path} ]]; then
            printf "%s\n" "${_path}"
            return 0
        fi
    done

    [[ -n $dracutsysrootdir ]] && return 1
    type -P "${1##*/}"
}

ldconfig_paths() {
    $DRACUT_LDCONFIG ${dracutsysrootdir:+-r ${dracutsysrootdir} -f /etc/ld.so.conf} -pN 2> /dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
}

# Version comparision function.  Assumes Linux style version scheme.
# $1 = version a
# $2 = comparision op (gt, ge, eq, le, lt, ne)
# $3 = version b
vercmp() {
    local _n1
    read -r -a _n1 <<< "${1//./ }"
    local _op=$2
    local _n2
    read -r -a _n2 <<< "${3//./ }"
    local _i _res

    for ((_i = 0; ; _i++)); do
        if [[ ! ${_n1[_i]}${_n2[_i]} ]]; then
            _res=0
        elif ((${_n1[_i]:-0} > ${_n2[_i]:-0})); then
            _res=1
        elif ((${_n1[_i]:-0} < ${_n2[_i]:-0})); then
            _res=2
        else
            continue
        fi
        break
    done

    case $_op in
        gt) ((_res == 1)) ;;
        ge) ((_res != 2)) ;;
        eq) ((_res == 0)) ;;
        le) ((_res != 1)) ;;
        lt) ((_res == 2)) ;;
        ne) ((_res != 0)) ;;
    esac
}

# Create all subdirectories for given path without creating the last element.
# $1 = path
mksubdirs() {
    # shellcheck disable=SC2174
    [[ -e ${1%/*} ]] || mkdir -m 0755 -p -- "${1%/*}"
}

# Function prints global variables in format name=value line by line.
# $@ = list of global variables' name
print_vars() {
    local _var _value

    for _var in "$@"; do
        eval printf -v _value "%s" \""\$$_var"\"
        [[ ${_value} ]] && printf '%s="%s"\n' "$_var" "$_value"
    done
}

# normalize_path <path>
# Prints the normalized path, where it removes any duplicated
# and trailing slashes.
# Example:
# $ normalize_path ///test/test//
# /test/test
normalize_path() {
    # shellcheck disable=SC2064
    trap "$(shopt -p extglob)" RETURN
    shopt -q -s extglob
    local p=${1//+(\/)//}
    printf "%s\n" "${p%/}"
}

# convert_abs_rel <from> <to>
# Prints the relative path, when creating a symlink to <to> from <from>.
# Example:
# $ convert_abs_rel /usr/bin/test /bin/test-2
# ../../bin/test-2
# $ ln -s $(convert_abs_rel /usr/bin/test /bin/test-2) /usr/bin/test
convert_abs_rel() {
    local __current __absolute __abssize __cursize __newpath
    local -i __i __level

    set -- "$(normalize_path "$1")" "$(normalize_path "$2")"

    # corner case #1 - self looping link
    [[ $1 == "$2" ]] && {
        printf "%s\n" "${1##*/}"
        return
    }

    # corner case #2 - own dir link
    [[ ${1%/*} == "$2" ]] && {
        printf ".\n"
        return
    }

    IFS=/ read -r -a __current <<< "$1"
    IFS=/ read -r -a __absolute <<< "$2"

    __abssize=${#__absolute[@]}
    __cursize=${#__current[@]}

    while [[ ${__absolute[__level]} == "${__current[__level]}" ]]; do
        ((__level++))
        if ((__level > __abssize || __level > __cursize)); then
            break
        fi
    done

    for ((__i = __level; __i < __cursize - 1; __i++)); do
        if ((__i > __level)); then
            __newpath=$__newpath"/"
        fi
        __newpath=$__newpath".."
    done

    for ((__i = __level; __i < __abssize; __i++)); do
        if [[ -n $__newpath ]]; then
            __newpath=$__newpath"/"
        fi
        __newpath=$__newpath${__absolute[__i]}
    done

    printf -- "%s\n" "$__newpath"
}

# get_fs_env <device>
# Get and the ID_FS_TYPE variable from udev for a device.
# Example:
# $ get_fs_env /dev/sda2
# ext4
get_fs_env() {
    [[ $1 ]] || return
    unset ID_FS_TYPE
    ID_FS_TYPE=$(blkid -u filesystem -o export -- "$1" \
        | while read -r line || [ -n "$line" ]; do
            if [[ $line == "TYPE="* ]]; then
                printf "%s" "${line#TYPE=}"
                exit 0
            fi
        done)
    if [[ $ID_FS_TYPE ]]; then
        printf "%s" "$ID_FS_TYPE"
        return 0
    fi
    return 1
}

# get_maj_min <device>
# Prints the major and minor of a device node.
# Example:
# $ get_maj_min /dev/sda2
# 8:2
get_maj_min() {
    local _majmin
    local _out

    if [[ $get_maj_min_cache_file ]]; then
        _out="$(grep -m1 -oP "^$1 \K\S+$" "$get_maj_min_cache_file")"
    fi

    if ! [[ "$_out" ]]; then
        _majmin="$(stat -L -c '%t:%T' "$1" 2> /dev/null)"
        _out="$(printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))")"
        if [[ $get_maj_min_cache_file ]]; then
            echo "$1 $_out" >> "$get_maj_min_cache_file"
        fi
    fi
    echo -n "$_out"
}

# get_devpath_block <device>
# get the DEVPATH in /sys of a block device
get_devpath_block() {
    local _majmin _i
    _majmin=$(get_maj_min "$1")

    for _i in /sys/block/*/dev /sys/block/*/*/dev; do
        [[ -e $_i ]] || continue
        if [[ $_majmin == "$(< "$_i")" ]]; then
            printf "%s" "${_i%/dev}"
            return 0
        fi
    done
    return 1
}

# get a persistent path from a device
get_persistent_dev() {
    local i _tmp _dev _pol

    _dev=$(get_maj_min "$1")
    [ -z "$_dev" ] && return

    if [[ -n $persistent_policy ]]; then
        _pol="/dev/disk/${persistent_policy}/*"
    else
        _pol=
    fi

    for i in \
        $_pol \
        /dev/mapper/* \
        /dev/disk/by-uuid/* \
        /dev/disk/by-label/* \
        /dev/disk/by-partuuid/* \
        /dev/disk/by-partlabel/* \
        /dev/disk/by-id/* \
        /dev/disk/by-path/*; do
        [[ -e $i ]] || continue
        [[ $i == /dev/mapper/control ]] && continue
        [[ $i == /dev/mapper/mpath* ]] && continue
        _tmp=$(get_maj_min "$i")
        if [ "$_tmp" = "$_dev" ]; then
            printf -- "%s" "$i"
            return
        fi
    done
    printf -- "%s" "$1"
}

expand_persistent_dev() {
    local _dev=$1

    case "$_dev" in
        LABEL=*)
            _dev="/dev/disk/by-label/${_dev#LABEL=}"
            ;;
        UUID=*)
            _dev="${_dev#UUID=}"
            _dev="${_dev,,}"
            _dev="/dev/disk/by-uuid/${_dev}"
            ;;
        PARTUUID=*)
            _dev="${_dev#PARTUUID=}"
            _dev="${_dev,,}"
            _dev="/dev/disk/by-partuuid/${_dev}"
            ;;
        PARTLABEL=*)
            _dev="/dev/disk/by-partlabel/${_dev#PARTLABEL=}"
            ;;
    esac
    printf "%s" "$_dev"
}

shorten_persistent_dev() {
    local _dev="$1"
    case "$_dev" in
        /dev/disk/by-uuid/*)
            printf "%s" "UUID=${_dev##*/}"
            ;;
        /dev/disk/by-label/*)
            printf "%s" "LABEL=${_dev##*/}"
            ;;
        /dev/disk/by-partuuid/*)
            printf "%s" "PARTUUID=${_dev##*/}"
            ;;
        /dev/disk/by-partlabel/*)
            printf "%s" "PARTLABEL=${_dev##*/}"
            ;;
        *)
            printf "%s" "$_dev"
            ;;
    esac
}

# find_block_device <mountpoint>
# Prints the major and minor number of the block device
# for a given mountpoint.
# Unless $use_fstab is set to "yes" the functions
# uses /proc/self/mountinfo as the primary source of the
# information and only falls back to /etc/fstab, if the mountpoint
# is not found there.
# Example:
# $ find_block_device /usr
# 8:4
find_block_device() {
    local _dev _majmin _find_mpt
    _find_mpt="$1"

    if [[ $use_fstab != yes ]]; then
        [[ -d $_find_mpt/. ]]
        findmnt -e -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | {
            while read -r _majmin _dev || [ -n "$_dev" ]; do
                if [[ -b $_dev ]]; then
                    if ! [[ $_majmin ]] || [[ $_majmin == 0:* ]]; then
                        _majmin=$(get_maj_min "$_dev")
                    fi
                    if [[ $_majmin ]]; then
                        printf "%s\n" "$_majmin"
                    else
                        printf "%s\n" "$_dev"
                    fi
                    return 0
                fi
                if [[ $_dev == *:* ]]; then
                    printf "%s\n" "$_dev"
                    return 0
                fi
            done
            return 1
        } && return 0
    fi
    # fall back to /etc/fstab

    findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | {
        while read -r _majmin _dev || [ -n "$_dev" ]; do
            if ! [[ $_dev ]]; then
                _dev="$_majmin"
                unset _majmin
            fi
            if [[ -b $_dev ]]; then
                [[ $_majmin ]] || _majmin=$(get_maj_min "$_dev")
                if [[ $_majmin ]]; then
                    printf "%s\n" "$_majmin"
                else
                    printf "%s\n" "$_dev"
                fi
                return 0
            fi
            if [[ $_dev == *:* ]]; then
                printf "%s\n" "$_dev"
                return 0
            fi
        done
        return 1
    } && return 0

    return 1
}

# find_mp_fstype <mountpoint>
# Echo the filesystem type for a given mountpoint.
# /proc/self/mountinfo is taken as the primary source of information
# and /etc/fstab is used as a fallback.
# No newline is appended!
# Example:
# $ find_mp_fstype /;echo
# ext4
find_mp_fstype() {
    local _fs

    if [[ $use_fstab != yes ]]; then
        findmnt -e -v -n -o 'FSTYPE' --target "$1" | {
            while read -r _fs || [ -n "$_fs" ]; do
                [[ $_fs ]] || continue
                [[ $_fs == "autofs" ]] && continue
                printf "%s" "$_fs"
                return 0
            done
            return 1
        } && return 0
    fi

    findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1" | {
        while read -r _fs || [ -n "$_fs" ]; do
            [[ $_fs ]] || continue
            [[ $_fs == "autofs" ]] && continue
            printf "%s" "$_fs"
            return 0
        done
        return 1
    } && return 0

    return 1
}

# find_dev_fstype <device>
# Echo the filesystem type for a given device.
# /proc/self/mountinfo is taken as the primary source of information
# and /etc/fstab is used as a fallback.
# No newline is appended!
# Example:
# $ find_dev_fstype /dev/sda2;echo
# ext4
find_dev_fstype() {
    local _find_dev _fs
    _find_dev="$1"
    if ! [[ $_find_dev == /dev* ]]; then
        [[ -b "/dev/block/$_find_dev" ]] && _find_dev="/dev/block/$_find_dev"
    fi

    if [[ $use_fstab != yes ]]; then
        findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev" | {
            while read -r _fs || [ -n "$_fs" ]; do
                [[ $_fs ]] || continue
                [[ $_fs == "autofs" ]] && continue
                printf "%s" "$_fs"
                return 0
            done
            return 1
        } && return 0
    fi

    findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev" | {
        while read -r _fs || [ -n "$_fs" ]; do
            [[ $_fs ]] || continue
            [[ $_fs == "autofs" ]] && continue
            printf "%s" "$_fs"
            return 0
        done
        return 1
    } && return 0

    return 1
}

# find_mp_fsopts <mountpoint>
# Echo the filesystem options for a given mountpoint.
# /proc/self/mountinfo is taken as the primary source of information
# and /etc/fstab is used as a fallback.
# No newline is appended!
# Example:
# $ find_mp_fsopts /;echo
# rw,relatime,discard,data=ordered
find_mp_fsopts() {
    if [[ $use_fstab != yes ]]; then
        findmnt -e -v -n -o 'OPTIONS' --target "$1" 2> /dev/null && return 0
    fi

    findmnt --fstab -e -v -n -o 'OPTIONS' --target "$1"
}

# find_dev_fsopts <device>
# Echo the filesystem options for a given device.
# /proc/self/mountinfo is taken as the primary source of information
# and /etc/fstab is used as a fallback.
# if `use_fstab == yes`, then only `/etc/fstab` is used.
#
# Example:
# $ find_dev_fsopts /dev/sda2
# rw,relatime,discard,data=ordered
find_dev_fsopts() {
    local _find_dev
    _find_dev="$1"
    if ! [[ $_find_dev == /dev* ]]; then
        [[ -b "/dev/block/$_find_dev" ]] && _find_dev="/dev/block/$_find_dev"
    fi

    if [[ $use_fstab != yes ]]; then
        findmnt -e -v -n -o 'OPTIONS' --source "$_find_dev" 2> /dev/null && return 0
    fi

    findmnt --fstab -e -v -n -o 'OPTIONS' --source "$_find_dev"
}

# finds the major:minor of the block device backing the root filesystem.
find_root_block_device() { find_block_device /; }

# for_each_host_dev_fs <func>
# Execute "<func> <dev> <filesystem>" for every "<dev> <fs>" pair found
# in ${host_fs_types[@]}
for_each_host_dev_fs() {
    local _func="$1"
    local _dev
    local _ret=1

    [[ "${#host_fs_types[@]}" ]] || return 2

    for _dev in "${!host_fs_types[@]}"; do
        $_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
    done
    return $_ret
}

host_fs_all() {
    printf "%s\n" "${host_fs_types[@]}"
}

# Walk all the slave relationships for a given block device.
# Stop when our helper function returns success
# $1 = function to call on every found block device
# $2 = block device in major:minor format
check_block_and_slaves() {
    local _x
    [[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
    if ! lvm_internal_dev "$2"; then "$1" "$2" && return; fi
    check_vol_slaves "$@" && return 0
    if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
        check_block_and_slaves "$1" "$(< "/sys/dev/block/$2/../dev")" && return 0
    fi
    for _x in /sys/dev/block/"$2"/slaves/*; do
        [[ -f $_x/dev ]] || continue
        [[ $_x/subsystem -ef /sys/class/block ]] || continue
        check_block_and_slaves "$1" "$(< "$_x/dev")" && return 0
    done
    return 1
}

check_block_and_slaves_all() {
    local _x _ret=1
    [[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
    if ! lvm_internal_dev "$2" && "$1" "$2"; then
        _ret=0
    fi
    check_vol_slaves_all "$@" && return 0
    if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
        check_block_and_slaves_all "$1" "$(< "/sys/dev/block/$2/../dev")" && _ret=0
    fi
    for _x in /sys/dev/block/"$2"/slaves/*; do
        [[ -f $_x/dev ]] || continue
        [[ $_x/subsystem -ef /sys/class/block ]] || continue
        check_block_and_slaves_all "$1" "$(< "$_x/dev")" && _ret=0
    done
    return $_ret
}
# for_each_host_dev_and_slaves <func>
# Execute "<func> <dev>" for every "<dev>" found
# in ${host_devs[@]} and their slaves
for_each_host_dev_and_slaves_all() {
    local _func="$1"
    local _dev
    local _ret=1

    [[ "${host_devs[*]}" ]] || return 2

    for _dev in "${host_devs[@]}"; do
        [[ -b $_dev ]] || continue
        if check_block_and_slaves_all "$_func" "$(get_maj_min "$_dev")"; then
            _ret=0
        fi
    done
    return $_ret
}

for_each_host_dev_and_slaves() {
    local _func="$1"
    local _dev

    [[ "${host_devs[*]}" ]] || return 2

    for _dev in "${host_devs[@]}"; do
        [[ -b $_dev ]] || continue
        check_block_and_slaves "$_func" "$(get_maj_min "$_dev")" && return 0
    done
    return 1
}

# ugly workaround for the lvm design
# There is no volume group device,
# so, there are no slave devices for volume groups.
# Logical volumes only have the slave devices they really live on,
# but you cannot create the logical volume without the volume group.
# And the volume group might be bigger than the devices the LV needs.
check_vol_slaves() {
    local _vg _pv _dm _majmin
    _majmin="$2"
    _dm=/sys/dev/block/$_majmin/dm
    [[ -f $_dm/uuid && $(< "$_dm"/uuid) =~ LVM-* ]] || return 1
    _vg=$(dmsetup splitname --noheadings -o vg_name "$(< "$_dm/name")")
    # strip space
    _vg="${_vg//[[:space:]]/}"
    if [[ $_vg ]]; then
        for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2> /dev/null); do
            check_block_and_slaves "$1" "$(get_maj_min "$_pv")" && return 0
        done
    fi
    return 1
}

check_vol_slaves_all() {
    local _vg _pv _majmin
    _majmin="$2"
    _dm="/sys/dev/block/$_majmin/dm"
    [[ -f $_dm/uuid && $(< "$_dm"/uuid) =~ LVM-* ]] || return 1
    _vg=$(dmsetup splitname --noheadings -o vg_name "$(< "$_dm/name")")
    # strip space
    _vg="${_vg//[[:space:]]/}"
    if [[ $_vg ]]; then
        # when filter/global_filter is set, lvm may be failed
        if ! lvm lvs --noheadings -o vg_name "$_vg" 2> /dev/null 1> /dev/null; then
            return 1
        fi

        for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2> /dev/null); do
            check_block_and_slaves_all "$1" "$(get_maj_min "$_pv")"
        done
        return 0
    fi
    return 1
}

# fs_get_option <filesystem options> <search for option>
# search for a specific option in a bunch of filesystem options
# and return the value
fs_get_option() {
    local _fsopts=$1
    local _option=$2
    local OLDIFS="$IFS"
    IFS=,
    # shellcheck disable=SC2086
    set -- $_fsopts
    IFS="$OLDIFS"
    while [ $# -gt 0 ]; do
        case $1 in
            $_option=*)
                echo "${1#${_option}=}"
                break
                ;;
        esac
        shift
    done
}

check_kernel_config() {
    local _config_opt="$1"
    local _config_file
    [[ -f $dracutsysrootdir/boot/config-$kernel ]] \
        && _config_file="/boot/config-$kernel"
    [[ -f $dracutsysrootdir/lib/modules/$kernel/config ]] \
        && _config_file="/lib/modules/$kernel/config"

    # no kernel config file, so return true
    [[ $_config_file ]] || return 0

    grep -q -F "${_config_opt}=" "$dracutsysrootdir$_config_file" && return 0
    return 1
}

# 0 if the kernel module is either built-in or available
# 1 if the kernel module is not enabled
check_kernel_module() {
    modprobe -S "$kernel" --dry-run "$1" &> /dev/null || return 1
}

# get_cpu_vendor
# Only two values are returned: AMD or Intel
get_cpu_vendor() {
    if grep -qE AMD /proc/cpuinfo; then
        printf "AMD"
    fi
    if grep -qE Intel /proc/cpuinfo; then
        printf "Intel"
    fi
}

# get_host_ucode
# Get the hosts' ucode file based on the /proc/cpuinfo
get_ucode_file() {
    local family
    local model
    local stepping
    family=$(grep -E "cpu family" /proc/cpuinfo | head -1 | sed "s/.*:\ //")
    model=$(grep -E "model" /proc/cpuinfo | grep -v name | head -1 | sed "s/.*:\ //")
    stepping=$(grep -E "stepping" /proc/cpuinfo | head -1 | sed "s/.*:\ //")

    if [[ "$(get_cpu_vendor)" == "AMD" ]]; then
        if [[ $family -ge 21 ]]; then
            printf "microcode_amd_fam%xh.bin" "$family"
        else
            printf "microcode_amd.bin"
        fi
    fi
    if [[ "$(get_cpu_vendor)" == "Intel" ]]; then
        # The /proc/cpuinfo are in decimal.
        printf "%02x-%02x-%02x" "${family}" "${model}" "${stepping}"
    fi
}

# Not every device in /dev/mapper should be examined.
# If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
lvm_internal_dev() {
    local dev_dm_dir=/sys/dev/block/$1/dm
    [[ ! -f $dev_dm_dir/uuid || $(< "$dev_dm_dir"/uuid) != LVM-* ]] && return 1 # Not an LVM device
    local DM_VG_NAME DM_LV_NAME DM_LV_LAYER
    eval "$(dmsetup splitname --nameprefixes --noheadings --rows "$(< "$dev_dm_dir"/name)" 2> /dev/null)"
    [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 0 # Better skip this!
    [[ ${DM_LV_LAYER} ]] || [[ ! -L /dev/${DM_VG_NAME}/${DM_LV_NAME} ]]
}

btrfs_devs() {
    local _mp="$1"
    btrfs device usage "$_mp" \
        | while read -r _dev _; do
            str_starts "$_dev" "/" || continue
            _dev=${_dev%,}
            printf -- "%s\n" "$_dev"
        done
}

iface_for_remote_addr() {
    # shellcheck disable=SC2046
    set -- $(ip -o route get to "$1")
    while [ $# -gt 0 ]; do
        case $1 in
            dev)
                echo "$2"
                return
                ;;
        esac
        shift
    done
}

local_addr_for_remote_addr() {
    # shellcheck disable=SC2046
    set -- $(ip -o route get to "$1")
    while [ $# -gt 0 ]; do
        case $1 in
            src)
                echo "$2"
                return
                ;;
        esac
        shift
    done
}

peer_for_addr() {
    local addr=$1
    local qtd

    # quote periods in IPv4 address
    qtd=${addr//./\\.}
    ip -o addr show \
        | sed -n 's%^.* '"$qtd"' peer \([0-9a-f.:]\{1,\}\(/[0-9]*\)\?\).*$%\1%p'
}

netmask_for_addr() {
    local addr=$1
    local qtd

    # quote periods in IPv4 address
    qtd=${addr//./\\.}
    ip -o addr show | sed -n 's,^.* '"$qtd"'/\([0-9]*\) .*$,\1,p'
}

gateway_for_iface() {
    local ifname=$1 addr=$2

    case $addr in
        *.*) proto=4 ;;
        *:*) proto=6 ;;
        *) return ;;
    esac
    ip -o -$proto route show \
        | sed -n "s/^default via \([0-9a-z.:]\{1,\}\) dev $ifname .*\$/\1/p"
}

# This works only for ifcfg-style network configuration!
bootproto_for_iface() {
    local ifname=$1
    local dir

    # follow ifcfg settings for boot protocol
    for dir in network-scripts network; do
        [ -f "/etc/sysconfig/$dir/ifcfg-$ifname" ] && {
            sed -n "s/BOOTPROTO=[\"']\?\([[:alnum:]]\{1,\}\)[\"']\?.*\$/\1/p" \
                "/etc/sysconfig/$dir/ifcfg-$ifname"
            return
        }
    done
}

is_unbracketed_ipv6_address() {
    strglob "$1" '*:*' && ! strglob "$1" '\[*:*\]'
}

# Create an ip= string to set up networking such that the given
# remote address can be reached
ip_params_for_remote_addr() {
    local remote_addr=$1
    local ifname local_addr peer netmask gateway ifmac

    [[ $remote_addr ]] || return 1
    ifname=$(iface_for_remote_addr "$remote_addr")
    [[ $ifname ]] || {
        berror "failed to determine interface to connect to $remote_addr"
        return 1
    }

    # ifname clause to bind the interface name to a MAC address
    if [ -d "/sys/class/net/$ifname/bonding" ]; then
        dinfo "Found bonded interface '${ifname}'. Make sure to provide an appropriate 'bond=' cmdline."
    elif [ -e "/sys/class/net/$ifname/address" ]; then
        ifmac=$(cat "/sys/class/net/$ifname/address")
        [[ $ifmac ]] && printf 'ifname=%s:%s ' "${ifname}" "${ifmac}"
    fi

    bootproto=$(bootproto_for_iface "$ifname")
    case $bootproto in
        dhcp | dhcp6 | auto6) ;;
        dhcp4)
            bootproto=dhcp
            ;;
        static* | "")
            bootproto=
            ;;
        *)
            derror "bootproto \"$bootproto\" is unsupported by dracut, trying static configuration"
            bootproto=
            ;;
    esac
    if [[ $bootproto ]]; then
        printf 'ip=%s:%s ' "${ifname}" "${bootproto}"
    else
        local_addr=$(local_addr_for_remote_addr "$remote_addr")
        [[ $local_addr ]] || {
            berror "failed to determine local address to connect to $remote_addr"
            return 1
        }
        peer=$(peer_for_addr "$local_addr")
        # Set peer or netmask, but not both
        [[ $peer ]] || netmask=$(netmask_for_addr "$local_addr")
        gateway=$(gateway_for_iface "$ifname" "$local_addr")
        # Quote IPv6 addresses with brackets
        is_unbracketed_ipv6_address "$local_addr" && local_addr="[$local_addr]"
        is_unbracketed_ipv6_address "$peer" && peer="[$peer]"
        is_unbracketed_ipv6_address "$gateway" && gateway="[$gateway]"
        printf 'ip=%s:%s:%s:%s::%s:none ' \
            "${local_addr}" "${peer}" "${gateway}" "${netmask}" "${ifname}"
    fi

}

# block_is_nbd <maj:min>
# Check whether $1 is an nbd device
block_is_nbd() {
    [[ -b /dev/block/$1 && $1 == 43:* ]]
}

# block_is_iscsi <maj:min>
# Check whether $1 is an nbd device
block_is_iscsi() {
    local _dir
    local _dev=$1 _real _sess
    [[ -L "/sys/dev/block/$_dev" ]] || return
    _dir="$(readlink -f "/sys/dev/block/$_dev")" || return
    until [[ -d "$_dir/sys" || -d "$_dir/iscsi_session" ]]; do
        _dir="$_dir/.."
    done
    [[ -d "$_dir/iscsi_session" ]] && {
        _real=$(realpath "$_dir")
        _sess=${_real##*/}
        [[ -f "$_real/iscsi_session/$_sess/initiatorname" ]]
    }
}

# block_is_fcoe <maj:min>
# Check whether $1 is an FCoE device
# Will not work for HBAs that hide the ethernet aspect
# completely and present a pure FC device
block_is_fcoe() {
    local _dir
    local _dev=$1
    [[ -L "/sys/dev/block/$_dev" ]] || return
    _dir="$(readlink -f "/sys/dev/block/$_dev")"
    until [[ -d "$_dir/sys" ]]; do
        _dir="$_dir/.."
        if [[ -d "$_dir/subsystem" ]]; then
            subsystem=$(basename "$(readlink "$_dir"/subsystem)")
            [[ $subsystem == "fcoe" ]] && return 0
        fi
    done
    return 1
}

# block_is_netdevice <maj:min>
# Check whether $1 is a net device
block_is_netdevice() {
    block_is_nbd "$1" || block_is_iscsi "$1" || block_is_fcoe "$1"
}

# get the corresponding kernel modules of a /sys/class/*/* or/dev/* device
get_dev_module() {
    local dev_attr_walk
    local dev_drivers
    dev_attr_walk=$(udevadm info -a "$1")
    dev_drivers=$(echo "$dev_attr_walk" | sed -n 's/\s*DRIVERS=="\(\S\+\)"/\1/p')
    # if no kernel modules found and device is in a virtual subsystem, follow symlinks
    if [[ -z $dev_drivers && $(udevadm info -q path "$1") == "/devices/virtual"* ]]; then
        local dev_vkernel
        local dev_vsubsystem
        local dev_vpath
        dev_vkernel=$(echo "$dev_attr_walk" | sed -n 's/\s*KERNELS=="\(\S\+\)"/\1/p' | tail -1)
        dev_vsubsystem=$(echo "$dev_attr_walk" | sed -n 's/\s*SUBSYSTEMS=="\(\S\+\)"/\1/p' | tail -1)
        dev_vpath="/sys/devices/virtual/$dev_vsubsystem/$dev_vkernel"
        if [[ -n $dev_vkernel && -n $dev_vsubsystem && -d $dev_vpath ]]; then
            local dev_links
            local dev_link
            dev_links=$(find "$dev_vpath" -maxdepth 1 -type l ! -name "subsystem" -exec readlink {} \;)
            for dev_link in $dev_links; do
                [[ -n $dev_drivers && ${dev_drivers: -1} != $'\n' ]] && dev_drivers+=$'\n'
                dev_drivers+=$(udevadm info -a "$dev_vpath/$dev_link" \
                    | sed -n 's/\s*DRIVERS=="\(\S\+\)"/\1/p' \
                    | grep -v -e pcieport)
            done
        fi
    fi
    echo "$dev_drivers"
}

getcmdline() {
    local _line
    local _cmdline
    if [ -e /proc/cmdline ]; then
        while read -r _line || [ -n "$_line" ]; do
            _cmdline="$_cmdline $_line"
        done < /proc/cmdline
    fi
    printf "%s" "$_cmdline"
}

getarg() {
    if ! [[ -x "$dracutbasedir/dracut-getarg" ]]; then
        derror "$dracutbasedir/dracut-getarg not found, cannot parse command line arguments"
        return 1
    fi
    local _deprecated _newoption
    CMDLINE=$(getcmdline)
    export CMDLINE
    while [ $# -gt 0 ]; do
        case $1 in
            -d)
                _deprecated=1
                shift
                ;;
            -y)
                if "$dracutbasedir"/dracut-getarg "$2" > /dev/null; then
                    if [ "$_deprecated" = "1" ]; then
                        if [ -n "$_newoption" ]; then
                            dwarn "Kernel command line option '$2' is deprecated, use '$_newoption' instead."
                        else
                            dwarn "Option '$2' is deprecated."
                        fi
                    fi
                    echo 1
                    return 0
                fi
                _deprecated=0
                shift 2
                ;;
            -n)
                if "$dracutbasedir"/dracut-getarg "$2" > /dev/null; then
                    echo 0
                    if [ "$_deprecated" = "1" ]; then
                        if [ -n "$_newoption" ]; then
                            dwarn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead."
                        else
                            dwarn "Option '$2' is deprecated."
                        fi
                    fi
                    return 1
                fi
                _deprecated=0
                shift 2
                ;;
            *)
                if [ -z "$_newoption" ]; then
                    _newoption="$1"
                fi
                if "$dracutbasedir"/dracut-getarg "$1"; then
                    if [ "$_deprecated" = "1" ]; then
                        if [ -n "$_newoption" ]; then
                            dwarn "Kernel command line option '$1' is deprecated, use '$_newoption' instead."
                        else
                            dwarn "Option '$1' is deprecated."
                        fi
                    fi
                    return 0
                fi
                _deprecated=0
                shift
                ;;
        esac
    done
    return 1
}

label_uuid_to_dev() {
    local _dev
    _dev="${1#block:}"
    case "$_dev" in
        LABEL=*)
            echo "/dev/disk/by-label/$(echo "${_dev#LABEL=}" | sed 's,/,\\x2f,g;s, ,\\x20,g')"
            ;;
        PARTLABEL=*)
            echo "/dev/disk/by-partlabel/$(echo "${_dev#PARTLABEL=}" | sed 's,/,\\x2f,g;s, ,\\x20,g')"
            ;;
        UUID=*)
            echo "/dev/disk/by-uuid/${_dev#UUID=}"
            ;;
        PARTUUID=*)
            echo "/dev/disk/by-partuuid/${_dev#PARTUUID=}"
            ;;
        *)
            echo "$_dev"
            ;;
    esac
}
 0707010000002D000081A400000000000000000000000164DF2CB8000092D7000000000000000000000000000000000000002D00000000dracut-055+suse.347.gdcb9bdbf/dracut-init.sh  #!/bin/bash
#
# functions used only by dracut and dracut modules
#
# Copyright 2005-2009 Red Hat, Inc.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
export LC_MESSAGES=C

if [[ $EUID == "0" ]] && ! [[ $DRACUT_NO_XATTR ]]; then
    export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,xattr,links -dfr"
else
    export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,links -dfr"
fi

# is_func <command>
# Check whether $1 is a function.
is_func() {
    [[ "$(type -t "$1")" == "function" ]]
}

if ! [[ $dracutbasedir ]]; then
    dracutbasedir=${BASH_SOURCE[0]%/*}
    [[ $dracutbasedir == dracut-functions* ]] && dracutbasedir="."
    [[ $dracutbasedir ]] || dracutbasedir="."
    dracutbasedir="$(readlink -f $dracutbasedir)"
fi

if ! is_func dinfo > /dev/null 2>&1; then
    # shellcheck source=./dracut-logger.sh
    . "$dracutbasedir/dracut-logger.sh"
    dlog_init
fi

# shellcheck disable=SC2154
if ! [[ $initdir ]]; then
    dfatal "initdir not set"
    exit 1
fi

if ! [[ -d $initdir ]]; then
    mkdir -p "$initdir"
fi

if ! [[ $kernel ]]; then
    kernel=$(uname -r)
    export kernel
fi

# shellcheck disable=SC2154
srcmods="$dracutsysrootdir/lib/modules/$kernel/"

# shellcheck disable=SC2154
[[ $drivers_dir ]] && {
    if ! command -v kmod &> /dev/null && vercmp "$(modprobe --version | cut -d' ' -f3)" lt 3.7; then
        dfatal 'To use --kmoddir option module-init-tools >= 3.7 is required.'
        exit 1
    fi
    srcmods="$drivers_dir"
}
export srcmods

[[ $DRACUT_FIRMWARE_PATH ]] || export DRACUT_FIRMWARE_PATH="/lib/firmware/updates:/lib/firmware:/lib/firmware/$kernel"

# export standard hookdirs
[[ $hookdirs ]] || {
    hookdirs="cmdline pre-udev pre-trigger netroot "
    hookdirs+="initqueue initqueue/settled initqueue/online initqueue/finished initqueue/timeout "
    hookdirs+="pre-mount pre-pivot cleanup mount "
    hookdirs+="emergency shutdown-emergency pre-shutdown shutdown "
    export hookdirs
}

DRACUT_LDD=${DRACUT_LDD:-ldd}
DRACUT_TESTBIN=${DRACUT_TESTBIN:-/bin/sh}
DRACUT_LDCONFIG=${DRACUT_LDCONFIG:-ldconfig}

# shellcheck source=./dracut-functions.sh
. "$dracutbasedir"/dracut-functions.sh

# Detect lib paths
if ! [[ $libdirs ]]; then
    if [[ $("$DRACUT_LDD" "$dracutsysrootdir$DRACUT_TESTBIN") == */lib64/* ]] &> /dev/null \
        && [[ -d $dracutsysrootdir/lib64 ]]; then
        libdirs+=" /lib64"
        [[ -d $dracutsysrootdir/usr/lib64 ]] && libdirs+=" /usr/lib64"
    else
        libdirs+=" /lib"
        [[ -d $dracutsysrootdir/usr/lib ]] && libdirs+=" /usr/lib"
    fi

    libdirs+=" $(ldconfig_paths)"

    export libdirs
fi

# helper function for check() in module-setup.sh
# to check for required installed binaries
# issues a standardized warning message
require_binaries() {
    # shellcheck disable=SC2154
    local _module_name="${moddir##*/}"
    local _ret=0

    if [[ $1 == "-m" ]]; then
        _module_name="$2"
        shift 2
    fi

    for cmd in "$@"; do
        if ! find_binary "$cmd" &> /dev/null; then
            dinfo "dracut module '${_module_name#[0-9][0-9]}' will not be installed, because command '$cmd' could not be found!"
            ((_ret++))
        fi
    done
    return "$_ret"
}

require_any_binary() {
    local _module_name="${moddir##*/}"
    local _ret=1

    if [[ $1 == "-m" ]]; then
        _module_name="$2"
        shift 2
    fi

    for cmd in "$@"; do
        if find_binary "$cmd" &> /dev/null; then
            _ret=0
            break
        fi
    done

    if ((_ret != 0)); then
        dinfo "$_module_name: Could not find any command of '$*'!"
        return 1
    fi

    return 0
}

dracut_need_initqueue() {
    : > "$initdir/lib/dracut/need-initqueue"
}

dracut_module_included() {
    # shellcheck disable=SC2154
    [[ " $mods_to_load $modules_loaded " == *\ $*\ * ]]
}

dracut_no_switch_root() {
    : > "$initdir/lib/dracut/no-switch-root"
}

dracut_module_path() {
    local _dir

    # shellcheck disable=SC2231
    for _dir in "${dracutbasedir}"/modules.d/??${1}; do
        echo "$_dir"
        return 0
    done
    return 1
}

if ! [[ $DRACUT_INSTALL ]]; then
    DRACUT_INSTALL=$(find_binary dracut-install)
fi

if ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/dracut-install ]]; then
    DRACUT_INSTALL=$dracutbasedir/dracut-install
elif ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/install/dracut-install ]]; then
    DRACUT_INSTALL=$dracutbasedir/install/dracut-install
fi

# Test if dracut-install is a standalone executable with no options.
# E.g. DRACUT_INSTALL may be set externally as:
# DRACUT_INSTALL="valgrind dracut-install"
# or
# DRACUT_INSTALL="dracut-install --debug"
# in which case the string cannot be tested for being executable.
DRINSTALLPARTS=0
for i in $DRACUT_INSTALL; do
    DRINSTALLPARTS=$((DRINSTALLPARTS + 1))
done

if [[ $DRINSTALLPARTS == 1 ]] && ! command -v "$DRACUT_INSTALL" > /dev/null 2>&1; then
    dfatal "dracut-install not found!"
    exit 10
fi

if [[ $hostonly == "-h" ]]; then
    if ! [[ $DRACUT_KERNEL_MODALIASES ]] || ! [[ -f $DRACUT_KERNEL_MODALIASES ]]; then
        export DRACUT_KERNEL_MODALIASES="${DRACUT_TMPDIR}/modaliases"
        "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
    fi
fi

[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
inst_dir() {
    [[ -e ${initdir}/"$1" ]] && return 0 # already there
    if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@"; then
        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@"
    fi
}

inst() {
    local _hostonly_install
    if [[ $1 == "-H" ]]; then
        _hostonly_install="-H"
        shift
    fi
    [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
    # shellcheck disable=SC2154
    if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
    fi
}

inst_simple() {
    local _hostonly_install
    if [[ $1 == "-H" ]]; then
        _hostonly_install="-H"
        shift
    fi
    [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
    [[ -e $1 ]] || return 1                    # no source
    if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"; then
        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || :
    fi
}

inst_symlink() {
    local _hostonly_install
    if [[ $1 == "-H" ]]; then
        _hostonly_install="-H"
        shift
    fi
    [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
    [[ -L $1 ]] || return 1
    if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
    fi
}

inst_multiple() {
    local _ret
    if "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then
        return 0
    else
        _ret=$?
        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
        return $_ret
    fi
}

dracut_install() {
    inst_multiple "$@"
}

dracut_instmods() {
    local _silent=0
    local i
    # shellcheck disable=SC2154
    [[ $no_kernel == yes ]] && return
    for i in "$@"; do
        [[ $i == "--silent" ]] && _silent=1
    done

    # shellcheck disable=SC2154
    if ! "$DRACUT_INSTALL" \
        ${dracutsysrootdir:+-r "$dracutsysrootdir"} \
        ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${check_supported:+--check-supported} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@"; then
        if ((_silent == 0)); then
            derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${check_supported:+--check-supported} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || :
        fi
    fi
}

inst_library() {
    local _hostonly_install
    if [[ $1 == "-H" ]]; then
        _hostonly_install="-H"
        shift
    fi
    [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
    [[ -e $1 ]] || return 1                    # no source
    if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
    fi
}

inst_binary() {
    if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then
        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
    fi
}

inst_script() {
    if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then
        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
    fi
}

inst_fsck_help() {
    local _helper="/run/dracut/fsck/fsck_help_$1.txt"
    if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" "$_helper"; then
        derror "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" "$_helper" || :
    fi
}

# Use with form hostonly="$(optional_hostonly)" inst_xxxx <args>
# If hosotnly mode is set to "strict", hostonly restrictions will still
# be applied, else will ignore hostonly mode and try to install all
# given modules.
optional_hostonly() {
    # shellcheck disable=SC2154
    if [[ $hostonly_mode == "strict" ]]; then
        printf -- "%s" "$hostonly"
    else
        printf ""
    fi
}

mark_hostonly() {
    for i in "$@"; do
        echo "$i" >> "$initdir/lib/dracut/hostonly-files"
    done
}

# find symlinks linked to given library file
# $1 = library file
# Function searches for symlinks by stripping version numbers appended to
# library filename, checks if it points to the same target and finally
# prints the list of symlinks to stdout.
#
# Example:
# rev_lib_symlinks libfoo.so.8.1
# output: libfoo.so.8 libfoo.so
# (Only if libfoo.so.8 and libfoo.so exists on host system.)
rev_lib_symlinks() {
    local _fn
    local _orig
    local _links

    [[ ! $1 ]] && return 0

    _fn="$1"
    _orig="$(readlink -f "$1")"
    _links=()

    [[ ${_fn} == *.so.* ]] || return 1

    until [[ ${_fn##*.} == so ]]; do
        _fn="${_fn%.*}"
        [[ -L ${_fn} ]] && [[ $(readlink -f "${_fn}") == "${_orig}" ]] && _links+=("${_fn}")
    done

    echo "${_links[*]}}"
}

# attempt to install any programs specified in a udev rule
inst_rule_programs() {
    local _prog _bin

    # shellcheck disable=SC2013
    for _prog in $(sed -nr 's/.*PROGRAM==?"([^ "]+).*/\1/p' "$1"); do
        _bin=""
        # shellcheck disable=SC2154
        if [[ -x ${udevdir}/$_prog ]]; then
            _bin="${udevdir}"/$_prog
        elif [[ ${_prog/\$env\{/} == "$_prog" ]]; then
            _bin=$(find_binary "$_prog") || {
                dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
                continue
            }
        fi

        [[ $_bin ]] && inst_binary "$_bin"
    done

    # shellcheck disable=SC2013
    for _prog in $(sed -nr 's/.*RUN[+=]=?"([^ "]+).*/\1/p' "$1"); do
        _bin=""
        if [[ -x ${udevdir}/$_prog ]]; then
            _bin=${udevdir}/$_prog
        elif [[ ${_prog/\$env\{/} == "$_prog" ]] && [[ ${_prog} != "/sbin/initqueue" ]]; then
            _bin=$(find_binary "$_prog") || {
                dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
                continue
            }
        fi

        [[ $_bin ]] && inst_binary "$_bin"
    done

    # shellcheck disable=SC2013
    for _prog in $(sed -nr 's/.*IMPORT\{program\}==?"([^ "]+).*/\1/p' "$1"); do
        _bin=""
        if [[ -x ${udevdir}/$_prog ]]; then
            _bin=${udevdir}/$_prog
        elif [[ ${_prog/\$env\{/} == "$_prog" ]]; then
            _bin=$(find_binary "$_prog") || {
                dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
                continue
            }
        fi

        [[ $_bin ]] && dracut_install "$_bin"
    done
}

# attempt to install any programs specified in a udev rule
inst_rule_group_owner() {
    local i

    # shellcheck disable=SC2013
    for i in $(sed -nr 's/.*OWNER=?"([^ "]+).*/\1/p' "$1"); do
        if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2> /dev/null; then
            grep -E "^$i:" "$dracutsysrootdir"/etc/passwd 2> /dev/null >> "$initdir/etc/passwd"
        fi
    done

    # shellcheck disable=SC2013
    for i in $(sed -nr 's/.*GROUP=?"([^ "]+).*/\1/p' "$1"); do
        if ! grep -Eq "^$i:" "$initdir/etc/group" 2> /dev/null; then
            grep -E "^$i:" "$dracutsysrootdir"/etc/group 2> /dev/null >> "$initdir/etc/group"
        fi
    done
}

inst_rule_initqueue() {
    if grep -q -F initqueue "$1"; then
        dracut_need_initqueue
    fi
}

# udev rules always get installed in the same place, so
# create a function to install them to make life simpler.
inst_rules() {
    local _target=/etc/udev/rules.d _rule _found

    inst_dir "${udevdir}/rules.d"
    inst_dir "$_target"
    for _rule in "$@"; do
        if [ "${_rule#/}" = "$_rule" ]; then
            for r in "$dracutsysrootdir${udevdir}/rules.d" ${hostonly:+"$dracutsysrootdir"/etc/udev/rules.d}; do
                [[ -e $r/$_rule ]] || continue
                _found="$r/$_rule"
                inst_rule_programs "$_found"
                inst_rule_group_owner "$_found"
                inst_rule_initqueue "$_found"
                inst_simple "$_found"
            done
        fi
        for r in '' "$dracutsysrootdir$dracutbasedir/rules.d/"; do
            # skip rules without an absolute path
            [[ "${r}$_rule" != /* ]] && continue
            [[ -f ${r}$_rule ]] || continue
            _found="${r}$_rule"
            inst_rule_programs "$_found"
            inst_rule_group_owner "$_found"
            inst_rule_initqueue "$_found"
            inst_simple "$_found" "$_target/${_found##*/}"
        done
        [[ $_found ]] || dinfo "Skipping udev rule: $_rule"
    done
}

inst_rules_wildcard() {
    local _target=/etc/udev/rules.d _rule _found

    inst_dir "${udevdir}/rules.d"
    inst_dir "$_target"
    for _rule in ${udevdir}/rules.d/$1 ${dracutbasedir}/rules.d/$1; do
        [[ -e $_rule ]] || continue
        inst_rule_programs "$_rule"
        inst_rule_group_owner "$_rule"
        inst_rule_initqueue "$_rule"
        inst_simple "$_rule"
        _found=$_rule
    done
    if [[ -n ${hostonly} ]]; then
        for _rule in ${_target}/$1; do
            [[ -f $_rule ]] || continue
            inst_rule_programs "$_rule"
            inst_rule_group_owner "$_rule"
            inst_rule_initqueue "$_rule"
            inst_simple "$_rule"
            _found=$_rule
        done
    fi
    [[ $_found ]] || dinfo "Skipping udev rule: $_rule"
}

prepare_udev_rules() {
    if [ -z "$UDEVVERSION" ]; then
        UDEVVERSION=$(udevadm --version)
        export UDEVVERSION
    fi

    if [ -z "$UDEVVERSION" ]; then
        derror "Failed to detect udev version!"
        return 1
    fi
    if [ -z "${UDEVVERSION##*[!0-9]*}" ]; then
        derror "udevadm --version did not report an integer, udev version cannot be determined!"
        return 1
    fi

    for f in "$@"; do
        f="${initdir}/etc/udev/rules.d/$f"
        [ -e "$f" ] || continue
        while read -r line || [ -n "$line" ]; do
            if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then
                if ((UDEVVERSION >= 174)); then
                    printf '%sIMPORT{builtin}="path_id"\n' "${line%%IMPORT PATH_ID}"
                else
                    printf '%sIMPORT{program}="path_id %%p"\n' "${line%%IMPORT PATH_ID}"
                fi
            elif [ "${line%%IMPORT BLKID}" != "$line" ]; then
                if ((UDEVVERSION >= 176)); then
                    printf '%sIMPORT{builtin}="blkid"\n' "${line%%IMPORT BLKID}"
                else
                    # shellcheck disable=SC2016
                    printf '%sIMPORT{program}="/sbin/blkid -o udev -p $tempnode"\n' "${line%%IMPORT BLKID}"
                fi
            else
                echo "$line"
            fi
        done < "${f}" > "${f}.new"
        mv "${f}.new" "$f"
    done
}

# install function specialized for hooks
# $1 = type of hook, $2 = hook priority (lower runs first), $3 = hook
# All hooks should be POSIX/SuS compliant, they will be sourced by init.
inst_hook() {
    local hook
    if ! [[ -f $3 ]]; then
        dfatal "Cannot install a hook ($3) that does not exist."
        dfatal "Aborting initrd creation."
        exit 1
    elif ! [[ $hookdirs == *$1* ]]; then
        dfatal "No such hook type $1. Aborting initrd creation."
        exit 1
    fi
    hook="/lib/dracut/hooks/${1}/${2}-${3##*/}"
    inst_simple "$3" "$hook"
    chmod u+x "$initdir/$hook"
}

# install any of listed files
#
# If first argument is '-d' and second some destination path, first accessible
# source is installed into this path, otherwise it will installed in the same
# path as source.  If none of listed files was installed, function return 1.
# On first successful installation it returns with 0 status.
#
# Example:
#
# inst_any -d /bin/foo /bin/bar /bin/baz
#
# Lets assume that /bin/baz exists, so it will be installed as /bin/foo in
# initramfs.
inst_any() {
    local to f

    [[ $1 == '-d' ]] && to="$2" && shift 2

    for f in "$@"; do
        [[ -e $f ]] || continue
        [[ $to ]] && inst "$f" "$to" && return 0
        inst "$f" && return 0
    done

    return 1
}

# inst_libdir_dir <dir> [<dir>...]
# Install a <dir> located on a lib directory to the initramfs image
inst_libdir_dir() {
    local -a _dirs
    for _dir in $libdirs; do
        for _i in "$@"; do
            for _d in "$dracutsysrootdir$_dir"/$_i; do
                [[ -d $_d ]] && _dirs+=("${_d#"$dracutsysrootdir"}")
            done
        done
    done
    for _dir in "${_dirs[@]}"; do
        inst_dir "$_dir"
    done
}

# inst_libdir_file [-n <pattern>] <file> [<file>...]
# Install a <file> located on a lib directory to the initramfs image
# -n <pattern> install matching files
inst_libdir_file() {
    local -a _files
    if [[ $1 == "-n" ]]; then
        local _pattern=$2
        shift 2
        for _dir in $libdirs; do
            for _i in "$@"; do
                for _f in "$dracutsysrootdir$_dir"/$_i; do
                    [[ ${_f#$dracutsysrootdir} =~ $_pattern ]] || continue
                    [[ -e $_f ]] && _files+=("${_f#$dracutsysrootdir}")
                done
            done
        done
    else
        for _dir in $libdirs; do
            for _i in "$@"; do
                for _f in "$dracutsysrootdir$_dir"/$_i; do
                    [[ -e $_f ]] && _files+=("${_f#$dracutsysrootdir}")
                done
            done
        done
    fi
    [[ ${#_files[@]} -gt 0 ]] && inst_multiple "${_files[@]}"
}

# get a command to decompress the given file
get_decompress_cmd() {
    case "$1" in
        *.gz) echo 'gzip -f -d' ;;
        *.bz2) echo 'bzip2 -d' ;;
        *.xz) echo 'xz -f -d' ;;
        *.zst) echo 'zstd -f -d ' ;;
    esac
}

# install function decompressing the target and handling symlinks
# $@ = list of compressed (gz or bz2) files or symlinks pointing to such files
#
# Function install targets in the same paths inside overlay but decompressed
# and without extensions (.gz, .bz2).
inst_decompress() {
    local _src _cmd

    for _src in "$@"; do
        _cmd=$(get_decompress_cmd "${_src}")
        [[ -z ${_cmd} ]] && return 1
        inst_simple "${_src}"
        # Decompress with chosen tool.  We assume that tool changes name e.g.
        # from 'name.gz' to 'name'.
        ${_cmd} "${initdir}${_src}"
    done
}

# It's similar to above, but if file is not compressed, performs standard
# install.
# $@ = list of files
inst_opt_decompress() {
    local _src

    for _src in "$@"; do
        inst_decompress "${_src}" || inst "${_src}"
    done
}

# module_check <dracut module> [<forced>] [<module path>]
# execute the check() function of module-setup.sh of <dracut module>
# or the "check" script, if module-setup.sh is not found
# "check $hostonly" is called
module_check() {
    local _moddir=$3
    local _ret
    local _forced=0
    local _hostonly=$hostonly
    [[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
    [ $# -eq 2 ] && _forced=$2
    [[ -d $_moddir ]] || return 1
    if [[ ! -f $_moddir/module-setup.sh ]]; then
        # if we do not have a check script, we are unconditionally included
        [[ -x $_moddir/check ]] || return 0
        [[ $_forced != 0 ]] && unset hostonly
        # don't quote $hostonly to leave argument empty
        # shellcheck disable=SC2086
        "$_moddir"/check $hostonly
        _ret=$?
    else
        unset check depends cmdline install installkernel
        check() { true; }
        # shellcheck disable=SC1090
        . "$_moddir"/module-setup.sh
        is_func check || return 0
        [[ $_forced != 0 ]] && unset hostonly
        # don't quote $hostonly to leave argument empty
        # shellcheck disable=SC2086
        moddir="$_moddir" check $hostonly
        _ret=$?
        unset check depends cmdline install installkernel
    fi
    hostonly=$_hostonly
    return $_ret
}

# module_check_mount <dracut module> [<module path>]
# execute the check() function of module-setup.sh of <dracut module>
# or the "check" script, if module-setup.sh is not found
# "mount_needs=1 check 0" is called
module_check_mount() {
    local _moddir=$2
    local _ret
    export mount_needs=1
    [[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
    [[ -d $_moddir ]] || return 1
    if [[ ! -f $_moddir/module-setup.sh ]]; then
        # if we do not have a check script, we are unconditionally included
        [[ -x $_moddir/check ]] || return 0
        mount_needs=1 "$_moddir"/check 0
        _ret=$?
    else
        unset check depends cmdline install installkernel
        check() { false; }
        # shellcheck disable=SC1090
        . "$_moddir"/module-setup.sh
        moddir=$_moddir check 0
        _ret=$?
        unset check depends cmdline install installkernel
    fi
    unset mount_needs
    return "$_ret"
}

# module_depends <dracut module> [<module path>]
# execute the depends() function of module-setup.sh of <dracut module>
# or the "depends" script, if module-setup.sh is not found
module_depends() {
    local _moddir=$2
    local _ret
    [[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
    [[ -d $_moddir ]] || return 1
    if [[ ! -f $_moddir/module-setup.sh ]]; then
        # if we do not have a check script, we have no deps
        [[ -x $_moddir/check ]] || return 0
        "$_moddir"/check -d
        return $?
    else
        unset check depends cmdline install installkernel
        depends() { true; }
        # shellcheck disable=SC1090
        . "$_moddir"/module-setup.sh
        moddir=$_moddir depends
        _ret=$?
        unset check depends cmdline install installkernel
        return $_ret
    fi
}

# module_cmdline <dracut module> [<module path>]
# execute the cmdline() function of module-setup.sh of <dracut module>
# or the "cmdline" script, if module-setup.sh is not found
module_cmdline() {
    local _moddir=$2
    local _ret
    [[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
    [[ -d $_moddir ]] || return 1
    if [[ ! -f $_moddir/module-setup.sh ]]; then
        # shellcheck disable=SC1090
        [[ -x $_moddir/cmdline ]] && . "$_moddir/cmdline"
        return $?
    else
        unset check depends cmdline install installkernel
        cmdline() { true; }
        # shellcheck disable=SC1090
        . "$_moddir"/module-setup.sh
        moddir="$_moddir" cmdline
        _ret=$?
        unset check depends cmdline install installkernel
        return $_ret
    fi
}

# module_install <dracut module> [<module path>]
# execute the install() function of module-setup.sh of <dracut module>
# or the "install" script, if module-setup.sh is not found
module_install() {
    local _moddir=$2
    local _ret
    [[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
    [[ -d $_moddir ]] || return 1
    if [[ ! -f $_moddir/module-setup.sh ]]; then
        # shellcheck disable=SC1090
        [[ -x $_moddir/install ]] && . "$_moddir/install"
        return $?
    else
        unset check depends cmdline install installkernel
        install() { true; }
        # shellcheck disable=SC1090
        . "$_moddir"/module-setup.sh
        moddir="$_moddir" install
        _ret=$?
        unset check depends cmdline install installkernel
        return $_ret
    fi
}

# module_installkernel <dracut module> [<module path>]
# execute the installkernel() function of module-setup.sh of <dracut module>
# or the "installkernel" script, if module-setup.sh is not found
module_installkernel() {
    local _moddir=$2
    local _ret
    [[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
    [[ -d $_moddir ]] || return 1
    if [[ ! -f $_moddir/module-setup.sh ]]; then
        # shellcheck disable=SC1090
        [[ -x $_moddir/installkernel ]] && . "$_moddir/installkernel"
        return $?
    else
        unset check depends cmdline install installkernel
        installkernel() { true; }
        # shellcheck disable=SC1090
        . "$_moddir"/module-setup.sh
        moddir="$_moddir" installkernel
        _ret=$?
        unset check depends cmdline install installkernel
        return $_ret
    fi
}

# check_mount <dracut module> [<use_as_dep>] [<module path>]
# check_mount checks, if a dracut module is needed for the given
# device and filesystem types in "${host_fs_types[@]}"
check_mount() {
    local _mod=$1
    local _moddir=$3
    local _ret
    local _moddep

    [[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
    # shellcheck disable=SC2154
    [ "${#host_fs_types[@]}" -le 0 ] && return 1

    # If we are already scheduled to be loaded, no need to check again.
    [[ " $mods_to_load " == *\ $_mod\ * ]] && return 0
    [[ " $mods_checked_as_dep " == *\ $_mod\ * ]] && return 1

    # This should never happen, but...
    [[ -d $_moddir ]] || return 1

    [[ $2 ]] || mods_checked_as_dep+=" $_mod "

    # shellcheck disable=SC2154
    if [[ " $omit_dracutmodules " == *\ $_mod\ * ]]; then
        return 1
    fi

    if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
        module_check_mount "$_mod" "$_moddir"
        ret=$?

        # explicit module, so also accept ret=255
        [[ $ret == 0 || $ret == 255 ]] || return 1
    else
        # module not in our list
        if [[ $dracutmodules == all ]]; then
            # check, if we can and should install this module
            module_check_mount "$_mod" "$_moddir" || return 1
        else
            # skip this module
            return 1
        fi
    fi

    for _moddep in $(module_depends "$_mod" "$_moddir"); do
        # handle deps as if they were manually added
        [[ " $dracutmodules " == *\ $_mod\ * ]] \
            && [[ " $dracutmodules " != *\ $_moddep\ * ]] \
            && dracutmodules+=" $_moddep "
        [[ " $add_dracutmodules " == *\ $_mod\ * ]] \
            && [[ " $add_dracutmodules " != *\ $_moddep\ * ]] \
            && add_dracutmodules+=" $_moddep "
        [[ " $force_add_dracutmodules " == *\ $_mod\ * ]] \
            && [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \
            && force_add_dracutmodules+=" $_moddep "
        # if a module we depend on fail, fail also
        if ! check_module "$_moddep"; then
            derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
            return 1
        fi
    done

    [[ " $mods_to_load " == *\ $_mod\ * ]] \
        || mods_to_load+=" $_mod "

    return 0
}

# check_module <dracut module> [<use_as_dep>] [<module path>]
# check if a dracut module is to be used in the initramfs process
# if <use_as_dep> is set, then the process also keeps track
# that the modules were checked for the dependency tracking process
check_module() {
    local _mod=$1
    local _moddir=$3
    local _ret
    local _moddep

    [[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
    # If we are already scheduled to be loaded, no need to check again.
    [[ " $mods_to_load " == *\ $_mod\ * ]] && return 0
    [[ " $mods_checked_as_dep " == *\ $_mod\ * ]] && return 1

    # This should never happen, but...
    [[ -d $_moddir ]] || return 1

    [[ $2 ]] || mods_checked_as_dep+=" $_mod "

    if [[ " $omit_dracutmodules " == *\ $_mod\ * ]]; then
        ddebug "dracut module '$_mod' will not be installed, because it's in the list to be omitted!"
        return 1
    fi

    if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
        if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then
            module_check "$_mod" 1 "$_moddir"
            ret=$?
        else
            module_check "$_mod" 0 "$_moddir"
            ret=$?
        fi
        # explicit module, so also accept ret=255
        [[ $ret == 0 || $ret == 255 ]] || return 1
    else
        # module not in our list
        if [[ $dracutmodules == all ]]; then
            # check, if we can and should install this module
            module_check "$_mod" 0 "$_moddir"
            ret=$?
            if [[ $ret != 0 ]]; then
                [[ $2 ]] && return 1
                [[ $ret != 255 ]] && return 1
            fi
        else
            # skip this module
            return 1
        fi
    fi

    for _moddep in $(module_depends "$_mod" "$_moddir"); do
        # handle deps as if they were manually added
        [[ " $dracutmodules " == *\ $_mod\ * ]] \
            && [[ " $dracutmodules " != *\ $_moddep\ * ]] \
            && dracutmodules+=" $_moddep "
        [[ " $add_dracutmodules " == *\ $_mod\ * ]] \
            && [[ " $add_dracutmodules " != *\ $_moddep\ * ]] \
            && add_dracutmodules+=" $_moddep "
        [[ " $force_add_dracutmodules " == *\ $_mod\ * ]] \
            && [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \
            && force_add_dracutmodules+=" $_moddep "
        # if a module we depend on fail, fail also
        if ! check_module "$_moddep"; then
            derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
            return 1
        fi
    done

    [[ " $mods_to_load " == *\ $_mod\ * ]] \
        || mods_to_load+=" $_mod "

    return 0
}

# for_each_module_dir <func>
# execute "<func> <dracut module> 1 <module path>"
for_each_module_dir() {
    local _modcheck
    local _mod
    local _moddir
    local _func
    _func=$1
    for _moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
        [[ -d $_moddir ]] || continue
        [[ -e $_moddir/install || -e $_moddir/installkernel || -e \
        $_moddir/module-setup.sh ]] || continue
        _mod=${_moddir##*/}
        _mod=${_mod#[0-9][0-9]}
        $_func "$_mod" 1 "$_moddir"
    done

    # Report any missing dracut modules, the user has specified
    _modcheck="$add_dracutmodules $force_add_dracutmodules"
    [[ $dracutmodules != all ]] && _modcheck="$_modcheck $dracutmodules"
    for _mod in $_modcheck; do
        [[ " $mods_to_load " == *\ $_mod\ * ]] && continue

        [[ " $force_add_dracutmodules " != *\ $_mod\ * ]] \
            && [[ " $dracutmodules " != *\ $_mod\ * ]] \
            && [[ " $omit_dracutmodules " == *\ $_mod\ * ]] \
            && continue

        derror "dracut module '$_mod' cannot be found or installed."
        [[ " $force_add_dracutmodules " == *\ $_mod\ * ]] && exit 1
        [[ " $dracutmodules " == *\ $_mod\ * ]] && exit 1
        [[ " $add_dracutmodules " == *\ $_mod\ * ]] && exit 1
    done
}

dracut_kernel_post() {
    for _f in modules.builtin modules.builtin.alias modules.builtin.modinfo modules.order; do
        [[ -e $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
    done

    # generate module dependencies for the initrd
    if [[ -d $initdir/lib/modules/$kernel ]] \
        && ! depmod -a -b "$initdir" "$kernel"; then
        dfatal "\"depmod -a $kernel\" failed."
        exit 1
    fi

}

instmods() {
    # instmods [-c [-s]] <kernel module> [<kernel module> ... ]
    # instmods [-c [-s]] <kernel subsystem>
    # install kernel modules along with all their dependencies.
    # <kernel subsystem> can be e.g. "=block" or "=drivers/usb/storage"
    # -c check
    # -s silent
    local _optional="-o"
    local _silent
    local _ret

    [[ $no_kernel == yes ]] && return

    if [[ $1 == '-c' ]]; then
        unset _optional
        shift
    fi
    if [[ $1 == '-s' ]]; then
        _silent=1
        shift
    fi

    if (($# == 0)); then
        read -r -d '' -a args
        set -- "${args[@]}"
    fi

    if (($# == 0)); then
        return 0
    fi

    "$DRACUT_INSTALL" \
        ${initdir:+-D "$initdir"} \
        ${dracutsysrootdir:+-r "$dracutsysrootdir"} \
        ${loginstall:+-L "$loginstall"} \
        ${hostonly:+-H} \
        ${check_supported:+--check-supported} \
        ${omit_drivers:+-N "$omit_drivers"} \
        ${srcmods:+--kerneldir "$srcmods"} \
        ${_optional:+-o} \
        ${_silent:+--silent} \
        -m "$@"
    _ret=$?

    if ((_ret != 0)) && [[ -z $_silent ]]; then
        derror "FAILED: " \
            "$DRACUT_INSTALL" \
            ${initdir:+-D "$initdir"} \
            ${dracutsysrootdir:+-r "$dracutsysrootdir"} \
            ${loginstall:+-L "$loginstall"} \
            ${hostonly:+-H} \
                ${check_supported:+--check-supported} \
            ${omit_drivers:+-N "$omit_drivers"} \
            ${srcmods:+--kerneldir "$srcmods"} \
            ${_optional:+-o} \
            ${_silent:+--silent} \
            -m "$@"
    fi

    [[ "$optional" ]] && return 0
    return $_ret
}

if [[ "$(ln --help)" == *--relative* ]]; then
    ln_r() {
        ln -sfnr "${initdir}/$1" "${initdir}/$2"
    }
else
    ln_r() {
        local _source=$1
        local _dest=$2
        [[ -d ${_dest%/*} ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
        ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}"
    }
fi

is_qemu_virtualized() {
    # 0 if a virt environment was detected
    # 1 if a virt environment could not be detected
    # 255 if any error was encountered
    if type -P systemd-detect-virt > /dev/null 2>&1; then
        if ! vm=$(systemd-detect-virt --vm > /dev/null 2>&1); then
            return 255
        fi
        [[ $vm == "qemu" ]] && return 0
        [[ $vm == "kvm" ]] && return 0
        [[ $vm == "bochs" ]] && return 0
    fi

    for i in /sys/class/dmi/id/*_vendor; do
        [[ -f $i ]] || continue
        read -r vendor < "$i"
        [[ $vendor == "QEMU" ]] && return 0
        [[ $vendor == "Red Hat" ]] && return 0
        [[ $vendor == "Bochs" ]] && return 0
    done
    return 1
}
 0707010000002E000081A400000000000000000000000164DF2CB8000008A0000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/dracut-initramfs-restore.sh #!/bin/bash

set -e

# do some sanity checks first
[ -e /run/initramfs/bin/sh ] && exit 0
[ -e /run/initramfs/.need_shutdown ] || exit 0

KERNEL_VERSION="$(uname -r)"

[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
SKIP="$dracutbasedir/skipcpio"
[[ -x $SKIP ]] || SKIP="cat"

[[ -f /etc/machine-id ]] && read -r MACHINE_ID < /etc/machine-id

mount -o ro /boot &> /dev/null || true

if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
    && [[ $MACHINE_ID ]] \
    && [[ -d /efi/${MACHINE_ID} || -L /efi/${MACHINE_ID} ]]; then
    IMG="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
elif [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
    && [[ $MACHINE_ID ]] \
    && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]]; then
    IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
elif [[ -f /boot/initrd-${KERNEL_VERSION} ]]; then
    IMG="/boot/initrd-${KERNEL_VERSION}"
elif [[ -f /lib/modules/${KERNEL_VERSION}/initrd ]]; then
    IMG="/lib/modules/${KERNEL_VERSION}/initrd"
else
    echo "No initramfs image found to restore!"
    exit 1
fi

cd /run/initramfs

if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet > /dev/null; then
    rm -f -- .need_shutdown
elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet > /dev/null; then
    rm -f -- .need_shutdown
elif $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet > /dev/null; then
    rm -f -- .need_shutdown
elif $SKIP "$IMG" | zstd -d -c | cpio -id --no-absolute-filenames --quiet > /dev/null; then
    rm -f -- .need_shutdown
else
    # something failed, so we clean up
    echo "Unpacking of $IMG to /run/initramfs failed" >&2
    rm -f -- /run/initramfs/shutdown
    exit 1
fi

if [[ -d squash ]]; then
    if ! unsquashfs -no-xattrs -f -d . squash-root.img > /dev/null; then
        echo "Squash module is enabled for this initramfs but failed to unpack squash-root.img" >&2
        rm -f -- /run/initramfs/shutdown
        exit 1
    fi
fi

if [ -e /etc/selinux/config -a -x /usr/sbin/setfiles ]; then
    . /etc/selinux/config
    /usr/sbin/setfiles -v -r /run/initramfs /etc/selinux/"${SELINUXTYPE}"/contexts/files/file_contexts /run/initramfs > /dev/null
fi

exit 0
0707010000002F000081ED00000000000000000000000164DF2CB800003485000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/dracut-logger.sh    #!/bin/bash
#
# logging faciality module for dracut both at build- and boot-time
#
# Copyright 2010 Amadeusz Żołnowski <aidecoe@aidecoe.name>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

export __DRACUT_LOGGER__=1

## @brief Logging facility module for dracut both at build- and boot-time.
#
# @section intro Introduction
#
# The logger takes a bit from Log4j philosophy. There are defined 6 logging
# levels:
#   - TRACE (6)
#     The TRACE Level designates finer-grained informational events than the
#     DEBUG.
#   - DEBUG (5)
#     The DEBUG Level designates fine-grained informational events that are most
#     useful to debug an application.
#   - INFO (4)
#     The INFO level designates informational messages that highlight the
#     progress of the application at coarse-grained level.
#   - WARN (3)
#     The WARN level designates potentially harmful situations.
#   - ERROR (2)
#     The ERROR level designates error events that might still allow the
#     application to continue running.
#   - FATAL (1)
#     The FATAL level designates very severe error events that will presumably
#     lead the application to abort.
# Descriptions are borrowed from Log4j documentation:
# http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html
#
# @section usage Usage
#
# First of all you have to start with dlog_init() function which initializes
# required variables. Don't call any other logging function before that one!
# If you're ready with this, you can use following functions which corresponds
# clearly to levels listed in @ref intro Introduction. Here they are:
#   - dtrace()
#   - ddebug()
#   - dinfo()
#   - dwarn()
#   - derror()
#   - dfatal()
# They take all arguments given as a single message to be logged. See dlog()
# function for details how it works. Note that you shouldn't use dlog() by
# yourself. It's wrapped with above functions.
#
# @see dlog_init() dlog()
#
# @section conf Configuration
#
# Logging is controlled by following global variables:
#   - @var stdloglvl - logging level to standard error (console output)
#   - @var sysloglvl - logging level to syslog (by logger command)
#   - @var fileloglvl - logging level to file
#   - @var kmsgloglvl - logging level to /dev/kmsg (only for boot-time)
#   - @var logfile - log file which is used when @var fileloglvl is higher
#   than 0
# and two global variables: @var maxloglvl and @var syslogfacility which <b>must
# not</b> be overwritten. Both are set by dlog_init(). @var maxloglvl holds
# maximum logging level of those three and indicates that dlog_init() was run.
# @var syslogfacility is set either to 'user' (when building initramfs) or
# 'daemon' (when booting).
#
# Logging level set by the variable means that messages from this logging level
# and above (FATAL is the highest) will be shown. Logging levels may be set
# independently for each destination (stderr, syslog, file, kmsg).
#
# @see dlog_init()

## @brief Initializes dracut Logger.
#
# @retval 1 if something has gone wrong
# @retval 0 on success.
#
# @note This function need to be called before any other from this file.
#
# If any of the variables is not set, this function set it to default:
#   - @var stdloglvl = 4 (info)
#   - @var sysloglvl = 0 (no logging)
#   - @var fileloglvl is set to 4 when @var logfile is set too, otherwise it's
#   - @var kmsgloglvl = 0 (no logging)
#   set to 0
#
# @warning Function sets global variables @var maxloglvl and @syslogfacility.
# See file doc comment for details.
dlog_init() {
    local __oldumask
    local ret=0
    local errmsg
    [ -z "$stdloglvl" ] && stdloglvl=4
    [ -z "$sysloglvl" ] && sysloglvl=0
    [ -z "$kmsgloglvl" ] && kmsgloglvl=0
    # Skip initialization if it's already done.
    [ -n "$maxloglvl" ] && return 0

    if [ -z "$fileloglvl" ]; then
        [ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
    elif ((fileloglvl > 0)); then
        if [[ $logfile ]]; then
            __oldumask=$(umask)
            umask 0377
            ! [ -e "$logfile" ] && : > "$logfile"
            umask "$__oldumask"
            if [[ -w $logfile ]] && [[ -f $logfile ]]; then
                # Mark new run in the log file
                echo >> "$logfile"
                if command -v date > /dev/null; then
                    echo "=== $(date) ===" >> "$logfile"
                else
                    echo "===============================================" >> "$logfile"
                fi
                echo >> "$logfile"
            else
                # We cannot log to file, so turn this facility off.
                fileloglvl=0
                ret=1
                errmsg="'$logfile' is not a writable file"
            fi
        fi
    fi

    if ((UID != 0)); then
        kmsgloglvl=0
        sysloglvl=0
    fi

    if ((sysloglvl > 0)); then
        if [[ -d /run/systemd/journal ]] \
            && type -P systemd-cat &> /dev/null \
            && systemctl --quiet is-active systemd-journald.socket &> /dev/null \
            && { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &> /dev/null; }; then
            readonly _systemdcatfile="$DRACUT_TMPDIR/systemd-cat"
            mkfifo "$_systemdcatfile"
            readonly _dlogfd=15
            systemd-cat -t 'dracut' --level-prefix=true < "$_systemdcatfile" &
            exec 15> "$_systemdcatfile"
        elif ! [[ -S /dev/log ]] && [[ -w /dev/log ]] || ! command -v logger > /dev/null; then
            # We cannot log to syslog, so turn this facility off.
            kmsgloglvl=$sysloglvl
            sysloglvl=0
            ret=1
            errmsg="No '/dev/log' or 'logger' included for syslog logging"
        fi
    fi

    if ((sysloglvl > 0)) || ((kmsgloglvl > 0)); then
        if [ -n "$dracutbasedir" ]; then
            readonly syslogfacility=user
        else
            readonly syslogfacility=daemon
        fi
        export syslogfacility
    fi

    local lvl
    local maxloglvl_l=0
    for lvl in $stdloglvl $sysloglvl $fileloglvl $kmsgloglvl; do
        ((lvl > maxloglvl_l)) && maxloglvl_l=$lvl
    done
    readonly maxloglvl=$maxloglvl_l
    export maxloglvl

    if ((stdloglvl < 6)) && ((kmsgloglvl < 6)) && ((fileloglvl < 6)) && ((sysloglvl < 6)); then
        unset dtrace
        dtrace() { :; }
    fi

    if ((stdloglvl < 5)) && ((kmsgloglvl < 5)) && ((fileloglvl < 5)) && ((sysloglvl < 5)); then
        unset ddebug
        ddebug() { :; }
    fi

    if ((stdloglvl < 4)) && ((kmsgloglvl < 4)) && ((fileloglvl < 4)) && ((sysloglvl < 4)); then
        unset dinfo
        dinfo() { :; }
    fi

    if ((stdloglvl < 3)) && ((kmsgloglvl < 3)) && ((fileloglvl < 3)) && ((sysloglvl < 3)); then
        unset dwarn
        dwarn() { :; }
        unset dwarning
        dwarning() { :; }
    fi

    if ((stdloglvl < 2)) && ((kmsgloglvl < 2)) && ((fileloglvl < 2)) && ((sysloglvl < 2)); then
        unset derror
        derror() { :; }
    fi

    if ((stdloglvl < 1)) && ((kmsgloglvl < 1)) && ((fileloglvl < 1)) && ((sysloglvl < 1)); then
        unset dfatal
        dfatal() { :; }
    fi

    [ -n "$errmsg" ] && derror "$errmsg"

    return $ret
}

## @brief Converts numeric logging level to the first letter of level name.
#
# @param lvl Numeric logging level in range from 1 to 6.
# @retval 1 if @a lvl is out of range.
# @retval 0 if @a lvl is correct.
# @result Echoes first letter of level name.
_lvl2char() {
    case "$1" in
        1) echo F ;;
        2) echo E ;;
        3) echo W ;;
        4) echo I ;;
        5) echo D ;;
        6) echo T ;;
        *) return 1 ;;
    esac
}

## @brief Converts numeric level to logger priority defined by POSIX.2.
#
# @param lvl Numeric logging level in range from 1 to 6.
# @retval 1 if @a lvl is out of range.
# @retval 0 if @a lvl is correct.
# @result Echoes logger priority.
_lvl2syspri() {
    printf -- "%s" "$syslogfacility."
    case "$1" in
        1) echo crit ;;
        2) echo error ;;
        3) echo warning ;;
        4) echo info ;;
        5) echo debug ;;
        6) echo debug ;;
        *) return 1 ;;
    esac
}

## @brief Converts dracut-logger numeric level to syslog log level
#
# @param lvl Numeric logging level in range from 1 to 6.
# @retval 1 if @a lvl is out of range.
# @retval 0 if @a lvl is correct.
# @result Echoes kernel console numeric log level
#
# Conversion is done as follows:
#
# <tt>
#   none     -> LOG_EMERG (0)
#   none     -> LOG_ALERT (1)
#   FATAL(1) -> LOG_CRIT (2)
#   ERROR(2) -> LOG_ERR (3)
#   WARN(3)  -> LOG_WARNING (4)
#   none     -> LOG_NOTICE (5)
#   INFO(4)  -> LOG_INFO (6)
#   DEBUG(5) -> LOG_DEBUG (7)
#   TRACE(6) /
# </tt>
#
# @see /usr/include/sys/syslog.h
_dlvl2syslvl() {
    local lvl

    case "$1" in
        1) lvl=2 ;;
        2) lvl=3 ;;
        3) lvl=4 ;;
        4) lvl=6 ;;
        5) lvl=7 ;;
        6) lvl=7 ;;
        *) return 1 ;;
    esac

    [ "$syslogfacility" = user ] && echo $((8 + lvl)) || echo $((24 + lvl))
}

## @brief Prints to stderr and/or writes to file, to syslog and/or /dev/kmsg
# given message with given level (priority).
#
# @param lvl Numeric logging level.
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
#
# @note This function is not supposed to be called manually. Please use
# dtrace(), ddebug(), or others instead which wrap this one.
#
# This is core logging function which logs given message to standard error, file
# and/or syslog (with POSIX shell command <tt>logger</tt>) and/or to /dev/kmsg.
# The format is following:
#
# <tt>X: some message</tt>
#
# where @c X is the first letter of logging level. See module description for
# details on that.
#
# Message to syslog is sent with tag @c dracut. Priorities are mapped as
# following:
#   - @c FATAL to @c crit
#   - @c ERROR to @c error
#   - @c WARN to @c warning
#   - @c INFO to @c info
#   - @c DEBUG and @c TRACE both to @c debug
_do_dlog() {
    local lvlc
    local lvl="$1"
    shift
    lvlc=$(_lvl2char "$lvl") || return 0
    local msg="$*"
    local lmsg="$lvlc: $*"

    ((lvl <= stdloglvl)) && printf -- 'dracut: %s\n' "$msg" >&2

    if ((lvl <= sysloglvl)); then
        if [[ "$_dlogfd" ]]; then
            printf -- "<%s>%s\n" "$(($(_dlvl2syslvl "$lvl") & 7))" "$msg" >&$_dlogfd
        else
            logger -t "dracut[$$]" -p "$(_lvl2syspri "$lvl")" -- "$msg"
        fi
    fi

    if ((lvl <= fileloglvl)) && [[ -w $logfile ]] && [[ -f $logfile ]]; then
        echo "$lmsg" >> "$logfile"
    fi

    ((lvl <= kmsgloglvl)) \
        && echo "<$(_dlvl2syslvl "$lvl")>dracut[$$] $msg" > /dev/kmsg
}

## @brief Internal helper function for _do_dlog()
#
# @param lvl Numeric logging level.
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
#
# @note This function is not supposed to be called manually. Please use
# dtrace(), ddebug(), or others instead which wrap this one.
#
# This function calls _do_dlog() either with parameter msg, or if
# none is given, it will read standard input and will use every line as
# a message.
#
# This enables:
# dwarn "This is a warning"
# echo "This is a warning" | dwarn
dlog() {
    [ -z "$maxloglvl" ] && return 0
    (($1 <= maxloglvl)) || return 0

    if (($# > 1)); then
        _do_dlog "$@"
    else
        while read -r line || [ -n "$line" ]; do
            _do_dlog "$1" "$line"
        done
    fi
}

## @brief Logs message at TRACE level (6)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dtrace() {
    set +x
    dlog 6 "$@"
    if [ -n "$debug" ]; then
        set -x
    fi
}

## @brief Logs message at DEBUG level (5)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
ddebug() {
    set +x
    dlog 5 "$@"
    if [ -n "$debug" ]; then
        set -x
    fi
}

## @brief Logs message at INFO level (4)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dinfo() {
    set +x
    dlog 4 "$@"
    if [ -n "$debug" ]; then
        set -x
    fi
}

## @brief Logs message at WARN level (3)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dwarn() {
    set +x
    dlog 3 "$@"
    if [ -n "$debug" ]; then
        set -x
    fi
}

## @brief It's an alias to dwarn() function.
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dwarning() {
    set +x
    dwarn "$@"
    if [ -n "$debug" ]; then
        set -x
    fi
}

## @brief Logs message at ERROR level (2)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
derror() {
    set +x
    dlog 2 "$@"
    if [ -n "$debug" ]; then
        set -x
    fi
}

## @brief Logs message at FATAL level (1)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dfatal() {
    set +x
    dlog 1 "$@"
    if [ -n "$debug" ]; then
        set -x
    fi
}
   07070100000030000081A400000000000000000000000164DF2CB800000075000000000000000000000000000000000000002A00000000dracut-055+suse.347.gdcb9bdbf/dracut.conf # PUT YOUR CONFIG IN separate files
# in /etc/dracut.conf.d named "<name>.conf"
# SEE man dracut.conf(5) for options
   07070100000031000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002C00000000dracut-055+suse.347.gdcb9bdbf/dracut.conf.d   07070100000032000081A400000000000000000000000164DF2CB8000005F9000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/dracut.conf.d/fedora.conf.example   # dracut config file customized for RedHat/Fedora.

# i18n
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
i18n_default_font="eurlatgr"
i18n_install_all="yes"


stdloglvl=3
sysloglvl=5
install_optional_items+=" vi /etc/virc ps grep cat rm "
prefix="/"
environment=/usr/lib/environment.d
environmentconfdir=/etc/environment.d
dbus=/usr/share/dbus-1
dbusinterfaces=/usr/share/dbus-1/interfaces
dbusservices=/usr/share/dbus-1/services
dbussession=/usr/share/dbus-1/session.d
dbussystem=/usr/share/dbus-1/system.d
dbussystemservices=/usr/share/dbus-1/system-services
dbusconfdir=/etc/dbus-1
dbusinterfacesconfdir=/etc/dbus-1/interfaces
dbusservicesconfdir=/etc/dbus-1/services
dbussessionconfdir=/etc/dbus-1/session.d
dbussystem=confdir/etc/dbus-1/system.d
dbussystemservicesconfdir=/etc/dbus-1/system-services
sysctld=/usr/lib/sysctl.d
sysctlconfdir=/etc/sysctl.d
systemdutildir=/usr/lib/systemd
systemdutilconfdir=/etc/systemd
systemdcatalog=/usr/lib/systemd/catalog
systemdntpunits=/usr/lib/systemd/ntp-units.d
systemdntpunitsconfdir=/etc/systemd/ntp-units.d
systemdportable=/usr/lib/systemd/portable
systemdportableconfdir=/etc/systemd/portable
systemdsystemunitdir=/usr/lib/systemd/system
systemdsystemconfdir=/etc/systemd/system
systemduser=/usr/lib/systemd/user
systemduserconfdir=/etc/systemd/user
sysusers=/usr/lib/sysusers.d
sysusersconfdir=/etc/sysusers.d
udevdir=/usr/lib/udev
hostonly="yes"
hostonly_cmdline="no"
early_microcode="yes"
reproducible="yes"
   07070100000033000081A400000000000000000000000164DF2CB800000033000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/dracut.conf.d/fips.conf.example # turn on fips module

add_dracutmodules+=" fips "
 07070100000034000081A400000000000000000000000164DF2CB800000099000000000000000000000000000000000000004800000000dracut-055+suse.347.gdcb9bdbf/dracut.conf.d/gentoo-systemd.conf.example   # /etc/dracut.conf.d/gentoo-systemd.conf

# Paths of systemd dirs on Gentoo
systemdutildir=/usr/lib/systemd
systemdsystemunitdir=/usr/lib/systemd/system
   07070100000035000081A400000000000000000000000164DF2CB800000183000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/dracut.conf.d/gentoo.conf.example   # /etc/dracut.conf.d/gentoo.conf
# dracut config file customized for Gentoo Base System release 2

udevdir=/lib/udev
ro_mnt=yes

#
# Modules
#

# i18n
i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE"
i18n_default_font="LatArCyrHeb-16"

omit_drivers+=" i2o_scsi "
 07070100000036000081A400000000000000000000000164DF2CB800000038000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/dracut.conf.d/ima.conf.example  # turn on ima modules

add_dracutmodules+=" integrity "
07070100000037000081A400000000000000000000000164DF2CB80000042A000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/dracut.conf.d/suse.conf.example # SUSE specific dracut settings
#
# SUSE by default always builds as small as possible initrd for performance
# and resource reasons.
# If you like to build a generic initrd which works on other platforms than
# on the one dracut/mkinitrd got called comment out below setting(s).
hostonly="yes"
hostonly_cmdline="yes"

compress="zstd -3 -T0 -q"

i18n_vars="/etc/sysconfig/language:RC_LANG-LANG,RC_LC_ALL-LC_ALL /etc/sysconfig/console:CONSOLE_UNICODEMAP-FONT_UNIMAP,CONSOLE_FONT-FONT,CONSOLE_SCREENMAP-FONT_MAP /etc/sysconfig/keyboard:KEYTABLE-KEYMAP"
omit_drivers+=" i2o_scsi "

# Below adds additional tools to the initrd which are not urgently necessary to
# bring up the system, but help to debug problems.
# See /usr/lib/dracut/modules.d/95debug/module-setup.sh which additional tools
# are installed and add more if you need them. This specifically helps if you
# use:
# rd.break=[cmdline|pre-udev|pre-trigger|initqueue|pre-mount|
# mount|pre-pivot|cleanup]
# boot parameter or if you are forced to enter the dracut emergency shell.

# add_dracutmodules+=debug
  07070100000038000081ED00000000000000000000000164DF2CB8000166CA000000000000000000000000000000000000002800000000dracut-055+suse.347.gdcb9bdbf/dracut.sh   #!/bin/bash -p
#
# Generator script for a dracut initramfs

# Copyright 2005-2013 Red Hat, Inc.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

# store for logging

unset BASH_ENV
unset GZIP

# Verify bash version, current minimum is 4
if ((BASH_VERSINFO[0] < 4)); then
    printf -- 'You need at least Bash 4 to use dracut, sorry.' >&2
    exit 1
fi

dracut_args=("$@")
# shellcheck disable=SC2155
readonly dracut_cmd=$(readlink -f "$0")

set -o pipefail

usage() {
    [[ $sysroot_l ]] && dracutsysrootdir="$sysroot_l"
    [[ $dracutbasedir ]] || dracutbasedir="$dracutsysrootdir"/usr/lib/dracut
    if [[ -f $dracutbasedir/dracut-version.sh ]]; then
        # shellcheck source=./dracut-version.sh
        . "$dracutbasedir"/dracut-version.sh
    fi

    #                                                   80x25 linebreak here ^
    cat << EOF
Usage: $dracut_cmd [OPTION]... [<initramfs> [<kernel-version>]]

Version: $DRACUT_VERSION

Creates initial ramdisk images for preloading modules

  -h, --help  Display all options

If a [LIST] has multiple arguments, then you have to put these in quotes.

For example:

    # dracut --add-drivers "module1 module2"  ...

EOF
}

long_usage() {
    [[ $dracutbasedir ]] || dracutbasedir="$dracutsysrootdir"/usr/lib/dracut
    if [[ -f $dracutbasedir/dracut-version.sh ]]; then
        # shellcheck source=./dracut-version.sh
        . "$dracutbasedir"/dracut-version.sh
    fi

    #                                                   80x25 linebreak here ^
    cat << EOF
Usage: $dracut_cmd [OPTION]... [<initramfs> [<kernel-version>]]

Version: $DRACUT_VERSION

Creates initial ramdisk images for preloading modules

  --kver [VERSION]      Set kernel version to [VERSION].
  -f, --force           Overwrite existing initramfs file.
  -a, --add [LIST]      Add a space-separated list of dracut modules.
  --rebuild         Append arguments to those of existing image and rebuild
  -m, --modules [LIST]  Specify a space-separated list of dracut modules to
                         call when building the initramfs. Modules are located
                         in /usr/lib/dracut/modules.d.
  -o, --omit [LIST]     Omit a space-separated list of dracut modules.
  --force-add [LIST]    Force to add a space-separated list of dracut modules
                         to the default set of modules, when -H is specified.
  -d, --drivers [LIST]  Specify a space-separated list of kernel modules to
                         exclusively include in the initramfs.
  --add-drivers [LIST]  Specify a space-separated list of kernel
                         modules to add to the initramfs.
  --force-drivers [LIST] Specify a space-separated list of kernel
                         modules to add to the initramfs and make sure they
                         are tried to be loaded via modprobe same as passing
                         rd.driver.pre=DRIVER kernel parameter.
  --omit-drivers [LIST] Specify a space-separated list of kernel
                         modules not to add to the initramfs.
  --filesystems [LIST]  Specify a space-separated list of kernel filesystem
                         modules to exclusively include in the generic
                         initramfs.
  -k, --kmoddir [DIR]   Specify the directory, where to look for kernel
                         modules
  --fwdir [DIR]         Specify additional directories, where to look for
                         firmwares, separated by :
  --kernel-only         Only install kernel drivers and firmware files
  --no-kernel           Do not install kernel drivers and firmware files
  --print-cmdline       Print the kernel command line for the given disk layout
  --early-microcode     Combine early microcode with ramdisk
  --no-early-microcode  Do not combine early microcode with ramdisk
  --kernel-cmdline [PARAMETERS] Specify default kernel command line parameters
  --strip               Strip binaries in the initramfs
  --nostrip             Do not strip binaries in the initramfs
  --hardlink            Hardlink files in the initramfs
  --nohardlink          Do not hardlink files in the initramfs
  --prefix [DIR]        Prefix initramfs files with [DIR]
  --noprefix            Do not prefix initramfs files
  --mdadmconf           Include local /etc/mdadm.conf
  --nomdadmconf         Do not include local /etc/mdadm.conf
  --lvmconf             Include local /etc/lvm/lvm.conf
  --nolvmconf           Do not include local /etc/lvm/lvm.conf
  --fscks [LIST]        Add a space-separated list of fsck helpers.
  --nofscks             Inhibit installation of any fsck helpers.
  --ro-mnt              Mount / and /usr read-only by default.
  -h, --help            This message
  --debug               Output debug information of the build process
  --profile             Output profile information of the build process
  -L, --stdlog [0-6]    Specify logging level (to standard error)
                         0 - suppress any messages
                         1 - only fatal errors
                         2 - all errors
                         3 - warnings
                         4 - info
                         5 - debug info (here starts lots of output)
                         6 - trace info (and even more)
  -v, --verbose         Increase verbosity level
  -q, --quiet           Decrease verbosity level
  -c, --conf [FILE]     Specify configuration file to use.
                         Default: /etc/dracut.conf
  --confdir [DIR]       Specify configuration directory to use *.conf files
                         from. Default: /etc/dracut.conf.d
  --tmpdir [DIR]        Temporary directory to be used instead of default
                         ${TMPDIR:-/var/tmp}.
  -r, --sysroot [DIR]   Specify sysroot directory to collect files from.
  -l, --local           Local mode. Use modules from the current working
                         directory instead of the system-wide installed in
                         /usr/lib/dracut/modules.d.
                         Useful when running dracut from a git checkout.
  -H, --hostonly        Host-Only mode: Install only what is needed for
                        booting the local host instead of a generic host.
  -N, --no-hostonly     Disables Host-Only mode
  --hostonly-mode <mode>
                        Specify the hostonly mode to use. <mode> could be
                        one of "sloppy" or "strict". "sloppy" mode is used
                        by default.
                        In "sloppy" hostonly mode, extra drivers and modules
                        will be installed, so minor hardware change won't make
                        the image unbootable (eg. changed keyboard), and the
                        image is still portable among similar hosts.
                        With "strict" mode enabled, anything not necessary
                        for booting the local host in its current state will
                        not be included, and modules may do some extra job
                        to save more space. Minor change of hardware or
                        environment could make the image unbootable.
                        DO NOT use "strict" mode unless you know what you
                        are doing.
  --hostonly-cmdline    Store kernel command line arguments needed
                        in the initramfs
  --no-hostonly-cmdline Do not store kernel command line arguments needed
                        in the initramfs
  --no-hostonly-default-device
                        Do not generate implicit host devices like root,
                        swap, fstab, etc. Use "--mount" or "--add-device"
                        to explicitly add devices as needed.
  --hostonly-i18n       Install only needed keyboard and font files according
                        to the host configuration (default).
  --no-hostonly-i18n    Install all keyboard and font files available.
  --hostonly-nics [LIST]
                        Only enable listed NICs in the initramfs.
  --persistent-policy [POLICY]
                        Use [POLICY] to address disks and partitions.
                        POLICY can be any directory name found in /dev/disk.
                        E.g. "by-uuid", "by-label"
  --fstab               Use /etc/fstab to determine the root device.
  --add-fstab [FILE]    Add file to the initramfs fstab
  --mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
                        Mount device [DEV] on mountpoint [MP] with filesystem
                        [FSTYPE] and options [FSOPTS] in the initramfs
  --mount "[MP]"        Same as above, but [DEV], [FSTYPE] and [FSOPTS] are
                        determined by looking at the current mounts.
  --add-device "[DEV]"  Bring up [DEV] in initramfs
  -i, --include [SOURCE] [TARGET]
                        Include the files in the SOURCE directory into the
                         Target directory in the final initramfs.
                        If SOURCE is a file, it will be installed to TARGET
                         in the final initramfs.
  -I, --install [LIST]  Install the space separated list of files into the
                         initramfs.
  --install-optional [LIST]  Install the space separated list of files into the
                         initramfs, if they exist.
  --gzip                Compress the generated initramfs using gzip.
                         This will be done by default, unless another
                         compression option or --no-compress is passed.
  --bzip2               Compress the generated initramfs using bzip2.
                         Make sure your kernel has bzip2 decompression support
                         compiled in, otherwise you will not be able to boot.
  --lzma                Compress the generated initramfs using lzma.
                         Make sure your kernel has lzma support compiled in,
                         otherwise you will not be able to boot.
  --xz                  Compress the generated initramfs using xz.
                         Make sure that your kernel has xz support compiled
                         in, otherwise you will not be able to boot.
  --lzo                 Compress the generated initramfs using lzop.
                         Make sure that your kernel has lzo support compiled
                         in, otherwise you will not be able to boot.
  --lz4                 Compress the generated initramfs using lz4.
                         Make sure that your kernel has lz4 support compiled
                         in, otherwise you will not be able to boot.
  --zstd                Compress the generated initramfs using Zstandard.
                         Make sure that your kernel has zstd support compiled
                         in, otherwise you will not be able to boot.
  --compress [COMPRESSION] Compress the generated initramfs with the
                         passed compression program.  Make sure your kernel
                         knows how to decompress the generated initramfs,
                         otherwise you will not be able to boot.
  --no-compress         Do not compress the generated initramfs.  This will
                         override any other compression options.
  --enhanced-cpio       Attempt to reflink cpio file data using dracut-cpio.
  --list-modules        List all available dracut modules.
  -M, --show-modules    Print included module's name to standard output during
                         build.
  --keep                Keep the temporary initramfs for debugging purposes
  --printsize           Print out the module install size
  --sshkey [SSHKEY]     Add ssh key to initramfs (use with ssh-client module)
  --logfile [FILE]      Logfile to use (overrides configuration setting)
  --check-supported     Check to ensure that modules are marked supported when
                        using a kernel that is configured to check the
                        support status of a module before loading.
  --reproducible        Create reproducible images
  --no-reproducible     Do not create reproducible images
  --loginstall [DIR]    Log all files installed from the host to [DIR]
  --uefi                Create an UEFI executable with the kernel cmdline and
                        kernel combined
  --no-uefi             Disables UEFI mode
  --uefi-stub [FILE]    Use the UEFI stub [FILE] to create an UEFI executable
  --uefi-splash-image [FILE]
                        Use [FILE] as a splash image when creating an UEFI
                        executable
  --kernel-image [FILE] location of the kernel image
  --regenerate-all      Regenerate all initramfs images at the default location
                        for the kernel versions found on the system
  --version             Display version

If [LIST] has multiple arguments, then you have to put these in quotes.

For example:

    # dracut --add-drivers "module1 module2"  ...

EOF
}

long_version() {
    [[ $dracutbasedir ]] || dracutbasedir="$dracutsysrootdir"/usr/lib/dracut
    if [[ -f $dracutbasedir/dracut-version.sh ]]; then
        # shellcheck source=./dracut-version.sh
        . "$dracutbasedir"/dracut-version.sh
    fi
    echo "dracut $DRACUT_VERSION"
}

# Fills up host_devs stack variable and makes sure there are no duplicates
push_host_devs() {
    local _dev
    for _dev in "$@"; do
        [[ " ${host_devs[*]} " == *" $_dev "* ]] && return
        host_devs+=("$_dev")
    done
}

# Little helper function for reading args from the commandline.
# it automatically handles -a b and -a=b variants, and returns 1 if
# we need to shift $3.
read_arg() {
    # $1 = arg name
    # $2 = arg value
    # $3 = arg parameter
    local rematch='^[^=]*=(.*)$'
    if [[ $2 =~ $rematch ]]; then
        read -r "$1" <<< "${BASH_REMATCH[1]}"
    else
        read -r "$1" <<< "$3"
        # There is no way to shift our callers args, so
        # return 1 to indicate they should do it instead.
        return 1
    fi
}

check_conf_file() {

    if grep -H -e '^[^#]*[+]=\("[^ ]\|.*[^ ]"\)' "$@"; then
        printf '\ndracut: WARNING: <key>+=" <values> ": <values> should have surrounding white spaces!\n' >&2
        printf 'dracut: WARNING: This will lead to unwanted side effects! Please fix the configuration file.\n\n' >&2
    fi
}

dropindirs_sort() {
    local suffix=$1
    shift
    local -a files
    local f d

    for d in "$@"; do
        for i in "$d/"*"$suffix"; do
            if [[ -e $i ]]; then
                printf "%s\n" "${i##*/}"
            fi
        done
    done | sort -Vu | {
        readarray -t files

        for f in "${files[@]}"; do
            for d in "$@"; do
                if [[ -e "$d/$f" ]]; then
                    printf "%s\n" "$d/$f"
                    continue 2
                fi
            done
        done
    }
}

rearrange_params() {

    # Workaround -i, --include taking 2 arguments
    newat=()
    for i in "$@"; do
        if [[ $i == "-i" ]] || [[ $i == "--include" ]]; then
            newat+=("++include") # Replace --include by ++include
        else
            newat+=("$i")
        fi
    done
    set -- "${newat[@]}" # Set new $@

    TEMP=$(
        unset POSIXLY_CORRECT
        getopt \
            -o "a:m:o:d:I:k:c:r:L:fvqlHhMN" \
            --long kver: \
            --long add: \
            --long force-add: \
            --long add-drivers: \
            --long force-drivers: \
            --long omit-drivers: \
            --long modules: \
            --long omit: \
            --long drivers: \
            --long filesystems: \
            --long install: \
            --long install-optional: \
            --long fwdir: \
            --long libdirs: \
            --long fscks: \
            --long add-fstab: \
            --long mount: \
            --long device: \
            --long add-device: \
            --long nofscks \
            --long ro-mnt \
            --long kmoddir: \
            --long conf: \
            --long confdir: \
            --long tmpdir: \
            --long sysroot: \
            --long stdlog: \
            --long compress: \
            --long prefix: \
            --long rebuild: \
            --long force \
            --long kernel-only \
            --long no-kernel \
            --long print-cmdline \
            --long kernel-cmdline: \
            --long strip \
            --long nostrip \
            --long hardlink \
            --long nohardlink \
            --long noprefix \
            --long mdadmconf \
            --long nomdadmconf \
            --long lvmconf \
            --long nolvmconf \
            --long debug \
            --long profile \
            --long sshkey: \
            --long logfile: \
            --long verbose \
            --long quiet \
            --long local \
            --long hostonly \
            --long host-only \
            --long no-hostonly \
            --long no-host-only \
            --long hostonly-mode: \
            --long hostonly-cmdline \
            --long no-hostonly-cmdline \
            --long no-hostonly-default-device \
            --long persistent-policy: \
            --long fstab \
            --long help \
            --long bzip2 \
            --long lzma \
            --long xz \
            --long lzo \
            --long lz4 \
            --long zstd \
            --long no-compress \
            --long gzip \
            --long enhanced-cpio \
            --long list-modules \
            --long show-modules \
            --long keep \
            --long printsize \
            --long regenerate-all \
            --long noimageifnotneeded \
            --long early-microcode \
            --long no-early-microcode \
        --long check-supported \
            --long reproducible \
            --long no-reproducible \
            --long loginstall: \
            --long uefi \
            --long no-uefi \
            --long uefi-stub: \
            --long uefi-splash-image: \
            --long kernel-image: \
            --long no-hostonly-i18n \
            --long hostonly-i18n \
            --long hostonly-nics: \
            --long no-machineid \
            --long version \
            -- "$@"
    )

    # shellcheck disable=SC2181
    if (($? != 0)); then
        usage
        exit 1
    fi
}

verbosity_mod_l=0
unset kernel
unset outfile

rearrange_params "$@"
eval set -- "$TEMP"

# parse command line args to check if '--rebuild' option is present
unset append_args_l
unset rebuild_file
while :; do

    if [ "$1" == "--" ]; then
        shift
        break
    fi
    if [ "$1" == "--rebuild" ]; then
        append_args_l="yes"
        rebuild_file="$2"
        if [ ! -e "$rebuild_file" ]; then
            echo "Image file '$rebuild_file', for rebuild, does not exist!"
            exit 1
        fi
        abs_rebuild_file=$(readlink -f "$rebuild_file") && rebuild_file="$abs_rebuild_file"
        shift
        continue
    fi
    shift
done

# get output file name and kernel version from command line arguments
while (($# > 0)); do
    case ${1%%=*} in
        ++include)
            shift 2
            ;;
        *)
            if ! [[ ${outfile+x} ]]; then
                outfile=$1
            elif ! [[ ${kernel+x} ]]; then
                kernel=$1
            else
                printf "\nUnknown arguments: %s\n\n" "$*" >&2
                usage
                exit 1
            fi
            ;;
    esac
    shift
done

# extract input image file provided with rebuild option to get previous parameters, if any
if [[ $append_args_l == "yes" ]]; then
    unset rebuild_param

    # determine resultant file
    if ! [[ $outfile ]]; then
        outfile=$rebuild_file
    fi

    if ! rebuild_param=$(lsinitrd "$rebuild_file" '*lib/dracut/build-parameter.txt'); then
        echo "Image '$rebuild_file' has no rebuild information stored"
        exit 1
    fi

    # prepend previous parameters to current command line args
    if [[ $rebuild_param ]]; then
        TEMP="$rebuild_param $TEMP"
        eval set -- "$TEMP"
        rearrange_params "$@"
    fi
fi

unset PARMS_TO_STORE
PARMS_TO_STORE=""

eval set -- "$TEMP"

while :; do
    if [[ $1 != "--" ]] && [[ $1 != "--rebuild" ]]; then
        PARMS_TO_STORE+=" $1"
    fi
    case $1 in
        --kver)
            kernel="$2"
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        -a | --add)
            add_dracutmodules_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --force-add)
            force_add_dracutmodules_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --add-drivers)
            add_drivers_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --force-drivers)
            force_drivers_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --omit-drivers)
            omit_drivers_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        -m | --modules)
            dracutmodules_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        -o | --omit)
            omit_dracutmodules_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        -d | --drivers)
            drivers_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --filesystems)
            filesystems_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        -I | --install)
            install_items_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --install-optional)
            install_optional_items_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --fwdir)
            fw_dir_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --libdirs)
            libdirs_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --fscks)
            fscks_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --add-fstab)
            add_fstab_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --mount)
            fstab_lines+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --add-device | --device)
            add_device_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --kernel-cmdline)
            kernel_cmdline_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --nofscks) nofscks_l="yes" ;;
        --ro-mnt) ro_mnt_l="yes" ;;
        -k | --kmoddir)
            drivers_dir_l="$2"
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        -c | --conf)
            conffile="$2"
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --confdir)
            confdir="$2"
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --tmpdir)
            tmpdir_l="$2"
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        -r | --sysroot)
            sysroot_l="$2"
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        -L | --stdlog)
            stdloglvl_l="$2"
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --compress)
            compress_l="$2"
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --prefix)
            prefix_l="$2"
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --loginstall)
            loginstall_l="$2"
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --rebuild)
            if [[ $rebuild_file == "$outfile" ]]; then
                force=yes
            fi
            shift
            ;;
        -f | --force) force=yes ;;
        --kernel-only)
            kernel_only="yes"
            no_kernel="no"
            ;;
        --no-kernel)
            kernel_only="no"
            no_kernel="yes"
            ;;
        --print-cmdline)
            print_cmdline="yes"
            hostonly_l="yes"
            kernel_only="yes"
            no_kernel="yes"
            ;;
        --early-microcode)
            early_microcode_l="yes"
            ;;
        --no-early-microcode)
            early_microcode_l="no"
            ;;
        --strip) do_strip_l="yes" ;;
        --nostrip) do_strip_l="no" ;;
        --hardlink) do_hardlink_l="yes" ;;
        --nohardlink) do_hardlink_l="no" ;;
        --noprefix) prefix_l="/" ;;
        --mdadmconf) mdadmconf_l="yes" ;;
        --nomdadmconf) mdadmconf_l="no" ;;
        --lvmconf) lvmconf_l="yes" ;;
        --nolvmconf) lvmconf_l="no" ;;
        --debug) debug="yes" ;;
        --profile) profile="yes" ;;
        --sshkey)
            sshkey="$2"
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --logfile)
            logfile_l="$2"
            shift
            ;;
        -v | --verbose) ((verbosity_mod_l++)) ;;
        -q | --quiet) ((verbosity_mod_l--)) ;;
        -l | --local)
            allowlocal="yes"
            [[ -f "$(readlink -f "${0%/*}")/dracut-init.sh" ]] \
                && dracutbasedir="$(readlink -f "${0%/*}")"
            ;;
        -H | --hostonly | --host-only)
            hostonly_l="yes"
            ;;
        -N | --no-hostonly | --no-host-only)
            hostonly_l="no"
            ;;
        --hostonly-mode)
            hostonly_mode_l="$2"
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --hostonly-cmdline)
            hostonly_cmdline_l="yes"
            ;;
        --hostonly-i18n)
            i18n_install_all_l="no"
            ;;
        --hostonly-nics)
            hostonly_nics_l+=("$2")
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --no-hostonly-i18n)
            i18n_install_all_l="yes"
            ;;
        --no-hostonly-cmdline)
            hostonly_cmdline_l="no"
            ;;
        --no-hostonly-default-device)
            hostonly_default_device="no"
            ;;
        --persistent-policy)
            persistent_policy_l="$2"
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --fstab) use_fstab_l="yes" ;;
        -h | --help)
            long_usage
            exit 1
            ;;
        --bzip2) compress_l="bzip2" ;;
        --lzma) compress_l="lzma" ;;
        --xz) compress_l="xz" ;;
        --lzo) compress_l="lzo" ;;
        --lz4) compress_l="lz4" ;;
        --zstd) compress_l="zstd" ;;
        --no-compress) _no_compress_l="cat" ;;
        --gzip) compress_l="gzip" ;;
        --enhanced-cpio) enhanced_cpio_l="yes" ;;
        --list-modules) do_list="yes" ;;
        -M | --show-modules)
            show_modules_l="yes"
            ;;
        --keep) keep="yes" ;;
        --printsize) printsize="yes" ;;
        --regenerate-all) regenerate_all="yes" ;;
        --noimageifnotneeded) noimageifnotneeded="yes" ;;
        --check-supported) check_supported="yes" ;;
        --reproducible) reproducible_l="yes" ;;
        --no-reproducible) reproducible_l="no" ;;
        --uefi) uefi_l="yes" ;;
        --no-uefi) uefi_l="no" ;;
        --uefi-stub)
            uefi_stub_l="$2"
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --uefi-splash-image)
            uefi_splash_image_l="$2"
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --kernel-image)
            kernel_image_l="$2"
            PARMS_TO_STORE+=" '$2'"
            shift
            ;;
        --no-machineid)
            machine_id_l="no"
            ;;
        --version)
            long_version
            exit 1
            ;;
        --)
            shift
            break
            ;;

        *) # should not even reach this point
            printf "\n!Unknown option: '%s'\n\n" "$1" >&2
            usage
            exit 1
            ;;
    esac
    shift
done

# getopt cannot handle multiple arguments, so just handle "-I,--include"
# the old fashioned way

while (($# > 0)); do
    if [ "${1%%=*}" == "++include" ]; then
        include_src+=("$2")
        include_target+=("$3")
        PARMS_TO_STORE+=" --include '$2' '$3'"
        shift 2
    fi
    shift
done

[[ $sysroot_l ]] && dracutsysrootdir="$sysroot_l"

if [[ $regenerate_all == "yes" ]]; then
    ret=0
    if [[ $kernel ]]; then
        printf -- "--regenerate-all cannot be called with a kernel version\n" >&2
        exit 1
    fi

    if [[ $outfile ]]; then
        printf -- "--regenerate-all cannot be called with a image file\n" >&2
        exit 1
    fi

    ((len = ${#dracut_args[@]}))
    for ((i = 0; i < len; i++)); do
        [[ ${dracut_args[$i]} == "--regenerate-all" ]] \
            && unset dracut_args["$i"]
    done

    cd "$dracutsysrootdir"/lib/modules || exit 1
    for i in *; do
        [[ -f $i/modules.dep ]] || [[ -f $i/modules.dep.bin ]] || continue
        [[ -d $i/kernel ]] || continue
        "$dracut_cmd" --kver="$i" "${dracut_args[@]}"
        ((ret += $?))
    done
    exit "$ret"
fi

if ! [[ $kernel ]]; then
    kernel=$(uname -r)
fi

export LC_ALL=C
export LANG=C
unset LC_MESSAGES
unset LC_CTYPE
unset LD_LIBRARY_PATH
unset LD_PRELOAD
unset GREP_OPTIONS

export DRACUT_LOG_LEVEL=warning
[[ $debug ]] && {
    export DRACUT_LOG_LEVEL=debug
    export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): '
    set -x
}

[[ $profile ]] && {
    export PS4='+ $(date "+%s.%N") ${BASH_SOURCE}@${LINENO}: '
    set -x
    debug=yes
}

[[ $dracutbasedir ]] || dracutbasedir="$dracutsysrootdir"/usr/lib/dracut

# if we were not passed a config file, try the default one
if [[ ! -f $conffile ]]; then
    if [[ $allowlocal ]]; then
        conffile="$dracutbasedir/dracut.conf"
    else
        conffile="$dracutsysrootdir/etc/dracut.conf"
    fi
fi

if [[ ! -d $confdir ]]; then
    if [[ $allowlocal ]]; then
        confdir="$dracutbasedir/dracut.conf.d"
    else
        confdir="$dracutsysrootdir/etc/dracut.conf.d"
    fi
fi

# source our config file
if [[ -f $conffile ]]; then
    check_conf_file "$conffile"
    # shellcheck disable=SC1090
    . "$conffile"
fi

# source our config dir
for f in $(dropindirs_sort ".conf" "$confdir" "$dracutbasedir/dracut.conf.d"); do
    check_conf_file "$f"
    # shellcheck disable=SC1090
    [[ -e $f ]] && . "$f"
done

DRACUT_PATH=${DRACUT_PATH:-/sbin /bin /usr/sbin /usr/bin}

for i in $DRACUT_PATH; do
    rl=$i
    if [ -L "$dracutsysrootdir$i" ]; then
        rl=$(readlink -f "$dracutsysrootdir$i")
    fi
    rl="${rl#$dracutsysrootdir}"
    if [[ $NPATH != *:$rl* ]]; then
        NPATH+=":$rl"
    fi
done
[[ -z $dracutsysrootdir ]] && export PATH="${NPATH#:}"
unset NPATH

export SYSTEMCTL=${SYSTEMCTL:-systemctl}

# these options add to the stuff in the config file
((${#add_dracutmodules_l[@]})) && add_dracutmodules+=" ${add_dracutmodules_l[*]} "
((${#omit_dracutmodules_l[@]})) && omit_dracutmodules+=" ${omit_dracutmodules_l[*]} "
((${#force_add_dracutmodules_l[@]})) && force_add_dracutmodules+=" ${force_add_dracutmodules_l[*]} "
((${#fscks_l[@]})) && fscks+=" ${fscks_l[*]} "
((${#add_fstab_l[@]})) && add_fstab+=" ${add_fstab_l[*]} "
((${#install_items_l[@]})) && install_items+=" ${install_items_l[*]} "
((${#install_optional_items_l[@]})) && install_optional_items+=" ${install_optional_items_l[*]} "
((${#hostonly_nics_l[@]})) && hostonly_nics+=" ${hostonly_nics_l[*]} "

# these options override the stuff in the config file
((${#dracutmodules_l[@]})) && dracutmodules="${dracutmodules_l[*]}"

((${#filesystems_l[@]})) && filesystems="${filesystems_l[*]}"
((${#fw_dir_l[@]})) && fw_dir="${fw_dir_l[*]}"
((${#libdirs_l[@]})) && libdirs="${libdirs_l[*]}"

[[ $stdloglvl_l ]] && stdloglvl=$stdloglvl_l
[[ ! $stdloglvl ]] && stdloglvl=4
stdloglvl=$((stdloglvl + verbosity_mod_l))
((stdloglvl > 6)) && stdloglvl=6
((stdloglvl < 0)) && stdloglvl=0

[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
[[ $do_strip_l ]] && do_strip=$do_strip_l
[[ $do_strip ]] || do_strip=yes
[[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l
[[ $do_hardlink ]] || do_hardlink=yes
[[ $prefix_l ]] && prefix=$prefix_l
[[ $prefix == "/" ]] && unset prefix
[[ $hostonly_l ]] && hostonly=$hostonly_l
[[ $hostonly_cmdline_l ]] && hostonly_cmdline=$hostonly_cmdline_l
[[ $hostonly_mode_l ]] && hostonly_mode=$hostonly_mode_l
[[ $hostonly == "yes" ]] && ! [[ $hostonly_cmdline ]] && hostonly_cmdline="yes"
# shellcheck disable=SC2034
[[ $i18n_install_all_l ]] && i18n_install_all=$i18n_install_all_l
# shellcheck disable=SC2034
[[ $persistent_policy_l ]] && persistent_policy=$persistent_policy_l
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
[[ $dracutbasedir ]] || dracutbasedir="$dracutsysrootdir"/usr/lib/dracut
[[ $fw_dir ]] || fw_dir="$dracutsysrootdir/lib/firmware/updates:$dracutsysrootdir/lib/firmware:$dracutsysrootdir/lib/firmware/$kernel"
[[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
[[ $tmpdir ]] || tmpdir="$TMPDIR"
[[ $tmpdir ]] || tmpdir="$dracutsysrootdir"/var/tmp
[[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS
[[ $compress_l ]] && compress=$compress_l
[[ $enhanced_cpio_l ]] && enhanced_cpio=$enhanced_cpio_l
[[ $show_modules_l ]] && show_modules=$show_modules_l
[[ $nofscks_l ]] && nofscks="yes"
[[ $ro_mnt_l ]] && ro_mnt="yes"
[[ $early_microcode_l ]] && early_microcode=$early_microcode_l
[[ $early_microcode ]] || early_microcode=yes
[[ $early_microcode_image_dir ]] || early_microcode_image_dir=('/boot')
[[ $early_microcode_image_name ]] \
    || early_microcode_image_name=('intel-uc.img' 'intel-ucode.img' 'amd-uc.img' 'amd-ucode.img' 'early_ucode.cpio' 'microcode.cpio')
[[ $logfile_l ]] && logfile="$logfile_l"
[[ $reproducible_l ]] && reproducible="$reproducible_l"
[[ $loginstall_l ]] && loginstall="$loginstall_l"
[[ $uefi_l ]] && uefi=$uefi_l
[[ $uefi_stub_l ]] && uefi_stub="$uefi_stub_l"
[[ $uefi_splash_image_l ]] && uefi_splash_image="$uefi_splash_image_l"
[[ $kernel_image_l ]] && kernel_image="$kernel_image_l"
[[ $machine_id_l ]] && machine_id="$machine_id_l"

if ! [[ $outfile ]]; then
    if [[ $machine_id != "no" ]]; then
        [[ -f "$dracutsysrootdir"/etc/machine-id ]] && read -r MACHINE_ID < "$dracutsysrootdir"/etc/machine-id
    fi

    if [[ $uefi == "yes" ]]; then
        # shellcheck disable=SC2154
        if [[ -n $uefi_secureboot_key && -z $uefi_secureboot_cert ]] || [[ -z $uefi_secureboot_key && -n $uefi_secureboot_cert ]]; then
            dfatal "Need 'uefi_secureboot_key' and 'uefi_secureboot_cert' both to be set."
            exit 1
        fi

        if [[ -n $uefi_secureboot_key && -n $uefi_secureboot_cert ]] && ! command -v sbsign &> /dev/null; then
            dfatal "Need 'sbsign' to create a signed UEFI executable"
            exit 1
        fi

        BUILD_ID=$(cat "$dracutsysrootdir"/etc/os-release "$dracutsysrootdir"/usr/lib/os-release \
            | while read -r line || [[ $line ]]; do
                [[ $line =~ BUILD_ID\=* ]] && eval "$line" && echo "$BUILD_ID" && break
            done)
        if [[ -z $dracutsysrootdir ]]; then
            if [[ -d /efi ]] && mountpoint -q /efi; then
                efidir=/efi/EFI
            else
                efidir=/boot/EFI
                if [[ -d $dracutsysrootdir/boot/efi/EFI ]]; then
                    efidir=/boot/efi/EFI
                fi
            fi
        else
            efidir=/boot/EFI
            if [[ -d $dracutsysrootdir/boot/efi/EFI ]]; then
                efidir=/boot/efi/EFI
            fi
        fi
        mkdir -p "$dracutsysrootdir$efidir/Linux"
        outfile="$dracutsysrootdir$efidir/Linux/linux-$kernel${MACHINE_ID:+-${MACHINE_ID}}${BUILD_ID:+-${BUILD_ID}}.efi"
    else
        if [[ -e "$dracutsysrootdir/boot/initrd-$kernel" ]]; then
            outfile="/boot/initrd-$kernel"
        elif [[ $MACHINE_ID ]] && { [[ -d $dracutsysrootdir/boot/${MACHINE_ID} ]] || [[ -L $dracutsysrootdir/boot/${MACHINE_ID} ]]; }; then
            outfile="$dracutsysrootdir/boot/${MACHINE_ID}/$kernel/initrd"
        else
            outfile="$dracutsysrootdir/boot/initrd-$kernel"
        fi
    fi
fi

# eliminate IFS hackery when messing with fw_dir
export DRACUT_FIRMWARE_PATH=${fw_dir// /:}
fw_dir=${fw_dir//:/ }

# check for logfile and try to create one if it doesn't exist
if [[ -n $logfile ]]; then
    if [[ ! -f $logfile ]]; then
        if touch "$logfile"; then
            printf "%s\n" "dracut: touch $logfile failed." >&2
        fi
    fi
fi

# handle compression options.
DRACUT_COMPRESS_BZIP2=${DRACUT_COMPRESS_BZIP2:-bzip2}
DRACUT_COMPRESS_LBZIP2=${DRACUT_COMPRESS_LBZIP2:-lbzip2}
DRACUT_COMPRESS_LZMA=${DRACUT_COMPRESS_LZMA:-lzma}
DRACUT_COMPRESS_XZ=${DRACUT_COMPRESS_XZ:-xz}
DRACUT_COMPRESS_GZIP=${DRACUT_COMPRESS_GZIP:-gzip}
DRACUT_COMPRESS_PIGZ=${DRACUT_COMPRESS_PIGZ:-pigz}
DRACUT_COMPRESS_LZOP=${DRACUT_COMPRESS_LZOP:-lzop}
DRACUT_COMPRESS_ZSTD=${DRACUT_COMPRESS_ZSTD:-zstd}
DRACUT_COMPRESS_LZ4=${DRACUT_COMPRESS_LZ4:-lz4}
DRACUT_COMPRESS_CAT=${DRACUT_COMPRESS_CAT:-cat}

if [[ $_no_compress_l == "$DRACUT_COMPRESS_CAT" ]]; then
    compress="$DRACUT_COMPRESS_CAT"
fi

[[ $hostonly == yes ]] && hostonly="-h"

[[ $hostonly != "-h" ]] && unset hostonly

case $hostonly_mode in
    '')
        [[ $hostonly ]] && hostonly_mode="sloppy"
        ;;
    sloppy | strict)
        if [[ ! $hostonly ]]; then
            unset hostonly_mode
        fi
        ;;
    *)
        printf "%s\n" "dracut: Invalid hostonly mode '$hostonly_mode'." >&2
        exit 1
        ;;
esac

[[ $reproducible == yes ]] && DRACUT_REPRODUCIBLE=1

case "${drivers_dir}" in
    '' | *lib/modules/${kernel} | *lib/modules/${kernel}/) ;;
    *)
        [[ "$DRACUT_KMODDIR_OVERRIDE" ]] || {
            printf "%s\n" 'dracut: -k/--kmoddir path must contain "lib/modules" as a parent of your kernel module directory,'
            printf "%s\n" "dracut: or modules may not be placed in the correct location inside the initramfs."
            printf "%s\n" "dracut: was given: ${drivers_dir}"
            printf "%s\n" "dracut: expected: $(dirname "${drivers_dir}")/lib/modules/${kernel}"
            printf "%s\n" "dracut: Please move your modules into the correct directory structure and pass the new location,"
            printf "%s\n" "dracut: or set DRACUT_KMODDIR_OVERRIDE=1 to ignore this check."
            exit 1
        }
        ;;
esac

# shellcheck disable=SC2155
readonly TMPDIR="$(realpath -e "$tmpdir")"
[ -d "$TMPDIR" ] || {
    printf "%s\n" "dracut: Invalid tmpdir '$tmpdir'." >&2
    exit 1
}

if findmnt --raw -n --target "$tmpdir" --output=options | grep -q noexec; then
    [[ $debug == yes ]] && printf "%s\n" "dracut: Tmpdir '$tmpdir' is mounted with 'noexec'."
    noexec=1
fi

# shellcheck disable=SC2155
readonly DRACUT_TMPDIR="$(mktemp -p "$TMPDIR/" -d -t dracut.XXXXXX)"
[ -d "$DRACUT_TMPDIR" ] || {
    printf "%s\n" "dracut: mktemp -p '$TMPDIR/' -d -t dracut.XXXXXX failed." >&2
    exit 1
}

# Cache file used to optimize get_maj_min()
declare -x -r get_maj_min_cache_file="${DRACUT_TMPDIR}/majmin_cache"
: > "$get_maj_min_cache_file"

# clean up after ourselves no matter how we die.
trap '
    ret=$?;
    [[ $keep ]] && echo "Not removing $DRACUT_TMPDIR." >&2 || { [[ $DRACUT_TMPDIR ]] && rm -rf -- "$DRACUT_TMPDIR"; };
    if [[ ${FSFROZEN} ]]; then
      fsfreeze -u "${FSFROZEN}"
    fi
    exit $ret;
    ' EXIT

# clean up after ourselves no matter how we die.
trap 'exit 1;' SIGINT

readonly initdir="${DRACUT_TMPDIR}/initramfs"
mkdir -p "$initdir"

# shellcheck disable=SC2154
if [[ $early_microcode == yes ]] || { [[ $acpi_override == yes ]] && [[ -d $acpi_table_dir ]]; }; then
    readonly early_cpio_dir="${DRACUT_TMPDIR}/earlycpio"
    mkdir "$early_cpio_dir"
fi

[[ "$dracutsysrootdir" ]] || [[ "$noexec" ]] || export DRACUT_RESOLVE_LAZY="1"

if [[ $print_cmdline ]]; then
    stdloglvl=0
    sysloglvl=0
    fileloglvl=0
    kmsgloglvl=0
fi

if [[ -f $dracutbasedir/dracut-version.sh ]]; then
    # shellcheck source=./dracut-version.sh
    . "$dracutbasedir"/dracut-version.sh
fi

if systemd-detect-virt -c &> /dev/null; then
    export DRACUT_NO_MKNOD=1 DRACUT_NO_XATTR=1
    if [[ $hostonly ]]; then
        printf "%s\n" "dracut: WARNING: running in hostonly mode in a container!!"
    fi
fi

if [[ -f $dracutbasedir/dracut-init.sh ]]; then
    # shellcheck source=./dracut-init.sh
    . "$dracutbasedir"/dracut-init.sh
else
    printf "%s\n" "dracut: Cannot find $dracutbasedir/dracut-init.sh." >&2
    printf "%s\n" "dracut: Are you running from a git checkout?" >&2
    printf "%s\n" "dracut: Try passing -l as an argument to $dracut_cmd" >&2
    exit 1
fi

if [[ $enhanced_cpio == "yes" ]]; then
    enhanced_cpio="$dracutbasedir/dracut-cpio"
    if [[ -x $enhanced_cpio ]]; then
        # align based on statfs optimal transfer size
        cpio_align=$(stat --file-system -c "%s" -- "$initdir")
    else
        dinfo "--enhanced-cpio ignored due to lack of dracut-cpio"
        unset enhanced_cpio
    fi
else
    unset enhanced_cpio
fi

# shellcheck disable=SC2154
if [[ $no_kernel != yes ]] && ! [[ -d $srcmods ]]; then
    printf "%s\n" "dracut: Cannot find module directory $srcmods" >&2
    printf "%s\n" "dracut: and --no-kernel was not specified" >&2
    exit 1
fi

if ! [[ $print_cmdline ]]; then
    inst "$DRACUT_TESTBIN"
    if ! $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${dracutsysrootdir:+-r "$dracutsysrootdir"} -R "$DRACUT_TESTBIN" &> /dev/null; then
        unset DRACUT_RESOLVE_LAZY
        export DRACUT_RESOLVE_DEPS=1
    fi
    rm -fr -- "${initdir:?}"/*
fi

dracutfunctions=$dracutbasedir/dracut-functions.sh
export dracutfunctions

((${#drivers_l[@]})) && drivers="${drivers_l[*]}"
drivers=${drivers/-/_}

((${#add_drivers_l[@]})) && add_drivers+=" ${add_drivers_l[*]} "
add_drivers=${add_drivers/-/_}

((${#force_drivers_l[@]})) && force_drivers+=" ${force_drivers_l[*]} "
force_drivers=${force_drivers/-/_}

((${#omit_drivers_l[@]})) && omit_drivers+=" ${omit_drivers_l[*]} "
omit_drivers=${omit_drivers/-/_}

((${#kernel_cmdline_l[@]})) && kernel_cmdline+=" ${kernel_cmdline_l[*]} "

omit_drivers_corrected=""
for d in $omit_drivers; do
    [[ " $drivers $add_drivers " == *\ $d\ * ]] && continue
    [[ " $drivers $force_drivers " == *\ $d\ * ]] && continue
    omit_drivers_corrected+="$d|"
done
omit_drivers="${omit_drivers_corrected%|}"
unset omit_drivers_corrected

# prepare args for logging
for ((i = 0; i < ${#dracut_args[@]}; i++)); do
    [[ ${dracut_args[$i]} == *\ * ]] \
        && dracut_args[$i]="\"${dracut_args[$i]}\""
    #" keep vim happy
done

dinfo "Executing: $dracut_cmd ${dracut_args[*]}"

[[ $do_list == yes ]] && {
    for mod in "$dracutbasedir"/modules.d/*; do
        [[ -d $mod ]] || continue
        [[ -e $mod/install || -e $mod/installkernel || -e \
        $mod/module-setup.sh ]] || continue
        printf "%s\n" "${mod##*/??}"
    done
    exit 0
}

# This is kinda legacy -- eventually it should go away.
case $dracutmodules in
    "" | auto) dracutmodules="all" ;;
esac

abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"


[[ -d $dracutsysrootdir$systemdutildir ]] \
    || systemdutildir=$(pkg-config systemd --variable=systemdutildir 2> /dev/null)

if ! [[ -d $dracutsysrootdir$systemdutildir ]]; then
    [[ -e $dracutsysrootdir/lib/systemd/systemd-udevd ]] && systemdutildir=/lib/systemd
    [[ -e $dracutsysrootdir/usr/lib/systemd/systemd-udevd ]] && systemdutildir=/usr/lib/systemd
fi

[[ -d $dracutsysrootdir$systemdutilconfdir ]] \
    || systemdutilconfdir=$(pkg-config systemd --variable=systemdutilconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$systemdutilconfdir ]] || systemdutilconfdir=/etc/systemd

if [[ $no_kernel != yes ]] && [[ -d $srcmods ]]; then
    if ! [[ -f $srcmods/modules.dep ]]; then
        if [[ -n "$(find "$srcmods" -name '*.ko*')" ]]; then
            dfatal "$srcmods/modules.dep is missing. Did you run depmod?"
            exit 1
        else
            dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
        fi
    fi
fi

if [[ ! $print_cmdline ]]; then
    if [[ -f $outfile && ! $force ]]; then
        dfatal "Will not override existing initramfs ($outfile) without --force"
        exit 1
    fi

    outdir=${outfile%/*}
    [[ $outdir ]] || outdir="/"

    if [[ ! -d $outdir ]]; then
        dfatal "Can't write to $outdir: Directory $outdir does not exist or is not accessible."
        exit 1
    elif [[ ! -w $outdir ]]; then
        dfatal "No permission to write to $outdir."
        exit 1
    elif [[ -f $outfile && ! -w $outfile ]]; then
        dfatal "No permission to write $outfile."
        exit 1
    fi

    if [[ $loginstall ]]; then
        if ! mkdir -p "$loginstall"; then
            dfatal "Could not create directory to log installed files to '$loginstall'."
            exit 1
        fi
        loginstall=$(readlink -f "$loginstall")
    fi

    if [[ $uefi == yes ]]; then
        if ! command -v objcopy &> /dev/null; then
            dfatal "Need 'objcopy' to create a UEFI executable"
            exit 1
        fi
        unset EFI_MACHINE_TYPE_NAME
        case $(uname -m) in
            x86_64)
                EFI_MACHINE_TYPE_NAME=x64
                ;;
            i?86)
                EFI_MACHINE_TYPE_NAME=ia32
                ;;
            *)
                dfatal "Architecture '$(uname -m)' not supported to create a UEFI executable"
                exit 1
                ;;
        esac

        if ! [[ -s $uefi_stub ]]; then
            uefi_stub="$dracutsysrootdir${systemdutildir}/boot/efi/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"

        fi

        if ! [[ -s $uefi_stub ]]; then
            dfatal "Can't find a uefi stub '$uefi_stub' to create a UEFI executable"
            exit 1
        fi

        if ! [[ $kernel_image ]]; then
            for kernel_image in "$dracutsysrootdir/lib/modules/$kernel/vmlinuz" "$dracutsysrootdir/boot/vmlinuz-$kernel"; do
                [[ -s $kernel_image ]] || continue
                break
            done
        fi
        if ! [[ -s $kernel_image ]]; then
            dfatal "Can't find a kernel image '$kernel_image' to create a UEFI executable"
            exit 1
        fi
    fi
fi

if [[ $acpi_override == yes ]] && ! (check_kernel_config CONFIG_ACPI_TABLE_UPGRADE || check_kernel_config CONFIG_ACPI_INITRD_TABLE_OVERRIDE); then
    dwarn "Disabling ACPI override, because kernel does not support it. CONFIG_ACPI_INITRD_TABLE_OVERRIDE!=y or CONFIG_ACPI_TABLE_UPGRADE!=y"
    unset acpi_override
fi

if [[ $early_microcode == yes ]]; then
    if [[ $hostonly ]]; then
        if [[ $(get_cpu_vendor) == "AMD" ]]; then
            check_kernel_config CONFIG_MICROCODE_AMD || unset early_microcode
        elif [[ $(get_cpu_vendor) == "Intel" ]]; then
            check_kernel_config CONFIG_MICROCODE_INTEL || unset early_microcode
        else
            unset early_microcode
        fi
    else
        ! check_kernel_config CONFIG_MICROCODE_AMD \
            && ! check_kernel_config CONFIG_MICROCODE_INTEL \
            && unset early_microcode
    fi
    # Do not complain on non-x86 architectures as it makes no sense
    case $(uname -m) in
        x86_64 | i?86)
            [[ $early_microcode != yes ]] \
                && dwarn "Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]!=y"
            ;;
        *) ;;
    esac
fi

# Need to be able to have non-root users read stuff (rpcbind etc)
chmod 755 "$initdir"

if [[ $hostonly ]]; then
    for i in /sys /proc /run /dev; do
        if ! findmnt --target "$i" &> /dev/null; then
            dwarning "Turning off host-only mode: '$i' is not mounted!"
            unset hostonly
        fi
    done
fi

declare -A host_fs_types

for line in "${fstab_lines[@]}"; do
    # shellcheck disable=SC2086
    set -- $line
    dev="$1"
    #dev mp fs fsopts
    case "$dev" in
        UUID=*)
            dev=$(blkid -l -t "UUID=${dev#UUID=}" -o device)
            ;;
        LABEL=*)
            dev=$(blkid -l -t "LABEL=${dev#LABEL=}" -o device)
            ;;
        PARTUUID=*)
            dev=$(blkid -l -t "PARTUUID=${dev#PARTUUID=}" -o device)
            ;;
        PARTLABEL=*)
            dev=$(blkid -l -t "PARTLABEL=${dev#PARTLABEL=}" -o device)
            ;;
    esac
    [ -z "$dev" ] && dwarn "Bad fstab entry $*" && continue
    if [[ $3 == btrfs ]]; then
        for mp in $(findmnt --source "$1" -o TARGET -n); do
            for i in $(btrfs_devs "$mp"); do
                push_host_devs "$i"
            done
        done
    fi
    push_host_devs "$dev"
    host_fs_types["$dev"]="$3"
done

for f in $add_fstab; do
    [[ -e $f ]] || continue
    while read -r dev rest || [ -n "$dev" ]; do
        push_host_devs "$dev"
    done < "$f"
done

for dev in $add_device; do
    push_host_devs "$dev"
done

if ((${#add_device_l[@]})); then
    add_device+=" ${add_device_l[*]} "
    push_host_devs "${add_device_l[@]}"
fi

if [[ $hostonly ]] && [[ $hostonly_default_device != "no" ]]; then
    # in hostonly mode, determine all devices, which have to be accessed
    # and examine them for filesystem types

    for mp in \
        "/" \
        "/etc" \
        "/bin" \
        "/sbin" \
        "/lib" \
        "/lib64" \
        "/usr" \
        "/usr/bin" \
        "/usr/sbin" \
        "/usr/lib" \
        "/usr/lib64" \
        "/boot" \
        "/boot/efi" \
        "/boot/zipl"; do

        mp=$(readlink -f "$dracutsysrootdir$mp")
        mountpoint "$mp" > /dev/null 2>&1 || continue
        _dev=$(find_block_device "$mp")
        _bdev=$(readlink -f "/dev/block/$_dev")
        [[ -b $_bdev ]] && _dev=$_bdev
        [[ $mp == "/" ]] && root_devs+=("$_dev")
        push_host_devs "$_dev"
        if [[ $(find_mp_fstype "$mp") == btrfs ]]; then
            for i in $(btrfs_devs "$mp"); do
                [[ $mp == "/" ]] && root_devs+=("$i")
                push_host_devs "$i"
            done
        fi
    done

    # TODO - with sysroot, /proc/swaps is not relevant
    if [[ -f /proc/swaps ]] && [[ -f $dracutsysrootdir/etc/fstab ]]; then
        while read -r dev type rest || [ -n "$dev" ]; do
            [[ -b $dev ]] || continue
            [[ $type == "partition" ]] || continue

            while read -r _d _m _t _o _ || [ -n "$_d" ]; do
                [[ $_d == \#* ]] && continue
                [[ $_d ]] || continue
                [[ $_t != "swap" ]] && continue
                [[ $_m != "swap" ]] && [[ $_m != "none" ]] && continue
                [[ $_o == *noauto* ]] && continue
                _d=$(expand_persistent_dev "$_d")
                [[ $_d -ef $dev ]] || continue

                if [[ -f $dracutsysrootdir/etc/crypttab ]]; then
                    while read -r _mapper _ _p _o || [ -n "$_mapper" ]; do
                        [[ $_mapper == \#* ]] && continue
                        [[ $_d -ef /dev/mapper/"$_mapper" ]] || continue
                        [[ "$_o" ]] || _o="$_p"
                        # skip entries with password files
                        [[ $_p == /* ]] && [[ -f $_p ]] && continue 2
                        # skip mkswap swap
                        [[ $_o == *swap* ]] && continue 2
                    done < "$dracutsysrootdir"/etc/crypttab
                fi

                _dev="$(readlink -f "$dev")"
                push_host_devs "$_dev"
                swap_devs+=("$_dev")
                break
            done < "$dracutsysrootdir"/etc/fstab
        done < /proc/swaps
    fi

    # collect all "x-initrd.mount" entries from /etc/fstab
    if [[ -f $dracutsysrootdir/etc/fstab ]]; then
        while read -r _d _m _t _o _ || [ -n "$_d" ]; do
            [[ $_d == \#* ]] && continue
            [[ $_d ]] || continue
            [[ $_o != *x-initrd.mount* ]] && continue
            _dev=$(expand_persistent_dev "$_d")
            _dev="$(readlink -f "$_dev")"
            [[ -b $_dev ]] || continue

            push_host_devs "$_dev"
            if [[ $_t == btrfs ]]; then
                for i in $(btrfs_devs "$_m"); do
                    push_host_devs "$i"
                done
            fi
        done < "$dracutsysrootdir"/etc/fstab
    fi
fi

unset m
unset rest

_get_fs_type() {
    [[ $1 ]] || return
    if [[ -b /dev/block/$1 ]]; then
        ID_FS_TYPE=$(get_fs_env "/dev/block/$1") && host_fs_types["$(readlink -f "/dev/block/$1")"]="$ID_FS_TYPE"
        return 1
    fi
    if [[ -b $1 ]]; then
        ID_FS_TYPE=$(get_fs_env "$1") && host_fs_types["$(readlink -f "$1")"]="$ID_FS_TYPE"
        return 1
    fi
    if fstype=$(find_dev_fstype "$1"); then
        host_fs_types["$1"]="$fstype"
        return 1
    fi
    return 1
}

for dev in "${host_devs[@]}"; do
    _get_fs_type "$dev"
    check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
done

for dev in "${!host_fs_types[@]}"; do
    [[ ${host_fs_types[$dev]} == "reiserfs" ]] || [[ ${host_fs_types[$dev]} == "xfs" ]] || continue
    rootopts=$(find_dev_fsopts "$dev")
    if [[ ${host_fs_types[$dev]} == "reiserfs" ]]; then
        journaldev=$(fs_get_option "$rootopts" "jdev")
    elif [[ ${host_fs_types[$dev]} == "xfs" ]]; then
        journaldev=$(fs_get_option "$rootopts" "logdev")
    fi
    if [[ $journaldev ]]; then
        dev="$(readlink -f "$dev")"
        push_host_devs "$dev"
        _get_fs_type "$dev"
        check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
    fi
done

[[ -d $dracutsysrootdir$dbus ]] \
    || dbus=$(pkg-config dbus --variable=dbus 2> /dev/null)

[[ -d $dracutsysrootdir$dbus ]] || dbus=/usr/share/dbus-1

[[ -d $dracutsysrootdir$dbusconfdir ]] \
    || dbusconfdir=$(pkg-config dbus --variable=dbusconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$dbusconfdir ]] || dbusconfdir=/etc/dbus-1

[[ -d $dracutsysrootdir$dbusinterfaces ]] \
    || dbusinterfaces=$(pkg-config dbus --variable=dbusinterfaces 2> /dev/null)

[[ -d $dracutsysrootdir$dbusinterfaces ]] || dbusinterfaces=${dbus}/interfaces

[[ -d $dracutsysrootdir$dbusinterfacesconfdir ]] \
    || dbusinterfacesconfdir=$(pkg-config dbus --variable=dbusinterfacesconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$dbusinterfacesconfdir ]] || dbusinterfacesconfdir=${dbusconfdir}/interfaces

[[ -d $dracutsysrootdir$dbusservices ]] \
    || dbusservices=$(pkg-config dbus --variable=dbusservices 2> /dev/null)

[[ -d $dracutsysrootdir$dbusservices ]] || dbusservices=${dbus}/services

[[ -d $dracutsysrootdir$dbusservicesconfdir ]] \
    || dbusservicesconfdir=$(pkg-config dbus --variable=dbusservicesconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$dbusservicesconfdir ]] || dbusservicesconfdir=${dbusconfdir}/services

[[ -d $dracutsysrootdir$dbussession ]] \
    || dbussession=$(pkg-config dbus --variable=dbussession 2> /dev/null)

[[ -d $dracutsysrootdir$dbussession ]] || dbussession=${dbus}/session.d

[[ -d $dracutsysrootdir$dbussessionconfdir ]] \
    || dbussessionconfdir=$(pkg-config dbus --variable=dbussessionconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$dbussessionconfdir ]] || dbussessionconfdir=${dbusconfdir}/session.d

[[ -d $dracutsysrootdir$dbussystem ]] \
    || dbussystem=$(pkg-config dbus --variable=dbussystem 2> /dev/null)

[[ -d $dracutsysrootdir$dbussystem ]] || dbussystem=${dbus}/system.d

[[ -d $dracutsysrootdir$dbussystemconfdir ]] \
    || dbussystemconfdir=$(pkg-config dbus --variable=dbussystemconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$dbussystemconfdir ]] || dbussystemconfdir=${dbusconfdir}/system.d

[[ -d $dracutsysrootdir$dbussystemservices ]] \
    || dbussystemservices=$(pkg-config dbus --variable=dbussystemservices 2> /dev/null)

[[ -d $dracutsysrootdir$dbussystemservices ]] || dbussystemservices=${dbus}/system-services

[[ -d $dracutsysrootdir$dbussystemservicesconfdir ]] \
    || dbussystemservicesconfdir=$(pkg-config dbus --variable=dbussystemservicesconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$dbussystemservicesconfdir ]] || dbussystemservicesconfdir=${dbusconfdir}/system-services

[[ -d $dracutsysrootdir$udevdir ]] \
    || udevdir="$(pkg-config udev --variable=udevdir 2> /dev/null)"
if ! [[ -d $dracutsysrootdir$udevdir ]]; then
    [[ -e $dracutsysrootdir/lib/udev/ata_id ]] && udevdir=/lib/udev
    [[ -e $dracutsysrootdir/usr/lib/udev/ata_id ]] && udevdir=/usr/lib/udev
fi

[[ -d $dracutsysrootdir$udevconfdir ]] \
    || udevconfdir=$(pkg-config udev --variable=udevconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$udevconfdir ]] || udevconfdir=/etc/udev

[[ -d $dracutsysrootdir$udevrulesdir ]] \
    || udevrulesdir=$(pkg-config udev --variable=udevrulesdir 2> /dev/null)

[[ -d $dracutsysrootdir$udevrulesdir ]] || udevrulesdir=${udevdir}/rules.d

[[ -d $dracutsysrootdir$udevrulesconfdir ]] \
    || udevrulesconfdir=$(pkg-config udev --variable=udevrulesconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$udevrulesconfdir ]] || udevrulesconfdir=${udevconfdir}/rules.d

[[ -d $dracutsysrootdir$sysctld ]] \
    || sysctld=$(pkg-config systemd --variable=sysctld 2> /dev/null)

[[ -d $dracutsysrootdir$sysctld ]] || sysctld=/usr/lib/sysctl.d

[[ -d $dracutsysrootdir$sysctlconfdir ]] \
    || sysctlconfdir=$(pkg-config systemd --variable=sysctlconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$sysctlconfdir ]] || sysctlconfdir=/etc/sysctl.d

[[ -d $dracutsysrootdir$environment ]] \
    || environment=$(pkg-config systemd --variable=environment 2> /dev/null)

[[ -d $dracutsysrootdir$environment ]] || environment=/usr/lib/environment.d

[[ -d $dracutsysrootdir$environmentconfdir ]] \
    || environmentconfdir=$(pkg-config systemd --variable=environmentconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$environmentconfdir ]] || environmentconfdir=/etc/environment.d

[[ -d $dracutsysrootdir$systemdcatalog ]] \
    || systemdcatalog=$(pkg-config systemd --variable=systemdcatalog 2> /dev/null)

[[ -d $dracutsysrootdir$systemdcatalog ]] || systemdcatalog=${systemdutildir}/catalog

[[ -d $dracutsysrootdir$modulesload ]] \
    || modulesload=$(pkg-config systemd --variable=modulesload 2> /dev/null)

[[ -d $dracutsysrootdir$modulesload ]] || modulesload=/usr/lib/modules-load.d

[[ -d $dracutsysrootdir$modulesloadconfdir ]] \
    || modulesloadconfdir=$(pkg-config systemd --variable=modulesloadconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$modulesloadconfdir ]] || modulesloadconfdir=/etc/modules-load.d

[[ -d $dracutsysrootdir$systemdnetwork ]] \
    || systemdnetwork=$(pkg-config systemd --variable=systemdnetwork 2> /dev/null)

[[ -d $dracutsysrootdir$systemdnetwork ]] || systemdnetwork=${systemdutildir}/network

[[ -d $dracutsysrootdir$systemdnetworkconfdir ]] \
    || systemdnetworkconfdir=$(pkg-config systemd --variable=systemdnetworkconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$systemdnetworkconfdir ]] || systemdnetworkconfdir=${systemdsystemconfdir}/network

[[ -d $dracutsysrootdir$systemdntpunits ]] \
    || systemdntpunits=$(pkg-config systemd --variable=systemdntpunits 2> /dev/null)

[[ -d $dracutsysrootdir$systemdntpunits ]] || systemdntpunits=${systemdutildir}/ntp-units.d

[[ -d $dracutsysrootdir$systemdntpunitsconfdir ]] \
    || systemdntpunitsconfdir=$(pkg-config systemd --variable=systemdntpunitsconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$systemdntpunitsconfdir ]] || systemdntpunitsconfdir=${systemdsystemconfdir}/ntp-units.d

[[ -d $dracutsysrootdir$systemdportable ]] \
    || systemdportable=$(pkg-config systemd --variable=systemdportable 2> /dev/null)

[[ -d $dracutsysrootdir$systemdportable ]] || systemdportable=${systemdutildir}/portable

[[ -d $dracutsysrootdir$systemdportableconfdir ]] \
    || systemdportableconfdir=$(pkg-config systemd --variable=systemdportableconfdir 2> /dev/null)

[[ -d "$dracutsysrootdir$systemdportableconfdir" ]] || systemdportableconfdir=${systemdsystemconfdir}/portable

[[ -d $dracutsysrootdir$systemdsystemunitdir ]] \
    || systemdsystemunitdir=$(pkg-config systemd --variable=systemdsystemunitdir 2> /dev/null)

[[ -d "$dracutsysrootdir$systemdsystemunitdir" ]] || systemdsystemunitdir=${systemdutildir}/system

[[ -d $dracutsysrootdir$systemduser ]] \
    || systemduser=$(pkg-config systemd --variable=systemduser 2> /dev/null)

[[ -d $dracutsysrootdir$systemduser ]] || systemduser=${systemdutildir}/user

[[ -d $dracutsysrootdir$systemduserconfdir ]] \
    || systemduserconfdir=$(pkg-config systemd --variable=systemduserconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$systemduserconfdir ]] || systemduserconfdir=${systemdsystemconfdir}/user

[[ -d $dracutsysrootdir$systemdsystemconfdir ]] \
    || systemdsystemconfdir=$(pkg-config systemd --variable=systemdsystemconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$systemdsystemconfdir ]] || systemdsystemconfdir=/etc/systemd/system

[[ -d $dracutsysrootdir$sysusers ]] \
    || sysusers=$(pkg-config systemd --variable=sysusers 2> /dev/null)

[[ -d $dracutsysrootdir$sysusers ]] || sysusers=/usr/lib/sysusers.d

[[ -d $dracutsysrootdir$sysusersconfdir ]] \
    || sysusersconfdir=$(pkg-config systemd --variable=sysusersconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$sysusersconfdir ]] || sysusersconfdir=/etc/sysusers.d

[[ -d $dracutsysrootdir$tmpfilesdir ]] \
    || tmpfilesdir=$(pkg-config systemd --variable=tmpfilesdir 2> /dev/null)

if ! [[ -d $dracutsysrootdir$tmpfilesdir ]]; then
    [[ -d $dracutsysrootdir/lib/tmpfiles.d ]] && tmpfilesdir=/lib/tmpfiles.d
    [[ -d $dracutsysrootdir/usr/lib/tmpfiles.d ]] && tmpfilesdir=/usr/lib/tmpfiles.d
fi

[[ -d $dracutsysrootdir$tmpfilesconfdir ]] \
    || tmpfilesconfdir=$(pkg-config systemd --variable=tmpfilesconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$tmpfilesconfdir ]] || tmpfilesconfdir=/etc/tmpfiles.d

[[ -d $dracutsysrootdir$depmodd ]] \
    || sysctld=$(pkg-config libkmod --variable=depmodd 2> /dev/null)

[[ -d $dracutsysrootdir$depmodd ]] || depmodd=/usr/lib/depmod.d

[[ -d $dracutsysrootdir$depmodconfdir ]] \
    || sysctlconfdir=$(pkg-config libkmod --variable=depmodconfdir 2> /dev/null)

[[ -d $dracutsysrootdir$depmodconfdir ]] || depmodconfdir=/etc/depmod.d

export initdir dracutbasedir \
    dracutmodules force_add_dracutmodules add_dracutmodules omit_dracutmodules \
    mods_to_load \
    fw_dir drivers_dir debug no_kernel kernel_only \
    omit_drivers mdadmconf lvmconf root_devs \
    use_fstab fstab_lines libdirs fscks nofscks ro_mnt \
    stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
    debug host_fs_types host_devs swap_devs sshkey add_fstab \
    DRACUT_VERSION udevdir udevconfdir udevrulesdir udevrulesconfdir \
    prefix filesystems drivers dbus dbusconfdir dbusinterfaces \
    dbusinterfacesconfdir dbusservices dbusservicesconfdir dbussession \
    dbussessionconfdir dbussystem dbussystemconfdir dbussystemservices \
    dbussystemservicesconfdir environment environmentconfdir modulesload \
    modulesloadconfdir sysctl sysctlconfdir sysusers sysusersconfdir \
    systemdutildir systemdutilconfdir systemdcatalog systemdntpunits \
    systemdntpunitsconfdir systemdsystemunitdir systemdsystemconfdir \
    hostonly_cmdline loginstall tmpfilesdir tmpfilesconfdir depmodd \
    depmodconfdir check_supported

mods_to_load=""
# check all our modules to see if they should be sourced.
# This builds a list of modules that we will install next.
for_each_module_dir check_module
for_each_module_dir check_mount

dracut_module_included "fips" && export DRACUT_FIPS_MODE=1

do_print_cmdline() {

    local -A _mods_to_print
    for i in $modules_loaded $mods_to_load; do
        _mods_to_print[$i]=1
    done

    # source our modules.
    for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
        _d_mod=${moddir##*/}
        _d_mod=${_d_mod#[0-9][0-9]}
        [[ ${_mods_to_print[$_d_mod]} ]] || continue
        module_cmdline "$_d_mod" "$moddir"
    done
    unset moddir
}

if [[ $print_cmdline ]]; then
    do_print_cmdline
    printf "\n"
    exit 0
fi

# Create some directory structure first
# shellcheck disable=SC2174
[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"

# shellcheck disable=SC2174
[[ -L $dracutsysrootdir/lib ]] || mkdir -m 0755 -p "${initdir}${prefix}/lib"
[[ $prefix ]] && ln -sfn "${prefix#/}/lib" "$initdir/lib"

if [[ $prefix ]]; then
    for d in bin etc lib sbin tmp usr var $libdirs; do
        d=${d#/}
        [[ $d == */* ]] && continue
        ln -sfn "${prefix#/}/${d#/}" "$initdir/$d"
    done
fi

if [[ $kernel_only != yes ]]; then
    for d in usr usr/bin usr/sbin bin etc lib sbin tmp var var/tmp $libdirs; do
        d=${d#/}
        [[ -e "${initdir}${prefix}/$d" ]] && continue
        if [ -L "/$d" ]; then
            inst_symlink "/$d" "${prefix}/$d"
        else
            # shellcheck disable=SC2174
            mkdir -m 0755 -p "${initdir}${prefix}/$d"
        fi
    done

    for d in dev proc sys sysroot root run; do
        if [ -L "/$d" ]; then
            inst_symlink "/$d"
        else
            # shellcheck disable=SC2174
            mkdir -m 0755 -p "$initdir/$d"
        fi
    done

    ln -sfn ../run "$initdir/var/run"
    ln -sfn ../run/lock "$initdir/var/lock"
else
    for d in lib "$libdirs"; do
        [[ -e "${initdir}${prefix}/$d" ]] && continue
        if [ -h "/$d" ]; then
            inst "/$d" "${prefix}/$d"
        else
            # shellcheck disable=SC2174
            mkdir -m 0755 -p "${initdir}${prefix}/$d"
        fi
    done
fi

if [[ $kernel_only != yes ]]; then
    mkdir -p "${initdir}/etc/cmdline.d"
    # shellcheck disable=SC2174
    mkdir -m 0755 -p "${initdir}"/lib "${initdir}"/lib/dracut "${initdir}"/lib/dracut/hooks
    # shellcheck disable=SC2154
    for _d in $hookdirs; do
        # shellcheck disable=SC2174
        mkdir -m 0755 -p "${initdir}/lib/dracut/hooks/$_d"
    done
    if [[ $EUID == "0" ]] && ! [[ $DRACUT_NO_MKNOD ]]; then
        [[ -c ${initdir}/dev/null ]] || mknod "${initdir}"/dev/null c 1 3
        [[ -c ${initdir}/dev/kmsg ]] || mknod "${initdir}"/dev/kmsg c 1 11
        [[ -c ${initdir}/dev/console ]] || mknod "${initdir}"/dev/console c 5 1
        [[ -c ${initdir}/dev/random ]] || mknod "${initdir}"/dev/random c 1 8
        [[ -c ${initdir}/dev/urandom ]] || mknod "${initdir}"/dev/urandom c 1 9
    fi
fi

_isize=0 #initramfs size
modules_loaded=" "
# source our modules.
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
    _d_mod=${moddir##*/}
    _d_mod=${_d_mod#[0-9][0-9]}
    [[ $mods_to_load == *\ $_d_mod\ * ]] || continue
    if [[ $show_modules == yes ]]; then
        printf "%s\n" "$_d_mod"
    else
        dinfo "*** Including module: $_d_mod ***"
    fi
    if [[ $kernel_only == yes ]]; then
        module_installkernel "$_d_mod" "$moddir" || {
            dfatal "installkernel failed in module $_d_mod"
            exit 1
        }
    else
        module_install "$_d_mod" "$moddir"
        if [[ $no_kernel != yes ]]; then
            module_installkernel "$_d_mod" "$moddir" || {
                dfatal "installkernel failed in module $_d_mod"
                exit 1
            }
        fi
    fi
    mods_to_load=${mods_to_load// $_d_mod /}
    modules_loaded+="$_d_mod "

    #print the module install size
    if [ -n "$printsize" ]; then
        _isize_new=$(du -sk "${initdir}" | {
            read -r a _
            echo -n "$a"
        })
        _isize_delta=$((_isize_new - _isize))
        printf "%s\n" "$_d_mod install size: ${_isize_delta}k"
        _isize=$_isize_new
    fi
done
unset moddir

for i in $modules_loaded; do
    mkdir -p "$initdir"/lib/dracut
    printf "%s\n" "$i" >> "$initdir"/lib/dracut/modules.txt
done

dinfo "*** Including modules done ***"

## final stuff that has to happen
if [[ $no_kernel != yes ]]; then
    if [[ $hostonly_mode == "strict" ]]; then
        cp "$DRACUT_KERNEL_MODALIASES" "$initdir"/lib/dracut/hostonly-kernel-modules.txt
    fi

    if [[ $drivers ]]; then
        # shellcheck disable=SC2086
        hostonly='' instmods $drivers
    fi

    if [[ -n ${add_drivers// /} ]]; then
        # shellcheck disable=SC2086
        hostonly='' instmods -c $add_drivers
    fi
    if [[ $force_drivers ]]; then
        # shellcheck disable=SC2086
        hostonly='' instmods -c $force_drivers
        rm -f "$initdir"/etc/cmdline.d/20-force_driver.conf
        for mod in $force_drivers; do
            echo "rd.driver.pre=$mod" >> "$initdir"/etc/cmdline.d/20-force_drivers.conf
        done
    fi
    if [[ $filesystems ]]; then
        # shellcheck disable=SC2086
        hostonly='' instmods -c $filesystems
    fi

    dinfo "*** Installing kernel module dependencies ***"
    dracut_kernel_post
    dinfo "*** Installing kernel module dependencies done ***"

    if [[ $noimageifnotneeded == yes ]] && [[ $hostonly ]]; then
        if [[ ! -f "$initdir/lib/dracut/need-initqueue" ]] \
            && [[ -f ${initdir}/lib/modules/$kernel/modules.dep && ! -s ${initdir}/lib/modules/$kernel/modules.dep ]]; then
            for i in "${initdir}"/etc/cmdline.d/*.conf; do
                # We need no initramfs image and do not generate one.
                [[ $i == "${initdir}/etc/cmdline.d/*.conf" ]] && exit 0
            done
        fi
    fi
fi

if [[ $kernel_only != yes ]]; then
    # FIXME: handle legacy item split
    # shellcheck disable=SC2068
    ((${#install_items[@]} > 0)) && inst_multiple ${install_items[@]}
    # shellcheck disable=SC2068
    ((${#install_optional_items[@]} > 0)) && inst_multiple -o ${install_optional_items[@]}

    if [[ $kernel_cmdline ]] && [[ $uefi != yes ]]; then
        printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
    fi

    for line in "${fstab_lines[@]}"; do
        read -r -a fstab_field <<< "$line"
        if [ -z "${fstab_field[1]}" ]; then
            # Determine device and mount options from current system
            mountpoint -q "${fstab_field[0]}" || derror "${fstab_field[0]} is not a mount point!"
            read -r -a fstab_field < <(findmnt --raw -n --target "${fstab_field[0]}" --output=source,target,fstype,options)
            dinfo "Line for ${fstab_field[1]}: ${fstab_field[*]}"
        else
            # Use default options
            [ -z "${fstab_field[3]}" ] && fstab_field[3]="defaults"
        fi

        # Default options for freq and passno
        [ -z "${fstab_field[4]}" ] && fstab_field[4]="0"
        [ -z "${fstab_field[5]}" ] && fstab_field[5]="2"

        strstr "${fstab_field[2]}" "nfs" && fstab_field[5]="0"
        echo "${fstab_field[@]}" >> "${initdir}/etc/fstab"
    done

    for f in $add_fstab; do
        cat "$f" >> "${initdir}/etc/fstab"
    done

    if [[ $dracutsysrootdir$systemdutildir ]]; then
        if [[ -d ${initdir}/$systemdutildir ]]; then
            mkdir -p "${initdir}"/etc/conf.d
            {
                printf "%s\n" "systemdutildir=\"$systemdutildir\""
                printf "%s\n" "systemdsystemunitdir=\"$systemdsystemunitdir\""
                printf "%s\n" "systemdsystemconfdir=\"$systemdsystemconfdir\""
            } > "${initdir}"/etc/conf.d/systemd.conf
        fi
    fi

    if [[ $DRACUT_RESOLVE_LAZY ]] && [[ $DRACUT_INSTALL ]]; then
        dinfo "*** Resolving executable dependencies ***"
        find "$initdir" -type f -perm /0111 -not -path '*.ko' -print0 \
            | xargs -r -0 "$DRACUT_INSTALL" ${initdir:+-D "$initdir"} ${dracutsysrootdir:+-r "$dracutsysrootdir"} -R ${DRACUT_FIPS_MODE:+-f} --
        # shellcheck disable=SC2181
        if (($? == 0)); then
            dinfo "*** Resolving executable dependencies done ***"
        else
            dfatal "Resolving executable dependencies failed"
            exit 1
        fi
    fi

    # Now we are done with lazy resolving, always install dependencies
    unset DRACUT_RESOLVE_LAZY
    export DRACUT_RESOLVE_DEPS=1
fi

for ((i = 0; i < ${#include_src[@]}; i++)); do
    src="${include_src[$i]}"
    target="${include_target[$i]}"
    if [[ $src && $target ]]; then
        if [[ -f $src ]]; then
            inst "$src" "$target"
        elif [[ -d $src ]]; then
            ddebug "Including directory: $src"
            destdir="${initdir}/${target}"
            mkdir -p "$destdir"
            # check for preexisting symlinks, so we can cope with the
            # symlinks to $prefix
            # Objectname is a file or a directory
            for objectname in "$src"/*; do
                [[ -e $objectname || -L $objectname ]] || continue
                if [[ -d $objectname ]]; then
                    # objectname is a directory, let's compute the final directory name
                    object_destdir=${destdir}/${objectname#$src/}
                    if ! [[ -e $object_destdir ]]; then
                        # shellcheck disable=SC2174
                        mkdir -m 0755 -p "$object_destdir"
                        chmod --reference="$objectname" "$object_destdir"
                    fi
                    $DRACUT_CP -t "$object_destdir" "$dracutsysrootdir$objectname"/*
                else
                    $DRACUT_CP -t "$destdir" "$dracutsysrootdir$objectname"
                fi
            done
        elif [[ -e $src ]]; then
            derror "$src is neither a directory nor a regular file"
        else
            derror "$src doesn't exist"
        fi
    fi
done

if [[ $do_hardlink == yes ]] && command -v hardlink > /dev/null; then
    dinfo "*** Hardlinking files ***"
    hardlink "$initdir" 2>&1 | dinfo
    dinfo "*** Hardlinking files done ***"
fi

# strip binaries
if [[ $do_strip == yes ]]; then
    # Prefer strip from elfutils for package size
    declare strip_cmd
    strip_cmd=$(command -v eu-strip)
    [ -z "$strip_cmd" ] && strip_cmd="strip"

    for p in $strip_cmd xargs find; do
        if ! type -P $p > /dev/null; then
            dinfo "Could not find '$p'. Not stripping the initramfs."
            do_strip=no
        fi
    done
fi

# cleanup empty ldconfig_paths directories
for d in $(ldconfig_paths); do
    rmdir -p --ignore-fail-on-non-empty "$initdir/$d" > /dev/null 2>&1
done

if [[ $early_microcode == yes ]]; then
    dinfo "*** Generating early-microcode cpio image ***"
    ucode_dir=(amd-ucode intel-ucode)
    ucode_dest=(AuthenticAMD.bin GenuineIntel.bin)
    _dest_dir="$early_cpio_dir/d/kernel/x86/microcode"
    _dest_idx="0 1"
    mkdir -p "$_dest_dir"
    if [[ $hostonly ]]; then
        [[ $(get_cpu_vendor) == "AMD" ]] && _dest_idx="0"
        [[ $(get_cpu_vendor) == "Intel" ]] && _dest_idx="1"
    fi
    for idx in $_dest_idx; do
        _fw=${ucode_dir[$idx]}
        for _fwdir in $fw_dir; do
            if [[ -d $_fwdir && -d $_fwdir/$_fw ]]; then
                _src="*"
                dinfo "*** Constructing ${ucode_dest[$idx]} ***"
                if [[ $hostonly ]]; then
                    _src=$(get_ucode_file)
                    [[ $_src ]] || break
                    [[ -r $_fwdir/$_fw/$_src ]] || _src="${_src}.early"
                    [[ -r $_fwdir/$_fw/$_src ]] || break
                fi

                for i in $_fwdir/$_fw/$_src; do
                    [ -e "$i" ] && break
                    break 2
                done
                for i in $_fwdir/$_fw/$_src; do
                    [[ -e $i ]] || continue
                    # skip gpg files
                    str_ends "$i" ".asc" && continue
                    cat "$i" >> "$_dest_dir/${ucode_dest[$idx]}"
                done
                create_early_cpio="yes"
            fi
        done
        if [[ ! -e "$_dest_dir/${ucode_dest[$idx]}" ]]; then
            if cd "$early_cpio_dir/d"; then
                for _ucodedir in "${early_microcode_image_dir[@]}"; do
                    for _ucodename in "${early_microcode_image_name[@]}"; do
                        [[ -e "$_ucodedir/$_ucodename" ]] \
                            && cpio --extract --file "$_ucodedir/$_ucodename" --quiet \
                                "kernel/x86/microcode/${ucode_dest[$idx]}"
                        if [[ -e "$_dest_dir/${ucode_dest[$idx]}" ]]; then
                            dinfo "*** Using microcode found in '$_ucodedir/$_ucodename' ***"
                            create_early_cpio="yes"
                            break 2
                        fi
                    done
                done
            fi
        fi
    done
fi

if [[ $acpi_override == yes ]] && [[ -d $acpi_table_dir ]]; then
    dinfo "*** Packaging ACPI tables to override BIOS provided ones ***"
    _dest_dir="$early_cpio_dir/d/kernel/firmware/acpi"
    mkdir -p "$_dest_dir"
    for table in "$acpi_table_dir"/*.aml; do
        dinfo "   Adding ACPI table: $table"
        $DRACUT_CP "$table" "$_dest_dir"
        create_early_cpio="yes"
    done
fi

dinfo "*** Store current command line parameters ***"
if ! (echo "$PARMS_TO_STORE" > "$initdir"/lib/dracut/build-parameter.txt); then
    dfatal "Could not store the current command line parameters"
    exit 1
fi

if [[ $hostonly_cmdline == "yes" ]]; then
    unset _stored_cmdline
    if [[ -d $initdir/etc/cmdline.d ]]; then
        dinfo "Stored kernel commandline:"
        for conf in "$initdir"/etc/cmdline.d/*.conf; do
            [ -e "$conf" ] || continue
            dinfo "$(< "$conf")"
            _stored_cmdline=1
        done
    fi
    if ! [[ $_stored_cmdline ]]; then
        dinfo "No dracut internal kernel commandline stored in the initramfs"
    fi
fi


if [[ $kernel_only != yes ]]; then
    # libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
    for _dir in $libdirs; do
        for _f in "$dracutsysrootdir$_dir/libpthread.so"*; do
            [[ -e $_f ]] || continue
            inst_libdir_file "libgcc_s.so*"
            break 2
        done
    done

    # FIPS workaround for Fedora/RHEL: libcrypto needs libssl when FIPS is enabled
    if [[ $DRACUT_FIPS_MODE ]]; then
        for _dir in $libdirs; do
            for _f in "$dracutsysrootdir$_dir/libcrypto.so"*; do
                [[ -e $_f ]] || continue
                inst_libdir_file -o "libssl.so*"
                break 2
            done
        done
    fi
fi

if [[ $kernel_only != yes ]]; then
    # make sure that library links are correct and up to date
    for f in "$dracutsysrootdir"/etc/ld.so.conf "$dracutsysrootdir"/etc/ld.so.conf.d/*; do
        [[ -f $f ]] && inst_simple "${f#$dracutsysrootdir}"
    done
    if ! $DRACUT_LDCONFIG -r "$initdir" -f /etc/ld.so.conf; then
        if [[ $EUID == 0 ]]; then
            derror "ldconfig exited ungracefully"
        else
            derror "ldconfig might need uid=0 (root) for chroot()"
        fi
    fi
fi

if dracut_module_included "squash"; then
    readonly squash_dir="$initdir/squash/root"
    readonly squash_img="$initdir/squash-root.img"
    mkdir -p "$squash_dir"
    dinfo "*** Install squash loader ***"
    DRACUT_SQUASH_POST_INST=1 module_install "squash"
fi

if [[ $do_strip == yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
    # stripping files negates (dedup) benefits of using reflink
    [[ -n $enhanced_cpio ]] && ddebug "strip is enabled alongside cpio reflink"
    dinfo "*** Stripping files ***"
    find "$initdir" -type f \
        -executable -not -path '*/lib/modules/*.ko' -print0 \
        | xargs -r -0 $strip_cmd -g -p 2> /dev/null

    # strip kernel modules, but do not touch signed modules
    find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
        | while read -r -d $'\0' f || [ -n "$f" ]; do
            SIG=$(tail -c 28 "$f" | tr -d '\000')
            [[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
        done | xargs -r -0 $strip_cmd -g -p
    dinfo "*** Stripping files done ***"
fi

if dracut_module_included "squash"; then
    dinfo "*** Squashing the files inside the initramfs ***"
    declare squash_compress_arg
    # shellcheck disable=SC2086
    if [[ $compress ]]; then
        if ! mksquashfs /dev/null "$DRACUT_TMPDIR"/.squash-test.img -no-progress -comp $compress &> /dev/null; then
            dwarn "mksquashfs doesn't support compressor '$compress', failing back to default compressor."
        else
            squash_compress_arg="$compress"
        fi
    fi

    # shellcheck disable=SC2086
    if ! mksquashfs "$squash_dir" "$squash_img" \
        -no-xattrs -no-exports -noappend -no-recovery -always-use-fragments \
        -no-progress ${squash_compress_arg:+-comp $squash_compress_arg} 1> /dev/null; then

        dfatal "dracut: Failed making squash image"
        exit 1
    fi

    rm -rf "$squash_dir"
    dinfo "*** Squashing the files inside the initramfs done ***"

    # Skip initramfs compress
    compress="cat"
fi

dinfo "*** Creating image file '$outfile' ***"

if [[ $uefi == yes ]]; then
    readonly uefi_outdir="$DRACUT_TMPDIR/uefi"
    mkdir -p "$uefi_outdir"
fi

if [[ $DRACUT_REPRODUCIBLE ]]; then
    find "$initdir" -newer "$dracutbasedir/dracut-functions.sh" -print0 \
        | xargs -r -0 touch -h -m -c -r "$dracutbasedir/dracut-functions.sh"

    if [[ "$(cpio --help)" == *--reproducible* ]]; then
        CPIO_REPRODUCIBLE=1
    else
        dinfo "cpio does not support '--reproducible'. Resulting image will not be reproducible."
    fi
fi

[[ $EUID != 0 ]] && cpio_owner="0:0"

if [[ $create_early_cpio == yes ]]; then
    echo 1 > "$early_cpio_dir/d/early_cpio"

    if [[ $DRACUT_REPRODUCIBLE ]]; then
        find "$early_cpio_dir/d" -newer "$dracutbasedir/dracut-functions.sh" -print0 \
            | xargs -r -0 touch -h -m -c -r "$dracutbasedir/dracut-functions.sh"
    fi

    # The microcode blob is _before_ the initramfs blob, not after
    if [[ -n $enhanced_cpio ]]; then
        if ! (
            umask 077
            cd "$early_cpio_dir/d"
            find . -print0 | sort -z \
                | $enhanced_cpio --null ${cpio_owner:+--owner "$cpio_owner"} \
                    --mtime 0 --data-align "$cpio_align" --truncate-existing \
                    "${DRACUT_TMPDIR}/initramfs.img"
        ); then
            dfatal "dracut-cpio: creation of $outfile failed"
            exit 1
        fi
    else
        if ! (
            umask 077
            cd "$early_cpio_dir/d"
            find . -print0 | sort -z \
                | cpio ${CPIO_REPRODUCIBLE:+--reproducible} --null \
                    ${cpio_owner:+-R "$cpio_owner"} -H newc -o --quiet > "${DRACUT_TMPDIR}/initramfs.img"
        ); then
            dfatal "dracut: creation of $outfile failed"
            exit 1
        fi
    fi
fi

if check_kernel_config CONFIG_RD_ZSTD; then
    DRACUT_KERNEL_RD_ZSTD=yes
else
    DRACUT_KERNEL_RD_ZSTD=
fi

if [[ $compress == $DRACUT_COMPRESS_ZSTD* && ! $DRACUT_KERNEL_RD_ZSTD ]]; then
    dwarn "dracut: kernel has no zstd support compiled in."
    compress=
fi

if [[ $compress && $compress != cat ]]; then
    if ! command -v "${compress%% *}" &> /dev/null; then
        derror "dracut: cannot execute compression command '$compress', falling back to default"
        compress=
    fi
fi

if ! [[ $compress ]]; then
    # check all known compressors, if none specified
    for i in $DRACUT_COMPRESS_PIGZ $DRACUT_COMPRESS_GZIP $DRACUT_COMPRESS_LZ4 $DRACUT_COMPRESS_LZOP $DRACUT_COMPRESS_ZSTD $DRACUT_COMPRESS_LZMA $DRACUT_COMPRESS_XZ $DRACUT_COMPRESS_LBZIP2 $DRACUT_COMPRESS_BZIP2 $DRACUT_COMPRESS_CAT; do
        [[ $i != "$DRACUT_COMPRESS_ZSTD" || $DRACUT_KERNEL_RD_ZSTD ]] || continue
        command -v "$i" &> /dev/null || continue
        compress="$i"
        break
    done
    if [[ $compress == cat ]]; then
        dwarn "dracut: no compression tool available. Initramfs image is going to be big."
    else
        dinfo "dracut: using auto-determined compression method '$compress'"
    fi
fi

# choose the right arguments for the compressor
case $compress in
    bzip2 | lbzip2)
        if [[ $compress == lbzip2 ]] || command -v "$DRACUT_COMPRESS_LBZIP2" &> /dev/null; then
            compress="$DRACUT_COMPRESS_LBZIP2 -9"
        else
            compress="$DRACUT_COMPRESS_BZIP2 -9"
        fi
        ;;
    lzma)
        compress="$DRACUT_COMPRESS_LZMA -9 -T0"
        ;;
    xz)
        compress="$DRACUT_COMPRESS_XZ --check=crc32 --lzma2=dict=1MiB -T0"
        ;;
    gzip | pigz)
        if [[ $compress == pigz ]] || command -v "$DRACUT_COMPRESS_PIGZ" &> /dev/null; then
            compress="$DRACUT_COMPRESS_PIGZ -9 -n -T -R"
        elif command -v gzip &> /dev/null && $DRACUT_COMPRESS_GZIP --help 2>&1 | grep -q rsyncable; then
            compress="$DRACUT_COMPRESS_GZIP -n -9 --rsyncable"
        else
            compress="$DRACUT_COMPRESS_GZIP -n -9"
        fi
        ;;
    lzo | lzop)
        compress="$DRACUT_COMPRESS_LZOP -9"
        ;;
    lz4)
        compress="$DRACUT_COMPRESS_LZ4 -l -9"
        ;;
    zstd)
        compress="$DRACUT_COMPRESS_ZSTD -15 -q -T0"
        ;;
esac

if [[ -n $enhanced_cpio ]]; then
    if [[ $compress == "cat" ]]; then
        # dracut-cpio appends by default, so any ucode remains
        cpio_outfile="${DRACUT_TMPDIR}/initramfs.img"
    else
        ddebug "$compress compression enabled alongside cpio reflink"
        # dracut-cpio doesn't output to stdout, so stage for compression
        cpio_outfile="${DRACUT_TMPDIR}/initramfs.img.uncompressed"
    fi

    if ! (
        umask 077
        cd "$initdir"
        find . -print0 | sort -z \
            | $enhanced_cpio --null ${cpio_owner:+--owner "$cpio_owner"} \
                --mtime 0 --data-align "$cpio_align" "$cpio_outfile" || exit 1
        [[ $compress == "cat" ]] && exit 0
        $compress < "$cpio_outfile" >> "${DRACUT_TMPDIR}/initramfs.img" \
            && rm "$cpio_outfile"
    ); then
        dfatal "dracut-cpio: creation of $outfile failed"
        exit 1
    fi
    unset cpio_outfile
else
    if ! (
        umask 077
        cd "$initdir"
        find . -print0 | sort -z \
            | cpio ${CPIO_REPRODUCIBLE:+--reproducible} --null ${cpio_owner:+-R "$cpio_owner"} -H newc -o --quiet \
            | $compress >> "${DRACUT_TMPDIR}/initramfs.img"
    ); then
        dfatal "dracut: creation of $outfile failed"
        exit 1
    fi
fi

# shellcheck disable=SC2154
if ((maxloglvl >= 5)) && ((verbosity_mod_l >= 0)); then
    if [[ $allowlocal ]]; then
        "$dracutbasedir/lsinitrd.sh" "${DRACUT_TMPDIR}/initramfs.img" | ddebug
    else
        lsinitrd "${DRACUT_TMPDIR}/initramfs.img" | ddebug
    fi
fi

umask 077

if [[ $uefi == yes ]]; then
    if [[ $kernel_cmdline ]]; then
        echo -n "$kernel_cmdline" > "$uefi_outdir/cmdline.txt"
    elif [[ $hostonly_cmdline == yes ]] && [ -d "$initdir/etc/cmdline.d" ]; then
        for conf in "$initdir"/etc/cmdline.d/*.conf; do
            [ -e "$conf" ] || continue
            printf "%s " "$(< "$conf")" >> "$uefi_outdir/cmdline.txt"
        done
    fi

    if [[ $kernel_cmdline ]] || [[ $hostonly_cmdline == yes && -d "$initdir/etc/cmdline.d" ]]; then
        echo -ne "\x00" >> "$uefi_outdir/cmdline.txt"
        dinfo "Using UEFI kernel cmdline:"
        dinfo "$(tr -d '\000' < "$uefi_outdir/cmdline.txt")"
        uefi_cmdline="${uefi_outdir}/cmdline.txt"
    else
        unset uefi_cmdline
    fi

    [[ -s $dracutsysrootdir/usr/lib/os-release ]] && uefi_osrelease="$dracutsysrootdir/usr/lib/os-release"
    [[ -s $dracutsysrootdir/etc/os-release ]] && uefi_osrelease="$dracutsysrootdir/etc/os-release"
    if [[ -s ${dracutsysrootdir}${uefi_splash_image} ]]; then
        uefi_splash_image="${dracutsysrootdir}${uefi_splash_image}"
    else
        unset uefi_splash_image
    fi

    if objcopy \
        ${uefi_osrelease:+--add-section .osrel="$uefi_osrelease" --change-section-vma .osrel=0x20000} \
        ${uefi_cmdline:+--add-section .cmdline="$uefi_cmdline" --change-section-vma .cmdline=0x30000} \
        ${uefi_splash_image:+--add-section .splash="$uefi_splash_image" --change-section-vma .splash=0x40000} \
        --add-section .linux="$kernel_image" --change-section-vma .linux=0x2000000 \
        --add-section .initrd="${DRACUT_TMPDIR}/initramfs.img" --change-section-vma .initrd=0x3000000 \
        "$uefi_stub" "${uefi_outdir}/linux.efi"; then
        if [[ -n ${uefi_secureboot_key} && -n ${uefi_secureboot_cert} ]]; then
            if sbsign \
                --key "${uefi_secureboot_key}" \
                --cert "${uefi_secureboot_cert}" \
                --output "$outfile" "${uefi_outdir}/linux.efi"; then
                dinfo "*** Creating signed UEFI image file '$outfile' done ***"
            else
                dfatal "*** Creating signed UEFI image file '$outfile' failed ***"
                exit 1
            fi
        else
            if cp --reflink=auto "${uefi_outdir}/linux.efi" "$outfile"; then
                dinfo "*** Creating UEFI image file '$outfile' done ***"
            fi
        fi
    else
        rm -f -- "$outfile"
        dfatal "*** Creating UEFI image file '$outfile' failed ***"
        exit 1
    fi
else
    if cp --reflink=auto "${DRACUT_TMPDIR}/initramfs.img" "$outfile"; then
        dinfo "*** Creating initramfs image file '$outfile' done ***"
    else
        rm -f -- "$outfile"
        dfatal "dracut: creation of $outfile failed"
        exit 1
    fi
fi

command -v restorecon &> /dev/null && restorecon -- "$outfile"

btrfs_uuid() {
    btrfs filesystem show "$1" | sed -n '1s/^.*uuid: //p'
}

freeze_ok_for_btrfs() {
    local mnt uuid1 uuid2
    # If the output file is on btrfs, we need to make sure that it's
    # not on a subvolume of the same file system as the root FS.
    # Otherwise, fsfreeze() might freeze the entire system.
    # This is most conveniently checked by comparing the FS uuid.

    [[ "$(stat -f -c %T -- "/")" == "btrfs" ]] || return 0
    mnt=$(stat -c %m -- "$1")
    uuid1=$(btrfs_uuid "$mnt")
    uuid2=$(btrfs_uuid "/")
    [[ $uuid1 && $uuid2 && $uuid1 != "$uuid2" ]]
}

freeze_ok_for_fstype() {
    local outfile=$1
    local fstype

    [[ "$(stat -c %m -- "$outfile")" == "/" ]] && return 1
    fstype=$(stat -f -c %T -- "$outfile")
    case $fstype in
        msdos)
            return 1
            ;;
        btrfs)
            freeze_ok_for_btrfs "$outfile"
            ;;
        *)
            return 0
            ;;
    esac
}

# We sync/fsfreeze only if we're operating on a live booted system.
# It's possible for e.g. `kernel` to be installed as an RPM BuildRequires or equivalent,
# and there's no reason to sync, and *definitely* no reason to fsfreeze.
# Another case where this happens is rpm-ostree, which performs its own sync/fsfreeze
# globally.  See e.g. https://github.com/ostreedev/ostree/commit/8642ef5ab3fec3ac8eb8f193054852f83a8bc4d0
if [[ -d $dracutsysrootdir/run/systemd/system ]]; then
    if ! sync "$outfile" 2> /dev/null; then
        dinfo "dracut: sync operation on newly created initramfs $outfile failed"
        exit 1
    fi

    # use fsfreeze only if we're not writing to /
    if [[ "$(stat -c %m -- "$outfile")" != "/" ]] && freeze_ok_for_fstype "$outfile"; then
        FSFROZEN="$(dirname "$outfile")"
        if ! (fsfreeze -f "${FSFROZEN}" 2> /dev/null && fsfreeze -u "${FSFROZEN}" 2> /dev/null); then
            dinfo "dracut: warning: could not fsfreeze $(dirname "$outfile")"
        fi
        unset FSFROZEN
    fi
fi

exit 0
  07070100000039000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002800000000dracut-055+suse.347.gdcb9bdbf/install.d   0707010000003A000081ED00000000000000000000000164DF2CB80000075C000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/install.d/50-dracut.install #!/bin/bash

COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4"

# If KERNEL_INSTALL_MACHINE_ID is defined but empty, BOOT_DIR_ABS is a fake directory.
# So, let's skip to create initrd.
if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then
    exit 0
fi

if [[ -d "$BOOT_DIR_ABS" ]]; then
    INITRD="initrd"
else
    BOOT_DIR_ABS="/boot"
    INITRD="initrd-${KERNEL_VERSION}"
fi

ret=0
case "$COMMAND" in
    add)
        INITRD_IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/initrd
        if [[ -f ${INITRD_IMAGE_PREGENERATED} ]]; then
            # we found an initrd at the same place as the kernel
            # use this and don't generate a new one
            cp --reflink=auto "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/$INITRD" \
                && chown root:root "$BOOT_DIR_ABS/$INITRD" \
                && chmod 0600 "$BOOT_DIR_ABS/$INITRD" \
                && exit 0
        fi

        if [[ -f /etc/kernel/cmdline ]]; then
            read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
        elif [[ -f /usr/lib/kernel/cmdline ]]; then
            read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
        else
            declare -a BOOT_OPTIONS

            read -r -d '' -a line < /proc/cmdline
            for i in "${line[@]}"; do
                [[ "${i#initrd=*}" != "$i" ]] && continue
                BOOT_OPTIONS+=("$i")
            done
        fi

        unset noimageifnotneeded

        for ((i=0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
            # shellcheck disable=SC1001
            if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
                noimageifnotneeded="yes"
                break
            fi
        done
	dracut -f ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
        ret=$?
	;;
    remove)
        rm -f -- "$BOOT_DIR_ABS/$INITRD"
        ret=$?
	;;
esac
exit $ret
0707010000003B000081ED00000000000000000000000164DF2CB800000DBA000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/install.d/51-dracut-rescue.install  #!/bin/bash

export LANG=C

COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="${3%/*}/0-rescue"
KERNEL_IMAGE="$4"


dropindirs_sort()
{
    suffix=$1; shift
    args=("$@")
    files=$(
        while (( $# > 0 )); do
            for i in "${1}"/*"${suffix}"; do
                [[ -f $i ]] && echo "${i##*/}"
            done
            shift
        done | sort -Vu
    )

    for f in $files; do
        for d in "${args[@]}"; do
            if [[ -f "$d/$f" ]]; then
                echo "$d/$f"
                continue 2
            fi
        done
    done
}

[[ -f /etc/os-release ]] && . /etc/os-release

if [[ ${KERNEL_INSTALL_MACHINE_ID+x} ]]; then
    MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID
elif [[ -f /etc/machine-id ]] ; then
    read -r MACHINE_ID < /etc/machine-id
fi

if ! [[ $MACHINE_ID ]]; then
    exit 0
fi

if [[ -f /etc/kernel/cmdline ]]; then
    read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
elif [[ -f /usr/lib/kernel/cmdline ]]; then
    read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
else
    declare -a BOOT_OPTIONS

    read -r -d '' -a line < /proc/cmdline
    for i in "${line[@]}"; do
        [[ "${i#initrd=*}" != "$i" ]] && continue
        BOOT_OPTIONS+=("$i")
    done
fi

if [[ -d "${BOOT_DIR_ABS%/*}" ]]; then
    BOOT_DIR="/${MACHINE_ID}/0-rescue"
    BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}
    LOADER_ENTRY="$BOOT_ROOT/loader/entries/${MACHINE_ID}-0-rescue.conf"
    KERNEL="linux"
    INITRD="initrd"
else
    BLS_DIR="/boot/loader/entries"
    BOOT_DIR_ABS="/boot"
    LOADER_ENTRY="$BLS_DIR/${MACHINE_ID}-0-rescue.conf"
    KERNEL="vmlinuz-0-rescue-${MACHINE_ID}"
    INITRD="initramfs-0-rescue-${MACHINE_ID}.img"
fi

ret=0

case "$COMMAND" in
    add)
        [[ -f "$LOADER_ENTRY" ]] && [[ -f "$BOOT_DIR_ABS/$KERNEL" ]] \
            && [[ -f "$BOOT_DIR_ABS/$INITRD" ]] && exit 0

        # source our config dir
        for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do
            if [[ -e $f ]]; then
                # shellcheck disable=SC1090
                . "$f"
            fi
        done

        # shellcheck disable=SC2154
        [[ $dracut_rescue_image != "yes" ]] && exit 0

        [[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS"

        if ! cp --reflink=auto "$KERNEL_IMAGE" "$BOOT_DIR_ABS/$KERNEL"; then
            echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/$KERNEL'!" >&2
        fi

        if [[ ! -f "$BOOT_DIR_ABS/$INITRD" ]]; then
            dracut -f --no-hostonly -a "rescue" "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
            ((ret+=$?))
        fi

        if [[ "${BOOT_DIR_ABS}" != "/boot" ]]; then
            {
                echo "title      $PRETTY_NAME - Rescue Image"
                echo "version    $KERNEL_VERSION"
                echo "machine-id $MACHINE_ID"
                echo "options    ${BOOT_OPTIONS[*]} rd.auto=1"
                echo "linux      $BOOT_DIR/linux"
                echo "initrd     $BOOT_DIR/initrd"
            } > "$LOADER_ENTRY"
        else
            if [[ -e "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" ]]; then
                cp -aT "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" "$LOADER_ENTRY"
            else
                cp -aT "${KERNEL_IMAGE%/*}/bls.conf" "$LOADER_ENTRY"
            fi
            sed -i "s/${KERNEL_VERSION}/0-rescue-${MACHINE_ID}/" "$LOADER_ENTRY"
        fi

        ((ret+=$?))
        ;;

    remove)
        exit 0
        ;;

    *)
        usage
        ret=1;;
esac

exit $ret
  0707010000003C000081ED00000000000000000000000164DF2CB800002B5C000000000000000000000000000000000000002A00000000dracut-055+suse.347.gdcb9bdbf/lsinitrd.sh #!/bin/bash
#
# Copyright 2005-2010 Harald Hoyer <harald@redhat.com>
# Copyright 2005-2010 Red Hat, Inc.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

usage() {
    {
        echo "Usage: ${0##*/} [options] [<initramfs file> [<filename> [<filename> [...] ]]]"
        echo "Usage: ${0##*/} [options] -k <kernel version>"
        echo
        echo "-h, --help                  print a help message and exit."
        echo "-s, --size                  sort the contents of the initramfs by size."
        echo "-m, --mod                   list modules."
        echo "-f, --file <filename>       print the contents of <filename>."
        echo "--unpack                    unpack the initramfs, instead of displaying the contents."
        echo "                            If optional filenames are given, will only unpack specified files,"
        echo "                            else the whole image will be unpacked. Won't unpack anything from early cpio part."
        echo "--unpackearly               unpack the early microcode part of the initramfs."
        echo "                            Same as --unpack, but only unpack files from early cpio part."
        echo "-v, --verbose               unpack verbosely."
        echo "-k, --kver <kernel version> inspect the initramfs of <kernel version>."
        echo
    } >&2
}

[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut

sorted=0
modules=0
unset verbose
declare -A filenames

unset POSIXLY_CORRECT
TEMP=$(getopt \
    -o "vshmf:k:" \
    --long kver: \
    --long file: \
    --long mod \
    --long help \
    --long size \
    --long unpack \
    --long unpackearly \
    --long verbose \
    -- "$@")

# shellcheck disable=SC2181
if (($? != 0)); then
    usage
    exit 1
fi

eval set -- "$TEMP"

while (($# > 0)); do
    case $1 in
        -k | --kver)
            KERNEL_VERSION="$2"
            shift
            ;;
        -f | --file)
            filenames[${2#/}]=1
            shift
            ;;
        -s | --size) sorted=1 ;;
        -h | --help)
            usage
            exit 0
            ;;
        -m | --mod) modules=1 ;;
        -v | --verbose) verbose="--verbose" ;;
        --unpack) unpack=1 ;;
        --unpackearly) unpackearly=1 ;;
        --)
            shift
            break
            ;;
        *)
            usage
            exit 1
            ;;
    esac
    shift
done

[[ $KERNEL_VERSION ]] || KERNEL_VERSION="$(uname -r)"

if [[ $1 ]]; then
    image="$1"
    if ! [[ -f $image ]]; then
        {
            echo "$image does not exist"
            echo
        } >&2
        usage
        exit 1
    fi
else
    [[ -f /etc/machine-id ]] && read -r MACHINE_ID < /etc/machine-id

    if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
        && [[ $MACHINE_ID ]] \
        && [[ -d /efi/${MACHINE_ID} || -L /efi/${MACHINE_ID} ]]; then
        image="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
    elif [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
        && [[ $MACHINE_ID ]] \
        && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]]; then
        image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
    else
        image="/boot/initrd-${KERNEL_VERSION}"
    fi
fi

shift
while (($# > 0)); do
    filenames[${1#/}]=1
    shift
done

if ! [[ -f $image ]]; then
    {
        echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
        echo
    } >&2
    usage
    exit 1
fi

TMPDIR="$(mktemp -d -t lsinitrd.XXXXXX)"
# shellcheck disable=SC2064
trap "rm -rf '$TMPDIR'" EXIT

dracutlibdirs() {
    for d in lib64/dracut lib/dracut usr/lib64/dracut usr/lib/dracut; do
        echo "$d/$1"
    done
}

extract_files() {
    ((${#filenames[@]} == 1)) && nofileinfo=1
    for f in "${!filenames[@]}"; do
        [[ $nofileinfo ]] || echo "initramfs:/$f"
        [[ $nofileinfo ]] || echo "========================================================================"
        $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout "$f" 2> /dev/null
        ((ret += $?))
        [[ $nofileinfo ]] || echo "========================================================================"
        [[ $nofileinfo ]] || echo
    done
}

list_modules() {
    echo "dracut modules:"
    # shellcheck disable=SC2046
    $CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
        $(dracutlibdirs modules.txt) 2> /dev/null
    ((ret += $?))
}

list_files() {
    echo "========================================================================"
    if [ "$sorted" -eq 1 ]; then
        $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
    else
        $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --list | sort -k9
    fi
    ((ret += $?))
    echo "========================================================================"
}

list_squash_content() {
    SQUASH_IMG="squash-root.img"
    SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh"

    $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \
        $SQUASH_IMG > "$SQUASH_TMPFILE" 2> /dev/null
    if [[ -s $SQUASH_TMPFILE ]]; then
        echo "Squashed content ($SQUASH_IMG):"
        echo "========================================================================"
        unsquashfs -ll "$SQUASH_TMPFILE" | tail -n +4
        echo "========================================================================"
    fi
}

unpack_files() {
    if ((${#filenames[@]} > 0)); then
        for f in "${!filenames[@]}"; do
            $CAT "$image" 2> /dev/null | cpio -id --quiet $verbose $f
            ((ret += $?))
        done
    else
        $CAT "$image" 2> /dev/null | cpio -id --quiet $verbose
        ((ret += $?))
    fi
}

read -r -N 2 bin < "$image"
if [ "$bin" = "MZ" ]; then
    command -v objcopy > /dev/null || {
        echo "Need 'objcopy' to unpack an UEFI executable."
        exit 1
    }
    objcopy \
        --dump-section .linux="$TMPDIR/vmlinuz" \
        --dump-section .initrd="$TMPDIR/initrd.img" \
        --dump-section .cmdline="$TMPDIR/cmdline.txt" \
        --dump-section .osrel="$TMPDIR/osrel.txt" \
        "$image" /dev/null
    uefi="$image"
    image="$TMPDIR/initrd.img"
    [ -f "$image" ] || exit 1
fi

if ((${#filenames[@]} <= 0)) && [[ -z $unpack ]] && [[ -z $unpackearly ]]; then
    if [ -n "$uefi" ]; then
        echo -n "initrd in UEFI: $uefi: "
        du -h "$image" | while read -r a _ || [ -n "$a" ]; do echo "$a"; done
        if [ -f "$TMPDIR/osrel.txt" ]; then
            name=$(sed -En '/^PRETTY_NAME/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
            id=$(sed -En '/^ID/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
            build=$(sed -En '/^BUILD_ID/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
            echo "OS Release: $name (${id}-${build})"
        fi
        if [ -f "$TMPDIR/vmlinuz" ]; then
            version=$(strings -n 20 "$TMPDIR/vmlinuz" | sed -En '/[0-9]+\.[0-9]+\.[0-9]+/ { p; q 0 }')
            echo "Kernel Version: $version"
        fi
        if [ -f "$TMPDIR/cmdline.txt" ]; then
            echo "Command line:"
            sed -En 's/\s+/\n/g; s/\x00/\n/; p' "$TMPDIR/cmdline.txt"
        fi
    else
        echo -n "Image: $image: "
        du -h "$image" | while read -r a _ || [ -n "$a" ]; do echo "$a"; done
    fi

    echo "========================================================================"
fi

read -r -N 6 bin < "$image"
case $bin in
    $'\x71\xc7'* | 070701)
        CAT="cat --"
        is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2> /dev/null)
        # Debian mkinitramfs does not create the file 'early_cpio', so let's check if firmware files exist
        [[ "$is_early" ]] || is_early=$(cpio --list --verbose --quiet --to-stdout -- 'kernel/*/microcode/*.bin' < "$image" 2> /dev/null)
        if [[ "$is_early" ]]; then
            if [[ -n $unpack ]]; then
                # should use --unpackearly for early CPIO
                :
            elif [[ -n $unpackearly ]]; then
                unpack_files
            elif ((${#filenames[@]} > 0)); then
                extract_files
            else
                echo "Early CPIO image"
                list_files
            fi
            if [[ -d "$dracutbasedir/skipcpio" ]]; then
                SKIP="$dracutbasedir/skipcpio/skipcpio"
            else
                SKIP="$dracutbasedir/skipcpio"
            fi
            if ! [[ -x $SKIP ]]; then
                echo
                echo "'$SKIP' not found, cannot display remaining contents!" >&2
                echo
                exit 0
            fi
        fi
        ;;
esac

if [[ $SKIP ]]; then
    bin="$($SKIP "$image" | { read -r -N 6 bin && echo "$bin"; })"
else
    read -r -N 6 bin < "$image"
fi
case $bin in
    $'\x1f\x8b'*)
        CAT="zcat --"
        ;;
    BZh*)
        CAT="bzcat --"
        ;;
    $'\x71\xc7'* | 070701)
        CAT="cat --"
        ;;
    $'\x02\x21'*)
        CAT="lz4 -d -c"
        ;;
    $'\x89'LZO$'\0'*)
        CAT="lzop -d -c"
        ;;
    $'\x28\xB5\x2F\xFD'*)
        CAT="zstd -d -c"
        ;;
    *)
        if echo "test" | xz | xzcat --single-stream > /dev/null 2>&1; then
            CAT="xzcat --single-stream --"
        else
            CAT="xzcat --"
        fi
        ;;
esac

skipcpio() {
    $SKIP "$@" | $ORIG_CAT
}

if [[ $SKIP ]]; then
    ORIG_CAT="$CAT"
    CAT=skipcpio
fi

if ((${#filenames[@]} > 1)); then
    TMPFILE="$TMPDIR/initrd.cpio"
    $CAT "$image" 2> /dev/null > "$TMPFILE"
    pre_decompress() {
        cat "$TMPFILE"
    }
    CAT=pre_decompress
fi

ret=0

if [[ -n $unpack ]]; then
    unpack_files
elif ((${#filenames[@]} > 0)); then
    extract_files
else
    # shellcheck disable=SC2046
    version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
        $(dracutlibdirs 'dracut-*') 2> /dev/null)
    ((ret += $?))
    echo "Version: $version"
    echo
    if [ "$modules" -eq 1 ]; then
        list_modules
        echo "========================================================================"
    else
        echo -n "Arguments: "
        # shellcheck disable=SC2046
        $CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
            $(dracutlibdirs build-parameter.txt) 2> /dev/null
        echo
        list_modules
        list_files
        list_squash_content
    fi
fi

exit "$ret"
0707010000003D000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002200000000dracut-055+suse.347.gdcb9bdbf/man 0707010000003E000081A400000000000000000000000164DF2CB800000520000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/man/dracut-catimages.8.asc  DRACUT-CATIMAGES(8)
===================
:doctype: manpage
:man source:   dracut
:man manual:   dracut

NAME
----
dracut-catimages - creates initial ramdisk image by concatenating images

SYNOPSIS
--------
**dracut-catimages** [_OPTION_...] _<initramfs base image>_ [_<image>_...]

DESCRIPTION
-----------
dracut-catimages creates an initial ramdisk image by concatenating several
images from the command line and /boot/dracut/*.img

OPTIONS
-------
**-f, --force**::
    overwrite existing initramfs file.

**-i, --imagedir**::
    Directory with additional images to add (default: /boot/dracut/)

**-o, --overlaydir**::
    Overlay directory, which contains additional files that will be used to
    create an additional image

**--nooverlay**:: Do not use the overlay directory

**--noimagedir**:: Do not use the additional image directory

**-h, --help**:: display help text and exit.

**--debug**:: output debug information of the build process

**-v, --verbose**:: verbose output during the build process

FILES
-----
_/boot/dracut/*.img_::
    images to work with

AUTHORS
-------
Harald Hoyer

AVAILABILITY
------------
The dracut-catimages command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]

SEE ALSO
--------
*dracut*(8)

0707010000003F000081A400000000000000000000000164DF2CB8000053A6000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/man/dracut.8.asc    DRACUT(8)
=========
:doctype: manpage
:man source:   dracut
:man manual:   dracut
:man version:  {version}

NAME
----
dracut - low-level tool for generating an initramfs/initrd image

SYNOPSIS
--------
*dracut* [__OPTION...__] [__<image>__ [__<kernel version>__]]

DESCRIPTION
-----------

Create an initramfs <image> for the kernel with the version <kernel version>.
If <kernel version> is omitted, then the version of the actual running
kernel is used. If <image> is omitted or empty, then the default location
/boot/initramfs-<kernel version>.img is used.

dracut creates an initial image used by the kernel for preloading the block
device modules (such as IDE, SCSI or RAID) which are needed to access the root
filesystem, mounting the root filesystem and booting into the real system.

At boot time, the kernel unpacks that archive into RAM disk, mounts and uses it
as initial root file system. All finding of the root device happens in this
early userspace.

Initramfs images are also called "initrd".

For a complete list of kernel command line options see *dracut.cmdline*(7).

If you are dropped to an emergency shell, while booting your initramfs,
the file _/run/initramfs/rdsosreport.txt_ is created, which can be saved to a
(to be mounted by hand) partition (usually /boot) or a USB stick.
Additional debugging info can be produced by adding **rd.debug** to the kernel
command line. _/run/initramfs/rdsosreport.txt_ contains all logs and the output
of some tools. It should be attached to any report about dracut problems.

USAGE
-----

include::dracut.usage.asc[]

OPTIONS
-------
**--kver** _<kernel version>_::
    set the kernel version. This enables to specify the kernel version, without
    specifying the location of the initramfs image. For example:
----
# dracut --kver 3.5.0-0.rc7.git1.2.fc18.x86_64
----

**-f, --force**::
    overwrite existing initramfs file.

**-a, --add** _<list of dracut modules>_::
    add a space-separated list of dracut modules to the default set of modules.
    This parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --add "module1 module2"  ...
----
===============================

**--force-add** _<list of dracut modules>_::
    force to add a space-separated list of dracut modules to the default set of
    modules, when -H is specified. This parameter can be specified multiple
    times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --force-add "module1 module2"  ...
----
===============================

**-o, --omit** _<list of dracut modules>_::
    omit a space-separated list of dracut modules. This parameter can be
    specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --omit "module1 module2"  ...
----
===============================

**-m, --modules** _<list of dracut modules>_::
    specify a space-separated list of dracut modules to call when building the
    initramfs. Modules are located in _/usr/lib/dracut/modules.d_. This
    parameter can be specified multiple times.
    This option forces dracut to only include the specified dracut modules.
    In most cases the "--add" option is what you want to use.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --modules "module1 module2"  ...
----
===============================

**-d, --drivers** _<list of kernel modules>_::
    specify a space-separated list of kernel modules to exclusively include
    in the initramfs. The kernel modules have to be specified without the ".ko"
    suffix. This parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --drivers "kmodule1 kmodule2"  ...
----
===============================

**--add-drivers** _<list of kernel modules>_::
    specify a space-separated list of kernel modules to add to the initramfs.
    The kernel modules have to be specified without the ".ko" suffix. This
    parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --add-drivers "kmodule1 kmodule2"  ...
----
===============================

**--force-drivers** _<list of kernel modules>_::
    See add-drivers above. But in this case it is ensured that the drivers
    are tried to be loaded early via modprobe.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --force-drivers "kmodule1 kmodule2"  ...
----
===============================

**--omit-drivers** _<list of kernel modules>_::
    specify a space-separated list of kernel modules not to add to the
    initramfs.
    The kernel modules have to be specified without the ".ko" suffix. This
    parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --omit-drivers "kmodule1 kmodule2"  ...
----
===============================

**--filesystems** _<list of filesystems>_::
    specify a space-separated list of kernel filesystem modules to exclusively
    include in the generic initramfs. This parameter can be specified multiple
    times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --filesystems "filesystem1 filesystem2"  ...
----
===============================

**-k, --kmoddir** _<kernel directory>_::
    specify the directory, where to look for kernel modules

**--fwdir** _<dir>[:<dir>...]++_::
    specify additional directories, where to look for firmwares. This parameter
    can be specified multiple times.

**--kernel-cmdline <parameters>**::
    specify default kernel command line parameters


**--kernel-only**::
    only install kernel drivers and firmware files

**--no-kernel**::
    do not install kernel drivers and firmware files

**--early-microcode**::
    Combine early microcode with ramdisk

**--no-early-microcode**::
    Do not combine early microcode with ramdisk

**--print-cmdline**::
    print the kernel command line for the current disk layout

**--mdadmconf**::
    include local _/etc/mdadm.conf_

**--nomdadmconf**::
    do not include local _/etc/mdadm.conf_

**--lvmconf**::
    include local _/etc/lvm/lvm.conf_

**--nolvmconf**::
    do not include local _/etc/lvm/lvm.conf_

**--fscks** [LIST]::
    add a space-separated list of fsck tools, in addition to _dracut.conf_'s
    specification; the installation is opportunistic (non-existing tools are
    ignored)
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --fscks "fsck.foo barfsck"  ...
----
===============================

**--nofscks**::
    inhibit installation of any fsck tools

**--strip**::
    strip binaries in the initramfs (default)

**--nostrip**::
    do not strip binaries in the initramfs

**--hardlink**::
    hardlink files in the initramfs (default)

**--nohardlink**::
    do not hardlink files in the initramfs

**--prefix** _<dir>_::
    prefix initramfs files with the specified directory

**--noprefix**::
    do not prefix initramfs files (default)

**-h, --help**::
    display help text and exit.

**--debug**::
    output debug information of the build process

**-v, --verbose**::
    increase verbosity level (default is info(4))

**--version**::
    display version and exit

**-q, --quiet**:: decrease verbosity level (default is info(4))

**-c, --conf** _<dracut configuration file>_::
    specify configuration file to use.
+
Default:
   _/etc/dracut.conf_

**--confdir** _<configuration directory>_::
    specify configuration directory to use.
+
Default:
   _/etc/dracut.conf.d_

**--tmpdir** _<temporary directory>_::
    specify temporary directory to use.
+
Default:
   _/var/tmp_

**-r, --sysroot** _<sysroot directory>_::
    specify the sysroot directory to collect files from.
    This is useful to create the initramfs image from
    a cross-compiled sysroot directory. For the extra helper
    variables, see *ENVIRONMENT* below.
+
Default:
    _empty_

**--sshkey** _<sshkey file>_:: ssh key file used with ssh-client module.

**--logfile** _<logfile>_:: logfile to use; overrides any setting from
    the configuration files.
+
Default:
    _/var/log/dracut.log_

**-l, --local**::
    activates the local mode. dracut will use modules from the current working
    directory instead of the system-wide installed modules in
    _/usr/lib/dracut/modules.d_.
    This is useful when running dracut from a git checkout.

**-H, --hostonly**::
    Host-Only mode: Install only what is needed for booting the local host
    instead of a generic host and generate host-specific configuration.
+
[WARNING]
====
If chrooted to another root other than the real root device, use "--fstab" and
provide a valid _/etc/fstab_.
====

**-N, --no-hostonly**::
    Disable Host-Only mode

**--hostonly-cmdline**:
    Store kernel command line arguments needed in the initramfs

**--no-hostonly-cmdline**:
    Do not store kernel command line arguments needed in the initramfs

**--no-hostonly-default-device**:
    Do not generate implicit host devices like root, swap, fstab, etc.
    Use "--mount" or "--add-device" to explicitly add devices as needed.

**--hostonly-i18n**:
    Install only needed keyboard and font files according to the host configuration (default).

**--no-hostonly-i18n**:
    Install all keyboard and font files available.

**--persistent-policy** _<policy>_::
    Use _<policy>_ to address disks and partitions.
    _<policy>_ can be any directory name found in /dev/disk.
    E.g. "by-uuid", "by-label"

**--fstab**::
    Use _/etc/fstab_ instead of _/proc/self/mountinfo_.

**--add-fstab** _<filename>_::
    Add entries of _<filename>_ to the initramfs /etc/fstab.

**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ [_<filesystem options>_ [_<dump frequency>_ [_<fsck order>_]]]"::
    Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ in the
    initramfs. _<filesystem options>_, _<dump options>_ and _<fsck order>_ can
    be specified, see fstab manpage for the details.
    The default _<filesystem options>_ is "defaults".
    The default _<dump frequency>_ is "0".
    the default _<fsck order>_ is "2".

**--mount** "_<mountpoint>_"::
    Like above, but _<device>_, _<filesystem type>_ and _<filesystem options>_
    are determined by looking at the current mounts.

**--add-device** _<device>_ ::
    Bring up _<device>_ in initramfs, _<device>_ should be the device name.
    This can be useful in hostonly mode for resume support when your swap is on
    LVM or an encrypted partition.
    [NB --device can be used for compatibility with earlier releases]

**-i, --include** _<SOURCE>_ _<TARGET>_::
    include the files in the SOURCE directory into the
    TARGET directory in the final initramfs. If SOURCE is a file, it will be
    installed to TARGET in the final initramfs. This parameter can be specified
    multiple times.

**-I, --install** _<file list>_::
    install the space separated list of files into the initramfs.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --install "/bin/foo /sbin/bar"  ...
----
===============================

**--install-optional** _<file list>_::
    install the space separated list of files into the initramfs, if they exist.

**--gzip**::
    Compress the generated initramfs using gzip. This will be done by default,
    unless another compression option or --no-compress is passed. Equivalent to
    "--compress=gzip -9"

**--bzip2**::
    Compress the generated initramfs using bzip2.
+
[WARNING]
====
Make sure your kernel has bzip2 decompression support compiled in, otherwise you
will not be able to boot. Equivalent to "--compress=bzip2"
====

**--lzma**::
    Compress the generated initramfs using lzma.
+
[WARNING]
====
Make sure your kernel has lzma decompression support compiled in, otherwise you
will not be able to boot. Equivalent to "lzma --compress=lzma -9"
====

**--xz**::
    Compress the generated initramfs using xz.
+
[WARNING]
====
Make sure your kernel has xz decompression support compiled in, otherwise you
will not be able to boot. Equivalent to
"lzma --compress=xz --check=crc32 --lzma2=dict=1MiB"
====

**--lzo**::
    Compress the generated initramfs using lzop.
[WARNING]
====
Make sure your kernel has lzo decompression support compiled in, otherwise you
will not be able to boot.
====

**--lz4**::
    Compress the generated initramfs using lz4.
[WARNING]
====
Make sure your kernel has lz4 decompression support compiled in, otherwise you
will not be able to boot.
====

**--zstd**::
    Compress the generated initramfs using Zstandard.
[WARNING]
====
Make sure your kernel has zstd decompression support compiled in, otherwise you
will not be able to boot.
====

**--compress** _<compressor>_::
    Compress the generated initramfs using the passed compression program. If
    you pass it just the name of a compression program, it will call that
    program with known-working arguments. If you pass a quoted string with
    arguments, it will be called with exactly those arguments. Depending on what
    you pass, this may result in an initramfs that the kernel cannot decompress.
    The default value can also be set via the _INITRD_COMPRESS_ environment variable.

**--no-compress**::
    Do not compress the generated initramfs. This will override any other
    compression options.

**--reproducible**::
    Create reproducible images.

**--no-reproducible**::
    Do not create reproducible images.

**--list-modules**::
    List all available dracut modules.

**-M, --show-modules**::
    Print included module's name to standard output during build.

**--keep**::
    Keep the initramfs temporary directory for debugging purposes.

**--printsize**::
    Print out the module install size

**--profile**:
    Output profile information of the build process

**--ro-mnt**:
    Mount / and /usr read-only by default.

**-L, --stdlog** _<level>_::
    [0-6] Specify logging level (to standard error)
----
          0 - suppress any messages
          1 - only fatal errors
          2 - all errors
          3 - warnings
          4 - info
          5 - debug info (here starts lots of output)
          6 - trace info (and even more)
----

**--regenerate-all**::
    Regenerate all initramfs images at the default location with the kernel
    versions found on the system. Additional parameters are passed through.

**--loginstall _<DIR>_**::
    Log all files installed from the host to _<DIR>_.

**--uefi**::
    Instead of creating an initramfs image, dracut will create an UEFI executable,
    which can be executed by an UEFI BIOS. The default output filename is
    _<EFI>/EFI/Linux/linux-$kernel$-<MACHINE_ID>-<BUILD_ID>.efi_. <EFI> might be
    _/efi_, _/boot_ or _/boot/efi_ depending on where the ESP partition is mounted.
    The <BUILD_ID> is taken from BUILD_ID in _/usr/lib/os-release_ or if it exists
    _/etc/os-release_ and is left out, if BUILD_ID is non-existant or empty.

**--no-uefi**::
    Disables UEFI mode.

**--no-machineid**::
    affects the default output filename of **--uefi** and will discard the <MACHINE_ID>
    part.

**--uefi-stub _<FILE>_**::
    Specifies the UEFI stub loader, which will load the attached kernel, initramfs and
    kernel command line and boots the kernel. The default is
    _$prefix/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_

**--uefi-splash-image _<FILE>_**::
    Specifies the UEFI stub loader's splash image. Requires bitmap (**.bmp**) image
    format.

**--kernel-image _<FILE>_**::
    Specifies the kernel image, which to include in the UEFI executable. The default is
    _/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_

**--check-supported**::
    The kernel may be configured to check whether a module is
    supported by the vendor before allowing it to be loaded.  On these
    systems, it's possible to generate an initramfs image that will
    fail to boot due to unsupported modules being refused.  This
    option enables a check that will issue a warning if a module built
    without the support option enabled is encountered while building
    the image.  Use of this option assumes that the kernel requires
    supported modules and will issue a warning on every module if used
    otherwise.

**--enhanced-cpio**::
    Attempt to use the dracut-cpio binary, which optimizes archive creation for
    copy-on-write filesystems by using the copy_file_range(2) syscall via Rust's
    io::copy(). When specified, initramfs archives are also padded to ensure
    optimal data alignment for extent sharing. To retain reflink data
    deduplication benefits, this should be used alongside the **--no-compress**
    and **--no-strip** parameters, with initramfs source files, **--tmpdir**
    staging area and destination all on the same copy-on-write capable filesystem.

ENVIRONMENT
-----------

_INITRD_COMPRESS_::
    sets the default compression program. See **--compress**.

_DRACUT_LDCONFIG_::
    sets the _ldconfig_ program path and options. Optional.
    Used for **--sysroot**.
+
Default:
    _ldconfig_

_DRACUT_LDD_::
    sets the _ldd_ program path and options. Optional.
    Used for **--sysroot**.
+
Default:
    _ldd_

_DRACUT_TESTBIN_::
    sets the initially tested binary for detecting library paths.
    Optional. Used for **--sysroot**. In the cross-compiled sysroot,
    the default value (_/bin/sh_) is unusable, as it is an absolute
    symlink and points outside the sysroot directory.
+
Default:
    _/bin/sh_

_DRACUT_INSTALL_::
    overrides path and options for executing _dracut-install_ internally.
    Optional. Can be used to debug _dracut-install_ while running the
    main dracut script.
+
Default:
    _dracut-install_
+
Example:
    DRACUT_INSTALL="valgrind dracut-install"

_DRACUT_COMPRESS_BZIP2_::
_DRACUT_COMPRESS_BZIP2_::
_DRACUT_COMPRESS_LBZIP2_::
_DRACUT_COMPRESS_LZMA_::
_DRACUT_COMPRESS_XZ_::
_DRACUT_COMPRESS_GZIP_::
_DRACUT_COMPRESS_PIGZ_::
_DRACUT_COMPRESS_LZOP_::
_DRACUT_COMPRESS_ZSTD_::
_DRACUT_COMPRESS_LZ4_::
_DRACUT_COMPRESS_CAT_::
    overrides for compression utilities to support using them from
    non-standard paths.
+
Default values are the default compression utility names to be found in **PATH**.

_DRACUT_ARCH_::
    overrides the value of **uname -m**. Used for **--sysroot**.
+
Default:
    _empty_ (the value of **uname -m** on the host system)

_SYSTEMD_VERSION_::
    overrides systemd version. Used for **--sysroot**.

_SYSTEMCTL_::
    overrides the systemctl binary. Used for **--sysroot**.

_NM_VERSION_::
    overrides the NetworkManager version. Used for **--sysroot**.

_DRACUT_INSTALL_PATH_::
    overrides **PATH** environment for **dracut-install** to look for
    binaries relative to **--sysroot**. In a cross-compiled environment
    (e.g. Yocto), PATH points to natively built binaries that are not
    in the host's /bin, /usr/bin, etc. **dracut-install** still needs plain
    /bin and /usr/bin that are relative to the cross-compiled sysroot.
+
Default:
    _PATH_

_DRACUT_INSTALL_LOG_TARGET_::
    overrides **DRACUT_LOG_TARGET** for **dracut-install**. It allows
    running **dracut-install* to run with different log target that
    **dracut** runs with.
+
Default:
    _DRACUT_LOG_TARGET_

_DRACUT_INSTALL_LOG_LEVEL_::
    overrides **DRACUT_LOG_LEVEL** for **dracut-install**. It allows
    running **dracut-install* to run with different log level that
    **dracut** runs with.
+
Default:
    _DRACUT_LOG_LEVEL_

FILES
-----
_/var/log/dracut.log_::
    logfile of initramfs image creation

_/tmp/dracut.log_::
    logfile of initramfs image creation, if _/var/log/dracut.log_ is not
    writable

_/etc/dracut.conf_::
    see dracut.conf5

_/etc/dracut.conf.d/*.conf_::
    see dracut.conf5

_/usr/lib/dracut/dracut.conf.d/*.conf_::
    see dracut.conf5

Configuration in the initramfs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_/etc/conf.d/_::
    Any files found in _/etc/conf.d/_ will be sourced in the initramfs to
    set initial values. Command line options will override these values
    set in the configuration files.

_/etc/cmdline_::
    Can contain additional command line options. Deprecated, better use
    /etc/cmdline.d/*.conf.

_/etc/cmdline.d/*.conf_::
    Can contain additional command line options.

AVAILABILITY
------------
The dracut command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]

AUTHORS
-------
Harald Hoyer

Victor Lowther

Amadeusz Żołnowski

Hannes Reinecke

Daniel Molkentin

Will Woods

Philippe Seewer

Warren Togami

SEE ALSO
--------
*dracut.cmdline*(7) *dracut.conf*(5) *lsinitrd*(1)
  07070100000040000081A400000000000000000000000164DF2CB800001D1C000000000000000000000000000000000000002D00000000dracut-055+suse.347.gdcb9bdbf/man/dracut.asc  dracut {mainversion}
====================
:author: Harald Hoyer
:email: harald@redhat.com
:revnumber: {version}
:language: bash

= Introduction
This section is a modified version of
http://en.wikipedia.org/wiki/Initrd which is licensed under the
Creative Commons Attribution/Share-Alike License.

== Definition
An _initial ramdisk_ is a temporary file system used in the boot process of the
Linux kernel. _initrd_ and _initramfs_ refer to slightly different schemes for
loading this file system into memory. Both are commonly used to make
preparations before the real root file system can be mounted.

== Rationale
Many Linux distributions ship a single, generic kernel image that is intended to
boot as wide a variety of hardware as possible. The device drivers for this
generic kernel image are included as loadable modules, as it is not possible to
statically compile them all into the one kernel without making it too large to
boot from computers with limited memory or from lower-capacity media like floppy
disks.

This then raises the problem of detecting and loading the modules necessary to
mount the root file system at boot time (or, for that matter, deducing where or
what the root file system is).

To further complicate matters, the root file system may be on a software RAID
volume, LVM, NFS (on diskless workstations), or on an encrypted partition. All
of these require special preparations to mount.

Another complication is kernel support for hibernation, which suspends the
computer to disk by dumping an image of the entire system to a swap partition or
a regular file, then powering off. On next boot, this image has to be made
accessible before it can be loaded back into memory.

To avoid having to hardcode handling for so many special cases into the kernel,
an initial boot stage with a temporary root file system
—now dubbed early user space— is used.  This root file system would contain
user-space helpers that would do the hardware detection, module loading and
device discovery necessary to get the real root file system mounted.

== Implementation
An image of this initial root file system (along with the kernel image) must be
stored somewhere accessible by the Linux bootloader or the boot firmware of the
computer. This can be:

* The root file system itself
* A boot image on an optical disc
* A small ext2/ext3 or FAT-formatted partition on a local disk
  (a _boot partition_)
* A TFTP server (on systems that can boot from Ethernet)

The bootloader will load the kernel and initial root file system image into
memory and then start the kernel, passing in the memory address of the image.

Depending on which algorithms were compiled statically into it, the kernel can
currently unpack initrd/initramfs images compressed with gzip, bzip2 and LZMA.

== Mount preparations
dracut can generate a customized initramfs image which contains only whatever is
necessary to boot some particular computer, such as ATA, SCSI and filesystem
kernel modules (host-only mode).

dracut can also generate a more generic initramfs image (default mode).

dracut's initramfs starts only with the device name of the root file system (or
its UUID) and must discover everything else at boot time. A complex cascade of
tasks must be performed to get the root file system mounted:

* Any hardware drivers that the boot process depends on must be loaded. All
kernel modules for common storage devices are packed onto the initramfs and then
udev pulls in modules matching the computer's detected hardware.

* On systems which display a boot rd.splash screen, the video hardware must be
initialized and a user-space helper started to paint animations onto the display
in lockstep with the boot process.

* If the root file system is on NFS, dracut does then:
** Bring up the primary network interface.
** Invoke a DHCP client, with which it can obtain a DHCP lease.
** Extract the name of the NFS share and the address of the NFS server from the
lease.
** Mount the NFS share.

* If the root file system appears to be on a software RAID device, there is no
way of knowing which devices the RAID volume spans; the standard MD utilities
must be invoked to scan all available block devices with a raid signature and
bring the required ones online.

* If the root file system appears to be on a logical volume, the LVM utilities
must be invoked to scan for and activate the volume group containing it.

* If the root file system is on an encrypted block device:
** Invoke a helper script to prompt the user to type in a passphrase and/or
insert a hardware token (such as a smart card or a USB security dongle).

* Create a decryption target with the device mapper.

dracut uses udev, an event-driven hotplug agent, which invokes helper programs
as hardware devices, disk partitions and storage volumes matching certain rules
come online. This allows discovery to run in parallel, and to progressively
cascade into arbitrary nestings of LVM, RAID or encryption to get at the root
file system.

When the root file system finally becomes visible:

* Any maintenance tasks which cannot run on a mounted root file system
are done.
* The root file system is mounted read-only.
* Any processes which must continue running (such as the rd.splash screen helper
and its command FIFO) are hoisted into the newly-mounted root file system.

The final root file system cannot simply be mounted over /, since that would
make the scripts and tools on the initial root file system inaccessible for any
final cleanup tasks. On an initramfs, the initial root file system cannot be
rotated away. Instead, it is simply emptied and the final root file system
mounted over the top.

If the systemd module is used in the initramfs, the ordering of the services
started looks like <<dracutbootup7>>.

== Dracut on shutdown

On a systemd driven system, the dracut initramfs is also used for the shutdown
procedure.

The following steps are executed during a shutdown:

* systemd switches to the shutdown.target
* systemd starts
  $prefix/lib/systemd/system/shutdown.target.wants/dracut-shutdown.service
* dracut-shutdown.service executes /usr/lib/dracut/dracut-initramfs-restore
  which unpacks the initramfs to /run/initramfs
* systemd finishes shutdown.target
* systemd kills all processes
* systemd tries to unmount everything and mounts the remaining read-only
* systemd checks, if there is a /run/initramfs/shutdown executable
* if yes, it does a pivot_root to /run/initramfs and executes ./shutdown.
  The old root is then mounted on /oldroot.
  /usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable.
* shutdown will try to unmount every /oldroot mount and calls the various
  shutdown hooks from the dracut modules

This ensures, that all devices are disassembled and unmounted cleanly.

= User Manual

:leveloffset: 1
include::dracut.8.asc[]

:leveloffset: 1
[[dracutconf5]]
include::dracut.conf.5.asc[]

[[dracutcmdline7]]
include::dracut.cmdline.7.asc[]

[[lsinitrd1]]
include::lsinitrd.1.asc[]

= Developer Manual

:leveloffset: 1
[[dracutmodules7]]
include::dracut.modules.7.asc[]

[[dracutbootup7]]
include::dracut.bootup.7.asc[]

:leveloffset: 0
[appendix]
License
-------
This work is licensed under the Creative Commons Attribution/Share-Alike
License. To view a copy of this license, visit
http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

07070100000041000081A400000000000000000000000164DF2CB800001777000000000000000000000000000000000000003600000000dracut-055+suse.347.gdcb9bdbf/man/dracut.bootup.7.asc DRACUT.BOOTUP(7)
================
:doctype: manpage
:man source:   dracut
:man manual:   dracut
:man version:  {version}

NAME
----
dracut.bootup - boot ordering in the initramfs

DESCRIPTION
-----------

This flow chart illustrates the ordering of the services, if systemd is used in
the dracut initramfs.
----

                                    systemd-journal.socket
                                               |
                                               v
                                    dracut-cmdline.service
                                               |
                                               v
                                    dracut-pre-udev.service
                                               |
                                               v
                                     systemd-udevd.service
                                               |
                                               v
local-fs-pre.target                dracut-pre-trigger.service
         |                                     |
         v                                     v
 (various mounts)  (various swap  systemd-udev-trigger.service
         |           devices...)               |             (various low-level   (various low-level
         |               |                     |             services: seed,       API VFS mounts:
         v               v                     v             tmpfiles, random     mqueue, configfs,
  local-fs.target   swap.target     dracut-initqueue.service    sysctl, ...)        debugfs, ...)
         |               |                     |                    |                    |
         \_______________|____________________ | ___________________|____________________/
                                              \|/
                                               v
                                        sysinit.target
                                               |
                             _________________/|\___________________
                            /                  |                    \
                            |                  |                    |
                            v                  |                    v
                        (various               |              rescue.service
                       sockets...)             |                    |
                            |                  |                    v
                            v                  |              rescue.target
                     sockets.target            |
                            |                  |
                            \_________________ |                                 emergency.service
                                              \|                                         |
                                               v                                         v
                                         basic.target                             emergency.target
                                               |
                        ______________________/|
                       /                       |
                       |                       v
                       |            dracut-pre-mount.service
                       |                       |
                       |                       v
                       |                  sysroot.mount
                       |                       |
                       |                       v
                       |             initrd-root-fs.target
           (custom initrd services)            |
                       |                       v
                       |             dracut-mount.service
                       |                       |
                       |                       v
                       |            initrd-parse-etc.service
                       |                       |
                       |                       v
                       |            (sysroot-usr.mount and
                       |             various mounts marked
                       |               with fstab option
                       |                x-initrd.mount)
                       |                       |
                       |                       v
                       |                initrd-fs.target
                       \______________________ |
                                              \|
                                               v
                                          initrd.target
                                               |
                                               v
                                    dracut-pre-pivot.service
                                               |
                                               v
                                     initrd-cleanup.service
                                          isolates to
                                    initrd-switch-root.target
                                               |
                                               v
                        ______________________/|
                       /                       |
                       |        initrd-udevadm-cleanup-db.service
                       |                       |
           (custom initrd services)            |
                       |                       |
                       \______________________ |
                                              \|
                                               v
                                   initrd-switch-root.target
                                               |
                                               v
                                   initrd-switch-root.service
                                               |
                                               v
                                          switch-root
----


AUTHOR
------
Harald Hoyer

SEE ALSO
--------
*dracut*(8) *bootup*(7)
 07070100000042000081A400000000000000000000000164DF2CB80000BE56000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/man/dracut.cmdline.7.asc    DRACUT.CMDLINE(7)
=================
:doctype: manpage
:man source:   dracut
:man manual:   dracut
:man version:  {version}

NAME
----
dracut.cmdline - dracut kernel command line options

DESCRIPTION
-----------
The root device used by the kernel is specified in the boot configuration
file on the kernel command line, as always.

The traditional _root=/dev/sda1_ style device specification is allowed, but not
encouraged. The root device should better be identified by LABEL or UUID. If a
label is used, as in _root=LABEL=<label_of_root>_ the initramfs will search all
available devices for a filesystem with the appropriate label, and mount that
device as the root filesystem. _root=UUID=<uuidnumber>_ will mount the partition
with that UUID as the root filesystem.

In the following all kernel command line parameters, which are processed by
dracut, are described.

"rd.*" parameters mentioned without "=" are boolean parameters. They can be
turned on/off by setting them to {0|1}. If the assignment with "=" is missing
"=1" is implied. For example _rd.info_ can be turned off with _rd.info=0_ or
turned on with _rd.info=1_ or _rd.info_. The last value in the kernel command
line is the value, which is honored.

Standard
~~~~~~~~
**init=**__<path to real init>__::
    specify the path to the init program to be started after the initramfs has
    finished

**root=**__<path to blockdevice>__::
    specify the block device to use as the root filesystem.
+
[listing]
.Example
--
root=/dev/sda1
root=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
root=/dev/disk/by-label/Root
root=LABEL=Root
root=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
root=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
root=PARTUUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
--

**rootfstype=**__<filesystem type>__:: "auto" if not specified.
+
[listing]
.Example
--
rootfstype=ext3
--

**rootflags=**__<mount options>__::
    specify additional mount options for the root filesystem. If not set,
    _/etc/fstab_ of the real root will be parsed for special mount options and
    mounted accordingly.

**ro**::
    force mounting _/_ and _/usr_ (if it is a separate device) read-only.  If
    none of ro and rw is present, both are mounted according to _/etc/fstab_.

**rw**::
    force mounting _/_ and _/usr_ (if it is a separate device) read-write.
    See also ro option.

**rootfallback=**__<path to blockdevice>__::
    specify the block device to use as the root filesystem, if the normal root
    cannot be found. This can only be a simple block device with a simple file
    system, for which the filesystem driver is either compiled in, or added
    manually to the initramfs. This parameter can be specified multiple times.

**rd.auto** **rd.auto=1**::
    enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or
    lvm. Default is off as of dracut version >= 024.

**rd.hostonly=0**::
    removes all compiled in configuration of the host system the initramfs image
    was built on. This helps booting, if any disk layout changed, especially in
    combination with rd.auto or other parameters specifying the layout.

**rd.cmdline=ask**::
    prompts the user for additional kernel command line parameters

**rd.fstab=0**::
    do not honor special mount options for the root filesystem found in
    _/etc/fstab_ of the real root.

**resume=**__<path to resume partition>__::
    resume from a swap partition
+
[listing]
.Example
--
resume=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
resume=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
--

**rd.skipfsck**::
    skip fsck for rootfs and _/usr_.  If you're mounting _/usr_ read-only and
    the init system performs fsck before remount, you might want to use this
    option to avoid duplication.

iso-scan/filename
~~~~~~~~~~~~~~~~~

Mount all mountable devices and search for ISO pointed by the argument. When
the ISO is found set it up as a loop device. Device containing this ISO
image will stay mounted at /run/initramfs/isoscandev.
Using iso-scan/filename with a Fedora/Red Hat/CentOS Live iso should just work
by copying the original kernel cmdline parameters.

[listing]
.Example
--
menuentry 'Live Fedora 20' --class fedora --class gnu-linux --class gnu --class os {
    set isolabel=Fedora-Live-LXDE-x86_64-20-1
    set isofile="/boot/iso/Fedora-Live-LXDE-x86_64-20-1.iso"
    loopback loop $isofile
    linux (loop)/isolinux/vmlinuz0 boot=isolinux iso-scan/filename=$isofile root=live:LABEL=$isolabel ro rd.live.image quiet rhgb
    initrd (loop)/isolinux/initrd0.img
}
--

Misc
~~~~
**rd.emergency=**__[reboot|poweroff|halt]__::
    specify, what action to execute in case of a critical failure. rd.shell=0 also
    be specified.

**rd.driver.blacklist=**__<drivername>__[,__<drivername>__,...]::
    do not load kernel module <drivername>. This parameter can be specified
    multiple times.

**rd.driver.pre=**__<drivername>__[,__<drivername>__,...]::
    force loading kernel module <drivername>. This parameter can be specified
    multiple times.

**rd.driver.post=**__<drivername>__[,__<drivername>__,...]::
    force loading kernel module <drivername> after all automatic loading modules
    have been loaded. This parameter can be specified multiple times.

**rd.retry=**__<seconds>__::
    specify how long dracut should retry the initqueue to configure devices.
    The default is 30 seconds. After 2/3 of the time, degraded raids are force
    started. If you have hardware, which takes a very long time to announce its
    drives, you might want to extend this value.

**rd.timeout=**__<seconds>__::
    specify how long dracut should wait for devices to appear. The
    default is '0', which means 'forever'. Note that this timeout
    should be longer than rd.retry to allow for proper configuration.

**rd.noverifyssl**::
    accept self-signed certificates for ssl downloads.

**rd.ctty=**__<terminal device>__::
   specify the controlling terminal for the console.
   This is useful, if you have multiple "console=" arguments.

**rd.shutdown.timeout.umount=**__<seconds>__::
    specify how long dracut should wait for an individual umount to finish
    during shutdown. This avoids the system from blocking when unmounting a file
    system cannot complete and waits indefinitely. Value '0' means to wait
    'forever'. The default is 90 seconds.

[[dracutkerneldebug]]
Debug
~~~~~
If you are dropped to an emergency shell, the file
_/run/initramfs/rdsosreport.txt_ is created, which can be saved to a (to be
mounted by hand) partition (usually /boot) or a USB stick. Additional debugging
info can be produced by adding **rd.debug** to the kernel command line.
_/run/initramfs/rdsosreport.txt_ contains all logs and the output of some tools.
It should be attached to any report about dracut problems.

**rd.info**::
    print informational output though "quiet" is set

**rd.shell**::
    allow dropping to a shell, if root mounting fails

**rd.debug**::
    set -x for the dracut shell.
    If systemd is active in the initramfs, all output is logged to the systemd
    journal, which you can inspect with "journalctl -ab".
    If systemd is not active, the logs are written to dmesg and
    _/run/initramfs/init.log_.
    If "quiet" is set, it also logs to the console.

**rd.memdebug=[0-5]**::
    Print memory usage info at various points, set the verbose level from 0 to 5.
+
    Higher level means more debugging output:
+
----
    0 - no output
    1 - partial /proc/meminfo
    2 - /proc/meminfo
    3 - /proc/meminfo + /proc/slabinfo
    4 - /proc/meminfo + /proc/slabinfo + memstrack summary
        NOTE: memstrack is a memory tracing tool that tracks the total memory
              consumption, and peak memory consumption of each kernel modules
              and userspace progress during the whole initramfs runtime, report
              is genereted and the end of initramsfs run.
    5 - /proc/meminfo + /proc/slabinfo + memstrack (with top memory stacktrace)
        NOTE: memstrack (with top memory stacktrace) will print top memory
              allocation stack traces during the whole initramfs runtime.
----

**rd.break**::
    drop to a shell at the end

**rd.break=**__{cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot|cleanup}__::
    drop to a shell on defined breakpoint

**rd.udev.info**::
    set udev to loglevel info

**rd.udev.debug**::
    set udev to loglevel debug

I18N
~~~~
**rd.vconsole.keymap=**__<keymap base file name>__::
    keyboard translation table loaded by loadkeys; taken from keymaps directory;
    will be written as KEYMAP to _/etc/vconsole.conf_ in the initramfs.
+
[listing]
.Example
--
rd.vconsole.keymap=de-latin1-nodeadkeys
--

**rd.vconsole.keymap.ext=**__<list of keymap base file names>__::
    list of extra keymaps to bo loaded (sep. by space); will be written as
    EXT_KEYMAP to _/etc/vconsole.conf_ in the initramfs

**rd.vconsole.unicode**::
    boolean, indicating UTF-8 mode; will be written as UNICODE to
    _/etc/vconsole.conf_ in the initramfs

**rd.vconsole.font=**__<font base file name>__::
    console font; taken from consolefonts directory; will be written as FONT to
    _/etc/vconsole.conf_ in the initramfs.
+
[listing]
.Example
--
rd.vconsole.font=eurlatgr
--

**rd.vconsole.font.map=**__<console map base file name>__::
    see description of '-m' parameter in setfont manual; taken from consoletrans
    directory; will be written as FONT_MAP to _/etc/vconsole.conf_ in the
    initramfs

**rd.vconsole.font.unimap=**__<unicode table base file name>__::
    see description of '-u' parameter in setfont manual; taken from unimaps
    directory; will be written as FONT_UNIMAP to _/etc/vconsole.conf_ in the
    initramfs

**rd.locale.LANG=**__<locale>__::
    taken from the environment; if no UNICODE is defined we set its value in
    basis of LANG value (whether it ends with ".utf8" (or similar) or not); will
    be written as LANG to _/etc/locale.conf_ in the initramfs.
+
[listing]
.Example
--
rd.locale.LANG=pl_PL.utf8
--

**rd.locale.LC_ALL=**__<locale>__::
    taken from the environment; will be written as LC_ALL to _/etc/locale.conf_
    in the initramfs

LVM
~~~
**rd.lvm=0**::
    disable LVM detection

**rd.lvm.vg=**__<volume group name>__::
    only activate all logical volumes in the the volume groups with the given name.
    rd.lvm.vg can be specified multiple times on the kernel command line.

**rd.lvm.lv=**__<volume group name>/<logical volume name>__::
    only activate the logical volumes with the given name.
    rd.lvm.lv can be specified multiple times on the kernel command line.

**rd.lvm.conf=0**::
    remove any _/etc/lvm/lvm.conf_, which may exist in the initramfs

crypto LUKS
~~~~~~~~~~~
**rd.luks=0**::
    disable crypto LUKS detection

**rd.luks.uuid=**__<luks uuid>__::
    only activate the LUKS partitions with the given UUID. Any "luks-" of the
    LUKS UUID is removed before comparing to _<luks uuid>_.
    The comparisons also matches, if _<luks uuid>_ is only the beginning of the
    LUKS UUID, so you don't have to specify the full UUID.
    This parameter can be specified multiple times.
    _<luks uuid>_ may be prefixed by the keyword `keysource:`, see
    _rd.luks.key_ below.

**rd.luks.allow-discards=**__<luks uuid>__::
    Allow  using  of discards (TRIM) requests for LUKS partitions with the given
    UUID. Any "luks-" of the LUKS UUID is removed before comparing to
    _<luks uuid>_. The comparisons also matches, if _<luks uuid>_ is only the
    beginning of the LUKS UUID, so you don't have to specify the full UUID.
    This parameter can be specified multiple times.

**rd.luks.allow-discards**::
    Allow  using  of discards (TRIM) requests on all LUKS partitions.

**rd.luks.crypttab=0**::
    do not check, if LUKS partition is in _/etc/crypttab_

**rd.luks.timeout=**__<seconds>__::
    specify how long dracut should wait when waiting for the user to enter the
    password. This avoid blocking the boot if no password is entered. It does
    not apply to luks key. The default is '0', which means 'forever'.

crypto LUKS - key on removable device support
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

NB: If systemd is included in the dracut initrd, dracut's built in
removable device keying support won't work. systemd will prompt for
a password from the console even if you've supplied **rd.luks.key**.
You may be able to use standard systemd *fstab*(5) syntax to
get the same effect. If you do need **rd.luks.key** to work,
you will have to exclude the "systemd" dracut module and any modules
that depend on it. See *dracut.conf*(5) and
https://bugzilla.redhat.com/show_bug.cgi?id=905683 for more
information.

**rd.luks.key=**_<keypath>[:<keydev>[:<luksdev>]]_::
    _<keypath>_ is the pathname of a key file, relative to the root
    of the filesystem on some device. It's REQUIRED. When
    _<keypath>_ ends with '.gpg' it's considered to be key encrypted
    symmetrically with GPG.  You will be prompted for the GPG password on
    boot. GPG support comes with the 'crypt-gpg' module, which needs to be
    added explicitly.
+
_<keydev>_ identifies the device on which the key file resides. It may
be the kernel name of the device (should start with "/dev/"), a UUID
(prefixed with "UUID=") or a label (prefix with "LABEL="). You don't
have to specify a full UUID. Just its beginning will suffice, even if
its ambiguous. All matching devices will be probed.  This parameter is
recommended, but not required. If it's not present, all block devices will
be probed, which may significantly increase boot time.
+
If _<luksdev>_ is given, the specified key will only be used for
the specified LUKS device. Possible values are the same as for
_<keydev>_. Unless you have several LUKS devices, you don't have to
specify this parameter. The simplest usage is:
+
[listing]
.Example
--
rd.luks.key=/foo/bar.key
--
+
As you see, you can skip colons in such a case.

[NOTE]
===============================
Your LUKS partition must match your key file.

dracut provides keys to cryptsetup with _-d_ (an older alias for
_--key-file_). This uses the entire binary
content of the key file as part of the secret.  If
you pipe a password into cryptsetup *without* _-d_ or _--key-file_,
it will be treated as text user input, and only characters before
the first newline will be used. Therefore, when you're creating
an encrypted partition for dracut to mount, and you pipe a key into
_cryptsetup luksFormat_,you must use _-d -_.

Here is an example for a key encrypted with GPG (warning:
_--batch-mode_ will overwrite the device without asking for
confirmation):

[listing]
--
gpg --quiet --decrypt rootkey.gpg | \
cryptsetup --batch-mode --key-file - \
           luksFormat /dev/sda47
--

If you use unencrypted key files, just use the key file pathname
instead of the standard input. For a random key with 256 bits of
entropy, you might use:

[listing]
--
head -32c /dev/urandom > rootkey.key
cryptsetup --batch-mode --key-file rootkey.key \
           luksFormat /dev/sda47
--

You can also use regular key files on an encrypted _keydev_.

Compared to using GPG encrypted keyfiles on an unencrypted
device this provides the following advantages:

- you can unlock your disk(s) using multiple passphrases
- better security by not loosing the key stretching mechanism

To use an encrypted _keydev_ you *must* ensure that it becomes
available by using the keyword `keysource`, e.g.
`rd.luks.uuid=keysource:aaaa`
_aaaa_ being the uuid of the encrypted _keydev_.

Example:

Lets assume you have three disks _A_, _B_ and _C_ with the uuids
_aaaa_, _bbbb_ and _cccc_. +
You want to unlock _A_ and _B_ using keyfile _keyfile_. +
The unlocked volumes be _A'_, _B'_ and _C'_ with the uuids
_AAAA_, _BBBB_ and _CCCC_. +
_keyfile_ is saved on _C'_ as _/keyfile_.

One luks keyslot of each _A_, _B_ and _C_ is setup with a
passphrase. +
Another luks keyslot of each _A_ and _B_ is setup with _keyfile_.

To boot this configuration you could use:
[listing]
--
rd.luks.uuid=aaaa
rd.luks.uuid=bbbb
rd.luks.uuid=keysource:cccc
rd.luks.key=/keyfile:UUID=CCCC
--
Dracut asks for the passphrase for _C_ and uses the
keyfile to unlock _A_ and _B_. +
If getting the passphrase for _C_ fails it falls back to
asking for the passphrases for _A_ and _B_.

If you want _C'_ to stay unlocked, specify a luks name for
it, e.g. `rd.luks.name=cccc=mykeys`, otherwise it gets closed
when not needed anymore.
===============================

MD RAID
~~~~~~~
**rd.md=0**::
    disable MD RAID detection

**rd.md.imsm=0**::
    disable MD RAID for imsm/isw raids, use DM RAID instead

**rd.md.ddf=0**::
    disable MD RAID for SNIA ddf raids, use DM RAID instead

**rd.md.conf=0**::
    ignore mdadm.conf included in initramfs

**rd.md.waitclean=1**::
    wait for any resync, recovery, or reshape activity to finish before
    continuing

**rd.md.uuid=**__<md raid uuid>__::
    only activate the raid sets with the given UUID. This parameter can be
    specified multiple times.

DM RAID
~~~~~~~
**rd.dm=0**::
    disable DM RAID detection

**rd.dm.uuid=**__<dm raid uuid>__::
   only activate the raid sets with the given UUID. This parameter can be
   specified multiple times.

MULTIPATH
~~~~~~~~~
**rd.multipath=0**::
   disable multipath detection

**rd.multipath=default**::
   use default multipath settings

FIPS
~~~~
**rd.fips**::
    enable FIPS

**boot=**__<boot device>__::
    specify the device, where /boot is located.
+
[listing]
.Example
--
boot=/dev/sda1
boot=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
boot=UUID=<uuid>
boot=LABEL=<label>
--

**rd.fips.skipkernel**::
    skip checksum check of the kernel image. Useful, if the kernel image is not
    in a separate boot partition.

Network
~~~~~~~

[IMPORTANT]
=====================
It is recommended to either bind an interface to a MAC with the **ifname**
argument, or to use the systemd-udevd predictable network interface names.

Predictable network interface device names based on:

- firmware/bios-provided index numbers for on-board devices
- firmware-provided pci-express hotplug slot index number
- physical/geographical location of the hardware
- the interface's MAC address

See:
http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames

Two character prefixes based on the type of interface:

en:: ethernet
wl:: wlan
ww:: wwan

Type of names:

o<index>:: on-board device index number
s<slot>[f<function>][d<dev_id>]:: hotplug slot index number
x<MAC>:: MAC address
[P<domain>]p<bus>s<slot>[f<function>][d<dev_id>]:: PCI geographical location
[P<domain>]p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>]:: USB port number chain

All multi-function PCI devices will carry the [f<function>] number in the
device name, including the function 0 device.

When using PCI geography, The PCI domain is only prepended when it is not 0.

For USB devices the full chain of port numbers of hubs is composed. If the
name gets longer than the maximum number of 15 characters, the name is not
exported.
The usual USB configuration == 1 and interface == 0 values are suppressed.

PCI ethernet card with firmware index "1"::
* eno1

PCI ethernet card in hotplug slot with firmware index number::
* ens1

PCI ethernet multi-function card with 2 ports::
* enp2s0f0
* enp2s0f1

PCI wlan card::
* wlp3s0

USB built-in 3G modem::
* wwp0s29u1u4i6

USB Android phone::
* enp0s29u1u2
=====================

**ip=**__{dhcp|on|any|dhcp6|auto6|either6|link6|single-dhcp}__::
    dhcp|on|any::: get ip from dhcp server from all interfaces. If netroot=dhcp,
    loop sequentially through all interfaces (eth0, eth1, ...) and use the first
    with a valid DHCP root-path.

    single-dhcp::: Send DHCP on all available interfaces in parallel, as
    opposed to one after another. After the first DHCP response is received,
    stop DHCP on all other interfaces. This gives the fastest boot time by
    using the IP on interface for which DHCP succeeded first during early boot.
    Caveat: Does not apply to Network Manager and to SUSE using wicked.

    auto6::: IPv6 autoconfiguration

    dhcp6::: IPv6 DHCP

    either6::: if auto6 fails, then dhcp6

    link6::: bring up interface for IPv6 link-local addressing

**ip=**__<interface>__:__{dhcp|on|any|dhcp6|auto6|link6}__[:[__<mtu>__][:__<macaddr>__]]::
    This parameter can be specified multiple times.
+
=====================
dhcp|on|any|dhcp6::: get ip from dhcp server on a specific interface
auto6::: do IPv6 autoconfiguration
link6::: bring up interface for IPv6 link local address
<macaddr>::: optionally **set** <macaddr> on the <interface>. This
cannot be used in conjunction with the **ifname** argument for the
same <interface>.
=====================

**ip=**__<client-IP>__:[__<peer>__]:__<gateway-IP>__:__<netmask>__:__<client_hostname>__:__<interface>__:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__[:[__<mtu>__][:__<macaddr>__]]::
    explicit network configuration. If you want do define a IPv6 address, put it
    in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple
    times. __<peer>__ is optional and is the address of the remote endpoint
    for pointopoint interfaces and it may be followed by a slash and a decimal
    number, encoding the network prefix length.
+
=====================
<macaddr>::: optionally **set** <macaddr> on the <interface>. This
cannot be used in conjunction with the **ifname** argument for the
same <interface>.
=====================

**ip=**__<client-IP>__:[__<peer>__]:__<gateway-IP>__:__<netmask>__:__<client_hostname>__:__<interface>__:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__[:[__<dns1>__][:__<dns2>__]]::
    explicit network configuration. If you want do define a IPv6 address, put it
    in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple
    times. __<peer>__ is optional and is the address of the remote endpoint
    for pointopoint interfaces and it may be followed by a slash and a decimal
    number, encoding the network prefix length.

**ifname=**__<interface>__:__<MAC>__::
    Assign network device name <interface> (i.e. "bootnet") to the NIC with
    MAC <MAC>.
+
WARNING: Do **not** use the default kernel naming scheme for the interface name,
as it can conflict with the kernel names. So, don't use "eth[0-9]+" for the
interface name. Better name it "bootnet" or "bluesocket".

**rd.route=**__<net>__/__<netmask>__:__<gateway>__[:__<interface>__]::
    Add a static route with route options, which are separated by a colon.
    IPv6 addresses have to be put in brackets.
+
[listing]
.Example
--
    rd.route=192.168.200.0/24:192.168.100.222:ens10
    rd.route=192.168.200.0/24:192.168.100.222
    rd.route=192.168.200.0/24::ens10
    rd.route=[2001:DB8:3::/8]:[2001:DB8:2::1]:ens10
--

**bootdev=**__<interface>__::
    specify network interface to use routing and netroot information from.
    Required if multiple ip= lines are used.

**BOOTIF=**__<MAC>__::
    specify network interface to use routing and netroot information from.

**rd.bootif=0**::
    Disable BOOTIF parsing, which is provided by PXE

**nameserver=**__<IP>__ [**nameserver=**__<IP>__ ...]::
    specify nameserver(s) to use

**rd.peerdns=0**::
    Disable DNS setting of DHCP parameters.

**biosdevname=0**::
    boolean, turn off biosdevname network interface renaming

**rd.neednet=1**::
    boolean, bring up network even without netroot set

**vlan=**__<vlanname>__:__<phydevice>__::
    Setup vlan device named <vlanname> on <phydevice>.
    We support the four styles of vlan names: VLAN_PLUS_VID (vlan0005),
    VLAN_PLUS_VID_NO_PAD (vlan5), DEV_PLUS_VID (eth0.0005),
    DEV_PLUS_VID_NO_PAD (eth0.5)

**bond=**__<bondname>__[:__<bondslaves>__:[:__<options>__[:<mtu>]]]::
    Setup bonding device <bondname> on top of <bondslaves>.
    <bondslaves> is a comma-separated list of physical (ethernet) interfaces.
    <options> is a comma-separated list on bonding options (modinfo bonding for
    details) in format compatible with initscripts. If <options> includes
    multi-valued arp_ip_target option, then its values should be separated by
    semicolon. if the mtu is specified, it will be set on the bond master.
    Bond without parameters assumes
    bond=bond0:eth0,eth1:mode=balance-rr

**team=**__<teammaster>__:__<teamslaves>__[:__<teamrunner>__]::
    Setup team device <teammaster> on top of <teamslaves>.
    <teamslaves> is a comma-separated list of physical (ethernet) interfaces.
    <teamrunner> is the runner type to be used (see *teamd.conf*(5)); defaults to
    activebackup.
    Team without parameters assumes
    team=team0:eth0,eth1:activebackup

**bridge=**__<bridgename>__:__<ethnames>__::
    Setup bridge <bridgename> with <ethnames>. <ethnames> is a comma-separated
    list of physical (ethernet) interfaces. Bridge without parameters assumes
    bridge=br0:eth0

NFS
~~~
**root=**\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__]::
    mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given, use
    dhcp next_server. If server-ip is an IPv6 address it has to be put in
    brackets, e.g. [2001:DB8::1]. NFS options can be appended with the prefix
    ":" or "," and are separated by ",".

**root=**nfs:\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__], **root=**nfs4:\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__], **root=**__{dhcp|dhcp6}__::
    netroot=dhcp alone directs initrd to look at the DHCP root-path where NFS
    options can be specified.
+
[listing]
.Example
--
    root-path=<server-ip>:<root-dir>[,<nfs-options>]
    root-path=nfs:<server-ip>:<root-dir>[,<nfs-options>]
    root-path=nfs4:<server-ip>:<root-dir>[,<nfs-options>]
--

**root=**_/dev/nfs_ nfsroot=\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__]::
    _Deprecated!_ kernel Documentation_/filesystems/nfsroot.txt_ defines this
    method. This is supported by dracut, but not recommended.

**rd.nfs.domain=**__<NFSv4 domain name>__::
    Set the NFSv4 domain name. Will override the settings in _/etc/idmap.conf_.

**rd.net.dhcp.retry=**__<cnt>__::
    If this option is set, dracut will try to connect via dhcp <cnt> times before failing.
    Default is 1.

**rd.net.timeout.dhcp=**__<arg>__::
    If this option is set, dhclient is called with "-timeout <arg>".

**rd.net.timeout.iflink=**__<seconds>__::
    Wait <seconds> until link shows up. Default is 60 seconds.

**rd.net.timeout.ifup=**__<seconds>__::
    Wait <seconds> until link has state "UP". Default is 20 seconds.

**rd.net.timeout.route=**__<seconds>__::
    Wait <seconds> until route shows up. Default is 20 seconds.

**rd.net.timeout.ipv6dad=**__<seconds>__::
    Wait <seconds> until IPv6 DAD is finished. Default is 50 seconds.

**rd.net.timeout.ipv6auto=**__<seconds>__::
    Wait <seconds> until IPv6 automatic addresses are assigned. Default is 40 seconds.

**rd.net.timeout.carrier=**__<seconds>__::
    Wait <seconds> until carrier is recognized. Default is 10 seconds.

CIFS
~~~
**root=**cifs://[__<username>__[:__<password>__]@]__<server-ip>__:__<root-dir>__::
    mount cifs share from <server-ip>:/<root-dir>, if no server-ip is given, use
    dhcp next_server. if server-ip is an IPv6 address it has to be put in
    brackets, e.g. [2001:DB8::1]. If a username or password are not specified
as part of the root, then they must be passed on the command line through
cifsuser/cifspass.
+
WARNING: Passwords specified on the kernel command line are visible for all
users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the
network, when using DHCP with DHCP root-path.

**cifsuser**=__<username>__::
    Set the cifs username, if not specified as part of the root.

**cifspass**=__<password>__::
    Set the cifs password, if not specified as part of the root.
+
WARNING: Passwords specified on the kernel command line are visible for all
users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the
network, when using DHCP with DHCP root-path.

iSCSI
~~~~~
**root=**iscsi:[__<username>__:__<password>__[:__<reverse>__:__<password>__]@][__<servername>__]:[__<protocol>__]:[__<port>__][:[__<iscsi_iface_name>__]:[__<netdev_name>__]]:[__<LUN>__]:__<targetname>__::
    protocol defaults to "6", LUN defaults to "0". If the "servername" field is
    provided by BOOTP or DHCP, then that field is used in conjunction with other
    associated fields to contact the boot server in the Boot stage. However, if
    the "servername" field is not provided, then the "targetname" field is then
    used in the Discovery Service stage in conjunction with other associated
    fields. See
    link:$$http://tools.ietf.org/html/rfc4173#section-5$$[rfc4173].
+
WARNING: Passwords specified on the kernel command line are visible for all
users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the
network, when using DHCP with DHCP root-path.
+
[listing]
.Example
--
root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
--
+
If servername is an IPv6 address, it has to be put in brackets:
+
[listing]
.Example
--
root=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
--

**root=**__???__ **netroot=**iscsi:[__<username>__:__<password>__[:__<reverse>__:__<password>__]@][__<servername>__]:[__<protocol>__]:[__<port>__][:[__<iscsi_iface_name>__]:[__<netdev_name>__]]:[__<LUN>__]:__<targetname>__ ...::
    multiple netroot options allow setting up multiple iscsi disks:
+
[listing]
.Example
--
root=UUID=12424547
netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1
--
+
If servername is an IPv6 address, it has to be put in brackets:
+
[listing]
.Example
--
netroot=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
--
+
WARNING: Passwords specified on the kernel command line are visible for all
users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the
network, when using DHCP with DHCP root-path.
You may want to use rd.iscsi.firmware.

**root=**__???__ **rd.iscsi.initiator=**__<initiator>__ **rd.iscsi.target.name=**__<target name>__  **rd.iscsi.target.ip=**__<target ip>__ **rd.iscsi.target.port=**__<target port>__ **rd.iscsi.target.group=**__<target group>__ **rd.iscsi.username=**__<username>__ **rd.iscsi.password=**__<password>__ **rd.iscsi.in.username=**__<in username>__ **rd.iscsi.in.password=**__<in password>__::
    manually specify all iscsistart parameter (see **+iscsistart --help+**)
+
WARNING: Passwords specified on the kernel command line are visible for all
users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the
network, when using DHCP with DHCP root-path.
You may want to use rd.iscsi.firmware.

**root=**_???_ **netroot=**iscsi **rd.iscsi.firmware=1**::
 will read the iscsi parameter from the BIOS firmware

**rd.iscsi.login_retry_max=**__<num>__::
    maximum number of login retries

**rd.iscsi.param=**__<param>__::
    <param> will be passed as "--param <param>" to iscsistart.
    This parameter can be specified multiple times.
+
[listing]
.Example
--
"netroot=iscsi rd.iscsi.firmware=1 rd.iscsi.param=node.session.timeo.replacement_timeout=30"
--
+
will result in
+
[listing]
--
iscsistart -b --param node.session.timeo.replacement_timeout=30
--

**rd.iscsi.ibft** **rd.iscsi.ibft=1**:
    Turn on iBFT autoconfiguration for the interfaces

**rd.iscsi.mp** **rd.iscsi.mp=1**:
    Configure all iBFT interfaces, not only used for booting (multipath)

**rd.iscsi.waitnet=0**:
    Turn off waiting for all interfaces to be up before trying to login to the iSCSI targets.

**rd.iscsi.testroute=0**:
    Turn off checking, if the route to the iSCSI target IP is possible before trying to login.

FCoE
~~~~
**rd.fcoe=0**::
    disable FCoE and lldpad

**fcoe=**__<edd|interface|MAC>__:__{dcb|nodcb}__:__{fabric|vn2vn}__::
    Try to connect to a FCoE SAN through the NIC specified by _<interface>_ or
    _<MAC>_ or EDD settings. The second argument specifies if DCB
    should be used. The optional third argument specifies whether
    fabric or VN2VN mode should be used.
    This parameter can be specified multiple times.
+
NOTE: letters in the MAC-address must be lowercase!

NVMf
~~~~
**rd.nonvmf**::
    Disable NVMf

**rd.nvmf.hostnqn=**__<hostNQN>__::
    NVMe host NQN to use

**rd.nvmf.hostid=**__<hostID>__::
    NVMe host id to use

**rd.nvmf.discover=**__{rdma|fc|tcp}__,__<traddr>__,[__<host_traddr>__],[__<trsvcid>__]::
    Discover and connect to a NVMe-over-Fabric controller specified by
    _<traddr>_ and the optionally _<host_traddr>_ or _<trsvcid>_.
    The first argument specifies the transport to use; currently only
    'rdma', 'fc', or 'tcp' are supported.
    This parameter can be specified multiple times.
+
[listing]
.Examples
--
rd.nvmf.discover=tcp,192.168.10.10,,4420
rd.nvmf.discover=fc,nn-0x201700a05634f5bf:pn-0x201900a05634f5bf,nn-0x200000109b579ef3:pn-0x100000109b579ef3
--

**rd.nvmf.discover=fc,auto**::
    This special syntax determines that Fibre Channel autodiscovery
    is to be used rather than regular NVMe discovery. It takes precedence
    over all other _rd.nvmf.discover=_ arguments.

NBD
~~~
**root=**??? **netroot=**nbd:__<server>__:__<port/exportname>__[:__<fstype>__[:__<mountopts>__[:__<nbdopts>__]]]::
    mount nbd share from <server>.
+
NOTE:
    If "exportname" instead of "port" is given the standard port is used.
    Newer versions of nbd are only supported with "exportname".

**root=/dev/root netroot=dhcp** with **dhcp** **root-path=**nbd:__<server>__:__<port/exportname>__[:__<fstype>__[:__<mountopts>__[:__<nbdopts>__]]]::
    netroot=dhcp alone directs initrd to look at the DHCP root-path where NBD
    options can be specified. This syntax is only usable in cases where you are
    directly mounting the volume as the rootfs.
+
NOTE:
    If "exportname" instead of "port" is given the standard port is used.
    Newer versions of nbd are only supported with "exportname".

DASD
~~~~
**rd.dasd=**....::
    same syntax as the kernel module parameter (s390 only)

ZFCP
~~~~
**rd.zfcp=**__<zfcp adaptor device bus ID>__,__<WWPN>__,__<FCPLUN>__::
    rd.zfcp can be specified multiple times on the kernel command
    line.

**rd.zfcp=**__<zfcp adaptor device bus ID>__::
    If NPIV is enabled and the 'allow_lun_scan' parameter to the zfcp
    module is set to 'Y' then the zfcp adaptor will be initiating a
    scan internally and the <WWPN> and <FCPLUN> parameters can be omitted.
+
[listing]
.Example
--
rd.zfcp=0.0.4000,0x5005076300C213e9,0x5022000000000000
rd.zfcp=0.0.4000
--

**rd.zfcp.conf=0**::
    ignore zfcp.conf included in the initramfs

ZNET
~~~~
**rd.znet=**__<nettype>__,__<subchannels>__,__<options>__::
    The whole parameter is appended to /etc/ccw.conf, which is used on
    RHEL/Fedora with ccw_init, which is called from udev for certain
    devices on z-series.
    rd.znet can be specified multiple times on the kernel command line.

**rd.znet_ifname=**__<ifname>__:__<subchannels>__::
    Assign network device name <interface> (i.e. "bootnet") to the NIC
    corresponds to the subchannels. This is useful when dracut's default
    "ifname=" doesn't work due to device having a changing MAC address.
+
[listing]
.Example
--
rd.znet=qeth,0.0.0600,0.0.0601,0.0.0602,layer2=1,portname=foo
rd.znet=ctc,0.0.0600,0.0.0601,protocol=bar
--

Booting live images
~~~~~~~~~~~~~~~~~~~
Dracut offers multiple options for live booted images:

=====================
SquashFS with read-only filesystem image::: The system will boot with a
read-only filesystem from the SquashFS and apply a writable Device-mapper
snapshot or an OverlayFS overlay mount for the read-only base filesystem.  This
method ensures a relatively fast boot and lower RAM usage. Users **must be
careful** to avoid writing too many blocks to a snapshot volume.  Once the
blocks of the snapshot overlay are exhausted, the root filesystem becomes
read-only and may cause application failures.  The snapshot overlay file is
marked 'Overflow', and a difficult recovery is required to repair and enlarge
the overlay offline.  Non-persistent overlays are sparse files in RAM that only
consume content space as required blocks are allocated.  They default to an
apparent size of 32 GiB in RAM.  The size can be adjusted with the
**rd.live.overlay.size=** kernel command line option.
+
The filesystem structure is traditionally expected to be:
+
[listing]
--
squashfs.img          |  SquashFS from LiveCD .iso
   !(mount)
   /LiveOS
       |- rootfs.img  |  Filesystem image to mount read-only
            !(mount)
            /bin      |  Live filesystem
            /boot     |
            /dev      |
            ...       |
--
+
For OverlayFS mount overlays, the filesystem structure may also be a direct
compression of the root filesystem:
+
[listing]
--
squashfs.img          |  SquashFS from LiveCD .iso
   !(mount)
   /bin               |  Live filesystem
   /boot              |
   /dev               |
   ...                |
--
+
Dracut uses one of the overlay methods of live booting by default.  No
additional command line options are required other than **root=live:<URL>** to
specify the location of your squashed filesystem.
+
- The compressed SquashFS image can be copied during boot to RAM at
`/run/initramfs/squashed.img` by using the **rd.live.ram=1** option.
- A device with a persistent overlay can be booted read-only by using the
**rd.live.overlay.readonly** option on the kernel command line.  This will
either cause a temporary, writable overlay to be stacked over a read-only
snapshot of the root filesystem or the OverlayFS mount will use an additional
lower layer with the root filesystem.
+
Uncompressed live filesystem image:::
When the live system was installed with the '--skipcompress' option of the
__livecd-iso-to-disk__ installation script for Live USB devices, the root
filesystem image, __rootfs.img__, is expanded on installation and no SquashFS
is involved during boot.
+
- If **rd.live.ram=1** is used in this situation, the full, uncompressed
root filesystem is copied during boot to `/run/initramfs/rootfs.img` in the
`/run` tmpfs.
+
- If **rd.live.overlay=none** is provided as a kernel command line option,
a writable, linear Device-mapper target is created on boot with no overlay.

Writable filesystem image:::
The system will retrieve a compressed filesystem image, extract it to
`/run/initramfs/fsimg/rootfs.img`, connect it to a loop device, create a
writable, linear Device-mapper target at `/dev/mapper/live-rw`, and mount that
as a writable volume at `/`.  More RAM is required during boot but the live
filesystem is easier to manage if it becomes full.  Users can make a filesystem
image of any size and that size will be maintained when the system boots. There
is no persistence of root filesystem changes between boots with this option.
+
The filesystem structure is expected to be:
+
[listing]
--
rootfs.tgz            |  Compressed tarball containing filesystem image
   !(unpack)
   /rootfs.img        |  Filesystem image at /run/initramfs/fsimg/
      !(mount)
      /bin            |  Live filesystem
      /boot           |
      /dev            |
      ...             |
--
+
To use this boot option, ensure that **rd.writable.fsimg=1** is in your kernel
command line and add the **root=live:<URL>** to specify the location
of your compressed filesystem image tarball or SquashFS image.
=====================

**rd.writable.fsimg=**1::
Enables writable filesystem support.  The system will boot with a fully
writable (but non-persistent) filesystem without snapshots __(see notes above
about available live boot options)__.  You can use the **rootflags** option to
set mount options for the live filesystem as well __(see documentation about
rootflags in the **Standard** section above)__.
This implies that the whole image is copied to RAM before the boot continues.
+
NOTE: There must be enough free RAM available to hold the complete image.
+
This method is very suitable for diskless boots.

**root=**live:__<url>__::
Boots a live image retrieved from __<url>__.  Requires the dracut 'livenet'
module.  Valid handlers: __http, https, ftp, torrent, tftp__.
+
[listing]
.Examples
--
root=live:http://example.com/liveboot.img
root=live:ftp://ftp.example.com/liveboot.img
root=live:torrent://example.com/liveboot.img.torrent
--

**rd.live.debug=**1::
Enables debug output from the live boot process.

**rd.live.dir=**__<path>__::
Specifies the directory within the boot device where the squashfs.img or
rootfs.img can be found.  By default, this is `/LiveOS`.

**rd.live.squashimg=**__<filename of SquashFS image>__::
Specifies the filename for a SquashFS image of the root filesystem.
By default, this is __squashfs.img__.

**rd.live.ram=**1::
Copy the complete image to RAM and use this for booting. This is useful
when the image resides on, e.g., a DVD which needs to be ejected later on.

**rd.live.overlay={**__<devspec>__[:__{<pathspec>|auto}__]|__none__}::
Manage the usage of a permanent overlay.
+
--
* _<devspec>_ specifies the path to a device with a mountable filesystem.
* _<pathspec>_ is the path to a file within that filesystem, which shall be
used to persist the changes made to the device specified by the
**root=live:__<url>__** option.
+
The default _pathspec_, when _auto_ or no _:<pathspec>_ is given, is
`/<rd.live.dir>/overlay-<label>-<uuid>`, where _<label>_ is the
device LABEL, and _<uuid>_ is the device UUID.
* _none_ (the word itself) specifies that no overlay will be used, such as when
an uncompressed, writable live root filesystem is available.
+
If a persistent overlay __is detected__ at the standard LiveOS path, the
overlay & overlay type detected, whether Device-mapper or OverlayFS, will be
used.
--
+
[listing]
.Examples
--
rd.live.overlay=/dev/sdb1:persistent-overlay.img
rd.live.overlay=UUID=99440c1f-8daa-41bf-b965-b7240a8996f4
--

**rd.live.overlay.size=**__<size_MiB>__::
Specifies a non-persistent Device-mapper overlay size in MiB.  The default is
_32768_.

**rd.live.overlay.readonly=**1::
This is used to boot with a normally read-write persistent overlay in a
read-only mode.  With this option, either an additional, non-persistent,
writable snapshot overlay will be stacked over a read-only snapshot,
`/dev/mapper/live‑ro`, of the base filesystem with the persistent overlay, or a
read-only loop device, in the case of a writable __rootfs.img__, or an OverlayFS
mount will use the persistent overlay directory linked at `/run/overlayfs‑r` as
an additional lower layer along with the base root filesystem and apply a
transient, writable upper directory overlay, in order to complete the booted
root filesystem.

**rd.live.overlay.reset=**1::
Specifies that a persistent overlay should be reset on boot.  All previous root
filesystem changes are vacated by this action.

**rd.live.overlay.thin=**1::
Enables the usage of thin snapshots instead of classic dm snapshots.
The advantage of thin snapshots is that they support discards, and will free
blocks that are not claimed by the filesystem. In this use case, this means
that memory is given back to the kernel when the filesystem does not claim it
anymore.

**rd.live.overlay.overlayfs=**1::
Enables the use of the *OverlayFS* kernel module, if available, to provide a
copy-on-write union directory for the root filesystem.  OverlayFS overlays are
directories of the files that have changed on the read-only base (lower)
filesystem.  The root filesystem is provided through a special overlay type
mount that merges the lower and upper directories.  If an OverlayFS upper
directory is not present on the boot device, a tmpfs directory will be created
at `/run/overlayfs` to provide temporary storage.  Persistent storage can be
provided on vfat or msdos formatted devices by supplying the OverlayFS upper
directory within an embedded filesystem that supports the creation of trusted.*
extended attributes and provides a valid d_type in readdir responses, such as
with ext4 and xfs.  On non-vfat-formatted devices, a persistent OverlayFS
overlay can extend the available root filesystem storage up to the capacity of
the LiveOS disk device.
+
If a persistent overlay is detected at the standard LiveOS path, the overlay &
overlay type detected, whether OverlayFS or Device-mapper, will be used.
+
The **rd.live.overlay.readonly** option, which allows a persistent overlayfs to
be mounted read-only through a higher level transient overlay directory, has
been implemented through the multiple lower layers feature of OverlayFS.


ZIPL
~~~~
**rd.zipl=**__<path to blockdevice>__::
    Update the dracut commandline with the values found in the
    _dracut-cmdline.conf_ file on the given device.
    The values are merged into the existing commandline values
    and the udev events are regenerated.
+
[listing]
.Example
--
rd.zipl=UUID=0fb28157-99e3-4395-adef-da3f7d44835a
--

CIO_IGNORE
~~~~~~~~~~
**rd.cio_accept=**__<device-ids>__::
    Remove the devices listed in <device-ids> from the default
    cio_ignore kernel command-line settings.
    <device-ids> is a list of comma-separated CCW device ids.
    The default for this value is taken from the
    _/boot/zipl/active_devices.txt_ file.
+
[listing]
.Example
--
rd.cio_accept=0.0.0180,0.0.0800,0.0.0801,0.0.0802
--

Plymouth Boot Splash
~~~~~~~~~~~~~~~~~~~~
**plymouth.enable=0**::
    disable the plymouth bootsplash completely.

**rd.plymouth=0**::
    disable the plymouth bootsplash only for the initramfs.

Kernel keys
~~~~~~~~~~~
**masterkey=**__<kernel master key path name>__::
    Set the path name of the kernel master key.
+
[listing]
.Example
--
masterkey=/etc/keys/kmk-trusted.blob
--

**masterkeytype=**__<kernel master key type>__::
    Set the type of the kernel master key.
+
[listing]
.Example
--
masterkeytype=trusted
--

**evmkey=**__<EVM key path name>__::
    Set the path name of the EVM key.
+
[listing]
.Example
--
evmkey=/etc/keys/evm-trusted.blob
--

**ecryptfskey=**__<eCryptfs key path name>__::
    Set the path name of the eCryptfs key.
+
[listing]
.Example
--
ecryptfskey=/etc/keys/ecryptfs-trusted.blob
--

Deprecated, renamed Options
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here is a list of options, which were used in dracut prior to version 008, and
their new replacement.

rdbreak:: rd.break

rd.ccw:: rd.znet
rd_CCW:: rd.znet

rd_DASD_MOD:: rd.dasd

rd_DASD:: rd.dasd

rdinitdebug rdnetdebug:: rd.debug

rd_NO_DM:: rd.dm=0

rd_DM_UUID:: rd.dm.uuid

rdblacklist:: rd.driver.blacklist

rdinsmodpost:: rd.driver.post

rdloaddriver:: rd.driver.pre

rd_NO_FSTAB:: rd.fstab=0

rdinfo:: rd.info

check:: rd.live.check

rdlivedebug:: rd.live.debug

live_dir:: rd.live.dir

liveimg:: rd.live.image

overlay:: rd.live.overlay

readonly_overlay:: rd.live.overlay.readonly

reset_overlay:: rd.live.overlay.reset

live_ram:: rd.live.ram

rd_NO_CRYPTTAB:: rd.luks.crypttab=0

rd_LUKS_KEYDEV_UUID:: rd.luks.keydev.uuid

rd_LUKS_KEYPATH:: rd.luks.keypath

rd_NO_LUKS:: rd.luks=0

rd_LUKS_UUID:: rd.luks.uuid

rd_NO_LVMCONF:: rd.lvm.conf

rd_LVM_LV:: rd.lvm.lv

rd_NO_LVM:: rd.lvm=0

rd_LVM_SNAPSHOT:: rd.lvm.snapshot

rd_LVM_SNAPSIZE:: rd.lvm.snapsize

rd_LVM_VG:: rd.lvm.vg

rd_NO_MDADMCONF:: rd.md.conf=0

rd_NO_MDIMSM:: rd.md.imsm=0

rd_NO_MD:: rd.md=0

rd_MD_UUID:: rd.md.uuid

rd_NO_MULTIPATH: rd.multipath=0

rd_NFS_DOMAIN:: rd.nfs.domain

iscsi_initiator:: rd.iscsi.initiator

iscsi_target_name:: rd.iscsi.target.name

iscsi_target_ip:: rd.iscsi.target.ip

iscsi_target_port:: rd.iscsi.target.port

iscsi_target_group:: rd.iscsi.target.group

iscsi_username:: rd.iscsi.username

iscsi_password:: rd.iscsi.password

iscsi_in_username:: rd.iscsi.in.username

iscsi_in_password:: rd.iscsi.in.password

iscsi_firmware:: rd.iscsi.firmware=0

rd_NO_PLYMOUTH:: rd.plymouth=0

rd_retry:: rd.retry

rdshell:: rd.shell

rd_NO_SPLASH:: rd.splash

rdudevdebug:: rd.udev.debug

rdudevinfo:: rd.udev.info

rd_NO_ZFCPCONF:: rd.zfcp.conf=0

rd_ZFCP:: rd.zfcp

rd_ZNET:: rd.znet

KEYMAP:: vconsole.keymap

KEYTABLE:: vconsole.keymap

SYSFONT:: vconsole.font

CONTRANS:: vconsole.font.map

UNIMAP:: vconsole.font.unimap

UNICODE:: vconsole.unicode

EXT_KEYMAP:: vconsole.keymap.ext

Configuration in the Initramfs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_/etc/conf.d/_::
    Any files found in _/etc/conf.d/_ will be sourced in the initramfs to
    set initial values. Command line options will override these values
    set in the configuration files.

_/etc/cmdline_::
    Can contain additional command line options. Deprecated, better use
    /etc/cmdline.d/*.conf.

_/etc/cmdline.d/*.conf_::
    Can contain additional command line options.

AUTHOR
------
Harald Hoyer

SEE ALSO
--------
*dracut*(8) *dracut.conf*(5)
  07070100000043000081A400000000000000000000000164DF2CB800002256000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/man/dracut.conf.5.asc   DRACUT.CONF(5)
==============
:doctype: manpage
:man source:   dracut
:man manual:   dracut
:man version:  {version}

NAME
----
dracut.conf - configuration file(s) for dracut

SYNOPSIS
--------
_/etc/dracut.conf_
_/etc/dracut.conf.d/\*.conf_
_/usr/lib/dracut/dracut.conf.d/*.conf_

Description
-----------
_dracut.conf_ is loaded during the initialisation phase of dracut. Command line
parameter will override any values set here.

_*.conf_ files are read from /usr/lib/dracut/dracut.conf.d and
/etc/dracut.conf.d. Files with the same name in /etc/dracut.conf.d will replace
files in /usr/lib/dracut/dracut.conf.d.
The files are then read in alphanumerical order and will override parameters
set in _/etc/dracut.conf_. Each line specifies an attribute and a value. A '#'
indicates the beginning of a comment; following characters, up to the end of the
line are not interpreted.

dracut command line options will override any values set here.

Configuration files must have the extension .conf; other extensions are ignored.

*add_dracutmodules+=*" __<dracut modules>__ "::
    Add a space-separated list of dracut modules to call when building the
    initramfs. Modules are located in _/usr/lib/dracut/modules.d_.

*dracutmodules+=*" __<dracut modules>__ "::
    Specify a space-separated list of dracut modules to call when building the
    initramfs. Modules are located in _/usr/lib/dracut/modules.d_.
    This option forces dracut to only include the specified dracut modules.
    In most cases the "add_dracutmodules" option is what you want to use.

*omit_dracutmodules+=*" __<dracut modules>__ "::
    Omit a space-separated list of dracut modules to call when building the
    initramfs. Modules are located in _/usr/lib/dracut/modules.d_.

*drivers+=*" __<kernel modules>__ "::
    Specify a space-separated list of kernel modules to exclusively include in
    the initramfs. The kernel modules have to be specified without the ".ko"
    suffix.

*add_drivers+=*" __<kernel modules>__ "::
    Specify a space-separated list of kernel modules to add to the initramfs.
    The kernel modules have to be specified without the ".ko" suffix.

*force_drivers+=*" __<list of kernel modules>__ "::
    See add_drivers above. But in this case it is ensured that the drivers
    are tried to be loaded early via modprobe.

*omit_drivers+=*" __<kernel modules>__ "::
    Specify a space-separated list of kernel modules not to add to the
    initramfs. The kernel modules have to be specified without the ".ko" suffix.

*filesystems+=*" __<filesystem names>__ "::
    Specify a space-separated list of kernel filesystem modules to exclusively
    include in the generic initramfs.

*drivers_dir=*"__<kernel modules directory>__"::
    Specify the directory, where to look for kernel modules

*fw_dir+=*" :__<dir>__[:__<dir>__ ...] "::
    Specify additional directories, where to look for firmwares, separated by :

*install_items+=*" __<file>__[ __<file>__ ...] "::
    Specify additional files to include in the initramfs, separated by spaces.

*install_optional_items+=*" __<file>__[ __<file>__ ...] "::
    Specify additional files to include in the initramfs, separated by spaces,
    if they exist.

*compress=*"__{cat|bzip2|lzma|xz|gzip|lzo|lz4|zstd|<compressor [args ...]>}__"::
    Compress the generated initramfs using the passed compression program. If
    you pass it just the name of a compression program, it will call that
    program with known-working arguments. If you pass arguments, it will be called
    with exactly those arguments. Depending on what you pass, this may result in
    an initramfs that the kernel cannot decompress.
    To disable compression, use "cat".

*do_strip=*"__{yes|no}__"::
    Strip binaries in the initramfs (default=yes)

*hostonly=*"__{yes|no}__"::
    Host-Only mode: Install only what is needed for booting the local host
    instead of a generic host and generate host-specific configuration.

*hostonly_cmdline=*"__{yes|no}__"::
    If set to "yes", store the kernel command line arguments needed in the initramfs

*persistent_policy=*"__<policy>__"::
    Use _<policy>_ to address disks and partitions.
    _<policy>_ can be any directory name found in /dev/disk.
    E.g. "by-uuid", "by-label"

*tmpdir=*"__<temporary directory>__"::
    Specify temporary directory to use.

[WARNING]
====
If chrooted to another root other than the real root device, use --fstab and
provide a valid _/etc/fstab_.
====

*use_fstab=*"__{yes|no}__"::
    Use _/etc/fstab_ instead of _/proc/self/mountinfo_.

*add_fstab+=*" __<filename>__ "::
    Add entries of __<filename>__ to the initramfs /etc/fstab.

*add_device+=*" __<device>__ "::
    Bring up _<device>_ in initramfs, _<device>_ should be the device name.
    This can be useful in hostonly mode for resume support when your swap is on
    LVM an encrypted partition.

*mdadmconf=*"__{yes|no}__"::
    Include local _/etc/mdadm.conf_ (default=yes)

*lvmconf=*"__{yes|no}__"::
    Include local _/etc/lvm/lvm.conf_ (default=yes)

*fscks=*" __<fsck tools>__ "::
    Add a space-separated list of fsck tools. If nothing is specified, the
    default is: "umount mount /sbin/fsck* xfs_db xfs_check xfs_repair e2fsck
    jfs_fsck reiserfsck btrfsck". The installation is opportunistic
    (non-existing tools are ignored).

*nofscks=*"__{yes|no}__"::
    If specified, inhibit installation of any fsck tools.

*ro_mnt=*"__{yes|no}__"::
    Mount _/_ and _/usr_ read-only by default.

*kernel_cmdline=*"__parameters__"::
    Specify default kernel command line parameters

*kernel_only=*"__{yes|no}__"::
    Only install kernel drivers and firmware files. (default=no)

*no_kernel=*"__{yes|no}__"::
    Do not install kernel drivers and firmware files (default=no)

*acpi_override=*"__{yes|no}__"::
    [WARNING] ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING! +
    Override BIOS provided ACPI tables. For further documentation read
    Documentation/acpi/initrd_table_override.txt in the kernel sources.
    Search for ACPI table files (must have .aml suffix) in acpi_table_dir=
    directory (see below) and add them to a separate uncompressed cpio
    archive. This cpio archive gets glued (concatenated, uncompressed one
    must be the first one) to the compressed cpio archive. The first,
    uncompressed cpio archive is for data which the kernel must be able
    to access very early (and cannot make use of uncompress algorithms yet)
    like microcode or ACPI tables (default=no).

*acpi_table_dir=*"__<dir>__"::
    Directory to search for ACPI tables if acpi_override= is set to yes.

*early_microcode=*"{yes|no}"::
    Combine early microcode with ramdisk (default=yes)

*stdloglvl*="__\{0-6\}__"::
    Set logging to standard error level.

*sysloglvl*="__\{0-6\}__"::
    Set logging to syslog level.

*fileloglvl=*"__\{0-6\}__"::
    Set logging to file level.

*logfile=*"__<file>__"::
    Path to log file.

*show_modules=*"__{yes|no}__"::
    Print the name of the included modules to standard output during build.

*i18n_vars=*"__<variable mapping>__"::
    Distribution specific variable mapping.
    See dracut/modules.d/10i18n/README for a detailed description.

*i18n_default_font=*"__<fontname>__"::
    The font <fontname> to install, if not specified otherwise.
    Default is "eurlatgr".

*i18n_install_all=*"__{yes|no}__"::
    Install everything regardless of generic or hostonly mode.

*reproducible=*"__{yes|no}__"::
    Create reproducible images.

*loginstall=*"__<DIR>__"::
    Log all files installed from the host to _<DIR>_.

*uefi_stub=*"_<FILE>_"::
    Specifies the UEFI stub loader, which will load the attached kernel, initramfs and
    kernel command line and boots the kernel. The default is
    _/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_

*uefi_splash_image=*"_<FILE>_"::
    Specifies the UEFI stub loader's splash image. Requires bitmap (**.bmp**) image format.

*uefi_secureboot_cert=*"_<FILE>_", *uefi_secureboot_key=*"_<FILE>_"::
    Specifies a certificate and corresponding key, which are used to sign the created UEFI executable.
    Requires both certificate and key need to be specified and _sbsign_ to be installed.

*kernel_image=*"_<FILE>_"::
    Specifies the kernel image, which to include in the UEFI executable. The default is
    _/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_

Files
-----
_/etc/dracut.conf_::
    Old configuration file. You better use your own file in
    _/etc/dracut.conf.d/_.

_/etc/dracut.conf.d/_::
    Any _/etc/dracut.conf.d/*.conf_ file can override the values in
    _/etc/dracut.conf_. The configuration files are read in alphanumerical
    order.

AUTHOR
------
Harald Hoyer

See Also
--------
*dracut*(8) *dracut.cmdline*(7)

  07070100000044000081A400000000000000000000000164DF2CB80000267F000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/man/dracut.modules.7.asc    DRACUT.MODULES(7)
=================
:doctype: manpage
:man source:   dracut
:man manual:   dracut
:man version:  {version}

NAME
----
dracut.modules - dracut modules

DESCRIPTION
-----------

dracut uses a modular system to build and extend the initramfs image. All
modules are located in _/usr/lib/dracut/modules.d_ or in _<git-src>/modules.d_.
The most basic dracut module is _99base_. In _99base_ the initial shell script
init is defined, which gets run by the kernel after initramfs loading. Although
you can replace init with your own version of _99base_, this is not encouraged.
Instead you should use, if possible, the hooks of dracut. All hooks, and the
point of time in which they are executed, are described in <<stages>>.

The main script, which creates the initramfs is dracut itself. It parses all
arguments and sets up the directory, in which everything is installed. It then
executes all check, install, installkernel scripts found in the modules, which
are to be processed. After everything is installed, the install directory is
archived and compressed to the final initramfs image. All helper functions used
by check, install and installkernel are found in in the file _dracut-functions_.
These shell functions are available to all module installer (install,
installkernel) scripts, without the need to source _dracut-functions_.

A module can check the preconditions for install and installkernel with the
check script. Also dependencies can be expressed with check. If a module passed
check, install and installkernel will be called to install all of the necessary
files for the module. To split between kernel and non-kernel parts of the
installation, all kernel module related parts have to be in installkernel. All
other files found in a module directory are module specific and mostly are hook
scripts and udev rules.


[[stages]]
== Boot Process Stages

dracut modules can insert custom script at various points, to control the boot
process.
These hooks are plain directories containing shell scripts ending with ".sh",
which are sourced by init.
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.

=== Hook: cmdline

The _cmdline_ hook is a place to insert scripts to parse the kernel command line
and prepare the later actions, like setting up udev rules and configuration
files.

In this hook the most important environment variable is defined: root. The
second one is rootok, which indicates, that a module claimed to be able to parse
the root defined. So for example, **root=**__iscsi:....__ will be claimed by the
iscsi dracut module, which then sets rootok.

=== Hook: pre-udev

This hook is executed right after the cmdline hook and a check if root and
rootok were set. Here modules can take action with the final root, and before
udev has been run.

=== Start Udev

Now udev is started and the logging for udev is setup.

=== Hook: pre-trigger

In this hook, you can set udev environment variables with **udevadm control
--property=KEY=_value_** or control the further execution of udev with
udevadm.

=== Trigger Udev

udev is triggered by calling udevadm trigger, which sends add events for all
devices and subsystems.

=== Main Loop

In the main loop of dracut loops until udev has settled and
all scripts in _initqueue/finished_ returned true.
In this loop there are three hooks, where scripts can be inserted
by calling /sbin/initqueue.

==== Initqueue

This hook gets executed every time a script is inserted here, regardless of the
udev state.

==== Initqueue settled

This hook (initqueue/settled) gets executed every time udev has settled.

==== Initqueue timeout

This hook (initqueue/timeout) gets executed, when the main loop counter becomes
half of the rd.retry counter.

==== Initqueue online

This hook (initqueue/online) gets executed whenever a network interface comes online
(that is, once it is up and configured by the configured network module).

==== Initqueue finished

This hook (initqueue/finished) is called after udev has settled and
if all scripts herein return 0 the main loop will be ended.
Arbitrary scripts can be added here, to loop in the
initqueue until something happens, which a dracut module wants to wait for.

=== Hook: pre-mount

Before the root device is mounted all scripts in the hook pre-mount are
executed. In some cases (e.g. NFS) the real root device is already mounted,
though.

=== Hook: mount

This hook is mainly to mount the real root device.

=== Hook: pre-pivot

This hook is called before cleanup hook, This is a good place for
actions other than cleanups which need to be called before pivot.

=== Hook: cleanup

This hook is the last hook and is called before init finally switches root to
the real root device. This is a good place to clean up and kill processes not
needed anymore.


=== Cleanup and switch_root

Init (or systemd) kills all udev processes, cleans up the environment,
sets up the arguments for the real init process and finally calls switch_root.
switch_root removes the whole filesystem hierarchy of the initramfs,
chroot()s to the real root device and calls /sbin/init with the specified
arguments.

To ensure all files in the initramfs hierarchy can be removed, all processes
still running from the initramfs should not have any open file descriptors left.

== Network Infrastructure

FIXME

== Writing a Module

A simple example module is _90kernel-modules_, which modprobes a kernel module
after udev has settled and the basic device drivers have been loaded.

All module installation information is in the file module-setup.sh.

First we create a check() function, which just exits with 0 indicating that this
module should be included by default.

check():
----
return 0
----

Then we create the install() function, which installs a cmdline hook with
priority number 20 called _parse-insmodpost.sh_. It also installs the
_insmodpost.sh_ script in _/sbin_.

install():
----
inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
----

The _parse-instmodpost.sh_ parses the kernel command line for a argument
rd.driver.post, blacklists the module from being autoloaded and installs the
hook _insmodpost.sh_ in the _initqueue/settled_.

_parse-insmodpost.sh_:
----
for p in $(getargs rd.driver.post=); do
    echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
    _do_insmodpost=1
done

[ -n "$_do_insmodpost" ] && /sbin/initqueue --settled --unique --onetime /sbin/insmodpost.sh
unset _do_insmodpost

----

_insmodpost.sh_, which is called in the _initqueue/settled_ hook will just
modprobe the kernel modules specified in all rd.driver.post kernel command line
parameters. It runs after udev has settled and is only called once (--onetime).

_insmodpost.sh_:
----
. /lib/dracut-lib.sh

for p in $(getargs rd.driver.post=); do
    modprobe $p
done

----


=== module-setup.sh: check()

_check()_ is called by dracut to evaluate the inclusion of a dracut module in
the initramfs.

$hostonly:: If the $hostonly variable is set, then the module check() function
should be in "hostonly" mode, which means, that the check() should only return
0, if the module is really needed to boot this specific host.

check() should return with:

0:: Include the dracut module in the initramfs.

1:: Do not include the dracut module. The requirements are not fulfilled
(missing tools, etc.)

255:: Only include the dracut module, if another module requires it or if
explicitly specified in the config file or on the argument list.


=== module-setup.sh: depends()

The function depends() should echo all other dracut module names the module
depends on.

=== module-setup.sh: cmdline()

This function should print the kernel command line options needed to boot the
current machine setup. It should start with a space and should not print a
newline.

=== module-setup.sh: install()

The install() function is called to install everything non-kernel related.
To install binaries, scripts, and other files, you can use the functions
mentioned in <<creation>>.

To address a file in the current module directory, use the variable "$moddir".

=== module-setup.sh: installkernel()

In installkernel() all kernel related files should be installed. You can use all
of the functions mentioned in <<creation>> to install files.

=== [[creation]]Creation Functions

==== inst_multiple [-o] <file> [ <file> ...]

installs multiple binaries and files. If executables are specified without a
path, dracut will search the path PATH=/usr/sbin:/sbin:/usr/bin:/bin for the
binary. If the option "-o" is given as the first parameter, a missing file does
not lead to an error.

==== inst <src> [<dst>]

installs _one_ file <src> either to the same place in the initramfs or to an
optional <dst>. inst with more than two arguments is treated the same as
inst_multiple, all arguments are treated as files to install and none as
install destinations.

==== inst_hook <hookdir> <prio> <src>

installs an executable/script <src> in the dracut hook <hookdir> with priority
<prio>.

==== inst_rules <udevrule> [ <udevrule> ...]

installs one or more udev rules. Non-existant udev rules are reported, but do
not let dracut fail.

==== instmods <kernelmodule> [ <kernelmodule> ... ]

instmods should be used only in the installkernel() function.

instmods installs one or more kernel modules in the initramfs. <kernelmodule>
can also be a whole subsystem, if prefixed with a "=", like "=drivers/net/team".

instmods will not install the kernel module, if $hostonly is set and the kernel
module is not currently needed by any /sys/*...*/uevent MODALIAS.
To install a kernel module regardless of the hostonly mode use the form:
----
hostonly='' instmods <kernelmodule>
----

=== Initramfs Functions

FIXME


=== Network Modules

FIXME

AUTHOR
------
Harald Hoyer

SEE ALSO
--------
*dracut*(8)
 07070100000045000081A400000000000000000000000164DF2CB80000439F000000000000000000000000000000000000003300000000dracut-055+suse.347.gdcb9bdbf/man/dracut.usage.asc    To create a initramfs image, the most simple command is:
----
# dracut
----

This will generate a general purpose initramfs image, with all possible
functionality resulting of the combination of the installed dracut modules and
system tools. The image is /boot/initramfs-_++<kernel version>++_.img and
contains the kernel modules of the currently active kernel with version
_++<kernel version>++_.

If the initramfs image already exists, dracut will display an error message, and
to overwrite the existing image, you have to use the --force option.
----
# dracut --force
----

If you want to specify another filename for the resulting image you would issue
a command like:
----
# dracut foobar.img
----

To generate an image for a specific kernel version, the command would be:
----
# dracut foobar.img 2.6.40-1.rc5.f20
----

A shortcut to generate the image at the default location for a specific kernel
version is:
----
# dracut --kver 2.6.40-1.rc5.f20
----

If you want to create lighter, smaller initramfs images, you may want to specify
the --hostonly or -H option. Using this option, the resulting image will
contain only those dracut modules, kernel modules and filesystems, which are
needed to boot this specific machine. This has the drawback, that you can't put
the disk on another controller or machine, and that you can't switch to another
root filesystem, without recreating the initramfs image. The usage of the
--hostonly option is only for experts and you will have to keep the broken
pieces. At least keep a copy of a general purpose image (and corresponding
kernel) as a fallback to rescue your system.

=== Inspecting the Contents
To see the contents of the image created by dracut, you can use the lsinitrd
tool.
----
# lsinitrd | less
----

To display the contents of a file in the initramfs also use the lsinitrd tool:
----
# lsinitrd -f /etc/ld.so.conf
include ld.so.conf.d/*.conf
----

=== Adding dracut Modules
Some dracut modules are turned off by default and have to be activated manually.
You can do this by adding the dracut modules to the configuration file
_/etc/dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_. See *dracut.conf*(5).
You can also add dracut modules on the command line
by using the -a or --add option:
----
# dracut --add module initramfs-module.img
----

To see a list of available dracut modules, use the --list-modules option:
----
# dracut --list-modules
----

=== Omitting dracut Modules
Sometimes you don't want a dracut module to be included for reasons of speed,
size or functionality. To do this, either specify the omit_dracutmodules
variable in the _dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_ configuration
file (see *dracut.conf*(5)), or use the -o or --omit option
on the command line:
----
# dracut -o "multipath lvm" no-multipath-lvm.img
----

=== Adding Kernel Modules
If you need a special kernel module in the initramfs, which is not
automatically picked up by dracut, you have the use the --add-drivers option
on the command line or  the drivers variable in  the _/etc/dracut.conf_
or _/etc/dracut.conf.d/myconf.conf_ configuration file (see *dracut.conf*(5)):
----
# dracut --add-drivers mymod initramfs-with-mymod.img
----

=== Boot parameters
An initramfs generated without the "hostonly" mode, does not contain any system
configuration files (except for some special exceptions), so the configuration
has to be done on the kernel command line. With this flexibility, you can easily
boot from a changed root partition, without the need to recompile the initramfs
image. So, you could completely change your root partition (move it inside a md
raid with encryption and LVM on top), as long as you specify the correct
filesystem LABEL or UUID on the kernel command line for your root device, dracut
will find it and boot from it.

The kernel command line can also be provided by the dhcp server with the
root-path option. See <<NetworkBoot>>.

For a full reference of all kernel command line parameters,
see *dracut.cmdline*(5).

To get a quick start for the suitable kernel command line on your system,
use the __--print-cmdline__ option:
----
# dracut --print-cmdline
 root=UUID=8b8b6f91-95c7-4da2-831b-171e12179081 rootflags=rw,relatime,discard,data=ordered rootfstype=ext4
----

==== Specifying the root Device
This is the only option dracut really needs to boot from your root partition.
Because your root partition can live in various environments, there are a lot of
formats for the root= option. The most basic one is root=_++<path to device
node>++_:
----
root=/dev/sda2
----

Because device node names can change, dependent on the drive ordering, you are
encouraged to use the filesystem identifier (UUID) or filesystem label (LABEL)
to specify your root partition:
----
root=UUID=19e9dda3-5a38-484d-a9b0-fa6b067d0331
----

or

----
root=LABEL=myrootpartitionlabel
----

To see all UUIDs or LABELs on your system, do:
----
# ls -l /dev/disk/by-uuid
----

or

----
# ls -l /dev/disk/by-label
----

If your root partition is on the network see <<NetworkBoot>>.

==== Keyboard Settings
If you have to input passwords for encrypted disk volumes, you might want to set
the keyboard layout and specify a display font.

A typical german kernel command line would contain:
----
rd.vconsole.font=eurlatgr rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8
----

Setting these options can override the setting stored on your system, if you use
a modern init system, like systemd.

==== Blacklisting Kernel Modules
Sometimes it is required to prevent the automatic kernel module loading of a
specific kernel module. To do this, just add rd.blacklist=_++<kernel module
name>++_, with _++<kernel module name>++_ not containing the _.ko_
suffix, to the kernel command line. For example:
----
rd.driver.blacklist=mptsas rd.driver.blacklist=nouveau
----

The option can be specified multiple times on the kernel command line.

==== Speeding up the Boot Process
If you want to speed up the boot process, you can specify as much information
for dracut on the kernel command as possible. For example, you can tell dracut,
that you root partition is not on a LVM volume or not on a raid partition, or
that it lives inside a specific crypto LUKS encrypted volume. By default, dracut
searches everywhere. A typical dracut kernel command line for a plain primary or
logical partition would contain:
----
rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0
----

This turns off every automatic assembly of LVM, MD raids, DM raids and
crypto LUKS.

Of course, you could also omit the dracut modules in the initramfs creation
process, but then you would lose the possibility to turn it on on demand.


[[Injecting]]
=== Injecting custom Files
To add your own files to the initramfs image, you have several possibilities.

The --include option let you specify a source path and a target path.
For example
----
# dracut --include cmdline-preset /etc/cmdline.d/mycmdline.conf initramfs-cmdline-pre.img
----
will create an initramfs image, where the file cmdline-preset will be copied
inside the initramfs to _/etc/cmdline.d/mycmdline.conf_. --include can only
be specified once.


----
# mkdir -p rd.live.overlay/etc/cmdline.d
# mkdir -p rd.live.overlay/etc/conf.d
# echo "ip=dhcp" >> rd.live.overlay/etc/cmdline.d/mycmdline.conf
# echo export FOO=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
# echo export BAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
# tree rd.live.overlay/
rd.live.overlay/
`-- etc
    |-- cmdline.d
    |   `-- mycmdline.conf
    `-- conf.d
        `-- testvar.conf

# dracut --include rd.live.overlay / initramfs-rd.live.overlay.img
----

This will put the contents of the rd.live.overlay directory into the root of the
initramfs image.

The --install option let you specify several files, which will get installed in
the initramfs image at the same location, as they are present on initramfs
creation time.


----
# dracut --install 'strace fsck.ext3 ssh' initramfs-dbg.img
----

This will create an initramfs with the strace, fsck.ext3 and ssh executables,
together with the libraries needed to start those. The --install option can be
specified multiple times.


[[NetworkBoot]]
=== Network Boot

If your root partition is on a network drive, you have to have the network
dracut modules installed to create a network aware initramfs image.

If you specify ip=dhcp on the kernel command line, then dracut asks a dhcp
server about the ip address for the machine. The dhcp server can also serve an
additional root-path, which will set the root device for dracut. With this
mechanism, you have static configuration on your client machine and a
centralized boot configuration on your TFTP/DHCP server. If you can't pass a
kernel command line, then you can inject _/etc/cmdline.d/mycmdline.conf_, with a
method described in <<Injecting>>.

==== Reducing the Image Size

To reduce the size of the initramfs, you should create it with by omitting all
dracut modules, which you know, you don't need to boot the machine.

You can also specify the exact dracut and kernel modules to produce a very tiny
initramfs image.

For example for a NFS image, you would do:


----
# dracut -m "nfs network base" initramfs-nfs-only.img
----

Then you would boot from this image with your target machine and reduce the size
once more by creating it on the target machine with the --host-only option:


----
# dracut -m "nfs network base" --host-only initramfs-nfs-host-only.img
----

This will reduce the size of the initramfs image significantly.


== Troubleshooting

If the boot process does not succeed, you have several options to debug the
situation. Some of the basic operations are covered here. For more information
you should also visit:
https://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html


[[identifying-your-problem-area]]
=== Identifying your problem area
. Remove ''rhgb'' and ''quiet'' from the kernel command line
. Add ''rd.shell'' to the kernel command line. This will present a shell should
dracut be unable to locate your root device
. Add ''rd.shell rd.debug log_buf_len=1M'' to the kernel command line so that
dracut shell commands are printed as they are executed
. The file /run/initramfs/rdsosreport.txt is generated,
which contains all the logs and the output of all significant tools, which are
mentioned later.

If you want to save that output, simply mount /boot by hand or insert an USB
stick and mount that. Then you can store the output for later inspection.

[[information-to-include-in-your-report]]
=== Information to include in your report

[[all-bug-reports]]
==== All bug reports
In all cases, the following should be mentioned and attached to your bug report:

* The exact kernel command-line used. Typically from the bootloader
configuration file (e.g. _/boot/grub2/grub.cfg_) or from _/proc/cmdline_.
* A copy of your disk partition information from _/etc/fstab_, which might be
obtained booting an old working initramfs or a rescue medium.
* Turn on dracut debugging (see _the 'debugging dracut' section_), and attach
the file /run/initramfs/rdsosreport.txt.
* If you use a dracut configuration file, please include _/etc/dracut.conf_ and
all files in _/etc/dracut.conf.d/*.conf_

[[network-root-device-related-problems]]
==== Network root device related problems
This section details information to include when experiencing problems on a
system whose root device is located on a network attached volume (e.g. iSCSI,
NFS or NBD). As well as the information from <<all-bug-reports>>, include the
following information:


* Please include the output of
+
----
# /sbin/ifup <interfacename>
# ip addr show
----

[[debugging-dracut]]
=== Debugging dracut


[[configure-a-serial-console]]
==== Configure a serial console

Successfully debugging dracut will require some form of console
logging during the system boot.  This section documents configuring a
serial console connection to record boot messages.

. First, enable serial console output for both the kernel and the bootloader.
. Open the file _/boot/grub2/grub.cfg_ for editing. Below the line ''timeout=5'', add
the following:
+
----
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
----
+
. Also in _/boot/grub2/grub.cfg_, add the following boot arguments to the ''kernel''
line:
+
----
console=tty0 console=ttyS0,9600
----
+
. When finished, the _/boot/grub2/grub.cfg_ file should look similar to the example
below.
+
----
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title Fedora (2.6.29.5-191.fc11.x86_64)
  root (hd0,0)
  kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 console=ttyS0,9600
  initrd /dracut-2.6.29.5-191.fc11.x86_64.img
----
+
. More detailed information on how to configure the kernel for console output
can be found at
http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL.
. Redirecting non-interactive output
+
--
NOTE: You can redirect all non-interactive output to _/dev/kmsg_ and the kernel
will put it out on the console when it reaches the kernel buffer by doing

----
# exec >/dev/kmsg 2>&1 </dev/console
----
--

[[using-the-dracut-shell]]
==== Using the dracut shell

dracut offers a shell for interactive debugging in the event dracut fails to
locate your root filesystem. To enable the shell:

. Add the boot parameter ''rd.shell'' to your bootloader configuration file
(e.g. _/boot/grub2/grub.cfg_)
. Remove the boot arguments ''rhgb'' and ''quiet''
+
A sample _/boot/grub2/grub.cfg_ bootloader configuration file is listed below.
+
----
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title Fedora (2.6.29.5-191.fc11.x86_64)
  root (hd0,0)
  kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
  initrd /dracut-2.6.29.5-191.fc11.x86_64.img
----
+
. If system boot fails, you will be dropped into a shell as seen in the example
below.
+
----
No root device found
Dropping to debug shell.

#
----
+
. Use this shell prompt to gather the information requested above
(see <<all-bug-reports>>).

[[accessing-the-root-volume-from-the-dracut-shell]]
==== Accessing the root volume from the dracut shell
From the dracut debug shell, you can manually perform the task of locating and
preparing your root volume for boot. The required steps will depend on how your
root volume is configured. Common scenarios include:

* A block device (e.g. _/dev/sda7_)
* A LVM logical volume (e.g. _/dev/VolGroup00/LogVol00_)
* An encrypted device
  (e.g. _/dev/mapper/luks-4d5972ea-901c-4584-bd75-1da802417d83_)
* A network attached device
  (e.g. _netroot=iscsi:@192.168.0.4::3260::iqn.2009-02.org.example:for.all_)

The exact method for locating and preparing will vary. However, to continue with
a successful boot, the objective is to locate your root volume and create a
symlink _/dev/root_ which points to the file system. For example, the following
example demonstrates accessing and booting a root volume that is an encrypted
LVM Logical volume.

. Inspect your partitions using parted
+
----
# parted /dev/sda -s p
Model: ATA HTS541060G9AT00 (scsi)
Disk /dev/sda: 60.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number  Start   End     Size    Type      File system  Flags
1      32.3kB  10.8GB  107MB   primary   ext4         boot
2      10.8GB  55.6GB  44.7GB  logical                lvm
----
+
. You recall that your root volume was a LVM logical volume. Scan and activate
any logical volumes.
+
----
# lvm vgscan
# lvm vgchange -ay
----
+
. You should see any logical volumes now using the command blkid:
+
----
# blkid
/dev/sda1: UUID="3de247f3-5de4-4a44-afc5-1fe179750cf7" TYPE="ext4"
/dev/sda2: UUID="Ek4dQw-cOtq-5MJu-OGRF-xz5k-O2l8-wdDj0I" TYPE="LVM2_member"
/dev/mapper/linux-root: UUID="def0269e-424b-4752-acf3-1077bf96ad2c" TYPE="crypto_LUKS"
/dev/mapper/linux-home: UUID="c69127c1-f153-4ea2-b58e-4cbfa9257c5e" TYPE="ext3"
/dev/mapper/linux-swap: UUID="47b4d329-975c-4c08-b218-f9c9bf3635f1" TYPE="swap"
----
+
. From the output above, you recall that your root volume exists on an encrypted
block device. Following the guidance disk encryption guidance from the
Installation Guide, you unlock your encrypted root volume.
+
----
# UUID=$(cryptsetup luksUUID /dev/mapper/linux-root)
# cryptsetup luksOpen /dev/mapper/linux-root luks-$UUID
Enter passphrase for /dev/mapper/linux-root:
Key slot 0 unlocked.
----
+
. Next, make a symbolic link to the unlocked root volume
+
----
# ln -s /dev/mapper/luks-$UUID /dev/root
----
+
. With the root volume available, you may continue booting the system by exiting
the dracut shell
+
----
# exit
----

[[additional-dracut-boot-parameters]]
==== Additional dracut boot parameters
For more debugging options, see *dracut.cmdline*(7).


[[debugging-dracut-on-shutdown]]
==== Debugging dracut on shutdown

To debug the shutdown sequence on systemd systems, you can _rd.break_
on _pre-shutdown_ or _shutdown_.

To do this from an already booted system:
----
# mkdir -p /run/initramfs/etc/cmdline.d
# echo "rd.debug rd.break=pre-shutdown rd.break=shutdown" > /run/initramfs/etc/cmdline.d/debug.conf
# touch /run/initramfs/.need_shutdown
----

This will give you a dracut shell after the system pivot'ed back in the
initramfs.

 07070100000046000081A400000000000000000000000164DF2CB800000670000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/man/lsinitrd.1.asc  LSINITRD(1)
=========
:doctype: manpage
:man source:   dracut
:man manual:   dracut
:man version:  {version}

NAME
----
lsinitrd - tool to show the contents of an initramfs image

SYNOPSIS
--------
*lsinitrd* ['OPTION...'] [<image> [<filename> [<filename> [...] ]]]

*lsinitrd* ['OPTION...'] -k <kernel-version>

DESCRIPTION
-----------
lsinitrd shows the contents of an initramfs image. if <image> is omitted, then
lsinitrd uses the default image _/boot/<machine-id>/<kernel-version>/initrd_ or
_/boot/initramfs-<kernel-version>.img_.

OPTIONS
-------
**-h, --help**::
    print a help message and exit.

**-s, --size**::
    sort the contents of the initramfs by size.

**-f, --file** _<filename>_::
    print the contents of <filename>.

**-k, --kver** _<kernel version>_::
    inspect the initramfs of <kernel version>.

**-m, --mod**::
    list dracut modules included of the initramfs image.

**--unpack**::
    unpack the initramfs to the current directory, instead of displaying the contents.
    If optional filenames are given, will only unpack specified files, else the whole image will be unpacked.
    Won't unpack anything from early cpio part.

**--unpackearly**::
    unpack the early microcode initramfs to the current directory, instead of displaying the contents.
    Same as --unpack, but only unpack files from early cpio part.

**-v, --verbose**::
    unpack verbosely

AVAILABILITY
------------
The lsinitrd command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]

AUTHORS
-------
Harald Hoyer

Amerigo Wang

Nikoli

SEE ALSO
--------
*dracut*(8)
07070100000047000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002800000000dracut-055+suse.347.gdcb9bdbf/modules.d   07070100000048000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/00bash    07070100000049000081ED00000000000000000000000164DF2CB8000002DD000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/00bash/module-setup.sh    #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed.
    require_binaries bash || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst /bin/bash

    # Prefer bash as default shell if no other shell is preferred.
    [[ -L $initdir/bin/sh ]] || ln -sf bash "${initdir}/bin/sh"

}
   0707010000004A000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/00dash    0707010000004B000081ED00000000000000000000000164DF2CB8000002DD000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/00dash/module-setup.sh    #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed.
    require_binaries dash || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst /bin/dash

    # Prefer dash as default shell if no other shell is preferred.
    [[ -L $initdir/bin/sh ]] || ln -sf dash "${initdir}/bin/sh"

}
   0707010000004C000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/00mksh    0707010000004D000081ED00000000000000000000000164DF2CB8000002DD000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/00mksh/module-setup.sh    #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed.
    require_binaries mksh || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst /bin/mksh

    # Prefer mksh as default shell if no other shell is preferred.
    [[ -L $initdir/bin/sh ]] || ln -sf mksh "${initdir}/bin/sh"

}
   0707010000004E000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/modules.d/00systemd 0707010000004F000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/00systemd-network-management  07070100000050000081ED00000000000000000000000164DF2CB800000210000000000000000000000000000000000000005500000000dracut-055+suse.347.gdcb9bdbf/modules.d/00systemd-network-management/module-setup.sh  #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # This module has external dependency on other module(s).
    echo systemd systemd-hostnamed systemd-networkd systemd-resolved systemd-timedated systemd-timesyncd
    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}
07070100000051000081ED00000000000000000000000164DF2CB800002916000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/modules.d/00systemd/module-setup.sh #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {
    [[ $mount_needs ]] && return 1
    # If the binary(s) requirements are not fulfilled the module can't be installed
    require_binaries "$systemdutildir"/systemd || return 1
    # Return 255 to only include the module, if another module requires it.
    return 255
}

# called by dracut
depends() {
    return 0
}

installkernel() {
    hostonly='' instmods autofs4 ipv6 algif_hash hmac sha256
    instmods -s efivarfs
}

# called by dracut
install() {
    local _mods

    if [[ $prefix == /run/* ]]; then
        dfatal 'systemd does not work with a prefix, which contains "/run"!!'
        exit 1
    fi

    inst_multiple -o \
        "$systemdutildir"/systemd \
        "$systemdutildir"/systemd-coredump \
        "$systemdutildir"/systemd-cgroups-agent \
        "$systemdutildir"/systemd-shutdown \
        "$systemdutildir"/systemd-reply-password \
        "$systemdutildir"/systemd-fsck \
        "$systemdutildir"/systemd-udevd \
        "$systemdutildir"/systemd-journald \
        "$systemdutildir"/systemd-sysctl \
        "$systemdutildir"/systemd-modules-load \
        "$systemdutildir"/systemd-vconsole-setup \
        "$systemdutildir"/systemd-volatile-root \
        "$systemdutildir"/system-generators/systemd-debug-generator \
        "$systemdutildir"/system-generators/systemd-fstab-generator \
        "$systemdutildir"/system-generators/systemd-gpt-auto-generator \
        \
        "$systemdsystemunitdir"/debug-shell.service \
        "$systemdsystemunitdir"/cryptsetup.target \
        "$systemdsystemunitdir"/cryptsetup-pre.target \
        "$systemdsystemunitdir"/remote-cryptsetup.target \
        "$systemdsystemunitdir"/emergency.target \
        "$systemdsystemunitdir"/sysinit.target \
        "$systemdsystemunitdir"/basic.target \
        "$systemdsystemunitdir"/halt.target \
        "$systemdsystemunitdir"/kexec.target \
        "$systemdsystemunitdir"/local-fs.target \
        "$systemdsystemunitdir"/local-fs-pre.target \
        "$systemdsystemunitdir"/remote-fs.target \
        "$systemdsystemunitdir"/remote-fs-pre.target \
        "$systemdsystemunitdir"/multi-user.target \
        "$systemdsystemunitdir"/network.target \
        "$systemdsystemunitdir"/network-pre.target \
        "$systemdsystemunitdir"/network-online.target \
        "$systemdsystemunitdir"/nss-lookup.target \
        "$systemdsystemunitdir"/nss-user-lookup.target \
        "$systemdsystemunitdir"/poweroff.target \
        "$systemdsystemunitdir"/reboot.target \
        "$systemdsystemunitdir"/rescue.target \
        "$systemdsystemunitdir"/rpcbind.target \
        "$systemdsystemunitdir"/shutdown.target \
        "$systemdsystemunitdir"/final.target \
        "$systemdsystemunitdir"/sigpwr.target \
        "$systemdsystemunitdir"/sockets.target \
        "$systemdsystemunitdir"/swap.target \
        "$systemdsystemunitdir"/timers.target \
        "$systemdsystemunitdir"/paths.target \
        "$systemdsystemunitdir"/umount.target \
        \
        "$systemdsystemunitdir"/sys-kernel-config.mount \
        \
        "$systemdsystemunitdir"/modprobe@.service \
        "$systemdsystemunitdir"/kmod-static-nodes.service \
        "$systemdsystemunitdir"/systemd-tmpfiles-setup.service \
        "$systemdsystemunitdir"/systemd-tmpfiles-setup-dev.service \
        "$systemdsystemunitdir"/systemd-ask-password-console.path \
        "$systemdsystemunitdir"/systemd-udevd-control.socket \
        "$systemdsystemunitdir"/systemd-udevd-kernel.socket \
        "$systemdsystemunitdir"/systemd-ask-password-plymouth.path \
        "$systemdsystemunitdir"/systemd-journald.socket \
        "$systemdsystemunitdir"/systemd-journald-audit.socket \
        "$systemdsystemunitdir"/systemd-ask-password-console.service \
        "$systemdsystemunitdir"/systemd-modules-load.service \
        "$systemdsystemunitdir"/systemd-halt.service \
        "$systemdsystemunitdir"/systemd-poweroff.service \
        "$systemdsystemunitdir"/systemd-reboot.service \
        "$systemdsystemunitdir"/systemd-kexec.service \
        "$systemdsystemunitdir"/systemd-fsck@.service \
        "$systemdsystemunitdir"/systemd-udevd.service \
        "$systemdsystemunitdir"/systemd-udev-trigger.service \
        "$systemdsystemunitdir"/systemd-udev-settle.service \
        "$systemdsystemunitdir"/systemd-ask-password-plymouth.service \
        "$systemdsystemunitdir"/systemd-journald.service \
        "$systemdsystemunitdir"/systemd-vconsole-setup.service \
        "$systemdsystemunitdir"/systemd-volatile-root.service \
        "$systemdsystemunitdir"/systemd-random-seed-load.service \
        "$systemdsystemunitdir"/systemd-random-seed.service \
        "$systemdsystemunitdir"/systemd-sysctl.service \
        \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-modules-load.service \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-ask-password-console.path \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-journald.service \
        "$systemdsystemunitdir"/sockets.target.wants/systemd-udevd-control.socket \
        "$systemdsystemunitdir"/sockets.target.wants/systemd-udevd-kernel.socket \
        "$systemdsystemunitdir"/sockets.target.wants/systemd-journald.socket \
        "$systemdsystemunitdir"/sockets.target.wants/systemd-journald-audit.socket \
        "$systemdsystemunitdir"/sockets.target.wants/systemd-journald-dev-log.socket \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-udevd.service \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-udev-trigger.service \
        "$systemdsystemunitdir"/sysinit.target.wants/kmod-static-nodes.service \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup.service \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup-dev.service \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-sysctl.service \
        \
        "$systemdsystemunitdir"/ctrl-alt-del.target \
        "$systemdsystemunitdir"/reboot.target \
        "$systemdsystemunitdir"/systemd-reboot.service \
        "$systemdsystemunitdir"/syslog.socket \
        \
        "$systemdsystemunitdir"/slices.target \
        "$systemdsystemunitdir"/system.slice \
        "$systemdsystemunitdir"/-.slice \
        \
        "$tmpfilesdir"/systemd.conf \
        \
        journalctl systemctl \
        echo swapoff \
        kmod insmod rmmod modprobe modinfo depmod lsmod \
        mount umount reboot poweroff \
        systemd-run systemd-escape \
        systemd-cgls systemd-tmpfiles \
        systemd-ask-password systemd-tty-ask-password-agent \
        /etc/udev/udev.hwdb

    inst_multiple -o \
        /usr/lib/modules-load.d/*.conf \
        /usr/lib/sysctl.d/*.conf

    modules_load_get() {
        local _line i
        for i in "$dracutsysrootdir$1"/*.conf; do
            [[ -f $i ]] || continue
            while read -r _line || [ -n "$_line" ]; do
                case $_line in
                    \#*) ;;

                    \;*) ;;

                    *)
                        echo "$_line"
                        ;;
                esac
            done < "$i"
        done
    }

    mapfile -t _mods < <(modules_load_get /usr/lib/modules-load.d)
    [[ ${#_mods[@]} -gt 0 ]] && hostonly='' instmods "${_mods[@]}"

    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            /etc/systemd/journald.conf \
            /etc/systemd/journald.conf.d/*.conf \
            /etc/systemd/system.conf \
            /etc/systemd/system.conf.d/*.conf \
            "$systemdsystemconfdir"/modprobe@.service \
            "$systemdsystemconfdir/modprobe@.service.d/*.conf" \
            /etc/hosts \
            /etc/hostname \
            /etc/nsswitch.conf \
            /etc/machine-id \
            /etc/machine-info \
            /etc/vconsole.conf \
            /etc/locale.conf \
            /etc/modules-load.d/*.conf \
            /etc/sysctl.d/*.conf \
            /etc/sysctl.conf \
            /etc/udev/udev.conf

        mapfile -t _mods < <(modules_load_get /etc/modules-load.d)
        [[ ${#_mods[@]} -gt 0 ]] && hostonly='' instmods "${_mods[@]}"
    fi

    if ! [[ -e "$initdir/etc/machine-id" ]]; then
        : > "$initdir/etc/machine-id"
    fi

    # install adm user/group for journald
    inst_multiple nologin
    {
        grep '^systemd-journal:' "$dracutsysrootdir"/etc/passwd 2> /dev/null
        grep '^adm:' "$dracutsysrootdir"/etc/passwd 2> /dev/null
        # we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
        grep '^systemd-network:' "$dracutsysrootdir"/etc/passwd 2> /dev/null
    } >> "$initdir/etc/passwd"

    {
        grep '^systemd-journal:' "$dracutsysrootdir"/etc/group 2> /dev/null
        grep '^wheel:' "$dracutsysrootdir"/etc/group 2> /dev/null
        grep '^adm:' "$dracutsysrootdir"/etc/group 2> /dev/null
        grep '^utmp:' "$dracutsysrootdir"/etc/group 2> /dev/null
        grep '^root:' "$dracutsysrootdir"/etc/group 2> /dev/null
        # we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
        grep '^systemd-network:' "$dracutsysrootdir"/etc/group 2> /dev/null
    } >> "$initdir/etc/group"

    ln_r "$systemdutildir"/systemd "/init"
    ln_r "$systemdutildir"/systemd "/sbin/init"

    inst_binary true
    ln_r "$(find_binary true)" "/usr/bin/loginctl"
    ln_r "$(find_binary true)" "/bin/loginctl"
    inst_rules \
        70-uaccess.rules \
        71-seat.rules \
        73-seat-late.rules \
        90-vconsole.rules \
        99-systemd.rules

    for i in \
        emergency.target \
        rescue.target \
        systemd-ask-password-console.service \
        systemd-ask-password-plymouth.service; do
        [[ -f "$systemdsystemunitdir"/$i ]] || continue
        $SYSTEMCTL -q --root "$initdir" add-wants "$i" systemd-vconsole-setup.service
    done

    mkdir -p "$initdir/etc/systemd"
    # We must use a volatile journal, and we don't want rate-limiting
    {
        echo "[Journal]"
        echo "Storage=volatile"
        echo "RateLimitInterval=0"
        echo "RateLimitBurst=0"
    } >> "$initdir/etc/systemd/journald.conf"

    $SYSTEMCTL -q --root "$initdir" set-default multi-user.target

    # Install library file(s)
    _arch=${DRACUT_ARCH:-$(uname -m)}
    inst_libdir_file \
        {"tls/$_arch/",tls/,"$_arch/",}"libnss_*"

}
  07070100000052000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/modules.d/00warpclock   07070100000053000081ED00000000000000000000000164DF2CB8000003A0000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/00warpclock/module-setup.sh   #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # hwclock does not exist on S390(x), bail out silently then
    local _arch=${DRACUT_ARCH:-$(uname -m)}
    [ "$_arch" = "s390" -o "$_arch" = "s390x" ] && return 1

    # If the binary(s) requirements are not fulfilled the module can't be installed.
    require_binaries hwclock || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst_hook pre-trigger 00 "$moddir/warpclock.sh"

    inst_multiple -o \
        /usr/share/zoneinfo/UTC \
        /etc/localtime \
        /etc/adjtime \
        hwclock

}
07070100000054000081A400000000000000000000000164DF2CB80000015D000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/00warpclock/warpclock.sh  #!/bin/sh
# This file is part of dracut warpclock module.
# SPDX-License-Identifier: GPL-2.0-or-later

# Set the kernel's timezone and reset the system time
# if adjtime is set to LOCAL.

if test -e /etc/adjtime; then
    while read -r line; do
        if test "$line" = LOCAL; then
            hwclock --systz
        fi
    done < /etc/adjtime
fi
   07070100000055000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01fips    07070100000056000081ED00000000000000000000000164DF2CB8000001E6000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01fips/fips-boot.sh   #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
    rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
elif [ -z "$fipsmode" ]; then
    die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
elif getarg boot= > /dev/null; then
    . /sbin/fips.sh
    fips_info "fips-boot: start"
    if mount_boot; then
        do_fips || die "FIPS integrity test failed"
    fi
    fips_info "fips-boot: done!"
fi
  07070100000057000081A400000000000000000000000164DF2CB8000001BB000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/01fips/fips-load-crypto.sh    #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
    rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
elif [ -z "$fipsmode" ]; then
    die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
else
    . /sbin/fips.sh
    fips_info "fips-load-crypto: start"
    fips_load_crypto || die "FIPS integrity test failed"
    fips_info "fips-load-crypto: done!"
fi
 07070100000058000081ED00000000000000000000000164DF2CB8000001D4000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01fips/fips-noboot.sh #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
    rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
elif [ -z "$fipsmode" ]; then
    die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
elif ! [ -f /tmp/fipsdone ]; then
    . /sbin/fips.sh
    fips_info "fips-noboot: start"
    mount_boot
    do_fips || die "FIPS integrity test failed"
    fips_info "fips-noboot: done!"
fi
07070100000059000081ED00000000000000000000000164DF2CB800001F52000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/modules.d/01fips/fips.sh    #!/bin/bash

# find fipscheck, prefer kernel-based version
fipscheck()
{
    FIPSCHECK=/usr/lib64/libkcapi/fipscheck
    if [ ! -f $FIPSCHECK ]; then
        FIPSCHECK=/usr/lib/libkcapi/fipscheck
    fi
    if [ ! -f $FIPSCHECK ]; then
        FIPSCHECK=/usr/bin/fipscheck
    fi
    echo $FIPSCHECK
}

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

# systemd lets stdout go to journal only, but the system
# has to halt when the integrity check fails to satisfy FIPS.
if [ -z "$DRACUT_SYSTEMD" ]; then
    fips_info() {
        info "$*"
    }
else
    fips_info() {
        echo "$*" >&2
    }
fi

mount_boot() {
    boot=$(getarg boot=)

    if [ -n "$boot" ]; then
        if [ -d /boot ] && ismounted /boot; then
            boot_dev=
            if command -v findmnt > /dev/null; then
                boot_dev=$(findmnt -n -o SOURCE /boot)
            fi
            fips_info "Ignoring 'boot=$boot' as /boot is already mounted ${boot_dev:+"from '$boot_dev'"}"
            return 0
        fi

        case "$boot" in
            LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
                boot="$(label_uuid_to_dev "$boot")"
                ;;
            /dev/*) ;;

            *)
                die "You have to specify boot=<boot device> as a boot option for fips=1"
                ;;
        esac

        if ! [ -e "$boot" ]; then
            udevadm trigger --action=add > /dev/null 2>&1

            i=0
            while ! [ -e "$boot" ]; do
                udevadm settle --exit-if-exists="$boot"
                [ -e "$boot" ] && break
                sleep 0.5
                i=$((i + 1))
                [ $i -gt 40 ] && break
            done
        fi

        [ -e "$boot" ] || return 1

        mkdir -p /boot
        fips_info "Mounting $boot as /boot"
        mount -oro "$boot" /boot || return 1
        FIPS_MOUNTED_BOOT=1
    elif ! ismounted /boot && [ -d "$NEWROOT/boot" ]; then
        # shellcheck disable=SC2114
        rm -fr -- /boot
        ln -sf "$NEWROOT/boot" /boot
    else
        die "You have to specify boot=<boot device> as a boot option for fips=1"
    fi
}

do_rhevh_check() {
    KERNEL=$(uname -r)
    kpath=${1}

    # If we're on RHEV-H, the kernel is in /run/initramfs/live/vmlinuz0
    HMAC_SUM_ORIG=$(while read -r a _ || [ -n "$a" ]; do printf "%s\n" "$a"; done < "$NEWROOT/boot/.vmlinuz-${KERNEL}.hmac")
    HMAC_SUM_CALC=$(sha512hmac "$kpath" | while read -r a _ || [ -n "$a" ]; do printf "%s\n" "$a"; done || return 1)
    if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
        warn "HMAC sum mismatch"
        return 1
    fi
    fips_info "rhevh_check OK"
    return 0
}

nonfatal_modprobe() {
    modprobe "$1" 2>&1 > /dev/stdout \
        | while read -r line || [ -n "$line" ]; do
            echo "${line#modprobe: FATAL: }" >&2
        done
}

get_vmname() {
    local _vmname

    case "$(uname -m)" in
    s390|s390x)
        _vmname=image
        ;;
    ppc*)
        _vmname=vmlinux
        ;;
    aarch64)
        _vmname=Image
        ;;
    armv*)
        _vmname=zImage
        ;;
    *)
        _vmname=vmlinuz
        ;;
    esac

    echo "$_vmname"
}

fips_load_crypto() {
    local _k
    local _v
    local _module
    local _found

    FIPSMODULES=$(cat /etc/fipsmodules)

    fips_info "Loading and integrity checking all crypto modules"
    mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
    for _module in $FIPSMODULES; do
        if [ "$_module" != "tcrypt" ]; then
            if ! nonfatal_modprobe "${_module}" 2> /tmp/fips.modprobe_err; then
                # check if kernel provides generic algo
                _found=0
                while read -r _k _ _v || [ -n "$_k" ]; do
                    [ "$_k" != "name" -a "$_k" != "driver" ] && continue
                    [ "$_v" != "$_module" ] && continue
                    _found=1
                    break
                done < /proc/crypto
                # If we find some hardware specific modules and cannot load them
                # it is not a problem, proceed.
                if [ "$_found" = "0" ]; then
                    # shellcheck disable=SC2055
                    if [    "$_module" != "${_module%intel}"    \
                        -o  "$_module" != "${_module%ssse3}"    \
                        -o  "$_module" != "${_module%x86_64}"   \
                        -o  "$_module" != "${_module%z90}"      \
                        -o  "$_module" != "${_module%s390}"     \
                        -o  "$_module" == "twofish_x86_64_3way" \
                        -o  "$_module" == "ablk_helper"         \
                        -o  "$_module" == "glue_helper"         \
                        -o  "$_module" == "sha1-mb"             \
                        -o  "$_module" == "sha256-mb"           \
                        -o  "$_module" == "sha512-mb"           \
                    ]; then
                        _found=1
                    fi
                fi
                [ "$_found" = "0" ] && cat /tmp/fips.modprobe_err >&2 && return 1
            fi
        fi
    done
    mv /etc/modprobe.d/fips.conf.bak /etc/modprobe.d/fips.conf

    fips_info "Self testing crypto algorithms"
    modprobe tcrypt || return 1
    rmmod tcrypt
}

do_fips() {
    KERNEL=$(uname -r)

    if ! getarg rd.fips.skipkernel > /dev/null; then

        fips_info "Checking integrity of kernel"
        if [ -e "/run/initramfs/live/vmlinuz0" ]; then
            do_rhevh_check /run/initramfs/live/vmlinuz0 || return 1
        elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then
            do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
        elif [ -e "/run/install/repo/images/pxeboot/vmlinuz" ]; then
            # This is a boot.iso with the .hmac inside the install.img
            do_rhevh_check /run/install/repo/images/pxeboot/vmlinuz || return 1
        else
            BOOT_IMAGE="$(getarg BOOT_IMAGE)"

            # Trim off any leading GRUB boot device (e.g. ($root) )
            # shellcheck disable=SC2001
            BOOT_IMAGE="$(echo "${BOOT_IMAGE}" | sed 's/^(.*)//')"

            BOOT_IMAGE_NAME="${BOOT_IMAGE##*/}"
            BOOT_IMAGE_PATH="${BOOT_IMAGE%${BOOT_IMAGE_NAME}}"

            local _vmname
            _vmname=$(get_vmname)

            if [ -z "$BOOT_IMAGE_NAME" ]; then
                BOOT_IMAGE_NAME="${_vmname}-${KERNEL}"
            elif ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE}" ]; then
                #if /boot is not a separate partition BOOT_IMAGE might start with /boot
                BOOT_IMAGE_PATH=${BOOT_IMAGE_PATH#"/boot"}
                #on some achitectures BOOT_IMAGE does not contain path to kernel
                #so if we can't find anything, let's treat it in the same way as if it was empty
                if ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE_NAME}" ]; then
                    BOOT_IMAGE_NAME="${_vmname}-${KERNEL}"
                    BOOT_IMAGE_PATH=""
                fi
            fi

            BOOT_IMAGE_HMAC="/boot/${BOOT_IMAGE_PATH}/.${BOOT_IMAGE_NAME}.hmac"
            if ! [ -e "${BOOT_IMAGE_HMAC}" ]; then
                warn "${BOOT_IMAGE_HMAC} does not exist"
                return 1
            fi

            BOOT_IMAGE_KERNEL="/boot/${BOOT_IMAGE_PATH}${BOOT_IMAGE_NAME}"
            if ! [ -e "${BOOT_IMAGE_KERNEL}" ]; then
                warn "${BOOT_IMAGE_KERNEL} does not exist"
                return 1
            fi

            if [ -n "$(fipscheck)" ]; then
                $(fipscheck) "${BOOT_IMAGE_KERNEL}" || return 1
            else
                warn "Could not find fipscheck to verify MACs"
                return 1
            fi
        fi
    fi

    fips_info "All initrd crypto checks done"

    : > /tmp/fipsdone

    if [ "$FIPS_MOUNTED_BOOT" = 1 ]; then
        fips_info "Unmounting /boot"
        umount /boot > /dev/null 2>&1
    else
        fips_info "Not unmounting /boot"
    fi

    return 0
}
  0707010000005A000081ED00000000000000000000000164DF2CB800000ADA000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01fips/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
installkernel() {
    local _fipsmodules _mod _bootfstype
    if [[ -f "${srcmods}/modules.fips" ]]; then
        _fipsmodules="$(cat "${srcmods}/modules.fips")"
    else
        _fipsmodules=""

        # Hashes:
        _fipsmodules+="sha1 sha224 sha256 sha384 sha512 "
        _fipsmodules+="sha3-224 sha3-256 sha3-384 sha3-512 "
        _fipsmodules+="crc32c crct10dif ghash "

        # Hashes, platform specific:
        _fipsmodules+="sha512-ssse3 sha1-ssse3 sha256-ssse3 "
        _fipsmodules+="ghash-clmulni-intel "

        # Ciphers:
        _fipsmodules+="cipher_null des3_ede aes cfb dh ecdh "

        # Modes/templates:
        _fipsmodules+="ecb cbc ctr xts gcm ccm authenc hmac cmac ofb cts "

        # Compression algs:
        _fipsmodules+="deflate lzo zlib "

        # PRNG algs:
        _fipsmodules+="ansi_cprng "

        # Misc:
        _fipsmodules+="aead cryptomgr tcrypt crypto_user "
    fi

    # shellcheck disable=SC2174
    mkdir -m 0755 -p "${initdir}/etc/modprobe.d"

    for _mod in $_fipsmodules; do
        if hostonly='' instmods -c -s "$_mod"; then
            echo "$_mod" >> "${initdir}/etc/fipsmodules"
            echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
        fi
    done

    # with hostonly_default_device fs module for /boot is not installed by default
    if [[ $hostonly ]] && [[ $hostonly_default_device == "no" ]]; then
        _bootfstype=$(find_mp_fstype /boot)
        if [[ -n $_bootfstype ]]; then
            hostonly='' instmods "$_bootfstype"
        else
            dwarning "Can't determine fs type for /boot, FIPS check may fail."
        fi
    fi
}

# called by dracut
install() {
    inst_hook pre-pivot 00 "$moddir/fips-boot.sh"
    inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
    inst_hook pre-udev 01 "$moddir/fips-load-crypto.sh"
    inst_script "$moddir/fips.sh" /sbin/fips.sh

    inst_multiple rmmod insmod mount uname umount
    inst_multiple -o sha512hmac \
                     fipscheck \
                     /usr/lib64/libkcapi/fipscheck \
                     /usr/lib/libkcapi/fipscheck

    inst_simple /etc/system-fips
    [ -c "${initdir}"/dev/random ] || mknod "${initdir}"/dev/random c 1 8 \
        || {
            dfatal "Cannot create /dev/random"
            dfatal "To create an initramfs with fips support, dracut has to run as root"
            return 1
        }
    [ -c "${initdir}"/dev/urandom ] || mknod "${initdir}"/dev/urandom c 1 9 \
        || {
            dfatal "Cannot create /dev/urandom"
            dfatal "To create an initramfs with fips support, dracut has to run as root"
            return 1
        }
}
  0707010000005B000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-ac-power    0707010000005C000081A400000000000000000000000164DF2CB800000129000000000000000000000000000000000000005900000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-ac-power/99-initrd-power-targets.rules  # This file is part of dracut systemd ac power module
SUBSYSTEM=="power_supply", KERNEL=="AC", ATTR{online}=="0", RUN+="/usr/sbin/systemctl start initrd-on-battery-power.target"
SUBSYSTEM=="power_supply", KERNEL=="AC", ATTR{online}=="1", RUN+="/usr/sbin/systemctl start initrd-on-ac-power.target"
   0707010000005D000081A400000000000000000000000164DF2CB8000000D4000000000000000000000000000000000000005500000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-ac-power/initrd-on-ac-power.target  # This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

[Unit]
Description=Initial RAM Disk On AC Power
ConditionPathExists=/usr/lib/initrd-release
DefaultDependencies=no
StopWhenUnneeded=yes
0707010000005E000081A400000000000000000000000164DF2CB8000000D9000000000000000000000000000000000000005A00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-ac-power/initrd-on-battery-power.target # This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

[Unit]
Description=Initial RAM Disk On Battery Power
ConditionPathExists=/usr/lib/initrd-release
DefaultDependencies=no
StopWhenUnneeded=yes
   0707010000005F000081ED00000000000000000000000164DF2CB80000030A000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-ac-power/module-setup.sh    #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst_rules "$moddir/99-initrd-power-targets.rules"
    inst_simple "$systemdutildir"/systemd-ac-power
    inst_simple "$moddir/initrd-on-ac-power.target" "$systemdsystemunitdir/initrd-on-ac-power.target"
    inst_simple "$moddir/initrd-on-battery-power.target" "$systemdsystemunitdir/initrd-on-battery-power.target"

}
  07070100000060000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-ask-password    07070100000061000081ED00000000000000000000000164DF2CB80000086F000000000000000000000000000000000000004F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-ask-password/module-setup.sh    #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed
    require_binaries \
        systemd-ask-password \
        systemd-tty-ask-password-agent \
        || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) for the module in the initramfs.
install() {

    inst_multiple -o \
        "$systemdsystemunitdir"/systemd-ask-password-console.path \
        "$systemdsystemunitdir"/systemd-ask-password-console.service \
        "$systemdsystemunitdir"/multi-user.target.wants/systemd-ask-password-wall.path \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-ask-password-console.path \
        systemd-ask-password \
        systemd-tty-ask-password-agent

    # Enable the systemd type service unit for systemd-ask-password.
    $SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-console.service

    # Install systemd-ask-password plymouth units if plymouth is enabled.
    if dracut_module_included "plymouth"; then
        inst_multiple -o \
            "$systemdsystemunitdir"/systemd-ask-password-plymouth.path \
            "$systemdsystemunitdir"/systemd-ask-password-plymouth.service

        $SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-plymouth.service
    fi

    # Uncomment this section if the usecase for wall module in the initramfs arises.
    # Install systemd-ask-password wall units if <wall module> is enabled.
    #if dracut_module_included "<wall module>"; then
    #    inst_multiple -o \
    #        $systemdsystemunitdir/systemd-ask-password-wall.path \
    #        $systemdsystemunitdir/systemd-ask-password-wall.service \
    #        $systemdsystemunitdir/multi-user.target.wants/systemd-ask-password-wall.path \
    #
    #    $SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-wall.service
    #fi
}
 07070100000062000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-coredump    07070100000063000081ED00000000000000000000000164DF2CB800000742000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-coredump/module-setup.sh    #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed
    require_binaries \
        coredumpctl \
        "$systemdutildir"/systemd-coredump \
        || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # This module has external dependency on the systemd module.
    echo systemd-journald systemd-sysctl
    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst_dir /var/lib/systemd/coredump
    inst_multiple -o \
        "$sysctld"/50-coredump.conf \
        "$systemdutildir"/coredump.conf \
        "$systemdsystemunitdir"/systemd-coredump \
        "$systemdsystemunitdir"/systemd-coredump.socket \
        "$systemdsystemunitdir"/systemd-coredump@.service \
        "$systemdsystemunitdir"/sockets.target.wants/systemd-coredump.socket \
        "$sysusers"/systemd-coredump.conf \
        coredumpctl

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            "$systemdutilconfdir"/coredump.conf \
            "$systemdsystemconfdir/coredump.conf.d/*.conf" \
            "$systemdsystemconfdir"/systemd-coredump.socket \
            "$systemdsystemconfdir/systemd-coredump.socket.d/*.conf" \
            "$systemdsystemconfdir"/systemd-coredump@.service \
            "$systemdsystemconfdir/systemd-coredump@.service.d/*.conf" \
            "$systemdsystemconfdir"/sockets.target.wants/systemd-coredump.socket \
            "$sysusersconfdir"/systemd-coredump.conf
    fi
}
  07070100000064000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-hostnamed   07070100000065000081A400000000000000000000000164DF2CB800000091000000000000000000000000000000000000005C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-hostnamed/99-systemd-networkd-dracut.conf   # This file is part of dracut systemd-hostnamed module.

[Service]
User=systemd-network
Group=systemd-hostname
AmbientCapabilities=CAP_SYS_ADMIN
   07070100000066000081ED00000000000000000000000164DF2CB8000006C5000000000000000000000000000000000000004C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-hostnamed/module-setup.sh   #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed.
    require_binaries \
        hostnamectl \
        "$systemdutildir"/systemd-hostnamed \
        || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # This module has external dependency on other module(s).
    echo dbus systemd-sysusers
    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst_simple "$moddir/systemd-hostname-dracut.conf" "$sysusers/systemd-hostname-dracut.conf"
    inst_simple "$moddir/org.freedesktop.hostname1_dracut.conf" "$dbussystem/org.freedesktop.hostname1_dracut.conf"
    inst_simple "$moddir/99-systemd-networkd-dracut.conf" "$systemdsystemunitdir/systemd-hostnamed.service.d/99-systemd-networkd-dracut.conf"

    inst_multiple -o \
        "$dbussystem"/org.freedesktop.hostname1.conf \
        "$dbussystemservices"/org.freedesktop.hostname1.service \
        "$systemdutildir"/systemd-hostnamed \
        "$systemdsystemunitdir"/systemd-hostnamed.service \
        "$systemdsystemunitdir/systemd-hostnamed.service.d/*.conf" \
        hostnamectl

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            /etc/hostname \
            "$systemdsystemconfdir"/systemd-hostnamed.service \
            "$systemdsystemconfdir/systemd-hostnamed.service.d/*.conf"
    fi
}
   07070100000067000081A400000000000000000000000164DF2CB80000021D000000000000000000000000000000000000006200000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-hostnamed/org.freedesktop.hostname1_dracut.conf <?xml version="1.0"?> <!--*-nxml-*-->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
        "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">

<!--

  This file is part of dracut systemd-hostnamed module.

-->

<busconfig>

        <policy group="systemd-hostname">
                <allow own="org.freedesktop.hostname1"/>
                <allow send_destination="org.freedesktop.hostname1"/>
                <allow receive_sender="org.freedesktop.hostname1"/>
        </policy>

</busconfig>
   07070100000068000081A400000000000000000000000164DF2CB800000060000000000000000000000000000000000000005900000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-hostnamed/systemd-hostname-dracut.conf  # This file is part of dracut systemd-hostnamed module.
g systemd-hostname - "systemd hostname"
07070100000069000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-initrd  0707010000006A000081ED00000000000000000000000164DF2CB800000369000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-initrd/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    [[ $mount_needs ]] && return 1

    return 0
}

# called by dracut
depends() {
    echo "systemd"
}

installkernel() {
    return 0
}

# called by dracut
install() {
    inst_multiple -o \
        "$systemdsystemunitdir"/initrd.target \
        "$systemdsystemunitdir"/initrd-fs.target \
        "$systemdsystemunitdir"/initrd-root-device.target \
        "$systemdsystemunitdir"/initrd-root-fs.target \
        "$systemdsystemunitdir"/initrd-usr-fs.target \
        "$systemdsystemunitdir"/initrd-switch-root.target \
        "$systemdsystemunitdir"/initrd-switch-root.service \
        "$systemdsystemunitdir"/initrd-cleanup.service \
        "$systemdsystemunitdir"/initrd-udevadm-cleanup-db.service \
        "$systemdsystemunitdir"/initrd-parse-etc.service

    $SYSTEMCTL -q --root "$initdir" set-default initrd.target
}
   0707010000006B000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-journald    0707010000006C000081A400000000000000000000000164DF2CB8000000DE000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-journald/initrd.conf    # This file is part of dracut systemd-journal module.
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Dracut requires volatile journal without rate-limiting

[Journal]
Storage=volatile
RateLimitInterval=0
RateLimitBurst=0
  0707010000006D000081ED00000000000000000000000164DF2CB800000B79000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-journald/module-setup.sh    #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed.
    require_binaries \
        journalctl \
        "$systemdutildir"/systemd-journald \
        || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst_simple "$moddir/initrd.conf" "$systemdutildir/journald.conf.d/initrd.conf"

    inst_multiple -o \
        "$systemdutildir"/journald.conf \
        "$systemdutildir/journald.conf.d/*.conf" \
        "$systemdutildir"/systemd-journald \
        "$systemdsystemunitdir"/systemd-journald.service \
        "$systemdsystemunitdir"/systemd-journald.socket \
        "$systemdsystemunitdir"/systemd-journald@.service \
        "$systemdsystemunitdir"/systemd-journald@.socket \
        "$systemdsystemunitdir"/systemd-journald-audit.socket \
        "$systemdsystemunitdir"/systemd-journald-dev-log.socket \
        "$systemdsystemunitdir"/systemd-journald-varlink@.socket \
        "$systemdsystemunitdir"/systemd-journal-flush.service \
        "$systemdsystemunitdir"/systemd-journal-catalog-update.service \
        "$systemdsystemunitdir"/sockets.target.wants/systemd-journald-audit.socket \
        "$systemdsystemunitdir"/sockets.target.wants/systemd-journald-dev-log.socket \
        "$systemdsystemunitdir"/sockets.target.wants/systemd-journald.socket \
        "$systemdsystemunitdir"/sockets.target.wants/systemd-journald-audit.socket \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-journald.service \
        "$sysusers"/systemd-journal.conf \
        journalctl

    # Install library file(s)
    _arch=${DRACUT_ARCH:-$(uname -m)}
    inst_libdir_file \
        {"tls/$_arch/",tls/,"$_arch/",}"liblz4.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libzstd.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"liblzma.so.*"

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            "$systemdutilconfdir"/journald.conf \
            "$systemdutilconfdir/journald.conf.d/*.conf" \
            "$systemdsystemconfdir"/systemd-journald.service \
            "$systemdsystemconfdir/systemd-journald.service.d/*.conf" \
            "$systemdsystemconfdir"/systemd-journal-flush.service \
            "$systemdsystemconfdir/systemd-journal-flush.service.d/*.conf" \
            "$systemdsystemconfdir"/systemd-journal-catalog-update.service \
            "$systemdsystemconfdir/systemd-journal-catalog-update.service.d/*.conf" \
            "$sysusersconfdir"/systemd-journal.conf
    fi

}
   0707010000006E000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-ldconfig    0707010000006F000081ED00000000000000000000000164DF2CB80000054D000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-ldconfig/module-setup.sh    #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed.
    require_binaries ldconfig || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # This module has external dependency on other module(s).
    echo systemd
    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst_multiple -o \
        /etc/ld.so.cache \
        /etc/ld.so.conf \
        "/etc/ld.so.conf.d/*.conf" \
        "$systemdsystemunitdir"/ldconfig.service \
        "$systemdsystemunitdir/ldconfig.service.d/*.conf" \
        "$systemdsystemunitdir"/sysinit.target.wants/ldconfig.service \
        ldconfig

    # Install required libraries.
    _arch=${DRACUT_ARCH:-$(uname -m)}
    inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"ld.so"

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            "$systemdsystemconfdir"/ldconfig.service \
            "$systemdsystemconfdir/ldconfig.service.d/*.conf"
    fi

}
   07070100000070000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-modules-load    07070100000071000081A400000000000000000000000164DF2CB800000504000000000000000000000000000000000000004F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-modules-load/module-setup.sh    #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed
    require_binaries "$systemdutildir"/systemd-modules-load || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst_multiple -o \
        "$modulesload/*.conf" \
        "$systemdutildir"/systemd-modules-load \
        "$systemdsystemunitdir"/systemd-modules-load.service \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-modules-load.service

    # Enable systemd type unit(s)
    $SYSTEMCTL -q --root "$initdir" enable systemd-modules-load.service

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            "$modulesloadconfdir/*.conf" \
            "$systemdsystemconfdir"/systemd-modules-load.service \
            "$systemdsystemconfdir/systemd-modules-load.service.d/*.conf"
    fi

}
07070100000072000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-networkd    07070100000073000081ED00000000000000000000000164DF2CB800000C8B000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-networkd/module-setup.sh    #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {
    [[ $mount_needs ]] && return 1

    # If the binary(s) requirements are not fulfilled the module can't be installed
    require_binaries ip networkctl \
        "$systemdutildir"/systemd-networkd \
        "$systemdutildir"/systemd-network-generator \
        "$systemdutildir"/systemd-networkd-wait-online \
        || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # This module has external dependency on other module(s).
    echo dbus kernel-network-modules systemd-sysusers
    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst_multiple -o \
        "$dbussystem"/org.freedesktop.network1.conf \
        "$dbussystemservices"/org.freedesktop.network1.service \
        "$systemdutildir"/networkd.conf \
        "$systemdutildir/networkd.conf.d/*.conf" \
        "$systemdutildir"/systemd-networkd \
        "$systemdutildir"/systemd-network-generator \
        "$systemdutildir"/systemd-networkd-wait-online \
        "$systemdutildir"/network/80-container-host0.network \
        "$systemdutildir"/network/80-container-ve.network \
        "$systemdutildir"/network/80-container-vz.network \
        "$systemdutildir"/network/80-vm-vt.network \
        "$systemdutildir"/network/80-wifi-adhoc.network \
        "$systemdutildir"/network/99-default.link \
        "$systemdsystemunitdir"/systemd-networkd.service \
        "$systemdsystemunitdir"/systemd-networkd.socket \
        "$systemdsystemunitdir"/systemd-network-generator.service \
        "$systemdsystemunitdir"/systemd-networkd-wait-online.service \
        "$systemdsystemunitdir"/systemd-network-generator.service \
        "$sysusers"/systemd-network.conf \
        networkctl ip

    # Enable systemd type units
    for i in \
        systemd-networkd.service \
        systemd-networkd.socket \
        systemd-network-generator.service \
        systemd-networkd-wait-online.service; do
        $SYSTEMCTL -q --root "$initdir" enable "$i"
    done

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            "$systemdutilconfdir"/networkd.conf \
            "$systemdutilconfdir/networkd.conf.d/*.conf" \
            "$systemdutilconfdir/network/*" \
            "$systemdsystemconfdir"/systemd-networkd.service \
            "$systemdsystemconfdir/systemd-networkd.service/*.conf" \
            "$systemdsystemunitdir"/systemd-networkd.socket \
            "$systemdsystemunitdir/systemd-networkd.socket/*.conf" \
            "$systemdsystemconfdir"/systemd-network-generator.service \
            "$systemdsystemconfdir/systemd-network-generator.service/*.conf" \
            "$systemdsystemconfdir"/systemd-networkd-wait-online.service \
            "$systemdsystemconfdir/systemd-networkd-wait-online.service/*.conf" \
            "$sysusersconfdir"/systemd-network.conf
    fi
}
 07070100000074000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-repart  07070100000075000081ED00000000000000000000000164DF2CB800000446000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-repart/module-setup.sh  #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed.
    require_binaries systemd-repart || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) for the module in the initramfs.
install() {

    inst_multiple -o \
        "$libdir/repart.d/*.conf" \
        "$systemdsystemunitdir"/systemd-repart.service \
        "$systemdsystemunitdir"/initrd-root-fs.target.wants/systemd-repart.service \
        systemd-repart

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            "/etc/repart.d/*.conf" \
            "$systemdsystemconfdir"/systemd-repart.service \
            "$systemdsystemconfdir/systemd-repart.service.d/*.conf"
    fi
}
  07070100000076000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-resolved    07070100000077000081ED00000000000000000000000164DF2CB800000757000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-resolved/module-setup.sh    #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed
    require_binaries \
        resolvectl \
        "$systemdutildir"/systemd-resolved \
        || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # This module has external dependency on other module(s).
    echo dbus systemd-sysusers
    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst_simple "$moddir/resolved-tmpfile-dracut.conf" "$tmpfilesdir/resolved-tmpfile-dracut.conf"

    inst_multiple -o \
        "$dbussystem"/org.freedesktop.resolve1.conf \
        "$dbussystemservices"/org.freedesktop.resolve1.service \
        "$systemdutildir"/resolv.conf \
        "$systemdutildir"/resolved.conf \
        "$systemdutildir/resolved.conf.d/*.conf" \
        "$systemdutildir"/systemd-resolved \
        "$systemdsystemunitdir"/systemd-resolved.service \
        "$systemdsystemunitdir/systemd-resolved.service.d/*.conf" \
        "$sysusers"/systemd-resolve.conf \
        resolvectl

    # Enable systemd type unit(s)
    $SYSTEMCTL -q --root "$initdir" enable systemd-resolved.service

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            "$systemdutilconfdir"/resolved.conf \
            "$systemdutilconfdir/resolved.conf.d/*.conf" \
            "$systemdsystemconfdir"/systemd-resolved.service \
            "$systemdsystemconfdir/systemd-resolved.service/*.conf" \
            "$sysusersconfdir"/systemd-resolve.conf
    fi
}
 07070100000078000081A400000000000000000000000164DF2CB80000007B000000000000000000000000000000000000005800000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-resolved/resolved-tmpfile-dracut.conf   # This file is part of dracut systemd-resolved module.
L! /etc/resolv.conf - - - - ../run/systemd/resolve/stub-resolv.conf
 07070100000079000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-rfkill  0707010000007A000081ED00000000000000000000000164DF2CB8000004E5000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-rfkill/module-setup.sh  #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed.
    require_binaries "$systemdutildir"/systemd-rfkill || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # This module has external dependency on other module(s).
    echo systemd
    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst_multiple -o \
        "$systemdutildir"/systemd-rfkill \
        "$systemdsystemunitdir"/systemd-rfkill.service \
        "$systemdsystemunitdir"/systemd-rfkill.socket

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            "$systemdsystemconfdir"/systemd-rfkill.service \
            "$systemdsystemconfdir/systemd-rfkill.service.d/*.conf" \
            "$systemdsystemconfdir"/systemd-rfkill.socket \
            "$systemdsystemconfdir/systemd-rfkill.socket.d/*.conf"
    fi

}
   0707010000007B000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-sysctl  0707010000007C000081ED00000000000000000000000164DF2CB800000551000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-sysctl/module-setup.sh  #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed
    require_binaries "$systemdutildir"/systemd-sysctl || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # This module has external dependency on other module(s).
    echo systemd-modules-load
    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) for the module in the initramfs.
install() {

    inst_multiple -o \
        "$sysctld/*.conf" \
        "$systemdsystemunitdir"/systemd-sysctl.service \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-sysctl.service \
        "$systemdutildir"/systemd-sysctl

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            /etc/sysctl.conf \
            "$sysctlconfdir/*.conf" \
            "$systemdsystemconfdir"/systemd-sysctl.service \
            "$systemdsystemconfdir/systemd-sysctl.service.d/*.conf"
    fi

    # Enable the systemd type service unit for sysctl.
    $SYSTEMCTL -q --root "$initdir" enable systemd-sysctl.service

}
   0707010000007D000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-sysext  0707010000007E000081ED00000000000000000000000164DF2CB800000530000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-sysext/module-setup.sh  #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed.
    require_binaries systemd-sysext || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # This module has external dependency on other module(s).
    echo systemd
    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst_multiple -o \
        "/usr/lib/extensions/*" \
        "/usr/lib/extension-release.d/extension-release.*" \
        "$systemdsystemunitdir"/systemd-sysext.service \
        "$systemdsystemunitdir/systemd-sysext.service.d/*.conf" \
        systemd-sysext

    # Enable systemd type unit(s)
    $SYSTEMCTL -q --root "$initdir" enable systemd-sysext.service

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            "/etc/extensions/*" \
            "$systemdsystemconfdir"/systemd-sysext.service \
            "$systemdsystemconfdir/systemd-sysext.service.d/*.conf"
    fi

}
0707010000007F000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-sysusers    07070100000080000081ED00000000000000000000000164DF2CB800000529000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-sysusers/module-setup.sh    #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed.
    require_binaries systemd-sysusers || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst_simple "$moddir/sysusers-dracut.conf" "$systemdsystemunitdir/systemd-sysusers.service.d/sysusers-dracut.conf"

    inst_multiple -o \
        "$sysusers"/basic.conf \
        "$sysusers"/systemd.conf \
        "$systemdsystemunitdir"/systemd-sysusers.service \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-sysusers.service \
        systemd-sysusers

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            "$sysusersconfdir"/basic.conf \
            "$sysusersconfdir"/systemd.conf \
            "$systemdsystemconfdir"/systemd-sysusers.service \
            "$systemdsystemconfdir/systemd-sysusers.service.d/*.conf"
    fi

}
   07070100000081000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000005000000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-sysusers/sysusers-dracut.conf   [Unit]
ConditionNeedsUpdate=
   07070100000082000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-timedated   07070100000083000081ED00000000000000000000000164DF2CB8000004ED000000000000000000000000000000000000004C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-timedated/module-setup.sh   #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed
    require_binaries \
        timedatectl \
        "$systemdutildir"/systemd-timedated \
        || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # This module has external dependency on other module(s).
    echo dbus
    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst_multiple -o \
        "$dbussystem"/org.freedesktop.timedate1.conf \
        "$dbussystemservices"/org.freedesktop.timedate1.service \
        "$systemdutildir"/systemd-timedated \
        "$systemdsystemunitdir"/systemd-timedated.service \
        timedatectl

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            "$systemdsystemconfdir"/systemd-timedated.service \
            "$systemdsystemconfdir/systemd-timedated.service/*.conf"
    fi
}
   07070100000084000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-timesyncd   07070100000085000081ED00000000000000000000000164DF2CB800000999000000000000000000000000000000000000004C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-timesyncd/module-setup.sh   #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed
    require_binaries \
        "$systemdutildir"/systemd-timesyncd \
        "$systemdutildir"/systemd-time-wait-sync \
        || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # This module has external dependency on other module(s).
    echo dbus systemd-timedated
    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    # Enable this if networkd ( not the module ) is disabled at build time and you want to use timesyncd
    # inst_simple "$moddir/timesyncd-tmpfile-dracut.conf" "$tmpfilesdir/timesyncd-tmpfile-dracut.conf"

    inst_multiple -o \
        "$dbussystem"/org.freedesktop.timesync1.conf \
        "$dbussystemservices"/org.freedesktop.timesync1.service \
        "$systemdutildir/ntp-units.d/*.list" \
        "$systemdutildir"/systemd-timesyncd \
        "$systemdutildir"/systemd-time-wait-sync \
        "$systemdutildir/timesyncd.conf.d/*.conf" \
        "$systemdsystemunitdir"/systemd-timesyncd.service \
        "$systemdsystemunitdir/systemd-timesyncd.service.d/*.conf" \
        "$systemdsystemunitdir"/systemd-time-wait-sync.service \
        "$systemdsystemunitdir/systemd-time-wait-sync.service.d/*.conf" \
        "$sysusers"/systemd-timesync.conf

    # Enable systemd type unit(s)
    for i in \
        systemd-timesyncd.service \
        systemd-time-wait-sync.service; do
        $SYSTEMCTL -q --root "$initdir" enable "$i"
    done

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            "$systemdutilconfdir/ntp-units.d/*.list" \
            "$systemdutilconfdir"/timesyncd.conf \
            "$systemdutilconfdir/timesyncd.conf.d/*.conf" \
            "$systemdsystemconfdir"/systemd-timesyncd.service \
            "$systemdsystemconfdir/systemd-timesyncd.service.d/*.conf" \
            "$systemdsystemunitdir"/systemd-time-wait-sync.service \
            "$systemdsystemunitdir/systemd-time-wait-sync.service.d/*.conf" \
            "$sysusersconfdir"/systemd-timesync.conf
    fi
}
   07070100000086000081A400000000000000000000000164DF2CB800000064000000000000000000000000000000000000005A00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-timesyncd/timesyncd-tmpfile-dracut.conf # This file is part of dracut systemd-timesyncd module.
d /run/systemd/netif/links 0755 root root -
07070100000087000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-tmpfiles    07070100000088000081ED00000000000000000000000164DF2CB800000B87000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-tmpfiles/module-setup.sh    #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed.
    require_binaries systemd-tmpfiles || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    # Excluding "$tmpfilesdir/home.conf", sets up /home /srv
    # Excluding "$tmpfilesdir/portables.conf", belongs in seperated portables module
    # Excluding "$tmpfilesdir/journal-nocow.conf", requires spesific btrfs setup
    # Excluding "$tmpfilesdir/legacy.conf", belongs in seperated legacy module
    # Excluding "$tmpfilesdir/systemd-nologin.conf", belongs in seperated pam module
    # Excluding "$tmpfilesdir/systemd-nspawn.conf", belongs in seperated machined module
    # Excluding "$tmpfilesdir/systemd-pstore.conf", belongs in seperated pstore module
    # Excluding "$tmpfilesdir/x11.conf", belongs in seperated x11 module

    inst_multiple -o \
        /usr/lib/group \
        /usr/lib/passwd \
        "$tmpfilesdir/etc.conf" \
        "$tmpfilesdir/static-nodes-permissions.conf" \
        "$tmpfilesdir/systemd-tmp.conf" \
        "$tmpfilesdir/systemd.conf" \
        "$tmpfilesdir/var.conf" \
        "$systemdsystemunitdir"/systemd-tmpfiles-clean.service \
        "$systemdsystemunitdir/systemd-tmpfiles-clean.service.d/*.conf" \
        "$systemdsystemunitdir"/systemd-tmpfiles-setup.service \
        "$systemdsystemunitdir/systemd-tmpfiles-setup.service.d/*.conf" \
        "$systemdsystemunitdir"/systemd-tmpfiles-setup-dev.service \
        "$systemdsystemunitdir/systemd-tmpfiles-setup-dev.service.d/*.conf" \
        "$systemdsystemunitdir"/systemd-tmpfiles-clean.timer \
        "$systemdsystemunitdir"/timers.target.wants/systemd-tmpfiles-clean.timer \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup-dev.service \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup.service \
        systemd-tmpfiles

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            /etc/group \
            /etc/passwd \
            "$tmpfilesconfdir/*.conf" \
            "$systemdsystemconfdir"/systemd-tmpfiles-clean.service \
            "$systemdsystemconfdir/systemd-tmpfiles-clean.service.d/*.conf" \
            "$systemdsystemconfdir"/systemd-tmpfiles-setup.service \
            "$systemdsystemconfdir/systemd-tmpfiles-setup.service.d/*.conf" \
            "$systemdsystemconfdir"/systemd-tmpfiles-setup-dev.service \
            "$systemdsystemconfdir/systemd-tmpfiles-setup-dev.service.d/*.conf"
    fi

}
 07070100000089000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003800000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-udevd   0707010000008A000081ED00000000000000000000000164DF2CB80000119C000000000000000000000000000000000000004800000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-udevd/module-setup.sh   #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed.
    require_binaries \
        udevadm \
        "$systemdutildir"/systemd-udevd \
        || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # This module has external dependency on other module(s).
    echo systemd
    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst_multiple -o \
        "$udevdir"/hwdb.bin \
        "$udevdir"/udev.conf \
        "$udevdir"/ata_id \
        "$udevdir"/cdrom_id \
        "$udevdir"/dmi_memory_id \
        "$udevdir"/fido_id \
        "$udevdir"/mtd_probe \
        "$udevdir"/mtp-probe \
        "$udevdir"/scsi_id \
        "$udevdir"/v4l_id \
        "$udevrulesdir"/50-udev-default.rules \
        "$udevrulesdir"/60-autosuspend.rules \
        "$udevrulesdir"/60-block.rules \
        "$udevrulesdir"/60-cdrom_id.rules \
        "$udevrulesdir"/60-drm.rules \
        "$udevrulesdir"/60-evdev.rules \
        "$udevrulesdir"/60-fido-id.rules \
        "$udevrulesdir"/60-input-id.rules \
        "$udevrulesdir"/60-persistent-alsa.rules \
        "$udevrulesdir"/60-persistent-input.rules \
        "$udevrulesdir"/60-persistent-storage-tape.rules \
        "$udevrulesdir"/60-persistent-storage.rules \
        "$udevrulesdir"/60-persistent-v4l.rules \
        "$udevrulesdir"/60-sensor.rules \
        "$udevrulesdir"/60-serial.rules \
        "$udevrulesdir"/64-btrfs.rules \
        "$udevrulesdir"/70-joystick.rules \
        "$udevrulesdir"/70-memory.rules \
        "$udevrulesdir"/70-mouse.rules \
        "$udevrulesdir"/70-touchpad.rules \
        "$udevrulesdir"/75-net-description.rules \
        "$udevrulesdir"/75-probe_mtd.rules \
        "$udevrulesdir"/78-sound-card.rules \
        "$udevrulesdir"/80-drivers.rules \
        "$udevrulesdir"/80-net-setup-link.rules \
        "$udevrulesdir"/81-net-dhcp.rules \
        "$udevrulesdir"/99-systemd.rules \
        "$systemdutildir"/systemd-udevd \
        "$systemdsystemunitdir"/systemd-udevd.service \
        "$systemdsystemunitdir/systemd-udevd.service.d/*.conf" \
        "$systemdsystemunitdir"/systemd-udev-trigger.service \
        "$systemdsystemunitdir/systemd-udev-trigger.service.d/*.conf" \
        "$systemdsystemunitdir"/systemd-udev-settle.service \
        "$systemdsystemunitdir/systemd-udev-settle.service.d/*.conf" \
        "$systemdsystemunitdir"/systemd-udevd-control.socket \
        "$systemdsystemunitdir"/systemd-udevd-kernel.socket \
        "$systemdsystemunitdir"/sockets.target.wants/systemd-udevd-control.socket \
        "$systemdsystemunitdir"/sockets.target.wants/systemd-udevd-kernel.socket \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-udevd.service \
        "$systemdsystemunitdir"/sysinit.target.wants/systemd-udev-trigger.service \
        udevadm

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            "$udevconfdir"/hwdb.bin \
            "$udevconfdir"/udev.conf \
            "$udevrulesconfdir/*.rules" \
            "$systemdutilconfdir"/hwdb/hwdb.bin \
            "$systemdsystemconfdir"/systemd-udevd.service \
            "$systemdsystemconfdir/systemd-udevd.service.d/*.conf" \
            "$systemdsystemconfdir"/systemd-udev-trigger.service \
            "$systemdsystemconfdir/systemd-udev-trigger.service.d/*.conf" \
            "$systemdsystemconfdir"/systemd-udev-settle.service \
            "$systemdsystemconfdir/systemd-udev-settle.service.d/*.conf" \
            "$systemdsystemconfdir"/systemd-udevd-control.socket \
            "$systemdsystemconfdir"/systemd-udevd-kernel.socket \
            "$systemdsystemconfdir"/sockets.target.wants/systemd-udevd-control.socket \
            "$systemdsystemconfdir"/sockets.target.wants/systemd-udevd-kernel.socket \
            "$systemdsystemconfdir"/sysinit.target.wants/systemd-udevd.service \
            "$systemdsystemconfdir"/sysinit.target.wants/systemd-udev-trigger.service
    fi

    # Install required libraries.
    _arch=${DRACUT_ARCH:-$(uname -m)}
    inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libudev.so.*"

}
0707010000008B000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-veritysetup 0707010000008C000081ED00000000000000000000000164DF2CB8000008CC000000000000000000000000000000000000004E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/01systemd-veritysetup/module-setup.sh #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed.
    require_binaries \
        "$systemdutildir"/systemd-veritysetup \
        "$systemdutildir"/system-generators/systemd-veritysetup-generator \
        || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # This module has external dependency on other module(s).
    echo systemd dm
    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst_multiple -o \
        "$systemdutildir"/systemd-veritysetup \
        "$systemdutildir"/system-generators/systemd-veritysetup-generator \
        "$systemdsystemunitdir"/remote-veritysetup.target \
        "$systemdsystemunitdir"/veritysetup-pre.target \
        "$systemdsystemunitdir"/veritysetup.target \
        "$systemdsystemunitdir"/sysinit.target.wants/veritysetup.target \
        "$systemdsystemunitdir"/initrd-root-device.target.wants/remote-veritysetup.target

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            /etc/veritytab \
            "$systemdsystemconfdir"/veritysetup.target \
            "$systemdsystemconfdir/veritysetup.target.wants/*.target" \
            "$systemdsystemconfdir"/veritysetup-pre.target \
            "$systemdsystemconfdir/veritysetup-pre.target.wants/*.target" \
            "$systemdsystemconfdir"/remote-veritysetup.target \
            "$systemdsystemconfdir/remote-veritysetup.target.wants/*.target" \
            "$systemdsystemconfdir"/sysinit.target.wants/veritysetup.target \
            "$systemdsystemconfdir/sysinit.target.wants/veritysetup.target.wants/*.target" \
            "$systemdsystemconfdir"/initrd-root-device.target.wants/remote-veritysetup.target
    fi

    # Install required libraries.
    _arch=${DRACUT_ARCH:-$(uname -m)}
    inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libcryptsetup.so.*"

}
0707010000008D000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/02caps    0707010000008E000081A400000000000000000000000164DF2CB80000053D000000000000000000000000000000000000003600000000dracut-055+suse.347.gdcb9bdbf/modules.d/02caps/README This adds the following parameters:
rd.caps=1
        turn the caps module on/off
rd.caps.initdrop=cap_sys_module,cap_sys_rawio
        drop the specified comma separated capabilities
rd.caps.disablemodules=1
        turn off module loading
rd.caps.disablekexec=1
        turn off the kexec functionality

If module loading is turned off, all modules have to be loaded in the
initramfs, which are used later on. This can be done with
"rd.driver.pre="
rd.driver.pre=autofs4,sunrpc,ipt_REJECT,nf_conntrack_ipv4,....

Because the kernel command line would get huge with all those drivers, I
recommend to make use of $initramfs/etc/cmdline.

So, all rd.caps.* and rd.driver.pre arguments are in caps.conf can be
copied to $initramfs/etc/cmdline with "-i caps.conf /etc/cmdline".

Also all modules have to be loaded in the initramfs via "--add-drivers".

The resulting initramfs creation would look like this:

  --add-drivers "autofs4 sunrpc ipt_REJECT nf_conntrack_ipv4 \
  nf_defrag_ipv4 iptable_filter ip_tables
  ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack
  ip6table_filter ip6_tables dm_mirror dm_region_hash dm_log uinput ppdev
  parport_pc parport ipv6 sg 8139too 8139cp mii i2c_piix4 i2c_core ext3
  jbd mbcache sd_mod crc_t10dif sr_mod cdrom ata_generic pata_acpi ata_piix
  dm_mod" \
  /boot/initramfs-caps.img
   0707010000008F000081ED00000000000000000000000164DF2CB8000005D6000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/modules.d/02caps/caps.sh    #!/bin/bash

capsmode=$(getarg rd.caps)

if [ "$capsmode" = "1" ]; then
    CAPS_INIT_DROP=$(getarg rd.caps.initdrop=)
    # shellcheck disable=SC2016
    CAPS_USERMODEHELPER_BSET=$(capsh --drop="$CAPS_INIT_DROP" -- -c 'while read a b  || [ -n "$a" ]; do [ "$a" = "CapBnd:" ] && echo $((0x${b:$((${#b}-8)):8})) $((0x${b:$((${#b}-16)):8})) && break; done < /proc/self/status')
    CAPS_MODULES_DISABLED=$(getarg rd.caps.disablemodules=)
    CAPS_KEXEC_DISABLED=$(getarg rd.caps.disablekexec=)

    info "Loading CAPS_MODULES $CAPS_MODULES"
    for i in $CAPS_MODULES; do modprobe "$i" 2>&1 > /dev/null | vinfo; done

    if [ "$CAPS_MODULES_DISABLED" = "1" -a -e /proc/sys/kernel/modules_disabled ]; then
        info "Disabling module loading."
        echo "$CAPS_MODULES_DISABLED" > /proc/sys/kernel/modules_disabled
    fi

    if [ "$CAPS_KEXEC_DISABLED" = "1" -a -e /proc/sys/kernel/kexec_disabled ]; then
        info "Disabling kexec."
        echo "$CAPS_KEXEC_DISABLED" > /proc/sys/kernel/kexec_disabled
    fi

    info "CAPS_USERMODEHELPER_BSET=$CAPS_USERMODEHELPER_BSET"
    if [ -e /proc/sys/kernel/usermodehelper/bset ]; then
        info "Setting usermode helper bounding set."
        echo "$CAPS_USERMODEHELPER_BSET" > /proc/sys/kernel/usermodehelper/bset
        echo "$CAPS_USERMODEHELPER_BSET" > /proc/sys/kernel/usermodehelper/inheritable
    fi

    echo "CAPS_INIT_DROP=\"$CAPS_INIT_DROP\"" > /etc/capsdrop
    info "Will drop capabilities $CAPS_INIT_DROP from init."
fi
  07070100000090000081ED00000000000000000000000164DF2CB8000001F4000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/02caps/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    require_binaries capsh
    return 255
}

# called by dracut
depends() {
    echo bash
    return 0
}

# called by dracut
install() {
    if ! dracut_module_included "systemd"; then
        inst_hook pre-pivot 00 "$moddir/caps.sh"
        inst "$(find_binary capsh 2> /dev/null)" /usr/sbin/capsh
        # capsh wants bash and we need bash also
        inst /bin/bash
    else
        dwarning "caps: does not work with systemd in the initramfs"
    fi
}
07070100000091000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/modules.d/03modsign 07070100000092000081ED00000000000000000000000164DF2CB8000000EB000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/03modsign/load-modsign-keys.sh    #!/bin/sh
#
# Licensed under the GPLv2
#
# Copyright 2013 Red Hat, Inc.
# Peter Jones <pjones@redhat.com>

for x in /lib/modules/keys/*; do
    [ "${x}" = "/lib/modules/keys/*" ] && break
    keyctl padd asymmetric "" @s < "${x}"
done
 07070100000093000081ED00000000000000000000000164DF2CB80000032F000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/modules.d/03modsign/module-setup.sh #!/bin/bash
#
# Licensed under the GPLv2
#
# Copyright 2013 Red Hat, Inc.
# Peter Jones <pjones@redhat.com>

# called by dracut
check() {
    require_binaries keyctl || return 1

    # do not include module in hostonly mode,
    # if no keys are present
    if [[ $hostonly ]]; then
        x=$(echo "$dracutsysrootdir"/lib/modules/keys/*)
        [[ ${x} == "$dracutsysrootdir/lib/modules/keys/*" ]] && return 255
    fi

    return 0
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    inst_dir /lib/modules/keys
    inst_binary keyctl

    inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"

    for x in "$dracutsysrootdir"/lib/modules/keys/*; do
        [[ ${x} == "$dracutsysrootdir/lib/modules/keys/*" ]] && break
        inst_simple "${x#$dracutsysrootdir}"
    done
}
 07070100000094000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/modules.d/03rescue  07070100000095000081ED00000000000000000000000164DF2CB800000178000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/03rescue/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    # do not add this module by default
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    inst_multiple -o ps grep more cat rm strace free showmount \
        ping netstat rpcinfo vi scp ping6 ssh \
        fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.f2fs fsck.vfat e2fsck
}
07070100000096000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003300000000dracut-055+suse.347.gdcb9bdbf/modules.d/04watchdog    07070100000097000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/04watchdog-modules    07070100000098000081ED00000000000000000000000164DF2CB8000002FD000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/04watchdog-modules/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    return 0
}

installkernel() {
    local -A _drivers
    local _wdtdrv

    for _wd in /sys/class/watchdog/*; do
        ! [ -e "$_wd" ] && continue
        _wdtdrv=$(get_dev_module "$_wd")
        if [[ $_wdtdrv ]]; then
            instmods "$_wdtdrv"
            for i in $_wdtdrv; do
                _drivers[$i]=1
            done
        fi
    done

    # ensure that watchdog module is loaded as early as possible
    if [[ ${!_drivers[*]} ]]; then
        echo "rd.driver.pre=\"$(
            IFS=,
            echo "${!_drivers[*]}"
        )\"" > "${initdir}"/etc/cmdline.d/00-watchdog.conf
    fi
    return 0
}
   07070100000099000081ED00000000000000000000000164DF2CB8000003D8000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/04watchdog/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    echo watchdog-modules
    return 0
}

# called by dracut
install() {
    # Do not add watchdog hooks if systemd module is included
    # In that case, systemd will manage watchdog kick
    if ! dracut_module_included "systemd"; then
        inst_hook cmdline 00 "$moddir/watchdog.sh"
        inst_hook cmdline 50 "$moddir/watchdog.sh"
        inst_hook pre-trigger 00 "$moddir/watchdog.sh"
        inst_hook initqueue 00 "$moddir/watchdog.sh"
        inst_hook mount 00 "$moddir/watchdog.sh"
        inst_hook mount 50 "$moddir/watchdog.sh"
        inst_hook mount 99 "$moddir/watchdog.sh"
        inst_hook pre-pivot 00 "$moddir/watchdog.sh"
        inst_hook pre-pivot 99 "$moddir/watchdog.sh"
        inst_hook cleanup 00 "$moddir/watchdog.sh"
        inst_hook cleanup 99 "$moddir/watchdog.sh"
    fi

    inst_hook emergency 02 "$moddir/watchdog-stop.sh"
    inst_multiple -o wdctl
}
0707010000009A000081ED00000000000000000000000164DF2CB80000003D000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/04watchdog/watchdog-stop.sh   #!/bin/sh
[ -c /dev/watchdog ] && printf 'V' > /dev/watchdog
   0707010000009B000081ED00000000000000000000000164DF2CB800000119000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/04watchdog/watchdog.sh    #!/bin/sh
if [ -e /dev/watchdog ]; then
    if [ ! -e /tmp/watchdog_timeout ]; then
        wdctl -s 60 /dev/watchdog > /dev/null 2>&1
        : > /tmp/watchdog_timeout
    fi
    info "Triggering watchdog"
    : > /dev/watchdog
else
    modprobe ib700wdt
    modprobe i6300esb
fi
   0707010000009C000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/modules.d/05busybox 0707010000009D000081ED00000000000000000000000164DF2CB80000023D000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/modules.d/05busybox/module-setup.sh #!/bin/bash

# called by dracut
check() {
    require_binaries busybox || return 1

    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    local _i _path _busybox
    local _progs=()
    _busybox=$(find_binary busybox)
    inst "$_busybox" /usr/bin/busybox
    for _i in $($_busybox --list); do
        [[ ${_i} == busybox ]] && continue
        _progs+=("${_i}")
    done

    for _i in "${_progs[@]}"; do
        _path=$(find_binary "$_i")
        [ -z "$_path" ] && continue
        ln_r /usr/bin/busybox "$_path"
    done
}
   0707010000009E000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003600000000dracut-055+suse.347.gdcb9bdbf/modules.d/06dbus-broker 0707010000009F000081ED00000000000000000000000164DF2CB800000CA9000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/modules.d/06dbus-broker/module-setup.sh #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed
    require_binaries busctl || return 1
    require_binaries dbus-broker || return 1
    require_binaries dbus-broker-launch || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {
    # This module has external dependency on the systemd module.
    echo systemd systemd-sysusers
    # Return 0 to include the dependent systemd module in the initramfs.
    return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    # Create dbus related directories.
    inst_dir "$dbus"
    inst_dir "$dbusinterfaces"
    inst_dir "$dbusservices"
    inst_dir "$dbussession"
    inst_dir "$dbussystem"
    inst_dir "$dbussystemservices"
    inst_dir "$dbusconfdir"
    inst_dir "$dbusinterfacesconfdir"
    inst_dir "$dbusservicesconfdir"
    inst_dir "$dbussessionconfdir"
    inst_dir "$dbussystemconfdir"
    inst_dir "$dbussystemservicesconfdir"

    inst_multiple -o \
        "$dbus"/session.conf \
        "$dbus"/system.conf \
        "$dbussystem"/org.freedesktop.systemd1.conf \
        "$dbusservicesconfdir"/org.freedesktop.systemd1.service \
        "$dbussystemservices"/org.freedesktop.systemd1.service \
        "$sysusers"/dbus.conf \
        "$systemdcatalog"/dbus-broker.catalog \
        "$systemdcatalog"/dbus-broker-launch.catalog \
        "$systemdsystemunitdir"/dbus-broker.service \
        "$systemduser"/dbus-broker.service \
        "$systemdsystemunitdir"/dbus.socket \
        "$systemduser"/dbus.socket \
        "$systemdsystemunitdir"/dbus.target.wants \
        busctl dbus-broker dbus-broker-launch

    # Adjusting dependencies for initramfs in the dbus socket unit.
    # shellcheck disable=SC1004
    sed -i -e \
        '/^\[Unit\]/aDefaultDependencies=no\
        Conflicts=shutdown.target\
        Before=shutdown.target
        /^\[Socket\]/aRemoveOnStop=yes' \
        "$initdir$systemdsystemunitdir/dbus.socket"

    $SYSTEMCTL -q --root "$initdir" enable dbus-broker.service

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            "$dbusconfdir"/session.conf \
            "$dbusconfdir"/system.conf \
            "$sysusersconfdir"/dbus.conf \
            "$systemdsystemconfdir"/dbus.socket \
            "$systemdsystemconfdir"/dbus.socket.d/*.conf \
            "$systemdsystemconfdir"/dbus-broker.service \
            "$systemdsystemconfdir"/dbus-broker.service.d/*.conf
    fi

    # We need to make sure that systemd-tmpfiles-setup.service->dbus.socket
    # will not wait for local-fs.target to start if swap is encrypted,
    # this would make dbus wait the timeout for the swap before loading.
    # This could delay sysinit services that are dependent on dbus.service.
    sed -i -Ee \
        '/^After/s/(After[[:space:]]*=.*)(local-fs.target[[:space:]]*)(.*)/\1-\.mount \3/' \
        "$initdir$systemdsystemunitdir/systemd-tmpfiles-setup.service"
}
   070701000000A0000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003600000000dracut-055+suse.347.gdcb9bdbf/modules.d/06dbus-daemon 070701000000A1000081ED00000000000000000000000164DF2CB800000DC1000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/modules.d/06dbus-daemon/module-setup.sh #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed
    require_binaries busctl || return 1
    require_binaries dbus-daemon || return 1
    require_binaries dbus-send || return 1


    # Return 255 to only include the module, if another module requires it.
    return 255
}

# Module dependency requirements.
depends() {

    # This module has external dependency on the systemd module.
    echo systemd
    # Return 0 to include the dependent systemd module in the initramfs.
    return 0
}

# Install the required file(s) and directories for the module in the initramfs.
install() {
    # dbus conflicts with dbus-broker.
    if dracut_module_included "dbus-broker"; then
        derror "dbus conflicts with dbus-broker in the initramfs."
        return 1
    fi

    # Create dbus related directories.
    inst_dir "$dbus"
    inst_dir "$dbusinterfaces"
    inst_dir "$dbusservices"
    inst_dir "$dbussession"
    inst_dir "$dbussystem"
    inst_dir "$dbussystemservices"
    inst_dir "$dbusconfdir"
    inst_dir "$dbusinterfacesconfdir"
    inst_dir "$dbusservicesconfdir"
    inst_dir "$dbussessionconfdir"
    inst_dir "$dbussystemconfdir"
    inst_dir "$dbussystemservicesconfdir"

    inst_multiple -o \
        "$dbus"/system.conf \
        "$dbussystem"/org.freedesktop.systemd1.conf \
        "$dbusservicesconfdir"/org.freedesktop.systemd1.service \
        "$dbussystemservices"/org.freedesktop.systemd1.service \
        "$systemdsystemunitdir"/dbus.service \
        "$systemdsystemunitdir"/dbus.socket \
        "$systemdsystemunitdir"/dbus.target.wants \
        busctl dbus-send dbus-daemon

    # Adjusting dependencies for initramfs in the dbus service unit.
    # shellcheck disable=SC1004
    sed -i -e \
        '/^\[Unit\]/aDefaultDependencies=no\
        Conflicts=shutdown.target\
        Before=shutdown.target' \
        "$initdir$systemdsystemunitdir/dbus.service"

    # Adjusting dependencies for initramfs in the dbus socket unit.
    # shellcheck disable=SC1004
    sed -i -e \
        '/^\[Unit\]/aDefaultDependencies=no\
        Conflicts=shutdown.target initrd-switch-root.service\
        Before=shutdown.target initrd-switch-root.service
        /^\[Socket\]/aRemoveOnStop=yes' \
        "$initdir$systemdsystemunitdir/dbus.socket"

    # Adding the user and group for dbus
    grep '^\(d\|message\)bus:' "$dracutsysrootdir"/etc/passwd >> "$initdir/etc/passwd"
    grep '^\(d\|message\)bus:' "$dracutsysrootdir"/etc/group >> "$initdir/etc/group"

    # Install the hosts local user configurations if enabled.
    if [[ $hostonly ]]; then
        inst_multiple -H -o \
            "$dbusconfdir"/system.conf \
            "$systemdsystemconfdir"/dbus.socket \
            "$systemdsystemconfdir"/dbus.socket.d/*.conf \
            "$systemdsystemconfdir"/dbus.service \
            "$systemdsystemconfdir"/dbus.service.d/*.conf

    fi

    # We need to make sure that systemd-tmpfiles-setup.service->dbus.socket
    # will not wait for local-fs.target to start if swap is encrypted,
    # this would make dbus wait the timeout for the swap before loading.
    # This could delay sysinit services that are dependent on dbus.service.
    sed -i -Ee \
        '/^After/s/(After[[:space:]]*=.*)(local-fs.target[[:space:]]*)(.*)/\1-\.mount \3/' \
        "$initdir$systemdsystemunitdir/systemd-tmpfiles-setup.service"
}   070701000000A2000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/06rngd    070701000000A3000081A400000000000000000000000164DF2CB8000004D7000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/06rngd/module-setup.sh    #!/bin/bash
# vim: set tabstop=8 shiftwidth=4 softtabstop=4 expandtab smarttab colorcolumn=80:
#
# Copyright (c) 2019 Red Hat, Inc.
# Author: Renaud Métrich <rmetrich@redhat.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

check() {
    # if there's no rngd binary, no go.
    require_binaries rngd || return 1

    return 0
}

depends() {
    echo systemd
    return 0
}

install() {
    inst rngd
    inst_simple "${moddir}/rngd.service" "${systemdsystemunitdir}/rngd.service"
    # make sure dependant libs are installed too
    inst_libdir_file opensc-pkcs11.so

    $SYSTEMCTL -q --root "$initdir" add-wants sysinit.target rngd.service
}
 070701000000A4000081A400000000000000000000000164DF2CB8000000B6000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/06rngd/rngd.service   [Unit]
Description=Hardware RNG Entropy Gatherer Daemon
DefaultDependencies=no
Before=systemd-udevd.service
ConditionVirtualization=!container

[Service]
ExecStart=/usr/sbin/rngd -f
  070701000000A5000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/09dbus    070701000000A6000081ED00000000000000000000000164DF2CB8000002A5000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/09dbus/module-setup.sh    #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {
    # We only want to return 255 since this is a meta module.
    return 255
}

# Module dependency requirements.
depends() {
    local _module
    # Add a dbus meta dependency based on the module in use.
    for _module in dbus-daemon dbus-broker; do
        if dracut_module_included "$_module"; then
            echo "$_module"
            return 0
        fi
    done

    if find_binary dbus-broker &> /dev/null; then
        echo "dbus-broker"
        return 0
    else
        echo "dbus-daemon"
        return 0
    fi

    return 1
}
   070701000000A7000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/10i18n    070701000000A8000081A400000000000000000000000164DF2CB8000000A8000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/modules.d/10i18n/10-console.rules   # Console initialization - keyboard, font, etc.
KERNEL=="tty0",		RUN+="/sbin/initqueue --onetime --unique --name console_init_$name /lib/udev/console_init $root/$name"
070701000000A9000081A400000000000000000000000164DF2CB800001144000000000000000000000000000000000000003600000000dracut-055+suse.347.gdcb9bdbf/modules.d/10i18n/README dracut i18n module
------------------

INDEX

0. Introduction
1. Hostonly vs Generic
2. Configuration
   2.1. Variables
   2.2. Setting up mappings
   2.3. Additional settings
3. Kernel parameters

~

0. Introduction

i18n module provides internationalization for initramfs at runtime.  It
is intended to be generic across different GNU/Linux distributions.

i18n and keyboard settings are stored in different files among
distributions.  To deal with it avoiding hardcoding those differences in
the installation script we handle it by mappings between variables used
by dracut and the ones in the system.  Package maintainer is expected to
create those for his/her distribution and it's appreciated to share it
with us, so we can include it in source package.


1. Hostonly vs Generic

If you invoke dracut with '-H' option, i18n module install script will
gather variables values from your configuration files using mappings
provided in "/etc/dracut.conf.d/<foo>.conf".  Those variables will be
put in "etc/vconsole.conf" and "etc/locale.conf" files inside initramfs
image. Next it will install only declared font, keymaps and so.

When building generic image (dracut without '-H' option), install script
copies all content of directories: consolefonts, consoletrans, unimaps
and keymaps to image.  Take into account that's about 4 MiB.


2. Configuration

2.1. Variables

The following variables are used by i18n install script and at initramfs
runtime:

    KEYMAP - keyboard translation table loaded by loadkeys
    KEYTABLE - base name for keyboard translation table; if UNICODE is
    true, Unicode version will be loaded. Overrides KEYMAP.
    EXT_KEYMAPS - list of extra keymaps to bo loaded (sep. by space)
    UNICODE - boolean, indicating UTF-8 mode
    FONT - console font
    FONT_MAP - see description of '-m' parameter in setfont manual
    FONT_UNIMAP - see description of '-u' parameter in setfont manual

The following are appended to EXT_KEYMAPS only during build time:

    UNIKEYMAP
    GRP_TOGGLE

They were used in 10redhat-i18n module, but not sure of its purpose.
I'm leaving it in case...  The following are taken from the environment:

    LANG
    LC_ALL

If UNICODE variable is not provided, script indicates if UTF-8 should be
used on the basis of LANG value (if it ends with ".utf8" or similar).


2.2. Setting up mappings

Mappings between variables listed in 2.1. and the ones spread around
your system are set up in /etc/dracut.conf.d/<foo>.conf.  You need to
assign mappings to i18n_vars.  Here's an example:

i18n_vars="/etc/conf.d/keymaps:KEYMAP,EXTENDED_KEYMAPS-EXT_KEYMAPS /etc/conf.d/consolefont:CONSOLEFONT-FONT,CONSOLETRANSLATION-FONT_MAP /etc/rc.conf:UNICODE"

First we've got name of file in host file system tree.  After colon
there's mapping: <from>-<to>.  If both variables have the same name you
can enter just a single, but it's important to specify it!  The module
will source only variables you've listed.

Below there's detailed description in BNF:

<list> ::= <element> | <element> " " <list>
<element> ::= <conf-file-name> ":" <map-list>
<map-list> ::= <mapping> | <mapping> "," <map-list>
<mapping> ::= <src-var> "-" <dst-var> | <src-var>

We assume no whitespace are allowed between symbols.
<conf-file-name> is a file holding <src-var> in your system.
<src-var> is a variable holding value of meaning the same as <dst-var>.
<dst-var> is a variable which will be set up inside initramfs.
If <dst-var> has the same name as <src-var> we can omit <dst-var>.

Example:
/etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
<list> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
<element> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
<conf-file-name> = /etc/conf.d/keymaps
<map-list> = KEYMAP,extended_keymaps-EXT_KEYMAPS
<mapping> = KEYMAP
<src-var> = KEYMAP
<mapping> = extended_keymaps-EXT_KEYMAPS
<src-var> = extended_keymaps
<dst-var> = EXT_KEYMAPS


2.3. Additional settings

If you encounter following error message: "Directories consolefonts,
consoletrans, keymaps, unimaps not found.", you can provide path where
those directories lie in your system by setting kbddir in configuration
file (the same where you put mappings).


3. Kernel parameters

If you create generic initramfs you can set up i18n by kernel
parameters using variables listed in 2.1. (except of UNIKEYMAP
and GRP_TOGGLE) The recommended minimum is: FONT and KEYMAP.
070701000000AA000081ED00000000000000000000000164DF2CB8000005FE000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/10i18n/console_init.sh    #!/bin/sh

[ -n "$DRACUT_SYSTEMD" ] && exit 0

if [ -x "$systemdutildir"/systemd-vconsole-setup ]; then
    "$systemdutildir"/systemd-vconsole-setup "$@"
fi

[ -e /etc/vconsole.conf ] && . /etc/vconsole.conf

DEFAULT_FONT=eurlatgr
DEFAULT_KEYMAP=/etc/sysconfig/console/default.kmap

set_keyboard() {
    local param

    [ "${UNICODE}" = 1 ] && param=-u || param=-a
    kbd_mode ${param}
}

set_terminal() {
    local dev=$1

    if [ "${UNICODE}" = 1 ]; then
        printf '\033%%G' >&7
        stty -F "${dev}" iutf8
    else
        printf '\033%%@' >&7
        stty -F "${dev}" -iutf8
    fi
}

set_keymap() {
    local utf_switch

    if [ -z "${KEYMAP}" ]; then
        [ -f "${DEFAULT_KEYMAP}" ] && KEYMAP=${DEFAULT_KEYMAP}
    fi

    [ -n "${KEYMAP}" ] || return 1

    [ "${UNICODE}" = 1 ] && utf_switch=-u

    # shellcheck disable=SC2086
    loadkeys -q ${utf_switch} ${KEYMAP} ${EXT_KEYMAPS}
}

set_font() {
    setfont "${FONT-${DEFAULT_FONT}}" \
        -C "${1}" \
        ${FONT_MAP:+-m "${FONT_MAP}"} \
        ${FONT_UNIMAP:+-u "${FONT_UNIMAP}"}
}

dev_close() {
    exec 6>&-
    exec 7>&-
}

dev_open() {
    local dev=$1

    exec 6< "${dev}" \
        && exec 7>> "${dev}"
}

dev=/dev/${1#/dev/}

[ -c "${dev}" ] || {
    echo "Usage: $0 device" >&2
    exit 1
}

dev_open "${dev}"

for fd in 6 7; do
    if ! [ -t ${fd} ]; then
        echo "ERROR: File descriptor not opened: ${fd}" >&2
        dev_close
        exit 1
    fi
done

set_keyboard
set_terminal "${dev}"
set_font "${dev}"
set_keymap

dev_close
  070701000000AB000081ED00000000000000000000000164DF2CB800002606000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/10i18n/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    [[ "$mount_needs" ]] && return 1

    require_binaries setfont loadkeys kbd_mode || return 1

    return 0
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    declare -A KEYMAPS

    if dracut_module_included "systemd"; then
        unset FONT
        unset KEYMAP
        # shellcheck disable=SC1090
        [[ -f "$dracutsysrootdir"/etc/vconsole.conf ]] && . "$dracutsysrootdir"/etc/vconsole.conf
    fi

    KBDSUBDIRS=(consolefonts consoletrans keymaps unimaps)
    DEFAULT_FONT="${i18n_default_font:-eurlatgr}"
    I18N_CONF="/etc/locale.conf"
    VCONFIG_CONF="/etc/vconsole.conf"

    findkeymap() {
        # shellcheck disable=SC2064
        trap "$(shopt -p nullglob globstar)" RETURN
        shopt -q -s nullglob globstar

        local -a MAPS
        local MAPNAME
        local INCLUDES
        local MAP
        local CMD
        local FN

        if [[ -f $dracutsysrootdir$1 ]]; then
            MAPS=("$1")
        else
            MAPNAME=${1%.map*}
            MAPS=("$dracutsysrootdir""${kbddir}"/keymaps/**/"${MAPNAME}"{,.map{,.*}})
        fi

        for MAP in "${MAPS[@]}"; do
            [[ -f $MAP ]] || continue
            [[ -v KEYMAPS["$MAP"] ]] && continue

            KEYMAPS["$MAP"]=1

            case "$MAP" in
                *.gz) CMD="zgrep" ;;
                *.bz2) CMD="bzgrep" ;;
                *) CMD="grep" ;;
            esac

            readarray -t INCLUDES < <("$CMD" '^include ' "$MAP" | while read -r _ a _ || [ -n "$a" ]; do echo "${a//\"/}"; done)

            for INCL in "${INCLUDES[@]}"; do
                for FN in "$dracutsysrootdir""${kbddir}"/keymaps/**/"$INCL"*; do
                    [[ -f $FN ]] || continue
                    [[ -v KEYMAPS["$FN"] ]] || findkeymap "$FN"
                done
            done
        done
    }

    # Function gathers variables from distributed files among the tree, maps to
    # specified names and prints the result in format "new-name=value".
    #
    # $@ = list in format specified below (BNF notation)
    #
    # <list> ::= <element> | <element> " " <list>
    # <element> ::= <conf-file-name> ":" <map-list>
    # <map-list> ::= <mapping> | <mapping> "," <map-list>
    # <mapping> ::= <src-var> "-" <dst-var> | <src-var>
    #
    # We assume no whitespace are allowed between symbols.
    # <conf-file-name> is a file holding <src-var> in your system.
    # <src-var> is a variable holding value of meaning the same as <dst-var>.
    # <dst-var> is a variable which will be set up inside initramfs.
    # If <dst-var> has the same name as <src-var> we can omit <dst-var>.
    #
    # Example:
    # /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
    # <list> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
    # <element> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
    # <conf-file-name> = /etc/conf.d/keymaps
    # <map-list> = KEYMAP,extended_keymaps-EXT_KEYMAPS
    # <mapping> = KEYMAP
    # <src-var> = KEYMAP
    # <mapping> = extended_keymaps-EXT_KEYMAPS
    # <src-var> = extended_keymaps
    # <dst-var> = EXT_KEYMAPS
    gather_vars() {
        local item map value

        # FIXME: double check
        # shellcheck disable=SC2068
        for item in "$@"; do
            read -r -a item <<< "${item/:/ }"
            for map in ${item[1]//,/ }; do
                read -r -a map <<< "${map//-/ }"
                if [[ -f "$dracutsysrootdir${item[0]}" ]]; then
                    value=$(grep "^${map[0]}=" "$dracutsysrootdir${item[0]}")
                    value=${value#*=}
                    echo "${map[1]:-${map[0]}}=${value}"
                fi
                unset map
            done
        done
    }

    install_base() {
        inst_multiple setfont loadkeys kbd_mode stty

        if ! dracut_module_included "systemd"; then
            inst "${moddir}"/console_init.sh /lib/udev/console_init
            inst_rules "${moddir}"/10-console.rules
            inst_hook cmdline 20 "${moddir}/parse-i18n.sh"
        fi

        if [[ ${kbddir} != "/usr/share" ]]; then
            inst_dir /usr/share
            for _src in "${KBDSUBDIRS[@]}"; do
                [ ! -e "${initdir}/usr/share/${_src}" ] && ln -s "${kbddir}/${_src}" "${initdir}/usr/share/${_src}"
            done
        fi
    }

    install_all_kbd() {
        local _src _line

        for _src in "${KBDSUBDIRS[@]}"; do
            inst_dir "${kbddir}/$_src"
            $DRACUT_CP -L -t "${initdir}/${kbddir}/$_src" "${dracutsysrootdir}${kbddir}/$_src"/*
        done

        # remove unnecessary files
        rm -f -- "${initdir}${kbddir}/consoletrans/utflist"
        find "${initdir}${kbddir}/" -name README\* -delete
        find "${initdir}${kbddir}/" -name '*.gz' -print -quit \
            | while read -r _line || [ -n "$_line" ]; do
                inst_multiple gzip
            done

        find "${initdir}${kbddir}/" -name '*.bz2' -print -quit \
            | while read -r _line || [ -n "$_line" ]; do
                inst_multiple bzip2
            done
    }

    install_local_i18n() {
        local map

        # shellcheck disable=SC2086
        eval "$(gather_vars ${i18n_vars})"
        # shellcheck disable=SC1090
        [ -f "$dracutsysrootdir"$I18N_CONF ] && . "$dracutsysrootdir"$I18N_CONF
        # shellcheck disable=SC1090
        [ -f "$dracutsysrootdir"$VCONFIG_CONF ] && . "$dracutsysrootdir"$VCONFIG_CONF

        shopt -q -s nocasematch
        if [[ ${UNICODE} ]]; then
            if [[ ${UNICODE} == YES || ${UNICODE} == 1 ]]; then
                UNICODE=1
            elif [[ ${UNICODE} == NO || ${UNICODE} == 0 ]]; then
                UNICODE=0
            else
                UNICODE=''
            fi
        fi
        if [[ ! ${UNICODE} && ${LANG} =~ .*\.UTF-?8 ]]; then
            UNICODE=1
        fi
        shopt -q -u nocasematch

        # Gentoo user may have KEYMAP set to something like "-u pl2",
        KEYMAP=${KEYMAP#-* }

        # openSUSE user may have KEYMAP set to something like ".gz"
        KEYMAP=${KEYMAP/.gz/}

        # KEYTABLE is a bit special - it defines base keymap name and UNICODE
        # determines whether non-UNICODE or UNICODE version is used

        if [[ ${KEYTABLE} ]]; then
            if [[ ${UNICODE} == 1 ]]; then
                [[ ${KEYTABLE} =~ .*\.uni.* ]] || KEYTABLE=${KEYTABLE%.map*}.uni
            fi
            KEYMAP=${KEYTABLE}
        fi

        # I'm not sure of the purpose of UNIKEYMAP and GRP_TOGGLE.  They were in
        # original redhat-i18n module.  Anyway it won't hurt.
        EXT_KEYMAPS+=\ ${UNIKEYMAP}\ ${GRP_TOGGLE}

        [[ ${KEYMAP} ]] || {
            dinfo 'No KEYMAP configured.'
            return 1
        }

        findkeymap "${KEYMAP}"

        for map in ${EXT_KEYMAPS}; do
            ddebug "Adding extra map: ${map}"
            findkeymap "${map}"
        done

        for keymap in "${!KEYMAPS[@]}"; do
            inst_opt_decompress "${keymap}"
        done

        inst_opt_decompress "${kbddir}"/consolefonts/"${DEFAULT_FONT}".*

        if [[ ${FONT} ]] && [[ ${FONT} != "${DEFAULT_FONT}" ]]; then
            if [[ -f "${kbddir}"/consolefonts/"${FONT}" ]]; then
                inst_opt_decompress "${kbddir}"/consolefonts/"${FONT}"
            else
                FONT=${FONT%.psf*}
                inst_opt_decompress "${kbddir}"/consolefonts/"${FONT}".*
            fi
        fi

        if [[ ${FONT_MAP} ]]; then
            FONT_MAP=${FONT_MAP%.trans}
            # There are three different formats that setfont supports
            inst_simple "${kbddir}"/consoletrans/"${FONT_MAP}" \
                || inst_simple "${kbddir}"/consoletrans/"${FONT_MAP}".trans \
                || inst_simple "${kbddir}"/consoletrans/"${FONT_MAP}"_to_uni.trans \
                || dwarn "Could not find FONT_MAP ${FONT_MAP}!"
        fi

        if [[ ${FONT_UNIMAP} ]]; then
            FONT_UNIMAP=${FONT_UNIMAP%.uni}
            inst_simple "${kbddir}"/unimaps/"${FONT_UNIMAP}".uni
        fi

        if dracut_module_included "systemd" && [[ -f $dracutsysrootdir${I18N_CONF} ]]; then
            inst_simple ${I18N_CONF}
        else
            mksubdirs "${initdir}"${I18N_CONF}
            print_vars LC_ALL LANG >> "${initdir}"${I18N_CONF}
        fi

        if ! dracut_module_included "systemd"; then
            mksubdirs "${initdir}"${VCONFIG_CONF}
            print_vars KEYMAP EXT_KEYMAPS UNICODE FONT FONT_MAP FONT_UNIMAP >> "${initdir}"${VCONFIG_CONF}
        fi

        return 0
    }

    checks() {
        for kbddir in ${kbddir} /usr/lib/kbd /lib/kbd /usr/share /usr/share/kbd; do
            if [[ -d "$dracutsysrootdir${kbddir}" ]]; then
                for dir in "${KBDSUBDIRS[@]}"; do
                    [[ -d "$dracutsysrootdir${kbddir}/${dir}" ]] && continue
                    false
                done && break
            fi
            kbddir=''
        done

        [[ "$kbddir" ]] || return 1

        [[ -f $dracutsysrootdir$I18N_CONF && -f $dracutsysrootdir$VCONFIG_CONF ]] \
            || [[ ! ${hostonly} || ${i18n_vars} ]] || {
            derror 'i18n_vars not set!  Please set up i18n_vars in ' \
                'configuration file.'
        }
        return 0
    }

    if checks; then
        install_base

        # https://github.com/dracutdevs/dracut/issues/796
        if dracut_module_included "systemd" && [[ -f $dracutsysrootdir${VCONFIG_CONF} ]]; then
            inst_simple ${VCONFIG_CONF}
        fi

        if [[ ${hostonly} ]] && ! [[ ${i18n_install_all} == "yes" ]]; then
            install_local_i18n || install_all_kbd
        else
            install_all_kbd
        fi
    fi
}
  070701000000AC000081ED00000000000000000000000164DF2CB800000440000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/10i18n/parse-i18n.sh  #!/bin/sh

inst_key_val() {
    local _value
    local _file
    local _default
    _file="$1"
    shift
    _key="$1"
    shift
    _default="$1"
    shift
    _value="$(getarg "$@")"
    [ -z "${_value}" ] && _value=$_default
    if [ -n "${_value}" ]; then
        printf -- '%s="%s"\n' "${_key}" "${_value}" >> "$_file"
    fi
    unset _file
    unset _value
}

inst_key_val /etc/vconsole.conf KEYMAP '' rd.vconsole.keymap KEYMAP -d KEYTABLE
inst_key_val /etc/vconsole.conf FONT '' rd.vconsole.font FONT -d SYSFONT
inst_key_val /etc/vconsole.conf FONT_MAP '' rd.vconsole.font.map FONT_MAP -d CONTRANS
inst_key_val /etc/vconsole.conf FONT_UNIMAP '' rd.vconsole.font.unimap FONT_UNIMAP -d UNIMAP
inst_key_val /etc/vconsole.conf UNICODE 1 rd.vconsole.font.unicode UNICODE vconsole.unicode
inst_key_val /etc/vconsole.conf EXT_KEYMAP '' rd.vconsole.keymap.ext EXT_KEYMAP

inst_key_val /etc/locale.conf LANG '' rd.locale.LANG LANG
inst_key_val /etc/locale.conf LC_ALL '' rd.locale.LC_ALL LC_ALL

if [ -f /etc/locale.conf ]; then
    . /etc/locale.conf
    export LANG
    export LC_ALL
fi
070701000000AD000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/modules.d/30convertfs   070701000000AE000081ED00000000000000000000000164DF2CB80000068F000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/30convertfs/convertfs.sh  #!/bin/bash

ROOT="$1"

if [[ ! -d $ROOT ]]; then
    echo "Usage: $0 <rootdir>"
    exit 1
fi

if [[ $ROOT -ef / ]]; then
    echo "Can't convert the running system."
    echo "Please boot with 'rd.convertfs' on the kernel command line,"
    echo "to update with the help of the initramfs,"
    echo "or run this script from a rescue system."
    exit 1
fi

while [[ $ROOT != "${ROOT%/}" ]]; do
    ROOT=${ROOT%/}
done

#mount /sysroot rw
[ -w $ROOT ] || mount -o remount,rw $ROOT

#mount /sysroot/var if it is a separate mount
VARDEV=$(sed -n -e 's/^\#.*//' -e '/ \/var /s/\([[:graph:]]* \).*/\1/p' /sysroot/etc/fstab)
VARFS=$(sed -n -e 's/^\#.*//' -e '/ \/var /s/[[:graph:]]* * [[:graph:]]* *\([[:graph:]]* \).*/\1/p' /sysroot/etc/fstab)

if [ -n $VARDEV ] && [ -n $VARFS ]; then
    #mount btrfs subvolume var
    if [ $VARFS == btrfs ]; then
        SUBVOLIDVAR=$(btrfs subvolume list $ROOT | sed -n '/var$/s/ID \([[:digit:]]*\) .*/\1/p')
        ROOTDEV=$(sed -n "/\\$ROOT/s/\([[:graph:]]*\) .*/\1/p" /proc/mounts)
        [ -z $SUBVOLIDVAR ] || mount -o subvolid=$SUBVOLIDVAR $ROOTDEV $ROOT/var
    else
        mount $VARDEV $ROOT/var
    fi
fi

if [ ! -L "$ROOT"/var/run -a -e "$ROOT"/var/run ]; then

    echo "Converting /var/run to symlink"
    mv -f "$ROOT"/var/run "$ROOT"/var/run.runmove~
    ln -sfn ../run "$ROOT"/var/run
fi

if [ ! -L "$ROOT"/var/lock -a -e "$ROOT"/var/lock ]; then
    echo "Converting /var/lock to symlink"
    mv -f "$ROOT"/var/lock "$ROOT"/var/lock.lockmove~
    ln -sfn ../run/lock "$ROOT"/var/lock
fi

[ -n $SUBVOLIDVAR ] && umount $ROOT/var
[ -w $ROOT ] && mount -o remount,ro $ROOT


































echo "Done."
exit 0
 070701000000AF000081ED00000000000000000000000164DF2CB8000000C2000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/30convertfs/do-convertfs.sh   #!/bin/bash

if getargbool 0 rd.convertfs; then
    if getargbool 0 rd.debug; then
        bash -x convertfs "$NEWROOT" 2>&1 | vinfo
    else
        convertfs "$NEWROOT" 2>&1 | vinfo
    fi
fi
  070701000000B0000081ED00000000000000000000000164DF2CB80000015D000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/30convertfs/module-setup.sh   #!/bin/bash

# called by dracut
check() {
    [[ $mount_needs ]] && return 1
    return 255
}

# called by dracut
depends() {
    echo bash
    return 0
}

# called by dracut
install() {
    inst_multiple bash find ldconfig mv rm cp ln
    inst_hook pre-pivot 99 "$moddir/do-convertfs.sh"
    inst_script "$moddir/convertfs.sh" /usr/bin/convertfs
}
   070701000000B1000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-legacy  070701000000B2000081ED00000000000000000000000164DF2CB8000027AD000000000000000000000000000000000000004C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-legacy/dhclient-script.sh   #!/bin/sh

PATH=/usr/sbin:/usr/bin:/sbin:/bin

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
type ip_to_var > /dev/null 2>&1 || . /lib/net-lib.sh

# We already need a set netif here
netif=$interface

setup_interface() {
    ip=$new_ip_address
    mtu=$new_interface_mtu
    mask=$new_subnet_mask
    bcast=$new_broadcast_address
    gw=${new_routers%%,*}
    domain=$new_domain_name
    # get rid of control chars
    search=$(printf -- "%s" "$new_domain_search" | tr -d '[:cntrl:]')
    namesrv=$new_domain_name_servers
    hostname=$new_host_name
    [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
    [ -n "$new_max_life" ] && lease_time=$new_max_life
    preferred_lft=$lease_time
    [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life

    # shellcheck disable=SC1090
    [ -f /tmp/net."$netif".override ] && . /tmp/net."$netif".override

    # Taken from debian dhclient-script:
    # The 576 MTU is only used for X.25 and dialup connections
    # where the admin wants low latency.  Such a low MTU can cause
    # problems with UDP traffic, among other things.  As such,
    # disallow MTUs from 576 and below by default, so that broken
    # MTUs are ignored, but higher stuff is allowed (1492, 1500, etc).
    if [ -n "$mtu" ] && [ "$mtu" -gt 576 ]; then
        if ! ip link set "$netif" mtu "$mtu"; then
            ip link set "$netif" down
            ip link set "$netif" mtu "$mtu"
            linkup "$netif"
        fi
    fi

    ip addr add "$ip"${mask:+/$mask} ${bcast:+broadcast $bcast} dev "$netif" \
        ${lease_time:+valid_lft $lease_time} \
        ${preferred_lft:+preferred_lft ${preferred_lft}}

    if [ -n "$gw" ]; then
        if [ "$mask" = "255.255.255.255" ]; then
            # point-to-point connection => set explicit route to gateway
            echo ip route add "$gw" dev "$netif" > /tmp/net."$netif".gw
        fi

        echo "$gw" | {
            IFS=' ' read -r main_gw other_gw
            echo ip route replace default via "$main_gw" dev "$netif" >> /tmp/net."$netif".gw
            if [ -n "$other_gw" ]; then
                for g in $other_gw; do
                    echo ip route add default via "$g" dev "$netif" >> /tmp/net."$netif".gw
                done
            fi
        }
    fi

    if getargbool 1 rd.peerdns; then
        [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net."$netif".resolv.conf
        if [ -n "$namesrv" ]; then
            for s in $namesrv; do
                echo nameserver "$s"
            done
        fi >> /tmp/net."$netif".resolv.conf
    fi
    # Note: hostname can be fqdn OR short hostname, so chop off any
    # trailing domain name and explicity add any domain if set.
    [ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net."$netif".hostname
}

setup_interface6() {
    domain=$new_domain_name
    # get rid of control chars
    search=$(printf -- "%s" "$new_dhcp6_domain_search" | tr -d '[:cntrl:]')
    namesrv=$new_dhcp6_name_servers
    hostname=$new_host_name
    [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
    [ -n "$new_max_life" ] && lease_time=$new_max_life
    preferred_lft=$lease_time
    [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life

    # shellcheck disable=SC1090
    [ -f /tmp/net."$netif".override ] && . /tmp/net."$netif".override

    ip -6 addr add "${new_ip6_address}"/"${new_ip6_prefixlen}" \
        dev "${netif}" scope global \
        ${lease_time:+valid_lft $lease_time} \
        ${preferred_lft:+preferred_lft ${preferred_lft}}

    if getargbool 1 rd.peerdns; then
        [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net."$netif".resolv.conf
        if [ -n "$namesrv" ]; then
            for s in $namesrv; do
                echo nameserver "$s"
            done
        fi >> /tmp/net."$netif".resolv.conf
    fi

    # Note: hostname can be fqdn OR short hostname, so chop off any
    # trailing domain name and explicity add any domain if set.
    [ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net."$netif".hostname
}

parse_option_121() {
    while [ $# -ne 0 ]; do
        mask="$1"
        shift

        # Is the destination a multicast group?
        if [ "$1" -ge 224 -a "$1" -lt 240 ]; then
            multicast=1
        else
            multicast=0
        fi

        # Parse the arguments into a CIDR net/mask string
        if [ "$mask" -gt 24 ]; then
            destination="$1.$2.$3.$4/$mask"
            shift
            shift
            shift
            shift
        elif [ "$mask" -gt 16 ]; then
            destination="$1.$2.$3.0/$mask"
            shift
            shift
            shift
        elif [ "$mask" -gt 8 ]; then
            destination="$1.$2.0.0/$mask"
            shift
            shift
        elif [ "$mask" -gt 0 ]; then
            destination="$1.0.0.0/$mask"
            shift
        else
            destination="0.0.0.0/$mask"
        fi

        # Read the gateway
        gateway="$1.$2.$3.$4"
        shift
        shift
        shift
        shift

        # Multicast routing on Linux
        #  - If you set a next-hop address for a multicast group, this breaks with Cisco switches
        #  - If you simply leave it link-local and attach it to an interface, it works fine.
        if [ $multicast -eq 1 -o "$gateway" = "0.0.0.0" ]; then
            temp_result="$destination dev $interface"
        else
            temp_result="$destination via $gateway dev $interface"
        fi

        echo "/sbin/ip route replace $temp_result"
    done
}

case $reason in
    PREINIT)
        echo "dhcp: PREINIT $netif up"
        linkup "$netif"
        ;;

    PREINIT6)
        echo "dhcp: PREINIT6 $netif up"
        linkup "$netif"
        wait_for_ipv6_dad_link "$netif"
        ;;

    BOUND)
        echo "dhcp: BOUND setting up $netif"
        unset layer2
        if [ -f /sys/class/net/"$netif"/device/layer2 ]; then
            read -r layer2 < /sys/class/net/"$netif"/device/layer2
        fi
        if [ "$layer2" != "0" ]; then
            if command -v arping2 > /dev/null; then
                if arping2 -q -C 1 -c 2 -I "$netif" -0 "$new_ip_address"; then
                    warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
                    exit 1
                fi
            elif command -v arping > /dev/null; then
                if ! arping -f -q -D -c 2 -I "$netif" "$new_ip_address"; then
                    warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
                    exit 1
                fi
            else
                wicked arp verify --quiet --count 2 --interval 1000 "$netif" "$new_ip_address"
                if [ $? -eq 4 ]; then
                    warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
                    exit 1
                fi
            fi
        fi
        unset layer2
        setup_interface
        set | while read -r line || [ -n "$line" ]; do
            [ "${line#new_}" = "$line" ] && continue
            echo "$line"
        done > /tmp/dhclient."$netif".dhcpopts

        {
            echo '. /lib/net-lib.sh'
            echo "setup_net $netif"
            if [ -n "$new_classless_static_routes" ]; then
                OLDIFS="$IFS"
                IFS=".$IFS"
                parse_option_121 "$new_classless_static_routes"
                IFS="$OLDIFS"
            fi
            echo "source_hook initqueue/online $netif"
            [ -e /tmp/net."$netif".manualup ] || echo "/sbin/netroot $netif"
            echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
        } > "$hookdir"/initqueue/setup_net_"$netif".sh

        echo "[ -f /tmp/net.$netif.did-setup ]" > "$hookdir"/initqueue/finished/dhclient-"$netif".sh
        : > /tmp/net."$netif".up
        if [ -e /sys/class/net/"${netif}"/address ]; then
            : > "/tmp/net.$(cat /sys/class/net/"${netif}"/address).up"
        fi

        ;;

    RENEW | REBIND)
        unset lease_time
        [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
        [ -n "$new_max_life" ] && lease_time=$new_max_life
        preferred_lft=$lease_time
        [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
        ip -4 addr change "${new_ip_address}"/"${new_subnet_mask}" broadcast "${new_broadcast_address}" dev "${interface}" \
            ${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \
            > /dev/null 2>&1
        ;;

    BOUND6)
        echo "dhcp: BOUND6 setting up $netif"
        setup_interface6

        set | while read -r line || [ -n "$line" ]; do
            [ "${line#new_}" = "$line" ] && continue
            echo "$line"
        done > /tmp/dhclient."$netif".dhcpopts

        {
            echo '. /lib/net-lib.sh'
            echo "setup_net $netif"
            echo "source_hook initqueue/online $netif"
            [ -e /tmp/net."$netif".manualup ] || echo "/sbin/netroot $netif"
            echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
        } > "$hookdir"/initqueue/setup_net_"$netif".sh

        echo "[ -f /tmp/net.$netif.did-setup ]" > "$hookdir"/initqueue/finished/dhclient-"$netif".sh
        : > /tmp/net."$netif".up
        if [ -e /sys/class/net/"${netif}"/address ]; then
            : > "/tmp/net.$(cat /sys/class/net/"${netif}"/address).up"
        fi
        ;;

    RENEW6 | REBIND6)
        unset lease_time
        [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
        [ -n "$new_max_life" ] && lease_time=$new_max_life
        preferred_lft=$lease_time
        [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
        ip -6 addr change "${new_ip6_address}"/"${new_ip6_prefixlen}" dev "${interface}" scope global \
            ${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \
            > /dev/null 2>&1
        ;;

    *) echo "dhcp: $reason" ;;
esac

exit 0
   070701000000B3000081A400000000000000000000000164DF2CB8000001C2000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-legacy/dhclient.conf    
option classless-static-routes code 121 = array of unsigned integer 8;

send dhcp-client-identifier = hardware;

request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        root-path, interface-mtu, classless-static-routes,
        netbios-name-servers, netbios-scope, ntp-servers,
        dhcp6.domain-search, dhcp6.fqdn,
        dhcp6.name-servers, dhcp6.sntp-servers;
  070701000000B4000081ED00000000000000000000000164DF2CB800001219000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-legacy/dhcp-multi.sh    #!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
PATH=/usr/sbin:/usr/bin:/sbin:/bin

# File to start dhclient requests on different interfaces in parallel

. /lib/dracut-lib.sh
. /lib/net-lib.sh

netif=$1
do_vlan=$2
arg=$3

# Run dhclient in parallel
do_dhclient() {
    local _COUNT=0
    local _timeout
    local _DHCPRETRY
    _timeout=$(getarg rd.net.timeout.dhcp=)
    _DHCPRETRY=$(getargnum 1 1 1000000000 rd.net.dhcp.retry=)

    while [ $_COUNT -lt "$_DHCPRETRY" ]; do
        info "Starting dhcp for interface $netif"
        dhclient "$arg" \
            ${_timeout:+--timeout "$_timeout"} \
            -q \
            -1 \
            -cf /etc/dhclient.conf \
            -pf /tmp/dhclient."$netif".pid \
            -lf /tmp/dhclient."$netif".lease \
            "$netif" &
        wait $! 2> /dev/null

        # wait will return the return value of dhclient
        retv=$?

        # dhclient and hence wait returned success, 0.
        if [ $retv -eq 0 ]; then
            return 0
        fi

        # If dhclient exited before wait was called, or it was killed by
        # another thread for interface whose DHCP succeeded, then it will not
        # find the process with that pid and return error code 127. In that
        # case we need to check if /tmp/dhclient.$netif.lease exists. If it
        # does, it means dhclient finished executing before wait was called,
        # and it was successful (return 0). If /tmp/dhclient.$netif.lease
        # does not exist, then it means dhclient was killed by another thread
        # or it finished execution but failed dhcp on that interface.

        if [ $retv -eq 127 ]; then
            pid=$(cat /tmp/dhclient."$netif".pid)
            info "PID $pid was not found by wait for $netif"
            if [ -e /tmp/dhclient."$netif".lease ]; then
                info "PID $pid not found but DHCP successful on $netif"
                return 0
            fi
        fi

        _COUNT=$((_COUNT + 1))
        [ $_COUNT -lt "$_DHCPRETRY" ] && sleep 1
    done
    warn "dhcp for interface $netif failed"
    # nuke those files since we failed; we might retry dhcp again if it's e.g.
    # `ip=dhcp,dhcp6` and we check for the PID file earlier
    rm -f /tmp/dhclient."$netif".pid /tmp/dhclient."$netif".lease
    return 1
}

do_dhclient
ret=$?

# setup nameserver
for s in "$dns1" "$dns2" $(getargs nameserver); do
    [ -n "$s" ] || continue
    echo nameserver "$s" >> /tmp/net."$netif".resolv.conf
done

if [ $ret -eq 0 ]; then
    : > /tmp/net."${netif}".up

    if [ -z "$do_vlan" ] && [ -e /sys/class/net/"${netif}"/address ]; then
        : > "/tmp/net.$(cat /sys/class/net/"${netif}"/address).up"
    fi

    # Check if DHCP also suceeded on another interface before this one.
    # We will always use the first one on which DHCP succeeded, by using
    # a commom file $IFNETFILE, to synchronize between threads.
    # Consider the race condition in which multiple threads
    # corresponding to different interfaces may try to read $IFNETFILE
    # and find it does not exist; they may all end up thinking they are the
    # first to succeed (hence more than one thread may end up writing to
    # $IFNETFILE). To take care of this, instead of checking if $IFNETFILE
    # exists to determine if we are the first, we create a symbolic link
    # in $IFNETFILE, pointing to the interface name ($netif), thus storing
    # the interface name in the link pointer.
    # Creating a link will fail, if the link already exists, hence kernel
    # will take care of allowing only first thread to create link, which
    # takes care of the race condition for us. Subsequent threads will fail.
    # Also, the link points to the interface name, which will tell us which
    # interface succeeded.

    if ln -s "$netif" "$IFNETFILE" 2> /dev/null; then
        intf=$(readlink "$IFNETFILE")
        if [ -e /tmp/dhclient."$intf".lease ]; then
            info "DHCP successful on interface $intf"
            # Kill all existing dhclient calls for other interfaces, since we
            # already got one successful interface

            npid=$(cat /tmp/dhclient."$netif".pid)
            pidlist=$(pgrep dhclient)
            for pid in $pidlist; do
                [ "$pid" -eq "$npid" ] && continue
                kill -9 "$pid" > /dev/null 2>&1
            done
        else
            echo "ERROR! $IFNETFILE exists but /tmp/dhclient.$intf.lease does not exist!!!"
        fi
    else
        info "DHCP success on $netif, and also on $intf"
        exit 0
    fi
    exit $ret
fi
   070701000000B5000081ED00000000000000000000000164DF2CB800005CE3000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-legacy/ifup.sh  #!/bin/bash
#
# We don't need to check for ip= errors here, that is handled by the
# cmdline parser script
#
# without $2 means this is for real netroot case
# or it is for manually bring up network ie. for kdump scp vmcore
PATH=/usr/sbin:/usr/bin:/sbin:/bin

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
type ip_to_var > /dev/null 2>&1 || . /lib/net-lib.sh

# Huh? No $1?
[ -z "$1" ] && exit 1

# $netif reads easier than $1
netif=$1

# loopback is always handled the same way
if [ "$netif" = "lo" ]; then
    # systemd probably has already set up lo
    ip link show dev lo >/dev/null && exit 0

    ip link set lo up
    ip addr add 127.0.0.1/8 dev lo
    exit 0
fi

dhcp_backend() {
    type wicked >/dev/null 2>&1 && \
    echo "wicked" || \
    echo "dhclient"
}

dhcp_wicked_apply() {
    unset IPADDR INTERFACE BROADCAST NETWORK PREFIXLEN ROUTES GATEWAYS MTU HOSTNAME DNSDOMAIN DNSSEARCH DNSSERVERS
    if [ -f "/tmp/leaseinfo.${netif}.dhcp.ipv${1:1:1}" ]; then
        . "/tmp/leaseinfo.${netif}.dhcp.ipv${1:1:1}"
    else
        warn "DHCP failed";
        return 1
    fi

    if [ -z "${IPADDR}" ] || [ -z "${INTERFACE}" ]; then
           warn "Missing crucial DHCP variables"
           return 1
    fi

    # Assign IP address
    ip $1 addr add "$IPADDR" ${BROADCAST:+broadcast $BROADCAST} dev "$INTERFACE"

    # Assign provided routes
    local r route=()
    if [ -n "${ROUTES}" ]; then
        for r in ${ROUTES}; do
            route=(${r//,/ })
            [[ ${route[2]} == "0.0.0.0" ]] || gateway=" via ${route[2]}"
            ip $1 route add "${route[0]}"/"${route[1]}""$gateway" dev "$INTERFACE"
        done
    fi

    # Assign provided routers
    local g
    if [ -n "${GATEWAYS}" ]; then
        for g in ${GATEWAYS}; do
            ip $1 route add default via "$g" dev "$INTERFACE" && break
        done
    fi

    # Set MTU
    [ -n "${MTU}" ] && ip $1 link set mtu "$MTU" dev "$INTERFACE"

    # Setup hostname
    [ -n "${HOSTNAME}" ] && echo $HOSTNAME > /proc/sys/kernel/hostname

    # If nameserver= has not been specified, use what dhcp provides
    if [ ! -s /tmp/net.$netif.resolv.conf.ipv${1:1:1} ]; then
        if [ -n "${DNSDOMAIN}" ]; then
            echo domain "${DNSDOMAIN}"
        fi >> /tmp/net.$netif.resolv.conf.ipv${1:1:1}

        if [ -n "${DNSSEARCH}" ]; then
            echo search "${DNSSEARCH}"
        fi >> /tmp/net.$netif.resolv.conf.ipv${1:1:1}

        if  [ -n "${DNSSERVERS}" ] ; then
            for s in ${DNSSERVERS}; do
                echo nameserver "$s"
            done
        fi >> /tmp/net.$netif.resolv.conf.ipv${1:1:1}
    fi
    # copy resolv.conf if it doesn't exist yet, modify otherwise
    if [ -e /tmp/net.$netif.resolv.conf.ipv${1:1:1} ] && [ ! -e /etc/resolv.conf ]; then
        cp -f /tmp/net.$netif.resolv.conf.ipv${1:1:1} /etc/resolv.conf
    else
        if [ -n "$(sed -n '/^search .*$/p' /etc/resolv.conf)" ]; then
            sed -i "s/\(^search .*\)$/\1 ${DNSSEARCH}/" /etc/resolv.conf
        else
            echo search ${DNSSEARCH} >> /etc/resolv.conf
        fi
        if  [ -n "${DNSSERVERS}" ] ; then
            for s in ${DNSSERVERS}; do
                echo nameserver "$s"
            done
        fi >> /etc/resolv.conf
    fi

    info "DHCP is finished successfully"
    return 0

}

# USECASE?
dhcp_wicked_read_ifcfg() {
    unset PREFIXLEN LLADDR MTU REMOTE_IPADDR GATEWAY BOOTPROTO

    if [ -e /etc/sysconfig/network/ifcfg-${netif} ] ; then
        # Pull in existing configuration
        . /etc/sysconfig/network/ifcfg-${netif}

        # The first configuration can be anything
        [ -n "$PREFIXLEN" ] && prefix=${PREFIXLEN}
        [ -n "$LLADDR" ] && macaddr=${LLADDR}
        [ -n "$MTU" ] && mtu=${MTU}
        [ -n "$REMOTE_IPADDR" ] && server=${REMOTE_IPADDR}
        [ -n "$GATEWAY" ] && gw=${GATEWAY}
        [ -n "$BOOTPROTO" ] && autoconf=${BOOTPROTO}
        return 0
    fi
    return 1
}


dhcp_dhclient_run() {
    dhclient "$@" \
                 ${_timeout:+--timeout $_timeout} \
                 -q \
                 -1 \
                 -cf /etc/dhclient.conf \
                 -pf "/tmp/dhclient.$netif.pid" \
                 -lf "/tmp/dhclient.$netif.lease" \
                 "$netif" \
            && return 0
    return 1
}

dhcp_wicked_run() {
    local _ipv=${1:-"-4"}

    [ -d /var/lib/wicked ] || mkdir -p /var/lib/wicked

    dhclient=
    if [ "$_ipv" = "-6" ] ; then
        ipv6_mode=
        if [ -f "/tmp/net.$netif.auto6" ] ; then
            ipv6_mode="auto"
        else
            ipv6_mode="managed"
        fi
        dhclient="wicked test dhcp6 -m $ipv6_mode"
    else
        dhclient="wicked test dhcp4"
    fi

    if ! linkup "$netif"; then
        warn "Could not bring interface $netif up!"
        return 1
    fi

    if dhcp_wicked_read_ifcfg ; then
        [ -n "$macaddr" ] && ip "$_ipv" link set address $macaddr dev $netif
        [ -n "$mtu" ] && ip "$_ipv" link set mtu $mtu dev $netif
    fi

    local needtimeout=0
    local CMDLINE=$(getcmdline)
    local cmdlineopt
    for cmdlineopt in $CMDLINE; do
        case "$cmdlineopt" in
            rd.iscsi.*) ;&
            rd.fcoe*) ;&
            root=nfs:*) ;&
            root=iscsi:*)
                needtimeout=1
                ;;
        esac
    done
    if [ $needtimeout -eq 1 -a -z "$_timeout" ]; then
        _timeout=60
    fi

    $dhclient ${_timeout:+--timeout $_timeout} --format leaseinfo --output "/tmp/leaseinfo.${netif}.dhcp.ipv${_ipv:1:1}" --request - $netif << EOF
<request type="lease"/>
EOF
    dhcp_wicked_apply "$_ipv" || return $?

    if [ "$_ipv" = "-6" ] ; then
        wait_for_ipv6_dad $netif
    fi

    return 0
}

do_dhcp_parallel() {
    # dhclient-script will mark the netif up and generate the online
    # event for nfsroot
    # XXX add -V vendor class and option parsing per kernel

    [ -e "/tmp/dhclient.$netif.pid" ] && return 0

    if ! iface_has_carrier "$netif"; then
        warn "No carrier detected on interface $netif"
        return 1
    fi

    bootintf=$(readlink "$IFNETFILE")
    if [ -n "$bootintf" ] && [ -e "/tmp/dhclient.${bootintf}.lease" ]; then
        info "DHCP already succeeded for $bootintf, exiting for $netif"
        return 1
    fi

    if [ ! -e /run/NetworkManager/conf.d/10-dracut-dhclient.conf ]; then
        mkdir -p /run/NetworkManager/conf.d
        echo '[main]' > /run/NetworkManager/conf.d/10-dracut-dhclient.conf
        echo 'dhcp=dhclient' >> /run/NetworkManager/conf.d/10-dracut-dhclient.conf
    fi

    chmod +x /sbin/dhcp-multi.sh
    /sbin/dhcp-multi.sh "$netif" "$DO_VLAN" "$@" &
    return 0
}

# Run dhclient
do_dhcp() {
    # dhclient-script will mark the netif up and generate the online
    # event for nfsroot
    # XXX add -V vendor class and option parsing per kernel

    local _COUNT
    local _timeout
    local _DHCPRETRY


    _COUNT=0
    _timeout=$(getarg rd.net.timeout.dhcp=)
    _DHCPRETRY=$(getargnum 1 1 1000000000 rd.net.dhcp.retry=)

    [ -e "/tmp/dhclient.${netif}.pid" ] && return 0

    if ! iface_has_carrier "$netif"; then
        warn "No carrier detected on interface $netif"
        return 1
    fi

    if [ ! -e /run/NetworkManager/conf.d/10-dracut-dhclient.conf ]; then
        mkdir -p /run/NetworkManager/conf.d
        echo '[main]' > /run/NetworkManager/conf.d/10-dracut-dhclient.conf
        echo 'dhcp=dhclient' >> /run/NetworkManager/conf.d/10-dracut-dhclient.conf
    fi

    while [ "$_COUNT" -lt "$_DHCPRETRY" ]; do
        info "Starting dhcp for interface $netif"
        backend="$(dhcp_backend)"
        dhcp_${backend}_run "$@" && return 0



        _COUNT=$((_COUNT + 1))
        [ "$_COUNT" -lt "$_DHCPRETRY" ] && sleep 1
    done
    warn "dhcp for interface $netif failed"
    # nuke those files since we failed; we might retry dhcp again if it's e.g.
    # `ip=dhcp,dhcp6` and we check for the PID file at the top
    rm -f /tmp/dhclient."$netif".pid /tmp/dhclient."$netif".lease
    return 1
}

load_ipv6() {
    [ -d /proc/sys/net/ipv6 ] && return
    modprobe ipv6
    i=0
    while [ ! -d /proc/sys/net/ipv6 ]; do
        i=$((i + 1))
        [ $i -gt 10 ] && break
        sleep 0.1
    done
}

do_ipv6auto() {
    local ret
    load_ipv6
    echo 0 > /proc/sys/net/ipv6/conf/"${netif}"/forwarding
    echo 1 > /proc/sys/net/ipv6/conf/"${netif}"/accept_ra
    echo 1 > /proc/sys/net/ipv6/conf/"${netif}"/accept_redirects
    linkup "$netif"
    wait_for_ipv6_auto "$netif"
    ret=$?

    [ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > "/tmp/net.${netif}.hostname"

    return "$ret"
}

do_ipv6link() {
    local ret
    load_ipv6
    echo 0 > /proc/sys/net/ipv6/conf/"${netif}"/forwarding
    echo 0 > /proc/sys/net/ipv6/conf/"${netif}"/accept_ra
    echo 0 > /proc/sys/net/ipv6/conf/"${netif}"/accept_redirects
    linkup "$netif"

    [ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > "/tmp/net.${netif}.hostname"

    return "$ret"
}

# Handle static ip configuration
do_static() {
    strglobin "$ip" '*:*:*' && load_ipv6

    if ! iface_has_carrier "$netif"; then
        warn "No carrier detected on interface $netif"
        return 1
    elif ! linkup "$netif"; then
        warn "Could not bring interface $netif up!"
        return 1
    fi

    ip route get "$ip" 2> /dev/null | {
        read -r a rest
        if [ "$a" = "local" ]; then
            warn "Not assigning $ip to interface $netif, cause it is already assigned!"
            return 1
        fi
        return 0
    } || return 1

    [ -n "$macaddr" ] && ip link set address "$macaddr" dev "$netif"
    [ -n "$mtu" ] && ip link set mtu "$mtu" dev "$netif"
    if strglobin "$ip" '*:*:*'; then
        # note no ip addr flush for ipv6
        ip addr add "$ip/$mask" ${srv:+peer "$srv"} dev "$netif"
        echo 0 > /proc/sys/net/ipv6/conf/"${netif}"/forwarding
        echo 1 > /proc/sys/net/ipv6/conf/"${netif}"/accept_ra
        echo 1 > /proc/sys/net/ipv6/conf/"${netif}"/accept_redirects
        wait_for_ipv6_dad "$netif"
    else
        if [ -z "$srv" ]; then
            if command -v arping2 > /dev/null; then
                if arping2 -q -C 1 -c 2 -I "$netif" -0 "$ip"; then
                    warn "Duplicate address detected for $ip for interface $netif."
                    return 1
                fi
            elif command -v arping > /dev/null; then
                if ! arping -f -q -D -c 2 -I "$netif" "$ip"; then
                    warn "Duplicate address detected for $ip for interface $netif."
                    return 1
                fi
            else
                wicked arp verify --quiet --count 2 --interval 1000 "$netif" "$ip"
                if [ $? -eq 4 ]; then
                    warn "Duplicate address detected for $ip for interface $netif."
                    return 1
                fi
            fi
        fi
        ip addr flush dev "$netif"
        ip addr add "$ip/$mask" ${srv:+peer "$srv"} brd + dev "$netif"
    fi

    [ -n "$gw" ] && echo "ip route replace default via '$gw' dev '$netif'" > "/tmp/net.$netif.gw"
    [ -n "$hostname" ] && echo "echo '$hostname' > /proc/sys/kernel/hostname" > "/tmp/net.$netif.hostname"

    for ifroute in /etc/sysconfig/network/ifroute-${netif} /etc/sysconfig/network/routes ; do
        [ -e ${ifroute} ] || continue
        # Pull in existing routing configuration
        read ifr_dest ifr_gw ifr_mask ifr_if < ${ifroute}
        [ -z "$ifr_dest" -o -z "$ifr_gw" ] && continue
        if [ "$ifr_if" = "-" ] ; then
            echo ip route add $ifr_dest via $ifr_gw >> /tmp/net.$netif.gw
        else
            echo ip route add $ifr_dest via $ifr_gw dev $ifr_if >> /tmp/net.$netif.gw
        fi
    done

    return 0
}

get_vid() {
    case "$1" in
        vlan*)
            echo "${1#vlan}"
            ;;
        *.*)
            echo "${1##*.}"
            ;;
    esac
}

# check, if we need VLAN's for this interface
if [ -z "$DO_VLAN_PHY" ] && [ -e "/tmp/vlan.${netif}.phy" ]; then
    unset DO_VLAN
    NO_AUTO_DHCP=yes DO_VLAN_PHY=yes ifup "$netif"
    modprobe -b -q 8021q

    for i in /tmp/vlan.*."${netif}"; do
        [ -e "$i" ] || continue
        unset vlanname
        unset phydevice
        # shellcheck disable=SC1090
        . "$i"
        if [ -n "$vlanname" ]; then
            linkup "$phydevice"
            ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid "$vlanname")"
            ifup "$vlanname"
        fi
    done
    exit 0
fi

# Check, if interface is VLAN interface
if ! [ -e "/tmp/vlan.${netif}.phy" ]; then
    for i in "/tmp/vlan.${netif}".*; do
        [ -e "$i" ] || continue
        export DO_VLAN=yes
        break
    done
fi


# bridge this interface?
if [ -z "$NO_BRIDGE_MASTER" ]; then
    for i in /tmp/bridge.*.info; do
        [ -e "$i" ] || continue
        unset bridgeslaves
        unset bridgename
        # shellcheck disable=SC1090
        . "$i"
        for ethname in $bridgeslaves; do
            [ "$netif" != "$ethname" ] && continue

            NO_BRIDGE_MASTER=yes NO_AUTO_DHCP=yes ifup "$ethname"
            linkup "$ethname"
            if [ ! -e "/tmp/bridge.$bridgename.up" ]; then
                ip link add name "$bridgename" type bridge
                echo 0 > "/sys/devices/virtual/net/$bridgename/bridge/forward_delay"
                : > "/tmp/bridge.$bridgename.up"
            fi
            ip link set dev "$ethname" master "$bridgename"
            ifup "$bridgename"
            exit 0
        done
    done
fi

# enslave this interface to bond?
if [ -z "$NO_BOND_MASTER" ]; then
    for i in /tmp/bond.*.info; do
        [ -e "$i" ] || continue
        unset bondslaves
        unset bondname
        # shellcheck disable=SC1090
        . "$i"
        for testslave in $bondslaves; do
            [ "$netif" != "$testslave" ] && continue

            # already setup
            [ -e "/tmp/bond.$bondname.up" ] && exit 0

            # wait for all slaves to show up
            for slave in $bondslaves; do
                # try to create the slave (maybe vlan or bridge)
                NO_BOND_MASTER=yes NO_AUTO_DHCP=yes ifup "$slave"

                if ! ip link show dev "$slave" > /dev/null 2>&1; then
                    # wait for the last slave to show up
                    exit 0
                fi
            done

            modprobe -q -b bonding
            echo "+$bondname" > /sys/class/net/bonding_masters 2> /dev/null
            ip link set "$bondname" down

            # Stolen from ifup-eth
            # add the bits to setup driver parameters here
            for arg in $bondoptions; do
                key=${arg%%=*}
                value=${arg##*=}
                # %{value:0:1} is replaced with non-bash specific construct
                if [ "${key}" = "arp_ip_target" -a "${#value}" != "0" -a "+${value%%+*}" != "+" ]; then
                    OLDIFS=$IFS
                    IFS=','
                    for arp_ip in $value; do
                        echo "+$arp_ip" > "/sys/class/net/${bondname}/bonding/$key"
                    done
                    IFS=$OLDIFS
                else
                    echo "$value" > "/sys/class/net/${bondname}/bonding/$key"
                fi
            done

            linkup "$bondname"

            for slave in $bondslaves; do
                cat "/sys/class/net/$slave/address" > "/tmp/net.${bondname}.${slave}.hwaddr"
                ip link set "$slave" down
                echo "+$slave" > "/sys/class/net/$bondname/bonding/slaves"
                linkup "$slave"
            done

            # Set mtu on bond master
            [ -n "$bondmtu" ] && ip link set mtu "$bondmtu" dev "$bondname"

            # add the bits to setup the needed post enslavement parameters
            for arg in $bondoptions; do
                key=${arg%%=*}
                value=${arg##*=}
                if [ "${key}" = "primary" ]; then
                    echo "$value" > "/sys/class/net/${bondname}/bonding/$key"
                fi
            done

            : > "/tmp/bond.$bondname.up"

            NO_BOND_MASTER=yes ifup "$bondname"
            exit $?
        done
    done
fi

if [ -z "$NO_TEAM_MASTER" ]; then
    for i in /tmp/team.*.info; do
        [ -e "$i" ] || continue
        unset teammaster
        unset teamslaves
        # shellcheck disable=SC1090
        . "$i"
        for testslave in $teamslaves; do
            [ "$netif" != "$testslave" ] && continue

            [ -e "/tmp/team.$teammaster.up" ] && exit 0

            # wait for all slaves to show up
            for slave in $teamslaves; do
                # try to create the slave (maybe vlan or bridge)
                NO_TEAM_MASTER=yes NO_AUTO_DHCP=yes ifup "$slave"

                if ! ip link show dev "$slave" > /dev/null 2>&1; then
                    # wait for the last slave to show up
                    exit 0
                fi
            done

            if [ ! -e "/tmp/team.$teammaster.up" ]; then
                # We shall only bring up those _can_ come up
                # in case of some slave is gone in active-backup mode
                working_slaves=""
                for slave in $teamslaves; do
                    teamdctl "${teammaster}" port present "${slave}" 2> /dev/null \
                        && continue
                    ip link set dev "$slave" up 2> /dev/null
                    if wait_for_if_up "$slave"; then
                        working_slaves="$working_slaves$slave "
                    fi
                done
                # Do not add slaves now
                teamd -d -U -n -N -t "$teammaster" -f "/etc/teamd/${teammaster}.conf"
                for slave in $working_slaves; do
                    # team requires the slaves to be down before joining team
                    ip link set dev "$slave" down
                    (
                        unset TEAM_PORT_CONFIG
                        _hwaddr=$(cat "/sys/class/net/$slave/address")
                        _subchannels=$(iface_get_subchannels "$slave")
                        if [ -n "$_hwaddr" ] && [ -e "/etc/sysconfig/network-scripts/mac-${_hwaddr}.conf" ]; then
                            # shellcheck disable=SC1090
                            . "/etc/sysconfig/network-scripts/mac-${_hwaddr}.conf"
                        elif [ -n "$_subchannels" ] && [ -e "/etc/sysconfig/network-scripts/ccw-${_subchannels}.conf" ]; then
                            # shellcheck disable=SC1090
                            . "/etc/sysconfig/network-scripts/ccw-${_subchannels}.conf"
                        elif [ -e "/etc/sysconfig/network-scripts/ifcfg-${slave}" ]; then
                            # shellcheck disable=SC1090
                            . "/etc/sysconfig/network-scripts/ifcfg-${slave}"
                        fi

                        if [ -n "${TEAM_PORT_CONFIG}" ]; then
                            /usr/bin/teamdctl "${teammaster}" port config update "${slave}" "${TEAM_PORT_CONFIG}"
                        fi
                    )
                    teamdctl "$teammaster" port add "$slave"
                done

                ip link set dev "$teammaster" up

                : > "/tmp/team.$teammaster.up"
                NO_TEAM_MASTER=yes ifup "$teammaster"
                exit $?
            fi
        done
    done
fi

# all synthetic interfaces done.. now check if the interface is available
if ! ip link show dev "$netif" > /dev/null 2>&1; then
    exit 1
fi

# disable manual ifup while netroot is set for simplifying our logic
# in netroot case we prefer netroot to bringup $netif automatically
[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"

if [ -n "$manualup" ]; then
    : > "/tmp/net.$netif.manualup"
    rm -f "/tmp/net.${netif}.did-setup"
else
    [ -e "/tmp/net.${netif}.did-setup" ] && exit 0
    [ -z "$DO_VLAN" ] \
        && [ -e "/sys/class/net/$netif/address" ] \
        && [ -e "/tmp/net.$(cat "/sys/class/net/$netif/address").did-setup" ] && exit 0
fi


# Specific configuration, spin through the kernel command line
# looking for ip= lines
for p in $(getargs ip=); do
    ip_to_var "$p"
    # skip ibft
    [ "$autoconf" = "ibft" ] && continue

    case "$dev" in
        ??:??:??:??:??:??) # MAC address
            _dev=$(iface_for_mac "$dev")
            [ -n "$_dev" ] && dev="$_dev"
            ;;
        ??-??-??-??-??-??) # MAC address in BOOTIF form
            _dev=$(iface_for_mac "$(fix_bootif "$dev")")
            [ -n "$_dev" ] && dev="$_dev"
            ;;
    esac

    # If this option isn't directed at our interface, skip it
    if [ -n "$dev" ]; then
        [ "$dev" != "$netif" ] && continue
    else
        iface_is_enslaved "$netif" && continue
    fi

    # Store config for later use
    for i in ip srv gw mask hostname macaddr mtu dns1 dns2; do
        eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
    done > "/tmp/net.$netif.override"

    for autoopt in $(str_replace "$autoconf" "," " "); do
        case $autoopt in
            dhcp | on | any)
                do_dhcp -4
                ;;
            single-dhcp)
                do_dhcp_parallel -4
                exit 0
                ;;
            dhcp6)
                load_ipv6
                do_dhcp -6
                ;;
            auto6)
                do_ipv6auto
                ;;
            either6)
                do_ipv6auto || do_dhcp -6
                ;;
            link6)
                do_ipv6link
                ;;
            *)
                do_static
                ;;
        esac
    done
    ret=$?

    # setup nameserver
    for s in "$dns1" "$dns2" $(getargs nameserver); do
        [ -n "$s" ] || continue
        echo "nameserver $s" >> "/tmp/net.$netif.resolv.conf"
    done

    if [ $ret -eq 0 ]; then
        : > "/tmp/net.${netif}.up"

        if [ -z "$DO_VLAN" ] && [ -e "/sys/class/net/${netif}/address" ]; then
            : > "/tmp/net.$(cat "/sys/class/net/${netif}/address").up"
        fi

        # and finally, finish interface set up if there isn't already a script
        # to do so (which is the case in the dhcp path)
        if [ ! -e "$hookdir/initqueue/setup_net_$netif.sh" ]; then
            setup_net "$netif"
            source_hook initqueue/online "$netif"
            if [ -z "$manualup" ]; then
                /sbin/netroot "$netif"
            fi
        fi

        if command -v wicked > /dev/null && [ -z "$manualup" ]; then
            /sbin/netroot "$netif"
        fi

        exit $ret
    fi
done

# no ip option directed at our interface?
if [ -z "$NO_AUTO_DHCP" ] && [ ! -e "/tmp/net.${netif}.up" ]; then
    ret=1
    if [ -e /tmp/net.bootdev ]; then
        BOOTDEV=$(cat /tmp/net.bootdev)
        if [ "$netif" = "$BOOTDEV" ] || [ "$BOOTDEV" = "$(cat "/sys/class/net/${netif}/address")" ]; then
            do_dhcp
            ret=$?
        fi
    else
        # No ip lines, no bootdev -> default to dhcp
        ip=$(getarg ip)

        if getargs 'ip=dhcp6' > /dev/null || [ -z "$ip" -a "$netroot" = "dhcp6" ]; then
            load_ipv6
            do_dhcp -6
            ret=$?
        fi
        if getargs 'ip=dhcp' > /dev/null || [ -z "$ip" -a "$netroot" != "dhcp6" ]; then
            do_dhcp -4
            ret=$?
        fi
    fi

    for s in $(getargs nameserver); do
        [ -n "$s" ] || continue
        echo "nameserver $s" >> "/tmp/net.$netif.resolv.conf"
    done

    if [ "$ret" -eq 0 ] && [ -n "$(ls "/tmp/leaseinfo.${netif}"* 2> /dev/null)" ]; then
        : > "/tmp/net.${netif}.did-setup"
        if [ -e "/sys/class/net/${netif}/address" ]; then
            : > "/tmp/net.$(cat "/sys/class/net/${netif}/address").did-setup"
        fi
    fi
fi

exit 0
 070701000000B6000081ED00000000000000000000000164DF2CB80000010E000000000000000000000000000000000000004A00000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-legacy/kill-dhclient.sh #!/bin/sh

for f in /tmp/dhclient.*.pid; do
    [ -e "$f" ] || continue
    read -r PID < "$f"
    kill "$PID" > /dev/null 2>&1
done

sleep 0.1

for f in /tmp/dhclient.*.pid; do
    [ -e "$f" ] || continue
    read -r PID < "$f"
    kill -9 "$PID" > /dev/null 2>&1
done
  070701000000B7000081ED00000000000000000000000164DF2CB800000E67000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-legacy/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    require_binaries ip sed awk grep pgrep tr expr || return 1

    require_any_binary arping arping2 wicked || return 1
    require_any_binary dhclient wicked || return 1

    return 255
}

# called by dracut
depends() {
    echo bash
    return 0
}

# called by dracut
installkernel() {
    return 0
}

# called by dracut
install() {
    local _arch

    #Adding default link
    if dracut_module_included "systemd"; then
        inst_multiple -o "${systemdutildir}/network/99-default.link"
        [[ $hostonly ]] && inst_multiple -H -o "${systemdsystemconfdir}/network/*.link"
    fi

    inst_multiple ip sed awk grep pgrep tr expr
    inst_simple -o dhclient

    inst_multiple -o arping arping2
    if command -v arping > /dev/null; then
        strstr "$(arping 2>&1)" "ARPing 2" && mv "$initdir/bin/arping" "$initdir/bin/arping2"
    fi
    inst_multiple -o wicked
    inst_multiple -o ping ping6
    inst_multiple -o teamd teamdctl teamnl
    inst_simple /etc/libnl/classid
    inst_script "$moddir/ifup.sh" "/sbin/ifup"
    inst_script "$moddir/dhcp-multi.sh" "/sbin/dhcp-multi.sh"
    inst_script "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
    inst_simple -H "/etc/dhclient.conf"
    cat "$moddir/dhclient.conf" >> "${initdir}/etc/dhclient.conf"
    inst_hook pre-udev 60 "$moddir/net-genrules.sh"
    inst_hook cmdline 92 "$moddir/parse-ibft.sh"
    inst_hook cmdline 95 "$moddir/parse-vlan.sh"
    inst_hook cmdline 96 "$moddir/parse-bond.sh"
    inst_hook cmdline 96 "$moddir/parse-team.sh"
    inst_hook cmdline 97 "$moddir/parse-bridge.sh"
    inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
    inst_hook cmdline 99 "$moddir/parse-ifname.sh"
    inst_hook cleanup 10 "$moddir/kill-dhclient.sh"

    # SUSE specific files
    for f in \
        /etc/sysconfig/network/ifcfg-* \
        /etc/sysconfig/network/ifroute-* \
        /etc/sysconfig/network/routes \
        /var/lib/wicked/duid.xml \
        /var/lib/wicked/iaid.xml; do
        [ -e "$f" ] && inst_simple "$f"
    done

    # install all config files for teaming
    unset TEAM_MASTER
    unset TEAM_CONFIG
    unset TEAM_PORT_CONFIG
    unset HWADDR
    unset SUBCHANNELS
    for i in /etc/sysconfig/network-scripts/ifcfg-*; do
        [ -e "$i" ] || continue
        case "$i" in
            *~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
                continue
                ;;
        esac
        (
            # shellcheck disable=SC1090
            . "$i"
            if ! [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] \
                && [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
                if [ -n "$TEAM_CONFIG" ] && [ -n "$DEVICE" ]; then
                    mkdir -p "$initdir"/etc/teamd
                    printf -- "%s" "$TEAM_CONFIG" > "$initdir/etc/teamd/${DEVICE}.conf"
                elif [ -n "$TEAM_PORT_CONFIG" ]; then
                    inst_simple "$i"

                    HWADDR="$(echo "$HWADDR" | sed 'y/ABCDEF/abcdef/')"
                    if [ -n "$HWADDR" ]; then
                        ln_r "$i" "/etc/sysconfig/network-scripts/mac-${HWADDR}.conf"
                    fi

                    SUBCHANNELS="$(echo "$SUBCHANNELS" | sed 'y/ABCDEF/abcdef/')"
                    if [ -n "$SUBCHANNELS" ]; then
                        ln_r "$i" "/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf"
                    fi
                fi
            fi
        )
    done

    _arch=${DRACUT_ARCH:-$(uname -m)}

    inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"

    dracut_need_initqueue
}
 070701000000B8000081ED00000000000000000000000164DF2CB800001124000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-legacy/net-genrules.sh  #!/bin/sh

getargbool 0 rd.neednet && NEEDNET=1

# Don't continue if we don't need network
if [ -z "$netroot" ] && [ ! -e "/tmp/net.ifaces" ] && [ "$NEEDNET" != "1" ]; then
    return
fi

command -v fix_bootif > /dev/null || . /lib/net-lib.sh

# Write udev rules
{
    # bridge: attempt only the defined interface
    for i in /tmp/bridge.*.info; do
        [ -e "$i" ] || continue
        unset bridgeslaves
        unset bridgename
        # shellcheck disable=SC1090
        . "$i"
        RAW_IFACES="$RAW_IFACES $bridgeslaves"
        MASTER_IFACES="$MASTER_IFACES $bridgename"
    done

    # bond: attempt only the defined interface (override bridge defines)
    for i in /tmp/bond.*.info; do
        [ -e "$i" ] || continue
        unset bondslaves
        unset bondname
        # shellcheck disable=SC1090
        . "$i"
        # It is enough to fire up only one
        RAW_IFACES="$RAW_IFACES $bondslaves"
        MASTER_IFACES="$MASTER_IFACES ${bondname}"
    done

    for i in /tmp/team.*.info; do
        [ -e "$i" ] || continue
        unset teamslaves
        unset teammaster
        # shellcheck disable=SC1090
        . "$i"
        RAW_IFACES="$RAW_IFACES ${teamslaves}"
        MASTER_IFACES="$MASTER_IFACES ${teammaster}"
    done

    for i in /tmp/vlan.*.phy; do
        [ -e "$i" ] || continue
        unset phydevice
        # shellcheck disable=SC1090
        . "$i"
        RAW_IFACES="$RAW_IFACES $phydevice"
        for j in /tmp/vlan.*".${phydevice}"; do
            [ -e "$j" ] || continue
            unset vlanname
            # shellcheck disable=SC1090
            . "$j"
            MASTER_IFACES="$MASTER_IFACES ${vlanname}"
        done
    done

    MASTER_IFACES="$(trim "$MASTER_IFACES")"
    RAW_IFACES="$(trim "$RAW_IFACES")"

    if [ -z "$IFACES" ]; then
        [ -e /tmp/net.ifaces ] && read -r IFACES < /tmp/net.ifaces
    fi

    if [ -e /tmp/net.bootdev ]; then
        bootdev=$(cat /tmp/net.bootdev)
    fi

    # shellcheck disable=SC2016
    ifup='/sbin/ifup $name'

    runcmd="RUN+=\"/sbin/initqueue --name ifup-\$name --unique --onetime $ifup\""

    # We have some specific interfaces to handle
    if [ -n "${RAW_IFACES}${IFACES}" ]; then
        echo 'SUBSYSTEM!="net", GOTO="net_end"'
        echo 'ACTION!="add|change|move", GOTO="net_end"'
        for iface in $IFACES $RAW_IFACES; do
            case "$iface" in
                ??:??:??:??:??:??) # MAC address
                    cond="ATTR{address}==\"$iface\""
                    echo "$cond, $runcmd, GOTO=\"net_end\""
                    ;;
                ??-??-??-??-??-??) # MAC address in BOOTIF form
                    cond="ATTR{address}==\"$(fix_bootif "$iface")\""
                    echo "$cond, $runcmd, GOTO=\"net_end\""
                    ;;
                *) # an interface name
                    cond="ENV{INTERFACE}==\"$iface\""
                    echo "$cond, $runcmd, GOTO=\"net_end\""
                    cond="NAME==\"$iface\""
                    echo "$cond, $runcmd, GOTO=\"net_end\""
                    ;;
            esac
            # The GOTO prevents us from trying to ifup the same device twice
        done
        echo 'LABEL="net_end"'

        for iface in $IFACES; do
            if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
                if [ -n "$netroot" ] && [ -n "$DRACUT_SYSTEMD" ]; then
                    echo "systemctl is-active initrd-root-device.target || [ -f /tmp/net.${iface}.did-setup ]"
                else
                    echo "[ -f /tmp/net.${iface}.did-setup ]"
                fi > "$hookdir"/initqueue/finished/wait-"$iface".sh
            fi
        done
    # Default: We don't know the interface to use, handle all
    # Fixme: waiting for the interface as well.
    else
        cond='ACTION=="add", SUBSYSTEM=="net", ENV{DEVTYPE}!="wlan|wwan"'
        # if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh
        echo "$cond, $runcmd" > /etc/udev/rules.d/91-default-net.rules
        if [ "$NEEDNET" = "1" ]; then
            # shellcheck disable=SC2016
            echo 'for i in /tmp/net.*.did-setup; do [ -f "$i" ]  && exit 0; done; exit 1' > "$hookdir"/initqueue/finished/wait-network.sh
        fi
    fi

    # if you change the name of "90-net.rules", also change modules.d/80cms/cmssetup.sh
} > /etc/udev/rules.d/90-net.rules
070701000000B9000081ED00000000000000000000000164DF2CB80000087F000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-legacy/parse-bond.sh    #!/bin/sh
#
# Format:
#       bond=<bondname>[:<bondslaves>[:<options>[:<mtu>]]]
#
#       bondslaves is a comma-separated list of physical (ethernet) interfaces
#       options is a comma-separated list on bonding options (modinfo bonding for details) in format compatible with initscripts
#       if options include multi-valued arp_ip_target option, then its values should be separated by semicolon.
#
#       bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr
#
#       if the mtu is specified, it will be set on the bond master
#

# We translate list of slaves to space-separated here to make it easier to loop over them in ifup
# Ditto for bonding options
parsebond() {
    local v=${1}:
    set --
    while [ -n "$v" ]; do
        set -- "$@" "${v%%:*}"
        v=${v#*:}
    done

    case $# in
        0)
            bondname=bond0
            bondslaves="eth0 eth1"
            ;;
        1)
            bondname=$1
            bondslaves="eth0 eth1"
            ;;
        2)
            bondname=$1
            bondslaves=$(str_replace "$2" "," " ")
            ;;
        3)
            bondname=$1
            bondslaves=$(str_replace "$2" "," " ")
            bondoptions=$(str_replace "$3" "," " ")
            ;;
        4)
            bondname=$1
            bondslaves=$(str_replace "$2" "," " ")
            bondoptions=$(str_replace "$3" "," " ")
            bondmtu=$4
            ;;
        *) die "bond= requires zero to four parameters" ;;
    esac
}

# Parse bond for bondname, bondslaves, bondmode, bondoptions and bondmtu
for bond in $(getargs bond=); do
    unset bondname
    unset bondslaves
    unset bondoptions
    unset bondmtu
    if [ "$bond" != "bond" ]; then
        parsebond "$bond"
    fi
    # Simple default bond
    if [ -z "$bondname" ]; then
        bondname=bond0
        bondslaves="eth0 eth1"
    fi
    # Make it suitable for initscripts export
    bondoptions=$(str_replace "$bondoptions" ";" ",")

    {
        echo "bondname=$bondname"
        echo "bondslaves=\"$bondslaves\""
        echo "bondoptions=\"$bondoptions\""
        echo "bondmtu=\"$bondmtu\""
    } > "/tmp/bond.${bondname}.info"
done
 070701000000BA000081ED00000000000000000000000164DF2CB80000049A000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-legacy/parse-bridge.sh  #!/bin/sh
#
# Format:
#       bridge=<bridgename>:<bridgeslaves>
#
#       <bridgeslaves> is a comma-separated list of physical (ethernet) interfaces
#       bridge without parameters assumes bridge=br0:eth0
#

parsebridge() {
    local v=${1}:
    set --
    while [ -n "$v" ]; do
        set -- "$@" "${v%%:*}"
        v=${v#*:}
    done
    case $# in
        0)
            bridgename=br0
            bridgeslaves=$iface
            ;;
        1) die "bridge= requires two parameters" ;;
        2)
            bridgename=$1
            bridgeslaves=$(str_replace "$2" "," " ")
            ;;
        *) die "bridge= requires two parameters" ;;
    esac
}

# Parse bridge for bridgename and bridgeslaves
for bridge in $(getargs bridge=); do
    unset bridgename
    unset bridgeslaves
    iface=eth0
    # Read bridge= parameters if they exist
    if [ "$bridge" != "bridge" ]; then
        parsebridge "$bridge"
    fi
    # Simple default bridge
    if [ -z "$bridgename" ]; then
        bridgename=br0
        bridgeslaves=$iface
    fi
    {
        echo "bridgename=$bridgename"
        echo "bridgeslaves=\"$bridgeslaves\""
    } > /tmp/bridge.${bridgename}.info
done
  070701000000BB000081ED00000000000000000000000164DF2CB800000115000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-legacy/parse-ibft.sh    #!/bin/sh

command -v getarg > /dev/null || . /lib/dracut-lib.sh
command -v ibft_to_cmdline > /dev/null || . /lib/net-lib.sh

if getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then
    modprobe -b -q iscsi_boot_sysfs 2> /dev/null
    modprobe -b -q iscsi_ibft
    ibft_to_cmdline
fi
   070701000000BC000081ED00000000000000000000000164DF2CB80000022B000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-legacy/parse-ifname.sh  #!/bin/sh
#
# Format:
#       ifname=<interface>:<mac>
#
# Note letters in the macaddress must be lowercase!
#
# Examples:
# ifname=eth0:4a:3f:4c:04:f8:d7
#
# Note when using ifname= to get persistent interface names, you must specify
# an ifname= argument for each interface used in an ip= or fcoe= argument

# check if there are any ifname parameters
if ! getarg ifname= > /dev/null; then
    return
fi

command -v parse_ifname_opts > /dev/null || . /lib/net-lib.sh

# Check ifname= lines
for p in $(getargs ifname=); do
    parse_ifname_opts "$p"
done
 070701000000BD000081ED00000000000000000000000164DF2CB80000136B000000000000000000000000000000000000004A00000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-legacy/parse-ip-opts.sh #!/bin/sh
#
# Format:
#       ip=[dhcp|on|any|single-dhcp]
#
#       ip=<interface>:[dhcp|on|any][:[<mtu>][:<macaddr>]]
#
#       ip=<client-IP-number>:<server-IP-number>:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:{dhcp|on|any|none|off}[:[<mtu>][:<macaddr>]]
#
# When supplying more than only ip= line, <interface> is mandatory and
# bootdev= must contain the name of the primary interface to use for
# routing,dns,dhcp-options,etc.
#

command -v getarg > /dev/null || . /lib/dracut-lib.sh

if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] && [ -z "$(getarg BOOTIF=)" ]; then
    # No ip= argument(s) for netroot provided, defaulting to DHCP
    return
fi

# Count ip= lines to decide whether we need bootdev= or not
if [ -z "$NEEDBOOTDEV" ]; then
    count=0
    for p in $(getargs ip=); do
        case "$p" in
            ibft)
                continue
                ;;
        esac
        count=$((count + 1))
    done
    [ $count -gt 1 ] && NEEDBOOTDEV=1
fi
unset count

# If needed, check if bootdev= contains anything usable
BOOTDEV=$(getarg bootdev=)

if [ -n "$NEEDBOOTDEV" ] && getargbool 1 rd.neednet; then
    #[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
    echo "rd.neednet=1" > /etc/cmdline.d/dracut-neednet.conf
    info "Multiple ip= arguments: assuming rd.neednet=1"
else
    unset NEEDBOOTDEV
fi

# Check ip= lines
# XXX Would be nice if we could errorcheck ip addresses here as well
for p in $(getargs ip=); do
    ip_to_var "$p"

    # make first device specified the BOOTDEV
    if [ -n "$NEEDBOOTDEV" ] && [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then
        BOOTDEV="$dev"
        info "Setting bootdev to '$BOOTDEV'"
    fi

    # skip ibft since we did it above
    [ "$autoconf" = "ibft" ] && continue

    # Empty autoconf defaults to 'dhcp'
    if [ -z "$autoconf" ]; then
        warn "Empty autoconf values default to dhcp"
        autoconf="dhcp"
    fi

    # Error checking for autoconf in combination with other values
    for autoopt in $(str_replace "$autoconf" "," " "); do
        case $autoopt in
            error) die "Error parsing option 'ip=$p'" ;;
            bootp | rarp | both) die "Sorry, ip=$autoopt is currenty unsupported" ;;
            none | off)
                [ -z "$ip" ] \
                    && die "For argument 'ip=$p'\nValue '$autoopt' without static configuration does not make sense"
                [ -z "$mask" ] \
                    && die "Sorry, automatic calculation of netmask is not yet supported"
                ;;
            auto6 | link6) ;;
            either6) ;;
            dhcp | dhcp6 | on | any | single-dhcp)
                [ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] \
                    && die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
                [ -n "$ip" ] \
                    && die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoopt'"
                ;;
            *) die "For argument 'ip=$p'\nSorry, unknown value '$autoopt'" ;;
        esac
    done

    if [ -n "$dev" ]; then
        # We don't like duplicate device configs
        if [ -n "$IFACES" ]; then
            for i in $IFACES; do
                [ "$dev" = "$i" ] && die "For argument 'ip=$p'\nDuplication configurations for '$dev'"
            done
        fi
        # IFACES list for later use
        IFACES="$IFACES $dev"
    fi

    # Do we need to check for specific options?
    if [ -n "$NEEDDHCP" ] || [ -n "$DHCPORSERVER" ]; then
        # Correct device? (Empty is ok as well)
        [ "$dev" = "$BOOTDEV" ] || continue
        # Server-ip is there?
        [ -n "$DHCPORSERVER" ] && [ -n "$srv" ] && continue
        # dhcp? (It's simpler to check for a set ip. Checks above ensure that if
        # ip is there, we're static
        [ -z "$ip" ] && continue
        # Not good!
        die "Server-ip or dhcp for netboot needed, but current arguments say otherwise"
    fi

    if str_starts "$dev" "enx" && [ ${#dev} -eq 15 ]; then
        # shellcheck disable=SC2003
        printf -- "ifname=%s:%s:%s:%s:%s:%s:%s\n" \
            "$dev" \
            "$(expr substr "$dev" 3 2)" \
            "$(expr substr "$dev" 5 2)" \
            "$(expr substr "$dev" 7 2)" \
            "$(expr substr "$dev" 9 2)" \
            "$(expr substr "$dev" 11 2)" \
            "$(expr substr "$dev" 13 2)" \
            >> /etc/cmdline.d/80-enx.conf
    fi
done

# put BOOTIF in IFACES to make sure it comes up
if getargbool 1 "rd.bootif" && BOOTIF="$(getarg BOOTIF=)"; then
    BOOTDEV=$(fix_bootif "$BOOTIF")
    IFACES="$BOOTDEV $IFACES"
fi

# This ensures that BOOTDEV is always first in IFACES
if [ -n "$BOOTDEV" ] && [ -n "$IFACES" ]; then
    IFACES="${IFACES%$BOOTDEV*} ${IFACES#*$BOOTDEV}"
    IFACES="$BOOTDEV $IFACES"
fi

# Store BOOTDEV and IFACES for later use
[ -n "$BOOTDEV" ] && echo "$BOOTDEV" > /tmp/net.bootdev
[ -n "$IFACES" ] && echo "$IFACES" > /tmp/net.ifaces
 070701000000BE000081ED00000000000000000000000164DF2CB8000006E2000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-legacy/parse-team.sh    #!/bin/sh
#
# Format:
#       team=<teammaster>:<teamslaves>[:<teamrunner>]
#
#       teamslaves is a comma-separated list of physical (ethernet) interfaces
#       teamrunner is the runner type to be used (see teamd.conf(5)); defaults to activebackup
#
#       team without parameters assumes team=team0:eth0,eth1:activebackup
#

parseteam() {
    local v=${1}:
    set --
    while [ -n "$v" ]; do
        set -- "$@" "${v%%:*}"
        v=${v#*:}
    done

    case $# in
        0)
            teammaster=team0
            teamslaves="eth0 eth1"
            teamrunner="activebackup"
            ;;
        1)
            teammaster=$1
            teamslaves="eth0 eth1"
            teamrunner="activebackup"
            ;;
        2)
            teammaster=$1
            teamslaves=$(str_replace "$2" "," " ")
            teamrunner="activebackup"
            ;;
        3)
            teammaster=$1
            teamslaves=$(str_replace "$2" "," " ")
            teamrunner=$3
            ;;
        *) die "team= requires zero to three parameters" ;;
    esac
    return 0
}

for team in $(getargs team); do
    [ "$team" = "team" ] && continue

    unset teammaster
    unset teamslaves
    unset teamrunner

    parseteam "$team" || continue

    {
        echo "teammaster=$teammaster"
        echo "teamslaves=\"$teamslaves\""
        echo "teamrunner=\"$teamrunner\""
    } > /tmp/team."${teammaster}".info

    if ! [ -e /etc/teamd/"${teammaster}".conf ]; then
        warn "Team master $teammaster specified, but no /etc/teamd/$teammaster.conf present. Using $teamrunner."
        mkdir -p /etc/teamd
        printf -- "%s" "{\"runner\": {\"name\": \"$teamrunner\"}, \"link_watch\": {\"name\": \"ethtool\"}}" > "/tmp/${teammaster}.conf"
    fi
done
  070701000000BF000081ED00000000000000000000000164DF2CB8000002C5000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-legacy/parse-vlan.sh    #!/bin/sh
#
# Format:
#	vlan=<vlanname>:<phydevice>
#

parsevlan() {
    local v=${1}:
    set --
    while [ -n "$v" ]; do
        set -- "$@" "${v%%:*}"
        v=${v#*:}
    done

    unset vlanname phydevice
    case $# in
        2)
            vlanname=$1
            phydevice=$2
            ;;
        *) die "vlan= requires two parameters" ;;
    esac
}

for vlan in $(getargs vlan=); do
    unset vlanname
    unset phydevice
    if [ ! "$vlan" = "vlan" ]; then
        parsevlan "$vlan"
    fi

    echo "phydevice=\"$phydevice\"" > /tmp/vlan."${phydevice}".phy
    {
        echo "vlanname=\"$vlanname\""
        echo "phydevice=\"$phydevice\""
    } > /tmp/vlan."${vlanname}"."${phydevice}"
done
   070701000000C0000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-manager 070701000000C1000081A400000000000000000000000164DF2CB800000036000000000000000000000000000000000000005600000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-manager/initrd-no-auto-default.conf [.config]
enable=env:initrd

[main]
no-auto-default=*
  070701000000C2000081ED00000000000000000000000164DF2CB800000AC8000000000000000000000000000000000000004A00000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-manager/module-setup.sh #!/bin/bash

# called by dracut
check() {
    require_binaries sed grep || return 1

    # do not add this module by default
    return 255
}

# called by dracut
depends() {
    echo dbus bash
    return 0
}

# called by dracut
installkernel() {
    return 0
}

# called by dracut
install() {
    local _nm_version

    _nm_version=${NM_VERSION:-$(NetworkManager --version)}

    # We don't need `ip` but having it is *really* useful for people debugging
    # in an emergency shell.
    inst_multiple ip sed grep

    inst NetworkManager
    inst_multiple -o /usr/{lib,libexec}/nm-initrd-generator
    inst_multiple -o /usr/{lib,libexec}/nm-daemon-helper
    inst_multiple -o teamd dhclient
    inst_hook cmdline 99 "$moddir/nm-config.sh"
    if dracut_module_included "systemd"; then

        inst "$dbussystem"/org.freedesktop.NetworkManager.conf
        inst_multiple nmcli nm-online

        # teaming support under systemd+dbus
        inst_multiple -o \
            "$dbussystem"/teamd.conf \
            "$dbussystemconfdir"/teamd.conf

        # Install a configuration snippet to prevent the automatic creation of
        # "Wired connection #" DHCP connections for Ethernet interfaces
        inst_simple "$moddir"/initrd-no-auto-default.conf /usr/lib/NetworkManager/conf.d/

        inst_simple "$moddir"/nm-initrd.service "$systemdsystemunitdir"/nm-initrd.service
        inst_simple "$moddir"/nm-wait-online-initrd.service "$systemdsystemunitdir"/nm-wait-online-initrd.service

        # Adding default link
        inst_multiple -o "${systemdutildir}/network/99-default.link"
        [[ $hostonly ]] && inst_multiple -H -o "${systemdsystemconfdir}/network/*.link"

        $SYSTEMCTL -q --root "$initdir" enable nm-initrd.service
    fi

    inst_hook initqueue/settled 99 "$moddir/nm-run.sh"

    inst_rules 85-nm-unmanaged.rules
    inst_libdir_dir "NetworkManager/$_nm_version"
    inst_libdir_file "NetworkManager/$_nm_version/libnm-device-plugin-team.so"
    inst_simple "$moddir/nm-lib.sh" "/lib/nm-lib.sh"

    if [[ -x "$initdir/usr/sbin/dhclient" ]]; then
        inst_multiple -o /usr/{lib,libexec}/nm-dhcp-helper
    elif ! [[ -e "$initdir/etc/machine-id" ]]; then
        # The internal DHCP client silently fails if we
        # have no machine-id
        systemd-machine-id-setup --root="$initdir"
    fi

    # We don't install the ifcfg files from the host automatically.
    # But the user might choose to include them, so we pull in the machinery to read them.
    inst_libdir_file "NetworkManager/$_nm_version/libnm-settings-plugin-ifcfg-rh.so"

    _arch=${DRACUT_ARCH:-$(uname -m)}

    inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
}
070701000000C3000081ED00000000000000000000000164DF2CB800000437000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-manager/nm-config.sh    #!/bin/sh

type nm_generate_connections > /dev/null 2>&1 || . /lib/nm-lib.sh

if [ -n "$netroot" ] || [ -e /tmp/net.ifaces ]; then
    echo rd.neednet >> /etc/cmdline.d/35-neednet.conf
fi

if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
    # shellcheck disable=SC2174
    mkdir -m 0755 -p /run/NetworkManager/conf.d
    (
        echo '[.config]'
        echo 'enable=env:initrd'
        echo
        echo '[logging]'
        echo 'level=TRACE'
    ) > /run/NetworkManager/conf.d/initrd-logging.conf

    if [ -n "$DRACUT_SYSTEMD" ]; then
        # Enable tty output if a usable console is found
        # See https://github.com/coreos/fedora-coreos-tracker/issues/943
        # shellcheck disable=SC2217
        if [ -w /dev/console ] && (echo < /dev/console) > /dev/null 2> /dev/null; then
            mkdir -p /run/systemd/system/nm-initrd.service.d
            cat << EOF > /run/systemd/system/nm-initrd.service.d/tty-output.conf
[Service]
StandardOutput=tty
EOF
            systemctl --no-block daemon-reload
        fi
    fi
fi

nm_generate_connections
 070701000000C4000081A400000000000000000000000164DF2CB800000425000000000000000000000000000000000000004C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-manager/nm-initrd.service   [Unit]
DefaultDependencies=no
Wants=systemd-udev-trigger.service
After=systemd-udev-trigger.service
After=dracut-cmdline.service
Wants=network.target
Before=network.target
ConditionPathExists=/run/NetworkManager/initrd/neednet
ConditionPathExistsGlob=|/usr/lib/NetworkManager/system-connections/*
ConditionPathExistsGlob=|/run/NetworkManager/system-connections/*
ConditionPathExistsGlob=|/etc/NetworkManager/system-connections/*
ConditionPathExistsGlob=|/etc/sysconfig/network-scripts/ifcfg-*

[Service]
Type=dbus
BusName=org.freedesktop.NetworkManager
ExecReload=/usr/bin/busctl call org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager Reload u 0
ExecStart=/usr/sbin/NetworkManager --debug
KillMode=process
# The following gets changed to StandardOutput=tty by nm-config.sh
# when debug is enabled and a usable console is found.
StandardOutput=null
Environment=NM_CONFIG_ENABLE_TAG=initrd
Restart=on-failure
ProtectSystem=true
ProtectHome=read-only

[Install]
WantedBy=initrd.target
Also=nm-wait-online-initrd.service
   070701000000C5000081A400000000000000000000000164DF2CB800000442000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-manager/nm-lib.sh   #!/bin/sh

type getcmdline > /dev/null 2>&1 || . /lib/dracut-lib.sh

nm_generate_connections() {
    rm -f /run/NetworkManager/system-connections/*
    if [ -x /usr/libexec/nm-initrd-generator ]; then
        # shellcheck disable=SC2046
        /usr/libexec/nm-initrd-generator -- $(getcmdline)
    elif [ -x /usr/lib/nm-initrd-generator ]; then
        # shellcheck disable=SC2046
        /usr/lib/nm-initrd-generator -- $(getcmdline)
    else
        warn "nm-initrd-generator not found"
    fi

    if getargbool 0 rd.neednet; then
        for i in /usr/lib/NetworkManager/system-connections/* \
            /run/NetworkManager/system-connections/* \
            /etc/NetworkManager/system-connections/* \
            /etc/sysconfig/network-scripts/ifcfg-*; do
            [ -f "$i" ] || continue
            mkdir -p "$hookdir"/initqueue/finished
            echo '[ -f /tmp/nm.done ]' > "$hookdir"/initqueue/finished/nm.sh
            mkdir -p /run/NetworkManager/initrd
            : > /run/NetworkManager/initrd/neednet # activate NM services
            break
        done
    fi
}
  070701000000C6000081ED00000000000000000000000164DF2CB8000008A7000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-manager/nm-run.sh   #!/bin/bash

type source_hook > /dev/null 2>&1 || . /lib/dracut-lib.sh

if [ -e /tmp/nm.done ]; then
    return
fi

if [ -z "$DRACUT_SYSTEMD" ]; then
    # Only start NM if networking is needed
    if [ -e /run/NetworkManager/initrd/neednet ]; then
        for i in /usr/lib/NetworkManager/system-connections/* \
            /run/NetworkManager/system-connections/* \
            /etc/NetworkManager/system-connections/* \
            /etc/sysconfig/network-scripts/ifcfg-*; do
            [ -f "$i" ] || continue
            /usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
            break
        done
    fi
fi

if [ -s /run/NetworkManager/initrd/hostname ]; then
    cat /run/NetworkManager/initrd/hostname > /proc/sys/kernel/hostname
fi

kf_get_string() {
    # NetworkManager writes keyfiles (glib's GKeyFile API). Have a naive
    # parser for it.
    #
    # But GKeyFile will backslash escape certain keys (\s, \t, \n) but also
    # escape backslash. As an approximation, interpret the string with printf's
    # '%b'.
    #
    # This is supposed to mimic g_key_file_get_string() (poorly).

    v1="$(sed -n "s/^$1=/=/p" | sed '1!d')"
    test "$v1" = "${v1#=}" && return 1
    printf "%b" "${v1#=}"
}

kf_unescape() {
    # Another layer of unescaping. While values in GKeyFile format
    # are backslash escaped, the original strings (which are in no
    # defined encoding) are backslash escaped too to be valid UTF-8.
    # This will undo the second layer of escaping to give binary "strings".
    printf "%b" "$1"
}

kf_parse() {
    v3="$(kf_get_string "$1")" || return 1
    v3="$(kf_unescape "$v3")"
    printf '%s=%s\n' "$2" "$(printf '%q' "$v3")"
}

dhcpopts_create() {
    kf_parse root-path new_root_path < "$1"
    kf_parse next-server new_next_server < "$1"
    kf_parse dhcp-bootfile filename < "$1"
}

for _i in /sys/class/net/*; do
    [ -d "$_i" ] || continue
    state="/run/NetworkManager/devices/$(cat "$_i"/ifindex)"
    grep -q '^connection-uuid=' "$state" 2> /dev/null || continue
    ifname="${_i##*/}"
    dhcpopts_create "$state" > /tmp/dhclient."$ifname".dhcpopts
    source_hook initqueue/online "$ifname"
    /sbin/netroot "$ifname"
done

: > /tmp/nm.done
 070701000000C7000081A400000000000000000000000164DF2CB80000015D000000000000000000000000000000000000005800000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-manager/nm-wait-online-initrd.service   [Unit]
DefaultDependencies=no
Requires=nm-initrd.service
After=nm-initrd.service
Before=network-online.target
Before=dracut-initqueue.service
ConditionPathExists=/run/NetworkManager/initrd/neednet

[Service]
Type=oneshot
ExecStart=/usr/bin/nm-online -s -q -t 3600
RemainAfterExit=yes

[Install]
WantedBy=initrd.target
WantedBy=network-online.target
   070701000000C8000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-wicked  070701000000C9000081ED00000000000000000000000164DF2CB8000008A3000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-wicked/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    require_binaries wicked || return 1

    # do not add this module by default
    return 255
}

# called by dracut
depends() {
    echo systemd dbus
    return 0
}

# called by dracut
installkernel() {
    return 0
}

# called by dracut
install() {
    local -a wicked_units

    inst_hook cmdline 99 "$moddir/wicked-config.sh"

    # Seems to not execute if in initqueue/settled
    inst_hook pre-udev 99 "$moddir/wicked-run.sh"

    # even with wicked configuring the interface, ip is useful
    inst_multiple ip

    inst_dir /etc/wicked/extensions
    inst_dir /usr/share/wicked/schema
    if [ -d /usr/lib/wicked/bin ]; then
        inst_dir /usr/lib/wicked/bin
        inst_multiple "/usr/lib/wicked/bin/*"
    elif [ -d /usr/libexec/wicked/bin ]; then
        inst_dir /usr/libexec/wicked/bin
        inst_multiple "/usr/libexec/wicked/bin/*"
    fi
    inst_dir /var/lib/wicked

    inst_multiple "/etc/wicked/*.xml"
    inst_multiple "/etc/wicked/extensions/*"
    if [ -f /etc/dbus-1/system.d/org.opensuse.Network.conf ]; then
        inst_multiple "/etc/dbus-1/system.d/org.opensuse.Network*"
    elif [ -f /usr/share/dbus-1/system.d/org.opensuse.Network.conf ]; then
        inst_multiple "/usr/share/dbus-1/system.d/org.opensuse.Network*"
    fi
    inst_multiple "/usr/share/wicked/schema/*"
    inst_multiple "/usr/sbin/wicked*"

    wicked_units=(
        "$systemdsystemunitdir"/wickedd.service
        "$systemdsystemunitdir"/wickedd-auto4.service
        "$systemdsystemunitdir"/wickedd-dhcp4.service
        "$systemdsystemunitdir"/wickedd-dhcp6.service
        "$systemdsystemunitdir"/wickedd-nanny.service
    )

    inst_multiple "${wicked_units[@]}"

    for unit in "${wicked_units[@]}"; do
        sed -i 's/^After=.*/After=dbus.service/g' "$initdir/$unit"
        sed -i 's/^Before=\(.*\)/Before=\1 dracut-pre-udev.service/g' "$initdir/$unit"
        sed -i 's/^Wants=\(.*\)/Wants=\1 dbus.service/g' "$initdir/$unit"
        # shellcheck disable=SC1004
        sed -i -e \
            '/^\[Unit\]/aDefaultDependencies=no\
            Conflicts=shutdown.target\
            Before=shutdown.target' \
            "$initdir/$unit"
    done
}
 070701000000CA000081ED00000000000000000000000164DF2CB80000009C000000000000000000000000000000000000004A00000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-wicked/wicked-config.sh #!/bin/sh

getcmdline > /tmp/cmdline.$$.conf
wicked show-config --ifconfig dracut:cmdline:/tmp/cmdline.$$.conf > /tmp/dracut.xml
rm -f /tmp/cmdline.$$.conf
070701000000CB000081ED00000000000000000000000164DF2CB8000000AA000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/35network-wicked/wicked-run.sh    #!/bin/sh

# ensure wickedd is running
systemctl start wickedd
# detection wrapper around ifup --ifconfig "final xml" all
wicked bootstrap --ifconfig /tmp/dracut.xml all
  070701000000CC000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/modules.d/40network 070701000000CD000081ED00000000000000000000000164DF2CB800000392000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/40network/dhcp-root.sh    #!/bin/sh

# This script is sourced, so root should be set. But let's be paranoid
[ -z "$root" ] && root=$(getarg root=)

if [ -z "$netroot" ]; then
    for netroot in $(getargs netroot=); do
        [ "$netroot" = "dhcp" ] && break
        [ "$netroot" = "dhcp6" ] && break
    done
    [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] || unset netroot
fi

if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ]; then
    # Tell ip= checker that we need dhcp
    # shellcheck disable=SC2034
    NEEDDHCP="1"

    # Done, all good!
    # shellcheck disable=SC2034
    rootok=1
    if [ "$netroot" != "dhcp" ] && [ "$netroot" != "dhcp6" ]; then
        netroot=$root
    fi

    # Shut up init error check
    [ -z "$root" ] && root="dhcp"
    # shellcheck disable=SC2016
    echo '[ -d $NEWROOT/proc -o -e /dev/root ]' > "$hookdir"/initqueue/finished/dhcp.sh
fi
  070701000000CE000081ED00000000000000000000000164DF2CB800000478000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/40network/ifname-genrules.sh  #!/bin/sh

# if there are no ifname parameters, just use NAME=KERNEL
if ! getarg ifname= > /dev/null; then
    return
fi

command -v parse_ifname_opts > /dev/null || . /lib/net-lib.sh

{
    for p in $(getargs ifname=); do
        parse_ifname_opts "$p"

        if [ -f /tmp/ifname-"$ifname_mac" ]; then
            read -r oldif < /tmp/ifname-"$ifname_mac"
        fi
        if [ -f /tmp/ifname-"$ifname_if" ]; then
            read -r oldmac < /tmp/ifname-"$ifname_if"
        fi
        if [ -n "$oldif" -a -n "$oldmac" -a "$oldif" = "$ifname_if" -a "$oldmac" = "$ifname_mac" ]; then
            # skip same ifname= declaration
            continue
        fi

        [ -n "$oldif" ] && warn "Multiple interface names specified for MAC $ifname_mac: $oldif"
        [ -n "$oldmac" ] && warn "Multiple MAC specified for $ifname_if: $oldmac"

        printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if"
        echo "$ifname_if" > /tmp/ifname-"$ifname_mac"
        echo "$ifname_mac" > /tmp/ifname-"$ifname_if"
    done
} >> /etc/udev/rules.d/80-ifname.rules
070701000000CF000081ED00000000000000000000000164DF2CB800000557000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/modules.d/40network/module-setup.sh #!/bin/bash

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    is_qemu_virtualized && echo -n "qemu-net "

    for module in network-wicked network-manager network-legacy systemd-networkd; do
        if dracut_module_included "$module"; then
            network_handler="$module"
            break
        fi
    done

    if [ -z "$network_handler" ]; then
        if [[ -x $dracutsysrootdir$systemdsystemunitdir/wicked.service ]]; then
            network_handler="network-wicked"
        elif [[ -x $dracutsysrootdir/usr/libexec/nm-initrd-generator ]] || [[ -x $dracutsysrootdir/usr/lib/nm-initrd-generator ]]; then
            network_handler="network-manager"
        elif [[ -x $dracutsysrootdir$systemdutildir/systemd-networkd ]]; then
            network_handler="systemd-networkd"
        else
            network_handler="network-legacy"
        fi
    fi
    echo "kernel-network-modules $network_handler"
    return 0
}

# called by dracut
installkernel() {
    return 0
}

# called by dracut
install() {
    inst_script "$moddir/netroot.sh" "/sbin/netroot"
    inst_simple "$moddir/net-lib.sh" "/lib/net-lib.sh"
    inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
    inst_hook cmdline 91 "$moddir/dhcp-root.sh"
    inst_multiple ip sed awk grep pgrep tr
    inst_multiple -o arping arping2
    dracut_need_initqueue
}
 070701000000D0000081ED00000000000000000000000164DF2CB80000696E000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/40network/net-lib.sh  #!/bin/sh

# shellcheck disable=SC2034
IFNETFILE="/tmp/bootnetif"

is_ip() {
    echo "$1" | {
        IFS=. read -r a b c d
        test "$a" -ge 0 -a "$a" -le 255 \
            -a "$b" -ge 0 -a "$b" -le 255 \
            -a "$c" -ge 0 -a "$c" -le 255 \
            -a "$d" -ge 0 -a "$d" -le 255 \
            2> /dev/null
    } && return 0
    return 1
}

get_ip() {
    local iface="$1" ip=""
    ip=$(ip -f inet addr show "$iface")
    ip=${ip%%/*}
    ip=${ip##* }
    echo "$ip"
}

iface_for_remote_addr() {
    # shellcheck disable=SC2046
    set -- $(ip route get to "$@" | sed 's/.*\bdev\b//p;q')
    echo "$1"
}

iface_for_ip() {
    # shellcheck disable=SC2046
    set -- $(ip addr show to "$@")
    echo "${2%:}"
}

iface_for_mac() {
    local interface=""
    local mac
    mac="$(echo "$@" | sed 'y/ABCDEF/abcdef/')"
    for interface in /sys/class/net/*; do
        if [ "$(cat "$interface"/address)" = "$mac" ]; then
            echo "${interface##*/}"
        fi
    done
}

# get the iface name for the given identifier - either a MAC, IP, or iface name
iface_name() {
    case "$1" in
        ??:??:??:??:??:?? | ??-??-??-??-??-??) iface_for_mac "$1" ;;
        *:*:* | *.*.*.*) iface_for_ip "$1" ;;
        *) echo "$1" ;;
    esac
}

# list the configured interfaces
configured_ifaces() {
    local IFACES="" iface_id="" rv=1
    [ -e "/tmp/net.ifaces" ] && read -r IFACES < /tmp/net.ifaces
    if { pidof udevd || pidof systemd-udevd; } > /dev/null; then
        for iface_id in $IFACES; do
            printf "%s\n" "$(iface_name "$iface_id")"
            rv=0
        done
    else
        warn "configured_ifaces called before udev is running"
        echo "$IFACES"
        [ -n "$IFACES" ] && rv=0
    fi
    return $rv
}

all_ifaces_up() {
    local iface="" IFACES=""
    [ -e "/tmp/net.ifaces" ] && read -r IFACES < /tmp/net.ifaces
    for iface in $IFACES; do
        [ -e /tmp/net."$iface".up ] || return 1
    done
}

all_ifaces_setup() {
    local iface="" IFACES=""
    [ -e "/tmp/net.ifaces" ] && read -r IFACES < /tmp/net.ifaces
    for iface in $IFACES; do
        [ -e /tmp/net."$iface".did-setup ] || return 1
    done
}

get_netroot_ip() {
    local prefix="" server="" rest=""
    splitsep "$1" ":" prefix server rest
    case $server in
        [0-9]*\.[0-9]*\.[0-9]*\.[0-9]*)
            echo "$server"
            return 0
            ;;
    esac
    return 1
}

ip_is_local() {
    strstr "$(ip route get "$@" 2> /dev/null)" " via "
}

ifdown() {
    local netif="$1"
    # ip down/flush ensures that routing info goes away as well
    ip link set "$netif" down
    ip addr flush dev "$netif"
    echo "#empty" > /etc/resolv.conf
    rm -f -- /tmp/net."$netif".did-setup
    [ -z "$DO_VLAN" ] \
        && [ -e /sys/class/net/"$netif"/address ] \
        && rm -f -- "/tmp/net.$(cat /sys/class/net/"$netif"/address).did-setup"
    # TODO: send "offline" uevent?
}

setup_net() {
    local netif="$1" f="" gw_ip="" netroot_ip="" iface="" IFACES=""
    local _p
    [ -e /tmp/net."$netif".did-setup ] && return
    [ -z "$DO_VLAN" ] \
        && [ -e /sys/class/net/"$netif"/address ] \
        && [ -e "/tmp/net.$(cat /sys/class/net/"$netif"/address).did-setup" ] && return
    [ -e "/tmp/net.ifaces" ] && read -r IFACES < /tmp/net.ifaces
    [ -z "$IFACES" ] && IFACES="$netif"
    # run the scripts written by ifup
    # shellcheck disable=SC1090
    [ -e /tmp/net."$netif".hostname ] && . /tmp/net."$netif".hostname
    # shellcheck disable=SC1090
    [ -e /tmp/net."$netif".override ] && . /tmp/net."$netif".override
    # shellcheck disable=SC1090
    [ -e /tmp/dhclient."$netif".dhcpopts ] && . /tmp/dhclient."$netif".dhcpopts
    # set up resolv.conf
    [ -e /tmp/net."$netif".resolv.conf ] \
        && awk '!array[$0]++' /tmp/net."$netif".resolv.conf > /etc/resolv.conf
    # shellcheck disable=SC1090
    [ -e /tmp/net."$netif".gw ] && . /tmp/net."$netif".gw

    # add static route
    for _p in $(getargs rd.route); do
        route_to_var "$_p" || continue
        [ -n "$route_dev" ] && [ "$route_dev" != "$netif" ] && continue
        ip route add "$route_mask" ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}
        if strstr "$route_mask" ":"; then
            printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
                > /tmp/net.route6."$netif"
        else
            printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
                > /tmp/net.route."$netif"
        fi
    done

    # If a static route was necessary to reach the gateway, the
    # first gateway setup call will have failed with
    #     RTNETLINK answers: Network is unreachable
    # Replace the default route again after static routes to cover
    # this scenario.
    # shellcheck disable=SC1090
    [ -e /tmp/net."$netif".gw ] && . /tmp/net."$netif".gw

    # Handle STP Timeout: arping the default gateway.
    # (or the root server, if a) it's local or b) there's no gateway.)
    # Note: This assumes that if no router is present the
    # root server is on the same subnet.

    # Get DHCP-provided router IP, or the cmdline-provided "gw=" argument
    [ -n "$new_routers" ] && gw_ip=${new_routers%%,*}
    [ -n "$gw" ] && gw_ip=$gw

    # Get the "netroot" IP (if there's an IP address in there)
    netroot_ip=$(get_netroot_ip "$netroot")

    # try netroot if it's local (or there's no gateway)
    if ip_is_local "$netroot_ip" || [ -z "$gw_ip" ]; then
        dest="$netroot_ip"
    else
        dest="$gw_ip"
    fi

    unset layer2
    if [ -f /sys/class/net/"$netif"/device/layer2 ]; then
        read -r layer2 < /sys/class/net/"$netif"/device/layer2
    fi

    if [ "$layer2" != "0" ] && [ -n "$dest" ] && ! strstr "$dest" ":"; then
        if command -v arping2 > /dev/null; then
            arping2 -q -C 1 -c 60 -I "$netif" "$dest" || info "Resolving $dest via ARP on $netif failed"
        elif command -v arping > /dev/null; then
            arping -q -f -w 60 -I "$netif" "$dest" || info "Resolving $dest via ARP on $netif failed"
        elif command -v wicked > /dev/null; then
            wicked arp ping --quiet --interval 1000 --timeout 60000 "$netif" "$dest" || info "Resolving $dest via ARP on $netif failed"
        fi
    fi
    unset layer2

    : > /tmp/net."$netif".did-setup
    [ -z "$DO_VLAN" ] \
        && [ -e /sys/class/net/"$netif"/address ] \
        && : > "/tmp/net.$(cat /sys/class/net/"$netif"/address).did-setup"
}

save_netinfo() {
    local netif="$1" IFACES="" f="" i=""
    [ -e /tmp/net.ifaces ] && read -r IFACES < /tmp/net.ifaces
    # Add $netif to the front of IFACES (if it's not there already).
    set -- "$netif"
    for i in $IFACES; do [ "$i" != "$netif" ] && set -- "$@" "$i"; done
    IFACES="$*"
    for i in $IFACES; do
        for f in "/tmp/dhclient.$i."*; do
            [ -f "$f" ] && cp -f "$f" /tmp/net."${f#/tmp/dhclient.}"
        done
    done
    echo "$IFACES" > /tmp/.net.ifaces.new
    mv /tmp/.net.ifaces.new /tmp/net.ifaces
}

set_ifname() {
    local name="$1" mac="$2" num=-1 n=""
    # if it's already set, return the existing name
    for n in $(getargs ifname=); do
        strstr "$n" "$mac" && echo "${n%%:*}" && return
    done
    [ ! -f "/tmp/set_ifname_$name" ] || read -r num < "/tmp/set_ifname_$name"
    # otherwise, pick a new name and use that
    while :; do
        num=$((num + 1))
        [ -e /sys/class/net/"$name"$num ] && continue
        for n in $(getargs ifname=); do
            [ "$name$num" = "${n%%:*}" ] && continue 2
        done
        break
    done
    echo "ifname=$name$num:$mac" >> /etc/cmdline.d/45-ifname.conf
    echo "$num" > "/tmp/set_ifname_$name"
    echo "$name$num"
}

# pxelinux provides macaddr '-' separated, but we need ':'
fix_bootif() {
    local macaddr=${1}
    local IFS='-'
    # shellcheck disable=SC2086
    macaddr=$(printf '%s:' ${macaddr})
    macaddr=${macaddr%:}
    # strip hardware type field from pxelinux
    [ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
    # return macaddr with lowercase alpha characters expected by udev
    echo "$macaddr" | sed 'y/ABCDEF/abcdef/'
}

ibft_to_cmdline() {
    local iface=""
    modprobe -q iscsi_ibft
    (
        for iface in /sys/firmware/ibft/ethernet*; do
            local mac="" dev=""
            local dhcp="" ip="" gw="" mask="" hostname=""
            local dns1 dns2

            [ -e "${iface}"/mac ] || continue
            read -r mac < "${iface}"/mac
            [ -z "$mac" ] && continue
            dev=$(set_ifname ibft "$mac")

            [ -e /tmp/net."${dev}".has_ibft_config ] && continue

            [ -e "${iface}"/flags ] && read -r flags < "${iface}"/flags
            # Skip invalid interfaces
            awk -- 'BEGIN { exit (!and('"$flags"',1)) }' || continue
            # Skip interfaces not used for booting unless using multipath
            if ! getargbool 0 rd.iscsi.mp; then
                awk -- 'BEGIN { exit (!and('"$flags"',2)) }' || continue
            fi
            [ -e "${iface}"/dhcp ] && read -r dhcp < "${iface}"/dhcp
            [ -e "${iface}"/origin ] && read -r origin < "${iface}"/origin
            [ -e "${iface}"/ip-addr ] && read -r ip < "${iface}"/ip-addr

            if [ -n "$ip" ]; then
                case "$ip" in
                    *.*.*.*)
                        family=ipv4
                        ;;
                    *:*)
                        family=ipv6
                        ;;
                esac
            fi
            if [ -n "$dhcp" ] || [ "$origin" -eq 3 ]; then
                if [ "$family" = "ipv6" ]; then
                    echo "ip=$dev:dhcp6"
                else
                    echo "ip=$dev:dhcp"
                fi
            elif [ -e "${iface}"/ip-addr ]; then
                # skip not assigned ip adresses
                [ "$ip" = "0.0.0.0" ] && continue
                [ -e "${iface}"/gateway ] && read -r gw < "${iface}"/gateway
                [ "$gw" = "0.0.0.0" ] && unset gw
                [ -e "${iface}"/subnet-mask ] && read -r mask < "${iface}"/subnet-mask
                [ -e "${iface}"/prefix-len ] && read -r prefix < "${iface}"/prefix-len
                [ -e "${iface}"/primary-dns ] && read -r dns1 < "${iface}"/primary-dns
                [ "$dns1" = "0.0.0.0" ] && unset dns1
                [ -e "${iface}"/secondary-dns ] && read -r dns2 < "${iface}"/secondary-dns
                [ "$dns2" = "0.0.0.0" ] && unset dns
                [ -e "${iface}"/hostname ] && read -r hostname < "${iface}"/hostname
                if [ "$family" = "ipv6" ]; then
                    if [ -n "$ip" ]; then
                        [ -n "$prefix" ] || prefix=64
                        ip="[${ip}/${prefix}]"
                        mask=
                    fi
                    if [ -n "$gw" ]; then
                        gw="[${gw}]"
                    fi
                fi
                if [ -n "$ip" ] && [ -n "$mask" -o -n "$prefix" ]; then
                    echo "ip=$ip::$gw:$mask:$hostname:$dev:none${dns1:+:$dns1}${dns2:+:$dns2}"
                else
                    warn "${iface} does not contain a valid iBFT configuration"
                    warn "ip-addr=$ip"
                    warn "gateway=$gw"
                    warn "subnet-mask=$mask"
                    warn "hostname=$hostname"
                fi
            else
                info "${iface} does not contain a valid iBFT configuration"
                # shellcheck disable=SC2012
                ls -l "${iface}" | vinfo
            fi

            if [ -e "${iface}"/vlan ]; then
                read -r vlan < "${iface}"/vlan
                if [ "$vlan" -ne "0" ]; then
                    case "$vlan" in
                        [0-9]*)
                            echo "vlan=$dev.$vlan:$dev"
                            echo "$mac" > /tmp/net."${dev}"."${vlan}".has_ibft_config
                            ;;
                        *)
                            echo "vlan=$vlan:$dev"
                            echo "$mac" > /tmp/net."${vlan}".has_ibft_config
                            ;;
                    esac
                else
                    echo "$mac" > /tmp/net."${dev}".has_ibft_config
                fi
            else
                echo "$mac" > /tmp/net."${dev}".has_ibft_config
            fi

        done
    ) >> /etc/cmdline.d/40-ibft.conf
}

parse_iscsi_root() {
    local v
    v=${1#iscsi:}

    # extract authentication info
    case "$v" in
        *@*:*:*:*:*)
            authinfo=${v%%@*}
            v=${v#*@}
            # allow empty authinfo to allow having an @ in iscsi_target_name like this:
            # netroot=iscsi:@192.168.1.100::3260::iqn.2009-01.com.example:testdi@sk
            if [ -n "$authinfo" ]; then
                OLDIFS="$IFS"
                IFS=:
                # shellcheck disable=SC2086
                set $authinfo
                IFS="$OLDIFS"
                if [ $# -gt 4 ]; then
                    warn "Wrong authentication info in iscsi: parameter!"
                    return 1
                fi
                iscsi_username=$1
                iscsi_password=$2
                if [ $# -gt 2 ]; then
                    iscsi_in_username=$3
                    iscsi_in_password=$4
                fi
            fi
            ;;
    esac

    # extract target ip
    case "$v" in
        [[]*[]]:*)
            iscsi_target_ip=${v#[[]}
            iscsi_target_ip=${iscsi_target_ip%%[]]*}
            # shellcheck disable=SC1087
            v=${v#[[]$iscsi_target_ip[]]:}
            ;;
        *)
            iscsi_target_ip=${v%%[:]*}
            v=${v#$iscsi_target_ip:}
            ;;
    esac

    unset iscsi_target_name
    # extract target name
    case "$v" in
        *:iqn.*)
            iscsi_target_name=iqn.${v##*:iqn.}
            v=${v%:iqn.*}:
            ;;
        *:eui.*)
            iscsi_target_name=eui.${v##*:eui.}
            v=${v%:eui.*}:
            ;;
        *:naa.*)
            iscsi_target_name=naa.${v##*:naa.}
            v=${v%:naa.*}:
            ;;
    esac

    # parse the rest
    OLDIFS="$IFS"
    IFS=:
    # shellcheck disable=SC2086
    set $v
    IFS="$OLDIFS"

    iscsi_protocol=$1
    shift # ignored
    iscsi_target_port=$1
    shift

    if [ -n "$iscsi_target_name" ]; then
        if [ $# -eq 3 ]; then
            iscsi_iface_name=$1
            shift
        fi
        if [ $# -eq 2 ]; then
            iscsi_netdev_name=$1
            shift
        fi
        iscsi_lun=$1
        shift
        if [ $# -ne 0 ]; then
            warn "Invalid parameter in iscsi: parameter!"
            return 1
        fi
        return 0
    fi

    if [ $# -gt 3 ] && [ -n "$1$2" ]; then
        if [ -z "$3" ] || [ "$3" -ge 0 ] 2> /dev/null; then
            iscsi_iface_name=$1
            shift
            iscsi_netdev_name=$1
            shift
        fi
    fi

    iscsi_lun=$1
    shift

    iscsi_target_name=$(printf "%s:" "$@")
    iscsi_target_name=${iscsi_target_name%:}
}

ip_to_var() {
    local v=${1}:
    local i
    set --
    while [ -n "$v" ]; do
        if [ "${v#\[*:*:*\]:}" != "$v" ]; then
            # handle IPv6 address
            i="${v%%\]:*}"
            i="${i##\[}"
            set -- "$@" "$i"
            v=${v#\[$i\]:}
        else
            set -- "$@" "${v%%:*}"
            v=${v#*:}
        fi
    done

    unset ip srv gw mask hostname dev autoconf macaddr mtu dns1 dns2

    if [ $# -eq 0 ]; then
        autoconf="error"
        return 0
    fi

    if [ $# -eq 1 ]; then
        # format: ip={dhcp|on|any|dhcp6|auto6|either6|single-dhcp}
        # or
        #         ip=<ipv4-address> means anaconda-style static config argument cluster
        autoconf="$1"

        if strglob "$autoconf" "*.*.*.*"; then
            # ip=<ipv4-address> means anaconda-style static config argument cluster:
            # ip=<ip> gateway=<gw> netmask=<nm> hostname=<host> mtu=<mtu>
            # ksdevice={link|bootif|ibft|<MAC>|<ifname>}
            ip="$autoconf"
            gw=$(getarg gateway=)
            mask=$(getarg netmask=)
            hostname=$(getarg hostname=)
            dev=$(getarg ksdevice=)
            autoconf="none"
            mtu=$(getarg mtu=)

            # handle special values for ksdevice
            case "$dev" in
                bootif | BOOTIF) dev=$(fix_bootif "$(getarg BOOTIF=)") ;;
                link) dev="" ;; # FIXME: do something useful with this
                ibft) dev="" ;; # ignore - ibft is handled elsewhere
            esac
        fi
        return 0
    fi

    if [ "$2" = "dhcp" -o "$2" = "on" -o "$2" = "any" -o "$2" = "dhcp6" -o "$2" = "auto6" -o "$2" = "either6" ]; then
        # format: ip=<interface>:{dhcp|on|any|dhcp6|auto6}[:[<mtu>][:<macaddr>]]
        [ -n "$1" ] && dev="$1"
        [ -n "$2" ] && autoconf="$2"
        [ -n "$3" ] && mtu=$3
        if [ -z "$5" ]; then
            macaddr="$4"
        else
            macaddr="${4}:${5}:${6}:${7}:${8}:${9}"
        fi
        return 0
    fi

    # format: ip=<client-IP>:[<peer>]:<gateway-IP>:<netmask>:<client_hostname>:<interface>:{none|off|dhcp|on|any|dhcp6|auto6|ibft}:[:[<mtu>][:<macaddr>]]

    [ -n "$1" ] && ip=$1
    [ -n "$2" ] && srv=$2
    [ -n "$3" ] && gw=$3
    [ -n "$4" ] && mask=$4
    [ -n "$5" ] && hostname=$5
    [ -n "$6" ] && dev=$6
    [ -n "$7" ] && autoconf=$7
    case "$8" in
        [0-9a-fA-F]*:* | [0-9]*.[0-9]*.[0-9]*.[0-9]*)
            dns1="$8"
            [ -n "$9" ] && dns2="$9"
            ;;
        [0-9]*)
            mtu="$8"
            if [ -n "${9}" -a -z "${10}" ]; then
                macaddr="${9}"
            elif [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
                macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
            fi
            ;;
        *)
            if [ -n "${9}" -a -z "${10}" ]; then
                macaddr="${9}"
            elif [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
                macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
            fi
            ;;
    esac
    return 0
}

route_to_var() {
    local v=${1}:
    local i
    set --
    while [ -n "$v" ]; do
        if [ "${v#\[*:*:*\]:}" != "$v" ]; then
            # handle IPv6 address
            i="${v%%\]:*}"
            i="${i##\[}"
            set -- "$@" "$i"
            v=${v#\[$i\]:}
        else
            set -- "$@" "${v%%:*}"
            v=${v#*:}
        fi
    done

    unset route_mask route_gw route_dev
    case $# in
        2)
            [ -n "$1" ] && route_mask="$1"
            [ -n "$2" ] && route_gw="$2"
            return 0
            ;;
        3)
            [ -n "$1" ] && route_mask="$1"
            [ -n "$2" ] && route_gw="$2"
            [ -n "$3" ] && route_dev="$3"
            return 0
            ;;
        *) return 1 ;;
    esac
}

parse_ifname_opts() {
    local IFS=:
    # shellcheck disable=SC2086
    set -- $1

    case $# in
        7)
            ifname_if=$1
            # udev requires MAC addresses to be lower case
            ifname_mac=$(echo "$2:$3:$4:$5:$6:$7" | sed 'y/ABCDEF/abcdef/')
            ;;
        21)
            ifname_if=$1
            # udev requires MAC addresses to be lower case
            ifname_mac=$(echo "$2:$3:$4:$5:$6:$7:$8:$9:${10}:${11}:${12}:${13}:${14}:${15}:${16}:${17}:${18}:${19}:${20}:${21}" | sed 'y/ABCDEF/abcdef/')
            ;;
        *)
            die "Invalid arguments for ifname="
            ;;
    esac

    case $ifname_if in
        eth[0-9] | eth[0-9][0-9] | eth[0-9][0-9][0-9] | eth[0-9][0-9][0-9][0-9])
            warn "ifname=$ifname_if uses the kernel name space for interfaces"
            warn "This can fail for multiple network interfaces and is discouraged!"
            warn 'Please use a custom name like "netboot" or "bluesocket"'
            warn "or use biosdevname and no ifname= at all."
            ;;
    esac

}

# some network driver need long time to initialize, wait before it's ready.
wait_for_if_link() {
    local cnt=0
    local li
    local timeout
    timeout=$(getargs rd.net.timeout.iflink=)
    timeout=${timeout:-60}
    timeout=$((timeout * 10))

    while [ $cnt -lt $timeout ]; do
        li=$(ip link show dev "$@" 2> /dev/null)
        [ -n "$li" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_if_up() {
    local cnt=0
    local li
    local timeout
    timeout=$(getargs rd.net.timeout.ifup=)
    timeout=${timeout:-20}
    timeout=$((timeout * 10))

    while [ $cnt -lt $timeout ]; do
        li=$(ip link show up dev "$@")
        if [ -n "$li" ]; then
            case "$li" in
                *\<UP*)
                    return 0
                    ;;
                *\<*,UP\>*)
                    return 0
                    ;;
                *\<*,UP,*\>*)
                    return 0
                    ;;
            esac
        fi
        if strstr "$li" "LOWER_UP" \
            && strstr "$li" "state UNKNOWN" \
            && ! strstr "$li" "DORMANT"; then
            return 0
        fi
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_route_ok() {
    local cnt=0
    local timeout
    timeout=$(getargs rd.net.timeout.route=)
    timeout=${timeout:-20}
    timeout=$((timeout * 10))

    while [ $cnt -lt $timeout ]; do
        li=$(ip route show)
        [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_ipv6_dad_link() {
    local cnt=0
    local timeout
    timeout=$(getargs rd.net.timeout.ipv6dad=)
    timeout=${timeout:-50}
    timeout=$((timeout * 10))

    while [ $cnt -lt $timeout ]; do
        [ -n "$(ip -6 addr show dev "$@" scope link)" ] \
            && [ -z "$(ip -6 addr show dev "$@" scope link tentative)" ] \
            && return 0
        [ -n "$(ip -6 addr show dev "$@" scope link dadfailed)" ] \
            && return 1
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_ipv6_dad() {
    local cnt=0
    local timeout
    timeout=$(getargs rd.net.timeout.ipv6dad=)
    timeout=${timeout:-50}
    timeout=$((timeout * 10))

    while [ $cnt -lt $timeout ]; do
        [ -n "$(ip -6 addr show dev "$@")" ] \
            && [ -z "$(ip -6 addr show dev "$@" tentative)" ] \
            && { ip -6 route list proto ra dev "$@" | grep -q ^default; } \
            && return 0
        [ -n "$(ip -6 addr show dev "$@" dadfailed)" ] \
            && return 1
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_ipv6_auto() {
    local cnt=0
    local timeout
    timeout=$(getargs rd.net.timeout.ipv6auto=)
    timeout=${timeout:-40}
    timeout=$((timeout * 10))

    while [ $cnt -lt $timeout ]; do
        [ -z "$(ip -6 addr show dev "$@" tentative)" ] \
            && { ip -6 route list proto ra dev "$@" | grep -q ^default; } \
            && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

linkup() {
    wait_for_if_link "$@" 2> /dev/null && ip link set "$@" up 2> /dev/null && wait_for_if_up "$@" 2> /dev/null
}

type hostname > /dev/null 2>&1 \
    || hostname() {
        cat /proc/sys/kernel/hostname
    }

iface_has_carrier() {
    local cnt=0
    local iface="$1" flags=""
    local timeout
    local iface_sys_path
    [ -n "$iface" ] || return 2
    iface_sys_path="/sys/class/net/$iface"
    [ -d "$iface_sys_path" ] || return 2
    timeout=$(getargs rd.net.timeout.carrier=)
    timeout=${timeout:-10}
    timeout=$((timeout * 10))

    linkup "$1"

    li=$(ip link show up dev "$iface")
    strstr "$li" "NO-CARRIER" && _no_carrier_flag=1

    while [ $cnt -lt $timeout ]; do
        if [ -n "$_no_carrier_flag" ]; then
            li=$(ip link show up dev "$iface")
            # NO-CARRIER flag was cleared
            strstr "$li" "NO-CARRIER" || return 0
        elif ! [ -e "$iface_sys_path/carrier" ]; then
            # sysfs not available and "NO-CARRIER" not displayed
            return 0
        fi
        # double check the syscfs carrier flag
        [ -e "$iface_sys_path/carrier" ] && [ "$(cat "$iface_sys_path"/carrier)" = 1 ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

iface_has_link() {
    iface_has_carrier "$@"
}

iface_is_enslaved() {
    local _li
    _li=$(ip link show dev "$@")
    strstr "$_li" " master " || return 1
    return 0
}

find_iface_with_link() {
    local iface_path="" iface=""
    for iface_path in /sys/class/net/*; do
        iface=${iface_path##*/}
        str_starts "$iface" "lo" && continue
        if iface_has_link "$iface"; then
            echo "$iface"
            return 0
        fi
    done
    return 1
}

is_persistent_ethernet_name() {
    local _netif="$1"
    local _name_assign_type="0"

    [ -f "/sys/class/net/$_netif/name_assign_type" ] \
        && _name_assign_type=$(cat "/sys/class/net/$_netif/name_assign_type" 2> /dev/null)

    # NET_NAME_ENUM 1
    [ "$_name_assign_type" = "1" ] && return 1

    # NET_NAME_PREDICTABLE 2
    [ "$_name_assign_type" = "2" ] && return 0

    case "$_netif" in
        # udev persistent interface names
        eno[0-9] | eno[0-9][0-9] | eno[0-9][0-9][0-9]*) ;;

        ens[0-9] | ens[0-9][0-9] | ens[0-9][0-9][0-9]*) ;;

        enp[0-9]s[0-9]* | enp[0-9][0-9]s[0-9]* | enp[0-9][0-9][0-9]*s[0-9]*) ;;

        enP*p[0-9]s[0-9]* | enP*p[0-9][0-9]s[0-9]* | enP*p[0-9][0-9][0-9]*s[0-9]*) ;;

            # biosdevname
        em[0-9] | em[0-9][0-9] | em[0-9][0-9][0-9]*) ;;

        p[0-9]p[0-9]* | p[0-9][0-9]p[0-9]* | p[0-9][0-9][0-9]*p[0-9]*) ;;

        *)
            return 1
            ;;
    esac
    return 0
}

is_kernel_ethernet_name() {
    local _netif="$1"
    local _name_assign_type="1"

    if [ -e "/sys/class/net/$_netif/name_assign_type" ]; then
        _name_assign_type=$(cat "/sys/class/net/$_netif/name_assign_type")

        case "$_name_assign_type" in
            2 | 3 | 4)
                # NET_NAME_PREDICTABLE 2
                # NET_NAME_USER 3
                # NET_NAME_RENAMED 4
                return 1
                ;;
            1 | *)
                # NET_NAME_ENUM 1
                return 0
                ;;
        esac
    fi

    # fallback to error prone manual name check
    case "$_netif" in
        eth[0-9] | eth[0-9][0-9] | eth[0-9][0-9][0-9]*)
            return 0
            ;;
        *)
            return 1
            ;;
    esac

}

iface_get_subchannels() {
    local _netif
    local _subchannels

    _netif="$1"

    _subchannels=$({
        for i in /sys/class/net/"$_netif"/device/cdev[0-9]*; do
            [ -e "$i" ] || continue
            channel=$(readlink -f "$i")
            printf -- "%s" "${channel##*/},"
        done
    })
    [ -n "$_subchannels" ] || return 1

    printf -- "%s" "${_subchannels%,}"
}
  070701000000D1000081ED00000000000000000000000164DF2CB800000B14000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/40network/netroot.sh  #!/bin/sh

PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v getarg > /dev/null || . /lib/dracut-lib.sh
command -v setup_net > /dev/null || . /lib/net-lib.sh

# Huh? Empty $1?
[ -z "$1" ] && exit 1

# [ ! -z $2 ] means this is for manually bringing up network
# instead of real netroot; If It's called without $2, then there's
# no sense in doing something if no (net)root info is available
# or root is already there
[ -d "$NEWROOT"/proc ] && exit 0

if [ -z "$netroot" ]; then
    netroot=$(getarg netroot=)
fi

[ -z "$netroot" ] && exit 1

# Set or override primary interface
netif=$1
[ -e "/tmp/net.bootdev" ] && read -r netif < /tmp/net.bootdev

case "$netif" in
    ??:??:??:??:??:??) # MAC address
        for i in /sys/class/net/*/address; do
            mac=$(cat "$i")
            if [ "$mac" = "$netif" ]; then
                i=${i%/address}
                netif=${i##*/}
                break
            fi
        done ;;
esac

# Figure out the handler for root=dhcp by recalling all netroot cmdline
# handlers when this is not called from manually network bringing up.
if [ -z "$2" ]; then
    if getarg "root=dhcp" || getarg "netroot=dhcp" || getarg "root=dhcp6" || getarg "netroot=dhcp6"; then
        # Load dhcp options
        # shellcheck disable=SC1090
        [ -e /tmp/dhclient."$netif".dhcpopts ] && . /tmp/dhclient."$netif".dhcpopts

        # If we have a specific bootdev with no dhcpoptions or empty root-path,
        # we die. Otherwise we just warn
        if [ -z "$new_root_path" ]; then
            [ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
            warn "No dhcp root-path received for '$netif' trying other interfaces if available"
            exit 1
        fi

        rm -f -- "$hookdir"/initqueue/finished/dhcp.sh

        # Set netroot to new_root_path, so cmdline parsers don't call
        netroot=$new_root_path

        # FIXME!
        unset rootok
        for f in "$hookdir"/cmdline/90*.sh; do
            # shellcheck disable=SC1090
            [ -f "$f" ] && . "$f"
        done
    else
        rootok="1"
    fi

    # Check: do we really know how to handle (net)root?
    if [ -z "$root" ]; then
        root=$(getarg root=)
    fi
    [ -z "$root" ] && die "No or empty root= argument"
    [ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"

    handler=${netroot%%:*}
    handler=${handler%%4}
    handler=$(command -v "${handler}"root)
    if [ -z "$netroot" ] || [ ! -e "$handler" ]; then
        die "No handler for netroot type '$netroot'"
    fi
fi

# Source netroot hooks before we start the handler
source_hook netroot "$netif"

# Run the handler; don't store the root, it may change from device to device
# XXX other variables to export?
[ -n "$handler" ] && "$handler" "$netif" "$netroot" "$NEWROOT"
save_netinfo "$netif"

exit 0
070701000000D2000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003000000000dracut-055+suse.347.gdcb9bdbf/modules.d/45ifcfg   070701000000D3000081ED00000000000000000000000164DF2CB800000130000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/modules.d/45ifcfg/module-setup.sh   #!/bin/bash

# called by dracut
check() {
    [[ -d $dracutsysrootdir/etc/sysconfig/network-scripts ]] && return 0
    return 255
}

# called by dracut
depends() {
    echo "network"
    return 0
}

# called by dracut
install() {
    inst_binary awk
    inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
}
070701000000D4000081ED00000000000000000000000164DF2CB8000014E3000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/45ifcfg/write-ifcfg-suse.sh   #!/bin/sh

# NFS root might have reached here before /tmp/net.ifaces was written
udevadm settle --timeout=30

if [ -e /tmp/bridge.info ]; then
    . /tmp/bridge.info
fi

if [ -e /tmp/vlan.info ]; then
    . /tmp/vlan.info
fi

# shellcheck disable=SC2174
mkdir -m 0755 -p /tmp/ifcfg/
# shellcheck disable=SC2174
mkdir -m 0755 -p /tmp/ifcfg-leases/

get_vid() {
    case "$1" in
        vlan*)
            echo "${1#vlan}"
            ;;
        *.*)
            echo "${1##*.}"
            ;;
    esac
}

for netup in /tmp/net.*.did-setup; do
    [ -f "$netup" ] || continue

    netif=${netup%%.did-setup}
    netif=${netif##*/net.}
    strglobin "$netif" ":*:*:*:*:" && continue
    [ -e /tmp/ifcfg/ifcfg-"$netif" ] && continue
    unset bridge
    unset bond
    unset bondslaves
    unset bondname
    unset bondoptions
    unset ip
    unset gw
    unset mtu
    unset mask
    unset macaddr
    unset slave
    unset ethname

    # shellcheck disable=SC1090
    [ -e /tmp/bond."${netif}".info ] && . /tmp/bond."${netif}".info

    if [ "$netif" = "$bridgename" ]; then
        bridge=yes
    elif [ "$netif" = "$bondname" ]; then
        # $netif can't be bridge and bond at the same time
        bond=yes
    fi
    if [ "$netif" = "$vlanname" ]; then
        vlan=yes
    fi
    [ -e /sys/class/net/"$netif"/address ] \
        && cat /sys/class/net/"$netif"/address > /tmp/net."$netif".hwaddr
    {
        echo "# Generated by dracut initrd"
        echo "NAME='$netif'"
        if [ -f /tmp/net."$netif".has_ibft_config ]; then
            echo "STARTMODE='nfsroot'"
        else
            echo "STARTMODE='auto'"
        fi

        local bootproto="static"
        if [ -f /tmp/leaseinfo."${netif}".dhcp.ipv6 ]; then
            bootproto="dhcp6"
        fi
        if [ -f /tmp/leaseinfo."${netif}".dhcp.ipv4 ]; then
            if [ "$bootproto" = "dhcp6" ]; then
                bootproto="dhcp"
            else
                bootproto="dhcp4"
            fi
        fi

        echo "BOOTPROTO='$bootproto'"

        if [ "$bootproto" = "static" ]; then
            # If we've booted with static ip= lines, the override file is there
            # shellcheck disable=SC1090
            [ -e /tmp/net."$netif".override ] && . /tmp/net."$netif".override
            echo "IPADDR='$ip'"
            if [ -n "$mask" ]; then
                if strstr "$mask" "."; then
                    echo "NETMASK='$mask'"
                else
                    echo "PREFIXLEN='$mask'"
                fi
            fi
            if [ -n "$gw" ]; then
                echo "GATEWAY='$gw'"
            fi
        fi
        [ -n "$mtu" ] && echo "MTU='$mtu'"
    } > /tmp/ifcfg/ifcfg-"$netif"

    # bridge needs different things written to ifcfg
    if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
        # standard interface
        {
            if [ -n "$macaddr" ]; then
                echo "LLADDR='$macaddr'"
            else
                echo "LLADDR='$(cat /sys/class/net/"$netif"/address)'"
            fi
            echo "INTERFACETYPE='Ethernet'"
        } >> /tmp/ifcfg/ifcfg-"$netif"
    fi

    if [ -n "$vlan" ]; then
        {
            echo "INTERFACETYPE='Vlan'"
            echo "VLAN_ID='$(get_vid "$vlanname")'"
            echo "ETHERDEVICE='$phydevice'"
        } >> /tmp/ifcfg/ifcfg-"$netif"
    fi

    if [ -n "$bond" ]; then
        # bond interface
        {
            # This variable is an indicator of a bond interface for initscripts
            echo "BONDING_MASTER='yes'"
            echo "BONDING_MODULE_OPTS='$bondoptions'"
            echo "INTERFACETYPE='Bond'"
        } >> /tmp/ifcfg/ifcfg-"$netif"

        local i=0
        for slave in $bondslaves; do
            echo "BONDING_SLAVE_$i='$slave'" >> /tmp/ifcfg/ifcfg-"$netif"
            i=$((i + 1))
            # write separate ifcfg file for the raw eth interface
            {
                echo "# Generated by dracut initrd"
                echo "NAME='$slave'"
                echo "INTERFACETYPE='Ethernet'"
                echo "STARTMODE='hotplug'"
                echo "BOOTPROTO='none'"
                echo "# ETHTOOL=''"
            } >> /tmp/ifcfg/ifcfg-"$slave"
        done
    fi

    if [ -n "$bridge" ]; then
        # bridge
        {
            echo "INTERFACETYPE='Bridge'"
            echo "BRIDGE='yes'"
            echo "BRIDGE_STP='off'"
            echo "BRIDGE_FORWARDDELAY='0'"
            echo -n "BRIDGE_PORTS='"
        } >> /tmp/ifcfg/ifcfg-"$netif"

        if [ "$ethname" = "$bondname" ]; then
            {
                for slave in $bondslaves; do
                    echo -n "$bondname "
                done
                echo "'"
            } >> /tmp/ifcfg/ifcfg-"$netif"
        else
            echo "$ethname'" >> /tmp/ifcfg/ifcfg-"$netif"
        fi
    fi
done

# Pass network opts
mkdir -m 0755 -p /run/initramfs/state/etc/sysconfig/network
mkdir -m 0755 -p /run/initramfs/state/var/run/wicked
echo "files /etc/sysconfig/network" >> /run/initramfs/rwtab
echo "files /var/run/wicked" >> /run/initramfs/rwtab
{
    cp /tmp/net.* /run/initramfs/
    cp /tmp/net."$netif".resolv.conf /run/initramfs/state/etc/resolv.conf
    copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network
    cp /tmp/leaseinfo.* /run/initramfs/state/var/run/wicked/
} > /dev/null 2>&1
 070701000000D5000081ED00000000000000000000000164DF2CB800002427000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/45ifcfg/write-ifcfg.sh    #!/bin/sh

# NFS root might have reached here before /tmp/net.ifaces was written
type is_persistent_ethernet_name > /dev/null 2>&1 || . /lib/net-lib.sh

udevadm settle --timeout=30

# shellcheck disable=SC2174
mkdir -m 0755 -p /tmp/ifcfg/
# shellcheck disable=SC2174
mkdir -m 0755 -p /tmp/ifcfg-leases/

get_config_line_by_subchannel() {
    local CHANNELS
    local line

    CHANNELS="$1"
    while read -r line || [ -n "$line" ]; do
        if strstr "$line" "$CHANNELS"; then
            echo "$line"
            return 0
        fi
    done < /etc/ccw.conf
    return 1
}

print_s390() {
    local _netif
    local SUBCHANNELS
    local OPTIONS
    local NETTYPE
    local CONFIG_LINE
    local i
    local channel
    local OLD_IFS

    _netif="$1"
    # if we find ccw channel, then use those, instead of
    # of the MAC
    SUBCHANNELS=$({
        for i in /sys/class/net/"$_netif"/device/cdev[0-9]*; do
            [ -e "$i" ] || continue
            channel=$(readlink -f "$i")
            printf '%s' "${channel##*/},"
        done
    })
    [ -n "$SUBCHANNELS" ] || return 1

    SUBCHANNELS=${SUBCHANNELS%,}
    echo "SUBCHANNELS=\"${SUBCHANNELS}\""

    CONFIG_LINE=$(get_config_line_by_subchannel "$SUBCHANNELS")
    # shellcheck disable=SC2181
    [ $? -ne 0 -o -z "$CONFIG_LINE" ] && return 0

    OLD_IFS=$IFS
    IFS=","
    # shellcheck disable=SC2086
    set -- $CONFIG_LINE
    IFS=$OLD_IFS
    NETTYPE=$1
    shift
    SUBCHANNELS="$1"
    OPTIONS=""
    shift
    while [ $# -gt 0 ]; do
        case $1 in
            *=*) OPTIONS="$OPTIONS $1" ;;
        esac
        shift
    done
    OPTIONS=${OPTIONS## }
    echo "NETTYPE=\"${NETTYPE}\""
    echo "OPTIONS=\"${OPTIONS}\""
    return 0
}

hw_bind() {
    local _netif="$1"
    local _macaddr="$2"

    [ -n "$_macaddr" ] \
        && echo "MACADDR=\"$_macaddr\""

    print_s390 "$_netif" \
        && return 0

    [ -n "$_macaddr" ] && return 0

    is_persistent_ethernet_name "$_netif" && return 0

    [ -f "/sys/class/net/$_netif/addr_assign_type" ] \
        && [ "$(cat "/sys/class/net/$_netif/addr_assign_type")" != "0" ] \
        && return 1

    [ -f "/sys/class/net/$_netif/address" ] \
        || return 1

    echo "HWADDR=\"$(cat /sys/class/net/"$_netif"/address)\""
}

interface_bind() {
    local _netif="$1"
    local _macaddr="$2"

    # see, if we can bind it to some hw parms
    if hw_bind "$_netif" "$_macaddr"; then
        # only print out DEVICE, if it's user assigned
        is_kernel_ethernet_name "$_netif" && return 0
    fi

    echo "DEVICE=\"$_netif\""
}

for netup in /tmp/net.*.did-setup; do
    [ -f "$netup" ] || continue

    netif=${netup%%.did-setup}
    netif=${netif##*/net.}
    strglobin "$netif" ":*:*:*:*:" && continue
    [ -e /tmp/ifcfg/ifcfg-"$netif" ] && continue
    unset bridge
    unset bond
    unset bondslaves
    unset bondname
    unset bondoptions
    unset bridgename
    unset bridgeslaves
    unset team
    unset uuid
    unset ip
    unset gw
    unset mtu
    unset mask
    unset macaddr
    unset slave
    unset ethname
    unset vlan
    unset vlanname
    unset phydevice

    # shellcheck disable=SC1090
    [ -e /tmp/bond."${netif}".info ] && . /tmp/bond."${netif}".info
    # shellcheck disable=SC1090
    [ -e /tmp/bridge."${netif}".info ] && . /tmp/bridge."${netif}".info
    # shellcheck disable=SC1090
    [ -e /tmp/team."${netif}".info ] && . /tmp/team."${netif}".info

    uuid=$(cat /proc/sys/kernel/random/uuid)
    if [ "$netif" = "$bridgename" ]; then
        bridge=yes
    elif [ "$netif" = "$teammaster" ]; then
        team=yes
    elif [ "$netif" = "$bondname" ]; then
        # $netif can't be bridge and bond at the same time
        bond=yes
    fi

    for i in "/tmp/vlan.${netif}."*; do
        [ ! -e "$i" ] && continue
        # shellcheck disable=SC1090
        . "$i"
        vlan=yes
        break
    done

    # skip team interfaces for now, the host config must be in sync
    [ "$netif" = "$teammaster" ] && continue

    {
        echo "# Generated by dracut initrd"
        echo "NAME=\"$netif\""
        [ -z "$vlan" ] && interface_bind "$netif" "$macaddr"
        echo "ONBOOT=yes"
        echo "NETBOOT=yes"
        echo "UUID=\"$uuid\""
        strstr "$(ip -6 addr show dev "$netif")" 'inet6' && echo "IPV6INIT=yes"
        if [ -f /tmp/dhclient."$netif".lease ]; then
            # shellcheck disable=SC1090
            [ -f /tmp/dhclient."$netif".dhcpopts ] && . /tmp/dhclient."$netif".dhcpopts
            if [ -f /tmp/net."$netif".has_ibft_config ]; then
                echo "BOOTPROTO=ibft"
            else
                echo "BOOTPROTO=dhcp"
            fi
            cp /tmp/dhclient."$netif".lease /tmp/ifcfg-leases/dhclient-"$uuid"-"$netif".lease
        else
            # If we've booted with static ip= lines, the override file is there
            # shellcheck disable=SC1090
            [ -e /tmp/net."$netif".override ] && . /tmp/net."$netif".override
            if strglobin "$ip" '*:*:*'; then
                echo "IPV6INIT=yes"
                echo "IPV6_AUTOCONF=no"
                echo "IPV6ADDR=\"$ip/$mask\""
            else
                if [ -f /tmp/net."$netif".has_ibft_config ]; then
                    echo "BOOTPROTO=ibft"
                else
                    echo "BOOTPROTO=none"
                    echo "IPADDR=\"$ip\""
                    if strstr "$mask" "."; then
                        echo "NETMASK=\"$mask\""
                    else
                        echo "PREFIX=\"$mask\""
                    fi
                fi
            fi
            if strglobin "$gw" '*:*:*'; then
                echo "IPV6_DEFAULTGW=\"$gw\""
            elif [ -n "$gw" ]; then
                echo "GATEWAY=\"$gw\""
            fi
        fi
        [ -n "$mtu" ] && echo "MTU=\"$mtu\""
    } > /tmp/ifcfg/ifcfg-"$netif"

    # bridge needs different things written to ifcfg
    if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ] && [ -z "$team" ]; then
        # standard interface
        echo "TYPE=Ethernet" >> /tmp/ifcfg/ifcfg-"$netif"
    fi

    if [ -n "$vlan" ]; then
        {
            echo "TYPE=Vlan"
            echo "DEVICE=\"$netif\""
            echo "VLAN=yes"
            echo "PHYSDEV=\"$phydevice\""
        } >> /tmp/ifcfg/ifcfg-"$netif"
    fi

    if [ -n "$bond" ]; then
        # bond interface
        {
            # This variable is an indicator of a bond interface for initscripts
            echo "BONDING_OPTS=\"$bondoptions\""
            echo "NAME=\"$netif\""
            echo "TYPE=Bond"
        } >> /tmp/ifcfg/ifcfg-"$netif"

        for slave in $bondslaves; do
            # write separate ifcfg file for the raw eth interface
            (
                echo "# Generated by dracut initrd"
                echo "NAME=\"$slave\""
                echo "TYPE=Ethernet"
                echo "ONBOOT=yes"
                echo "NETBOOT=yes"
                echo "SLAVE=yes"
                echo "MASTER=\"$netif\""
                echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
                unset macaddr
                # shellcheck disable=SC1090
                [ -e /tmp/net."$slave".override ] && . /tmp/net."$slave".override
                interface_bind "$slave" "$macaddr"
            ) >> /tmp/ifcfg/ifcfg-"$slave"
        done
    fi

    if [ -n "$bridge" ]; then
        # bridge
        {
            echo "TYPE=Bridge"
            echo "NAME=\"$netif\""
        } >> /tmp/ifcfg/ifcfg-"$netif"
        for slave in $bridgeslaves; do
            # write separate ifcfg file for the raw eth interface
            (
                echo "# Generated by dracut initrd"
                echo "NAME=\"$slave\""
                echo "TYPE=Ethernet"
                echo "ONBOOT=yes"
                echo "NETBOOT=yes"
                echo "BRIDGE=\"$bridgename\""
                echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
                unset macaddr
                # shellcheck disable=SC1090
                [ -e /tmp/net."$slave".override ] && . /tmp/net."$slave".override
                interface_bind "$slave" "$macaddr"
            ) >> /tmp/ifcfg/ifcfg-"$slave"
        done
    fi
    i=1
    for ns in $(getargs nameserver) $dns1 $dns2; do
        echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-"$netif"
        i=$((i + 1))
    done

    [ -f /tmp/net.route6."$netif" ] && cp /tmp/net.route6."$netif" /tmp/ifcfg/route6-"$netif"
    [ -f /tmp/net.route."$netif" ] && cp /tmp/net.route."$netif" /tmp/ifcfg/route-"$netif"
done

# Pass network opts
mkdir -m 0755 -p /run/initramfs/state/etc/sysconfig/network-scripts
mkdir -m 0755 -p /run/initramfs/state/var/lib/dhclient
echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab
echo "files /var/lib/dhclient" >> /run/initramfs/rwtab
{
    cp /tmp/net.* /run/initramfs/
    for i in /tmp/net.*.resolv.conf; do
        [ -f "$i" ] && cat "$i"
    done | awk '!($0 in a) { a[$0]; print }' > /run/initramfs/state/etc/resolv.conf
    [ -s /run/initramfs/state/etc/resolv.conf ] || rm -f /run/initramfs/state/etc/resolv.conf
    copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network-scripts
    cp /tmp/ifcfg-leases/* /run/initramfs/state/var/lib/dhclient
} > /dev/null 2>&1
 070701000000D6000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/modules.d/45url-lib 070701000000D7000081ED00000000000000000000000164DF2CB800000EBE000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/modules.d/45url-lib/module-setup.sh #!/bin/bash
# module-setup for url-lib

# called by dracut
check() {
    require_binaries curl || return 1
    return 255
}

# called by dracut
depends() {
    echo network
    return 0
}

# called by dracut
install() {
    local _dir _crt _crts _found _lib _nssckbi _p11roots _p11root
    inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
    inst_multiple -o ctorrent
    inst_multiple curl sed
    if curl --version | grep -qi '\bNSS\b'; then
        # also install libs for curl https
        inst_libdir_file "libnsspem.so*"
        inst_libdir_file "libnsssysinit.so*"
        inst_libdir_file "libsoftokn3.so*"
        inst_libdir_file "libsqlite3.so*"
    fi

    for _dir in $libdirs; do
        [[ -d $dracutsysrootdir$_dir ]] || continue
        for _lib in "$dracutsysrootdir$_dir"/libcurl.so.* "$dracutsysrootdir$_dir"/libcrypto.so.*; do
            [[ -e $_lib ]] || continue
            if ! [[ $_nssckbi ]]; then
                read -r -d '' _nssckbi < <(grep -F --binary-files=text -z libnssckbi "$_lib")
            fi
            read -r -d '' _crt < <(grep -E --binary-files=text -z "\.(pem|crt)" "$_lib" | sed 's/\x0//g')
            [[ $_crt ]] || continue
            [[ $_crt == /*/* ]] || continue
            if [[ -e $_crt ]]; then
                _crts="$_crts $_crt"
                _found=1
            fi
        done
    done
    if [[ $_found ]] && [[ -n $_crts ]]; then
        for _crt in $_crts; do
            if ! inst "${_crt#$dracutsysrootdir}"; then
                dwarn "Couldn't install '$_crt' SSL CA cert bundle; HTTPS might not work."
                continue
            fi
        done
    fi
    # If we found no cert bundle files referenced in libcurl but we
    # *did* find a mention of libnssckbi (checked above), install it.
    # If its truly NSS libnssckbi, it includes its own trust bundle,
    # but if it's really p11-kit-trust.so, we need to find the dirs
    # where it will look for a trust bundle and install them too.
    if ! [[ $_found ]] && [[ $_nssckbi ]]; then
        _found=1
        inst_libdir_file "libnssckbi.so*" || _found=
        for _dir in $libdirs; do
            [[ -e $dracutsysrootdir$_dir/libnssckbi.so ]] || continue
            # this looks for directory-ish strings in the file
            grep -z -o --binary-files=text '/[[:alpha:]][[:print:]]*' "${dracutsysrootdir}${_dir}"/libnssckbi.so \
                | while read -r -d '' _p11roots || [[ $_p11roots ]]; do
                    IFS=":" read -r -a _p11roots <<< "$_p11roots"
                    # the string can be a :-separated list of dirs
                    for _p11root in "${_p11roots[@]}"; do
                        # check if it's actually a directory (there are
                        # several false positives in the results)
                        [[ -d "$dracutsysrootdir$_p11root" ]] || continue
                        # check if it has some specific subdirs that all
                        # p11-kit trust dirs have
                        [[ -d "$dracutsysrootdir${_p11root}/anchors" ]] || continue
                        [[ -d "$dracutsysrootdir${_p11root}/blacklist" ]] || continue
                        # so now we know it's really a p11-kit trust dir;
                        # install everything in it
                        mkdir -p -- "${initdir}/${_p11root}"
                        if ! $DRACUT_CP -L -t "${initdir}/${_p11root}" "${dracutsysrootdir}${_p11root}"/*; then
                            dwarn "Couldn't install from p11-kit trust dir '${_p11root#$dracutsysrootdir}'; HTTPS might not work."
                        fi
                    done
                done
        done
    fi
    [[ $_found ]] || dwarn "Couldn't find SSL CA cert bundle or libnssckbi.so; HTTPS won't work."
}
  070701000000D8000081ED00000000000000000000000164DF2CB8000014F5000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/45url-lib/url-lib.sh  #!/bin/sh
# url-lib.sh - functions for handling URLs (file fetching etc.)
#
# Authors:
#   Will Woods <wwoods@redhat.com>

type mkuniqdir > /dev/null 2>&1 || . /lib/dracut-lib.sh

# fetch_url URL [OUTFILE]
#   fetch the given URL to a locally-visible location.
#   if OUTFILE is given, the URL will be fetched to that filename,
#   overwriting it if present.
#   If the URL is something mountable (e.g. nfs://) and no OUTFILE is given,
#   the server will be left mounted until pre-pivot.
#   the return values are as follows:
#   0: success
#   253: unknown error (file missing)
#   254: unhandled URL scheme / protocol
#   255: bad arguments / unparseable URLs
#   other: fetch command failure (whatever curl/mount/etc return)
fetch_url() {
    local url="$1" outloc="$2"
    local handler
    handler="$(get_url_handler "$url")"
    [ -n "$handler" ] || return 254
    [ -n "$url" ] || return 255
    "$handler" "$url" "$outloc"
}

# get_url_handler URL
#   returns the first HANDLERNAME corresponding to the URL's scheme
get_url_handler() {
    local scheme="${1%%:*}" item=""
    for item in $url_handler_map; do
        [ "$scheme" = "${item%%:*}" ] && echo "${item#*:}" && return 0
    done
    return 1
}

# add_url_handler HANDLERNAME SCHEME [SCHEME...]
#   associate the named handler with the named scheme(s).
add_url_handler() {
    local handler="$1"
    shift
    local schemes="$*" scheme=""
    set --
    for scheme in $schemes; do
        [ "$(get_url_handler "$scheme")" = "$handler" ] && continue
        set -- "$@" "$scheme:$handler"
    done
    set -- "$@" "$url_handler_map" # add new items to *front* of list
    url_handler_map="$*"
}

### HTTP, HTTPS, FTP #################################################

export CURL_HOME="/run/initramfs/url-lib"
mkdir -p $CURL_HOME
curl_args="--globoff --location --retry 3 --fail --show-error"
getargbool 0 rd.noverifyssl && curl_args="$curl_args --insecure"

proxy=$(getarg proxy=)
[ -n "$proxy" ] && curl_args="$curl_args --proxy $proxy"

curl_fetch_url() {
    local url="$1" outloc="$2"
    echo "$url" > /proc/self/fd/0
    if [ -n "$outloc" ]; then
        # shellcheck disable=SC2086
        curl $curl_args --output - -- "$url" > "$outloc" || return $?
    else
        local outdir
        outdir="$(mkuniqdir /tmp curl_fetch_url)"
        (
            cd "$outdir" || exit
            # shellcheck disable=SC2086
            curl $curl_args --remote-name "$url" || return $?
        )
        outloc="$outdir/$(ls -A "$outdir")"
    fi
    if ! [ -f "$outloc" ]; then
        warn "Downloading '$url' failed!"
        return 253
    fi
    if [ -z "$2" ]; then echo "$outloc"; fi
}
add_url_handler curl_fetch_url http https ftp tftp

set_http_header() {
    echo "header = \"$1: $2\"" >> $CURL_HOME/.curlrc
}

### TORRENT ##########################################################

ctorrent_args="-E 0 -e 0"

ctorrent_fetch_url() {
    local url="$1" outloc="$2"
    url=${url#*//}
    torrent_outloc="$outloc.torrent"
    echo "$url" > /proc/self/fd/0
    if [ -n "$outloc" ]; then
        # shellcheck disable=SC2086
        curl $curl_args --output - -- "$url" > "$torrent_outloc" || return $?
    else
        local outdir
        outdir="$(mkuniqdir /tmp torrent_fetch_url)"
        (
            cd "$outdir" || exit
            # shellcheck disable=SC2086
            curl $curl_args --remote-name "$url" || return $?
        )
        torrent_outloc="$outdir/$(ls -A "$outdir")"
        outloc=${torrent_outloc%.*}
    fi
    if ! [ -f "$torrent_outloc" ]; then
        warn "Downloading '$url' failed!"
        return 253
    fi
    # shellcheck disable=SC2086
    ctorrent $ctorrent_args -s "$outloc" "$torrent_outloc" >&2
    if ! [ -f "$outloc" ]; then
        warn "Torrent download of '$url' failed!"
        return 253
    fi
    if [ -z "$2" ]; then echo "$outloc"; fi
}

command -v ctorrent > /dev/null \
    && add_url_handler ctorrent_fetch_url torrent

### NFS ##############################################################

[ -e /lib/nfs-lib.sh ] && . /lib/nfs-lib.sh

nfs_already_mounted() {
    local server="$1" path="$2" s="" p=""
    while read -r src mnt rest || [ -n "$src" ]; do
        splitsep ":" "$src" s p
        if [ "$server" = "$s" ]; then
            if [ "$path" = "$p" ]; then
                echo "$mnt"
            elif str_starts "$path" "$p"; then
                echo "$mnt"/"${path#$p/}"
            fi
        fi
    done < /proc/mounts
}

nfs_fetch_url() {
    local url="$1" outloc="$2" nfs="" server="" path="" options=""
    nfs_to_var "$url" || return 255
    local filepath="${path%/*}" filename="${path##*/}" mntdir=""

    # skip mount if server:/filepath is already mounted
    mntdir=$(nfs_already_mounted "$server" "$path")
    if [ -z "$mntdir" ]; then
        local mntdir
        mntdir="$(mkuniqdir /run nfs_mnt)"
        mount_nfs "$nfs:$server:$filepath${options:+:$options}" "$mntdir"
        # lazy unmount during pre-pivot hook
        inst_hook --hook pre-pivot --name 99url-lib-umount-nfs umount -l -- "$mntdir"
    fi

    if [ -z "$outloc" ]; then
        outloc="$mntdir/$filename"
    else
        cp -f -- "$mntdir/$filename" "$outloc" || return $?
    fi
    [ -f "$outloc" ] || return 253
    if [ -z "$2" ]; then echo "$outloc"; fi
}
command -v nfs_to_var > /dev/null && add_url_handler nfs_fetch_url nfs nfs4
   070701000000D9000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/50drm 070701000000DA000081ED00000000000000000000000164DF2CB800000896000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/50drm/module-setup.sh #!/bin/bash

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
installkernel() {
    # Include KMS capable drm drivers

    if [[ ${DRACUT_ARCH:-$(uname -m)} == arm* || ${DRACUT_ARCH:-$(uname -m)} == aarch64 ]]; then
        # arm/aarch64 specific modules needed by drm
        instmods \
            "=drivers/gpu/drm/i2c" \
            "=drivers/gpu/drm/panel" \
            "=drivers/gpu/drm/bridge" \
            "=drivers/video/backlight"
    fi

    instmods amdkfd hyperv_fb "=drivers/pwm"

    # if the hardware is present, include module even if it is not currently loaded,
    # as we could e.g. be in the installer; nokmsboot boot parameter will disable
    # loading of the driver if needed
    if [[ $hostonly ]]; then
        local i modlink modname

        for i in /sys/bus/{pci/devices,platform/devices,virtio/devices,soc/devices/soc?}/*/modalias; do
            [[ -e $i ]] || continue
            [[ -n $(< "$i") ]] || continue
            # shellcheck disable=SC2046
            if hostonly="" dracut_instmods --silent -s "drm_crtc_init|drm_dev_register|drm_encoder_init" -S "iw_handler_get_spy" $(< "$i"); then
                if strstr "$(modinfo -F filename $(< "$i") 2> /dev/null)" radeon.ko; then
                    hostonly='' instmods amdkfd
                fi
            fi
        done
        # if there is a privacy screen then its driver must be loaded before the
        # kms driver will bind, otherwise its probe() will return -EPROBE_DEFER
        # note privacy screens always register, even with e.g. nokmsboot
        for i in /sys/class/drm/privacy_screen-*/device/driver/module; do
            [[ -L $i ]] || continue
            modlink=$(readlink "$i")
            modname=$(basename "$modlink")
            instmods "$modname"
        done
    else
        dracut_instmods -o -s "drm_crtc_init|drm_dev_register|drm_encoder_init" "=drivers/gpu/drm" "=drivers/staging"
        # also include privacy screen providers (see above comment)
        # atm all providers live under drivers/platform/x86
        dracut_instmods -o -s "drm_privacy_screen_register" "=drivers/platform/x86"
    fi
}
  070701000000DB000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/modules.d/50gensplash   070701000000DC000081A400000000000000000000000164DF2CB80000050A000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/50gensplash/README    dracut gensplash module
-----------------------

INDEX

0. Introduction
1. Hostonly vs Generic
2. Configuration and kernel parameters

~

0. Introduction

gensplash is based on Genkernel code and that's why it's Gentoo-specific.  It
requires splashutils to work.  To set up theme you may edit /etc/conf.d/splash
or set DRACUT_GENSPLASH_THEME and DRACUT_GENSPLASH_RES variables.  Your theme
has to exist in /etc/splash and for every given resolution has to exist config
in theme's directory, e.g. there's 1024x768.cfg in /etc/splash/natural_gentoo.
List of resolutions is comma-separated.

NOTE: The module will be rewritten to be distro-neutral. Its name will change
to fbsplash.


1. Hostonly vs Generic

All available themes are installed only if no --hostonly is specified and no
DRACUT_GENSPLASH_THEME and DRACUT_GENSPLASH_RES are set.  Otherwise those vars
are checked and if not set then config /etc/conf.d/splash is read.


2. Configuration and kernel parameters

Example set up by environment variables:
    DRACUT_GENSPLASH_THEME=natural_gentoo
    DRACUT_GENSPLASH_RES=1024x768,1024x600

Example kernel arguments:
    splash=silent,theme:natural_gentoo console=tty1 quiet

You may easily set up the module using Genkernel with arguments:
    --gensplash=<theme>:<res1>,<res2>,...
  070701000000DD000081ED00000000000000000000000164DF2CB800000057000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/50gensplash/gensplash-emergency.sh    #!/bin/sh

# shellcheck disable=SC2034
CDROOT=0
. /lib/gensplash-lib.sh
splash verbose
 070701000000DE000081ED00000000000000000000000164DF2CB80000006F000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/50gensplash/gensplash-newroot.sh  #!/bin/sh

# shellcheck disable=SC2034
CDROOT=0
. /lib/gensplash-lib.sh
splash set_msg 'Switching to new root'
 070701000000DF000081ED00000000000000000000000164DF2CB800000149000000000000000000000000000000000000004C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/50gensplash/gensplash-pretrigger.sh   #!/bin/sh

if getargbool 1 rd.splash -d -n rd_NO_SPLASH; then
    info "Starting Gentoo Splash"

    [ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
    # shellcheck disable=SC2034
    CDROOT=0
    . /lib/gensplash-lib.sh
    splash init
    [ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
fi
   070701000000E0000081ED00000000000000000000000164DF2CB8000008E2000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/50gensplash/module-setup.sh   #!/bin/bash

# called by dracut
check() {
    # TODO: splash_geninitramfs
    # TODO: /usr/share/splashutils/initrd.splash
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    local _opts
    local _splash_theme
    local _splash_res

    call_splash_geninitramfs() {
        local _out _ret

        _out=$(splash_geninitramfs -c "$1" "${@:2}" 2>&1)
        _ret=$?

        if [[ ${_out} ]]; then
            local IFS='
'
            for line in ${_out}; do
                if [[ ${line} =~ ^Warning ]]; then
                    dwarn "${line}"
                else
                    derror "${line}"
                    ((_ret == 0)) && _ret=1
                fi
            done
        fi

        return ${_ret}
    }

    find_binary splash_geninitramfs > /dev/null || return 1

    _opts=''
    if [[ ${DRACUT_GENSPLASH_THEME} ]]; then
        # Variables from the environment
        # They're supposed to be set up by e.g. Genkernel in basis of cmdline args.
        # If user set them he/she would expect to be included only given theme
        # rather then all even if we're building generic initramfs.
        _splash_theme=${DRACUT_GENSPLASH_THEME}
        _splash_res=${DRACUT_GENSPLASH_RES}
    elif [[ ${hostonly} ]]; then
        # Settings from config only in hostonly
        # shellcheck disable=SC1090
        [[ -e $dracutsysrootdir/etc/conf.d/splash ]] && source "$dracutsysrootdir"/etc/conf.d/splash
        [[ ! ${_splash_theme} ]] && _splash_theme=default
        [[ ${_splash_res} ]] && _opts+=" -r ${_splash_res}"
    else
        # generic
        _splash_theme=--all
    fi

    dinfo "Installing Gentoo Splash (using the ${_splash_theme} theme)"

    pushd "${initdir}" > /dev/null || exit
    mv dev dev.old
    call_splash_geninitramfs "${initdir}" "${_opts}" ${_splash_theme} || {
        derror "Could not build splash"
        return 1
    }
    rm -rf dev
    mv dev.old dev
    popd > /dev/null || exit

    inst_multiple chvt
    inst /usr/share/splashutils/initrd.splash /lib/gensplash-lib.sh
    inst_hook pre-pivot 90 "${moddir}"/gensplash-newroot.sh
    inst_hook pre-trigger 10 "${moddir}"/gensplash-pretrigger.sh
    inst_hook emergency 50 "${moddir}"/gensplash-emergency.sh
}
  070701000000E1000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003300000000dracut-055+suse.347.gdcb9bdbf/modules.d/50plymouth    070701000000E2000081ED00000000000000000000000164DF2CB800000596000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/50plymouth/module-setup.sh    #!/bin/bash

pkglib_dir() {
    local _dirs="/usr/lib/plymouth /usr/libexec/plymouth/"
    if find_binary dpkg-architecture &> /dev/null; then
        _dirs+=" /usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth"
    fi
    for _dir in $_dirs; do
        if [ -x "$dracutsysrootdir""$_dir"/plymouth-populate-initrd ]; then
            echo "$_dir"
            return
        fi
    done
}

# called by dracut
check() {
    [[ "$mount_needs" ]] && return 1
    [[ $(pkglib_dir) ]] || return 1

    require_binaries plymouthd plymouth plymouth-set-default-theme
}

# called by dracut
depends() {
    echo drm
}

# called by dracut
install() {
    PKGLIBDIR=$(pkglib_dir)
    if grep -q nash "$dracutsysrootdir""${PKGLIBDIR}"/plymouth-populate-initrd \
        || [ ! -x "$dracutsysrootdir""${PKGLIBDIR}"/plymouth-populate-initrd ]; then
        # shellcheck disable=SC1090
        . "$moddir"/plymouth-populate-initrd.sh
    else
        PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
            "$dracutsysrootdir""${PKGLIBDIR}"/plymouth-populate-initrd -t "$initdir"
    fi

    inst_hook emergency 50 "$moddir"/plymouth-emergency.sh

    inst_multiple readlink

    inst_multiple plymouthd plymouth plymouth-set-default-theme

    if ! dracut_module_included "systemd"; then
        inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
        inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
    fi
}
  070701000000E3000081ED00000000000000000000000164DF2CB800000034000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/50plymouth/plymouth-emergency.sh  #!/bin/sh

plymouth --hide-splash 2> /dev/null || :
070701000000E4000081ED00000000000000000000000164DF2CB800000074000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/50plymouth/plymouth-newroot.sh    #!/bin/sh

if type plymouth > /dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then
    plymouth --newroot="$NEWROOT"
fi
070701000000E5000081ED00000000000000000000000164DF2CB800000679000000000000000000000000000000000000004F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/50plymouth/plymouth-populate-initrd.sh    #!/bin/bash

PLYMOUTH_LOGO_FILE="/usr/share/pixmaps/system-logo-white.png"
PLYMOUTH_THEME=$(plymouth-set-default-theme)

inst_multiple plymouthd plymouth \
    /etc/system-release

test -e "${PLYMOUTH_LOGO_FILE}" && inst_simple "${PLYMOUTH_LOGO_FILE}"

# shellcheck disable=SC2174
mkdir -m 0755 -p "${initdir}/usr/share/plymouth"

inst_libdir_file "plymouth/text.so" "plymouth/details.so"

if [[ $hostonly ]]; then
    inst_multiple \
        "/usr/share/plymouth/themes/details/details.plymouth" \
        "/usr/share/plymouth/themes/text/text.plymouth"

    if [[ -d $dracutsysrootdir/usr/share/plymouth/themes/${PLYMOUTH_THEME} ]]; then
        for x in "/usr/share/plymouth/themes/${PLYMOUTH_THEME}"/*; do
            [[ -f "$dracutsysrootdir$x" ]] || break
            inst "$x"
        done
    fi

    if [[ -L $dracutsysrootdir/usr/share/plymouth/themes/default.plymouth ]]; then
        inst /usr/share/plymouth/themes/default.plymouth
        # Install plugin for this theme
        PLYMOUTH_PLUGIN=$(grep "^ModuleName=" "$dracutsysrootdir"/usr/share/plymouth/themes/default.plymouth | while read -r _ b _ || [ -n "$b" ]; do echo "$b"; done)
        inst_libdir_file "plymouth/${PLYMOUTH_PLUGIN}.so"
    fi
else
    for x in "$dracutsysrootdir"/usr/share/plymouth/themes/{text,details}/*; do
        [[ -f $x ]] || continue
        THEME_DIR=$(dirname "${x#$dracutsysrootdir}")
        # shellcheck disable=SC2174
        mkdir -m 0755 -p "${initdir}/$THEME_DIR"
        inst_multiple "${x#$dracutsysrootdir}"
    done
    (
        cd "${initdir}"/usr/share/plymouth/themes || exit
        ln -s text/text.plymouth default.plymouth 2>&1
    )
fi
   070701000000E6000081ED00000000000000000000000164DF2CB80000049F000000000000000000000000000000000000004A00000000dracut-055+suse.347.gdcb9bdbf/modules.d/50plymouth/plymouth-pretrigger.sh #!/bin/sh

if type plymouthd > /dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then
    if getargbool 1 plymouth.enable && getargbool 1 rd.plymouth -d -n rd_NO_PLYMOUTH; then
        # first trigger graphics subsystem
        udevadm trigger --action=add --attr-match=class=0x030000 > /dev/null 2>&1
        # first trigger graphics and tty subsystem
        udevadm trigger --action=add \
            --subsystem-match=graphics \
            --subsystem-match=drm \
            --subsystem-match=tty \
            --subsystem-match=acpi \
            > /dev/null 2>&1

        udevadm settle --timeout=180 2>&1 | vinfo

        info "Starting plymouth daemon"
        mkdir -m 0755 /run/plymouth
        read -r consoledev rest < /sys/class/tty/console/active
        consoledev=${consoledev:-tty0}
        [ -x /lib/udev/console_init -a -e "/dev/$consoledev" ] && /lib/udev/console_init "/dev/$consoledev"
        plymouthd --attach-to-session --pid-file /run/plymouth/pid
        plymouth --show-splash 2>&1 | vinfo
        # reset tty after plymouth messed with it
        [ -x /lib/udev/console_init -a -e "/dev/$consoledev" ] && /lib/udev/console_init "/dev/$consoledev"
    fi
fi
 070701000000E7000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/modules.d/62bluetooth   070701000000E8000081ED00000000000000000000000164DF2CB800000AAE000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/62bluetooth/module-setup.sh   #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {
    # If the binary(s) requirements are not fulfilled the module can't be installed
    require_any_binary /usr/lib/bluetooth/bluetoothd /usr/libexec/bluetooth/bluetoothd || return 1

    if [[ $hostonly ]]; then
        # Include by default if a Peripheral (0x500) is found of minor class:
        #  * Keyboard (0x40)
        #  * Keyboard/pointing (0xC0)
        grep -qiE 'Class=0x[0-9a-f]{3}5[4c]0' /var/lib/bluetooth/*/*/info 2> /dev/null && return 0
    fi

    return 255
}

# Module dependency requirements.
depends() {
    # This module has external dependencies on the systemd and dbus modules.
    echo systemd dbus
    # Return 0 to include the dependent modules in the initramfs.
    return 0
}

installkernel() {
    instmods bluetooth btrtl btintel btbcm bnep ath3k btusb rfcomm hidp
    inst_multiple -o \
        /lib/firmware/ar3k/AthrBT* \
        /lib/firmware/ar3k/ramps* \
        /lib/firmware/ath3k-1.fw* \
        /lib/firmware/BCM2033-MD.hex* \
        /lib/firmware/bfubase.frm* \
        /lib/firmware/BT3CPCC.bin* \
        /lib/firmware/brcm/*.hcd* \
        /lib/firmware/mediatek/mt7622pr2h.bin* \
        /lib/firmware/qca/nvm* \
        /lib/firmware/qca/crnv* \
        /lib/firmware/qca/rampatch* \
        /lib/firmware/qca/crbtfw* \
        /lib/firmware/rtl_bt/* \
        /lib/firmware/intel/ibt* \
        /lib/firmware/ti-connectivity/TIInit_* \
        /lib/firmware/nokia/bcmfw.bin* \
        /lib/firmware/nokia/ti1273.bin*
}

# Install the required file(s) for the module in the initramfs.
install() {
    # shellcheck disable=SC2064
    trap "$(shopt -p nullglob globstar)" RETURN
    shopt -q -s nullglob globstar
    local -a var_lib_files

    inst_multiple \
        "${systemdsystemunitdir}/bluetooth.target" \
        "${systemdsystemunitdir}/bluetooth.service" \
        bluetoothctl

    inst_multiple -o \
        /usr/libexec/bluetooth/bluetoothd \
        /usr/lib/bluetooth/bluetoothd

    if [[ $hostonly ]]; then
        var_lib_files=("$dracutsysrootdir"/var/lib/bluetooth/**)

        inst_multiple -o \
            /etc/bluetooth/main.conf \
            /etc/dbus-1/system.d/bluetooth.conf \
            "${var_lib_files[@]#"$dracutsysrootdir"}"
    fi

    inst_rules 69-btattach-bcm.rules 60-persistent-input.rules

    # shellcheck disable=SC1004
    sed -i -e \
        '/^\[Unit\]/aDefaultDependencies=no\
        Conflicts=shutdown.target\
        Before=shutdown.target\
        After=dbus.service' \
        "${initdir}/${systemdsystemunitdir}/bluetooth.service"

    $SYSTEMCTL -q --root "$initdir" enable bluetooth.service
}
  070701000000E9000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/80cms 070701000000EA000081ED00000000000000000000000164DF2CB800000CC2000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/80cms/cms-write-ifcfg.sh  #!/bin/bash

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

OLD_UMASK=$(umask)
umask 0022
mkdir -p /run/initramfs/state/etc/sysconfig/network-scripts
umask "$OLD_UMASK"

function cms_write_config() {
    . /tmp/cms.conf
    SUBCHANNELS="$(echo "$SUBCHANNELS" | sed 'y/ABCDEF/abcdef/')"
    OLDIFS=$IFS
    IFS=,
    read -ra subch_array <<< "indexzero,$SUBCHANNELS"
    IFS=$OLDIFS
    devbusid=${subch_array[1]}
    if [ "$NETTYPE" = "ctc" ]; then
        driver="ctcm"
    else
        driver=$NETTYPE
    fi

    DEVICE=$(cd "/sys/devices/${driver}/$devbusid/net/" && set -- * && [ "$1" != "*" ] && echo "$1")

    uuid=$(cat /proc/sys/kernel/random/uuid)

    IFCFGFILE=/run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-$DEVICE

    strglobin "$IPADDR" '*:*:*' && ipv6=1

    # to please NetworkManager on startup in loader before loader reconfigures net
    cat > /etc/sysconfig/network << EOF
HOSTNAME=$HOSTNAME
EOF
    echo "$HOSTNAME" > /etc/hostname
    if [ "$ipv6" ]; then
        echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network
    else
        echo "NETWORKING=yes" >> /etc/sysconfig/network
    fi

    cat > "$IFCFGFILE" << EOF
DEVICE=$DEVICE
UUID=$uuid
ONBOOT=yes
BOOTPROTO=static
MTU=$MTU
SUBCHANNELS=$SUBCHANNELS
EOF
    if [ "$ipv6" ]; then
        cat >> "$IFCFGFILE" << EOF
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6ADDR=$IPADDR/$NETMASK
IPV6_DEFAULTGW=$GATEWAY
EOF
    else
        cat >> "$IFCFGFILE" << EOF
IPADDR=$IPADDR
NETMASK=$NETMASK
BROADCAST=$BROADCAST
GATEWAY=$GATEWAY
EOF
    fi
    if [ "$ipv6" ]; then
        # shellcheck disable=SC2153
        IFS="," read -r DNS1 DNS2 _ <<< "$DNS"
    else
        IFS=":" read -r DNS1 DNS2 _ <<< "$DNS"
    fi
    # real DNS config for NetworkManager to generate /etc/resolv.conf
    [[ $DNS1 ]] && echo "DNS1=$DNS1" >> "$IFCFGFILE"
    [[ $DNS2 ]] && echo "DNS2=$DNS2" >> "$IFCFGFILE"
    # just to please loader's readNetInfo && writeEnabledNetInfo
    # which eats DNS1,DNS2,... and generates it themselves based on DNS
    if [[ $ipv6 ]]; then
        [[ $DNS ]] && echo "DNS=\"$DNS\"" >> "$IFCFGFILE"
    else
        [[ $DNS ]] && echo "DNS=\"${DNS/:/,}\"" >> "$IFCFGFILE"
    fi
    # colons in SEARCHDNS already replaced with spaces above for /etc/resolv.conf
    [[ $SEARCHDNS ]] && echo "DOMAIN=\"$SEARCHDNS\"" >> "$IFCFGFILE"
    [[ $NETTYPE ]] && echo "NETTYPE=$NETTYPE" >> "$IFCFGFILE"
    [[ $PEERID ]] && echo "PEERID=$PEERID" >> "$IFCFGFILE"
    [[ $PORTNAME ]] && echo "PORTNAME=$PORTNAME" >> "$IFCFGFILE"
    [[ $CTCPROT ]] && echo "CTCPROT=$CTCPROT" >> "$IFCFGFILE"
    [[ $MACADDR ]] && echo "MACADDR=$MACADDR" >> "$IFCFGFILE"
    optstr=""
    for option in LAYER2 PORTNO; do
        [ -z "${!option}" ] && continue
        [ -n "$optstr" ] && optstr=${optstr}" "
        optstr=${optstr}$(echo ${option} | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')"="${!option}
    done
    # write single quotes since network.py removes double quotes but we need quotes
    echo "OPTIONS='$optstr'" >> "$IFCFGFILE"
    unset option
    unset optstr
    unset DNS1
    unset DNS2
    echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab
    echo "files /var/lib/dhclient" >> /run/initramfs/rwtab
}

[ -f /tmp/cms.conf ] && cms_write_config
  070701000000EB000081ED00000000000000000000000164DF2CB8000003BF000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/modules.d/80cms/cmsifup.sh  #!/bin/bash

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

DEVICE=$1

. /tmp/cms.conf

strglobin "$IPADDR" '*:*:*' && ipv6=1

if [ "$ipv6" ] && ! str_starts "$IPADDR" "["; then
    IPADDR="[$IPADDR]"
fi

if [ "$ipv6" ] && ! str_starts "$GATEWAY" "["; then
    GATEWAY="[$GATEWAY]"
fi

if [ "$ipv6" ]; then
    # shellcheck disable=SC2153
    IFS="," read -r DNS1 DNS2 _ <<< "$DNS"
else
    IFS=":" read -r DNS1 DNS2 _ <<< "$DNS"
fi

{
    echo "ip=$IPADDR::$GATEWAY:$NETMASK:$HOSTNAME:$DEVICE:none:$MTU:$MACADDR"
    for i in $DNS1 $DNS2; do
        echo "nameserver=$i"
    done
} > /etc/cmdline.d/80-cms.conf

[ -e "/tmp/net.ifaces" ] && read -r IFACES < /tmp/net.ifaces
IFACES="$IFACES $DEVICE"
echo "$IFACES" >> /tmp/net.ifaces

if [ -x /usr/libexec/nm-initrd-generator ] || [ -x /usr/lib/nm-initrd-generator ]; then
    type nm_generate_connections > /dev/null 2>&1 || . /lib/nm-lib.sh
    nm_generate_connections
else
    exec ifup "$DEVICE"
fi
 070701000000EC000081ED00000000000000000000000164DF2CB80000182D000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/modules.d/80cms/cmssetup.sh #!/bin/bash

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

function sysecho() {
    file="$1"
    shift
    local i=1
    while [ $i -le 10 ]; do
        if [ ! -f "$file" ]; then
            sleep 1
            i=$((i + 1))
        else
            break
        fi
    done
    local status
    read -r status < "$file"
    if [[ $status != "$*" ]]; then
        [ -f "$file" ] && echo "$*" > "$file"
    fi
}

function dasd_settle() {
    local dasd_status=/sys/bus/ccw/devices/$1/status
    if [ ! -f "$dasd_status" ]; then
        return 1
    fi
    local i=1
    while [ $i -le 60 ]; do
        local status
        read -r status < "$dasd_status"
        case $status in
            online | unformatted)
                return 0
                ;;
            *)
                sleep 0.1
                i=$((i + 1))
                ;;
        esac
    done
    return 1
}

function dasd_settle_all() {
    for dasdccw in $(while read -r line || [ -n "$line" ]; do echo "${line%%(*}"; done < /proc/dasd/devices); do
        if ! dasd_settle "$dasdccw"; then
            echo $"Could not access DASD $dasdccw in time"
            return 1
        fi
    done
    return 0
}

# prints a canonocalized device bus ID for a given devno of any format
function canonicalize_devno() {
    case ${#1} in
        3) echo "0.0.0${1}" ;;
        4) echo "0.0.${1}" ;;
        *) echo "${1}" ;;
    esac
    return 0
}

# read file from CMS and write it to /tmp
function readcmsfile() { # $1=dasdport $2=filename
    local dev
    local numcpus
    local devname
    local ret=0
    if [ $# -ne 2 ]; then return; fi
    # precondition: udevd created dasda block device node
    if ! dasd_cio_free -d "$1"; then
        echo $"DASD $1 could not be cleared from device blacklist"
        return 1
    fi

    modprobe dasd_mod dasd="$CMSDASD"
    modprobe dasd_eckd_mod
    udevadm settle

    # precondition: dasd_eckd_mod driver incl. dependencies loaded,
    #               dasd_mod must be loaded without setting any DASD online
    dev=$(canonicalize_devno "$1")
    numcpus=$(
        while read -r line || [ -n "$line" ]; do
            if strstr "$line" "# processors"; then
                echo "${line##*:}"
                break
            fi
        done < /proc/cpuinfo
    )

    if [ "${numcpus}" -eq 1 ]; then
        echo 1 > /sys/bus/ccw/devices/"$dev"/online
    else
        if ! sysecho /sys/bus/ccw/devices/"$dev"/online 1; then
            echo $"DASD $dev could not be set online"
            return 1
        fi
        udevadm settle
        if ! dasd_settle "$dev"; then
            echo $"Could not access DASD $dev in time"
            return 1
        fi
    fi

    udevadm settle

    devname=$(
        cd /sys/bus/ccw/devices/"$dev"/block || exit
        set -- *
        [ -b /dev/"$1" ] && echo "$1"
    )
    devname=${devname:-dasda}

    [[ -d /mnt ]] || mkdir -p /mnt
    if cmsfs-fuse --to=UTF-8 -a /dev/"$devname" /mnt; then
        cat /mnt/"$2" > /run/initramfs/"$2"
        umount /mnt || umount -l /mnt
        udevadm settle
    else
        echo $"Could not read conf file $2 on CMS DASD $1."
        ret=1
    fi

    if ! sysecho /sys/bus/ccw/devices/"$dev"/online 0; then
        echo $"DASD $dev could not be set offline again"
        #return 1
    fi
    udevadm settle

    # unbind all dasds to unload the dasd modules for a clean start
    (
        cd /sys/bus/ccw/drivers/dasd-eckd || exit
        for i in *.*; do echo "$i" > unbind; done
    )
    udevadm settle
    modprobe -r dasd_eckd_mod
    udevadm settle
    modprobe -r dasd_diag_mod
    udevadm settle
    modprobe -r dasd_mod
    udevadm settle
    return $ret
}

processcmsfile() {
    source /tmp/cms.conf
    SUBCHANNELS="$(echo "$SUBCHANNELS" | sed 'y/ABCDEF/abcdef/')"

    if [[ $NETTYPE ]]; then
        (
            echo -n "$NETTYPE","$SUBCHANNELS"
            [[ $PORTNAME ]] && echo -n ",portname=$PORTNAME"
            [[ $LAYER2 ]] && echo -n ",layer2=$LAYER2"
            [[ $NETTYPE == "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
            echo
        ) >> /etc/ccw.conf

        OLDIFS=$IFS
        IFS=,
        read -r -a subch_array <<< "indexzero,$SUBCHANNELS"
        IFS=$OLDIFS
        devbusid=${subch_array[1]}
        if [ "$NETTYPE" = "ctc" ]; then
            driver="ctcm"
        else
            driver=$NETTYPE
        fi

        # shellcheck disable=SC2016
        printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$name /sbin/cmsifup $name"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
        # remove the default net rules
        rm -f -- /etc/udev/rules.d/91-default-net.rules
        # shellcheck disable=SC2016
        [[ -f /etc/udev/rules.d/90-net.rules ]] \
            || printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$name source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
        udevadm control --reload
        znet_cio_free
    fi

    if [[ $DASD ]] && [[ $DASD != "none" ]]; then
        echo "$DASD" | normalize_dasd_arg > /etc/dasd.conf
        echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf
        dasd_cio_free
    fi

    unset _do_zfcp
    for i in ${!FCP_*}; do
        echo "${!i}" | while read -r port rest || [ -n "$port" ]; do
            case $port in
                *.*.*) ;;

                *.*)
                    port="0.$port"
                    ;;
                *)
                    port="0.0.$port"
                    ;;
            esac
            echo "$port" "$rest" >> /etc/zfcp.conf
        done
        _do_zfcp=1
    done
    [[ $_do_zfcp ]] && zfcp_cio_free
    unset _do_zfcp
}

[[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=")
[[ $CMSCONFFILE ]] || CMSCONFFILE=$(getarg "CMSCONFFILE=")

# Parse configuration
if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then
    if readcmsfile "$CMSDASD" "$CMSCONFFILE"; then
        ln -s /run/initramfs/"$CMSCONFFILE" /tmp/"$CMSCONFFILE"
        ln -s /run/initramfs/"$CMSCONFFILE" /tmp/cms.conf
        processcmsfile
    fi
fi
   070701000000ED000081ED00000000000000000000000164DF2CB8000003B7000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/80cms/module-setup.sh #!/bin/bash

# called by dracut
check() {
    arch=${DRACUT_ARCH:-$(uname -m)}
    [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
    return 255
}

# called by dracut
depends() {
    arch=${DRACUT_ARCH:-$(uname -m)}
    [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
    echo znet zfcp dasd dasd_mod bash
    return 0
}

# called by dracut
installkernel() {
    instmods zfcp
}

# called by dracut
install() {
    inst_hook pre-trigger 30 "$moddir/cmssetup.sh"
    inst_hook pre-pivot 95 "$moddir/cms-write-ifcfg.sh"
    inst_script "$moddir/cmsifup.sh" /sbin/cmsifup
    # shellcheck disable=SC2046
    inst_multiple /etc/cmsfs-fuse/filetypes.conf /etc/udev/rules.d/99-fuse.rules /etc/fuse.conf \
        cmsfs-fuse fusermount ulockmgr_server bash insmod rmmod cat normalize_dasd_arg sed \
        $(rpm -ql s390utils-base) awk getopt

    inst_libdir_file "gconv/*"
    #inst /usr/lib/locale/locale-archive
    dracut_need_initqueue
}
 070701000000EE000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003300000000dracut-055+suse.347.gdcb9bdbf/modules.d/80lvmmerge    070701000000EF000081A400000000000000000000000164DF2CB80000082D000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/80lvmmerge/README.md  # lvmmerge - dracut module

## Preparation
- ensure that the lvm thin pool is big enough
- backup any (most likely /boot and /boot/efi) device with:
```
# mkdir /restoredev
# dev=<device>; umount $dev; dd if="$dev" of=/restoredev/$(systemd-escape -p "$dev"); mount $dev
```
- backup the MBR
```
# dev=<device>; dd if="$dev" of=/restoredev/$(systemd-escape -p "$dev") bs=446 count=1
# ls -l /dev/disk/by-path/virtio-pci-0000\:00\:07.0
lrwxrwxrwx. 1 root root 9 Jul 24 04:27 /dev/disk/by-path/virtio-pci-0000:00:07.0 -> ../../vda
```
- backup some partitions
```
# dev=/dev/disk/by-path/virtio-pci-0000:00:07.0
# dd if="$dev" of=/restoredev/$(systemd-escape -p "$dev") bs=446 count=1
# umount /boot/efi
# dev=/dev/disk/by-partuuid/687177a8-86b3-4e37-a328-91d20db9563c
# dd if="$dev" of=/restoredev/$(systemd-escape -p "$dev")
# umount /boot
# dev=/dev/disk/by-partuuid/4fdf99e9-4f28-4207-a26f-c76546824eaf
# dd if="$dev" of=/restoredev/$(systemd-escape -p "$dev")
```
Final /restoredev
```
# ls -al /restoredev/
total 1253380
drwx------.  2 root root        250 Jul 24 04:38 .
dr-xr-xr-x. 18 root root        242 Jul 24 04:32 ..
-rw-------. 1 root root  209715200 Jul 24 04:34 dev-disk-by\x2dpartuuid-4fdf99e9\x2d4f28\x2d4207\x2da26f\x2dc76546824eaf
-rw-------. 1 root root 1073741824 Jul 24 04:34 dev-disk-by\x2dpartuuid-687177a8\x2d86b3\x2d4e37\x2da328\x2d91d20db9563c
-rw-------. 1 root root        446 Jul 24 04:38 dev-disk-by\x2dpath-virtio\x2dpci\x2d0000:00:07.0
```
- make a thin snapshot
```
# lvm lvcreate -pr -s rhel/root --name reset
```

- mark the snapshot with a tag
```
# lvm lvchange --addtag reset rhel/reset
```

- remove /restoredev
```
# rm -fr /restoredev
```

## Operation

If a boot entry with ```rd.lvm.mergetags=<tag>``` is selected and there are LVs with ```<tag>```
dracut will
- make a copy of the snapshot
- merge it back to the original
- rename the copy back to the name of the snapshot
- if /restordev appears in the root, then it will restore the images
  found in that directory. This can be used to restore /boot and /boot/efi and the
  MBR of the boot device
   070701000000F0000081ED00000000000000000000000164DF2CB800000C16000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/80lvmmerge/lvmmerge.sh    #!/bin/bash

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

do_merge() {
    sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 1/' \
        /etc/lvm/lvm.conf

    systemctl --no-block stop sysroot.mount
    swapoff -a
    umount -R /sysroot

    for tag in $(getargs rd.lvm.mergetags); do
        lvm vgs --noheadings -o vg_name \
            | while read -r vg || [[ -n $vg ]]; do
                unset LVS
                declare -a LVS
                lvs=$(lvm lvs --noheadings -o lv_name "$vg")
                for lv in $lvs; do
                    lvm lvchange -an "$vg/$lv"

                    tags=$(trim "$(lvm lvs --noheadings -o lv_tags "$vg/$lv")")
                    strstr ",${tags}," ",${tag}," || continue

                    if ! lvm lvs --noheadings -o lv_name "${vg}/${lv}_dracutsnap" &> /dev/null; then
                        info "Creating backup ${lv}_dracutsnap of ${vg}/${lv}"
                        lvm lvcreate -pr -s "${vg}/${lv}" --name "${lv}_dracutsnap"
                    fi
                    lvm lvchange --addtag "$tag" "${vg}/${lv}_dracutsnap"

                    info "Merging back ${vg}/${lv} to the original LV"
                    lvm lvconvert --merge "${vg}/${lv}"

                    LVS+=("$lv")
                done

                systemctl --no-block stop sysroot.mount
                udevadm settle

                for ((i = 0; i < 100; i++)); do
                    lvm vgchange -an "$vg" && break
                    sleep 0.5
                done

                udevadm settle
                lvm vgchange -ay "$vg"
                udevadm settle
                for lv in "${LVS[@]}"; do
                    info "Renaming ${lv}_dracutsnap backup to ${vg}/${lv}"
                    lvm lvrename "$vg" "${lv}_dracutsnap" "${lv}"
                done
                udevadm settle
            done
    done

    systemctl --no-block reset-failed systemd-fsck-root
    systemctl --no-block start systemd-fsck-root
    systemctl --no-block reset-failed sysroot.mount
    systemctl --no-block start sysroot.mount

    for ((i = 0; i < 100; i++)); do
        [[ -d /sysroot/dev ]] && break
        sleep 0.5
        systemctl --no-block start sysroot.mount
    done

    if [[ -d /sysroot/restoredev ]]; then
        (
            if cd /sysroot/restoredev; then
                # restore devices and partitions
                for i in *; do
                    target=$(systemd-escape -pu "$i")
                    if ! [[ -b $target ]]; then
                        warn "Not restoring $target, as the device does not exist"
                        continue
                    fi

                    # Just in case
                    umount "$target" &> /dev/null

                    info "Restoring $target"
                    dd if="$i" of="$target" |& vinfo
                done
            fi
        )
        mount -o remount,rw /sysroot
        rm -fr /sysroot/restoredev
    fi
    info "Rebooting"
    reboot
}

if getarg rd.lvm.mergetags; then
    do_merge
fi
  070701000000F1000081ED00000000000000000000000164DF2CB8000001AD000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/80lvmmerge/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    # No point trying to support lvm if the binaries are missing
    require_binaries lvm dd swapoff || return 1

    return 255
}

# called by dracut
depends() {
    echo lvm dracut-systemd systemd bash
    return 0
}

installkernel() {
    hostonly="" instmods dm-snapshot
}

# called by dracut
install() {
    inst_multiple dd swapoff
    inst_hook cleanup 01 "$moddir/lvmmerge.sh"
}
   070701000000F2000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003500000000dracut-055+suse.347.gdcb9bdbf/modules.d/81cio_ignore  070701000000F3000081ED00000000000000000000000164DF2CB800000459000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/81cio_ignore/module-setup.sh  #!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# called by dracut
check() {
    # do not add this module by default
    local arch=${DRACUT_ARCH:-$(uname -m)}
    [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
    return 0
}

cmdline() {
    local cio_accept

    if [ -e /boot/zipl/active_devices.txt ]; then
        while read -r dev _; do
            [ "$dev" = "#" -o "$dev" = "" ] && continue
            if [ -z "$cio_accept" ]; then
                cio_accept="$dev"
            else
                cio_accept="${cio_accept},${dev}"
            fi
        done < /boot/zipl/active_devices.txt
    fi
    if [ -n "$cio_accept" ]; then
        echo "rd.cio_accept=${cio_accept}"
    fi
}

# called by dracut
install() {
    if [[ $hostonly_cmdline == "yes" ]]; then
        local _cio_accept
        _cio_accept=$(cmdline)
        [[ $_cio_accept ]] && printf "%s\n" "$_cio_accept" >> "${initdir}/etc/cmdline.d/01cio_accept.conf"
    fi

    inst_hook cmdline 20 "$moddir/parse-cio_accept.sh"
    inst_multiple cio_ignore
}
   070701000000F4000081ED00000000000000000000000164DF2CB800000215000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/81cio_ignore/parse-cio_accept.sh  #!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

CIO_IGNORE=$(getarg cio_ignore)
CIO_ACCEPT=$(getarg rd.cio_accept)

if [ -z "$CIO_IGNORE" ]; then
    info "cio_ignored disabled on commandline"
    return
fi
if [ -n "$CIO_ACCEPT" ]; then
    OLDIFS="$IFS"
    IFS=,
    # shellcheck disable=SC2086
    set -- $CIO_ACCEPT
    while [ "$#" -gt 0 ]; do
        info "Enabling device $1"
        cio_ignore --remove "$1"
        shift
    done
    IFS="$OLDIFS"
fi
   070701000000F5000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003000000000dracut-055+suse.347.gdcb9bdbf/modules.d/90btrfs   070701000000F6000081A400000000000000000000000164DF2CB80000010E000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90btrfs/80-btrfs.rules    SUBSYSTEM!="block", GOTO="btrfs_end"
ACTION!="add|change", GOTO="btrfs_end"
ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end"
RUN+="/sbin/btrfs device scan $env{DEVNAME}"

RUN+="/sbin/initqueue --finished --unique --name btrfs_finished /sbin/btrfs_finished"

LABEL="btrfs_end"
  070701000000F7000081ED00000000000000000000000164DF2CB8000001D0000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/modules.d/90btrfs/btrfs_device_ready.sh #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

btrfs_check_complete() {
    local _rootinfo _dev
    _dev="${1:-/dev/root}"
    [ -e "$_dev" ] || return 0
    _rootinfo=$(udevadm info --query=env "--name=$_dev" 2> /dev/null)
    if strstr "$_rootinfo" "ID_FS_TYPE=btrfs"; then
        info "Checking, if btrfs device complete"
        btrfs device ready "$_dev" > /dev/null 2>&1
        return $?
    fi
    return 0
}

btrfs_check_complete "$1"
070701000000F8000081ED00000000000000000000000164DF2CB800000253000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/modules.d/90btrfs/btrfs_finished.sh #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

btrfs_check_complete() {
    local _rootinfo _dev
    _dev="${1:-/dev/root}"
    [ -e "$_dev" ] || return 0
    _rootinfo=$(udevadm info --query=env "--name=$_dev" 2> /dev/null)
    if strstr "$_rootinfo" "ID_FS_TYPE=btrfs"; then
        info "Checking, if btrfs device complete"
        unset __btrfs_mount
        mount -o ro "$_dev" /tmp > /dev/null 2>&1
        __btrfs_mount=$?
        [ $__btrfs_mount -eq 0 ] && umount "$_dev" > /dev/null 2>&1
        return $__btrfs_mount
    fi
    return 0
}

btrfs_check_complete "$1"
 070701000000F9000081ED00000000000000000000000164DF2CB800000090000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90btrfs/btrfs_timeout.sh  #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

info "Scanning for all btrfs devices"
/sbin/btrfs device scan > /dev/null 2>&1
070701000000FA000081ED00000000000000000000000164DF2CB800000540000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/modules.d/90btrfs/module-setup.sh   #!/bin/bash

# called by dracut
check() {
    # if we don't have btrfs installed on the host system,
    # no point in trying to support it in the initramfs.
    require_binaries btrfs || return 1

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for fs in "${host_fs_types[@]}"; do
            [[ $fs == "btrfs" ]] && return 0
        done
        return 255
    }

    return 0
}

# called by dracut
depends() {
    echo udev-rules
    return 0
}

# called by dracut
installkernel() {
    instmods btrfs
}

# called by dracut
install() {
    if ! inst_rules 64-btrfs.rules; then
        inst_rules "$moddir/80-btrfs.rules"
        case "$(btrfs --help)" in
            *device\ ready*)
                inst_script "$moddir/btrfs_device_ready.sh" /sbin/btrfs_finished
                ;;
            *)
                inst_script "$moddir/btrfs_finished.sh" /sbin/btrfs_finished
                ;;
        esac
    else
        inst_rules 64-btrfs-dm.rules
    fi

    if ! dracut_module_included "systemd"; then
        inst_hook initqueue/timeout 10 "$moddir/btrfs_timeout.sh"
    fi

    inst_multiple -o btrfsck btrfs-zero-log
    inst "$(command -v btrfs)" /sbin/btrfs
    # Hack for slow machines
    # see https://github.com/dracutdevs/dracut/issues/658
    echo "rd.driver.pre=btrfs" > "${initdir}"/etc/cmdline.d/00-btrfs.conf
}
070701000000FB000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003000000000dracut-055+suse.347.gdcb9bdbf/modules.d/90crypt   070701000000FC000081ED00000000000000000000000164DF2CB8000001C0000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90crypt/crypt-cleanup.sh  #!/bin/sh

# close everything which is not busy
rm -f -- /etc/udev/rules.d/70-luks.rules > /dev/null 2>&1

if ! getarg rd.luks.uuid -d rd_LUKS_UUID > /dev/null 2>&1 && getargbool 1 rd.luks -d -n rd_NO_LUKS > /dev/null 2>&1; then
    while true; do
        local do_break="y"
        for i in /dev/mapper/luks-*; do
            cryptsetup luksClose "$i" > /dev/null 2>&1 && do_break=n
        done
        [ "$do_break" = "y" ] && break
    done
fi
070701000000FD000081ED00000000000000000000000164DF2CB800001FE3000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90crypt/crypt-lib.sh  #!/bin/sh

command -v getarg > /dev/null || . /lib/dracut-lib.sh

# check if the crypttab contains an entry for a LUKS UUID
crypttab_contains() {
    local luks="$1"
    local dev="$2"
    local l d rest
    if [ -f /etc/crypttab ]; then
        while read -r l d rest || [ -n "$l" ]; do
            strstr "${l##luks-}" "${luks##luks-}" && return 0
            strstr "$d" "${luks##luks-}" && return 0
            if [ -n "$dev" ]; then
                for _dev in $(devnames "$d"); do
                    [ "$dev" -ef "$_dev" ] && return 0
                done
            fi
            if [ -e /etc/block_uuid.map ]; then
                # search for line starting with $d
                _line=$(sed -n "\,^$d .*$,{p}" /etc/block_uuid.map)
                [ -z "$_line" ] && continue
                # get second column with uuid
                _uuid="$(echo "$_line" | sed 's,^.* \(.*$\),\1,')"
                strstr "$_uuid" "${luks##luks-}" && return 0
            fi
        done < /etc/crypttab
    fi
    return 1
}

# ask_for_password
#
# Wraps around plymouth ask-for-password and adds fallback to tty password ask
# if plymouth is not present.
#
# --cmd command
#   Command to execute. Required.
# --prompt prompt
#   Password prompt. Note that function already adds ':' at the end.
#   Recommended.
# --tries n
#   How many times repeat command on its failure.  Default is 3.
# --ply-[cmd|prompt|tries]
#   Command/prompt/tries specific for plymouth password ask only.
# --tty-[cmd|prompt|tries]
#   Command/prompt/tries specific for tty password ask only.
# --tty-echo-off
#   Turn off input echo before tty command is executed and turn on after.
#   It's useful when password is read from stdin.
ask_for_password() {
    local ply_cmd
    local ply_prompt
    local ply_tries=3
    local tty_cmd
    local tty_prompt
    local tty_tries=3
    local ret

    while [ $# -gt 0 ]; do
        case "$1" in
            --cmd)
                ply_cmd="$2"
                tty_cmd="$2"
                shift
                ;;
            --ply-cmd)
                ply_cmd="$2"
                shift
                ;;
            --tty-cmd)
                tty_cmd="$2"
                shift
                ;;
            --prompt)
                ply_prompt="$2"
                tty_prompt="$2"
                shift
                ;;
            --ply-prompt)
                ply_prompt="$2"
                shift
                ;;
            --tty-prompt)
                tty_prompt="$2"
                shift
                ;;
            --tries)
                ply_tries="$2"
                tty_tries="$2"
                shift
                ;;
            --ply-tries)
                ply_tries="$2"
                shift
                ;;
            --tty-tries)
                tty_tries="$2"
                shift
                ;;
            --tty-echo-off) tty_echo_off=yes ;;
        esac
        shift
    done

    {
        flock -s 9
        # Prompt for password with plymouth, if installed and running.
        if type plymouth > /dev/null 2>&1 && plymouth --ping 2> /dev/null; then
            plymouth ask-for-password \
                --prompt "$ply_prompt" --number-of-tries="$ply_tries" \
                --command="$ply_cmd"
            ret=$?
        else
            if [ "$tty_echo_off" = yes ]; then
                stty_orig="$(stty -g)"
                stty -echo
            fi

            local i=1
            while [ $i -le "$tty_tries" ]; do
                [ -n "$tty_prompt" ] \
                    && printf "%s" "$tty_prompt [$i/$tty_tries]:" >&2
                eval "$tty_cmd" && ret=0 && break
                ret=$?
                i=$((i + 1))
                [ -n "$tty_prompt" ] && printf '\n' >&2
            done

            [ "$tty_echo_off" = yes ] && stty "$stty_orig"
        fi
    } 9> /.console_lock

    [ $ret -ne 0 ] && echo "Wrong password" >&2
    return $ret
}

# Try to mount specified device (by path, by UUID or by label) and check
# the path with 'test'.
#
# example:
# test_dev -f LABEL="nice label" /some/file1
test_dev() {
    local test_op=$1
    local dev="$2"
    local f="$3"
    local ret=1
    local mount_point

    mount_point=$(mkuniqdir /mnt testdev)
    [ -n "$dev" -a -n "$*" ] || return 1
    [ -d "$mount_point" ] || die 'Mount point does not exist!'

    if mount -r "$dev" "$mount_point" > /dev/null 2>&1; then
        test "$test_op" "${mount_point}/${f}"
        ret=$?
        umount "$mount_point"
    fi

    rmdir "$mount_point"

    return $ret
}

# match_dev devpattern dev
#
# Returns true if 'dev' matches 'devpattern'.  Both 'devpattern' and 'dev' are
# expanded to kernel names and then compared.  If name of 'dev' is on list of
# names of devices matching 'devpattern', the test is positive.  'dev' and
# 'devpattern' may be anything which function 'devnames' recognizes.
#
# If 'devpattern' is empty or '*' then function just returns true.
#
# Example:
#   match_dev UUID=123 /dev/dm-1
# Returns true if /dev/dm-1 UUID starts with "123".
match_dev() {
    [ -z "$1" -o "$1" = '*' ] && return 0
    local devlist
    local dev

    devlist="$(devnames "$1")" || return 255
    dev="$(devnames "$2")" || return 255

    strstr "
$devlist
" "
$dev
"
}

# getkey keysfile for_dev
#
# Reads file <keysfile> produced by probe-keydev and looks for first line to
# which device <for_dev> matches.  The successful result is printed in format
# "<keydev>:<keypath>".  When nothing found, just false is returned.
#
# Example:
#   getkey /tmp/luks.keys /dev/sdb1
# May print:
#   /dev/sdc1:/keys/some.key
getkey() {
    local keys_file="$1"
    local for_dev="$2"
    local luks_dev
    local key_dev
    local key_path

    [ -z "$keys_file" -o -z "$for_dev" ] && die 'getkey: wrong usage!'
    [ -f "$keys_file" ] || return 1

    while IFS=: read -r luks_dev key_dev key_path _ || [ -n "$luks_dev" ]; do
        if match_dev "$luks_dev" "$for_dev"; then
            echo "${key_dev}:${key_path}"
            return 0
        fi
    done < "$keys_file"

    return 1
}

# readkey keypath keydev device
#
# Mounts <keydev>, reads key from file <keypath>, optionally processes it (e.g.
# if encrypted with GPG) and prints to standard output which is supposed to be
# read by cryptsetup.  <device> is just passed to helper function for
# informational purpose.
readkey() {
    local keypath="$1"
    local keydev="$2"
    local device="$3"

    # No mounting needed if the keyfile resides inside the initrd
    if [ "/" = "$keydev" ]; then
        local mntp=/
    else
        # This creates a unique single mountpoint for *, or several for explicitly
        # given LUKS devices. It accomplishes unlocking multiple LUKS devices with
        # a single password entry.
        local mntp
        mntp="/mnt/$(str_replace "keydev-$keydev-$keypath" '/' '-')"

        if [ ! -d "$mntp" ]; then
            mkdir -p "$mntp"
            mount -r "$keydev" "$mntp" || die 'Mounting rem. dev. failed!'
        fi
    fi

    case "${keypath##*.}" in
        gpg)
            if [ -f /lib/dracut-crypt-gpg-lib.sh ]; then
                . /lib/dracut-crypt-gpg-lib.sh
                gpg_decrypt "$mntp" "$keypath" "$keydev" "$device"
            else
                die "No GPG support to decrypt '$keypath' on '$keydev'."
            fi
            ;;
        img)
            if [ -f /lib/dracut-crypt-loop-lib.sh ]; then
                . /lib/dracut-crypt-loop-lib.sh
                loop_decrypt "$mntp" "$keypath" "$keydev" "$device"
                printf "%s\n" "umount \"$mntp\"; rmdir \"$mntp\";" > "${hookdir}/cleanup/crypt-loop-cleanup-99-${mntp##*/}".sh
                return 0
            else
                die "No loop file support to decrypt '$keypath' on '$keydev'."
            fi
            ;;
        *) cat "$mntp/$keypath" ;;
    esac

    # No unmounting if the keyfile resides inside the initrd
    if [ "/" != "$keydev" ]; then
        # General unmounting mechanism, modules doing custom cleanup should return earlier
        # and install a pre-pivot cleanup hook
        umount "$mntp"
        rmdir "$mntp"
    fi
}
 070701000000FE000081ED00000000000000000000000164DF2CB800000320000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/90crypt/crypt-run-generator.sh    #!/bin/sh

. /lib/dracut-lib.sh
type crypttab_contains > /dev/null 2>&1 || . /lib/dracut-crypt-lib.sh

dev=$1
luks=$2

crypttab_contains "$luks" "$dev" && exit 0

allowdiscards="-"

# parse for allow-discards
if [ -n "$DRACUT_SYSTEMD" ] || strstr "$(cryptsetup --help)" "allow-discards"; then
    if discarduuids=$(getargs "rd.luks.allow-discards"); then
        discarduuids=$(str_replace "$discarduuids" 'luks-' '')
        if strstr " $discarduuids " " ${luks##luks-}"; then
            allowdiscards="discard"
        fi
    elif getargbool 0 rd.luks.allow-discards; then
        allowdiscards="discard"
    fi
fi

echo "$luks $dev - timeout=0,$allowdiscards" >> /etc/crypttab

if command -v systemctl > /dev/null; then
    systemctl daemon-reload
    systemctl start cryptsetup.target
fi
exit 0
070701000000FF000081ED00000000000000000000000164DF2CB8000015D8000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90crypt/cryptroot-ask.sh  #!/bin/sh

PATH=/usr/sbin:/usr/bin:/sbin:/bin
NEWROOT=${NEWROOT:-"/sysroot"}

# do not ask, if we already have root
[ -f "$NEWROOT"/proc ] && exit 0

. /lib/dracut-lib.sh

mkdir -p -m 0700 /run/cryptsetup

# if device name is /dev/dm-X, convert to /dev/mapper/name
if [ "${1##/dev/dm-}" != "$1" ]; then
    device="/dev/mapper/$(dmsetup info -c --noheadings -o name "$1")"
else
    device="$1"
fi

# default luksname - luks-UUID
luksname=$2

# is_keysource - ask for passphrase even if a rd.luks.key argument is set
is_keysource=${3:-0}

# number of tries
numtries=${4:-10}

# TODO: improve to support what cmdline does
if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -d -n rd_NO_CRYPTTAB; then
    while read -r name dev luksfile luksoptions || [ -n "$name" ]; do
        # ignore blank lines and comments
        if [ -z "$name" -o "${name#\#}" != "$name" ]; then
            continue
        fi

        # PARTUUID used in crypttab
        if [ "${dev%%=*}" = "PARTUUID" ]; then
            if [ "luks-${dev##PARTUUID=}" = "$luksname" ]; then
                luksname="$name"
                break
            fi

        # UUID used in crypttab
        elif [ "${dev%%=*}" = "UUID" ]; then
            if [ "luks-${dev##UUID=}" = "$luksname" ]; then
                luksname="$name"
                break
            fi

        # ID used in crypttab
        elif [ "${dev%%=*}" = "ID" ]; then
            if [ "luks-${dev##ID=}" = "$luksname" ]; then
                luksname="$name"
                break
            fi

        # path used in crypttab
        else
            cdev=$(readlink -f "$dev")
            mdev=$(readlink -f "$device")
            if [ "$cdev" = "$mdev" ]; then
                luksname="$name"
                break
            fi
        fi
    done < /etc/crypttab
    unset name dev
fi

# check if destination already exists
[ -b /dev/mapper/"$luksname" ] && exit 0

# we already asked for this device
asked_file=/tmp/cryptroot-asked-$luksname
[ -f "$asked_file" ] && exit 0

# load dm_crypt if it is not already loaded
[ -d /sys/module/dm_crypt ] || modprobe dm_crypt

. /lib/dracut-crypt-lib.sh

#
# Open LUKS device
#

info "luksOpen $device $luksname $luksfile $luksoptions"

OLD_IFS="$IFS"
IFS=,
# shellcheck disable=SC2086
set -- $luksoptions
IFS="$OLD_IFS"

while [ $# -gt 0 ]; do
    case $1 in
        noauto)
            # skip this
            exit 0
            ;;
        swap)
            # skip this
            exit 0
            ;;
        tmp)
            # skip this
            exit 0
            ;;
        allow-discards)
            allowdiscards="--allow-discards"
            ;;
        header=*)
            cryptsetupopts="${cryptsetupopts} --${1}"
            ;;
    esac
    shift
done

# parse for allow-discards
if strstr "$(cryptsetup --help)" "allow-discards"; then
    if discarduuids=$(getargs "rd.luks.allow-discards"); then
        discarduuids=$(str_replace "$discarduuids" 'luks-' '')
        if strstr " $discarduuids " " ${luksdev##luks-}"; then
            allowdiscards="--allow-discards"
        fi
    elif getargbool 0 rd.luks.allow-discards; then
        allowdiscards="--allow-discards"
    fi
fi

if strstr "$(cryptsetup --help)" "allow-discards"; then
    cryptsetupopts="$cryptsetupopts $allowdiscards"
fi

unset allowdiscards

# fallback to passphrase
ask_passphrase=1

if [ -n "$luksfile" -a "$luksfile" != "none" -a -e "$luksfile" ]; then
    # shellcheck disable=SC2086
    if readkey "$luksfile" / "$device" \
        | cryptsetup -d - $cryptsetupopts luksOpen "$device" "$luksname"; then
        ask_passphrase=0
    fi
elif [ "$is_keysource" -ne 0 ]; then
    info "Asking for passphrase because $device is a keysource."
else
    while [ -n "$(getarg rd.luks.key)" ]; do
        if tmp=$(getkey /tmp/luks.keys "$device"); then
            keydev="${tmp%%:*}"
            keypath="${tmp#*:}"
        else
            if [ "$numtries" -eq 0 ]; then
                warn "No key found for $device.  Fallback to passphrase mode."
                break
            fi
            sleep 1
            info "No key found for $device.  Will try $numtries time(s) more later."
            initqueue --unique --onetime --settled \
                --name cryptroot-ask-"$luksname" \
                "$(command -v cryptroot-ask)" "$device" "$luksname" "$is_keysource" "$((numtries - 1))"
            exit 0
        fi
        unset tmp

        info "Using '$keypath' on '$keydev'"
        # shellcheck disable=SC2086
        readkey "$keypath" "$keydev" "$device" \
            | cryptsetup -d - $cryptsetupopts luksOpen "$device" "$luksname" \
            && ask_passphrase=0
        unset keypath keydev
        break
    done
fi

if [ $ask_passphrase -ne 0 ]; then
    luks_open="$(command -v cryptsetup) $cryptsetupopts luksOpen"
    _timeout=$(getargs "rd.luks.timeout")
    _timeout=${_timeout:-0}
    ask_for_password --ply-tries 5 \
        --ply-cmd "$luks_open -T1 $device $luksname" \
        --ply-prompt "Password ($device)" \
        --tty-tries 1 \
        --tty-cmd "$luks_open -T5 -t $_timeout $device $luksname"
    unset luks_open
    unset _timeout
fi

if [ "$is_keysource" -ne 0 -a "${luksname##luks-}" != "$luksname" ]; then
    luks_close="$(command -v cryptsetup) close"
    {
        printf -- '[ -e /dev/mapper/%s ] && ' "$luksname"
        printf -- '%s "%s"\n' "$luks_close" "$luksname"
    } >> "$hookdir/cleanup/31-crypt-keysource.sh"
    unset luks_close
fi

unset device luksname luksfile

# mark device as asked
: >> "$asked_file"

need_shutdown
udevsettle

exit 0
07070100000100000081ED00000000000000000000000164DF2CB800001876000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/modules.d/90crypt/module-setup.sh   #!/bin/bash

# called by dracut
check() {
    local fs
    # if cryptsetup is not installed, then we cannot support encrypted devices.
    require_any_binary "$systemdutildir"/systemd-cryptsetup cryptsetup || return 1

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for fs in "${host_fs_types[@]}"; do
            [[ $fs == "crypto_LUKS" ]] && return 0
        done
        return 255
    }

    return 0
}

# called by dracut
depends() {
    local deps
    deps="dm rootfs-block"
    if [[ $hostonly && -f "$dracutsysrootdir"/etc/crypttab ]]; then
        if grep -q "tpm2-device=" "$dracutsysrootdir"/etc/crypttab; then
            deps+=" tpm2-tss"
        fi
        if grep -q -e "fido2-device=" -e "fido2-cid=" "$dracutsysrootdir"/etc/crypttab; then
            deps+=" fido2"
        fi
    fi
    echo "$deps"
    return 0
}

# called by dracut
installkernel() {
    hostonly="" instmods drbg
    instmods dm_crypt

    # in case some of the crypto modules moved from compiled in
    # to module based, try to install those modules
    # best guess
    if [[ $hostonly ]] || [[ $mount_needs ]]; then
        # dmsetup returns s.th. like
        # cryptvol: 0 2064384 crypt aes-xts-plain64 :64:logon:cryptsetup:....
        dmsetup table | while read -r name _ _ is_crypt cipher _; do
            [[ $is_crypt == "crypt" ]] || continue
            # get the device name
            name=/dev/$(dmsetup info -c --noheadings -o blkdevname "${name%:}")
            # check if the device exists as a key in our host_fs_types (even with null string)
            # shellcheck disable=SC2030  # this is a shellcheck bug
            if [[ ${host_fs_types[$name]+_} ]]; then
                # split the cipher aes-xts-plain64 in pieces
                IFS='-:' read -ra mods <<< "$cipher"
                # try to load the cipher part with "crypto-" prepended
                # in non-hostonly mode
                hostonly='' instmods "${mods[@]/#/crypto-}" "crypto-$cipher"
            fi
        done
    else
        instmods "=crypto"
    fi
    return 0
}

# called by dracut
cmdline() {
    local dev UUID
    # shellcheck disable=SC2031
    for dev in "${!host_fs_types[@]}"; do
        [[ ${host_fs_types[$dev]} != "crypto_LUKS" ]] && continue

        UUID=$(
            blkid -u crypto -o export "$dev" \
                | while read -r line || [ -n "$line" ]; do
                    [[ ${line#UUID} == "$line" ]] && continue
                    printf "%s" "${line#UUID=}"
                    break
                done
        )
        [[ ${UUID} ]] || continue
        printf "%s" " rd.luks.uuid=luks-${UUID}"
    done
}

# called by dracut
install() {

    if [[ $hostonly_cmdline == "yes" ]]; then
        local _cryptconf
        _cryptconf=$(cmdline)
        [[ $_cryptconf ]] && printf "%s\n" "$_cryptconf" >> "${initdir}/etc/cmdline.d/90crypt.conf"
    fi

    inst_hook cmdline 30 "$moddir/parse-crypt.sh"
    if ! dracut_module_included "systemd"; then
        inst_multiple cryptsetup rmdir readlink umount
        inst_script "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
        inst_script "$moddir"/probe-keydev.sh /sbin/probe-keydev
        inst_hook cmdline 10 "$moddir/parse-keydev.sh"
        inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
    fi

    if [[ $hostonly ]] && [[ -f $dracutsysrootdir/etc/crypttab ]]; then
        # filter /etc/crypttab for the devices we need
        while read -r _mapper _dev _luksfile _luksoptions || [ -n "$_mapper" ]; do
            [[ $_mapper == \#* ]] && continue
            [[ $_dev ]] || continue

            [[ $_dev == PARTUUID=* ]] \
                && _dev="/dev/disk/by-partuuid/${_dev#PARTUUID=}"

            [[ $_dev == UUID=* ]] \
                && _dev="/dev/disk/by-uuid/${_dev#UUID=}"

            [[ $_dev == ID=* ]] \
                && _dev="/dev/disk/by-id/${_dev#ID=}"

            echo "$_dev $(blkid "$_dev" -s UUID -o value)" >> "${initdir}/etc/block_uuid.map"

            # loop through the options to check for the force option
            luksoptions=${_luksoptions}
            OLD_IFS="${IFS}"
            IFS=,
            # shellcheck disable=SC2086
            set -- ${luksoptions}
            IFS="${OLD_IFS}"

            forceentry=""
            while [ $# -gt 0 ]; do
                case $1 in
                    force)
                        forceentry="yes"
                        break
                        ;;
                esac
                shift
            done

            # include the entry regardless
            if [ "${forceentry}" = "yes" ]; then
                echo "$_mapper $_dev $_luksfile $_luksoptions"
            else
                # shellcheck disable=SC2031
                for _hdev in "${!host_fs_types[@]}"; do
                    [[ ${host_fs_types[$_hdev]} == "crypto_LUKS" ]] || continue
                    if [[ $_hdev -ef $_dev ]] || [[ /dev/block/$_hdev -ef $_dev ]]; then
                        echo "$_mapper $_dev $_luksfile $_luksoptions"
                        break
                    fi
                done
            fi
        done < "$dracutsysrootdir"/etc/crypttab > "$initdir"/etc/crypttab
        mark_hostonly /etc/crypttab
    fi

    inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
    inst_script "$moddir/crypt-run-generator.sh" "/sbin/crypt-run-generator"

    if dracut_module_included "systemd"; then
        # the cryptsetup targets are already pulled in by 00systemd, but not
        # the enablement symlinks
        inst_multiple -o \
            "$tmpfilesdir"/cryptsetup.conf \
            "$systemdutildir"/system-generators/systemd-cryptsetup-generator \
            "$systemdutildir"/systemd-cryptsetup \
            "$systemdsystemunitdir"/systemd-ask-password-console.path \
            "$systemdsystemunitdir"/systemd-ask-password-console.service \
            "$systemdsystemunitdir"/cryptsetup.target \
            "$systemdsystemunitdir"/sysinit.target.wants/cryptsetup.target \
            "$systemdsystemunitdir"/remote-cryptsetup.target \
            "$systemdsystemunitdir"/initrd-root-device.target.wants/remote-cryptsetup.target \
            systemd-ask-password systemd-tty-ask-password-agent
    fi

    dracut_need_initqueue
}
  07070100000101000081ED00000000000000000000000164DF2CB800001F91000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90crypt/parse-crypt.sh    #!/bin/sh

type crypttab_contains > /dev/null 2>&1 || . /lib/dracut-crypt-lib.sh

_cryptgetargsname() {
    debug_off
    local _o _found _key
    unset _o
    unset _found
    _key="$1"
    set --
    for _o in $(getargs rd.luks.name); do
        if [ "${_o%=*}" = "${_key%=}" ]; then
            [ -n "${_o%=*}" ] && set -- "$@" "${_o#*=}"
            _found=1
        fi
    done
    if [ -n "$_found" ]; then
        [ $# -gt 0 ] && printf '%s' "$*"
        return 0
    fi
    return 1
}

if ! getargbool 1 rd.luks -d -n rd_NO_LUKS; then
    info "rd.luks=0: removing cryptoluks activation"
    rm -f -- /etc/udev/rules.d/70-luks.rules
else
    {
        echo 'SUBSYSTEM!="block", GOTO="luks_end"'
        echo 'ACTION!="add|change", GOTO="luks_end"'
    } > /etc/udev/rules.d/70-luks.rules.new

    PARTUUID=$(getargs rd.luks.partuuid -d rd_LUKS_PARTUUID)
    SERIAL=$(getargs rd.luks.serial -d rd_LUKS_SERIAL)
    LUKS=$(getargs rd.luks.uuid -d rd_LUKS_UUID)
    tout=$(getarg rd.luks.key.tout)

    if [ -e /etc/crypttab ]; then
        while read -r _ _dev _ || [ -n "$_dev" ]; do
            set_systemd_timeout_for_dev "$_dev"
        done < /etc/crypttab
    fi

    if [ -n "$PARTUUID" ]; then
        for uuid in $PARTUUID; do

            is_keysource=0
            _uuid=$uuid
            uuid=${uuid#keysource:}
            [ "$uuid" != "$_uuid" ] && is_keysource=1
            unset _uuid

            uuid=${uuid##luks-}
            if luksname=$(_cryptgetargsname "$uuid="); then
                luksname="${luksname#$uuid=}"
            else
                luksname="luks-$uuid"
            fi

            if [ -z "$DRACUT_SYSTEMD" ]; then
                {
                    printf -- 'ENV{ID_PART_ENTRY_UUID}=="*%s*", ' "$uuid"
                    printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
                    printf -- '--name cryptroot-ask-%%k %s ' "$(command -v cryptroot-ask)"
                    # shellcheck disable=SC2016
                    printf -- '$env{DEVNAME} %s %s %s"\n' "$luksname" "$is_keysource" "$tout"
                } >> /etc/udev/rules.d/70-luks.rules.new
            else
                luksname=$(dev_unit_name "$luksname")
                # shellcheck disable=SC1003
                luksname="$(str_replace "$luksname" '\' '\\')"

                if ! crypttab_contains "$uuid"; then
                    {
                        printf -- 'ENV{ID_PART_ENTRY_UUID}=="*%s*", ' "$uuid"
                        printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
                        printf -- '--name systemd-cryptsetup-%%k %s start ' "$(command -v systemctl)"
                        printf -- 'systemd-cryptsetup@%s.service"\n' "$luksname"
                    } >> /etc/udev/rules.d/70-luks.rules.new
                fi
            fi
        done

    elif [ -n "$SERIAL" ]; then
        for serialid in $SERIAL; do

            is_keysource=0
            _serialid=$serialid
            serialid=${serialid#keysource:}
            [ "$serialid" != "$_serialid" ] && is_keysource=1
            unset _serialid

            serialid=${serialid##luks-}
            if luksname=$(_cryptgetargsname "$serialid="); then
                luksname="${luksname#$serialid=}"
            else
                luksname="luks-$serialid"
            fi

            if [ -z "$DRACUT_SYSTEMD" ]; then
                {
                    printf -- 'ENV{ID_SERIAL_SHORT}=="*%s*", ' "$serialid"
                    printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
                    printf -- '--name cryptroot-ask-%%k %s ' "$(command -v cryptroot-ask)"
                    # shellcheck disable=SC2016
                    printf -- '$env{DEVNAME} %s %s %s"\n' "$luksname" "$is_keysource" "$tout"
                } >> /etc/udev/rules.d/70-luks.rules.new
            else
                luksname=$(dev_unit_name "$luksname")
                # shellcheck disable=SC1003
                luksname="$(str_replace "$luksname" '\' '\\')"

                if ! crypttab_contains "$serialid"; then
                    {
                        printf -- 'ENV{ID_SERIAL_SHORT}=="*%s*", ' "$serialid"
                        printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
                        printf -- '--name systemd-cryptsetup-%%k %s start ' "$(command -v systemctl)"
                        printf -- 'systemd-cryptsetup@%s.service"\n' "$luksname"
                    } >> /etc/udev/rules.d/70-luks.rules.new
                fi
            fi
        done

    elif [ -n "$LUKS" ]; then
        for luksid in $LUKS; do

            is_keysource=0
            _luksid=$luksid
            luksid=${luksid#keysource:}
            [ "$luksid" != "$_luksid" ] && is_keysource=1
            unset _luksid

            luksid=${luksid##luks-}
            if luksname=$(_cryptgetargsname "$luksid="); then
                luksname="${luksname#$luksid=}"
            else
                luksname="luks-$luksid"
            fi

            if [ -z "$DRACUT_SYSTEMD" ]; then
                {
                    printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
                    printf -- 'ENV{ID_FS_UUID}=="*%s*", ' "$luksid"
                    printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
                    printf -- '--name cryptroot-ask-%%k %s ' "$(command -v cryptroot-ask)"
                    # shellcheck disable=SC2016
                    printf -- '$env{DEVNAME} %s %s %s"\n' "$luksname" "$is_keysource" "$tout"
                } >> /etc/udev/rules.d/70-luks.rules.new
            else
                luksname=$(dev_unit_name "$luksname")
                # shellcheck disable=SC1003
                luksname="$(str_replace "$luksname" '\' '\\')"

                if ! crypttab_contains "$luksid"; then
                    {
                        printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
                        printf -- 'ENV{ID_FS_UUID}=="*%s*", ' "$luksid"
                        printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
                        printf -- '--name systemd-cryptsetup-%%k %s start ' "$(command -v systemctl)"
                        printf -- 'systemd-cryptsetup@%s.service"\n' "$luksname"
                    } >> /etc/udev/rules.d/70-luks.rules.new
                fi
            fi

            if [ $is_keysource -eq 0 ]; then
                uuid=$luksid
                while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done
                printf -- '[ -e /dev/disk/by-id/dm-uuid-CRYPT-LUKS?-*%s*-* ] || exit 1\n' "$uuid" \
                    >> "$hookdir/initqueue/finished/90-crypt.sh"
                {
                    printf -- '[ -e /dev/disk/by-uuid/*%s* ] || ' "$luksid"
                    printf -- 'warn "crypto LUKS UUID "%s" not found"\n' "$luksid"
                } >> "$hookdir/emergency/90-crypt.sh"
            fi
        done
    elif getargbool 0 rd.auto; then
        if [ -z "$DRACUT_SYSTEMD" ]; then
            {
                printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' "$(command -v initqueue)"
                printf -- '--unique --settled --onetime --name cryptroot-ask-%%k '
                # shellcheck disable=SC2016
                printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' "$(command -v cryptroot-ask)" "$tout"
            } >> /etc/udev/rules.d/70-luks.rules.new
        else
            {
                printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' "$(command -v initqueue)"
                printf -- '--unique --settled --onetime --name crypt-run-generator-%%k '
                # shellcheck disable=SC2016
                printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' "$(command -v crypt-run-generator)"
            } >> /etc/udev/rules.d/70-luks.rules.new
        fi
    fi

    echo 'LABEL="luks_end"' >> /etc/udev/rules.d/70-luks.rules.new
    mv /etc/udev/rules.d/70-luks.rules.new /etc/udev/rules.d/70-luks.rules
fi
   07070100000102000081ED00000000000000000000000164DF2CB800000561000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/modules.d/90crypt/parse-keydev.sh   #!/bin/sh

if getargbool 1 rd.luks -n rd_NO_LUKS \
    && [ -n "$(getarg rd.luks.key)" ]; then
    exec 7> /etc/udev/rules.d/65-luks-keydev.rules
    echo 'SUBSYSTEM!="block", GOTO="luks_keydev_end"' >&7
    echo 'ACTION!="add|change", GOTO="luks_keydev_end"' >&7

    for arg in $(getargs rd.luks.key); do
        unset keypath keydev luksdev
        splitsep : "$arg" keypath keydev luksdev

        info "rd.luks.key: keypath='$keypath' keydev='$keydev' luksdev='$luksdev'"

        if [ -z "$keypath" ]; then
            warn 'keypath required!'
            continue
        fi

        # A keydev of '/' is treated as the initrd itself
        if [ "/" = "$keydev" ]; then
            [ -z "$luksdev" ] && luksdev='*'
            echo "$luksdev:$keydev:$keypath" >> /tmp/luks.keys
            continue
        elif [ -n "$keydev" ]; then
            udevmatch "$keydev" >&7 || {
                warn 'keydev incorrect!'
                continue
            }
            printf ', ' >&7
        fi

        {
            printf -- 'RUN+="%s --unique --onetime ' "$(command -v initqueue)"
            printf -- '--name probe-keydev-%%k '
            printf -- '%s /dev/%%k %s %s"\n' \
                "$(command -v probe-keydev)" "${keypath}" "${luksdev}"
        } >&7
    done
    unset arg keypath keydev luksdev

    echo 'LABEL="luks_keydev_end"' >&7
    exec 7>&-
fi
   07070100000103000081ED00000000000000000000000164DF2CB80000017B000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/modules.d/90crypt/probe-keydev.sh   #!/bin/sh

. /lib/dracut-crypt-lib.sh

real_keydev="$1"
keypath="$2"
luksdev="$3"

[ -z "$real_keydev" -o -z "$keypath" ] && die 'probe-keydev: wrong usage!'
[ -z "$luksdev" ] && luksdev='*'

info "Probing $real_keydev for $keypath..."
test_dev -f "$real_keydev" "$keypath" || exit 1

info "Found $keypath on $real_keydev"
echo "$luksdev:$real_keydev:$keypath" >> /tmp/luks.keys
 07070100000104000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dm  07070100000105000081A400000000000000000000000164DF2CB80000008E000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dm/11-dm.rules  SUBSYSTEM!="block", GOTO="dm_end"
KERNEL!="dm-[0-9]*", GOTO="dm_end"
ACTION!="add|change", GOTO="dm_end"
OPTIONS+="db_persist"
LABEL="dm_end"
  07070100000106000081A400000000000000000000000164DF2CB80000029D000000000000000000000000000000000000004C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dm/59-persistent-storage-dm.rules   SUBSYSTEM!="block", GOTO="dm_end"
ACTION!="add|change", GOTO="dm_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="dm_end"

KERNEL!="dm-[0-9]*", GOTO="dm_end"
ACTION=="add", GOTO="dm_end"
IMPORT{program}="/sbin/dmsetup info -c --nameprefixes --unquoted --rows --noheadings -o name,uuid,suspended,readonly,major,minor,open,tables_loaded,names_using_dev -j%M -m%m"
ENV{DM_NAME}!="?*", GOTO="dm_end"
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="dm_end"
ENV{DM_UUID}=="CRYPT-TEMP-?*", GOTO="dm_end"
ENV{DM_UUID}!="?*", ENV{DM_NAME}=="temporary-cryptsetup-?*", GOTO="dm_end"
IMPORT BLKID

LABEL="dm_end"
   07070100000107000081ED00000000000000000000000164DF2CB800000067000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dm/dm-pre-udev.sh   #!/bin/sh

strstr "$(cat /proc/misc)" device-mapper || modprobe dm_mod
modprobe dm_mirror 2> /dev/null
 07070100000108000081ED00000000000000000000000164DF2CB8000004E9000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dm/dm-shutdown.sh   #!/bin/sh

_remove_dm() {
    local dev=$1
    local s
    local devname

    for s in /sys/block/"${dev}"/holders/dm-*; do
        [ -e "${s}" ] || continue
        _remove_dm "${s##*/}"
    done
    # multipath devices might have MD devices on top,
    # which are removed after this script. So do not
    # remove those to avoid spurious errors
    case $(cat /sys/block/"${dev}"/dm/uuid) in
        mpath-*)
            return 0
            ;;
        *)
            devname=$(cat /sys/block/"${dev}"/dm/name)
            dmsetup -v --noudevsync remove "$devname" || return $?
            ;;
    esac
    return 0
}

_do_dm_shutdown() {
    local ret=0
    local final=$1
    local dev

    info "Disassembling device-mapper devices"
    for dev in /sys/block/dm-*; do
        [ -e "${dev}" ] || continue
        if [ "x$final" != "x" ]; then
            _remove_dm "${dev##*/}" || ret=$?
        else
            _remove_dm "${dev##*/}" > /dev/null 2>&1 || ret=$?
        fi
    done
    if [ "x$final" != "x" ]; then
        info "dmsetup ls --tree"
        dmsetup ls --tree 2>&1 | vinfo
    fi
    return $ret
}

if command -v dmsetup > /dev/null \
    && [ "x$(dmsetup status)" != "xNo devices found" ]; then
    _do_dm_shutdown "$1"
else
    :
fi
   07070100000109000081ED00000000000000000000000164DF2CB8000003F1000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dm/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    require_binaries dmsetup || return 1
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
installkernel() {
    instmods '=drivers/md' dm_mod dm-cache dm-cache-mq dm-cache-cleaner
}

# called by dracut
install() {
    modinfo -k "$kernel" dm_mod > /dev/null 2>&1 \
        && inst_hook pre-udev 30 "$moddir/dm-pre-udev.sh"

    inst_multiple dmsetup
    inst_multiple -o dmeventd

    inst_libdir_file "libdevmapper-event.so*"

    inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
    # Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
    # files, but provides the one below:
    inst_rules 64-device-mapper.rules
    # debian udev rules
    inst_rules 60-persistent-storage-dm.rules 55-dm.rules

    inst_rules "$moddir/11-dm.rules"

    inst_rules "$moddir/59-persistent-storage-dm.rules"
    prepare_udev_rules 59-persistent-storage-dm.rules

    inst_hook shutdown 25 "$moddir/dm-shutdown.sh"
}
   0707010000010A000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmraid  0707010000010B000081A400000000000000000000000164DF2CB800000399000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmraid/61-dmraid-imsm.rules # This file causes block devices with RAID (dmraid) signatures to
# automatically cause dmraid_scan to be run.
# See udev(8) for syntax

SUBSYSTEM!="block", GOTO="dm_end"
ACTION!="add|change", GOTO="dm_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="dm_end"

ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="dm_end"

ENV{ID_FS_TYPE}!="*_raid_member", GOTO="dm_end"

ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}!="?*", GOTO="dm_end"
ENV{ID_FS_TYPE}=="ddf_raid_member", ENV{rd_NO_MDDDF}!="?*", GOTO="dm_end"

ENV{rd_NO_DM}=="?*", GOTO="dm_end"

OPTIONS:="nowatch"

ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="dm_end"

PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/dm-[0-9]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
    GOTO="dm_end"

RUN+="/sbin/initqueue --onetime --unique --settled /sbin/dmraid_scan $env{DEVNAME}"

LABEL="dm_end"
   0707010000010C000081ED00000000000000000000000164DF2CB8000004AA000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmraid/dmraid.sh    #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

devenc=$(str_replace "$1" '/' '\2f')

[ -e /tmp/dmraid."$devenc" ] && exit 0

: > /tmp/dmraid."$devenc"

DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=)

if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
    # run dmraid if udev has settled
    info "Scanning for dmraid devices $DM_RAIDS"
    SETS=$(dmraid -c -s)

    if [ "$SETS" = "no raid disks" -o "$SETS" = "no raid sets" ]; then
        return
    fi

    info "Found dmraid sets:"
    echo "$SETS" | vinfo

    if [ -n "$DM_RAIDS" ]; then
        # only activate specified DM RAIDS
        for r in $DM_RAIDS; do
            for s in $SETS; do
                if [ "${s##$r}" != "$s" ]; then
                    info "Activating $s"
                    dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
                fi
            done
        done
    else
        # scan and activate all DM RAIDS
        for s in $SETS; do
            info "Activating $s"
            dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
            [ -e "/dev/mapper/$s" ] && kpartx -a "/dev/mapper/$s" 2>&1 | vinfo
            udevsettle
        done
    fi

    need_shutdown
fi
  0707010000010D000081ED00000000000000000000000164DF2CB80000086C000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmraid/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    local holder
    local dev

    # if we don't have dmraid installed on the host system, no point
    # in trying to support it in the initramfs.
    require_binaries dmraid || return 1
    require_binaries kpartx || return 1

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for dev in "${!host_fs_types[@]}"; do
            [[ ${host_fs_types[$dev]} != *_raid_member ]] && continue

            DEVPATH=$(get_devpath_block "$dev")

            for holder in "$DEVPATH"/holders/*; do
                [[ -e $holder ]] || continue
                [[ -e "$holder/dm" ]] && return 0
                break
            done

        done
        return 255
    }

    return 0
}

# called by dracut
depends() {
    echo dm rootfs-block
    return 0
}

# called by dracut
cmdline() {
    local dev
    local -A _activated

    for dev in "${!host_fs_types[@]}"; do
        local holder DEVPATH DM_NAME
        [[ ${host_fs_types[$dev]} != *_raid_member ]] && continue

        DEVPATH=$(get_devpath_block "$dev")

        for holder in "$DEVPATH"/holders/*; do
            [[ -e $holder ]] || continue
            dev="/dev/${holder##*/}"
            DM_NAME="$(dmsetup info -c --noheadings -o name "$dev" 2> /dev/null)"
            [[ ${DM_NAME} ]] && break
        done

        [[ ${DM_NAME} ]] || continue

        if ! [[ ${_activated[${DM_NAME}]} ]]; then
            printf "%s" " rd.dm.uuid=${DM_NAME}"
            _activated["${DM_NAME}"]=1
        fi
    done
}

# called by dracut
install() {
    local _raidconf

    if [[ $hostonly_cmdline == "yes" ]]; then
        _raidconf=$(cmdline)
        [[ $_raidconf ]] && printf "%s\n" "$_raidconf" >> "${initdir}/etc/cmdline.d/90dmraid.conf"
    fi

    inst_multiple dmraid
    inst_multiple -o kpartx
    inst "$(command -v partx)" /sbin/partx

    inst "$moddir/dmraid.sh" /sbin/dmraid_scan

    inst_rules 66-kpartx.rules 67-kpartx-compat.rules

    inst_libdir_file "libdmraid-events*.so*"

    inst_rules "$moddir/61-dmraid-imsm.rules"
    #inst "$moddir/dmraid-cleanup.sh" /sbin/dmraid-cleanup
    inst_hook pre-trigger 30 "$moddir/parse-dm.sh"
}
0707010000010E000081ED00000000000000000000000164DF2CB80000033A000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmraid/parse-dm.sh  #!/bin/sh

# nodmraid for anaconda / rc.sysinit compatibility
if ! getargbool 1 rd.dm -d -n rd_NO_DM || getarg "rd.dm=0" -d nodmraid; then
    info "rd.dm=0: removing DM RAID activation"
    udevproperty rd_NO_DM=1
fi

if ! command -v mdadm > /dev/null \
    || ! getargbool 1 rd.md.imsm -d -n rd_NO_MDIMSM -n noiswmd \
    || ! getargbool 1 rd.md -d -n rd_NO_MD; then
    info "rd.md.imsm=0: no MD RAID for imsm/isw raids"
    udevproperty rd_NO_MDIMSM=1
fi

if ! command -v mdadm > /dev/null \
    || ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd \
    || ! getargbool 1 rd.md -d -n rd_NO_MD; then
    info "rd.md.ddf=0: no MD RAID for SNIA ddf raids"
    udevproperty rd_NO_MDDDF=1
fi

DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=)

if [ -z "$DM_RAIDS" ] && ! getargbool 0 rd.auto; then
    udevproperty rd_NO_DM=1
fi
  0707010000010F000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003800000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmsquash-live   07070100000110000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmsquash-live-ntfs  07070100000111000081ED00000000000000000000000164DF2CB80000012C000000000000000000000000000000000000004D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmsquash-live-ntfs/module-setup.sh  #!/bin/bash

command -v

check() {
    require_binaries ntfs-3g || return 1
    return 255
}

depends() {
    echo dmsquash-live
    return 0
}

install() {
    inst_multiple fusermount ulockmgr_server mount.fuse ntfs-3g
    dracut_need_initqueue
}

installkernel() {
    hostonly='' instmods fuse
}
07070100000112000081ED00000000000000000000000164DF2CB80000032C000000000000000000000000000000000000004E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmsquash-live/apply-live-updates.sh #!/bin/sh

if [ -h /dev/root ] && [ -d /run/initramfs/live/updates -o -d /updates ]; then
    info "Applying updates to live image..."
    mount -o bind /run "$NEWROOT"/run
    # avoid overwriting symlinks (e.g. /lib -> /usr/lib) with directories
    for d in /updates /run/initramfs/live/updates; do
        [ -d "$d" ] || continue
        (
            cd "$d" || return 0
            find . -depth -type d -exec mkdir -p "$NEWROOT/{}" \;
            find . -depth \! -type d -exec cp -a "{}" "$NEWROOT/{}" \;
        )
    done
    umount "$NEWROOT"/run
fi
# release resources on iso-scan boots with rd.live.ram
if [ -d /run/initramfs/isoscan ] \
    && [ -f /run/initramfs/squashed.img -o -f /run/initramfs/rootfs.img ]; then
    umount --detach-loop /run/initramfs/live
    umount /run/initramfs/isoscan
fi
07070100000113000081A400000000000000000000000164DF2CB80000010C000000000000000000000000000000000000004D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmsquash-live/checkisomd5@.service  [Unit]
Description=Media check on %f
DefaultDependencies=no
Before=shutdown.target

[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/bin/checkisomd5 --verbose %f
StandardInput=tty-force
StandardOutput=inherit
StandardError=inherit
TimeoutSec=0
SuccessExitStatus=2
07070100000114000081ED00000000000000000000000164DF2CB800000968000000000000000000000000000000000000004E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmsquash-live/dmsquash-generator.sh #!/bin/bash

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

[ -z "$root" ] && root=$(getarg root=)

# support legacy syntax of passing liveimg and then just the base root
if getargbool 0 rd.live.image -d -y liveimg; then
    liveroot="live:$root"
fi

if [ "${root%%:*}" = "live" ]; then
    liveroot=$root
fi

[ "${liveroot%%:*}" = "live" ] || exit 0

case "$liveroot" in
    live:LABEL=* | LABEL=* | live:UUID=* | UUID=* | live:PARTUUID=* | PARTUUID=* | live:PARTLABEL=* | PARTLABEL=*)
        root="live:$(label_uuid_to_dev "${root#live:}")"
        rootok=1
        ;;
    live:CDLABEL=* | CDLABEL=*)
        root="${root#live:}"
        root="$(echo "$root" | sed 's,/,\\x2f,g;s, ,\\x20,g')"
        root="live:/dev/disk/by-label/${root#CDLABEL=}"
        rootok=1
        ;;
    live:/*.[Ii][Ss][Oo] | /*.[Ii][Ss][Oo])
        root="${root#live:}"
        root="liveiso:${root}"
        rootok=1
        ;;
    live:/dev/*)
        rootok=1
        ;;
    live:/*.[Ii][Mm][Gg] | /*.[Ii][Mm][Gg])
        [ -f "${root#live:}" ] && rootok=1
        ;;
esac

[ "$rootok" != "1" ] && exit 0

GENERATOR_DIR="$2"
[ -z "$GENERATOR_DIR" ] && exit 1
[ -d "$GENERATOR_DIR" ] || mkdir -p "$GENERATOR_DIR"

getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"
[ -e /xor_overlayfs ] && xor_overlayfs="yes"
[ -e /xor_readonly ] && xor_readonly="--readonly"
ROOTFLAGS="$(getarg rootflags)"
{
    echo "[Unit]"
    echo "Before=initrd-root-fs.target"
    echo "[Mount]"
    echo "Where=/sysroot"
    if [ "$overlayfs$xor_overlayfs" = "yes" ]; then
        echo "What=LiveOS_rootfs"
        if [ "$readonly_overlay$xor_readonly" = "--readonly" ]; then
            ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
        else
            ovlfs=lowerdir=/run/rootfsbase
        fi
        echo "Options=${ROOTFLAGS},${ovlfs},upperdir=/run/overlayfs,workdir=/run/ovlwork"
        echo "Type=overlay"
        _dev=LiveOS_rootfs
    else
        echo "What=/dev/mapper/live-rw"
        [ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
        _dev=$'dev-mapper-live\\x2drw'
    fi
} > "$GENERATOR_DIR"/sysroot.mount

mkdir -p "$GENERATOR_DIR/$_dev.device.d"
{
    echo "[Unit]"
    echo "JobTimeoutSec=3000"
    echo "JobRunningTimeoutSec=3000"
} > "$GENERATOR_DIR/$_dev.device.d/timeout.conf"
07070100000115000081ED00000000000000000000000164DF2CB8000002A7000000000000000000000000000000000000005200000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmsquash-live/dmsquash-live-genrules.sh #!/bin/sh

case "$root" in
    live:/dev/*)
        {
            printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root %s"\n' \
                "${root#live:/dev/}" "${root#live:}"
            printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root %s"\n' \
                "${root#live:/dev/}" "${root#live:}"
        } >> /etc/udev/rules.d/99-live-squash.rules
        wait_for_dev -n "${root#live:}"
        ;;
    live:*)
        if [ -f "${root#live:}" ]; then
            /sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root "${root#live:}"
        fi
        ;;
esac
 07070100000116000081ED00000000000000000000000164DF2CB800003CDC000000000000000000000000000000000000004E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmsquash-live/dmsquash-live-root.sh #!/bin/bash

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

command -v unpack_archive > /dev/null || . /lib/img-lib.sh

PATH=/usr/sbin:/usr/bin:/sbin:/bin

if getargbool 0 rd.live.debug -n -y rdlivedebug; then
    exec > /tmp/liveroot.$$.out
    exec 2>> /tmp/liveroot.$$.out
    set -x
fi

[ -z "$1" ] && exit 1
livedev="$1"

# parse various live image specific options that make sense to be
# specified as their own things
live_dir=$(getarg rd.live.dir -d live_dir)
[ -z "$live_dir" ] && live_dir="LiveOS"
squash_image=$(getarg rd.live.squashimg)
[ -z "$squash_image" ] && squash_image="squashfs.img"

getargbool 0 rd.live.ram -d -y live_ram && live_ram="yes"
getargbool 0 rd.live.overlay.reset -d -y reset_overlay && reset_overlay="yes"
getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
overlay=$(getarg rd.live.overlay -d overlay)
getargbool 0 rd.writable.fsimg -d -y writable_fsimg && writable_fsimg="yes"
overlay_size=$(getarg rd.live.overlay.size=)
[ -z "$overlay_size" ] && overlay_size=32768

getargbool 0 rd.live.overlay.thin && thin_snapshot="yes"
getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"

# CD/DVD media check
[ -b "$livedev" ] && fs=$(blkid -s TYPE -o value "$livedev")
if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
    check="yes"
fi
getarg rd.live.check -d check || check=""
if [ -n "$check" ]; then
    type plymouth > /dev/null 2>&1 && plymouth --hide-splash
    if [ -n "$DRACUT_SYSTEMD" ]; then
        p=$(dev_unit_name "$livedev")
        systemctl start checkisomd5@"${p}".service
    else
        checkisomd5 --verbose "$livedev"
    fi
    if [ $? -eq 1 ]; then
        die "CD check failed!"
        exit 1
    fi
    type plymouth > /dev/null 2>&1 && plymouth --show-splash
fi

ln -s "$livedev" /run/initramfs/livedev

# determine filesystem type for a filesystem image
det_img_fs() {
    udevadm settle >&2
    blkid -s TYPE -u noraid -o value "$1"
}

modprobe squashfs
CMDLINE=$(getcmdline)
for arg in $CMDLINE; do
    case $arg in
        ro | rw) liverw=$arg ;;
    esac
done

# mount the backing of the live image first
mkdir -m 0755 -p /run/initramfs/live
if [ -f "$livedev" ]; then
    # no mount needed - we've already got the LiveOS image in initramfs
    # check filesystem type and handle accordingly
    fstype=$(det_img_fs "$livedev")
    case $fstype in
        squashfs) SQUASHED=$livedev ;;
        auto) die "cannot mount live image (unknown filesystem type)" ;;
        *) FSIMG=$livedev ;;
    esac
    [ -e /sys/fs/"$fstype" ] || modprobe "$fstype"
else
    livedev_fstype=$(blkid -o value -s TYPE "$livedev")
    if [ "$livedev_fstype" = "squashfs" ]; then
        # no mount needed - we've already got the LiveOS image in $livedev
        SQUASHED=$livedev
    elif [ "$livedev_fstype" != "ntfs" ]; then
        if ! mount -n -t "$fstype" -o "${liverw:-ro}" "$livedev" /run/initramfs/live; then
            die "Failed to mount block device of live image"
            exit 1
        fi
    else
        # Symlinking /usr/bin/ntfs-3g as /sbin/mount.ntfs seems to boot
        # at the first glance, but ends with lots and lots of squashfs
        # errors, because systemd attempts to kill the ntfs-3g process?!
        if [ -x "/usr/bin/ntfs-3g" ]; then
            (exec -a @ntfs-3g ntfs-3g -o "${liverw:-ro}" "$livedev" /run/initramfs/live) | vwarn
        else
            die "Failed to mount block device of live image: Missing NTFS support"
            exit 1
        fi
    fi
fi

# overlay setup helper function
do_live_overlay() {
    # create a sparse file for the overlay
    # overlay: if non-ram overlay searching is desired, do it,
    #              otherwise, create traditional overlay in ram

    l=$(blkid -s LABEL -o value "$livedev") || l=""
    u=$(blkid -s UUID -o value "$livedev") || u=""

    if [ -z "$overlay" ]; then
        pathspec="/${live_dir}/overlay-$l-$u"
    elif strstr "$overlay" ":"; then
        # pathspec specified, extract
        pathspec=${overlay##*:}
    fi

    if [ -z "$pathspec" -o "$pathspec" = "auto" ]; then
        pathspec="/${live_dir}/overlay-$l-$u"
    fi
    devspec=${overlay%%:*}

    # need to know where to look for the overlay
    if [ -z "$setup" -a -n "$devspec" -a -n "$pathspec" -a -n "$overlay" ]; then
        mkdir -m 0755 -p /run/initramfs/overlayfs
        mount -n -t auto "$devspec" /run/initramfs/overlayfs || :
        if [ -f /run/initramfs/overlayfs$pathspec -a -w /run/initramfs/overlayfs$pathspec ]; then
            OVERLAY_LOOPDEV=$(losetup -f --show ${readonly_overlay:+-r} /run/initramfs/overlayfs$pathspec)
            over=$OVERLAY_LOOPDEV
            umount -l /run/initramfs/overlayfs || :
            oltype=$(det_img_fs "$OVERLAY_LOOPDEV")
            if [ -z "$oltype" ] || [ "$oltype" = DM_snapshot_cow ]; then
                if [ -n "$reset_overlay" ]; then
                    info "Resetting the Device-mapper overlay."
                    dd if=/dev/zero of="$OVERLAY_LOOPDEV" bs=64k count=1 conv=fsync 2> /dev/null
                fi
                if [ -n "$overlayfs" ]; then
                    unset -v overlayfs
                    [ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit=":>/xor_overlayfs;"
                fi
                setup="yes"
            else
                mount -n -t "$oltype" ${readonly_overlay:+-r} "$OVERLAY_LOOPDEV" /run/initramfs/overlayfs
                if [ -d /run/initramfs/overlayfs/overlayfs ] \
                    && [ -d /run/initramfs/overlayfs/ovlwork ]; then
                    ln -s /run/initramfs/overlayfs/overlayfs /run/overlayfs${readonly_overlay:+-r}
                    ln -s /run/initramfs/overlayfs/ovlwork /run/ovlwork${readonly_overlay:+-r}
                    if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
                        reloadsysrootmountunit=":>/xor_overlayfs;"
                    fi
                    overlayfs="required"
                    setup="yes"
                fi
            fi
        elif [ -d /run/initramfs/overlayfs$pathspec ] \
            && [ -d /run/initramfs/overlayfs$pathspec/../ovlwork ]; then
            ln -s /run/initramfs/overlayfs$pathspec /run/overlayfs${readonly_overlay:+-r}
            ln -s /run/initramfs/overlayfs$pathspec/../ovlwork /run/ovlwork${readonly_overlay:+-r}
            if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
                reloadsysrootmountunit=":>/xor_overlayfs;"
            fi
            overlayfs="required"
            setup="yes"
        fi
    fi
    if [ -n "$overlayfs" ]; then
        if ! modprobe overlay; then
            if [ "$overlayfs" = required ]; then
                die "OverlayFS is required but not available."
                exit 1
            fi
            [ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit=":>/xor_overlayfs;"
            m='OverlayFS is not available; using temporary Device-mapper overlay.'
            info "$m"
            unset -v overlayfs setup
        fi
    fi

    if [ -z "$setup" -o -n "$readonly_overlay" ]; then
        if [ -n "$setup" ]; then
            warn "Using temporary overlay."
        elif [ -n "$devspec" -a -n "$pathspec" ]; then
            [ -z "$m" ] \
                && m='   Unable to find a persistent overlay; using a temporary one.'
            m="$m"$'\n      All root filesystem changes will be lost on shutdown.'
            m="$m"$'\n         Press [Enter] to continue.'
            printf "\n\n\n\n%s\n\n\n" "${m}" > /dev/kmsg
            if [ -n "$DRACUT_SYSTEMD" ]; then
                if type plymouth > /dev/null 2>&1 && plymouth --ping; then
                    if getargbool 0 rhgb || getargbool 0 splash; then
                        m='>>>'$'\n''>>>'$'\n''>>>'$'\n\n\n'"$m"
                        m="${m%n.*}"$'n.\n\n\n''<<<'$'\n''<<<'$'\n''<<<'
                        plymouth display-message --text="${m}"
                    else
                        plymouth ask-question --prompt="${m}" --command=true
                    fi
                else
                    m=">>>${m//.[[:space:]]/.}  <<<"
                    systemd-ask-password --timeout=0 "${m}"
                fi
            else
                type plymouth > /dev/null 2>&1 && plymouth --ping && plymouth --quit
                read -s -r -p $'\n\n'"${m}" -n 1 _
            fi
        fi
        if [ -n "$overlayfs" ]; then
            mkdir -m 0755 -p /run/overlayfs
            mkdir -m 0755 -p /run/ovlwork
            if [ -n "$readonly_overlay" ] && ! [ -h /run/overlayfs-r ]; then
                info "No persistent overlay found."
                unset -v readonly_overlay
                [ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="${reloadsysrootmountunit}:>/xor_readonly;"
            fi
        else
            dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((overlay_size * 1024)) 2> /dev/null
            if [ -n "$setup" -a -n "$readonly_overlay" ]; then
                RO_OVERLAY_LOOPDEV=$(losetup -f --show /overlay)
                over=$RO_OVERLAY_LOOPDEV
            else
                OVERLAY_LOOPDEV=$(losetup -f --show /overlay)
                over=$OVERLAY_LOOPDEV
            fi
        fi
    fi

    # set up the snapshot
    if [ -z "$overlayfs" ]; then
        if [ -n "$readonly_overlay" ] && [ -n "$OVERLAY_LOOPDEV" ]; then
            echo 0 "$sz" snapshot "$BASE_LOOPDEV" "$OVERLAY_LOOPDEV" P 8 | dmsetup create --readonly live-ro
            base="/dev/mapper/live-ro"
        else
            base=$BASE_LOOPDEV
        fi
    fi

    if [ -n "$thin_snapshot" ]; then
        modprobe dm_thin_pool
        mkdir -m 0755 -p /run/initramfs/thin-overlay

        # In block units (512b)
        thin_data_sz=$((overlay_size * 1024 * 1024 / 512))
        thin_meta_sz=$((thin_data_sz / 10))

        # It is important to have the backing file on a tmpfs
        # this is needed to let the loopdevice support TRIM
        dd if=/dev/null of=/run/initramfs/thin-overlay/meta bs=1b count=1 seek=$((thin_meta_sz)) 2> /dev/null
        dd if=/dev/null of=/run/initramfs/thin-overlay/data bs=1b count=1 seek=$((thin_data_sz)) 2> /dev/null

        THIN_META_LOOPDEV=$(losetup --show -f /run/initramfs/thin-overlay/meta)
        THIN_DATA_LOOPDEV=$(losetup --show -f /run/initramfs/thin-overlay/data)

        echo 0 $thin_data_sz thin-pool "$THIN_META_LOOPDEV" "$THIN_DATA_LOOPDEV" 1024 1024 | dmsetup create live-overlay-pool
        dmsetup message /dev/mapper/live-overlay-pool 0 "create_thin 0"

        # Create a snapshot of the base image
        echo 0 "$sz" thin /dev/mapper/live-overlay-pool 0 "$base" | dmsetup create live-rw
    elif [ -z "$overlayfs" ]; then
        echo 0 "$sz" snapshot "$base" "$over" PO 8 | dmsetup create live-rw
    fi

    # Create a device for the ro base of overlayed file systems.
    if [ -z "$overlayfs" ]; then
        echo 0 "$sz" linear "$BASE_LOOPDEV" 0 | dmsetup create --readonly live-base
    fi
    ln -s "$BASE_LOOPDEV" /dev/live-base
}
# end do_live_overlay()

# we might have an embedded fs image on squashfs (compressed live)
if [ -e /run/initramfs/live/${live_dir}/${squash_image} ]; then
    SQUASHED="/run/initramfs/live/${live_dir}/${squash_image}"
fi
if [ -e "$SQUASHED" ]; then
    if [ -n "$live_ram" ]; then
        echo 'Copying live image to RAM...' > /dev/kmsg
        echo ' (this may take a minute)' > /dev/kmsg
        dd if=$SQUASHED of=/run/initramfs/squashed.img bs=512 2> /dev/null
        echo 'Done copying live image to RAM.' > /dev/kmsg
        SQUASHED="/run/initramfs/squashed.img"
    fi

    SQUASHED_LOOPDEV=$(losetup -f)
    losetup -r "$SQUASHED_LOOPDEV" $SQUASHED
    mkdir -m 0755 -p /run/initramfs/squashfs
    mount -n -t squashfs -o ro "$SQUASHED_LOOPDEV" /run/initramfs/squashfs

    if [ -d /run/initramfs/squashfs/LiveOS ]; then
        if [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
            FSIMG="/run/initramfs/squashfs/LiveOS/rootfs.img"
        elif [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
            FSIMG="/run/initramfs/squashfs/LiveOS/ext3fs.img"
        fi
    elif [ -d /run/initramfs/squashfs/proc ]; then
        FSIMG=$SQUASHED
        if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
            reloadsysrootmountunit=":>/xor_overlayfs;"
        fi
        overlayfs="required"
    else
        die "Failed to find a root filesystem in $SQUASHED."
        exit 1
    fi
else
    # we might have an embedded fs image to use as rootfs (uncompressed live)
    if [ -e /run/initramfs/live/${live_dir}/rootfs.img ]; then
        FSIMG="/run/initramfs/live/${live_dir}/rootfs.img"
    elif [ -e /run/initramfs/live/${live_dir}/ext3fs.img ]; then
        FSIMG="/run/initramfs/live/${live_dir}/ext3fs.img"
    fi
    if [ -n "$live_ram" ]; then
        echo 'Copying live image to RAM...' > /dev/kmsg
        echo ' (this may take a minute or so)' > /dev/kmsg
        dd if=$FSIMG of=/run/initramfs/rootfs.img bs=512 2> /dev/null
        echo 'Done copying live image to RAM.' > /dev/kmsg
        FSIMG='/run/initramfs/rootfs.img'
    fi
fi

if [ -n "$FSIMG" ]; then
    if [ -n "$writable_fsimg" ]; then
        # mount the provided filesystem read/write
        echo "Unpacking live filesystem (may take some time)" > /dev/kmsg
        mkdir -m 0755 -p /run/initramfs/fsimg/
        if [ -n "$SQUASHED" ]; then
            cp -v $FSIMG /run/initramfs/fsimg/rootfs.img
        else
            unpack_archive $FSIMG /run/initramfs/fsimg/
        fi
        FSIMG=/run/initramfs/fsimg/rootfs.img
    fi
    # For writable DM images...
    readonly_base=1
    if [ -z "$SQUASHED" -a -n "$live_ram" -a -z "$overlayfs" ] \
        || [ -n "$writable_fsimg" ] \
        || [ "$overlay" = none -o "$overlay" = None -o "$overlay" = NONE ]; then
        if [ -z "$readonly_overlay" ]; then
            unset readonly_base
            setup=rw
        else
            setup=yes
        fi
    fi
    if [ "$FSIMG" = "$SQUASHED" ]; then
        BASE_LOOPDEV=$SQUASHED_LOOPDEV
    else
        BASE_LOOPDEV=$(losetup -f --show ${readonly_base:+-r} $FSIMG)
        sz=$(blockdev --getsz "$BASE_LOOPDEV")
    fi
    if [ "$setup" = rw ]; then
        echo 0 "$sz" linear "$BASE_LOOPDEV" 0 | dmsetup create live-rw
    else
        # Add a DM snapshot or OverlayFS for writes.
        do_live_overlay
    fi
fi

if [ -n "$reloadsysrootmountunit" ]; then
    eval "$reloadsysrootmountunit"
    systemctl daemon-reload
fi

ROOTFLAGS="$(getarg rootflags)"

if [ -n "$overlayfs" ]; then
    mkdir -m 0755 -p /run/rootfsbase
    if [ -n "$reset_overlay" ] && [ -h /run/overlayfs ]; then
        ovlfs=$(readlink /run/overlayfs)
        info "Resetting the OverlayFS overlay directory."
        rm -r -- "${ovlfs:?}"/* "${ovlfs:?}"/.* > /dev/null 2>&1
    fi
    if [ -n "$readonly_overlay" ] && [ -h /run/overlayfs-r ]; then
        ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
    else
        ovlfs=lowerdir=/run/rootfsbase
    fi
    mount -r $FSIMG /run/rootfsbase
    if [ -z "$DRACUT_SYSTEMD" ]; then
        printf 'mount -t overlay LiveOS_rootfs -o%s,%s %s\n' "$ROOTFLAGS" \
            "$ovlfs",upperdir=/run/overlayfs,workdir=/run/ovlwork \
            "$NEWROOT" > "$hookdir"/mount/01-$$-live.sh
    fi
else
    if [ -z "$DRACUT_SYSTEMD" ]; then
        [ -n "$ROOTFLAGS" ] && ROOTFLAGS="-o $ROOTFLAGS"
        printf 'mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > "$hookdir"/mount/01-$$-live.sh
    fi
fi
[ -e "$SQUASHED" ] && umount -l /run/initramfs/squashfs

ln -s null /dev/root

need_shutdown

exit 0
07070100000117000081ED00000000000000000000000164DF2CB800000147000000000000000000000000000000000000005500000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmsquash-live/dmsquash-liveiso-genrules.sh  #!/bin/sh

if [ "${root%%:*}" = "liveiso" ]; then
    {
        # shellcheck disable=SC2016
        printf 'KERNEL=="loop-control", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root `/sbin/losetup -f --show %s`"\n' \
            "${root#liveiso:}"
    } >> /etc/udev/rules.d/99-liveiso-mount.rules
fi
 07070100000118000081ED00000000000000000000000164DF2CB800000351000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmsquash-live/iso-scan.sh   #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

PATH=/usr/sbin:/usr/bin:/sbin:/bin

isofile=$1

[ -z "$isofile" ] && exit 1

ismounted "/run/initramfs/isoscan" && exit 0

mkdir -p "/run/initramfs/isoscan"

do_iso_scan() {
    local _name
    local dev
    for dev in /dev/disk/by-uuid/*; do
        _name=$(dev_unit_name "$dev")
        [ -e /tmp/isoscan-"${_name}" ] && continue
        : > /tmp/isoscan-"${_name}"
        mount -t auto -o ro "$dev" "/run/initramfs/isoscan" || continue
        if [ -f "/run/initramfs/isoscan/$isofile" ]; then
            losetup -f "/run/initramfs/isoscan/$isofile"
            ln -s "$dev" /run/initramfs/isoscandev
            rm -f -- "$job"
            exit 0
        else
            umount "/run/initramfs/isoscan"
        fi
    done
}

do_iso_scan

rmdir "/run/initramfs/isoscan"
exit 1
   07070100000119000081ED00000000000000000000000164DF2CB800000506000000000000000000000000000000000000004800000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmsquash-live/module-setup.sh   #!/bin/bash

# called by dracut
check() {
    # a live host-only image doesn't really make a lot of sense
    [[ $hostonly ]] && return 1
    return 255
}

# called by dracut
depends() {
    # if dmsetup is not installed, then we cannot support fedora/red hat
    # style live images
    echo dm rootfs-block img-lib bash
    return 0
}

# called by dracut
installkernel() {
    instmods squashfs loop iso9660 overlay
}

# called by dracut
install() {
    inst_multiple umount dmsetup blkid dd losetup blockdev find
    inst_multiple -o checkisomd5
    inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
    inst_hook cmdline 31 "$moddir/parse-iso-scan.sh"
    inst_hook pre-udev 30 "$moddir/dmsquash-live-genrules.sh"
    inst_hook pre-udev 30 "$moddir/dmsquash-liveiso-genrules.sh"
    inst_hook pre-pivot 20 "$moddir/apply-live-updates.sh"
    inst_script "$moddir/dmsquash-live-root.sh" "/sbin/dmsquash-live-root"
    inst_script "$moddir/iso-scan.sh" "/sbin/iso-scan"
    inst_script "$moddir/dmsquash-generator.sh" "$systemdutildir"/system-generators/dracut-dmsquash-generator
    # should probably just be generally included
    inst_rules 60-cdrom_id.rules
    inst_simple "$moddir/checkisomd5@.service" "/etc/systemd/system/checkisomd5@.service"
    dracut_need_initqueue
}
  0707010000011A000081ED00000000000000000000000164DF2CB8000004F4000000000000000000000000000000000000004F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmsquash-live/parse-dmsquash-live.sh    #!/bin/sh
# live images are specified with
# root=live:backingdev

[ -z "$root" ] && root=$(getarg root=)

# support legacy syntax of passing liveimg and then just the base root
if getargbool 0 rd.live.image -d -y liveimg; then
    liveroot="live:$root"
fi

if [ "${root%%:*}" = "live" ]; then
    liveroot=$root
fi

[ "${liveroot%%:*}" = "live" ] || return 1

modprobe -q loop

case "$liveroot" in
    live:LABEL=* | LABEL=* | live:UUID=* | UUID=* | live:PARTUUID=* | PARTUUID=* | live:PARTLABEL=* | PARTLABEL=*)
        root="live:$(label_uuid_to_dev "${root#live:}")"
        rootok=1
        ;;
    live:CDLABEL=* | CDLABEL=*)
        root="${root#live:}"
        root="$(echo "$root" | sed 's,/,\\x2f,g;s, ,\\x20,g')"
        root="live:/dev/disk/by-label/${root#CDLABEL=}"
        rootok=1
        ;;
    live:/*.[Ii][Ss][Oo] | /*.[Ii][Ss][Oo])
        root="${root#live:}"
        root="liveiso:${root}"
        rootok=1
        ;;
    live:/dev/*)
        rootok=1
        ;;
    live:/*.[Ii][Mm][Gg] | /*.[Ii][Mm][Gg])
        [ -f "${root#live:}" ] && rootok=1
        ;;
esac

[ "$rootok" = "1" ] || return 1

info "root was $liveroot, is now $root"

# make sure that init doesn't complain
[ -z "$root" ] && root="live"

wait_for_dev -n /dev/root

return 0
0707010000011B000081ED00000000000000000000000164DF2CB8000000C7000000000000000000000000000000000000004A00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90dmsquash-live/parse-iso-scan.sh #!/bin/sh
# live images are specified with
# root=live:backingdev

isofile=$(getarg iso-scan/filename)

if [ -n "$isofile" ]; then
    /sbin/initqueue --settled --unique /sbin/iso-scan "$isofile"
fi
 0707010000011C000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/modules.d/90kernel-modules  0707010000011D000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90kernel-modules-extra    0707010000011E000081ED00000000000000000000000164DF2CB8000018F7000000000000000000000000000000000000004F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90kernel-modules-extra/module-setup.sh    #!/bin/bash

# called by dracut
#
# Parses depmod configuration and calls instmods for out-of-tree kernel
# modules found.  Specifically, kernel modules inside directories that
# come from the following places are included (if these kernel modules
# are present in modules.dep):
#   - "search" configuration option;
#   - "override" configuration option (matching an exact file name constructed
#      by concatenating the provided directory and the kernel module name);
#   - "external" configuration option (if "external" is a part of "search"
#     configuration).
# (See depmod.d(5) for details.)
#
# This module has the following variables available for configuration:
#   - "depmod_modules_dep" - Path to the modules.dep file
#                            ("$srcmods/modules.dep" by default);
#   - "depmod_module_dir" - Directory containing kernel modules ("$srcmods"
#                           by default);
#   - "depmod_configs" - array of depmod configuration paths to parse
#                        (as supplied to depmod -C, ("/run/depmod.d/"
#                        "/etc/depmod.d/" "/lib/depmod.d/") by default).
installkernel() {
    : "${depmod_modules_dep:=$srcmods/modules.dep}"
    : "${depmod_module_dir:=$srcmods}"

    [[ -f ${depmod_modules_dep} ]] || return 0

    # Message printers with custom prefix
    local mod_name="kernel-modules-extra"
    prinfo() { dinfo "  ${mod_name}: $*"; }
    prdebug() { ddebug "  ${mod_name}: $*"; }

    # Escape a string for usage as a part of extended regular expression.
    # $1 - string to escape
    re_escape() {
        printf "%s" "$1" | sed 's/\([.+?^$\/\\|()\[]\|\]\)/\\\0/'
    }

    local cfg
    local cfgs=()
    local search_list=""
    local overrides=()
    local external_dirs=()
    local e f

    ## Gathering and sorting configuration file list

    [ -n "${depmod_configs[*]-}" ] \
        || depmod_configs=(/run/depmod.d /etc/depmod.d /lib/depmod.d)

    for cfg in "${depmod_configs[@]}"; do
        [ -e "$cfg" ] || {
            prdebug "configuration source \"$cfg\" does not exist"
            continue
        }

        # '/' is used as a separator between configuration name and
        # configuration path
        if [ -d "$cfg" ]; then
            for f in "$cfg/"*.conf; do
                [[ -e $f && ! -d $f ]] || {
                    prdebug "configuration source" \
                        "\"$cfg\" is ignored" \
                        "(directory or doesn't exist)"
                    continue
                }
                cfgs+=("${f##*/}/$f")
            done
        else
            cfgs+=("${cfg##*/}/$cfg")
        fi
    done

    if ((${#cfgs[@]} > 0)); then
        mapfile -t cfgs < <(printf '%s\n' "${cfgs[@]}" | LANG=C sort -u -k1,1 -t '/' | cut -f 2- -d '/')
    fi

    ## Parse configurations

    for cfg in "${cfgs[@]}"; do
        prdebug "parsing configuration file \"$cfg\""

        local k v mod kverpat path
        while read -r k v; do
            case "$k" in
                search)
                    search_list="$search_list $v"
                    prdebug "$cfg: added \"$v\" to the list of" \
                        "search directories"
                    ;;
                override) # module_name kver_pattern dir
                    read -r mod kverpat path <<< "$v"

                    if [[ ! $mod || ! $kverpat || ! $path ]]; then
                        prinfo "$cfg: ignoring incorrect" \
                            "override option: \"$k $v\""
                        continue
                    fi

                    if [[ '*' == "$kverpat" ]] \
                        || [[ $kernel =~ $kverpat ]]; then
                        overrides+=("${path}/${mod}")

                        prdebug "$cfg: added override" \
                            "\"${path}/${mod}\""
                    else
                        prdebug "$cfg: override \"$v\" is" \
                            "ignored since \"$kverpat\"" \
                            "doesn't match \"$kernel\""
                    fi
                    ;;
                external) # kverpat dir
                    read -r kverpat path <<< "$v"

                    if [[ ! $kverpat || ! $path ]]; then
                        prinfo "$cfg: ignoring incorrect" \
                            "external option: \"$k $v\""
                        continue
                    fi

                    if [[ '*' == "$kverpat" || \
                        $kernel =~ $kverpat ]]; then
                        external_dirs+=("$path")

                        prdebug "$cfg: added external" \
                            "directory \"$path\""
                    else
                        prdebug "$cfg: external directory" \
                            "\"$path\" is ignored since" \
                            "\"$kverpat\" doesn't match " \
                            "\"$kernel\""
                    fi
                    ;;
                '#'* | '') # comments and empty strings
                    ;;
                include | make_map_files) # ignored by depmod
                    ;;
                *)
                    prinfo "$cfg: unknown depmod configuration" \
                        "option \"$k $v\""
                    ;;
            esac
        done < "$cfg"
    done

    # "updates built-in" is the default search list
    : "${search_list:=updates}"

    ## Build a list of regular expressions for grepping modules.dep

    local pathlist=()
    for f in "${overrides[@]}"; do
        pathlist+=("^$(re_escape "$f")")
    done

    for f in $(printf "%s" "$search_list"); do
        # Ignoring builtin modules
        [[ $f == "built-in" ]] && continue

        if [[ $f == "external" ]]; then
            for e in "${external_dirs[@]}"; do
                pathlist+=("$(re_escape "${e%/}")/[^:]+")
            done
        fi

        pathlist+=("$(re_escape "${f%/}")/[^:]+")
    done

    ## Filter modules.dep, canonicalise the resulting filenames and supply
    ## them to instmods.

    ((${#pathlist[@]} > 0)) || return 0

    printf "^%s\.ko(\.gz|\.bz2|\.xz|\.zst)?:\n" "${pathlist[@]}" \
        | (LANG=C grep -E -o -f - -- "$depmod_modules_dep" || exit 0) \
        | tr -d ':' \
        | (
            cd "$depmod_module_dir" || exit
            xargs -r realpath -se --
        ) \
        | instmods || return 1

    return 0
}
 0707010000011F000081ED00000000000000000000000164DF2CB8000000C3000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/90kernel-modules/insmodpost.sh    #!/bin/sh

. /lib/dracut-lib.sh

for modlist in $(getargs rd.driver.post -d rdinsmodpost=); do
    (
        IFS=,
        for m in $modlist; do
            modprobe "$m"
        done
    )
done
 07070100000120000081ED00000000000000000000000164DF2CB80000140B000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/90kernel-modules/module-setup.sh  #!/bin/bash

# called by dracut
installkernel() {
    local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma|blk_mq_alloc_disk|blk_cleanup_disk'
    local -A _hostonly_drvs

    find_kernel_modules_external() {
        local a

        [[ -f "$srcmods/modules.dep" ]] || return 0

        while IFS=: read -r a _ || [[ $a ]]; do
            [[ $a =~ ^/ ]] && printf "%s\n" "$a"
        done < "$srcmods/modules.dep"
    }

    record_block_dev_drv() {
        for _mod in $(get_dev_module /dev/block/"$1"); do
            _hostonly_drvs["$_mod"]="$_mod"
        done
        ((${#_hostonly_drvs[@]} > 0)) && return 0
        return 1
    }

    install_block_modules_strict() {
        hostonly='' instmods "${_hostonly_drvs[@]}"
    }

    install_block_modules() {
        instmods \
            scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
            =drivers/usb/storage \
            =ide nvme vmd \
            virtio_blk virtio_scsi

        dracut_instmods -o -s "${_blockfuncs}" "=drivers"
    }

    if [[ -z $drivers ]]; then
        hostonly='' instmods \
            hid_generic unix

        hostonly=$(optional_hostonly) instmods \
            ehci-hcd ehci-pci ehci-platform \
            ohci-hcd ohci-pci \
            uhci-hcd \
            usbhid \
            xhci-hcd xhci-pci xhci-plat-hcd \
            "=drivers/hid" \
            "=drivers/tty/serial" \
            "=drivers/input/serio" \
            "=drivers/input/keyboard" \
            "=drivers/pci/host" \
            "=drivers/pci/controller" \
            "=drivers/pinctrl" \
            "=drivers/watchdog"

        instmods \
            yenta_socket \
            atkbd i8042 firewire-ohci pcmcia hv-vmbus \
            virtio virtio_ring virtio_pci pci_hyperv \
            "=drivers/pcmcia"

        if [[ ${DRACUT_ARCH:-$(uname -m)} == arm* || ${DRACUT_ARCH:-$(uname -m)} == aarch64 ]]; then
            # arm/aarch64 specific modules
            _blockfuncs+='|dw_mc_probe|dw_mci_pltfm_register'
            instmods \
                "=drivers/clk" \
                "=drivers/devfreq" \
                "=drivers/dma" \
                "=drivers/extcon" \
                "=drivers/gpio" \
                "=drivers/hwmon" \
                "=drivers/hwspinlock" \
                "=drivers/i2c/busses" \
                "=drivers/memory" \
                "=drivers/mfd" \
                "=drivers/mmc/core" \
                "=drivers/phy" \
                "=drivers/power" \
                "=drivers/regulator" \
                "=drivers/reset" \
                "=drivers/rpmsg" \
                "=drivers/rtc" \
                "=drivers/soc" \
                "=drivers/usb/chipidea" \
                "=drivers/usb/dwc2" \
                "=drivers/usb/dwc3" \
                "=drivers/usb/host" \
                "=drivers/usb/isp1760" \
                "=drivers/usb/misc" \
                "=drivers/usb/musb" \
                "=drivers/usb/phy" \
                "=drivers/scsi/hisi_sas"
        fi

        find_kernel_modules_external | instmods

        # if not on hostonly mode, or there are hostonly block device
        # install block drivers
        if ! [[ $hostonly ]] \
            || for_each_host_dev_and_slaves_all record_block_dev_drv; then
            hostonly='' instmods sg sr_mod sd_mod scsi_dh ata_piix

            if [[ $hostonly_mode == "strict" ]]; then
                install_block_modules_strict
            else
                install_block_modules
            fi
        fi

        # if not on hostonly mode, install all known filesystems,
        # if the required list is not set via the filesystems variable
        if ! [[ $hostonly ]]; then
            if [[ -z $filesystems ]]; then
                dracut_instmods -o -P ".*/(kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd)/.*" '=fs'
            fi
        elif [[ "${host_fs_types[*]}" ]]; then
            hostonly='' instmods "${host_fs_types[@]}"
        fi

        arch=${DRACUT_ARCH:-$(uname -m)}

        # We don't want to play catch up with hash and encryption algorithms.
        # To be safe, just use the hammer and include all crypto.
        [[ $arch == x86_64 ]] && arch=x86
        [[ $arch == s390x ]] && arch=s390
        [[ $arch == aarch64 ]] && arch=arm64
        hostonly='' instmods "=crypto"
        instmods "=arch/$arch/crypto" "=drivers/crypto"
    fi

    inst_multiple -o "$depmodd/*.conf"
    if [[ $hostonly ]]; then
        inst_multiple -H -o "$depmodconfdir/*.conf"
    fi
    :
}

# called by dracut
install() {
    [[ -d /lib/modprobe.d ]] && inst_multiple -o "/lib/modprobe.d/*.conf"
    [[ -d /usr/lib/modprobe.d ]] && inst_multiple -o "/usr/lib/modprobe.d/*.conf"
    [[ $hostonly ]] && inst_multiple -H -o /etc/modprobe.d/*.conf /etc/modprobe.conf
    if ! dracut_module_included "systemd"; then
        inst_hook cmdline 01 "$moddir/parse-kernel.sh"
    fi
    inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
}
 07070100000121000081ED00000000000000000000000164DF2CB800000395000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/90kernel-modules/parse-kernel.sh  #!/bin/sh

_modprobe_d=/etc/modprobe.d
if [ -d /usr/lib/modprobe.d ]; then
    _modprobe_d=/usr/lib/modprobe.d
elif [ -d /lib/modprobe.d ]; then
    _modprobe_d=/lib/modprobe.d
elif [ ! -d $_modprobe_d ]; then
    mkdir -p $_modprobe_d
fi

for i in $(getargs rd.driver.pre -d rdloaddriver=); do
    (
        IFS=,
        for p in $i; do
            modprobe "$p" 2>&1 | vinfo
        done
    )
done

[ -d /etc/modprobe.d ] || mkdir -p /etc/modprobe.d

for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
    (
        IFS=,
        for p in $i; do
            echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
        done
    )
done

for p in $(getargs rd.driver.post -d rdinsmodpost=); do
    echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
    _do_insmodpost=1
done

[ -n "$_do_insmodpost" ] && initqueue --settled --unique --onetime insmodpost.sh
unset _do_insmodpost _modprobe_d
   07070100000122000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90kernel-network-modules  07070100000123000081ED00000000000000000000000164DF2CB80000059F000000000000000000000000000000000000005100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90kernel-network-modules/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
installkernel() {
    # Include wired net drivers, excluding wireless
    local _arch=${DRACUT_ARCH:-$(uname -m)}
    local _net_symbols='eth_type_trans|register_virtio_device|usbnet_open'
    local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'
    local _net_drivers

    if [[ $_arch == "s390" ]] || [[ $_arch == "s390x" ]]; then
        dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_symbols" "=drivers/s390/net"
    fi

    if [[ $hostonly_mode == 'strict' ]] && [[ $hostonly_nics ]]; then
        for _nic in $hostonly_nics; do
            mapfile -t _net_drivers < <(get_dev_module /sys/class/net/"$_nic")
            if ((${#_net_drivers[@]} == 0)); then
                derror "--hostonly-nics contains invalid NIC '$_nic'"
                continue
            fi
            hostonly="" instmods "${_net_drivers[@]}"
        done
        return 0
    fi

    dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_symbols" "=drivers/net"
    #instmods() will take care of hostonly
    instmods \
        '=drivers/net/mdio' \
        '=drivers/net/phy' \
        '=drivers/net/team' \
        '=drivers/net/ethernet' \
        ecb arc4 bridge stp llc ipv6 bonding 8021q ipvlan macvlan af_packet virtio_net xennet
}

# called by dracut
install() {
    return 0
}
 07070100000124000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/modules.d/90livenet 07070100000125000081ED00000000000000000000000164DF2CB80000034B000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/modules.d/90livenet/fetch-liveupdate.sh #!/bin/sh
# fetch-liveupdate - fetch an update image for dmsquash-live media.
# this gets called by the "initqueue/online" hook for each network interface
# that comes online.

# no updates requested? we're not needed.
[ -e /tmp/liveupdates.info ] || return 0

command -v getarg > /dev/null || . /lib/dracut-lib.sh
command -v fetch_url > /dev/null || . /lib/url-lib.sh
command -v unpack_img > /dev/null || . /lib/img-lib.sh

read -r url < /tmp/liveupdates.info

info "fetching live updates from $url"

if ! fetch_url "$url" /tmp/updates.img; then
    warn "failed to fetch update image!"
    warn "url: $url"
    return 1
fi

if ! unpack_img /tmp/updates.img /updates.tmp.$$; then
    warn "failed to unpack update image!"
    warn "url: $url"
    return 1
fi

copytree /updates.tmp.$$ /updates

mv /tmp/liveupdates.info /tmp/liveupdates.done
 07070100000126000081ED00000000000000000000000164DF2CB8000008CC000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/90livenet/livenet-generator.sh    #!/bin/bash

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

[ -z "$root" ] && root=$(getarg root=)

# support legacy syntax of passing liveimg and then just the base root
if getargbool 0 rd.live.image -d -y liveimg; then
    liveroot="live:$root"
fi

if [ "${root%%:*}" = "live" ]; then
    liveroot=$root
fi

[ "${liveroot%%:*}" = "live" ] || exit 0

case "$liveroot" in
    live:nfs://* | nfs://*)
        root="${root#live:}"
        rootok=1
        ;;
    live:http://* | http://*)
        root="${root#live:}"
        rootok=1
        ;;
    live:https://* | https://*)
        root="${root#live:}"
        rootok=1
        ;;
    live:ftp://* | ftp://*)
        root="${root#live:}"
        rootok=1
        ;;
    live:torrent://* | torrent://*)
        root="${root#live:}"
        rootok=1
        ;;
    live:tftp://* | tftp://*)
        root="${root#live:}"
        rootok=1
        ;;
esac

[ "$rootok" != "1" ] && exit 0

GENERATOR_DIR="$2"
[ -z "$GENERATOR_DIR" ] && exit 1

[ -d "$GENERATOR_DIR" ] || mkdir -p "$GENERATOR_DIR"

getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"
[ -e /xor_overlayfs ] && xor_overlayfs="yes"
[ -e /xor_readonly ] && xor_readonly="--readonly"
ROOTFLAGS="$(getarg rootflags)"
{
    echo "[Unit]"
    echo "Before=initrd-root-fs.target"
    echo "[Mount]"
    echo "Where=/sysroot"
    if [ "$overlayfs$xor_overlayfs" = "yes" ]; then
        echo "What=LiveOS_rootfs"
        if [ "$readonly_overlay$xor_readonly" = "--readonly" ]; then
            ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
        else
            ovlfs=lowerdir=/run/rootfsbase
        fi
        echo "Options=${ROOTFLAGS},${ovlfs},upperdir=/run/overlayfs,workdir=/run/ovlwork"
        echo "Type=overlay"
        _dev=LiveOS_rootfs
    else
        echo "What=/dev/mapper/live-rw"
        [ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
        _dev=$'dev-mapper-live\\x2drw'
    fi
} > "$GENERATOR_DIR"/sysroot.mount

mkdir -p "$GENERATOR_DIR/$_dev.device.d"
{
    echo "[Unit]"
    echo "JobTimeoutSec=3000"
    echo "JobRunningTimeoutSec=3000"
} > "$GENERATOR_DIR/$_dev.device.d/timeout.conf"
07070100000127000081ED00000000000000000000000164DF2CB800000488000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90livenet/livenetroot.sh  #!/bin/sh
# livenetroot - fetch a live image from the network and run it

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

. /lib/url-lib.sh

PATH=/usr/sbin:/usr/bin:/sbin:/bin
RETRIES=${RETRIES:-100}
SLEEP=${SLEEP:-5}

[ -e /tmp/livenet.downloaded ] && exit 0

# args get passed from 40network/netroot
netroot="$2"
liveurl="${netroot#livenet:}"
info "fetching $liveurl"

imgfile=
#retry until the imgfile is populated with data or the max retries
i=1
while [ "$i" -le "$RETRIES" ]; do
    imgfile=$(fetch_url "$liveurl")

    # shellcheck disable=SC2181
    if [ $? != 0 ]; then
        warn "failed to download live image: error $?"
        imgfile=
    fi

    if [ -n "$imgfile" -a -s "$imgfile" ]; then
        break
    else
        if [ $i -ge "$RETRIES" ]; then
            warn "failed to download live image after $i attempts."
            exit 1
        fi

        sleep "$SLEEP"
    fi

    i=$((i + 1))
done > /tmp/livenet.downloaded

# TODO: couldn't dmsquash-live-root handle this?
if [ "${imgfile##*.}" = "iso" ]; then
    root=$(losetup -f)
    losetup "$root" "$imgfile"
else
    root=$imgfile
fi

exec /sbin/dmsquash-live-root "$root"
07070100000128000081ED00000000000000000000000164DF2CB800000255000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/modules.d/90livenet/module-setup.sh #!/bin/bash
# module-setup.sh for livenet

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    echo network url-lib dmsquash-live img-lib bash
    return 0
}

# called by dracut
install() {
    inst_hook cmdline 29 "$moddir/parse-livenet.sh"
    inst_hook initqueue/online 95 "$moddir/fetch-liveupdate.sh"
    inst_script "$moddir/livenetroot.sh" "/sbin/livenetroot"
    if dracut_module_included "systemd-initrd"; then
        inst_script "$moddir/livenet-generator.sh" "$systemdutildir"/system-generators/dracut-livenet-generator
    fi
    dracut_need_initqueue
}
   07070100000129000081ED00000000000000000000000164DF2CB8000003F8000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/90livenet/parse-livenet.sh    #!/bin/sh
# live net images - just like live images, but specified like:
# root=live:[url-to-backing-file]

[ -z "$root" ] && root=$(getarg root=)
. /lib/url-lib.sh

# live updates
updates=$(getarg live.updates=)
if [ -n "$updates" ]; then
    # make sure network comes up even if we're doing a local live device
    if [ -z "$netroot" ]; then
        echo > /tmp/net.ifaces
    fi
    echo "$updates" > /tmp/liveupdates.info
    echo '[ -e /tmp/liveupdates.done ]' > \
        "$hookdir"/initqueue/finished/liveupdates.sh
fi

str_starts "$root" "live:" && liveurl="$root"
str_starts "$liveurl" "live:" || return
liveurl="${liveurl#live:}"

# setting netroot to "livenet:..." makes "livenetroot" get run after ifup
if get_url_handler "$liveurl" > /dev/null; then
    info "livenet: root image at $liveurl"
    netroot="livenet:$liveurl"
    root="livenet" # quiet complaints from init
    # shellcheck disable=SC2034
    rootok=1
    wait_for_dev -n /dev/root
else
    info "livenet: no url handler for $liveurl"
fi
0707010000012A000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90lvm 0707010000012B000081A400000000000000000000000164DF2CB80000050C000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90lvm/64-lvm.rules    # hacky rules to try to activate lvm when we get new block devs...
#
# Copyright 2008, Red Hat, Inc.
# Jeremy Katz <katzj@redhat.com>


SUBSYSTEM!="block", GOTO="lvm_end"
ACTION!="add|change", GOTO="lvm_end"

# If the md device is active (indicated by array_state), then set the flag
# LVM_MD_PV_ACTIVATED=1 indicating that the md device for the PV is ready
# to be used.  The lvm udev rule running in root will check that this flag
# is set before it will process the md device (it wants to avoid
# processing an md device that exists but is not yet ready to be used.)
KERNEL=="md[0-9]*", ACTION=="change", ENV{ID_FS_TYPE}=="LVM2_member", ENV{LVM_MD_PV_ACTIVATED}!="1", TEST=="md/array_state", ENV{LVM_MD_PV_ACTIVATED}="1"

# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="lvm_end"
KERNEL=="dm-[0-9]*", ACTION=="add", GOTO="lvm_end"
ENV{ID_FS_TYPE}!="LVM?_member", GOTO="lvm_end"

PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/dm-[0-9]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
    GOTO="lvm_end"

RUN+="/sbin/initqueue --settled --onetime --unique /sbin/lvm_scan"
RUN+="/sbin/initqueue --timeout --name 51-lvm_scan --onetime --unique /sbin/lvm_scan --partial"
RUN+="/bin/sh -c '>/tmp/.lvm_scan-%k;'"

LABEL="lvm_end"
0707010000012C000081ED00000000000000000000000164DF2CB800000E68000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90lvm/lvm_scan.sh #!/bin/sh

# run lvm scan if udev has settled

extraargs="$*"
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

VGS=$(getargs rd.lvm.vg -d rd_LVM_VG=)
LVS=$(getargs rd.lvm.lv -d rd_LVM_LV=)
SNAPSHOT=$(getargs rd.lvm.snapshot -d rd_LVM_SNAPSHOT=)
SNAPSIZE=$(getargs rd.lvm.snapsize -d rd_LVM_SNAPSIZE=)

# shellcheck disable=SC2174
[ -d /etc/lvm ] || mkdir -m 0755 -p /etc/lvm
# build a list of devices to scan
lvmdevs=$(
    for f in /tmp/.lvm_scan-*; do
        [ -e "$f" ] || continue
        printf '%s' "${f##/tmp/.lvm_scan-} "
    done
)

if [ ! -e /etc/lvm/lvm.conf ]; then
    {
        echo 'devices {'
        printf '    filter = [ '
        for dev in $lvmdevs; do
            printf '"a|^/dev/%s$|", ' "$dev"
        done
        echo '"r/.*/" ]'
        echo '}'

        # establish LVM locking
        if [ -n "$SNAPSHOT" ]; then
            echo 'global {'
            echo '    locking_type = 1'
            echo '    use_lvmetad = 0'
            echo '}'
        else
            echo 'global {'
            echo '    locking_type = 4'
            echo '    use_lvmetad = 0'
            echo '}'
        fi
    } > /etc/lvm/lvm.conf
    lvmwritten=1
fi

check_lvm_ver() {
    maj=$1
    min=$2
    ver=$3
    # --poll is supported since 2.2.57
    [ "$4" -lt "$maj" ] && return 1
    [ "$4" -gt "$maj" ] && return 0
    [ "$5" -lt "$min" ] && return 1
    [ "$5" -gt "$min" ] && return 0
    [ "$6" -ge "$ver" ] && return 0
    return 1
}

# hopefully this output format will never change, e.g.:
#   LVM version:     2.02.53(1) (2009-09-25)
OLDIFS=$IFS
IFS=.
# shellcheck disable=SC2046
set -- $(lvm version 2> /dev/null)
IFS=$OLDIFS
maj=${1##*:}
min=$2
sub=${3%% *}
sub=${sub%%\(*}

lvm_ignorelockingfailure="--ignorelockingfailure"
lvm_quirk_args="--ignorelockingfailure --ignoremonitoring"

check_lvm_ver 2 2 57 "$maj" "$min" "$sub" \
    && lvm_quirk_args="$lvm_quirk_args --poll n"

if check_lvm_ver 2 2 65 "$maj" "$min" "$sub"; then
    lvm_quirk_args=" --sysinit $extraargs"
fi

if check_lvm_ver 2 2 221 "$maj" "$min" "$sub"; then
    lvm_quirk_args=" $extraargs"
    unset lvm_ignorelockingfailure
fi

unset extraargs

export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1

if [ -n "$SNAPSHOT" ]; then
    # HACK - this should probably be done elsewhere or turned into a function
    # Enable read-write LVM locking
    sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type =  1/' /etc/lvm/lvm.conf

    # Expected SNAPSHOT format "<orig lv name>:<snap lv name>"
    ORIG_LV=${SNAPSHOT%%:*}
    SNAP_LV=${SNAPSHOT##*:}

    info "Removing existing LVM snapshot $SNAP_LV"
    lvm lvremove --force "$SNAP_LV" 2>&1 | vinfo

    # Determine snapshot size
    if [ -z "$SNAPSIZE" ]; then
        SNAPSIZE=$(lvm lvs --noheadings --units m --options lv_size "$ORIG_LV")
        info "No LVM snapshot size provided, using size of $ORIG_LV ($SNAPSIZE)"
    fi

    info "Creating LVM snapshot $SNAP_LV ($SNAPSIZE)"
    lvm lvcreate -s -n "$SNAP_LV" -L "$SNAPSIZE" "$ORIG_LV" 2>&1 | vinfo
fi

if [ -n "$LVS" ]; then
    info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
    lvm lvscan $lvm_ignorelockingfailure 2>&1 | vinfo
    for LV in $LVS; do
        # shellcheck disable=SC2086
        lvm lvchange --yes -K -ay $lvm_quirk_args "$LV" 2>&1 | vinfo
    done
fi

if [ -z "$LVS" ] || [ -n "$VGS" ]; then
    info "Scanning devices $lvmdevs for LVM volume groups $VGS"
    lvm vgscan $lvm_ignorelockingfailure 2>&1 | vinfo
    # shellcheck disable=SC2086
    lvm vgchange -ay $lvm_quirk_args $VGS 2>&1 | vinfo
fi

if [ "$lvmwritten" ]; then
    rm -f -- /etc/lvm/lvm.conf
fi
unset lvmwritten

udevadm settle

need_shutdown
0707010000012D000081ED00000000000000000000000164DF2CB8000011F8000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90lvm/module-setup.sh #!/bin/bash

# called by dracut
check() {
    # No point trying to support lvm if the binaries are missing
    require_binaries lvm || return 1

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for fs in "${host_fs_types[@]}"; do
            [[ $fs == LVM*_member ]] && return 0
        done
        return 255
    }

    return 0
}

# called by dracut
depends() {
    # We depend on dm_mod being loaded
    echo rootfs-block dm
    return 0
}

# called by dracut
cmdline() {
    local _activated
    declare -A _activated

    for dev in "${!host_fs_types[@]}"; do
        [[ -e /sys/block/${dev#/dev/}/dm/name ]] || continue
        [[ -e /sys/block/${dev#/dev/}/dm/uuid ]] || continue
        uuid=$(< "/sys/block/${dev#/dev/}/dm/uuid")
        [[ ${uuid#LVM-} == "$uuid" ]] && continue
        dev=$(< "/sys/block/${dev#/dev/}/dm/name")
        eval "$(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2> /dev/null)"
        [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
        if ! [[ ${_activated[DM_VG_NAME / DM_LV_NAME]} ]]; then
            printf " rd.lvm.lv=%s " "${DM_VG_NAME}/${DM_LV_NAME} "
            _activated["${DM_VG_NAME}/${DM_LV_NAME}"]=1
        fi
    done
}

installkernel() {
    hostonly='' dracut_instmods -o -P ".*/(bcache/|md-cluster).*" "=drivers/md"
}

# called by dracut
install() {
    inst lvm

    if [[ $hostonly_cmdline == "yes" ]]; then
        local _lvmconf
        _lvmconf=$(cmdline)
        [[ $_lvmconf ]] && printf "%s\n" "$_lvmconf" >> "${initdir}/etc/cmdline.d/90lvm.conf"
    fi

    inst_rules "$moddir/64-lvm.rules"

    if [[ $hostonly ]] || [[ $lvmconf == "yes" ]]; then
        if [[ -f $dracutsysrootdir/etc/lvm/lvm.conf ]]; then
            inst_simple -H /etc/lvm/lvm.conf
            # FIXME: near-term hack to establish read-only locking;
            # use command-line lvm.conf editor once it is available
            sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' "${initdir}/etc/lvm/lvm.conf"
            sed -i -e 's/\(^[[:space:]]*\)use_lvmetad[[:space:]]*=[[:space:]]*[[:digit:]]/\1use_lvmetad = 0/' "${initdir}/etc/lvm/lvm.conf"
        fi

        export LVM_SUPPRESS_FD_WARNINGS=1
        # Also install any files needed for LVM system id support.
        if [[ -f $dracutsysrootdir/etc/lvm/lvmlocal.conf ]]; then
            inst_simple -H /etc/lvm/lvmlocal.conf
        fi
        eval "$(lvm dumpconfig global/system_id_source &> /dev/null)"
        if [ "$system_id_source" == "file" ]; then
            eval "$(lvm dumpconfig global/system_id_file)"
            if [ -f "$system_id_file" ]; then
                inst_simple -H "$system_id_file"
            fi
        fi
        unset LVM_SUPPRESS_FD_WARNINGS
    fi

    if ! [[ -e ${initdir}/etc/lvm/lvm.conf ]]; then
        mkdir -p "${initdir}/etc/lvm"
        {
            echo 'global {'
            echo 'locking_type = 4'
            echo 'use_lvmetad = 0'
            echo '}'
        } > "${initdir}/etc/lvm/lvm.conf"
    fi

    inst_rules 11-dm-lvm.rules

    # Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
    # files, but provides the one below:
    inst_rules 64-device-mapper.rules
    # debian udev rules
    inst_rules 56-lvm.rules 60-persistent-storage-lvm.rules

    inst_script "$moddir/lvm_scan.sh" /sbin/lvm_scan
    inst_hook cmdline 30 "$moddir/parse-lvm.sh"

    inst_libdir_file "libdevmapper-event-lvm*.so"

    if [[ $hostonly ]] && find_binary lvs &> /dev/null; then
        for dev in "${!host_fs_types[@]}"; do
            [[ -e /sys/block/${dev#/dev/}/dm/name ]] || continue
            dev=$(< "/sys/block/${dev#/dev/}/dm/name")
            eval "$(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2> /dev/null)"
            # shellcheck disable=SC2015
            [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || continue
            case "$(lvs --noheadings -o segtype "${DM_VG_NAME}" 2> /dev/null)" in
                *thin* | *cache* | *era*)
                    inst_multiple -o thin_dump thin_restore thin_check thin_repair \
                        cache_dump cache_restore cache_check cache_repair \
                        era_check era_dump era_invalidate era_restore
                    break
                    ;;
            esac
        done
    fi

    if ! [[ $hostonly ]]; then
        inst_multiple -o thin_dump thin_restore thin_check thin_repair \
            cache_dump cache_restore cache_check cache_repair \
            era_check era_dump era_invalidate era_restore
    fi

    dracut_need_initqueue
}
0707010000012E000081ED00000000000000000000000164DF2CB8000001E7000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90lvm/parse-lvm.sh    #!/bin/sh

if [ -e /etc/lvm/lvm.conf ] && ! getargbool 1 rd.lvm.conf -d -n rd_NO_LVMCONF; then
    rm -f -- /etc/lvm/lvm.conf
fi

LV_DEVS="$(getargs rd.lvm.vg -d rd_LVM_VG=) $(getargs rd.lvm.lv -d rd_LVM_LV=)"

if ! getargbool 1 rd.lvm -d -n rd_NO_LVM \
    || { [ -z "$LV_DEVS" ] && ! getargbool 0 rd.auto; }; then
    info "rd.lvm=0: removing LVM activation"
    rm -f -- /etc/udev/rules.d/64-lvm*.rules
else
    for dev in $LV_DEVS; do
        wait_for_dev -n "/dev/$dev"
    done
fi
 0707010000012F000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90mdraid  07070100000130000081A400000000000000000000000164DF2CB80000034A000000000000000000000000000000000000005000000000dracut-055+suse.347.gdcb9bdbf/modules.d/90mdraid/59-persistent-storage-md.rules   SUBSYSTEM!="block", GOTO="md_end"
ACTION!="add|change", GOTO="md_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="md_end"

KERNEL!="md[0-9]*|md_d[0-9]*|md/*", KERNEL!="md*", GOTO="md_end"

# partitions have no md/{array_state,metadata_version}
ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"

# container devices have a metadata version of e.g. 'external:ddf' and
# never leave state 'inactive'
ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
TEST!="md/array_state", GOTO="md_end"
ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"

LABEL="md_ignore_state"

IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
IMPORT BLKID
OPTIONS+="link_priority=100"
OPTIONS+="watch"
OPTIONS+="db_persist"
LABEL="md_end"
  07070100000131000081A400000000000000000000000164DF2CB8000005AF000000000000000000000000000000000000004E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90mdraid/65-md-incremental-imsm.rules # This file causes block devices with Linux RAID (mdadm) signatures to
# automatically cause mdadm to be run.
# See udev(8) for syntax

ACTION!="add|change", GOTO="md_end"
SUBSYSTEM!="block", GOTO="md_end"
ENV{rd_NO_MD}=="?*", GOTO="md_end"
KERNEL=="md*", ENV{ID_FS_TYPE}!="linux_raid_member", GOTO="md_end"
KERNEL=="md*", ACTION!="change", GOTO="md_end"

# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="md_end"

ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_raid_member", GOTO="md_try"
GOTO="md_end"

LABEL="md_try"
ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}=="?*", GOTO="md_end"
ENV{ID_FS_TYPE}=="ddf_raid_member", ENV{rd_NO_MDDDF}=="?*", GOTO="md_end"

# already done ?
PROGRAM="/bin/sh -c 'for i in $sys/$devpath/holders/md[0-9_]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
    GOTO="md_end"

# for native arrays - array's uuid has to be specified
# for containers - container's uuid has to be specified
# TODO : how to get embedded array's uuid having container's component ?
#
# UUID CHECK

ENV{DEVTYPE}!="partition", \
    RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"

RUN+="/sbin/initqueue --timeout --name 50-mdraid_start --onetime --unique /sbin/mdraid_start"

#
# Incrementally build the md array; this will automatically assemble
# any eventual containers as well (imsm, ddf)
#
LABEL="md_incremental"

RUN+="/sbin/mdadm -I $env{DEVNAME}"

LABEL="md_end"
 07070100000132000081ED00000000000000000000000164DF2CB8000001CE000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/modules.d/90mdraid/md-shutdown.sh   #!/bin/sh

_do_md_shutdown() {
    local ret
    local final=$1
    info "Waiting for mdraid devices to be clean."
    mdadm -vv --wait-clean --scan | vinfo
    ret=$?
    info "Disassembling mdraid devices."
    mdadm -vv --stop --scan | vinfo
    ret=$((ret + $?))
    if [ "x$final" != "x" ]; then
        info "/proc/mdstat:"
        vinfo < /proc/mdstat
    fi
    return $ret
}

if command -v mdadm > /dev/null; then
    _do_md_shutdown "$1"
else
    :
fi
  07070100000133000081ED00000000000000000000000164DF2CB8000000E8000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/90mdraid/mdmon-pre-shutdown.sh    #!/bin/sh

_do_mdmon_takeover() {
    local ret
    mdmon --takeover --all
    ret=$?
    [ $ret -eq 0 ] && info "Taking over mdmon processes."
    return $ret
}

if command -v mdmon > /dev/null; then
    _do_mdmon_takeover "$1"
fi
07070100000134000081ED00000000000000000000000164DF2CB800000085000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/90mdraid/mdmon-pre-udev.sh    #!/bin/sh
# save state dir for mdmon/mdadm for the real root
[ -d /run/mdadm ] || mkdir -m 0755 -p /run/mdadm
# backward compat link
   07070100000135000081ED00000000000000000000000164DF2CB8000001F2000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/90mdraid/mdraid-cleanup.sh    #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

containers=""
for md in /dev/md[0-9_]*; do
    [ -b "$md" ] || continue
    udevinfo="$(udevadm info --query=env --name="$md")"
    strstr "$udevinfo" "DEVTYPE=partition" && continue
    if strstr "$udevinfo" "MD_LEVEL=container"; then
        containers="$containers $md"
        continue
    fi
    mdadm -S "$md" > /dev/null 2>&1
done

for md in $containers; do
    mdadm -S "$md" > /dev/null 2>&1
done

unset containers udevinfo
  07070100000136000081ED00000000000000000000000164DF2CB80000009C000000000000000000000000000000000000004800000000dracut-055+suse.347.gdcb9bdbf/modules.d/90mdraid/mdraid-needshutdown.sh   #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

for md in /dev/md[0-9_]*; do
    [ -b "$md" ] || continue
    need_shutdown
    break
done
07070100000137000081ED00000000000000000000000164DF2CB8000002B8000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/90mdraid/mdraid-waitclean.sh  #!/bin/sh

if getargbool 0 rd.md.waitclean; then
    type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
    containers=""
    for md in /dev/md[0-9_]*; do
        [ -b "$md" ] || continue
        udevinfo="$(udevadm info --query=env --name="$md")"
        strstr "$udevinfo" "DEVTYPE=partition" && continue
        if strstr "$udevinfo" "MD_LEVEL=container"; then
            containers="$containers $md"
            continue
        fi
        info "Waiting for $md to become clean"
        mdadm -W "$md" > /dev/null 2>&1
    done

    for md in $containers; do
        info "Waiting for $md to become clean"
        mdadm -W "$md" > /dev/null 2>&1
    done

    unset containers udevinfo
fi
07070100000138000081ED00000000000000000000000164DF2CB800000741000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90mdraid/mdraid_start.sh  #!/bin/sh

type getargs > /dev/null 2>&1 || . /lib/dracut-lib.sh

_md_start() {
    local _udevinfo
    local _path_s
    local _path_d
    local _md="$1"

    _udevinfo="$(udevadm info --query=env --name="${_md}")"
    strstr "$_udevinfo" "MD_LEVEL=container" && return 0
    strstr "$_udevinfo" "DEVTYPE=partition" && return 0

    _path_s="/sys/$(udevadm info -q path -n "${_md}")/md/array_state"
    [ ! -r "$_path_s" ] && return 0

    # inactive ?
    [ "$(cat "$_path_s")" != "inactive" ] && return 0

    mdadm -R "${_md}" 2>&1 | vinfo

    # still inactive ?
    [ "$(cat "$_path_s")" = "inactive" ] && return 0

    _path_d="${_path_s%/*}/degraded"
    [ ! -r "$_path_d" ] && return 0
    : > "$hookdir"/initqueue/work
}

_md_force_run() {
    local _md
    local _UUID
    local _MD_UUID

    _MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
    [ -n "$_MD_UUID" ] || getargbool 0 rd.auto || return

    if [ -n "$_MD_UUID" ]; then
        _MD_UUID=$(str_replace "$_MD_UUID" "-" "")
        _MD_UUID=$(str_replace "$_MD_UUID" ":" "")

        for _md in /dev/md[0-9_]*; do
            [ -b "$_md" ] || continue
            _UUID=$(
                /sbin/mdadm -D --export "$_md" \
                    | while read -r line || [ -n "$line" ]; do
                        str_starts "$line" "MD_UUID=" || continue
                        printf "%s" "${line#MD_UUID=}"
                    done
            )

            [ -z "$_UUID" ] && continue
            _UUID=$(str_replace "$_UUID" ":" "")

            # check if we should handle this device
            strstr "$_MD_UUID" "$_UUID" || continue

            _md_start "${_md}"
        done
    else
        # try to force-run anything not running yet
        for _md in /dev/md[0-9_]*; do
            [ -b "$_md" ] || continue
            _md_start "${_md}"
        done
    fi
}

_md_force_run
   07070100000139000081ED00000000000000000000000164DF2CB8000011DF000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90mdraid/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    local dev holder

    # No mdadm?  No mdraid support.
    require_binaries mdadm expr || return 1

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for dev in "${!host_fs_types[@]}"; do
            [[ ${host_fs_types[$dev]} != *_raid_member ]] && continue

            DEVPATH=$(get_devpath_block "$dev")

            for holder in "$DEVPATH"/holders/*; do
                [[ -e $holder ]] || continue
                [[ -e "$holder/md" ]] && return 0
                break
            done

        done
        return 255
    }

    return 0
}

# called by dracut
depends() {
    echo rootfs-block
    return 0
}

# called by dracut
installkernel() {
    instmods '=drivers/md'
}

# called by dracut
cmdline() {
    local _activated dev line UUID
    declare -A _activated

    for dev in "${!host_fs_types[@]}"; do
        [[ ${host_fs_types[$dev]} != *_raid_member ]] && continue

        UUID=$(
            /sbin/mdadm --examine --export "$dev" \
                | while read -r line || [[ "$line" ]]; do
                    [[ ${line#MD_UUID=} == "$line" ]] && continue
                    printf "%s" "${line#MD_UUID=} "
                done
        )

        [[ -z $UUID ]] && continue

        if ! [[ ${_activated[${UUID}]} ]]; then
            printf "%s" " rd.md.uuid=${UUID}"
            _activated["${UUID}"]=1
        fi

    done
}

# called by dracut
install() {
    local rule rule_path
    inst_multiple cat expr
    inst_multiple -o mdmon
    inst "$(command -v partx)" /sbin/partx
    inst "$(command -v mdadm)" /sbin/mdadm

    if [[ $hostonly_cmdline == "yes" ]]; then
        local _raidconf
        _raidconf=$(cmdline)
        [[ $_raidconf ]] && printf "%s\n" "$_raidconf" >> "${initdir}/etc/cmdline.d/90mdraid.conf"
    fi

    # <mdadm-3.3 udev rule
    inst_rules 64-md-raid.rules
    # >=mdadm-3.3 udev rules
    inst_rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules
    # remove incremental assembly from stock rules, so they don't shadow
    # 65-md-inc*.rules and its fine-grained controls, or cause other problems
    # when we explicitly don't want certain components to be incrementally
    # assembled
    for rule in 64-md-raid.rules 64-md-raid-assembly.rules; do
        rule_path="${initdir}${udevdir}/rules.d/${rule}"
        # shellcheck disable=SC2016
        [ -f "${rule_path}" ] && sed -i -r \
            -e '/(RUN|IMPORT\{program\})\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(--export )?(\$env\{DEVNAME\}|\$tempnode|\$devnode)/d' \
            "${rule_path}"
    done

    inst_rules "$moddir/65-md-incremental-imsm.rules"

    inst_rules "$moddir/59-persistent-storage-md.rules"
    prepare_udev_rules 59-persistent-storage-md.rules

    if [[ $hostonly ]] || [[ $mdadmconf == "yes" ]]; then
        if [[ -f $dracutsysrootdir/etc/mdadm.conf ]]; then
            inst -H /etc/mdadm.conf
        else
            [[ -f $dracutsysrootdir/etc/mdadm/mdadm.conf ]] && inst -H /etc/mdadm/mdadm.conf /etc/mdadm.conf
        fi
        if [[ -d $dracutsysrootdir/etc/mdadm.conf.d ]]; then
            local f
            inst_dir /etc/mdadm.conf.d
            for f in /etc/mdadm.conf.d/*.conf; do
                [[ -f "$dracutsysrootdir$f" ]] || continue
                inst -H "$f"
            done
        fi
    fi

    inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh"
    inst_hook pre-trigger 30 "$moddir/parse-md.sh"
    inst_hook pre-mount 10 "$moddir/mdraid-waitclean.sh"
    inst_hook cleanup 99 "$moddir/mdraid-needshutdown.sh"
    inst_hook shutdown 30 "$moddir/md-shutdown.sh"
    inst_script "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
    inst_script "$moddir/mdraid_start.sh" /sbin/mdraid_start
    if dracut_module_included "systemd"; then
        if [[ -e $dracutsysrootdir$systemdsystemunitdir/mdmon@.service ]]; then
            inst_simple "$systemdsystemunitdir"/mdmon@.service
        fi
        if [[ -e $dracutsysrootdir$systemdsystemunitdir/mdadm-last-resort@.service ]]; then
            inst_simple "$systemdsystemunitdir"/mdadm-last-resort@.service
        fi
        if [[ -e $dracutsysrootdir$systemdsystemunitdir/mdadm-last-resort@.timer ]]; then
            inst_simple "$systemdsystemunitdir"/mdadm-last-resort@.timer
        fi
        if [[ -e $dracutsysrootdir$systemdsystemunitdir/mdadm-grow-continue@.service ]]; then
            inst_simple "$systemdsystemunitdir"/mdadm-grow-continue@.service
        fi
    fi
    inst_hook pre-shutdown 30 "$moddir/mdmon-pre-shutdown.sh"
    dracut_need_initqueue
}
 0707010000013A000081ED00000000000000000000000164DF2CB800000AC0000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90mdraid/parse-md.sh  #!/bin/sh
# we really need to use `expr substr` with dash
# shellcheck disable=SC2003

MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
# normalize the uuid
MD_UUID=$(str_replace "$MD_UUID" "-" "")
MD_UUID=$(str_replace "$MD_UUID" ":" "")

if { [ -z "$MD_UUID" ] && ! getargbool 0 rd.auto; } || ! getargbool 1 rd.md -d -n rd_NO_MD; then
    info "rd.md=0: removing MD RAID activation"
    udevproperty rd_NO_MD=1
else
    # rewrite the md rules to only process the specified raid array
    if [ -n "$MD_UUID" ]; then
        for f in /etc/udev/rules.d/65-md-incremental*.rules; do
            [ -e "$f" ] || continue
            while read -r line || [ -n "$line" ]; do
                if [ "${line%%UUID CHECK}" != "$line" ]; then
                    for uuid in $MD_UUID; do
                        printf 'ENV{ID_FS_UUID}=="%s", GOTO="md_uuid_ok"\n' "$(expr substr "$uuid" 1 8)-$(expr substr "$uuid" 9 4)-$(expr substr "$uuid" 13 4)-$(expr substr "$uuid" 17 4)-$(expr substr "$uuid" 21 12)"
                    done
                    # shellcheck disable=SC2016
                    printf 'IMPORT{program}="/sbin/mdadm --examine --export $tempnode"\n'
                    for uuid in $MD_UUID; do
                        printf 'ENV{MD_UUID}=="%s", GOTO="md_uuid_ok"\n' "$(expr substr "$uuid" 1 8):$(expr substr "$uuid" 9 8):$(expr substr "$uuid" 17 8):$(expr substr "$uuid" 25 8)"
                    done
                    printf 'GOTO="md_end"\n'
                    printf 'LABEL="md_uuid_ok"\n'
                else
                    echo "$line"
                fi
            done < "${f}" > "${f}.new"
            mv "${f}.new" "$f"
        done
        for uuid in $MD_UUID; do
            uuid="$(expr substr "$uuid" 1 8):$(expr substr "$uuid" 9 8):$(expr substr "$uuid" 17 8):$(expr substr "$uuid" 25 8)"
            wait_for_dev "/dev/disk/by-id/md-uuid-${uuid}"
        done
    fi
fi

if [ -e /etc/mdadm.conf ] && getargbool 1 rd.md.conf -d -n rd_NO_MDADMCONF; then
    udevproperty rd_MDADMCONF=1
    rm -f -- "$hookdir"/pre-pivot/*mdraid-cleanup.sh
fi

if ! getargbool 1 rd.md.conf -d -n rd_NO_MDADMCONF; then
    rm -f -- /etc/mdadm/mdadm.conf /etc/mdadm.conf
    ln -s "$(command -v mdraid-cleanup)" "$hookdir"/pre-pivot/31-mdraid-cleanup.sh 2> /dev/null
fi

# noiswmd nodmraid for anaconda / rc.sysinit compatibility
# note nodmraid really means nobiosraid, so we don't want MDIMSM then either
if ! getargbool 1 rd.md.imsm -d -n rd_NO_MDIMSM -n noiswmd -n nodmraid; then
    info "no MD RAID for imsm/isw raids"
    udevproperty rd_NO_MDIMSM=1
fi

# same thing with ddf containers
if ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd -n nodmraid; then
    info "no MD RAID for SNIA ddf raids"
    udevproperty rd_NO_MDDDF=1
fi
0707010000013B000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/modules.d/90multipath   0707010000013C000081ED00000000000000000000000164DF2CB800001032000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/90multipath/module-setup.sh   #!/bin/bash

is_mpath() {
    local _dev=$1
    [ -e /sys/dev/block/"$_dev"/dm/uuid ] || return 1
    [[ $(cat /sys/dev/block/"$_dev"/dm/uuid) =~ mpath- ]] && return 0
    return 1
}

majmin_to_mpath_dev() {
    local _dev
    for i in /dev/mapper/*; do
        [[ $i == /dev/mapper/control ]] && continue
        _dev=$(get_maj_min "$i")
        if [ "$_dev" = "$1" ]; then
            echo "$i"
            return
        fi
    done
}

# called by dracut
check() {
    local _any_mpath_dev

    for_each_host_dev_and_slaves is_mpath
    _any_mpath_dev=$?

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        [[ $_any_mpath_dev == 0 ]] || return 255
    }

    # if there's no multipath binary, no go.
    require_binaries multipath || return 1
    require_binaries kpartx || return 1

    if [[ $_any_mpath_dev != 0 ]] && [[ ! -f /etc/multipath.conf ]]; then
        dwarn "multipath: including module with no multipath devices and empty" \
            "configuration, the root disk may be unintentionally multipathed."
    fi

    return 0
}

# called by dracut
depends() {
    echo rootfs-block
    echo dm
    return 0
}

# called by dracut
cmdline() {
    for m in scsi_dh_alua scsi_dh_emc scsi_dh_rdac dm_multipath; do
        if grep -m 1 -q "$m" /proc/modules; then
            printf 'rd.driver.pre=%s ' "$m"
        fi
    done
}

# called by dracut
installkernel() {
    local _arch=${DRACUT_ARCH:-$(uname -m)}
    local _funcs='scsi_register_device_handler|dm_dirty_log_type_register|dm_register_path_selector|dm_register_target'

    if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then
        _s390drivers="=drivers/s390/scsi"
    fi

    hostonly='' dracut_instmods -o -s "$_funcs" "=drivers/scsi" "=drivers/md" ${_s390drivers:+"$_s390drivers"}
}

mpathconf_installed() {
    command -v mpathconf &> /dev/null
}

# called by dracut
install() {
    local -A _allow

    add_hostonly_mpath_conf() {
        if is_mpath "$1"; then
            local _dev

            _dev=$(majmin_to_mpath_dev "$1")
            [ -z "$_dev" ] && return
            _allow["$_dev"]="$_dev"
        fi
    }

    inst_multiple \
        pkill \
        pidof \
        kpartx \
        dmsetup \
        multipath \
        multipathd

    inst_multiple -o \
        mpath_wait \
        mpathconf \
        mpathpersist \
        xdrgetprio \
        xdrgetuid \
        /etc/xdrdevices.conf \
        /etc/multipath.conf \
        /etc/multipath/* \
        /etc/multipath/conf.d/*

    mpathconf_installed \
        && [[ $hostonly ]] && [[ $hostonly_mode == "strict" ]] && {
        for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
        if ((${#_allow[@]} > 0)); then
            local -a _args
            local _dev
            for _dev in "${_allow[@]}"; do
                _args+=("--allow" "$_dev")
            done
            mpathconf "${_args[@]}" --outfile "${initdir}"/etc/multipath.conf
        fi
    }

    inst "$(command -v partx)" /sbin/partx

    inst_libdir_file "libmultipath*" "multipath/*"
    inst_libdir_file 'libgcc_s.so*'

    if [[ $hostonly_cmdline ]]; then
        local _conf
        _conf=$(cmdline)
        [[ $_conf ]] && echo "$_conf" >> "${initdir}/etc/cmdline.d/90multipath.conf"
    fi

    if dracut_module_included "systemd"; then
        if mpathconf_installed; then
            inst_simple "${moddir}/multipathd-configure.service" "${systemdsystemunitdir}/multipathd-configure.service"
            $SYSTEMCTL -q --root "$initdir" enable multipathd-configure.service
        fi
        inst_simple "${moddir}/multipathd.service" "${systemdsystemunitdir}/multipathd.service"
        $SYSTEMCTL -q --root "$initdir" enable multipathd.service
    else
        inst_hook pre-trigger 02 "$moddir/multipathd.sh"
        inst_hook cleanup 02 "$moddir/multipathd-stop.sh"
    fi

    inst_hook cleanup 80 "$moddir/multipathd-needshutdown.sh"
    inst_hook shutdown 20 "$moddir/multipath-shutdown.sh"

    inst_rules 40-multipath.rules 56-multipath.rules \
        62-multipath.rules 65-multipath.rules \
        66-kpartx.rules 67-kpartx-compat.rules \
        11-dm-mpath.rules 11-dm-parts.rules
}
  0707010000013D000081ED00000000000000000000000164DF2CB8000000AD000000000000000000000000000000000000004A00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90multipath/multipath-shutdown.sh #!/bin/sh

for i in $(multipath -l -v1); do
    if ! dmsetup table "$i" | sed -n '/.*queue_if_no_path.*/q1'; then
        dmsetup message "$i" 0 fail_if_no_path
    fi
done
   0707010000013E000081A400000000000000000000000164DF2CB8000001C1000000000000000000000000000000000000005100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90multipath/multipathd-configure.service  [Unit]
Description=Device-Mapper Multipath Default Configuration
Before=lvm2-activation-early.service
Before=local-fs-pre.target multipathd.service
DefaultDependencies=no
Conflicts=shutdown.target

ConditionKernelCommandLine=rd.multipath=default
ConditionPathExists=!/etc/multipath.conf

[Service]
Type=oneshot
ExecStartPre=-/usr/bin/mkdir -p /etc/multipath/multipath.conf.d
ExecStart=/usr/sbin/mpathconf --enable

[Install]
WantedBy=sysinit.target
   0707010000013F000081ED00000000000000000000000164DF2CB8000000A0000000000000000000000000000000000000004F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90multipath/multipathd-needshutdown.sh    #!/bin/sh

for i in $(multipath -l -v1); do
    if dmsetup table "$i" | sed -n '/.*queue_if_no_path.*/q1'; then
        need_shutdown
        break
    fi
done
07070100000140000081ED00000000000000000000000164DF2CB800000105000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/90multipath/multipathd-stop.sh    #!/bin/sh

if [ -e /etc/multipath.conf ]; then
    pkill multipathd > /dev/null 2>&1

    if pidof multipathd > /dev/null 2>&1; then
        sleep 0.2
    fi

    if pidof multipathd > /dev/null 2>&1; then
        pkill -9 multipathd > /dev/null 2>&1
    fi
fi
   07070100000141000081A400000000000000000000000164DF2CB80000033D000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/90multipath/multipathd.service    [Unit]
Description=Device-Mapper Multipath Device Controller
Before=lvm2-activation-early.service
Before=local-fs-pre.target blk-availability.service shutdown.target
Wants=systemd-udevd-kernel.socket
After=systemd-udevd-kernel.socket
After=multipathd.socket systemd-remount-fs.service
Before=initrd-cleanup.service
DefaultDependencies=no
Conflicts=shutdown.target
Conflicts=initrd-cleanup.service
ConditionKernelCommandLine=!nompath
ConditionKernelCommandLine=!rd.multipath=0
ConditionKernelCommandLine=!rd_NO_MULTIPATH
ConditionKernelCommandLine=!multipath=off
ConditionVirtualization=!container

[Service]
Type=notify
NotifyAccess=main
ExecStartPre=-/sbin/modprobe dm-multipath
ExecStart=/sbin/multipathd -d -s
ExecReload=/sbin/multipathd reconfigure
TasksMax=infinity

[Install]
WantedBy=sysinit.target
Also=multipathd.socket
   07070100000142000081ED00000000000000000000000164DF2CB80000018C000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/modules.d/90multipath/multipathd.sh #!/bin/sh

if [ "$(getarg rd.multipath)" = "default" ] && [ ! -e /etc/multipath.conf ]; then
    mkdir -p /etc/multipath/multipath.conf.d
    mpathconf --enable
fi

if getargbool 1 rd.multipath -d -n rd_NO_MULTIPATH && [ -e /etc/multipath.conf ]; then
    modprobe dm-multipath
    multipathd -B || multipathd
    need_shutdown
else
    rm -- /etc/udev/rules.d/??-multipath.rules 2> /dev/null
fi
07070100000143000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90nvdimm  07070100000144000081ED00000000000000000000000164DF2CB8000002E6000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90nvdimm/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    if [[ ! $hostonly ]]; then
        return 0
    fi
    [[ $DRACUT_KERNEL_MODALIASES && -f $DRACUT_KERNEL_MODALIASES ]] \
        && grep -q libnvdimm "$DRACUT_KERNEL_MODALIASES" && return 0
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
installkernel() {
    # Directories to search for NVDIMM "providers" (firmware drivers)
    # These modules call "nvdimm_bus_register()".
    #instmods() will take care of hostonly
    dracut_instmods -o -s nvdimm_bus_register \
        '=drivers/nvdimm' \
        '=drivers/acpi' \
        '=arch/powerpc'
}

# called by dracut
install() {
    inst_multiple -o ndctl /etc/ndctl/keys/tpm.handle "/etc/ndctl/keys/*.blob"
}
  07070100000145000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90ppcmac  07070100000146000081A400000000000000000000000164DF2CB8000003B2000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90ppcmac/load-thermal.sh  #!/bin/sh
#
# This hook attempts to load the appropriate thermal modules
# for PowerPC Macs depending on the specific machine you have.

[ -r /proc/cpuinfo ] || exit 0

load_windfarm() {
    local pm_model
    pm_model="$(sed -n '/model/p' /proc/cpuinfo)"
    pm_model="${pm_model##*: }"

    # load quietly and respect the blacklist
    # this way if the modules are for some reason missing, it will
    # still exit successfully and not affect the boot process
    case "$pm_model" in
        PowerMac3,6) modprobe -b -q therm_windtunnel ;;
        PowerMac7,2 | PowerMac7,3) modprobe -b -q windfarm_pm72 ;;
        PowerMac8,1 | PowerMac8,2) modprobe -b -q windfarm_pm81 ;;
        PowerMac9,1) modprobe -b -q windfarm_pm91 ;;
        PowerMac11,2) modprobe -b -q windfarm_pm112 ;;
        PowerMac12,1) modprobe -b -q windfarm_pm121 ;;
        RackMac3,1) modprobe -b -q windfarm_rm31 ;;
        *) ;;
    esac

    return 0
}

load_windfarm
  07070100000147000081A400000000000000000000000164DF2CB800000B31000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/90ppcmac/module-setup.sh  #!/bin/bash
#
# This module attempts to properly deal with thermal behavior on PowerPC
# based Mac systems, by installing the model-appropriate (when hostonly)
# or all (when not) fan control/thermal kernel modules and loading them
# in a hook.
#
# While this is not strictly necessary for all kernels, particularly
# modular kernels will not autoload those drivers, even once the full
# system is up, which results in the fans spinning up to 100%; this is
# particularly annoying on live systems, where the system takes a while
# to load, so it's best to load the drivers early in initramfs stage.
#
# The behavior of this is inspired by the thermal hook in Debian's
# initramfs-tools, but written for dracut specifically and updated
# for modern kernels (2012+).

# called by dracut
check() {
    local _arch=${DRACUT_ARCH:-$(uname -m)}
    # only for PowerPC Macs
    [[ $_arch == ppc* && $_arch != ppc64le ]] || return 1
    return 0
}

# called by dracut
depends() {
    return 0
}

# called by dracut
installkernel() {
    pmac_model() {
        local pm_model
        pm_model="$(grep model /proc/cpuinfo)"
        echo "${pm_model##*: }"
    }

    # only PowerMac3,6 has a module, special case
    if [[ ${DRACUT_ARCH:-$(uname -m)} != ppc64* ]]; then
        if ! [[ $hostonly ]] || [[ "$(pmac_model)" == "PowerMac3,6" ]]; then
            instmods therm_windtunnel
        fi
        return 0
    fi

    windfarm_modules() {
        if ! [[ $hostonly ]]; then
            # include all drivers when not hostonly
            instmods \
                windfarm_pm72 windfarm_pm81 windfarm_pm91 windfarm_pm112 \
                windfarm_pm121 windfarm_rm31
        else
            # guess model specific module, then install the rest
            case "$(pmac_model)" in
                PowerMac7,2 | PowerMac7,3) instmods windfarm_pm72 ;;
                PowerMac8,1 | PowerMac8,2) instmods windfarm_pm81 ;;
                PowerMac9,1) instmods windfarm_pm91 ;;
                PowerMac11,2) instmods windfarm_pm112 ;;
                PowerMac12,1) instmods windfarm_pm121 ;;
                RackMac3,1) instmods windfarm_rm31 ;;
                # no match, so skip installation of the rest
                *) return 1 ;;
            esac
        fi
        return 0
    }

    # hostonly and didn't match a model; skip installing other modules
    windfarm_modules || return 0
    # these are all required by the assorted windfarm_pm*
    instmods \
        windfarm_core windfarm_cpufreq_clamp windfarm_pid \
        windfarm_smu_controls windfarm_smu_sat windfarm_smu_sensors \
        windfarm_fcu_controls windfarm_ad7417_sensor windfarm_max6690_sensor \
        windfarm_lm75_sensor windfarm_lm87_sensor
}

# called by dracut
install() {
    # this will attempt to load the appropriate modules
    inst_hook pre-udev 99 "$moddir/load-thermal.sh"
}
   07070100000148000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90qemu    07070100000149000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003300000000dracut-055+suse.347.gdcb9bdbf/modules.d/90qemu-net    0707010000014A000081ED00000000000000000000000164DF2CB800000171000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/90qemu-net/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    if [[ $hostonly ]]; then
        return 255
    fi

    if [[ $mount_needs ]]; then
        is_qemu_virtualized && return 0
        return 255
    fi

    return 0
}

# called by dracut
installkernel() {
    # qemu specific modules
    hostonly=$(optional_hostonly) instmods virtio_net e1000 8139cp pcnet32 e100 ne2k_pci
}
   0707010000014B000081ED00000000000000000000000164DF2CB8000001E1000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/90qemu/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    if [[ $hostonly ]] || [[ $mount_needs ]]; then
        is_qemu_virtualized && return 0
        return 255
    fi

    return 0
}

# called by dracut
installkernel() {
    # qemu specific modules
    hostonly='' instmods \
        ata_piix ata_generic pata_acpi cdrom sr_mod ahci \
        virtio_blk virtio virtio_ring virtio_pci \
        virtio_scsi virtio_console virtio_rng virtio_mem \
        spapr-vscsi \
        qemu_fw_cfg
}
   0707010000014C000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/modules.d/91crypt-gpg   0707010000014D000081A400000000000000000000000164DF2CB800000A23000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/91crypt-gpg/README    # Directions for changing a system from password-based gpg keyfile
# to smartcard-based gpg keyfile

# Be sure that you meet the following requirements:
#  1. GnuPG >= 2.1 installed with
#     * Smartcard support enabled (scdaemon must be built)
#     * Direct CCID access built into scdaemon
#  2. A password-based gpg keyfile ${KEYFILE} (e.g. "keyfile.gpg"):
#     That is, a file containing the slot key for LUKS, which
#     has been encrypted symmetrically with GnuPG using
#     a password.
#  3. Your public OpenPGP identity ${RECIPIENT} (e.g. "3A696356")
#  4. An OpenPGP smartcard holding the decryption key associated
#     with your public identity
#  5. A CCID smartcard reader

#  Notes: Requirement 4. and 5. can of course be one device, e.g.
#         a USB token with an integrated OpenPGP smartcard

# Make a backup of your keyfile (assuming it lies on the boot partition)
$ cp /boot/${KEYFILE} /safe/place/keyfile.bak.gpg

# Change your keyfile from purely password-based to both
# password-based and key-based (you can then decrypt the keyfile
# with either method). As an example aes256 is chosen, the cipher
# is not important to this guide, but do note that your kernel
# must support it at boot time (be it built into the kernel image
# or loaded as a module from the initramfs).
$ cat /safe/place/keyfile.bak.gpg | gpg -d | gpg --encrypt --recipient ${RECIPIENT} --cipher-algo aes256 --armor -c > /safe/place/keyfile_sc.gpg

# Verify that you can decrypt your new keyfile both with the password
# and your smartcard.
# (with smartcard inserted, you should be prompted for your PIN, unless
#  you already did so and have not yet timed out)
$ gpg -d /safe/place/keyfile_sc.gpg
# (with smartcard disconnected, you should be prompted for your password)
$ gpg -d /safe/place/keyfile_sc.gpg

# After verification, replace your old keyfile with your new one
$ su -c 'cp /safe/place/keyfile_sc.gpg /boot/${KEYFILE}'

# Export your public key to where crypt-gpg can find it
$ gpg --armor --export-options export-minimal --export ${RECIPIENT} > /safe/place/crypt-public-key.gpg
$ su -c 'cp /safe/place/crypt-public-key.gpg /etc/dracut.conf.d/crypt-public-key.gpg'

# Rebuild your initramfs as usual
# When booting with any of the requirements not met, crypt-gpg will default to password-based keyfile unlocking.
# If all requirements are met and smartcard support is not disabled by setting the kernel option "rd.luks.smartcard=0"
# crypt-gpg will try find and use a connected OpenPGP smartcard by prompting you for the PIN and then
# unlocking the gpg keyfile with the smartcard.
 0707010000014E000081ED00000000000000000000000164DF2CB800000A7D000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/91crypt-gpg/crypt-gpg-lib.sh  #!/bin/sh

command -v ask_for_password > /dev/null || . /lib/dracut-crypt-lib.sh

# gpg_decrypt mnt_point keypath keydev device
#
# Decrypts symmetrically encrypted (password or OpenPGP smartcard) key to standard output.
#
# mnt_point - mount point where <keydev> is already mounted
# keypath - GPG encrypted key path relative to <mnt_point>
# keydev - device on which key resides; only to display in prompt
# device - device to be opened by cryptsetup; only to display in prompt
gpg_decrypt() {
    local mntp="$1"
    local keypath="$2"
    local keydev="$3"
    local device="$4"

    local gpghome=/tmp/gnupg
    local opts="--homedir $gpghome --no-mdc-warning --skip-verify --quiet"
    opts="$opts --logger-file /dev/null --batch --no-tty --passphrase-fd 0"

    mkdir -m 0700 -p "$gpghome"

    # Setup GnuPG home and gpg-agent for usage of OpenPGP smartcard.
    # This requires GnuPG >= 2.1, as it uses the new ,,pinentry-mode´´
    # feature, which - when set to ,,loopback´´ - allows us to pipe
    # the smartcard's pin to GnuPG (instead of using a normal pinentry
    # program needed with GnuPG < 2.1), making for uncomplicated
    # integration with the existing codebase.
    local useSmartcard="0"
    local gpgMajorVersion
    local gpgMinorVersion
    gpgMajorVersion="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* ([0-9]*).*|\1|p')"
    gpgMinorVersion="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* [0-9]*\.([0-9]*).*|\1|p')"

    if [ "${gpgMajorVersion}" -ge 2 ] && [ "${gpgMinorVersion}" -ge 1 ] \
        && [ -f /root/crypt-public-key.gpg ] && getargbool 1 rd.luks.smartcard; then
        useSmartcard="1"
        echo "allow-loopback-pinentry" >> "$gpghome/gpg-agent.conf"
        GNUPGHOME="$gpghome" gpg-agent --quiet --daemon
        GNUPGHOME="$gpghome" gpg --quiet --no-tty --import < /root/crypt-public-key.gpg
        local smartcardSerialNumber
        smartcardSerialNumber="$(GNUPGHOME=$gpghome gpg --no-tty --card-status \
            | sed -n -r -e 's|Serial number.*: ([0-9]*)|\1|p' | tr -d '\n')"
        if [ -n "${smartcardSerialNumber}" ]; then
            inputPrompt="PIN (OpenPGP card ${smartcardSerialNumber})"
        fi
        GNUPGHOME="$gpghome" gpg-connect-agent 1> /dev/null learn /bye
        opts="$opts --pinentry-mode=loopback"
    fi

    ask_for_password \
        --cmd "gpg $opts --decrypt $mntp/$keypath" \
        --prompt "${inputPrompt:-Password ($keypath on $keydev for $device)}" \
        --tries 3 --tty-echo-off

    # Clean up the smartcard gpg-agent
    if [ "${useSmartcard}" = "1" ]; then
        GNUPGHOME="$gpghome" gpg-connect-agent 1> /dev/null killagent /bye
    fi

    rm -rf -- "$gpghome"
}
   0707010000014F000081ED00000000000000000000000164DF2CB800000727000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/91crypt-gpg/module-setup.sh   #!/bin/bash

# GPG support is optional
# called by dracut
check() {
    require_binaries gpg || return 1

    if sc_requested; then
        if ! sc_supported; then
            dwarning "crypt-gpg: GnuPG >= 2.1 with scdaemon and libusb required for ccid smartcard support"
            return 1
        fi
        return 0
    fi

    return 255
}

# called by dracut
depends() {
    echo crypt
}

# called by dracut
install() {
    inst_multiple gpg
    inst "$moddir/crypt-gpg-lib.sh" "/lib/dracut-crypt-gpg-lib.sh"

    if sc_requested; then
        inst_multiple gpg-agent
        inst_multiple gpg-connect-agent
        inst_multiple -o /usr/libexec/scdaemon /usr/lib/gnupg/scdaemon
        cp "$dracutsysrootdir$(sc_public_key)" "${initdir}/root/"
    fi
}

sc_public_key() {
    echo -n "/etc/dracut.conf.d/crypt-public-key.gpg"
}

# CCID Smartcard support requires GnuPG >= 2.1 with scdaemon and libusb
sc_supported() {
    local gpgMajor
    local gpgMinor
    local scdaemon
    gpgMajor="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* ([0-9]*).*|\1|p')"
    gpgMinor="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* [0-9]*\.([0-9]*).*|\1|p')"

    if [[ -x "$dracutsysrootdir"/usr/libexec/scdaemon ]]; then
        scdaemon=/usr/libexec/scdaemon
    elif [[ -x "$dracutsysrootdir"/usr/lib/gnupg/scdaemon ]]; then
        scdaemon=/usr/lib/gnupg/scdaemon
    else
        return 1
    fi

    if [[ ${gpgMajor} -gt 2 || ${gpgMajor} -eq 2 && ${gpgMinor} -ge 1 ]] \
        && require_binaries gpg-agent \
        && require_binaries gpg-connect-agent \
        && ($DRACUT_LDD "${dracutsysrootdir}${scdaemon}" | grep libusb > /dev/null); then
        return 0
    else
        return 1
    fi
}

sc_requested() {
    if [ -f "$dracutsysrootdir$(sc_public_key)" ]; then
        return 0
    else
        return 1
    fi
}
 07070100000150000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003500000000dracut-055+suse.347.gdcb9bdbf/modules.d/91crypt-loop  07070100000151000081ED00000000000000000000000164DF2CB80000052A000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/91crypt-loop/crypt-loop-lib.sh    #!/bin/sh

command -v ask_for_password > /dev/null || . /lib/dracut-crypt-lib.sh

# loop_decrypt mnt_point keypath keydev device
#
# Decrypts symmetrically encrypted key to standard output.
#
# mnt_point - mount point where <keydev> is already mounted
# keypath - LUKS encrypted loop file path relative to <mnt_point>
# keydev - device on which key resides; only to display in prompt
# device - device to be opened by cryptsetup; only to display in prompt
loop_decrypt() {
    local mntp="$1"
    local keypath="$2"
    local keydev="$3"
    local device="$4"
    local key

    key="/dev/mapper/$(str_replace "loop-$keydev-$mntp-$keypath" '/' '-')"

    if [ ! -b "$key" ]; then
        local loopdev
        local opts
        loopdev=$(losetup -f "${mntp}/${keypath}" --show)
        opts="-d - luksOpen $loopdev ${key##*/}"

        ask_for_password \
            --cmd "cryptsetup $opts" \
            --prompt "Password ($keypath on $keydev for $device)" \
            --tty-echo-off

        [ -b "$key" ] || die "Failed to unlock $keypath on $keydev for $device."

        printf "%s\n" "cryptsetup luksClose \"$key\"" > "${hookdir}/cleanup/crypt-loop-cleanup-10-${key##*/}.sh"
        printf "%s\n" "losetup -d \"$loopdev\"" > "${hookdir}/cleanup/crypt-loop-cleanup-20-${loopdev##*/}.sh"
    fi

    cat "$key"
}
  07070100000152000081ED00000000000000000000000164DF2CB800000177000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/91crypt-loop/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    require_binaries losetup || return 1

    return 255
}

# called by dracut
depends() {
    echo crypt
}

# called by dracut
installkernel() {
    hostonly='' instmods loop
}

# called by dracut
install() {
    inst_multiple losetup
    inst "$moddir/crypt-loop-lib.sh" "/lib/dracut-crypt-loop-lib.sh"
    dracut_need_initqueue
}
 07070100000153000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003000000000dracut-055+suse.347.gdcb9bdbf/modules.d/91fido2   07070100000154000081ED00000000000000000000000164DF2CB800000366000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/modules.d/91fido2/module-setup.sh   #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {
    # Return 255 to only include the module, if another module requires it.
    return 255
}

# Module dependency requirements.
depends() {
    # This module has external dependency on other module(s).
    echo systemd-udevd
    # Return 0 to include the dependent module(s) in the initramfs.
    return 0
}

# Install the required file(s) and directories for the module in the initramfs.
install() {
    # Install required libraries.
    _arch=${DRACUT_ARCH:-$(uname -m)}
    inst_libdir_file \
        {"tls/$_arch/",tls/,"$_arch/",}"libfido2.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libcryptsetup.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libcbor.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libhidapi-hidraw.so.*"
}
  07070100000155000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003300000000dracut-055+suse.347.gdcb9bdbf/modules.d/91tpm2-tss    07070100000156000081ED00000000000000000000000164DF2CB80000078F000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/91tpm2-tss/module-setup.sh    #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

    # If the binary(s) requirements are not fulfilled the module can't be installed.
    require_binaries tpm2 || return 1

    # Return 255 to only include the module, if another module requires it.
    return 255

}

# Module dependency requirements.
depends() {

    # This module has external dependency on other module(s).
    echo systemd-sysusers systemd-udevd
    # Return 0 to include the dependent module(s) in the initramfs.
    return 0

}

# Install kernel module(s).
installkernel() {
    instmods '=drivers/char/tpm'
}

# Install the required file(s) and directories for the module in the initramfs.
install() {

    inst_multiple -o \
        "$sysusers"/system-user-tss.conf \
        "$tmpfilesdir"/tpm2-tss-fapi*.conf \
        "$udevrulesdir"/90-tpm.rules \
        tpm2_pcrread tpm2_pcrextend tpm2_createprimary tpm2_createpolicy \
        tpm2_create tpm2_load tpm2_unseal tpm2

    # Install library file(s)
    _arch=${DRACUT_ARCH:-$(uname -m)}
    inst_libdir_file \
        {"tls/$_arch/",tls/,"$_arch/",}"libtss2-esys.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libtss2-fapi.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libtss2-mu.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libtss2-rc.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libtss2-sys.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libtss2-tcti-cmd.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libtss2-tcti-device.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libtss2-tcti-mssim.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libtss2-tcti-swtpm.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libtss2-tctildr.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libcryptsetup.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libcurl.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libjson-c.so.*"

}
 07070100000157000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/91zipl    07070100000158000081ED00000000000000000000000164DF2CB800000335000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/91zipl/install_zipl_cmdline.sh    #!/bin/bash

DEV="$1"
MNT=/boot/zipl

if [ -z "$DEV" ]; then
    echo "No IPL device given"
    : > /tmp/install.zipl.cmdline-done
    exit 1
fi

[ -d ${MNT} ] || mkdir -p ${MNT}

if ! mount -o ro "${DEV}" ${MNT}; then
    echo "Failed to mount ${MNT}"
    : > /tmp/install.zipl.cmdline-done
    exit 1
fi

if [ -f ${MNT}/dracut-cmdline.conf ]; then
    cp ${MNT}/dracut-cmdline.conf /etc/cmdline.d/99zipl.conf
fi

if [ -f ${MNT}/active_devices.txt ]; then
    while read -r dev _ || [[ $dev ]]; do
        [ "$dev" = "#" -o "$dev" = "" ] && continue
        cio_ignore -r "$dev"
    done < ${MNT}/active_devices.txt
fi

umount ${MNT}

if [ -f /etc/cmdline.d/99zipl.conf ]; then
    systemctl restart dracut-cmdline.service
    systemctl restart systemd-udev-trigger.service
fi
: > /tmp/install.zipl.cmdline-done

exit 0
   07070100000159000081ED00000000000000000000000164DF2CB80000064A000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/91zipl/module-setup.sh    #!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# called by dracut
check() {
    local _arch=${DRACUT_ARCH:-$(uname -m)}
    # Only for systems on s390 using indirect booting via userland grub
    [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
    # /boot/zipl contains a first stage kernel used to launch grub in initrd
    [ -d /boot/zipl ] || return 1
    return 0
}

# called by dracut
depends() {
    return 0
}

# called by dracut
installkernel() {
    local _boot_zipl

    _boot_zipl=$(sed -n -e '/^[[:space:]]*#/d' -e 's/\(.*\)\w*\/boot\/zipl.*/\1/p' /etc/fstab)
    if [ -n "$_boot_zipl" ]; then
        eval "$(blkid -s TYPE -o udev "${_boot_zipl}")"
        if [ -n "$ID_FS_TYPE" ]; then
            case "$ID_FS_TYPE" in
                ext?)
                    ID_FS_TYPE=ext4
                    ;;
            esac
            instmods ${ID_FS_TYPE}
        fi
    fi
}

# called by dracut
cmdline() {
    local _boot_zipl

    _boot_zipl=$(sed -n -e '/^[[:space:]]*#/d' -e 's/\(.*\)\w*\/boot\/zipl.*/\1/p' /etc/fstab)
    if [ -n "$_boot_zipl" ]; then
        echo "rd.zipl=${_boot_zipl}"
    fi
}

# called by dracut
install() {
    inst_multiple mount umount

    inst_hook cmdline 91 "$moddir/parse-zipl.sh"
    inst_script "${moddir}/install_zipl_cmdline.sh" /sbin/install_zipl_cmdline.sh
    if [[ $hostonly_cmdline == "yes" ]]; then
        local _zipl
        _zipl=$(cmdline)

        [[ $_zipl ]] && printf "%s\n" "$_zipl" > "${initdir}/etc/cmdline.d/91zipl.conf"
    fi
    dracut_need_initqueue
}
  0707010000015A000081ED00000000000000000000000164DF2CB8000006FB000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/91zipl/parse-zipl.sh  #!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

zipl_arg=$(getarg rd.zipl)

if [ -n "$zipl_arg" ]; then
    case "$zipl_arg" in
        LABEL=*)
            zipl_env="ENV{ID_FS_LABEL}"
            zipl_val=${zipl_arg#LABEL=}
            zipl_arg="$(label_uuid_to_dev "${zipl_arg}")"
            ;;
        UUID=*)
            zipl_env="ENV{ID_FS_UUID}"
            zipl_val=${zipl_arg#UUID=}
            zipl_arg="$(label_uuid_to_dev "${zipl_arg}")"
            ;;
        PARTLABEL=*)
            zipl_env="ENV{ID_FS_PARTLABEL}"
            zipl_val=${zipl_arg#PARTLABEL=}
            zipl_arg="$(label_uuid_to_dev "${zipl_arg}")"
            ;;
        PARTUUID=*)
            zipl_env="ENV{ID_FS_PARTUUID}"
            zipl_val=${zipl_arg#PARTUUID=}
            zipl_arg="$(label_uuid_to_dev "${zipl_arg}")"
            ;;
        /dev/mapper/*)
            zipl_env="ENV{DM_NAME}"
            zipl_val=${zipl_arg#/dev/mapper/}
            ;;
        /dev/disk/by-*)
            zipl_env="SYMLINK"
            zipl_val=${zipl_arg#/dev/}
            ;;
        /dev/*)
            zipl_env="KERNEL"
            zipl_val=${zipl_arg}
            ;;
    esac
    if [ "$zipl_env" ]; then
        {
            printf 'ACTION=="add|change", SUBSYSTEM=="block", %s=="%s", ENV{SYSTEMD_READY}!="0", RUN+="/sbin/initqueue --settled --onetime --unique --name install_zipl_cmdline /sbin/install_zipl_cmdline.sh %s"\n' \
                ${zipl_env} "${zipl_val}" "${zipl_arg}"
            echo "[ -f /tmp/install.zipl.cmdline-done ]" > "$hookdir"/initqueue/finished/wait-zipl-conf.sh
        } >> /etc/udev/rules.d/99zipl-conf.rules
        cat /etc/udev/rules.d/99zipl-conf.rules
    fi
    wait_for_dev -n "$zipl_arg"
fi
 0707010000015B000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95cifs    0707010000015C000081ED00000000000000000000000164DF2CB800000465000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95cifs/cifs-lib.sh    #!/bin/sh

# cifs_to_var CIFSROOT
# use CIFSROOT to set $server, $path, and $options.
# CIFSROOT is something like: cifs://[<username>[:<password>]]@<host>/<path>
# NETIF is used to get information from DHCP options, if needed.

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

cifs_to_var() {
    local cifsuser
    local cifspass
    # Check required arguments
    server=${1##cifs://}
    cifsuser=${server%@*}
    cifspass=${cifsuser#*:}
    if [ "$cifspass" != "$cifsuser" ]; then
        cifsuser=${cifsuser%:*}
    else
        cifspass=$(getarg cifspass)
    fi
    if [ "$cifsuser" != "$server" ]; then
        server="${server#*@}"
    else
        cifsuser=$(getarg cifsuser)
    fi

    # shellcheck disable=SC2034
    path=${server#*/}
    # shellcheck disable=SC2034
    server=${server%/*}

    if [ ! "$cifsuser" -o ! "$cifspass" ]; then
        die "For CIFS support you need to specify a cifsuser and cifspass either in the cifsuser and cifspass commandline parameters or in the root= CIFS URL."
    fi
    # shellcheck disable=SC2034
    options="user=$cifsuser,pass=$cifspass,$(getarg rootflags=)"
}
   0707010000015D000081ED00000000000000000000000164DF2CB800000287000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95cifs/cifsroot.sh    #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
. /lib/cifs-lib.sh

[ "$#" = 3 ] || exit 1

# root is in the form root=cifs://user:pass@[server]/[folder] either from
# cmdline or dhcp root-path
#netif="$1"
root="$2"
NEWROOT="$3"

cifs_to_var "$root"

# shellcheck disable=SC2154
mount.cifs "//$server/$path" "$NEWROOT" -o "$options" && { [ -e /dev/root ] || ln -s null /dev/root; }

# inject new exit_if_exists
# shellcheck disable=SC2016
# shellcheck disable=SC2154
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm -f -- "$job"' > "$hookdir"/initqueue/cifs.sh
# force udevsettle to break
: > "$hookdir"/initqueue/work
 0707010000015E000081ED00000000000000000000000164DF2CB800000599000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95cifs/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    # If our prerequisites are not met, fail anyways.
    require_binaries mount.cifs || return 1

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for fs in "${host_fs_types[@]}"; do
            [[ $fs == "cifs" ]] && return 0
        done
        return 255
    }

    return 0
}

# called by dracut
depends() {
    # We depend on network modules being loaded
    echo network
}

# called by dracut
installkernel() {
    instmods cifs ipv6
    # hash algos
    instmods md4 md5 sha256 sha512
    # ciphers
    instmods aes arc4 des ecb gcm aead2
    # macs
    instmods hmac cmac ccm
}

# called by dracut
install() {
    local _nsslibs
    inst_multiple -o mount.cifs
    inst_multiple -o /etc/services /etc/nsswitch.conf /etc/protocols
    inst_multiple -o /usr/etc/services /usr/etc/nsswitch.conf /usr/etc/protocols

    inst_libdir_file 'libcap-ng.so*'

    _nsslibs=$(
        cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
            | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \
            | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
    )
    _nsslibs=${_nsslibs#|}
    _nsslibs=${_nsslibs%|}

    inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'

    inst_hook cmdline 90 "$moddir/parse-cifsroot.sh"
    inst "$moddir/cifsroot.sh" "/sbin/cifsroot"
    inst "$moddir/cifs-lib.sh" "/lib/cifs-lib.sh"
    dracut_need_initqueue
}
   0707010000015F000081ED00000000000000000000000164DF2CB8000004F7000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/95cifs/parse-cifsroot.sh  #!/bin/sh
#
# root=cifs://[user:pass@]<server>/<folder>
#
# This syntax can come from DHCP root-path as well.
#
# If a username or password are not specified as part of the root, then they
# will be pulled from cifsuser and cifspass on the kernel command line,
# respectively.
#

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
. /lib/cifs-lib.sh

# This script is sourced, so root should be set. But let's be paranoid
[ -z "$root" ] && root=$(getarg root=)

if [ -z "$netroot" ]; then
    for netroot in $(getargs netroot=); do
        [ "${netroot%%:*}" = "cifs" ] && break
    done
    [ "${netroot%%:*}" = "cifs" ] || unset netroot
fi

# Root takes precedence over netroot
if [ "${root%%:*}" = "cifs" ]; then
    if [ -n "$netroot" ]; then
        warn "root takes precedence over netroot. Ignoring netroot"
    fi
    netroot=$root
    unset root
fi

# If it's not cifs we don't continue
[ "${netroot%%:*}" = "cifs" ] || return

# Check required arguments
cifs_to_var "$netroot"

# If we don't have a server, we need dhcp
if [ -z "$server" ]; then
    # shellcheck disable=SC2034
    DHCPORSERVER="1"
fi

# Done, all good!
# shellcheck disable=SC2034
rootok=1

# shellcheck disable=SC2016
echo '[ -e $NEWROOT/proc ]' > "$hookdir"/initqueue/finished/cifsroot.sh
 07070100000160000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95dasd    07070100000161000081ED00000000000000000000000164DF2CB80000023D000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95dasd/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    local _arch=${DRACUT_ARCH:-$(uname -m)}
    [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
    require_binaries normalize_dasd_arg || return 1
    return 0
}

# called by dracut
depends() {
    echo "dasd_mod"
    return 0
}

# called by dracut
install() {
    inst_hook cmdline 30 "$moddir/parse-dasd.sh"
    inst_multiple dasdinfo dasdconf.sh normalize_dasd_arg
    conf=/etc/dasd.conf
    if [[ $hostonly && -f $conf ]]; then
        inst -H $conf
    fi
    inst_rules 56-dasd.rules
    inst_rules 59-dasd.rules
}
   07070100000162000081ED00000000000000000000000164DF2CB80000010D000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95dasd/parse-dasd.sh  #!/bin/sh
for dasd_arg in $(getargs rd.dasd= -d rd_DASD= DASD=); do
    (
        local OLDIFS="$IFS"
        IFS=","
        # shellcheck disable=SC2086
        set -- $dasd_arg
        IFS="$OLDIFS"
        echo "$@" | normalize_dasd_arg >> /etc/dasd.conf
    )
done
   07070100000163000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003300000000dracut-055+suse.347.gdcb9bdbf/modules.d/95dasd_mod    07070100000164000081ED00000000000000000000000164DF2CB8000001F3000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/95dasd_mod/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    local _arch=${DRACUT_ARCH:-$(uname -m)}
    [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
    require_binaries grep sed seq

    return 0
}

# called by dracut
depends() {
    return 0
}

# called by dracut
installkernel() {
    instmods dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod
}

# called by dracut
install() {
    inst_hook cmdline 31 "$moddir/parse-dasd-mod.sh"
    inst_multiple grep sed seq
    inst_multiple -o dasd_cio_free
}
 07070100000165000081ED00000000000000000000000164DF2CB8000001A2000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/95dasd_mod/parse-dasd-mod.sh  #!/bin/sh
mod_args=""

for dasd_arg in $(getargs rd.dasd= -d rd_DASD= DASD=); do
    mod_args="$mod_args,$dasd_arg"
done

mod_args="${mod_args#*,}"

if [ -x /sbin/dasd_cio_free -a -n "$mod_args" ]; then
    [ -d /etc/modprobe.d ] || mkdir -m 0755 -p /etc/modprobe.d
    echo "options dasd_mod dasd=$mod_args" >> /etc/modprobe.d/dasd_mod.conf
fi

unset dasd_arg
if [ -x /sbin/dasd_cio_free ]; then
    dasd_cio_free
fi
  07070100000166000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003500000000dracut-055+suse.347.gdcb9bdbf/modules.d/95dasd_rules  07070100000167000081ED00000000000000000000000164DF2CB800000667000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/95dasd_rules/module-setup.sh  #!/bin/bash

# called by dracut
cmdline() {
    is_dasd() {
        local _dev=$1
        local _devpath
        _devpath=$(
            cd -P /sys/dev/block/"$_dev" || exit
            echo "$PWD"
        )

        [ "${_devpath#*/dasd}" == "$_devpath" ] && return 1
        _ccw="${_devpath%%/block/*}"
        echo "rd.dasd=${_ccw##*/}"
        return 0
    }
    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for_each_host_dev_and_slaves_all is_dasd || return 255
    } | sort | uniq
}

# called by dracut
check() {
    local _arch=${DRACUT_ARCH:-$(uname -m)}
    local found=0
    local bdev
    [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for bdev in /sys/block/*; do
            case "${bdev##*/}" in
                dasd*)
                    found=$((found + 1))
                    break
                    ;;
            esac
        done
        [ $found -eq 0 ] && return 255
    }
    return 0
}

# called by dracut
depends() {
    echo 'dasd_mod' bash
    return 0
}

# called by dracut
install() {
    inst_multiple -o /usr/lib/udev/collect
    inst_hook cmdline 30 "$moddir/parse-dasd.sh"
    if [[ $hostonly_cmdline == "yes" ]]; then
        local _dasd
        _dasd=$(cmdline)
        [[ $_dasd ]] && printf "%s\n" "$_dasd" >> "${initdir}/etc/cmdline.d/95dasd.conf"
    fi
    if [[ $hostonly ]]; then
        inst_rules_wildcard "51-dasd-*.rules"
        inst_rules_wildcard "41-dasd-*.rules"
        mark_hostonly /etc/udev/rules.d/51-dasd-*.rules
        mark_hostonly /etc/udev/rules.d/41-dasd-*.rules
    fi
    inst_rules 59-dasd.rules
}
 07070100000168000081ED00000000000000000000000164DF2CB8000004E4000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/95dasd_rules/parse-dasd.sh    #!/bin/bash

allow_device() {
    local ccw=$1

    if [ -x /sbin/cio_ignore ] && cio_ignore -i "$ccw" > /dev/null; then
        cio_ignore -r "$ccw"
    fi
}

if [[ -f /sys/firmware/ipl/ipl_type ]] && [[ $(< /sys/firmware/ipl/ipl_type) == "ccw" ]]; then
    allow_device "$(< /sys/firmware/ipl/device)"
fi

for dasd_arg in $(getargs root=) $(getargs resume=); do
    [[ $dasd_arg =~ /dev/disk/by-path/ccw-* ]] || continue

    ccw_dev="${dasd_arg##*/ccw-}"
    allow_device "${ccw_dev%%-*}"
done

for dasd_arg in $(getargs rd.dasd=); do
    IFS=',' read -r -a devs <<< "$dasd_arg"
    declare -p devs
    for dev in "${devs[@]}"; do
        case "$dev" in
            autodetect | probeonly) ;;

            *-*)
                IFS="-" read -r start end _ <<< "${dev%(ro)}"
                prefix=${start%.*}
                start=${start##*.}
                for rdev in $(seq $((16#$start)) $((16#$end))); do
                    allow_device "$(printf "%s.%04x" "$prefix" "$rdev")"
                done
                ;;
            *)
                IFS="." read -r sid ssid chan _ <<< "${dev%(ro)}"
                allow_device "$(printf "%01x.%01x.%04x" $((16#$sid)) $((16#$ssid)) $((16#$chan)))"
                ;;
        esac
    done
done
07070100000169000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/modules.d/95dcssblk 0707010000016A000081ED00000000000000000000000164DF2CB800000394000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/modules.d/95dcssblk/module-setup.sh #!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# called by dracut
check() {
    local _arch=${DRACUT_ARCH:-$(uname -m)}
    [[ $_arch == "s390" ]] || [[ $_arch == "s390x" ]] || return 1
    return 0
}

# called by dracut
installkernel() {
    if [[ $hostonly ]]; then
        for dev in /sys/devices/dcssblk/*/block/dcssblk*; do
            [[ -e $dev ]] || continue
            hostonly='' instmods dcssblk
            return $?
        done
    else
        hostonly='' instmods dcssblk
    fi
}

# called by dracut
install() {
    inst_hook cmdline 30 "$moddir/parse-dcssblk.sh"
    # If there is a config file which contains avail (best only of root device)
    # disks to activate add it and use it during boot -> then we do not need
    # a kernel param anymore
    #if [[ $hostonly ]]; then
    #    inst /etc/dcssblk.conf
    #fi
}
0707010000016B000081ED00000000000000000000000164DF2CB800000097000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/95dcssblk/parse-dcssblk.sh    #!/bin/sh

if dcssblk_arg=$(getarg rd.dcssblk=); then
    info "Loading dcssblk segments=$dcssblk_arg"
    modprobe dcssblk segments="$dcssblk_arg"
fi
 0707010000016C000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003000000000dracut-055+suse.347.gdcb9bdbf/modules.d/95debug   0707010000016D000081ED00000000000000000000000164DF2CB800000223000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/modules.d/95debug/module-setup.sh   #!/bin/bash

# called by dracut
check() {
    # do not add this module by default
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    inst_multiple -o ls ps grep more cat rm strace free showmount df du lsblk \
        ping netstat rpcinfo vi scp ping6 ssh find \
        tcpdump cp dd less hostname mkdir systemd-analyze \
        fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.f2fs fsck.vfat e2fsck

    grep '^tcpdump:' "$dracutsysrootdir"/etc/passwd 2> /dev/null >> "$initdir/etc/passwd"
}
 0707010000016E000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95fcoe    0707010000016F000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/modules.d/95fcoe-uefi   07070100000170000081ED00000000000000000000000164DF2CB8000001FD000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/95fcoe-uefi/module-setup.sh   #!/bin/bash

# called by dracut
check() {
    is_fcoe() {
        block_is_fcoe "$1" || return 1
    }

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for_each_host_dev_and_slaves is_fcoe || return 255
        [ -d /sys/firmware/efi ] || return 255
    }

    require_binaries dcbtool fipvlan lldpad ip readlink || return 1
    return 0
}

# called by dracut
depends() {
    echo fcoe uefi-lib bash
    return 0
}

# called by dracut
install() {
    inst_hook cmdline 20 "$moddir/parse-uefifcoe.sh"
}
   07070100000171000081ED00000000000000000000000164DF2CB800000395000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/modules.d/95fcoe-uefi/parse-uefifcoe.sh #!/bin/bash

command -v getarg > /dev/null || . /lib/dracut-lib.sh
command -v get_fcoe_boot_mac > /dev/null || . /lib/uefi-lib.sh
command -v set_ifname > /dev/null || . /lib/net-lib.sh

print_fcoe_uefi_conf() {
    local mac dev vlan
    mac=$(get_fcoe_boot_mac "$1")
    [ -z "$mac" ] && return 1
    dev=$(set_ifname fcoe "$mac")
    vlan=$(get_fcoe_boot_vlan "$1")
    if [ "$vlan" -ne "0" ]; then
        case "$vlan" in
            [0-9]*)
                printf "%s\n" "vlan=$dev.$vlan:$dev"
                dev="$dev.$vlan"
                ;;
            *)
                printf "%s\n" "vlan=$vlan:$dev"
                dev="$vlan"
                ;;
        esac
    fi
    # fcoe=eth0:nodcb
    printf "fcoe=%s\n" "$dev:nodcb"
    return 0
}

for i in /sys/firmware/efi/efivars/FcoeBootDevice-*; do
    [ -e "$i" ] || continue
    print_fcoe_uefi_conf "$i" > /etc/cmdline.d/40-fcoe-uefi.conf && break
done
   07070100000172000081ED00000000000000000000000164DF2CB800000244000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95fcoe/cleanup-fcoe.sh    #!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

if [ -e /var/run/lldpad.pid ]; then
    lldpad -k
    # with systemd version 230, this is not necessary anymore
    # systemd commit cacf980ed44a28e276a6cc7f8fc41f991e2ab354
    if [ -z "$DRACUT_SYSTEMD" ]; then
        # shellcheck disable=SC2174
        mkdir -m 0755 -p /run/initramfs/state/dev/shm
        cp /dev/shm/lldpad.state /run/initramfs/state/dev/shm/ > /dev/null 2>&1
        echo "files /dev/shm/lldpad.state" >> /run/initramfs/rwtab
    fi
fi
07070100000173000081ED00000000000000000000000164DF2CB8000004FA000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95fcoe/fcoe-edd.sh    #!/bin/sh

dcb="$1"

_modprobe_r_edd="0"

check_edd() {
    local cnt=0

    [ -d /sys/firmware/edd ] && return 0

    _modprobe_r_edd="1"
    modprobe edd || return $?

    while [ $cnt -lt 600 ]; do
        [ -d /sys/firmware/edd ] && return 0
        cnt=$((cnt + 1))
        sleep 0.1
    done
    return 1
}

check_edd || exit 1

for disk in /sys/firmware/edd/int13_*; do
    [ -d "$disk" ] || continue
    if [ -e "${disk}/pci_dev/driver" ]; then
        driver=$(readlink "${disk}/pci_dev/driver")
        driver=${driver##*/}
    fi
    # i40e uses dev_port 1 for a virtual fcoe function
    if [ "${driver}" = "i40e" ]; then
        dev_port=1
    fi
    for nic in "${disk}"/pci_dev/net/*; do
        [ -d "$nic" ] || continue
        if [ -n "${dev_port}" -a -e "${nic}/dev_port" ]; then
            if [ "$(cat "${nic}"/dev_port)" -ne "${dev_port}" ]; then
                continue
            fi
        fi
        if [ -e "${nic}"/address ]; then
            fcoe_interface=${nic##*/}
            if ! [ -e "/tmp/.fcoe-$fcoe_interface" ]; then
                /sbin/fcoe-up "$fcoe_interface" "$dcb"
                : > "/tmp/.fcoe-$fcoe_interface"
            fi
        fi
    done
done

[ "$_modprobe_r_edd" = "1" ] && modprobe -r edd

unset _modprobe_r_edd
  07070100000174000081ED00000000000000000000000164DF2CB800000A07000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95fcoe/fcoe-up.sh #!/bin/sh
#
# We get called like this:
# fcoe-up <network-device> <dcb|nodcb> <fabric|vn2vn>
#
# Note currently only nodcb is supported, the dcb option is reserved for
# future use.

PATH=/usr/sbin:/usr/bin:/sbin:/bin
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
type ip_to_var > /dev/null 2>&1 || . /lib/net-lib.sh

# Huh? Missing arguments ??
[ -z "$1" -o -z "$2" ] && exit 1

netif=$1
dcb=$2
mode=$3
vlan="yes"

iflink=$(cat /sys/class/net/"$netif"/iflink)
ifindex=$(cat /sys/class/net/"$netif"/ifindex)
if [ "$iflink" != "$ifindex" ]; then
    # Skip VLAN devices
    exit 0
fi

ip link set dev "$netif" up
linkup "$netif"

# Some fcoemon implementations expect --syslog=true
syslogopt="--syslog"
if fcoemon -h | grep syslog | grep -q yes; then
    syslogopt="$syslogopt=yes"
fi

netdriver=$(readlink -f /sys/class/net/"$netif"/device/driver)
netdriver=${netdriver##*/}

write_fcoemon_cfg() {
    [ -f /etc/fcoe/cfg-"$netif" ] && return
    echo FCOE_ENABLE=\"yes\" > /etc/fcoe/cfg-"$netif"
    if [ "$dcb" = "dcb" ]; then
        echo DCB_REQUIRED=\"yes\" >> /etc/fcoe/cfg-"$netif"
    else
        echo DCB_REQUIRED=\"no\" >> /etc/fcoe/cfg-"$netif"
    fi
    if [ "$vlan" = "yes" ]; then
        echo AUTO_VLAN=\"yes\" >> /etc/fcoe/cfg-"$netif"
    else
        echo AUTO_VLAN=\"no\" >> /etc/fcoe/cfg-"$netif"
    fi
    if [ "$mode" = "vn2vn" ]; then
        echo MODE=\"vn2vn\" >> /etc/fcoe/cfg-"$netif"
    else
        echo MODE=\"fabric\" >> /etc/fcoe/cfg-"$netif"
    fi
}

if [ "$netdriver" = "bnx2x" ]; then
    # If driver is bnx2x, do not use /sys/module/fcoe/parameters/create but fipvlan
    modprobe 8021q
    udevadm settle --timeout=30
    # Sleep for 13 s to allow dcb negotiation
    sleep 13
    fipvlan "$netif" -c -s
    need_shutdown
    exit
fi
if [ "$dcb" = "dcb" ]; then
    # wait for lldpad to be ready
    i=0
    while [ $i -lt 60 ]; do
        lldptool -p && break
        info "Waiting for lldpad to be ready"
        sleep 1
        i=$((i + 1))
    done

    while [ $i -lt 60 ]; do
        dcbtool sc "$netif" dcb on && break
        info "Retrying to turn dcb on"
        sleep 1
        i=$((i + 1))
    done

    while [ $i -lt 60 ]; do
        dcbtool sc "$netif" pfc e:1 a:1 w:1 && break
        info "Retrying to turn dcb on"
        sleep 1
        i=$((i + 1))
    done

    while [ $i -lt 60 ]; do
        dcbtool sc "$netif" app:fcoe e:1 a:1 w:1 && break
        info "Retrying to turn fcoe on"
        sleep 1
        i=$((i + 1))
    done

    sleep 1
fi
write_fcoemon_cfg
fcoemon $syslogopt

need_shutdown
 07070100000175000081ED00000000000000000000000164DF2CB8000001DC000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/modules.d/95fcoe/lldpad.sh  #!/bin/sh

if ! getargbool 1 rd.fcoe -d -n rd.nofcoe; then
    info "rd.fcoe=0: skipping lldpad activation"
    return 0
fi

# Note lldpad will stay running after switchroot, the system initscripts
# are to kill it and start a new lldpad to take over. Data is transfered
# between the 2 using a shm segment
lldpad -d
# wait for lldpad to be ready
i=0
while [ $i -lt 60 ]; do
    lldptool -p && break
    info "Waiting for lldpad to be ready"
    sleep 1
    i=$((i + 1))
done
07070100000176000081ED00000000000000000000000164DF2CB800000E0F000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95fcoe/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    is_fcoe() {
        block_is_fcoe "$1" || return 1
    }

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for_each_host_dev_and_slaves is_fcoe || return 255
    }

    require_binaries dcbtool fipvlan lldpad ip readlink fcoemon fcoeadm tr || return 1
    return 0
}

# called by dracut
depends() {
    echo network rootfs-block
    return 0
}

# called by dracut
installkernel() {
    instmods fcoe libfcoe 8021q edd bnx2fc
}

get_vlan_parent() {
    local link=$1

    [ -d "$link" ] || return
    read -r iflink < "$link"/iflink
    for if in /sys/class/net/*; do
        read -r idx < "$if"/ifindex
        if [ "$idx" -eq "$iflink" ]; then
            echo "${if##*/}"
        fi
    done
}

# called by dracut
cmdline() {
    {
        for c in /sys/bus/fcoe/devices/ctlr_*; do
            [ -L "$c" ] || continue
            read -r enabled < "$c"/enabled
            read -r mode < "$c"/mode
            [ "$enabled" -eq 0 ] && continue
            if [ "$mode" = "VN2VN" ]; then
                mode="vn2vn"
            else
                mode="fabric"
            fi
            d=$(
                cd -P "$c" || exit
                echo "$PWD"
            )
            i=${d%/*}
            ifname=${i##*/}
            read -r mac < "${i}"/address
            s=$(dcbtool gc "${i##*/}" dcb 2> /dev/null | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
            if [ -z "$s" ]; then
                p=$(get_vlan_parent "${i}")
                if [ "$p" ]; then
                    s=$(dcbtool gc "${p}" dcb 2> /dev/null | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
                    ifname=${p##*/}
                fi
            fi
            if [ "$s" = "on" ]; then
                dcb="dcb"
            else
                dcb="nodcb"
            fi

            # Some Combined Network Adapters(CNAs) implement DCB in firmware.
            # Do not run software-based DCB or LLDP on CNAs that implement DCB.
            # If the network interface provides hardware DCB/DCBX capabilities,
            # DCB_REQUIRED in "/etc/fcoe/cfg-xxx" is expected to set to "no".
            #
            # Force "nodcb" if there's any DCB_REQUIRED="no"(child or vlan parent).
            if grep -q '^[[:blank:]]*DCB_REQUIRED="no"' /etc/fcoe/cfg-"${i##*/}" &> /dev/null; then
                dcb="nodcb"
            fi

            if [ "$p" ]; then
                if grep -q '^[[:blank:]]*DCB_REQUIRED="no"' /etc/fcoe/cfg-"${p}" &> /dev/null; then
                    dcb="nodcb"
                fi
            fi

            echo "ifname=${ifname}:${mac}"
            echo "fcoe=${ifname}:${dcb}:${mode}"
        done
    } | sort | uniq
}

# called by dracut
install() {
    inst_multiple ip dcbtool fipvlan lldpad readlink lldptool fcoemon fcoeadm tr
    if [[ -e $dracutsysrootdir/etc/hba.conf ]]; then
        inst_libdir_file 'libhbalinux.so*'
        inst_simple "/etc/hba.conf"
    fi

    mkdir -m 0755 -p "$initdir/var/lib/lldpad"
    mkdir -m 0755 -p "$initdir/etc/fcoe"

    if [[ $hostonly_cmdline == "yes" ]]; then
        local _fcoeconf
        _fcoeconf=$(cmdline)
        [[ $_fcoeconf ]] && printf "%s\n" "$_fcoeconf" >> "${initdir}/etc/cmdline.d/95fcoe.conf"
    fi
    inst_multiple "/etc/fcoe/cfg-*"

    inst "$moddir/fcoe-up.sh" "/sbin/fcoe-up"
    inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
    inst_hook pre-trigger 03 "$moddir/lldpad.sh"
    inst_hook cmdline 99 "$moddir/parse-fcoe.sh"
    inst_hook cleanup 90 "$moddir/cleanup-fcoe.sh"
    inst_hook shutdown 40 "$moddir/stop-fcoe.sh"
    dracut_need_initqueue
}
 07070100000177000081ED00000000000000000000000164DF2CB800000D22000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95fcoe/parse-fcoe.sh  #!/bin/sh
#
# Supported formats:
# fcoe=<networkdevice>:<dcb|nodcb>:<fabric|vn2vn>
# fcoe=<macaddress>:<dcb|nodcb>:<fabric|vn2vn>
#
# Note currently only nodcb is supported, the dcb option is reserved for
# future use.
#
# Note letters in the macaddress must be lowercase!
#
# Examples:
# fcoe=eth0:nodcb:vn2vn
# fcoe=4a:3f:4c:04:f8:d7:nodcb:fabric

if [ -z "$fcoe" ] && ! getarg fcoe=; then
    # If it's not set we don't continue
    return 0
fi

if ! getargbool 1 rd.fcoe -d -n rd.nofcoe; then
    info "rd.fcoe=0: skipping fcoe"
    return 0
fi

if ! [ -e /sys/bus/fcoe/ctlr_create ] && ! modprobe -b -a fcoe && ! modprobe -b -a libfcoe; then
    die "FCoE requested but kernel/initrd does not support FCoE"
fi

initqueue --onetime modprobe -b -q bnx2fc

parse_fcoe_opts() {
    local fcoe_interface
    local fcoe_dcb
    local fcoe_mode
    local fcoe_mac
    local OLDIFS="$IFS"
    local IFS=:
    # shellcheck disable=SC2086
    # shellcheck disable=SC2048
    set -- $*
    IFS="$OLDIFS"

    case $# in
        2)
            fcoe_interface=$1
            fcoe_dcb=$2
            fcoe_mode="fabric"
            unset fcoe_mac
            ;;
        3)
            fcoe_interface=$1
            fcoe_dcb=$2
            fcoe_mode=$3
            unset fcoe_mac
            ;;
        7)
            fcoe_mac=$(echo "$1:$2:$3:$4:$5:$6" | tr "[:upper:]" "[:lower:]")
            fcoe_dcb=$7
            fcoe_mode="fabric"
            unset fcoe_interface
            ;;
        8)
            fcoe_mac=$(echo "$1:$2:$3:$4:$5:$6" | tr "[:upper:]" "[:lower:]")
            fcoe_dcb=$7
            fcoe_mode=$8
            unset fcoe_interface
            ;;
        *)
            warn "Invalid arguments for fcoe=$fcoe"
            return 1
            ;;
    esac

    if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ]; then
        warn "Invalid FCoE DCB option: $fcoe_dcb"
    fi

    if [ "$fcoe_interface" = "edd" ]; then
        /sbin/initqueue --settled --unique /sbin/fcoe-edd "$fcoe_dcb"
        return 0
    fi

    if [ -z "$fcoe_interface" -a -z "$fcoe_mac" ]; then
        warn "fcoe: Neither interface nor MAC specified for fcoe=$fcoe"
        return 1
    fi

    {
        if [ -n "$fcoe_mac" ]; then
            # shellcheck disable=SC2016
            printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/initqueue --onetime --unique --name fcoe-up-$name /sbin/fcoe-up $name %s %s"\n' "$fcoe_mac" "$fcoe_dcb" "$fcoe_mode"
            # shellcheck disable=SC2016
            printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/initqueue --onetime --timeout --unique --name fcoe-timeout-$name /sbin/fcoe-up $name %s %s"\n' "$fcoe_mac" "$fcoe_dcb" "$fcoe_mode"
        else
            # shellcheck disable=SC2016
            printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/initqueue --onetime --unique --name fcoe-up-$name /sbin/fcoe-up $name %s %s"\n' "$fcoe_interface" "$fcoe_dcb" "$fcoe_mode"
            # shellcheck disable=SC2016
            printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/initqueue --onetime --timeout --unique --name fcoe-timeout-$name /sbin/fcoe-up $name %s %s"\n' "$fcoe_interface" "$fcoe_dcb" "$fcoe_mode"
        fi
    } >> /etc/udev/rules.d/92-fcoe.rules
}

for fcoe in $fcoe $(getargs fcoe=); do
    parse_fcoe_opts "$fcoe"
done
  07070100000178000081ED00000000000000000000000164DF2CB800000070000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95fcoe/stop-fcoe.sh   #!/bin/sh

for f in /sys/bus/fcoe/devices/ctlr_*; do
    [ -e "$f" ] || continue
    echo 0 > "$f"/enabled
done
07070100000179000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/modules.d/95fstab-sys   0707010000017A000081ED00000000000000000000000164DF2CB800000154000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/95fstab-sys/module-setup.sh   #!/bin/bash

# called by dracut
check() {
    [[ -f $dracutsysrootdir/etc/fstab.sys ]] || [[ -n $add_fstab || -n $fstab_lines ]]
}

# called by dracut
depends() {
    echo fs-lib
}

# called by dracut
install() {
    [[ -f $dracutsysrootdir/etc/fstab.sys ]] && inst_simple /etc/fstab.sys
    inst_hook pre-pivot 00 "$moddir/mount-sys.sh"
}
0707010000017B000081ED00000000000000000000000164DF2CB800000510000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/95fstab-sys/mount-sys.sh  #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
type det_fs > /dev/null 2>&1 || . /lib/fs-lib.sh

fstab_mount() {
    local _dev _mp _fs _opts _pass
    test -e "$1" || return 1
    info "Mounting from $1"
    while read -r _dev _mp _fs _opts _ _pass _ || [ -n "$_dev" ]; do
        [ -z "${_dev%%#*}" ] && continue # Skip comment lines
        ismounted "$_mp" && continue     # Skip mounted filesystem
        if [ "$_pass" -gt 0 ] && ! strstr "$_opts" _netdev; then
            fsck_single "$_dev" "$_fs" "$_opts"
        fi
        _fs=$(det_fs "$_dev" "$_fs")
        info "Mounting $_dev"
        if [ -d "$NEWROOT/$_mp" ]; then
            mount -v -t "$_fs" -o "$_opts" "$_dev" "$NEWROOT/$_mp" 2>&1 | vinfo
        else
            [ -d "$_mp" ] || mkdir -p "$_mp"
            mount -v -t "$_fs" -o "$_opts" "$_dev" "$_mp" 2>&1 | vinfo
        fi
    done < "$1"
    return 0
}

# systemd will mount and run fsck from /etc/fstab and we don't want to
# run into a race condition.
if [ -z "$DRACUT_SYSTEMD" ]; then
    [ -f /etc/fstab ] && fstab_mount /etc/fstab
fi

# prefer $NEWROOT/etc/fstab.sys over local /etc/fstab.sys
if [ -f "$NEWROOT"/etc/fstab.sys ]; then
    fstab_mount "$NEWROOT"/etc/fstab.sys
elif [ -f /etc/fstab.sys ]; then
    fstab_mount /etc/fstab.sys
fi
0707010000017C000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003000000000dracut-055+suse.347.gdcb9bdbf/modules.d/95iscsi   0707010000017D000081ED00000000000000000000000164DF2CB800000084000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/95iscsi/cleanup-iscsi.sh  #!/bin/sh

if [ -z "${DRACUT_SYSTEMD}" ] && { [ -e /sys/module/bnx2i ] || [ -e /sys/module/qedi ]; }; then
    killproc iscsiuio
fi
0707010000017E000081ED00000000000000000000000164DF2CB800002C5C000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95iscsi/iscsiroot.sh  #!/bin/sh
#
# This implementation is incomplete: Discovery mode is not implemented and
# the argument handling doesn't follow currently agreed formats. This is mainly
# because rfc4173 does not say anything about iscsi_initiator but open-iscsi's
# iscsistart needs this.
#

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
type parse_iscsi_root > /dev/null 2>&1 || . /lib/net-lib.sh
type write_fs_tab > /dev/null 2>&1 || . /lib/fs-lib.sh

PATH=/usr/sbin:/usr/bin:/sbin:/bin

# Huh? Empty $1?
[ -z "$1" ] && exit 1

# Huh? Empty $2?
[ -z "$2" ] && exit 1

# Huh? Empty $3? This isn't really necessary, since NEWROOT isn't
# used here. But let's be consistent
[ -z "$3" ] && exit 1

# root is in the form root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
netif="$1"
iroot="$2"

# If it's not iscsi we don't continue
[ "${iroot%%:*}" = "iscsi" ] || exit 1

iroot=${iroot#iscsi}
iroot=${iroot#:}

# XXX modprobe crc32c should go in the cmdline parser, but I haven't yet
# figured out a way how to check whether this is built-in or not
modprobe crc32c 2> /dev/null

# start iscsiuio if needed
if [ -z "${DRACUT_SYSTEMD}" ] \
    && { [ -e /sys/module/bnx2i ] || [ -e /sys/module/qedi ]; } \
    && ! [ -e /tmp/iscsiuio-started ]; then
    iscsiuio
    : > /tmp/iscsiuio-started
fi

handle_firmware() {
    local ifaces retry _res

    # Depending on the 'ql4xdisablesysfsboot' qla4xxx
    # will be autostarting sessions without presenting
    # them via the firmware interface.
    # In these cases 'iscsiadm -m fw' will fail, but
    # the iSCSI sessions will still be present.
    if ! iscsiadm -m fw; then
        warn "iscsiadm: Could not get list of targets from firmware."
    else
        ifaces=$(
            set -- /sys/firmware/ibft/ethernet*
            echo $#
        )
        retry=$(cat /tmp/session-retry)

        if [ "$retry" -lt "$ifaces" ]; then
            retry=$((retry + 1))
            echo $retry > /tmp/session-retry
            return 1
        else
            rm /tmp/session-retry
        fi

        # check to see if we have the new iscsiadm command,
        # that supports the "no-wait" (-W) flag. If so, use it.
        iscsiadm -m fw -l -W 2> /dev/null
        _res=$?
        if [ $_res -eq 7 ]; then
            # ISCSI_ERR_INVALID (7) => "-W" not supported
            info "iscsiadm does not support no-wait firmware logins"
            iscsiadm -m fw -l
            _res=$?
        fi
        if [ $_res -ne 0 ]; then
            warn "iscsiadm: Log-in to iscsi target failed"
        else
            need_shutdown
        fi
    fi
    [ -d /sys/class/iscsi_session ] || return 1
    echo 'started' > "/tmp/iscsistarted-iscsi:"
    echo 'started' > "/tmp/iscsistarted-firmware"

    return 0
}

handle_netroot() {
    local iscsi_initiator iscsi_target_name iscsi_target_ip iscsi_target_port
    local iscsi_target_group iscsirw iscsi_lun
    local iscsi_username iscsi_password
    local iscsi_in_username iscsi_in_password
    local iscsi_iface_name iscsi_netdev_name
    local iscsi_param param
    local p found
    local login_retry_max_seen=

    # override conf settings by command line options
    arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=)
    [ -n "$arg" ] && iscsi_initiator=$arg
    arg=$(getarg rd.iscsi.target.group -d iscsi_target_group=)
    [ -n "$arg" ] && iscsi_target_group=$arg
    arg=$(getarg rd.iscsi.username -d iscsi_username=)
    [ -n "$arg" ] && iscsi_username=$arg
    arg=$(getarg rd.iscsi.password -d iscsi_password)
    [ -n "$arg" ] && iscsi_password=$arg
    arg=$(getarg rd.iscsi.in.username -d iscsi_in_username=)
    [ -n "$arg" ] && iscsi_in_username=$arg
    arg=$(getarg rd.iscsi.in.password -d iscsi_in_password=)
    [ -n "$arg" ] && iscsi_in_password=$arg
    for p in $(getargs rd.iscsi.param -d iscsi_param); do
        [ "${p%=*}" = node.session.initial_login_retry_max ] \
            && login_retry_max_seen=yes
        iscsi_param="$iscsi_param $p"
    done

    # this sets iscsi_target_name and possibly overwrites most
    # parameters read from the command line above
    parse_iscsi_root "$1" || return 1

    # Bail out early, if there is no route to the destination
    if is_ip "$iscsi_target_ip" && [ "$netif" != "timeout" ] && ! all_ifaces_setup && getargbool 1 rd.iscsi.testroute; then
        ip route get "$iscsi_target_ip" > /dev/null 2>&1 || return 0
    fi

    #limit iscsistart login retries
    if [ "$login_retry_max_seen" != yes ]; then
        retries=$(getargnum 3 0 10000 rd.iscsi.login_retry_max)
        if [ "$retries" -gt 0 ]; then
            iscsi_param="${iscsi_param% } node.session.initial_login_retry_max=$retries"
        fi
    fi

    # XXX is this needed?
    getarg ro && iscsirw=ro
    getarg rw && iscsirw=rw
    fsopts=${fsopts:+$fsopts,}${iscsirw}

    if [ -z "$iscsi_initiator" ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
        iscsi_initiator=$(while read -r line || [ -n "$line" ]; do echo "$line"; done < /sys/firmware/ibft/initiator/initiator-name)
        echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
        rm -f /etc/iscsi/initiatorname.iscsi
        mkdir -p /etc/iscsi
        ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
        : > /tmp/iscsi_set_initiator
        if [ -n "$DRACUT_SYSTEMD" ]; then
            systemctl try-restart iscsid
            # FIXME: iscsid is not yet ready, when the service is :-/
            sleep 1
        fi
    fi

    if [ -z "$iscsi_initiator" ]; then
        [ -f /run/initiatorname.iscsi ] && . /run/initiatorname.iscsi
        [ -f /etc/initiatorname.iscsi ] && . /etc/initiatorname.iscsi
        [ -f /etc/iscsi/initiatorname.iscsi ] && . /etc/iscsi/initiatorname.iscsi
        iscsi_initiator=$InitiatorName
    fi

    if [ -z "$iscsi_initiator" ]; then
        iscsi_initiator=$(iscsi-iname)
        echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
        rm -f /etc/iscsi/initiatorname.iscsi
        mkdir -p /etc/iscsi
        ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
        : > /tmp/iscsi_set_initiator
        if [ -n "$DRACUT_SYSTEMD" ]; then
            systemctl try-restart iscsid
            # FIXME: iscsid is not yet ready, when the service is :-/
            sleep 1
        fi
    fi

    if [ -z "$iscsi_target_port" ]; then
        iscsi_target_port=3260
    fi

    if [ -z "$iscsi_target_group" ]; then
        iscsi_target_group=1
    fi

    if [ -z "$iscsi_lun" ]; then
        iscsi_lun=0
    fi

    echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
    ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi
    if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then
        mkdir -p /etc/iscsi
        ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
        if [ -n "$DRACUT_SYSTEMD" ]; then
            systemctl try-restart iscsid
            # FIXME: iscsid is not yet ready, when the service is :-/
            sleep 1
        fi
    fi

    if [ -z "$DRACUT_SYSTEMD" ]; then
        iscsid
        sleep 2
    fi

    # FIXME $iscsi_protocol??

    if [ "$root" = "dhcp" ] || [ "$netroot" = "dhcp" ]; then
        # if root is not specified try to mount the whole iSCSI LUN
        printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' "$iscsi_lun" >> /etc/udev/rules.d/99-iscsi-root.rules
        udevadm control --reload
        write_fs_tab /dev/root
        wait_for_dev -n /dev/root

        # install mount script
        [ -z "$DRACUT_SYSTEMD" ] \
            && echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > "$hookdir"/mount/01-$$-iscsi.sh
    fi

    if strglobin "$iscsi_target_ip" '*:*:*' && ! strglobin "$iscsi_target_ip" '['; then
        iscsi_target_ip="[$iscsi_target_ip]"
    fi
    targets=$(iscsiadm -m discovery -t st -p "$iscsi_target_ip":${iscsi_target_port:+$iscsi_target_port} | {
        while read -r _ target _ || [ -n "$target" ]; do
            echo "$target"
        done
    })
    [ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1

    found=
    for target in $targets; do
        if [ "$target" = "$iscsi_target_name" ]; then
            if [ -n "$iscsi_iface_name" ]; then
                iscsiadm -m iface -I "$iscsi_iface_name" --op=new
                EXTRA=" ${iscsi_netdev_name:+--name=iface.net_ifacename --value=$iscsi_netdev_name} "
                EXTRA="$EXTRA ${iscsi_initiator:+--name=iface.initiatorname --value=$iscsi_initiator} "
            fi
            [ -n "$iscsi_param" ] && for param in $iscsi_param; do EXTRA="$EXTRA --name=${param%=*} --value=${param#*=}"; done

            CMD="iscsiadm -m node -T $target \
                     ${iscsi_iface_name:+-I $iscsi_iface_name} \
                     -p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port}"
            __op="--op=update \
                     --name=node.startup --value=onboot \
                     ${iscsi_username:+   --name=node.session.auth.username    --value=$iscsi_username} \
                     ${iscsi_password:+   --name=node.session.auth.password    --value=$iscsi_password} \
                     ${iscsi_in_username:+--name=node.session.auth.username_in --value=$iscsi_in_username} \
                     ${iscsi_in_password:+--name=node.session.auth.password_in --value=$iscsi_in_password} \
                     $EXTRA"
            # shellcheck disable=SC2086
            $CMD $__op
            if [ "$netif" != "timeout" ]; then
                $CMD --login
            fi
            found=yes
            break
        fi
    done

    if [ "$netif" = "timeout" ]; then
        iscsiadm -m node -L onboot || :
    elif [ "$found" != yes ]; then
        warn "iSCSI target \"$iscsi_target_name\" not found on portal $iscsi_target_ip:$iscsi_target_port"
        return 1
    fi
    : > "$hookdir"/initqueue/work

    netroot_enc=$(str_replace "$1" '/' '\2f')
    echo 'started' > "/tmp/iscsistarted-iscsi:${netroot_enc}"
    return 0
}

ret=0

if [ "$netif" != "timeout" ] && getargbool 0 rd.iscsi.waitnet; then
    all_ifaces_setup || exit 0
fi

if [ "$netif" = "timeout" ] && all_ifaces_setup; then
    # s.th. went wrong and the timeout script hits
    # restart
    systemctl restart iscsid
    # damn iscsid is not ready after unit says it's ready
    sleep 2
fi

if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware; then
    if [ "$netif" = "timeout" ] || [ "$netif" = "online" ] || [ "$netif" = "dummy" ]; then
        [ -f /tmp/session-retry ] || echo 1 > /tmp/session-retry
        handle_firmware
        ret=$?
    fi
fi

if ! [ "$netif" = "online" ]; then
    # loop over all netroot parameter
    if nroot=$(getarg netroot) && [ "$nroot" != "dhcp" ]; then
        for nroot in $(getargs netroot); do
            [ "${nroot%%:*}" = "iscsi" ] || continue
            nroot="${nroot##iscsi:}"
            if [ -n "$nroot" ]; then
                handle_netroot "$nroot"
                ret=$((ret + $?))
            fi
        done
    else
        if [ -n "$iroot" ]; then
            handle_netroot "$iroot"
            ret=$?
        fi
    fi
fi

need_shutdown

# now we have a root filesystem somewhere in /dev/sd*
# let the normal block handler handle root=
exit $ret
0707010000017F000081ED00000000000000000000000164DF2CB80000250C000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/modules.d/95iscsi/module-setup.sh   #!/bin/bash

# called by dracut
check() {
    # If our prerequisites are not met, fail anyways.
    require_binaries iscsi-iname iscsiadm iscsid || return 1

    # If hostonly was requested, fail the check if we are not actually
    # booting from root.

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        pushd . > /dev/null
        for_each_host_dev_and_slaves block_is_iscsi
        local _is_iscsi=$?
        popd > /dev/null || exit
        [[ $_is_iscsi == 0 ]] || return 255
    }
    return 0
}

get_ibft_mod() {
    local ibft_mac=$1
    local iface_mac iface_mod
    # Return the iSCSI offload module for a given MAC address
    for iface_desc in $(iscsiadm -m iface | cut -f 2 -d ' '); do
        iface_mod=${iface_desc%%,*}
        iface_mac=${iface_desc#*,}
        iface_mac=${iface_mac%%,*}
        if [ "$ibft_mac" = "$iface_mac" ]; then
            echo "$iface_mod"
            return 0
        fi
    done
}

install_ibft() {
    # When iBFT / iscsi_boot is detected:
    # - Use 'ip=ibft' to set up iBFT network interface
    #   Note: bnx2i is using a different MAC address of iSCSI offloading
    #         so the 'ip=ibft' parameter must not be set
    # - specify firmware booting cmdline parameter

    for d in /sys/firmware/*; do
        if [ -d "${d}"/ethernet0 ]; then
            read -r ibft_mac < "${d}"/ethernet0/mac
            ibft_mod=$(get_ibft_mod "$ibft_mac")
        fi
        if [ -z "$ibft_mod" ] && [ -d "${d}"/ethernet1 ]; then
            read -r ibft_mac < "${d}"/ethernet1/mac
            ibft_mod=$(get_ibft_mod "$ibft_mac")
        fi
        if [ -d "${d}"/initiator ]; then
            if [ "${d##*/}" = "ibft" ] && [ "$ibft_mod" != "bnx2i" ]; then
                echo -n "rd.iscsi.ibft=1 "
            fi
            echo -n "rd.iscsi.firmware=1 "
        fi
    done
}

install_iscsiroot() {
    local devpath=$1
    local scsi_path iscsi_lun session c d conn host flash
    local iscsi_session iscsi_address iscsi_port iscsi_targetname

    scsi_path=${devpath%%/block*}
    [ "$scsi_path" = "$devpath" ] && return 1
    iscsi_lun=${scsi_path##*:}
    [ "$iscsi_lun" = "$scsi_path" ] && return 1
    session=${devpath%%/target*}
    [ "$session" = "$devpath" ] && return 1
    iscsi_session=${session##*/}
    [ "$iscsi_session" = "$session" ] && return 1
    host=${session%%/session*}
    [ "$host" = "$session" ] && return 1
    iscsi_host=${host##*/}

    for flash in "${host}"/flashnode_sess-*; do
        [ -f "$flash" ] || continue
        [ ! -e "$flash/is_boot_target" ] && continue
        is_boot=$(cat "$flash"/is_boot_target)
        if [ "$is_boot" -eq 1 ]; then
            # qla4xxx flashnode session; skip iBFT discovery
            iscsi_initiator=$(cat /sys/class/iscsi_host/"${iscsi_host}"/initiatorname)
            echo "rd.iscsi.initiator=${iscsi_initiator}"
            return
        fi
    done

    for d in "${session}"/*; do
        case $d in
            *connection*)
                c=${d##*/}
                conn=${d}/iscsi_connection/${c}
                if [ -d "${conn}" ]; then
                    iscsi_address=$(cat "${conn}"/persistent_address)
                    iscsi_port=$(cat "${conn}"/persistent_port)
                fi
                ;;
            *session)
                if [ -d "${d}"/"${iscsi_session}" ]; then
                    iscsi_initiator=$(cat "${d}"/"${iscsi_session}"/initiatorname)
                    iscsi_targetname=$(cat "${d}"/"${iscsi_session}"/targetname)
                fi
                ;;
        esac
    done

    [ -z "$iscsi_address" ] && return
    ip_params_for_remote_addr "$iscsi_address"

    if [ -n "$iscsi_address" -a -n "$iscsi_targetname" ]; then
        if [ -n "$iscsi_port" -a "$iscsi_port" -eq 3260 ]; then
            iscsi_port=
        fi
        if [ -n "$iscsi_lun" -a "$iscsi_lun" -eq 0 ]; then
            iscsi_lun=
        fi
        # In IPv6 case rd.iscsi.initatior= must pass address in [] brackets
        case "$iscsi_address" in
            *:*)
                iscsi_address="[$iscsi_address]"
                ;;
        esac
        # Must be two separate lines, so that "sort | uniq" commands later
        # can sort out rd.iscsi.initiator= duplicates
        echo "rd.iscsi.initiator=${iscsi_initiator}"
        echo "netroot=iscsi:${iscsi_address}::${iscsi_port}:${iscsi_lun}:${iscsi_targetname}"
        echo "rd.neednet=1"
    fi
    return 0
}

install_softiscsi() {
    [ -d /sys/firmware/ibft ] && return 0

    is_softiscsi() {
        local _dev=$1
        local iscsi_dev

        [[ -L "/sys/dev/block/$_dev" ]] || return
        iscsi_dev=$(
            cd -P /sys/dev/block/"$_dev" || exit
            echo "$PWD"
        )
        install_iscsiroot "$iscsi_dev"
    }

    for_each_host_dev_and_slaves_all is_softiscsi || return 255
    return 0
}

# called by dracut
depends() {
    echo network rootfs-block
}

# called by dracut
installkernel() {
    local _arch=${DRACUT_ARCH:-$(uname -m)}
    local _funcs='iscsi_register_transport'

    instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi qedi
    hostonly="" instmods iscsi_tcp iscsi_ibft crc32c iscsi_boot_sysfs

    if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then
        _s390drivers="=drivers/s390/scsi"
    fi

    dracut_instmods -o -s ${_funcs} =drivers/scsi ${_s390drivers:+"$_s390drivers"}
}

# called by dracut
cmdline() {
    local _iscsiconf
    _iscsiconf=$(install_ibft)
    {
        if [ "$_iscsiconf" ]; then
            echo "${_iscsiconf}"
        else
            install_softiscsi
        fi
    } | sort | uniq
}

# called by dracut
install() {
    inst_multiple -o iscsiuio
    inst_libdir_file 'libgcc_s.so*'
    inst_multiple umount iscsi-iname iscsiadm iscsid
    inst_binary sort

    inst_multiple -o \
        "$systemdsystemunitdir"/iscsid.socket \
        "$systemdsystemunitdir"/iscsid.service \
        "$systemdsystemunitdir"/iscsiuio.service \
        "$systemdsystemunitdir"/iscsiuio.socket \
        "$systemdsystemunitdir"/sockets.target.wants/iscsid.socket \
        "$systemdsystemunitdir"/sockets.target.wants/iscsiuio.socket

    if [[ $hostonly ]]; then
        local -a _filenames

        inst_dir /etc/iscsi
        mapfile -t -d '' _filenames < <(find /etc/iscsi -type f -print0)
        inst_multiple "${_filenames[@]}"
    else
        inst_simple /etc/iscsi/iscsid.conf
    fi

    # Detect iBFT and perform mandatory steps
    if [[ $hostonly_cmdline == "yes" ]]; then
        local _iscsiconf
        _iscsiconf=$(cmdline)
        [[ $_iscsiconf ]] && printf "%s\n" "$_iscsiconf" >> "${initdir}/etc/cmdline.d/95iscsi.conf"
    fi

    inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
    inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
    inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"

    if ! dracut_module_included "systemd"; then
        inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
    else
        inst_multiple -o \
            "$systemdsystemunitdir"/iscsi.service \
            "$systemdsystemunitdir"/iscsi-init.service \
            "$systemdsystemunitdir"/iscsid.service \
            "$systemdsystemunitdir"/iscsid.socket \
            "$systemdsystemunitdir"/iscsiuio.service \
            "$systemdsystemunitdir"/iscsiuio.socket \
            iscsiadm iscsid

        for i in \
            iscsid.socket \
            iscsiuio.socket; do
            $SYSTEMCTL -q --root "$initdir" enable "$i"
        done

        mkdir -p "${initdir}/$systemdsystemunitdir/iscsid.service.d"
        {
            echo "[Unit]"
            echo "DefaultDependencies=no"
            echo "Conflicts=shutdown.target"
            echo "Before=shutdown.target"
        } > "${initdir}/$systemdsystemunitdir/iscsid.service.d/dracut.conf"

        mkdir -p "${initdir}/$systemdsystemunitdir/iscsid.socket.d"
        {
            echo "[Unit]"
            echo "DefaultDependencies=no"
            echo "Conflicts=shutdown.target"
            echo "Before=shutdown.target sockets.target"
        } > "${initdir}/$systemdsystemunitdir/iscsid.socket.d/dracut.conf"

        mkdir -p "${initdir}/$systemdsystemunitdir/iscsiuio.service.d"
        {
            echo "[Unit]"
            echo "DefaultDependencies=no"
            echo "Conflicts=shutdown.target"
            echo "Before=shutdown.target"
        } > "${initdir}/$systemdsystemunitdir/iscsiuio.service.d/dracut.conf"

        mkdir -p "${initdir}/$systemdsystemunitdir/iscsiuio.socket.d"
        {
            echo "[Unit]"
            echo "DefaultDependencies=no"
            echo "Conflicts=shutdown.target"
            echo "Before=shutdown.target sockets.target"
        } > "${initdir}/$systemdsystemunitdir/iscsiuio.socket.d/dracut.conf"

        # Fedora 34 iscsid requires iscsi-shutdown.service
        # which would terminate all iSCSI connections on switch root
        cat > "${initdir}/$systemdsystemunitdir/iscsi-shutdown.service" << EOF
[Unit]
Description=Dummy iscsi-shutdown.service for the initrd
Documentation=man:iscsid(8) man:iscsiadm(8)
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service
Before=remote-fs-pre.target

[Service]
Type=oneshot
RemainAfterExit=false
ExecStart=-/usr/bin/true
EOF
    fi
    inst_dir /var/lib/iscsi
    mkdir -p "${initdir}/var/lib/iscsi/nodes"
    # Fedora 34 iscsid wants a non-empty /var/lib/iscsi/nodes directory
    : > "${initdir}/var/lib/iscsi/nodes/.dracut"
    dracut_need_initqueue
}
07070100000180000081ED00000000000000000000000164DF2CB800000158000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95iscsi/mount-lun.sh  #!/bin/sh
if [ -z "$iscsi_lun" ]; then
    iscsi_lun=0
fi
NEWROOT=${NEWROOT:-/sysroot}

for disk in /dev/disk/by-path/*-iscsi-*-"$iscsi_lun"; do
    if mount -t "${fstype:-auto}" -o "$rflags" "$disk" "$NEWROOT"; then
        if [ ! -d "$NEWROOT"/proc ]; then
            umount "$disk"
            continue
        fi
        break
    fi
done
07070100000181000081ED00000000000000000000000164DF2CB8000017FB000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/95iscsi/parse-iscsiroot.sh    #!/bin/sh
#
# Preferred format:
#       root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
#       [root=*] netroot=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
#
# Legacy formats:
#       [net]root=[iscsi] iscsiroot=[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
#       [net]root=[iscsi] iscsi_firmware
#
# root= takes precedence over netroot= if root=iscsi[...]
#

# This script is sourced, so root should be set. But let's be paranoid
[ -z "$root" ] && root=$(getarg root=)
if [ -z "$netroot" ]; then
    for nroot in $(getargs netroot=); do
        [ "${nroot%%:*}" = "iscsi" ] && break
    done
    if [ "${nroot%%:*}" = "iscsi" ]; then
        netroot="$nroot"
    else
        for nroot in $(getargs netroot=); do
            [ "${nroot%%:*}" = "dhcp" ] && break
        done
        netroot="$nroot"
    fi
fi
[ -z "$iscsiroot" ] && iscsiroot=$(getarg iscsiroot=)
[ -z "$iscsi_firmware" ] && getargbool 0 rd.iscsi.firmware -y iscsi_firmware && iscsi_firmware="1"

[ -n "$iscsiroot" ] && [ -n "$iscsi_firmware" ] && die "Mixing iscsiroot and iscsi_firmware is dangerous"

type write_fs_tab > /dev/null 2>&1 || . /lib/fs-lib.sh

# Root takes precedence over netroot
if [ "${root%%:*}" = "iscsi" ]; then
    if [ -n "$netroot" ]; then
        echo "Warning: root takes precedence over netroot. Ignoring netroot"
    fi
    netroot=$root
    # if root is not specified try to mount the whole iSCSI LUN
    printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
    [ -n "$DRACUT_SYSTEMD" ] && systemctl is-active systemd-udevd && udevadm control --reload-rules
    root=/dev/root

    write_fs_tab /dev/root
fi

# If it's not empty or iscsi we don't continue
for nroot in $(getargs netroot); do
    [ "${nroot%%:*}" = "iscsi" ] || continue
    netroot="$nroot"
    break
done

# Root takes precedence over netroot
if [ "${root}" = "/dev/root" ] && getarg "netroot=dhcp"; then
    # if root is not specified try to mount the whole iSCSI LUN
    printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
    [ -n "$DRACUT_SYSTEMD" ] && systemctl is-active systemd-udevd && udevadm control --reload-rules
fi

if [ -n "$iscsiroot" ]; then
    [ -z "$netroot" ] && netroot=$root

    # @deprecated
    echo "Warning: Argument iscsiroot is deprecated and might be removed in a future"
    echo "release. See 'man dracut.kernel' for more information."

    # Accept iscsiroot argument?
    [ -z "$netroot" ] || [ "$netroot" = "iscsi" ] \
        || die "Argument iscsiroot only accepted for empty root= or [net]root=iscsi"

    # Override root with iscsiroot content?
    [ -z "$netroot" ] || [ "$netroot" = "iscsi" ] && netroot=iscsi:$iscsiroot
fi

# iscsi_firmware does not need argument checking
if [ -n "$iscsi_firmware" ]; then
    if [ "$root" != "dhcp" ] && [ "$netroot" != "dhcp" ]; then
        [ -z "$netroot" ] && netroot=iscsi:
    fi
    modprobe -b -q iscsi_boot_sysfs 2> /dev/null
    modprobe -b -q iscsi_ibft
    # if no ip= is given, but firmware
    echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f '/tmp/iscsistarted-firmware' ]" > "$hookdir"/initqueue/finished/iscsi_started.sh
    initqueue --unique --online /sbin/iscsiroot online "iscsi:" "$NEWROOT"
    initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "iscsi:" "$NEWROOT"
    initqueue --unique --onetime --settled /sbin/iscsiroot online "iscsi:" "'$NEWROOT'"
fi

# ISCSI actually supported?
if ! [ -e /sys/module/iscsi_tcp ]; then
    modprobe -b -q iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi"
fi

modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi

if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
    if ! getargbool 1 rd.neednet > /dev/null || ! getarg "ip="; then
        initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
    fi
fi

if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ] && ! [ -f /run/initiatorname.iscsi ]; then
    iscsi_initiator=$arg
    echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
    ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi
    rm -f /etc/iscsi/initiatorname.iscsi
    mkdir -p /etc/iscsi
    ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
    if [ -n "$DRACUT_SYSTEMD" ]; then
        systemctl try-restart iscsid
        # FIXME: iscsid is not yet ready, when the service is :-/
        sleep 1
    fi
fi

# If not given on the cmdline and initiator-name available via iBFT
if [ -z "$iscsi_initiator" ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
    iscsi_initiator=$(while read -r line || [ -n "$line" ]; do echo "$line"; done < /sys/firmware/ibft/initiator/initiator-name)
    if [ -n "$iscsi_initiator" ]; then
        echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
        rm -f /etc/iscsi/initiatorname.iscsi
        mkdir -p /etc/iscsi
        ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
        : > /tmp/iscsi_set_initiator
        if [ -n "$DRACUT_SYSTEMD" ]; then
            systemctl try-restart iscsid
            # FIXME: iscsid is not yet ready, when the service is :-/
            sleep 1
        fi
    fi
fi

if [ -z "$netroot" ] || ! [ "${netroot%%:*}" = "iscsi" ]; then
    return 1
fi

initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT"

for nroot in $(getargs netroot); do
    [ "${nroot%%:*}" = "iscsi" ] || continue
    type parse_iscsi_root > /dev/null 2>&1 || . /lib/net-lib.sh
    parse_iscsi_root "$nroot" || return 1
    netroot_enc=$(str_replace "$nroot" '/' '\2f')
    echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f '/tmp/iscsistarted-$netroot_enc' ]" > "$hookdir"/initqueue/finished/iscsi_started.sh
done

# Done, all good!
# shellcheck disable=SC2034
rootok=1

# Shut up init error check
[ -z "$root" ] && root="iscsi"
 07070100000182000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/modules.d/95lunmask 07070100000183000081ED00000000000000000000000164DF2CB80000023A000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95lunmask/fc_transport_scan_lun.sh    #!/bin/sh
#
# fc_transport_lun_scan
#
# Selectively enable individual LUNs behind an FC remote port
#
# ACTION=="add", SUBSYSTEM=="fc_transport", ATTR{port_name}=="wwpn", \
#    PROGRAM="fc_transport_lun_scan lun"
#

[ -z "$DEVPATH" ] && exit 1

if [ -n "$1" ]; then
    LUN=$1
else
    LUN=-
fi
ID=${DEVPATH##*/rport-}
HOST=${ID%%:*}
CHANNEL=${ID%%-*}
CHANNEL=${CHANNEL#*:}
if [ -f /sys"$DEVPATH"/scsi_target_id ]; then
    TARGET=$(cat /sys"$DEVPATH"/scsi_target_id)
fi
[ -z "$TARGET" ] && exit 1
echo "$CHANNEL" "$TARGET" $LUN > /sys/class/scsi_host/host"$HOST"/scan
  07070100000184000081ED00000000000000000000000164DF2CB8000008FD000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/modules.d/95lunmask/module-setup.sh #!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# called by dracut
cmdline() {
    get_lunmask() {
        local _dev=$1
        local _devpath _sdev _lun _rport _end_device _classdev _wwpn _sas_address
        _devpath=$(
            cd -P /sys/dev/block/"$_dev" || exit
            echo "$PWD"
        )

        [ "${_devpath#*/sd}" == "$_devpath" ] && return 1
        _sdev="${_devpath%%/block/*}"
        _lun="${_sdev##*:}"
        # Check for FibreChannel
        _rport="${_devpath##*/rport-}"
        if [ "$_rport" != "$_devpath" ]; then
            _rport="${_rport%%/*}"
            _classdev="/sys/class/fc_remote_ports/rport-${_rport}"
            [ -d "$_classdev" ] || return 1
            _wwpn=$(cat "${_classdev}"/port_name)
            echo "rd.lunmask=fc,${_wwpn},${_lun}"
            return 0
        fi
        # Check for SAS
        _end_device="${_devpath##*/end_device-}"
        if [ "$_end_device" != "$_devpath" ]; then
            _end_device="${_end_device%%/*}"
            _classdev="/sys/class/sas_device/end_device-${_end_device}"
            [ -e "$_classdev" ] || return 1
            _sas_address=$(cat "${_classdev}"/sas_address)
            echo "rd.lunmask=sas,${_sas_address},${_lun}"
            return 0
        fi
        return 1
    }
    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for_each_host_dev_and_slaves_all get_lunmask
    } | sort | uniq
}

# called by dracut
check() {
    [[ $hostonly ]] || [[ $mount_needs ]] && {
        [ -w /sys/module/scsi_mod/parameters/scan ] || return 255
        scan_type=$(cat /sys/module/scsi_mod/parameters/scan)
        [ "$scan_type" = "manual" ] && return 0
        return 255
    }
    return 0
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    inst_script "$moddir/fc_transport_scan_lun.sh" /usr/lib/udev/fc_transport_scan_lun.sh
    inst_script "$moddir/sas_transport_scan_lun.sh" /usr/lib/udev/sas_transport_scan_lun.sh
    inst_hook cmdline 30 "$moddir/parse-lunmask.sh"
    if [[ $hostonly_cmdline == "yes" ]]; then
        local _lunmask

        for _lunmask in $(cmdline); do
            printf "%s\n" "$_lunmask" >> "${initdir}/etc/cmdline.d/95lunmask.conf"
        done
    fi
}
   07070100000185000081ED00000000000000000000000164DF2CB8000004DB000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/95lunmask/parse-lunmask.sh    #!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

create_udev_rule() {
    local transport=$1
    local tgtid=$2
    local lun=$3
    local _rule=/etc/udev/rules.d/51-${transport}-lunmask-${tgtid}.rules

    [ -e "${_rule}" ] && return 0

    if [ ! -f "$_rule" ]; then
        if [ "$transport" = "fc" ]; then
            cat > "$_rule" << EOF
ACTION=="add", SUBSYSTEM=="fc_remote_ports", ATTR{port_name}=="$tgtid", PROGRAM="fc_transport_scan_lun.sh $lun"
EOF
        elif [ "$transport" = "sas" ]; then
            cat > "$_rule" << EOF
ACTION=="add", SUBSYSTEM=="sas_device", ATTR{sas_address}=="$tgtid", PROGRAM="sas_transport_scan_lun.sh $lun"
EOF
        fi
    fi
}

for lunmask_arg in $(getargs rd.lunmask); do
    (
        local OLDIFS="$IFS"
        local IFS=","
        # shellcheck disable=SC2086
        set $lunmask_arg
        IFS="$OLDIFS"
        if [ -d /sys/module/scsi_mod ]; then
            printf "manual" > /sys/module/scsi_mod/parameters/scan
        elif [ ! -f /etc/modprobe.d/95lunmask.conf ]; then
            echo "options scsi_mod scan=manual" > /etc/modprobe.d/95lunmask.conf
        fi
        create_udev_rule "$1" "$2" "$3"
    )
done
 07070100000186000081ED00000000000000000000000164DF2CB80000023E000000000000000000000000000000000000004C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95lunmask/sas_transport_scan_lun.sh   #!/bin/sh
#
# sas_transport_lun_scan
#
# Selectively enable individual LUNs behind a SAS end device
#
# ACTION=="add", SUBSYSTEM=="sas_transport", ATTR{sas_address}=="sas_addr", \
#    PROGRAM="sas_transport_lun_scan lun"
#

[ -z "$DEVPATH" ] && exit 1

if [ -n "$1" ]; then
    LUN=$1
else
    LUN=-
fi
ID=${DEVPATH##*/end_device-}
HOST=${ID%%:*}
CHANNEL=${ID%%-*}
CHANNEL=${CHANNEL#*:}
if [ -f /sys"$DEVPATH"/scsi_target_id ]; then
    TARGET=$(cat /sys"$DEVPATH"/scsi_target_id)
fi
[ -z "$TARGET" ] && exit 1
echo 0 "$TARGET" $LUN > /sys/class/scsi_host/host"$HOST"/scan
  07070100000187000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nbd 07070100000188000081ED00000000000000000000000164DF2CB8000003CB000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nbd/module-setup.sh #!/bin/bash

# called by dracut
check() {
    local _rootdev

    # if an nbd device is not somewhere in the chain of devices root is
    # mounted on, fail the hostonly check.
    [[ $hostonly ]] || [[ $mount_needs ]] && {
        _rootdev=$(find_root_block_device)
        [[ -b /dev/block/$_rootdev ]] || return 1
        check_block_and_slaves block_is_nbd "$_rootdev" || return 255
    }
    require_binaries nbd-client || return 1

    return 0
}

# called by dracut
depends() {
    # We depend on network modules being loaded
    echo network rootfs-block
}

# called by dracut
installkernel() {
    instmods nbd
}

# called by dracut
install() {
    inst nbd-client
    inst_hook cmdline 90 "$moddir/parse-nbdroot.sh"
    inst_script "$moddir/nbdroot.sh" "/sbin/nbdroot"
    if dracut_module_included "systemd-initrd"; then
        inst_script "$moddir/nbd-generator.sh" "$systemdutildir"/system-generators/dracut-nbd-generator
    fi
    dracut_need_initqueue
}
 07070100000189000081ED00000000000000000000000164DF2CB800000512000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nbd/nbd-generator.sh    #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

[ -z "$root" ] && root=$(getarg root=)

[ "${root%%:*}" = "nbd" ] || exit 0

GENERATOR_DIR="$2"
[ -z "$GENERATOR_DIR" ] && exit 1

[ -d "$GENERATOR_DIR" ] || mkdir -p "$GENERATOR_DIR"

ROOTFLAGS="$(getarg rootflags)"

nroot=${root#nbd:}
nbdserver=${nroot%%:*}
if [ "${nbdserver%"${nbdserver#?}"}" = "[" ]; then
    nbdserver=${nroot#[}
    nbdserver=${nbdserver%%]:*}\]
    nroot=${nroot#*]:}
else
    nroot=${nroot#*:}
fi
nbdport=${nroot%%:*}
nroot=${nroot#*:}
nbdfstype=${nroot%%:*}
nroot=${nroot#*:}
nbdflags=${nroot%%:*}

if [ "$nbdflags" = "$nbdfstype" ]; then
    unset nbdflags
fi
if [ "$nbdfstype" = "$nbdport" ]; then
    unset nbdfstype
fi

[ -n "$nbdflags" ] && ROOTFLAGS="$nbdflags"

if getarg "ro"; then
    if [ -n "$ROOTFLAGS" ]; then
        ROOTFLAGS="$ROOTFLAGS,ro"
    else
        ROOTFLAGS="ro"
    fi
fi

if [ -n "$nbdfstype" ]; then
    ROOTFSTYPE="$nbdfstype"
else
    ROOTFSTYPE=$(getarg rootfstype=) || unset ROOTFSTYPE
fi

{
    echo "[Unit]"
    echo "Before=initrd-root-fs.target"
    echo "[Mount]"
    echo "Where=/sysroot"
    echo "What=/dev/root"
    [ -n "$ROOTFSTYPE" ] && echo "Type=${ROOTFSTYPE}"
    [ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
} > "$GENERATOR_DIR"/sysroot.mount

exit 0
  0707010000018A000081ED00000000000000000000000164DF2CB800000CBC000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nbd/nbdroot.sh  #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

PATH=/usr/sbin:/usr/bin:/sbin:/bin

# Huh? Empty $1?
[ -z "$1" ] && exit 1

# Huh? Empty $2?
[ -z "$2" ] && exit 1

# Huh? Empty $3?
[ -z "$3" ] && exit 1

# root is in the form root=nbd:srv:port[:fstype[:rootflags[:nbdopts]]]
# shellcheck disable=SC2034
netif="$1"
nroot="$2"
NEWROOT="$3"

# If it's not nbd we don't continue
[ "${nroot%%:*}" = "nbd" ] || return

nroot=${nroot#nbd:}
nbdserver=${nroot%%:*}
if [ "${nbdserver%"${nbdserver#?}"}" = "[" ]; then
    nbdserver=${nroot#[}
    nbdserver=${nbdserver%%]:*}
    nroot=${nroot#*]:}
else
    nroot=${nroot#*:}
fi
nbdport=${nroot%%:*}
nroot=${nroot#*:}
nbdfstype=${nroot%%:*}
nroot=${nroot#*:}
nbdflags=${nroot%%:*}
nbdopts=${nroot#*:}

if [ "$nbdopts" = "$nbdflags" ]; then
    unset nbdopts
fi
if [ "$nbdflags" = "$nbdfstype" ]; then
    unset nbdflags
fi
if [ "$nbdfstype" = "$nbdport" ]; then
    unset nbdfstype
fi
if [ -z "$nbdfstype" ]; then
    nbdfstype=auto
fi

# look through the NBD options and pull out the ones that need to
# go before the host etc. Append a ',' so we know we terminate the loop
nbdopts=${nbdopts},
while [ -n "$nbdopts" ]; do
    f=${nbdopts%%,*}
    nbdopts=${nbdopts#*,}
    if [ -z "$f" ]; then
        break
    fi
    if [ -z "${f%bs=*}" -o -z "${f%timeout=*}" ]; then
        preopts="$preopts $f"
        continue
    fi
    opts="$opts $f"
done

# look through the flags and see if any are overridden by the command line
nbdflags=${nbdflags},
while [ -n "$nbdflags" ]; do
    f=${nbdflags%%,*}
    nbdflags=${nbdflags#*,}
    if [ -z "$f" ]; then
        break
    fi
    if [ "$f" = "ro" -o "$f" = "rw" ]; then
        nbdrw=$f
        continue
    fi
    fsopts=${fsopts:+$fsopts,}$f
done

getarg ro && nbdrw=ro
getarg rw && nbdrw=rw
fsopts=${fsopts:+$fsopts,}${nbdrw}

# XXX better way to wait for the device to be made?
i=0
while [ ! -b /dev/nbd0 ]; do
    [ $i -ge 20 ] && exit 1
    udevadm settle --exit-if-exists=/dev/nbd0
    i=$((i + 1))
done

# If we didn't get a root= on the command line, then we need to
# add the udev rules for mounting the nbd0 device
if [ "$root" = "block:/dev/root" -o "$root" = "dhcp" ]; then
    printf 'KERNEL=="nbd0", ENV{DEVTYPE}!="partition", ENV{ID_FS_TYPE}=="?*", SYMLINK+="root"\n' > /etc/udev/rules.d/99-nbd-root.rules
    udevadm control --reload
    wait_for_dev -n /dev/root

    if [ -z "$DRACUT_SYSTEMD" ]; then
        type write_fs_tab > /dev/null 2>&1 || . /lib/fs-lib.sh

        write_fs_tab /dev/root "$nbdfstype" "$fsopts"

        printf '/bin/mount %s\n' \
            "$NEWROOT" \
            > "$hookdir"/mount/01-$$-nbd.sh
    else
        mkdir -p /run/systemd/system/sysroot.mount.d
        cat << EOF > /run/systemd/system/sysroot.mount.d/dhcp.conf
[Mount]
Where=/sysroot
What=/dev/root
Type=$nbdfstype
Options=$fsopts
EOF
        systemctl --no-block daemon-reload
    fi
    # if we're on systemd, use the nbd-generator script
    # to create the /sysroot mount.
fi

if ! [ "$nbdport" -gt 0 ] 2> /dev/null; then
    nbdport="-name $nbdport"
fi

if ! nbd-client -check /dev/nbd0 > /dev/null; then
    # shellcheck disable=SC2086
    nbd-client -p -systemd-mark "$nbdserver" $nbdport /dev/nbd0 $opts || exit 1
fi

need_shutdown
exit 0
0707010000018B000081ED00000000000000000000000164DF2CB80000069D000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nbd/parse-nbdroot.sh    #!/bin/sh
#
# Preferred format:
#       root=nbd:srv:port/exportname[:fstype[:rootflags[:nbdopts]]]
#       [root=*] netroot=nbd:srv:port/exportname[:fstype[:rootflags[:nbdopts]]]
#
# nbdopts is a comma separated list of options to give to nbd-client
#
# root= takes precedence over netroot= if root=nbd[...]
#

# This script is sourced, so root should be set. But let's be paranoid
[ -z "$root" ] && root=$(getarg root=)

if [ -z "$netroot" ]; then
    for netroot in $(getargs netroot=); do
        [ "${netroot%%:*}" = "nbd" ] && break
    done
    [ "${netroot%%:*}" = "nbd" ] || unset netroot
fi

# Root takes precedence over netroot
if [ "${root%%:*}" = "nbd" ]; then
    if [ -n "$netroot" ]; then
        warn "root takes precedence over netroot. Ignoring netroot"

    fi
    netroot=$root
    unset root
fi

# If it's not nbd we don't continue
[ "${netroot%%:*}" = "nbd" ] || return

# Check required arguments
nroot=${netroot#nbd:}
server=${nroot%%:*}
if [ "${server%"${server#?}"}" = "[" ]; then
    server=${nroot#[}
    server=${server%%]:*}\]
    nroot=${nroot#*]:}
else
    nroot=${nroot#*:}
fi
port=${nroot%%:*}
unset nroot

[ -z "$server" ] && die "Argument server for nbdroot is missing"
[ -z "$port" ] && die "Argument port for nbdroot is missing"

# NBD actually supported?
incol2 /proc/devices nbd || modprobe nbd || die "nbdroot requested but kernel/initrd does not support nbd"

# Done, all good!
# shellcheck disable=SC2034
rootok=1

# Shut up init error check
if [ -z "$root" ]; then
    root=block:/dev/root
    # the device is created and waited for in ./nbdroot.sh
fi

echo 'nbd-client -check /dev/nbd0 > /dev/null 2>&1' > "$hookdir"/initqueue/finished/nbdroot.sh
   0707010000018C000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nfs 0707010000018D000081ED00000000000000000000000164DF2CB800001154000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nfs/module-setup.sh #!/bin/bash

# return value:
#  'nfs4': Only nfs4 founded
#  'nfs': nfs with version < 4 founded
#  '': No nfs founded
get_nfs_type() {
    local _nfs _nfs4

    for fs in "${host_fs_types[@]}"; do
        [[ $fs == "nfs" ]] && _nfs=1
        [[ $fs == "nfs3" ]] && _nfs=1
        [[ $fs == "nfs4" ]] && _nfs4=1
    done

    [[ "$_nfs" ]] && echo "nfs" && return
    [[ "$_nfs4" ]] && echo "nfs4" && return
}

# called by dracut
check() {
    # If our prerequisites are not met, fail anyways.
    require_any_binary rpcbind portmap || return 1
    require_binaries rpc.statd mount.nfs mount.nfs4 umount || return 1

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        [[ "$(get_nfs_type)" ]] && return 0
        return 255
    }
    return 0
}

# called by dracut
depends() {
    # We depend on network modules being loaded
    echo network
}

# called by dracut
installkernel() {
    hostonly=$(optional_hostonly) instmods '=net/sunrpc' '=fs/nfs' ipv6 nfs_acl nfs_layout_nfsv41_files
}

cmdline() {
    local nfs_device
    local nfs_options
    local nfs_root
    local nfs_address
    local lookup

    ### nfsroot= ###
    nfs_device=$(findmnt -t nfs4 -n -o SOURCE /)
    if [ -n "$nfs_device" ]; then
        nfs_root="root=nfs4:$nfs_device"
    else
        nfs_device=$(findmnt -t nfs -n -o SOURCE /)
        [ -z "$nfs_device" ] && return
        nfs_root="root=nfs:$nfs_device"
    fi
    nfs_options=$(findmnt -t nfs4,nfs -n -o OPTIONS /)
    [ -n "$nfs_options" ] && nfs_root="$nfs_root:$nfs_options"
    echo "$nfs_root"

    ### ip= ###
    if [[ $nfs_device =~ [0-9]*\.[0-9]*\.[0-9]*.[0-9]* ]] || [[ $nfs_device =~ \[[^]]*\] ]]; then
        nfs_address="${nfs_device%%:*}"
    else
        lookup=$(host "${nfs_device%%:*}" | grep " address " | head -n1)
        nfs_address=${lookup##* }
    fi

    [[ $nfs_address ]] || return
    ip_params_for_remote_addr "$nfs_address"
}

# called by dracut
install() {
    local _nsslibs
    inst_multiple -o rpc.idmapd mount.nfs mount.nfs4 umount sed /etc/netconfig chmod "$tmpfilesdir/rpcbind.conf"
    inst_multiple -o /etc/idmapd.conf
    inst_multiple -o /etc/services /etc/nsswitch.conf /etc/rpc /etc/protocols
    inst_multiple -o /usr/etc/services /usr/etc/nsswitch.conf /usr/etc/rpc /usr/etc/protocols

    if [[ $hostonly_cmdline == "yes" ]]; then
        local _netconf
        _netconf="$(cmdline)"
        [[ $_netconf ]] && printf "%s\n" "$_netconf" >> "${initdir}/etc/cmdline.d/95nfs.conf"
    fi

    if [[ -f $dracutsysrootdir/lib/modprobe.d/nfs.conf ]]; then
        inst_multiple /lib/modprobe.d/nfs.conf
    else
        [[ -d $initdir/etc/modprobe.d ]] || mkdir -p "$initdir"/etc/modprobe.d
        echo "alias nfs4 nfs" > "$initdir"/etc/modprobe.d/nfs.conf
    fi

    inst_libdir_file 'libnfsidmap_nsswitch.so*' 'libnfsidmap/*.so' 'libnfsidmap*.so*'

    _nsslibs=$(
        cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
            | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \
            | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
    )
    _nsslibs=${_nsslibs#|}
    _nsslibs=${_nsslibs%|}

    inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'

    inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
    inst_hook pre-udev 99 "$moddir/nfs-start-rpc.sh"
    inst_hook cleanup 99 "$moddir/nfsroot-cleanup.sh"
    inst "$moddir/nfsroot.sh" "/sbin/nfsroot"

    # For strict hostonly, only install rpcbind for NFS < 4
    if [[ $hostonly_mode != "strict" ]] || [[ "$(get_nfs_type)" != "nfs4" ]]; then
        inst_multiple -o portmap rpcbind rpc.statd
    fi

    inst "$moddir/nfs-lib.sh" "/lib/nfs-lib.sh"
    mkdir -m 0755 -p "$initdir/var/lib/nfs"
    mkdir -m 0755 -p "$initdir/var/lib/nfs/rpc_pipefs"
    mkdir -m 0770 -p "$initdir/var/lib/rpcbind"
    mkdir -m 0755 -p "$initdir/var/lib/nfs/sm"

    # Rather than copy the passwd file in, just set a user for rpcbind
    # We'll save the state and restart the daemon from the root anyway
    grep -E '^nfsnobody:|^rpc:|^rpcuser:' "$dracutsysrootdir"/etc/passwd >> "$initdir/etc/passwd"
    grep -E '^nogroup:|^rpc:|^nobody:' "$dracutsysrootdir"/etc/group >> "$initdir/etc/group"

    # rpc user needs to be able to write to this directory to save the warmstart
    # file
    chmod 770 "$initdir/var/lib/rpcbind"
    grep -q '^rpc:' "$dracutsysrootdir"/etc/passwd \
        && grep -q '^rpc:' "$dracutsysrootdir"/etc/group

    dracut_need_initqueue
}
0707010000018E000081ED00000000000000000000000164DF2CB8000012A6000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nfs/nfs-lib.sh  #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
. /lib/net-lib.sh

# TODO: make these things not pollute the calling namespace

# nfs_to_var NFSROOT [NETIF]
# use NFSROOT to set $nfs, $server, $path, and $options.
# NFSROOT is something like: nfs[4]:<server>:/<path>[:<options>|,<options>]
# NETIF is used to get information from DHCP options, if needed.
nfs_to_var() {
    # Unfortunately, there's multiple styles of nfs "URL" in use, so we need
    # extra functions to parse them into $nfs, $server, $path, and $options.
    # FIXME: local netif=${2:-$netif}?
    case "$1" in
        nfs://*) rfc2224_nfs_to_var "$1" ;;
        nfs:*[*) anaconda_nfsv6_to_var "$1" ;;
        nfs:*:*:/*) anaconda_nfs_to_var "$1" ;;
        *) nfsroot_to_var "$1" ;;
    esac
    # if anything's missing, try to fill it in from DHCP options
    if [ -z "$server" ] || [ -z "$path" ]; then nfsroot_from_dhcp "$2"; fi
    # if there's a "%s" in the path, replace it with the hostname/IP
    if strstr "$path" "%s"; then
        local node=""
        read -r node < /proc/sys/kernel/hostname
        [ "$node" = "(none)" ] && node=$(get_ip "$2")
        path=${path%%%s*}$node${path#*%s} # replace only the first %s
    fi
}

# root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>]
# root=nfs4:[<server-ip>:]<root-dir>[:<nfs-options>]
nfsroot_to_var() {
    # strip nfs[4]:
    local arg="$*:"
    nfs="${arg%%:*}"
    arg="${arg##$nfs:}"

    # check if we have a server
    if strstr "$arg" ':/'; then
        server="${arg%%:/*}"
        arg="/${arg##*:/}"
    fi

    path="${arg%%:*}"

    # rest are options
    options="${arg##$path}"
    # strip leading ":"
    options="${options##:}"
    # strip  ":"
    options="${options%%:}"

    # Does it really start with '/'?
    [ -n "${path%%/*}" ] && path="error"

    #Fix kernel legacy style separating path and options with ','
    if [ "$path" != "${path#*,}" ]; then
        options=${path#*,}
        path=${path%%,*}
    fi
}

# RFC2224: nfs://<server>[:<port>]/<path>
rfc2224_nfs_to_var() {
    nfs="nfs"
    server="${1#nfs://}"
    path="/${server#*/}"
    server="${server%%/*}"
    server="${server%%:}" # anaconda compat (nfs://<server>:/<path>)
    local port="${server##*:}"
    [ "$port" != "$server" ] && options="port=$port"
}

# Anaconda-style path with options: nfs:<options>:<server>:/<path>
# (without mount options, anaconda is the same as dracut)
anaconda_nfs_to_var() {
    nfs="nfs"
    options="${1#nfs:}"
    server="${options#*:}"
    server="${server%:/*}"
    options="${options%%:*}"
    path="/${1##*:/}"
}

# IPv6 nfs path will be treated separately
anaconda_nfsv6_to_var() {
    nfs="nfs"
    path="$1"
    options="${path#*:/}"
    path="/${options%%:*}"
    server="${1#*nfs:}"
    if str_starts "$server" '['; then
        server="${server%:/*}"
        options="${options#*:*}"
    else
        server="${server%:/*}"
        options="${server%%:*}"
        server="${server#*:}"
    fi
}

# nfsroot_from_dhcp NETIF
# fill in missing server/path from DHCP options.
nfsroot_from_dhcp() {
    local f
    for f in /tmp/net.$1.override /tmp/dhclient.$1.dhcpopts /tmp/leaseinfo.$1.dhcp.*; do
        # shellcheck disable=SC1090
        [ -f "$f" ] && . "$f"
    done
    [ -n "$new_root_path" ] && nfsroot_to_var "$nfs:$new_root_path"
    [ -z "$path" ] && [ "$(getarg root=)" = "/dev/nfs" ] && path=/tftpboot/%s
    [ -z "$server" ] && server=$srv
    [ -z "$server" ] && server=$new_next_server
    [ -z "$server" ] && server=$new_dhcp_server_identifier
    [ -z "$server" ] && server=$BOOTSERVERADDR
    [ -z "$server" ] && server=${new_root_path%%:*}
}

# Look through $options, fix "rw"/"ro", move "lock"/"nolock" to $nfslock
munge_nfs_options() {
    local f="" flags="" nfsrw="ro" OLDIFS="$IFS"
    IFS=,
    for f in $options; do
        case $f in
            ro | rw) nfsrw=$f ;;
            lock | nolock) nfslock=$f ;;
            *) flags=${flags:+$flags,}$f ;;
        esac
    done
    IFS="$OLDIFS"

    # Override rw/ro if set on cmdline
    getarg ro > /dev/null && nfsrw=ro
    getarg rw > /dev/null && nfsrw=rw

    options=$nfsrw${flags:+,$flags}
}

# mount_nfs NFSROOT MNTDIR [NETIF]
mount_nfs() {
    local nfsroot="$1" mntdir="$2" netif="$3"
    local nfs="" server="" path="" options=""
    nfs_to_var "$nfsroot" "$netif"
    munge_nfs_options
    if [ "$nfs" = "nfs4" ]; then
        options=$options${nfslock:+,$nfslock}
    else
        # NFSv{2,3} doesn't support using locks as it requires a helper to
        # transfer the rpcbind state to the new root
        [ "$nfslock" = "lock" ] \
            && warn "Locks unsupported on NFSv{2,3}, using nolock" 1>&2
        options=$options,nolock
    fi
    mount -t "$nfs" -o"$options" "$server:$path" "$mntdir"
}  0707010000018F000081ED00000000000000000000000164DF2CB8000003CF000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nfs/nfs-start-rpc.sh    #!/bin/sh

if modprobe sunrpc || strstr "$(cat /proc/filesystems)" rpc_pipefs; then
    [ ! -d /var/lib/nfs/rpc_pipefs/nfs ] \
        && mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs

    # Start rpcbind or rpcbind
    # FIXME occasionally saw 'rpcbind: fork failed: No such device' -- why?
    command -v portmap > /dev/null && [ -z "$(pidof portmap)" ] && portmap
    if command -v rpcbind > /dev/null && [ -z "$(pidof rpcbind)" ]; then
        mkdir -p /run/rpcbind
        chown rpc: /run/rpcbind
        rpcbind
    fi

    # Start rpc.statd as mount won't let us use locks on a NFSv4
    # filesystem without talking to it. NFSv4 does locks internally,
    # rpc.lockd isn't needed
    command -v rpc.statd > /dev/null && [ -z "$(pidof rpc.statd)" ] && rpc.statd
    command -v rpc.idmapd > /dev/null && [ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
else
    warn 'Kernel module "sunrpc" not in the initramfs, or support for filesystem "rpc_pipefs" missing!'
fi
 07070100000190000081ED00000000000000000000000164DF2CB80000035F000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nfs/nfsroot-cleanup.sh  #!/bin/sh

type incol2 > /dev/null 2>&1 || . /lib/dracut-lib.sh

[ -f /tmp/nfs.rpc_pipefs_path ] && rpcpipefspath=$(cat /tmp/nfs.rpc_pipefs_path)
[ -z "$rpcpipefspath" ] && rpcpipefspath=var/lib/nfs/rpc_pipefs

pid=$(pidof rpc.statd)
[ -n "$pid" ] && kill "$pid"

pid=$(pidof rpc.idmapd)
[ -n "$pid" ] && kill "$pid"

pid=$(pidof rpcbind)
[ -n "$pid" ] && kill "$pid"

if incol2 /proc/mounts /var/lib/nfs/rpc_pipefs; then
    # try to create the destination directory
    [ -d "$NEWROOT"/$rpcpipefspath ] \
        || mkdir -m 0755 -p "$NEWROOT"/$rpcpipefspath 2> /dev/null

    if [ -d "$NEWROOT"/$rpcpipefspath ]; then
        # mount --move does not seem to work???
        mount --bind /var/lib/nfs/rpc_pipefs "$NEWROOT"/$rpcpipefspath
        umount /var/lib/nfs/rpc_pipefs 2> /dev/null
    else
        umount /var/lib/nfs/rpc_pipefs 2> /dev/null
    fi
fi
 07070100000191000081ED00000000000000000000000164DF2CB800000301000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nfs/nfsroot.sh  #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
. /lib/nfs-lib.sh

[ "$#" = 3 ] || exit 1

# root is in the form root=nfs[4]:[server:]path[:options], either from
# cmdline or dhcp root-path
netif="$1"
root="$2"
NEWROOT="$3"

nfs_to_var "$root" "$netif"
[ -z "$server" ] && die "Required parameter 'server' is missing"

mount_nfs "$root" "$NEWROOT" "$netif" && {
    [ -e /dev/root ] || ln -s null /dev/root
    [ -e /dev/nfs ] || ln -s null /dev/nfs
}

[ -f "$NEWROOT"/etc/fstab ] && cat "$NEWROOT"/etc/fstab > /dev/null

# inject new exit_if_exists
# shellcheck disable=SC2016
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm -- "$job"' > "$hookdir"/initqueue/nfs.sh
# force udevsettle to break
: > "$hookdir"/initqueue/work

need_shutdown
   07070100000192000081ED00000000000000000000000164DF2CB800000D8B000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nfs/parse-nfsroot.sh    #!/bin/sh
#
# Preferred format:
#       root=nfs[4]:[server:]path[:options]
#
# This syntax can come from DHCP root-path as well.
#
# Legacy format:
#       root=/dev/nfs nfsroot=[server:]path[,options]
#
# In Legacy root=/dev/nfs mode, if the 'nfsroot' parameter is not given
# on the command line or is empty, the dhcp root-path is used as
# [server:]path[:options] or the default "/tftpboot/%s" will be used.
#
# If server is unspecified it will be pulled from one of the following
# sources, in order:
#       static ip= option on kernel command line
#       DHCP next-server option
#       DHCP server-id option
#       DHCP root-path option
#
# NFSv4 is only used if explicitly requested with nfs4: prefix, otherwise
# NFSv3 is used.
#

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
. /lib/nfs-lib.sh

# This script is sourced, so root should be set. But let's be paranoid
[ -z "$root" ] && root=$(getarg root=)
[ -z "$nfsroot" ] && nfsroot=$(getarg nfsroot=)

[ -n "$netroot" ] && oldnetroot="$netroot"

# netroot= cmdline argument must be ignored, but must be used if
# we're inside netroot to parse dhcp root-path
if [ -n "$netroot" ]; then
    for n in $(getargs netroot=); do
        [ "$n" = "$netroot" ] && break
    done
    if [ "$n" = "$netroot" ]; then
        #warn "Ignoring netroot argument for NFS"
        netroot=$root
    fi
else
    netroot=$root
fi

# LEGACY: nfsroot= is valid only if root=/dev/nfs
if [ -n "$nfsroot" ]; then
    # @deprecated
    warn "Argument nfsroot is deprecated and might be removed in a future release. See 'man dracut.kernel' for more information."
    if [ "$(getarg root=)" != "/dev/nfs" ]; then
        die "Argument nfsroot only accepted for legacy root=/dev/nfs"
    fi
    netroot=nfs:$nfsroot
fi

case "$netroot" in
    /dev/nfs) netroot=nfs ;;
    /dev/*)
        if [ -n "$oldnetroot" ]; then
            netroot="$oldnetroot"
        else
            unset netroot
        fi
        return
        ;;
    # LEGACY: root=<server-ip>:/<path
    [0-9]*:/* | [0-9]*\.[0-9]*\.[0-9]*[!:] | /*)
        netroot=nfs:$netroot
        ;;
esac

# Continue if nfs
case "${netroot%%:*}" in
    nfs | nfs4 | /dev/nfs) ;;
    *)
        if [ -n "$oldnetroot" ]; then
            netroot="$oldnetroot"
        else
            unset netroot
        fi
        return
        ;;
esac

# Check required arguments

if nfsdomain=$(getarg rd.nfs.domain -d rd_NFS_DOMAIN); then
    if [ -f /etc/idmapd.conf ]; then
        sed -i -e \
            "s/^[[:space:]#]*Domain[[:space:]]*=.*/Domain = $nfsdomain/g" \
            /etc/idmapd.conf
    fi
    # and even again after the sed, in case it was not yet specified
    echo "Domain = $nfsdomain" >> /etc/idmapd.conf
fi

nfsroot_to_var "$netroot"
[ "$path" = "error" ] && die "Argument nfsroot must contain a valid path!"

# Set fstype, might help somewhere
fstype=${nfs#/dev/}

# Rewrite root so we don't have to parse this uglyness later on again
netroot="$fstype:$server:$path:$options"

# If we don't have a server, we need dhcp
if [ -z "$server" ]; then
    # shellcheck disable=SC2034
    DHCPORSERVER="1"
fi

# Done, all good!
# shellcheck disable=SC2034
rootok=1

# Shut up init error check or make sure that block parser wont get
# confused by having /dev/nfs[4]
root="$fstype"

# shellcheck disable=SC2016
echo '[ -e $NEWROOT/proc ]' > "$hookdir"/initqueue/finished/nfsroot.sh

mkdir -p /var/lib/rpcbind
chown rpc: /var/lib/rpcbind
chmod 770 /var/lib/rpcbind
 07070100000193000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nvmf    07070100000194000081A400000000000000000000000164DF2CB80000022D000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nvmf/95-nvmf-initqueue.rules    #
# nvmf-initqueue.rules
#
# D-Bus doesn't run in the initrd, which means that we cannot use our
# usual trick of starting custom systemd services.
# So use a rule to create initqueue entries instead.

ACTION=="change", SUBSYSTEM=="fc", ENV{FC_EVENT}=="nvmediscovery", \
      ENV{NVMEFC_HOST_TRADDR}=="*", ENV{NVMEFC_TRADDR}=="*", \
      RUN+="/sbin/initqueue --onetime --unique --name nvmf-connect-$env{NVMEFC_TRADDR}-$env{NVMEFC_HOST_TRADDR} /usr/sbin/nvme connect-all --transport=fc --traddr=$env{NVMEFC_TRADDR} --host-traddr=$env{NVMEFC_HOST_TRADDR}"
   07070100000195000081ED00000000000000000000000164DF2CB800000F68000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nvmf/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    require_binaries nvme || return 1
    [ -f /etc/nvme/hostnqn ] || return 255
    [ -f /etc/nvme/hostid ] || return 255

    is_nvmf() {
        local _dev=$1
        local trtype

        [[ -L "/sys/dev/block/$_dev" ]] || return 0
        cd -P "/sys/dev/block/$_dev" || return 0
        if [ -f partition ]; then
            cd ..
        fi
        for d in device/nvme*; do
            [ -L "$d" ] || continue
            if readlink "$d" | grep -q nvme-fabrics; then
                trtype=$(cat "$d"/transport)
                break
            fi
        done
        [[ $trtype == "fc" ]] || [[ $trtype == "tcp" ]] || [[ $trtype == "rdma" ]]
    }

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        pushd . > /dev/null
        for_each_host_dev_and_slaves is_nvmf
        local _is_nvmf=$?
        popd > /dev/null || exit
        [[ $_is_nvmf == 0 ]] || return 255
        if [ ! -f /sys/class/fc/fc_udev_device/nvme_discovery ]; then
            if [ ! -f /etc/nvme/discovery.conf ]; then
                echo "No discovery arguments present"
                return 255
            fi
        fi
    }
    return 0
}

# called by dracut
depends() {
    echo bash rootfs-block network
    return 0
}

# called by dracut
installkernel() {
    instmods nvme_fc lpfc qla2xxx
    hostonly="" instmods nvme_tcp nvme_fabrics
}

# called by dracut
cmdline() {
    local _hostnqn
    local _hostid

    gen_nvmf_cmdline() {
        local _dev=$1
        local trtype
        local traddr
        local host_traddr
        local trsvcid
        local _address
        local -a _address_parts

        [[ -L "/sys/dev/block/$_dev" ]] || return 0
        cd -P "/sys/dev/block/$_dev" || return 0
        if [ -f partition ]; then
            cd ..
        fi
        for d in device/nvme*; do
            [ -L "$d" ] || continue
            if readlink "$d" | grep -q nvme-fabrics; then
                trtype=$(cat "$d"/transport)
                break
            fi
        done

        [ -z "$trtype" ] && return 0
        nvme list-subsys "${PWD##*/}" | while read -r _ _ trtype _address _; do
            [[ -z $trtype || $trtype != "${trtype#NQN}" ]] && continue
            unset traddr
            unset host_traddr
            unset trsvcid
            mapfile -t -d ',' _address_parts < <(printf "%s" "$_address")
            for i in "${_address_parts[@]}"; do
                [[ $i =~ ^traddr= ]] && traddr="${i#traddr=}"
                [[ $i =~ ^host_traddr= ]] && host_traddr="${i#host_traddr=}"
                [[ $i =~ ^trsvcid= ]] && trsvcid="${i#trsvcid=}"
            done
            [[ -z $traddr && -z $host_traddr && -z $trsvcid ]] && continue
            echo -n " rd.nvmf.discover=$trtype,$traddr,$host_traddr,$trsvcid"
        done
    }

    if [ -f /etc/nvme/hostnqn ]; then
        _hostnqn=$(cat /etc/nvme/hostnqn)
        echo -n " rd.nvmf.hostnqn=${_hostnqn}"
    fi
    if [ -f /etc/nvme/hostid ]; then
        _hostid=$(cat /etc/nvme/hostid)
        echo -n " rd.nvmf.hostid=${_hostid}"
    fi

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        pushd . > /dev/null
        for_each_host_dev_and_slaves gen_nvmf_cmdline
        popd > /dev/null || exit
    }
}

# called by dracut
install() {
    if [[ $hostonly_cmdline == "yes" ]]; then
        local _nvmf_args
        _nvmf_args=$(cmdline)
        [[ "$_nvmf_args" ]] && printf "%s" "$_nvmf_args" >> "${initdir}/etc/cmdline.d/95nvmf-args.conf"
    fi
    inst_simple "/etc/nvme/hostnqn"
    inst_simple "/etc/nvme/hostid"

    inst_multiple ip sed

    inst_script "${moddir}/nvmf-autoconnect.sh" /sbin/nvmf-autoconnect.sh

    inst_multiple nvme
    inst_hook cmdline 92 "$moddir/parse-nvmf-boot-connections.sh"
    inst_simple "/etc/nvme/discovery.conf"
    inst_rules /usr/lib/udev/rules.d/71-nvmf-iopolicy-netapp.rules
    inst_rules "$moddir/95-nvmf-initqueue.rules"
    dracut_need_initqueue
}
07070100000196000081ED00000000000000000000000164DF2CB800000088000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nvmf/nvmf-autoconnect.sh    #!/bin/bash

[ -f /sys/class/fc/fc_udev_device/nvme_discovery ] || exit 1
echo add > /sys/class/fc/fc_udev_device/nvme_discovery
exit 0
07070100000197000081ED00000000000000000000000164DF2CB800000D8D000000000000000000000000000000000000004E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95nvmf/parse-nvmf-boot-connections.sh #!/bin/sh
#
# Supported formats:
# rd.nvmf.hostnqn=<hostnqn>
# rd.nvmf.hostid=<hostid>
# rd.nvmf.discover=<transport>,<traddr>,<host-traddr>,<trsvcid>
#
# Examples:
# rd.nvmf.hostnqn=nqn.2014-08.org.nvmexpress:uuid:37303738-3034-584d-5137-333230423843
# rd.nvmf.discover=rdma,192.168.1.3,,4420
# rd.nvmf.discover=tcp,192.168.1.3,,4420
# rd.nvmf.discover=tcp,192.168.1.3
# rd.nvmf.discover=fc,nn-0x200400a098d85236:pn-0x201400a098d85236,nn-0x200000109b7db455:pn-0x100000109b7db455
# rd.nvmf.discover=fc,auto
#
# Note: FC does autodiscovery, so typically there is no need to
# specify any discover parameters for FC.
#

type is_ip > /dev/null 2>&1 || . /lib/net-lib.sh

if getargbool 0 rd.nonvmf; then
    warn "rd.nonvmf=0: skipping nvmf"
    return 0
fi

initqueue --onetime modprobe --all -b -q nvme_tcp nvme_core nvme_fabrics

parse_nvmf_discover() {
    traddr="none"
    trtype="none"
    hosttraddr="none"
    trsvcid=4420
    OLDIFS="$IFS"
    IFS=,
    # shellcheck disable=SC2086
    set -- $1
    IFS="$OLDIFS"

    case $# in
        2)
            [ -n "$1" ] && trtype=$1
            [ -n "$2" ] && traddr=$2
            ;;
        3)
            [ -n "$1" ] && trtype=$1
            [ -n "$2" ] && traddr=$2
            [ -n "$3" ] && hosttraddr=$3
            ;;
        4)
            [ -n "$1" ] && trtype=$1
            [ -n "$2" ] && traddr=$2
            [ -n "$3" ] && hosttraddr=$3
            [ -n "$4" ] && trsvcid=$4
            ;;
        *)
            warn "Invalid arguments for rd.nvmf.discover=$1"
            return 0
            ;;
    esac
    if [ "$traddr" = "none" ]; then
        warn "traddr is mandatory for $trtype"
        return 0
    fi
    if [ "$trtype" = "tcp" ]; then
        : > /tmp/nvmf_needs_network
    elif [ "$trtype" = "fc" ]; then
        if [ "$traddr" = "auto" ]; then
            rm /etc/nvme/discovery.conf
            return 1
        fi
        if [ "$hosttraddr" = "none" ]; then
            warn "host traddr is mandatory for fc"
            return 0
        fi
    elif [ "$trtype" != "rdma" ]; then
        warn "unsupported transport $trtype"
        return 0
    fi
    if [ "$trtype" = "fc" ]; then
        echo "--transport=$trtype --traddr=$traddr --host-traddr=$hosttraddr" >> /etc/nvme/discovery.conf
    else
        echo "--transport=$trtype --traddr=$traddr --host-traddr=$hosttraddr --trsvcid=$trsvcid" >> /etc/nvme/discovery.conf
    fi
    return 0
}

nvmf_hostnqn=$(getarg rd.nvmf.hostnqn -d nvmf.hostnqn=)
if [ -n "$nvmf_hostnqn" ]; then
    echo "$nvmf_hostnqn" > /etc/nvme/hostnqn
fi
nvmf_hostid=$(getarg rd.nvmf.hostid -d nvmf.hostid=)
if [ -n "$nvmf_hostid" ]; then
    echo "$nvmf_hostid" > /etc/nvme/hostid
fi

NVMF_FC_AUTO=
for d in $(getargs rd.nvmf.discover -d nvmf.discover=); do
    parse_nvmf_discover "$d" || {
        NVMF_FC_AUTO=1
        break
    }
done

if [ -e /tmp/nvmf_needs_network ]; then
    echo "rd.neednet=1" > /etc/cmdline.d/nvmf-neednet.conf
    rm -f /tmp/nvmf_needs_network
fi

# Host NQN and host id are mandatory for NVMe-oF
if [ -f "/etc/nvme/hostnqn" ] && [ -f "/etc/nvme/hostid" ]; then

    # If no nvme command line arguments present, try autodiscovery
    if [ $NVMF_FC_AUTO ] || [ ! -f "/etc/nvme/discovery.conf" ]; then
        /sbin/initqueue --settled --onetime --unique --name nvme-fc-autoconnect /sbin/nvmf-autoconnect.sh
    else
        /sbin/initqueue --settled --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all
    fi
fi
   07070100000198000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003500000000dracut-055+suse.347.gdcb9bdbf/modules.d/95qeth_rules  07070100000199000081ED00000000000000000000000164DF2CB800000542000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/95qeth_rules/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    local _arch=${DRACUT_ARCH:-$(uname -m)}
    local _online=0
    [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
    dracut_module_included network || return 1

    [[ $hostonly ]] && {
        for i in /sys/devices/qeth/*/online; do
            read -r _online < "$i"
            [ "$_online" -eq 1 ] && return 0
        done
    }
    return 255
}

# called by dracut
installkernel() {
    instmods qeth
}

# called by dracut
install() {
    ccwid() {
        qeth_path=$(readlink -e -q "$1"/device)
        basename "$qeth_path"
    }

    inst_rules_qeth() {
        for rule in /etc/udev/rules.d/{4,5}1-qeth-${1}.rules; do
            # prefer chzdev generated 41- rules
            if [ -f "$rule" ]; then
                inst_rules "$rule"
                break
            fi
        done
    }

    has_carrier() {
        carrier=0
        # not readable in qeth interfaces
        # that have just been assembled, ignore
        # read error and assume no carrier
        read -r carrier 2> /dev/null < "$1/carrier"
        [ "$carrier" -eq 1 ] && return 0
        return 1
    }

    for dev in /sys/class/net/*; do
        has_carrier "$dev" || continue
        id=$(ccwid "$dev")
        [ -n "$id" ] && inst_rules_qeth "$id"
    done

    inst_simple -o /usr/lib/udev/collect
}
  0707010000019A000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/modules.d/95resume  0707010000019B000081ED00000000000000000000000164DF2CB800000C56000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/95resume/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    swap_on_netdevice() {
        local _dev
        for _dev in "${swap_devs[@]}"; do
            block_is_netdevice "$(get_maj_min "$_dev")" && return 0
        done
        return 1
    }

    # Only support resume if there is any suitable swap and
    # it is not mounted on a net device
    [[ $hostonly ]] || [[ $mount_needs ]] && {
        # sanity check: do not add the resume module if there is a
        # resume argument pointing to a non existent disk or to a
        # volatile swap
        local _resume
        _resume=$(getarg resume=)
        if [ -n "$_resume" ]; then
            _resume="$(label_uuid_to_dev "$_resume")"
            if [ ! -e "$_resume" ]; then
                derror "Current resume kernel argument points to an invalid disk"
                return 255
            fi
            if [[ "$_resume" == /dev/mapper/* ]]; then
                if [[ -f "$dracutsysrootdir"/etc/crypttab ]]; then
                    local _mapper _opts
                    read -r _mapper _ _ _opts < <(grep -m1 -w "^${_resume#/dev/mapper/}" "$dracutsysrootdir"/etc/crypttab)
                    if [[ -n "$_mapper" ]] && [[ "$_opts" == *swap* ]]; then
                        derror "Current resume kernel argument points to a volatile swap"
                        return 255
                    fi
                fi
            fi
        fi
        ((${#swap_devs[@]})) || return 255
        swap_on_netdevice && return 255
    }

    return 0
}

# called by dracut
cmdline() {
    local _resume

    for dev in "${!host_fs_types[@]}"; do
        [[ ${host_fs_types[$dev]} =~ ^(swap|swsuspend|swsupend)$ ]] || continue
        _resume=$(shorten_persistent_dev "$(get_persistent_dev "$dev")")
        [[ -n ${_resume} ]] && printf " resume=%s" "${_resume}"
    done
}

# called by dracut
install() {
    local _bin
    local _resumeconf

    if [[ $hostonly_cmdline == "yes" ]]; then
        _resumeconf=$(cmdline)
        [[ $_resumeconf ]] && printf "%s\n" "$_resumeconf" >> "${initdir}/etc/cmdline.d/95resume.conf"
    fi

    # if systemd is included and has the hibernate-resume tool, use it and nothing else
    if dracut_module_included "systemd" && [[ -x $dracutsysrootdir$systemdutildir/systemd-hibernate-resume ]]; then
        inst_multiple -o \
            "$systemdutildir"/system-generators/systemd-hibernate-resume-generator \
            "$systemdsystemunitdir"/systemd-hibernate-resume@.service \
            "$systemdutildir"/systemd-hibernate-resume
        return 0
    fi

    # Optional uswsusp support
    for _bin in /usr/sbin/resume /usr/lib/suspend/resume /usr/lib/uswsusp/resume; do
        [[ -x $dracutsysrootdir${_bin} ]] && {
            inst "${_bin}" /usr/sbin/resume
            [[ $hostonly ]] && [[ -f $dracutsysrootdir/etc/suspend.conf ]] && inst -H /etc/suspend.conf
            break
        }
    done

    if ! dracut_module_included "systemd"; then
        inst_hook cmdline 10 "$moddir/parse-resume.sh"
    else
        inst_script "$moddir/parse-resume.sh" /lib/dracut/parse-resume.sh
    fi

    inst_script "$moddir/resume.sh" /lib/dracut/resume.sh
}
  0707010000019C000081ED00000000000000000000000164DF2CB800000D55000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/95resume/parse-resume.sh  #!/bin/sh

if resume=$(getarg resume=) && ! getarg noresume; then
    export resume
    echo "$resume" > /.resume
else
    unset resume
fi

resume="$(label_uuid_to_dev "$resume")"

if splash=$(getarg splash=); then
    export splash
else
    unset splash
fi

case "$splash" in
    quiet)
        a_splash="-P splash=y"
        ;;
    *)
        a_splash="-P splash=n"
        ;;
esac

if ! getarg noresume; then
    if [ -n "$resume" ]; then
        wait_for_dev /dev/resume

        {
            printf "KERNEL==\"%s\", ACTION==\"add|change\", SYMLINK+=\"resume\"\n" \
                "${resume#/dev/}"
            printf "SYMLINK==\"%s\", ACTION==\"add|change\", SYMLINK+=\"resume\"\n" \
                "${resume#/dev/}"
        } >> /etc/udev/rules.d/99-resume-link.rules

        {
            if [ -x /usr/sbin/resume ]; then
                printf -- 'KERNEL=="%s", ' "${resume#/dev/}"
                printf -- '%s' 'ACTION=="add|change", ENV{ID_FS_TYPE}=="suspend|swsuspend|swsupend",'
                printf -- " RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \
                    "$a_splash" "$resume"
                printf -- 'SYMLINK=="%s", ' "${resume#/dev/}"
                printf -- '%s' 'ACTION=="add|change", ENV{ID_FS_TYPE}=="suspend|swsuspend|swsupend",'
                printf -- " RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \
                    "$a_splash" "$resume"
            fi

            printf -- 'KERNEL=="%s", ' "${resume#/dev/}"
            printf -- '%s' 'ACTION=="add|change", ENV{ID_FS_TYPE}=="suspend|swsuspend|swsupend",'
            printf -- '%s\n' ' RUN+="/sbin/initqueue --finished --unique --name 00resume echo %M:%m > /sys/power/resume"'

            printf -- 'SYMLINK=="%s", ' "${resume#/dev/}"
            printf -- '%s' 'ACTION=="add|change", ENV{ID_FS_TYPE}=="suspend|swsuspend|swsupend",'
            printf -- '%s\n' ' RUN+="/sbin/initqueue --finished --unique --name 00resume echo %M:%m  > /sys/power/resume"'
        } >> /etc/udev/rules.d/99-resume.rules

        # shellcheck disable=SC2016
        printf '[ -e "%s" ] && { ln -fs "%s" /dev/resume 2> /dev/null; rm -f -- "$job" "%s/initqueue/timeout/resume.sh"; }\n' \
            "$resume" "$resume" "$hookdir" >> "$hookdir"/initqueue/settled/resume.sh

        {
            printf -- "%s" 'warn "Cancelling resume operation. Device not found.";'
            # shellcheck disable=SC2016
            printf -- ' cancel_wait_for_dev /dev/resume; rm -f -- "$job" "%s/initqueue/settled/resume.sh";\n' "$hookdir"
        } >> "$hookdir"/initqueue/timeout/resume.sh

        mv /lib/dracut/resume.sh /lib/dracut/hooks/pre-mount/10-resume.sh
    else
        {
            if [ -x /usr/sbin/resume ]; then
                printf -- '%s' 'SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="suspend|swsuspend|swsupend",'
                # shellcheck disable=SC2016
                printf -- ' RUN+="/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s $tempnode"\n' "$a_splash"
            fi
            printf -- '%s' 'SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="suspend|swsuspend|swsupend",'
            printf -- '%s\n' ' RUN+="/sbin/initqueue --finished --unique --name 00resume echo %M:%m > /sys/power/resume"'
        } >> /etc/udev/rules.d/99-resume.rules
    fi
fi
   0707010000019D000081ED00000000000000000000000164DF2CB8000001B2000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95resume/resume.sh    #!/bin/sh

PATH=/usr/sbin:/usr/bin:/sbin:/bin

[ -s /.resume -a -b "$resume" ] && {
    # First try user level resume; it offers splash etc
    case "$splash" in
        quiet)
            a_splash="-P splash=y"
            ;;
        *)
            a_splash="-P splash=n"
            ;;
    esac
    [ -x "$(command -v resume)" ] && command resume "$a_splash" "$resume"

    (readlink -fn "$resume" > /sys/power/resume) > /.resume
}
  0707010000019E000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/modules.d/95rootfs-block    0707010000019F000081ED00000000000000000000000164DF2CB800000237000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/95rootfs-block/block-genrules.sh  #!/bin/sh

# shellcheck disable=SC2154
if [ "${root%%:*}" = "block" ]; then
    {
        printf 'KERNEL=="%s", SYMLINK+="root"\n' \
            "${root#block:/dev/}"
        printf 'SYMLINK=="%s", SYMLINK+="root"\n' \
            "${root#block:/dev/}"
    } >> /etc/udev/rules.d/99-root.rules

    # shellcheck disable=SC2016
    # shellcheck disable=SC2154
    printf '[ -e "%s" ] && { ln -s "%s" /dev/root 2>/dev/null; rm "$job"; }\n' \
        "${root#block:}" "${root#block:}" > "$hookdir"/initqueue/settled/blocksymlink.sh

    wait_for_dev "${root#block:}"
fi
 070701000001A0000081ED00000000000000000000000164DF2CB800000999000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/95rootfs-block/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    return 0
}

# called by dracut
depends() {
    echo fs-lib
}

cmdline_journal() {
    if [[ $hostonly ]]; then
        for dev in "${!host_fs_types[@]}"; do
            [[ ${host_fs_types[$dev]} == "reiserfs" ]] || [[ ${host_fs_types[$dev]} == "xfs" ]] || continue
            rootopts=$(find_dev_fsopts "$dev")
            if [[ ${host_fs_types[$dev]} == "reiserfs" ]]; then
                journaldev=$(fs_get_option "$rootopts" "jdev")
            elif [[ ${host_fs_types[$dev]} == "xfs" ]]; then
                journaldev=$(fs_get_option "$rootopts" "logdev")
            fi

            if [ -n "$journaldev" ]; then
                printf " root.journaldev=%s" "$journaldev"
            fi
        done
    fi
    return 0
}

cmdline_rootfs() {
    local _block
    _block=$(find_root_block_device)
    local _dev=/dev/block/$_block
    local _fstype _flags _subvol

    # "--no-hostonly-default-device" can result in empty root_devs
    if [ "${#root_devs[@]}" -eq 0 ]; then
        return
    fi

    if [ -n "$_block" -a -b "$_dev" ]; then
        printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$_dev")")"
    fi
    _fstype="$(find_mp_fstype /)"
    _flags="$(find_mp_fsopts /)"
    if [ -n "$_fstype" ]; then
        printf " rootfstype=%s" "$_fstype"
    fi
    if [[ $use_fstab != yes ]] && [[ $_fstype == btrfs ]]; then
        _subvol=$(findmnt -e -v -n -o FSROOT --target /) \
            && _subvol=${_subvol#/}
        _flags="$_flags${_subvol:+,subvol=$_subvol}"
    fi
    if [ -n "$_flags" ]; then
        printf " rootflags=%s" "$_flags"
    fi
}

# called by dracut
cmdline() {
    cmdline_rootfs
    cmdline_journal
}

# called by dracut
install() {
    if [[ $hostonly_cmdline == "yes" ]]; then
        local _journaldev
        _journaldev=$(cmdline_journal)
        [[ $_journaldev ]] && printf "%s\n" "$_journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
        local _rootdev
        _rootdev=$(cmdline_rootfs)
        [[ $_rootdev ]] && printf "%s\n" "$_rootdev" >> "${initdir}/etc/cmdline.d/95root-dev.conf"
    fi

    inst_multiple umount
    inst_multiple tr
    if ! dracut_module_included "systemd"; then
        inst_hook cmdline 95 "$moddir/parse-block.sh"
        inst_hook pre-udev 30 "$moddir/block-genrules.sh"
        inst_hook mount 99 "$moddir/mount-root.sh"
    fi

    inst_hook initqueue/timeout 99 "$moddir/rootfallback.sh"
}
   070701000001A1000081ED00000000000000000000000164DF2CB80000115E000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/95rootfs-block/mount-root.sh  #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
type det_fs > /dev/null 2>&1 || . /lib/fs-lib.sh

mount_root() {
    local _rflags_ro
    # sanity - determine/fix fstype
    rootfs=$(det_fs "${root#block:}" "$fstype")

    journaldev=$(getarg "root.journaldev=")
    if [ -n "$journaldev" ]; then
        case "$rootfs" in
            xfs)
                rflags="${rflags:+${rflags},}logdev=$journaldev"
                ;;
            reiserfs)
                fsckoptions="-j $journaldev $fsckoptions"
                rflags="${rflags:+${rflags},}jdev=$journaldev"
                ;;
            *) ;;
        esac
    fi

    _rflags_ro="$rflags,ro"
    _rflags_ro="${_rflags_ro##,}"

    while ! mount -t "${rootfs}" -o "$_rflags_ro" "${root#block:}" "$NEWROOT"; do
        warn "Failed to mount -t ${rootfs} -o $_rflags_ro ${root#block:} $NEWROOT"
        fsck_ask_err
    done

    READONLY=
    fsckoptions=
    if [ -f "$NEWROOT"/etc/sysconfig/readonly-root ]; then
        # shellcheck disable=SC1090
        . "$NEWROOT"/etc/sysconfig/readonly-root
    fi

    if getargbool 0 "readonlyroot=" -y readonlyroot; then
        READONLY=yes
    fi

    if getarg noreadonlyroot; then
        READONLY=no
    fi

    if [ -f "$NEWROOT"/fastboot ] || getargbool 0 fastboot; then
        fastboot=yes
    fi

    if ! getargbool 0 rd.skipfsck; then
        if [ -f "$NEWROOT"/fsckoptions ]; then
            fsckoptions=$(cat "$NEWROOT"/fsckoptions)
        fi

        if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck; then
            fsckoptions="-f $fsckoptions"
        elif [ -f "$NEWROOT"/.autofsck ]; then
            # shellcheck disable=SC1090
            [ -f "$NEWROOT"/etc/sysconfig/autofsck ] \
                && . "$NEWROOT"/etc/sysconfig/autofsck
            if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
                AUTOFSCK_OPT="$AUTOFSCK_OPT -f"
            fi
            if [ -n "$AUTOFSCK_SINGLEUSER" ]; then
                warn "*** Warning -- the system did not shut down cleanly. "
                warn "*** Dropping you to a shell; the system will continue"
                warn "*** when you leave the shell."
                emergency_shell
            fi
            fsckoptions="$AUTOFSCK_OPT $fsckoptions"
        fi
    fi

    rootopts=
    if getargbool 1 rd.fstab -d -n rd_NO_FSTAB \
        && ! getarg rootflags > /dev/null \
        && [ -f "$NEWROOT/etc/fstab" ] \
        && ! [ -L "$NEWROOT/etc/fstab" ]; then
        # if $NEWROOT/etc/fstab contains special mount options for
        # the root filesystem,
        # remount it with the proper options
        rootopts="defaults"
        while read -r dev mp fs opts _ fsck || [ -n "$dev" ]; do
            # skip comments
            [ "${dev%%#*}" != "$dev" ] && continue

            if [ "$mp" = "/" ]; then
                # sanity - determine/fix fstype
                rootfs=$(det_fs "${root#block:}" "$fs")
                rootopts=$opts
                rootfsck=$fsck
                break
            fi
        done < "$NEWROOT/etc/fstab"
    fi

    # we want rootflags (rflags) to take precedence so prepend rootopts to
    # them
    rflags="${rootopts},${rflags}"
    rflags="${rflags#,}"
    rflags="${rflags%,}"

    # backslashes are treated as escape character in fstab
    # esc_root=$(echo ${root#block:} | sed 's,\\,\\\\,g')
    # printf '%s %s %s %s 1 1 \n' "$esc_root" "$NEWROOT" "$rootfs" "$rflags" >/etc/fstab

    if fsck_able "$rootfs" \
        && [ "$rootfsck" != "0" -a -z "$fastboot" -a "$READONLY" != "yes" ] \
        && ! strstr "${rflags}" _netdev \
        && ! getargbool 0 rd.skipfsck; then
        umount "$NEWROOT"
        fsck_single "${root#block:}" "$rootfs" "$rflags" "$fsckoptions"
    fi

    echo "${root#block:} $NEWROOT $rootfs ${rflags:-defaults} 0 ${rootfsck:-0}" >> /etc/fstab

    if ! ismounted "$NEWROOT"; then
        info "Mounting ${root#block:} with -o ${rflags}"
        mount "$NEWROOT" 2>&1 | vinfo
    elif ! are_lists_eq , "$rflags" "$_rflags_ro" defaults; then
        info "Remounting ${root#block:} with -o ${rflags}"
        mount -o remount "$NEWROOT" 2>&1 | vinfo
    fi

    if ! getargbool 0 rd.skipfsck; then
        [ -f "$NEWROOT"/forcefsck ] && rm -f -- "$NEWROOT"/forcefsck 2> /dev/null
        [ -f "$NEWROOT"/.autofsck ] && rm -f -- "$NEWROOT"/.autofsck 2> /dev/null
    fi
}

if [ -n "$root" -a -z "${root%%block:*}" ]; then
    mount_root
fi
  070701000001A2000081ED00000000000000000000000164DF2CB800000156000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/modules.d/95rootfs-block/parse-block.sh #!/bin/sh

case "${root#block:}" in
    LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
        root="block:$(label_uuid_to_dev "$root")"
        rootok=1
        ;;
    /dev/*)
        root="block:${root#block:}"
        # shellcheck disable=SC2034
        rootok=1
        ;;
esac

[ "${root%%:*}" = "block" ] && wait_for_dev "${root#block:}"
  070701000001A3000081ED00000000000000000000000164DF2CB8000001CB000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/95rootfs-block/rootfallback.sh    #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

for root in $(getargs rootfallback=); do
    root=$(label_uuid_to_dev "$root")

    if ! [ -b "$root" ]; then
        warn "Could not find rootfallback $root"
        continue
    fi

    if mount "$root" /sysroot; then
        info "Mounted rootfallback $root"
        exit 0
    else
        warn "Failed to mount rootfallback $root"
        exit 1
    fi
done

[ -e "$job" ] && rm -f "$job"
 070701000001A4000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003500000000dracut-055+suse.347.gdcb9bdbf/modules.d/95ssh-client  070701000001A5000081ED00000000000000000000000164DF2CB800000902000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/95ssh-client/module-setup.sh  #!/bin/bash

# fixme: assume user is root

# called by dracut
check() {
    [[ $mount_needs ]] && return 1

    # If our prerequisites are not met, fail.
    require_binaries ssh scp || return 1

    if [[ $sshkey ]]; then
        [[ ! -f $dracutsysrootdir$sshkey ]] && {
            derror "ssh key: $sshkey is not found!"
            return 1
        }
    fi

    return 255
}

# called by dracut
depends() {
    # We depend on network modules being loaded
    echo network
}

inst_sshenv() {
    if [[ -d $dracutsysrootdir/root/.ssh ]]; then
        inst_dir /root/.ssh
        chmod 700 "${initdir}"/root/.ssh
    fi

    # Copy over ssh key and knowhosts if needed
    [[ $sshkey ]] && {
        inst_simple "$sshkey"
        [[ -f $dracutsysrootdir/root/.ssh/known_hosts ]] && inst_simple /root/.ssh/known_hosts
        [[ -f $dracutsysrootdir/etc/ssh/ssh_known_hosts ]] && inst_simple /etc/ssh/ssh_known_hosts
    }

    # Copy over root and system-wide ssh configs.
    [[ -f $dracutsysrootdir/root/.ssh/config ]] && inst_simple /root/.ssh/config
    if [[ -f $dracutsysrootdir/etc/ssh/ssh_config ]]; then
        inst_simple /etc/ssh/ssh_config
        sed -i -e 's/\(^[[:space:]]*\)ProxyCommand/\1# ProxyCommand/' "${initdir}"/etc/ssh/ssh_config
        while read -r key val || [ -n "$key" ]; do
            if [[ $key == "GlobalKnownHostsFile" ]]; then
                inst_simple "$val"
            # Copy customized UserKnowHostsFile
            elif [[ $key == "UserKnownHostsFile" ]]; then
                # Make sure that ~/foo will be copied as /root/foo in kdump's initramfs
                # shellcheck disable=SC2088
                if str_starts "$val" "~/"; then
                    val="/root/${val#"~/"}"
                fi
                inst_simple "$val"
            fi
        done < "$dracutsysrootdir"/etc/ssh/ssh_config
    fi

    return 0
}

# called by dracut
install() {
    local _nsslibs

    inst_multiple ssh scp
    inst_sshenv

    _nsslibs=$(
        cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
            | sed -e 's/#.*//; s/^[^:]*://; s/\[[^]]*\]//' \
            | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
    )
    _nsslibs=${_nsslibs#|}
    _nsslibs=${_nsslibs%|}

    inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'
}
  070701000001A6000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003300000000dracut-055+suse.347.gdcb9bdbf/modules.d/95terminfo    070701000001A7000081ED00000000000000000000000164DF2CB800000247000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/95terminfo/module-setup.sh    #!/bin/bash

# called by dracut
install() {
    local _terminfodir
    # terminfo bits make things work better if you fall into interactive mode
    for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
        [[ -f $dracutsysrootdir${_terminfodir}/l/linux ]] && break
    done

    if [[ -d $dracutsysrootdir${_terminfodir} ]]; then
        for i in "l/linux" "v/vt100" "v/vt102" "v/vt220"; do
            inst_dir "$_terminfodir/${i%/*}"
            $DRACUT_CP -L -t "${initdir}/${_terminfodir}/${i%/*}" "$dracutsysrootdir$_terminfodir/$i"
        done
    fi
}
 070701000001A8000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003500000000dracut-055+suse.347.gdcb9bdbf/modules.d/95udev-rules  070701000001A9000081A400000000000000000000000164DF2CB800000113000000000000000000000000000000000000005100000000dracut-055+suse.347.gdcb9bdbf/modules.d/95udev-rules/59-persistent-storage.rules  SUBSYSTEM!="block", GOTO="ps_end"
ACTION!="add|change", GOTO="ps_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="ps_end"

KERNEL=="cciss[0-9]*", IMPORT BLKID
KERNEL=="nbd[0-9]*", IMPORT BLKID

LABEL="ps_end"
 070701000001AA000081A400000000000000000000000164DF2CB8000003FB000000000000000000000000000000000000005100000000dracut-055+suse.347.gdcb9bdbf/modules.d/95udev-rules/61-persistent-storage.rules  SUBSYSTEM!="block", GOTO="pss_end"
ACTION!="add|change", GOTO="pss_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="pss_end"

ACTION=="change", KERNEL=="dm-[0-9]*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}!="1", GOTO="do_pss"
KERNEL=="cciss[0-9]*", GOTO="do_pss"
KERNEL=="nbd[0-9]*", GOTO="do_pss"
KERNEL=="md[0-9]*|md_d[0-9]*|md/*", GOTO="do_pss"

GOTO="pss_end"

LABEL="do_pss"
# by-path (parent device path)
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT PATH_ID
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}"
ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"

# by-label/by-uuid links (filesystem metadata)
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
LABEL="pss_end"
 070701000001AB000081ED00000000000000000000000164DF2CB80000004E000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/95udev-rules/load-modules.sh  #!/bin/sh

# Implement blacklisting for udev-loaded modules

modprobe -b "$@"
  070701000001AC000081ED00000000000000000000000164DF2CB800000D1D000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/95udev-rules/module-setup.sh  #!/bin/bash

# called by dracut
install() {
    local _i

    # Fixme: would be nice if we didn't have to guess, which rules to grab....
    # ultimately, /lib/initramfs/rules.d or somesuch which includes links/copies
    # of the rules we want so that we just copy those in would be best
    inst_multiple udevadm cat uname blkid
    inst_dir /etc/udev
    inst_multiple -o /etc/udev/udev.conf

    [[ -d ${initdir}/$systemdutildir ]] || mkdir -p "${initdir}/$systemdutildir"
    for _i in "${systemdutildir}"/systemd-udevd "${udevdir}"/udevd /sbin/udevd; do
        [[ -x $dracutsysrootdir$_i ]] || continue
        inst "$_i"

        if ! [[ -f ${initdir}${systemdutildir}/systemd-udevd ]]; then
            ln -fs "$_i" "${initdir}${systemdutildir}"/systemd-udevd
        fi
        break
    done
    if ! [[ -e ${initdir}${systemdutildir}/systemd-udevd ]]; then
        derror "Cannot find [systemd-]udevd binary!"
        exit 1
    fi

    inst_rules \
        40-redhat.rules \
        50-firmware.rules \
        50-udev.rules \
        50-udev-default.rules \
        55-scsi-sg3_id.rules \
        58-scsi-sg3_symlink.rules \
        59-scsi-sg3_utils.rules \
        60-block.rules \
        60-pcmcia.rules \
        60-persistent-storage.rules \
        61-persistent-storage-edd.rules \
        64-btrfs.rules \
        70-uaccess.rules \
        70-persistent-net.rules \
        71-seat.rules \
        73-seat-late.rules \
        75-net-description.rules \
        80-drivers.rules 95-udev-late.rules \
        80-net-name-slot.rules 80-net-setup-link.rules \
        95-late.rules \
        "$moddir/59-persistent-storage.rules" \
        "$moddir/61-persistent-storage.rules"

    prepare_udev_rules 59-persistent-storage.rules 61-persistent-storage.rules
    # debian udev rules
    inst_rules 91-permissions.rules
    # eudev rules
    inst_rules 80-drivers-modprobe.rules
    # legacy persistent network device name rules
    [[ $hostonly ]] && inst_rules 70-persistent-net.rules

    {
        for i in cdrom tape dialout floppy; do
            if ! grep -q "^$i:" "$initdir"/etc/group 2> /dev/null; then
                if ! grep "^$i:" "$dracutsysrootdir"/etc/group 2> /dev/null; then
                    case $i in
                        cdrom) echo "$i:x:11:" ;;
                        dialout) echo "$i:x:18:" ;;
                        floppy) echo "$i:x:19:" ;;
                        tape) echo "$i:x:33:" ;;
                    esac
                fi
            fi
        done
    } >> "$initdir/etc/group"

    inst_multiple -o \
        "${udevdir}"/ata_id \
        "${udevdir}"/cdrom_id \
        "${udevdir}"/create_floppy_devices \
        "${udevdir}"/edd_id \
        "${udevdir}"/firmware.sh \
        "${udevdir}"/firmware \
        "${udevdir}"/firmware.agent \
        "${udevdir}"/hotplug.functions \
        "${udevdir}"/fw_unit_symlinks.sh \
        "${udevdir}"/hid2hci \
        "${udevdir}"/path_id \
        "${udevdir}"/input_id \
        "${udevdir}"/scsi_id \
        "${udevdir}"/usb_id \
        "${udevdir}"/pcmcia-socket-startup \
        "${udevdir}"/pcmcia-check-broken-cis

    inst_multiple -o /etc/pcmcia/config.opts

    [[ -f $dracutsysrootdir/etc/arch-release ]] \
        && inst_script "$moddir/load-modules.sh" /lib/udev/load-modules.sh

    inst_libdir_file "libnss_files*"

}
   070701000001AD000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/modules.d/95virtfs  070701000001AE000081ED00000000000000000000000164DF2CB800000211000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/95virtfs/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for fs in "${host_fs_types[@]}"; do
            [[ $fs == "9p" ]] && return 0
        done
        return 255
    }

    is_qemu_virtualized && return 0

    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
installkernel() {
    instmods 9p 9pnet_virtio virtio_pci
}

# called by dracut
install() {
    inst_hook cmdline 95 "$moddir/parse-virtfs.sh"
    inst_hook mount 99 "$moddir/mount-virtfs.sh"
}
   070701000001AF000081ED00000000000000000000000164DF2CB800000773000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/95virtfs/mount-virtfs.sh  #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

filter_rootopts() {
    rootopts=$1
    # strip ro and rw options
    local OLDIFS="$IFS"
    IFS=,
    # shellcheck disable=SC2086
    set -- $rootopts
    IFS="$OLDIFS"
    local v
    while [ $# -gt 0 ]; do
        case $1 in
            rw | ro) ;;
            defaults) ;;
            *)
                v="$v,${1}"
                ;;
        esac
        shift
    done
    rootopts=${v#,}
    echo "$rootopts"
}

mount_root() {
    rootfs="9p"
    rflags="trans=virtio,version=9p2000.L"

    modprobe 9pnet_virtio

    mount -t ${rootfs} -o "$rflags",ro "${root#virtfs:}" "$NEWROOT"

    rootopts=
    if getargbool 1 rd.fstab -n rd_NO_FSTAB \
        && ! getarg rootflags \
        && [ -f "$NEWROOT/etc/fstab" ] \
        && ! [ -L "$NEWROOT/etc/fstab" ]; then
        # if $NEWROOT/etc/fstab contains special mount options for
        # the root filesystem,
        # remount it with the proper options
        rootopts="defaults"
        while read -r dev mp _ opts rest || [ -n "$dev" ]; do
            # skip comments
            [ "${dev%%#*}" != "$dev" ] && continue

            if [ "$mp" = "/" ]; then
                rootopts=$opts
                break
            fi
        done < "$NEWROOT/etc/fstab"

        rootopts=$(filter_rootopts "$rootopts")
    fi

    # we want rootflags (rflags) to take precedence so prepend rootopts to
    # them; rflags is guaranteed to not be empty
    rflags="${rootopts:+${rootopts},}${rflags}"

    umount "$NEWROOT"

    info "Remounting ${root#virtfs:} with -o ${rflags}"
    mount -t ${rootfs} -o "$rflags" "${root#virtfs:}" "$NEWROOT" 2>&1 | vinfo

    [ -f "$NEWROOT"/forcefsck ] && rm -f -- "$NEWROOT"/forcefsck 2> /dev/null
    [ -f "$NEWROOT"/.autofsck ] && rm -f -- "$NEWROOT"/.autofsck 2> /dev/null
}

if [ -n "$root" -a -z "${root%%virtfs:*}" ]; then
    mount_root
fi
:
 070701000001B0000081ED00000000000000000000000164DF2CB80000007C000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/95virtfs/parse-virtfs.sh  #!/bin/sh

if [ "${root%%:*}" = "virtfs" ]; then
    modprobe 9pnet_virtio

    # shellcheck disable=SC2034
    rootok=1
fi
070701000001B1000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95zfcp    070701000001B2000081ED00000000000000000000000164DF2CB80000024A000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95zfcp/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    arch=${DRACUT_ARCH:-$(uname -m)}
    [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1

    require_binaries zfcp_cio_free grep sed seq || return 1

    return 0
}

# called by dracut
depends() {
    return 0
}

# called by dracut
installkernel() {
    instmods zfcp
}

# called by dracut
install() {
    inst_hook cmdline 30 "$moddir/parse-zfcp.sh"
    inst_multiple zfcp_cio_free grep sed seq

    inst_script /sbin/zfcpconf.sh
    inst_rules 56-zfcp.rules

    if [[ $hostonly ]]; then
        inst_simple -H /etc/zfcp.conf
    fi
}
  070701000001B3000081ED00000000000000000000000164DF2CB8000001E2000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95zfcp/parse-zfcp.sh  #!/bin/sh

getargbool 1 rd.zfcp.conf -d -n rd_NO_ZFCPCONF || rm /etc/zfcp.conf

for zfcp_arg in $(getargs rd.zfcp -d 'rd_ZFCP='); do
    echo "$zfcp_arg" | grep '^0\.[0-9a-fA-F]\.[0-9a-fA-F]\{4\}\(,0x[0-9a-fA-F]\{16\},0x[0-9a-fA-F]\{16\}\)\?$' > /dev/null
    test $? -ne 0 && die "For argument 'rd.zfcp=$zfcp_arg'\nSorry, invalid format."
    (
        IFS=","
        # shellcheck disable=SC2086
        set $zfcp_arg
        echo "$@" >> /etc/zfcp.conf
    )
done

zfcp_cio_free
  070701000001B4000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003500000000dracut-055+suse.347.gdcb9bdbf/modules.d/95zfcp_rules  070701000001B5000081ED00000000000000000000000164DF2CB800000897000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/95zfcp_rules/module-setup.sh  #!/bin/bash

# called by dracut
cmdline() {
    is_zfcp() {
        local _dev=$1
        local _devpath
        _devpath=$(
            cd -P /sys/dev/block/"$_dev" || exit
            echo "$PWD"
        )
        local _sdev _scsiid _hostno _lun _wwpn _ccw _port_type
        local _allow_lun_scan _is_npiv

        _allow_lun_scan=$(cat /sys/module/zfcp/parameters/allow_lun_scan)
        [ "${_devpath#*/sd}" == "$_devpath" ] && return 1
        _sdev="${_devpath%%/block/*}"
        [ -e "${_sdev}"/fcp_lun ] || return 1
        _scsiid="${_sdev##*/}"
        _hostno="${_scsiid%%:*}"
        [ -d /sys/class/fc_host/host"${_hostno}" ] || return 1
        _port_type=$(cat /sys/class/fc_host/host"${_hostno}"/port_type)
        case "$_port_type" in
            NPIV*)
                _is_npiv=1
                ;;
        esac
        _ccw=$(cat "${_sdev}"/hba_id)
        if [ "$_is_npiv" ] && [ "$_allow_lun_scan" = "Y" ]; then
            echo "rd.zfcp=${_ccw}"
        else
            _lun=$(cat "${_sdev}"/fcp_lun)
            _wwpn=$(cat "${_sdev}"/wwpn)
            echo "rd.zfcp=${_ccw},${_wwpn},${_lun}"
        fi
        return 0
    }
    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for_each_host_dev_and_slaves_all is_zfcp
    } | sort | uniq
}

# called by dracut
check() {
    local _arch=${DRACUT_ARCH:-$(uname -m)}
    local _ccw
    [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        found=0
        for _ccw in /sys/bus/ccw/devices/*/host*; do
            [ -d "$_ccw" ] || continue
            found=$((found + 1))
        done
        [ $found -eq 0 ] && return 255
    }
    return 0
}

# called by dracut
depends() {
    echo bash
    return 0
}

# called by dracut
install() {
    inst_multiple -o /usr/lib/udev/collect
    inst_hook cmdline 30 "$moddir/parse-zfcp.sh"
    if [[ $hostonly_cmdline == "yes" ]]; then
        local _zfcp

        for _zfcp in $(cmdline); do
            printf "%s\n" "$_zfcp" >> "${initdir}/etc/cmdline.d/94zfcp.conf"
        done
    fi
    if [[ $hostonly ]]; then
        inst_rules_wildcard "51-zfcp-*.rules"
        inst_rules_wildcard "41-zfcp-*.rules"
    fi
}
 070701000001B6000081ED00000000000000000000000164DF2CB80000076B000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/95zfcp_rules/parse-zfcp.sh    #!/bin/bash

create_udev_rule() {
    local ccw=$1
    local wwpn=$2
    local lun=$3
    local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules
    local _cu_type _dev_type

    if [ -x /sbin/cio_ignore ] && cio_ignore -i "$ccw" > /dev/null; then
        cio_ignore -r "$ccw"
    fi

    if [ -e /sys/bus/ccw/devices/"${ccw}" ]; then
        read -r _cu_type < /sys/bus/ccw/devices/"${ccw}"/cutype
        read -r _dev_type < /sys/bus/ccw/devices/"${ccw}"/devtype
    fi
    if [ "$_cu_type" != "1731/03" ]; then
        return 0
    fi
    if [ "$_dev_type" != "1732/03" ] && [ "$_dev_type" != "1732/04" ]; then
        return 0
    fi

    [ -z "$wwpn" ] || [ -z "$lun" ] && return
    m=$(sed -n "/.*${wwpn}.*${lun}.*/p" "$_rule")
    if [ -z "$m" ]; then
        cat >> "$_rule" << EOF
ACTION=="add", KERNEL=="rport-*", ATTR{port_name}=="$wwpn", SUBSYSTEMS=="ccw", KERNELS=="$ccw", ATTR{[ccw/$ccw]$wwpn/unit_add}="$lun"
EOF
    fi
}

if [[ -f /sys/firmware/ipl/ipl_type && \
    $(< /sys/firmware/ipl/ipl_type) == "fcp" ]]; then
    (
        _wwpn=$(cat /sys/firmware/ipl/wwpn)
        _lun=$(cat /sys/firmware/ipl/lun)
        _ccw=$(cat /sys/firmware/ipl/device)

        create_udev_rule "$_ccw" "$_wwpn" "$_lun"
    )
fi

for zfcp_arg in $(getargs rd.zfcp); do
    (
        OLDIFS="$IFS"
        IFS=","
        # shellcheck disable=SC2086
        set $zfcp_arg
        IFS="$OLDIFS"
        create_udev_rule "$1" "$2" "$3"
    )
done

for zfcp_arg in $(getargs root=) $(getargs resume=); do
    (
        case $zfcp_arg in
            /dev/disk/by-path/ccw-*)
                ccw_arg=${zfcp_arg##*/}
                ;;
        esac
        if [ -n "$ccw_arg" ]; then
            OLDIFS="$IFS"
            IFS="-"
            set -- "$ccw_arg"
            IFS="$OLDIFS"
            _wwpn=${4%:*}
            _lun=${4#*:}
            create_udev_rule "$2" "$wwpn" "$lun"
        fi
    )
done
 070701000001B7000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95znet    070701000001B8000081ED00000000000000000000000164DF2CB800000226000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95znet/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    arch=${DRACUT_ARCH:-$(uname -m)}
    [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1

    require_binaries znet_cio_free grep sed seq readlink || return 1

    return 0
}

# called by dracut
depends() {
    echo bash
    return 0
}

# called by dracut
installkernel() {
    instmods ctcm lcs qeth qeth_l2 qeth_l3
}

# called by dracut
install() {
    inst_hook cmdline 30 "$moddir/parse-ccw.sh"
    inst_rules 81-ccw.rules
    inst_multiple znet_cio_free grep sed seq readlink /lib/udev/ccw_init
}
  070701000001B9000081ED00000000000000000000000164DF2CB800000370000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/95znet/parse-ccw.sh   #!/bin/bash

for ccw_arg in $(getargs rd.ccw -d 'rd_CCW=') $(getargs rd.znet -d 'rd_ZNET='); do
    echo "$ccw_arg" >> /etc/ccw.conf
done

for ifname in $(getargs rd.znet_ifname); do
    IFS=: read -r ifname_if ifname_subchannels _rest <<< "$ifname"
    if [ -z "$ifname_if" ] || [ -z "$ifname_subchannels" ] || [ -n "$_rest" ]; then
        warn "Invalid arguments for rd.znet_ifname="
    else
        {
            ifname_subchannels=${ifname_subchannels//,/|}

            echo 'ACTION!="add|change", GOTO="ccw_ifname_end"'
            echo 'ATTR{type}!="1", GOTO="ccw_ifname_end"'
            echo 'SUBSYSTEM!="net", GOTO="ccw_ifname_end"'
            echo "SUBSYSTEMS==\"ccwgroup\", KERNELS==\"$ifname_subchannels\", DRIVERS==\"?*\" NAME=\"$ifname_if\""
            echo 'LABEL="ccw_ifname_end"'

        } > /etc/udev/rules.d/81-ccw-ifname.rules
    fi
done

znet_cio_free
070701000001BA000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003500000000dracut-055+suse.347.gdcb9bdbf/modules.d/96securityfs  070701000001BB000081ED00000000000000000000000164DF2CB8000000BD000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/96securityfs/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    inst_hook cmdline 60 "$moddir/securityfs.sh"
}
   070701000001BC000081ED00000000000000000000000164DF2CB8000000DC000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/96securityfs/securityfs.sh    #!/bin/sh

SECURITYFSDIR="/sys/kernel/security"
export SECURITYFSDIR

if ! findmnt "${SECURITYFSDIR}" > /dev/null 2>&1; then
    mount -t securityfs -o nosuid,noexec,nodev securityfs ${SECURITYFSDIR} > /dev/null 2>&1
fi
070701000001BD000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003600000000dracut-055+suse.347.gdcb9bdbf/modules.d/97biosdevname 070701000001BE000081ED00000000000000000000000164DF2CB80000011E000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/modules.d/97biosdevname/module-setup.sh #!/bin/bash

# called by dracut
check() {
    [[ "$mount_needs" ]] && return 1
    require_binaries biosdevname || return 1
    return 0
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    inst_multiple biosdevname
    inst_rules 71-biosdevname.rules
}
  070701000001BF000081ED00000000000000000000000164DF2CB800000134000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/97biosdevname/parse-biosdevname.sh    #!/bin/sh

if ! getargbool 1 biosdevname; then
    info "biosdevname=0: removing biosdevname network renaming"
    udevproperty UDEV_BIOSDEVNAME=
    rm -f -- /etc/udev/rules.d/71-biosdevname.rules
else
    info "biosdevname=1: activating biosdevname network renaming"
    udevproperty UDEV_BIOSDEVNAME=1
fi
070701000001C0000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/modules.d/97masterkey   070701000001C1000081A400000000000000000000000164DF2CB800000DA9000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/97masterkey/README    # Directions for creating the kernel master key that will be used for
# encrypting/decrypting other keys.

# A trusted key is a TPM random number, which is only ever exposed to
# userspace as an encrypted datablob. A trusted key can be sealed to a
# set of PCR values. For more details on trusted keys, refer to the
# kernel keys-trusted-encrypted.txt documentation.
$ keyctl add trusted kmk-trusted "new 32" @u
801713097

# For those systems which don't have a TPM, but want to experiment with
# encrypted keys, create a user key of 32 random bytes. Unlike
# trusted/encrypted keys, user type key data is visible to userspace.
$ keyctl add user kmk-user "`dd if=/dev/urandom bs=1 count=32 2>/dev/null`" @u
144468621

# Save the kernel master key (trusted type):
$ su -c 'keyctl pipe `keyctl search @u trusted kmk-trusted` > /etc/keys/kmk-trusted.blob'

# or (user type):
$ su -c 'keyctl pipe `keyctl search @u user kmk-user` > /etc/keys/kmk-user.blob'

# A useful feature of trusted keys is that it is possible to prevent their
# unsealing at later time by providing the parameter 'pcrlock=<pcrnum>' when
# loading it, which causes the PCR #<pcrnum> to be extended with a random value.
# Actually, the <pcrnum> variable is set to '11' to let users experiment with
# this feature by using a register that is never extended during the boot,
# making the re-sealing not necessary. In the future, the kernel master key will
# be sealed to the PCR #14 which is extended, according to the TrustedGRUB
# documentation[1], to the measure of the kernel and the initial ramdisk.

# The kernel master key path name and type can be set in one of the following
# ways (specified in the order in which variables are overwritten):

1) use default values:
--------------------------------------------------------------------------
MULTIKERNELMODE="NO"
MASTERKEYTYPE="trusted"
MASTERKEY="/etc/keys/kmk-${MASTERKEYTYPE}.blob"
--------------------------------------------------------------------------

2) create the configuration file '/etc/sysconfig/masterkey' to override the
value of one or all variables;

3) specify these parameters in the kernel command line:
- masterkey=</kernel/master/key/path>, to override the MASTERKEY variable;
- masterkeytype=<kernel-master-key-type>, to override the MASTERKEYTYPE variable.

# The variable MULTIKERNELMODE has been introduced to support multi boot
# configurations, where a trusted/user key is tied to a specific kernel and
# initial ramdisk. In this case, setting MULTIKERNELMODE to 'YES' will cause the
# kernel version to be added to the default masterkey path name, so that the
# MASTERKEY variable should not be overridden each time a different kernel is
# chosen. The default value of MASTERKEY will be equal to:
--------------------------------------------------------------------------
MASTERKEY="/etc/keys/kmk-${MASTERKEYTYPE}-$(uname -r).blob"
--------------------------------------------------------------------------

# The masterkey path name also depends on the value of MASTERKEYTYPE, as reported
# in the default values for defined variables. For example, if only MASTERKEYTYPE
# is overridden by setting it to 'user' in the configuration file or from the
# kernel command line, the value of MASTERKEY will be:
--------------------------------------------------------------------------
MASTERKEY="/etc/keys/kmk-user.blob"
--------------------------------------------------------------------------


[1] https://projects.sirrix.com/trac/trustedgrub/
   070701000001C2000081ED00000000000000000000000164DF2CB800000871000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/97masterkey/masterkey.sh  #!/bin/sh

# Licensed under the GPLv2
#
# Copyright (C) 2011 Politecnico di Torino, Italy
#                    TORSEC group -- http://security.polito.it
# Roberto Sassu <roberto.sassu@polito.it>

MASTERKEYSCONFIG="${NEWROOT}/etc/sysconfig/masterkey"
MULTIKERNELMODE="NO"
PCRLOCKNUM=11

load_masterkey() {
    # read the configuration from the config file
    # shellcheck disable=SC1090
    [ -f "${MASTERKEYSCONFIG}" ] \
        && . "${MASTERKEYSCONFIG}"

    # override the kernel master key path name from the 'masterkey=' parameter
    # in the kernel command line
    MASTERKEYARG=$(getarg masterkey=) && MASTERKEY=${MASTERKEYARG}

    # override the kernel master key type from the 'masterkeytype=' parameter
    # in the kernel command line
    MASTERKEYTYPEARG=$(getarg masterkeytype=) && MASTERKEYTYPE=${MASTERKEYTYPEARG}

    # set default values
    [ -z "${MASTERKEYTYPE}" ] \
        && MASTERKEYTYPE="trusted"

    if [ -z "${MASTERKEY}" ]; then
        # append the kernel version to the default masterkey path name
        # if MULTIKERNELMODE is set to YES
        if [ "${MULTIKERNELMODE}" = "YES" ]; then
            MASTERKEY="/etc/keys/kmk-${MASTERKEYTYPE}-$(uname -r).blob"
        else
            MASTERKEY="/etc/keys/kmk-${MASTERKEYTYPE}.blob"
        fi
    fi

    # set the kernel master key path name
    MASTERKEYPATH="${NEWROOT}${MASTERKEY}"

    # check for kernel master key's existence
    if [ ! -f "${MASTERKEYPATH}" ]; then
        if [ "${RD_DEBUG}" = "yes" ]; then
            info "masterkey: kernel master key file not found: ${MASTERKEYPATH}"
        fi
        return 1
    fi

    # read the kernel master key blob
    KEYBLOB=$(cat "${MASTERKEYPATH}")

    # add the 'load' prefix if the key type is 'trusted'
    [ "${MASTERKEYTYPE}" = "trusted" ] \
        && KEYBLOB="load ${KEYBLOB} pcrlock=${PCRLOCKNUM}"

    # load the kernel master key
    info "Loading the kernel master key"
    keyctl add "${MASTERKEYTYPE}" "kmk-${MASTERKEYTYPE}" "${KEYBLOB}" @u > /dev/null || {
        info "masterkey: failed to load the kernel master key: kmk-${MASTERKEYTYPE}"
        return 1
    }

    return 0
}

load_masterkey
   070701000001C3000081ED00000000000000000000000164DF2CB800000176000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/97masterkey/module-setup.sh   #!/bin/bash

# called by dracut
check() {
    [[ $hostonly ]] && {
        require_binaries keyctl uname || return 1
    }

    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
installkernel() {
    instmods trusted encrypted
}

# called by dracut
install() {
    inst_multiple keyctl uname
    inst_hook pre-pivot 60 "$moddir/masterkey.sh"
}
  070701000001C4000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd  070701000001C5000081A400000000000000000000000164DF2CB80000034D000000000000000000000000000000000000005400000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-cmdline-ask.service   #  This file is part of dracut.
#
# See dracut.bootup(7) for details

[Unit]
Description=dracut ask for additional cmdline parameters
DefaultDependencies=no
Before=dracut-cmdline.service
Wants=systemd-journald.socket
After=systemd-journald.socket
Wants=systemd-vconsole-setup.service
After=systemd-vconsole-setup.service

ConditionPathExists=/usr/lib/initrd-release
ConditionKernelCommandLine=|rd.cmdline=ask
ConditionPathExistsGlob=|/etc/cmdline.d/*.conf
Conflicts=shutdown.target emergency.target

[Service]
Environment=DRACUT_SYSTEMD=1
Environment=NEWROOT=/sysroot
Type=oneshot
ExecStart=-/bin/dracut-cmdline-ask
StandardInput=tty
StandardOutput=inherit
StandardError=inherit
RemainAfterExit=yes
KillMode=process
IgnoreSIGPIPE=no

# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
KillSignal=SIGHUP
   070701000001C6000081ED00000000000000000000000164DF2CB8000001AB000000000000000000000000000000000000004F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-cmdline-ask.sh    #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

getarg "rd.cmdline=ask" || exit 0

sleep 0.5
echo
sleep 0.5
echo
sleep 0.5
echo
echo
echo
echo
echo "Enter additional kernel command line parameter (end with ctrl-d or .)"
while read -r -p "> " ${BASH:+-e} line || [ -n "$line" ]; do
    [ "$line" = "." ] && break
    [ -n "$line" ] && printf -- "%s\n" "$line" >> /etc/cmdline.d/99-cmdline-ask.conf
done

exit 0
 070701000001C7000081A400000000000000000000000164DF2CB800000373000000000000000000000000000000000000005000000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-cmdline.service   #  This file is part of dracut.
#
# See dracut.bootup(7) for details

[Unit]
Description=dracut cmdline hook
Documentation=man:dracut-cmdline.service(8)
DefaultDependencies=no
Before=dracut-pre-udev.service
After=systemd-journald.socket
Wants=systemd-journald.socket
ConditionPathExists=/usr/lib/initrd-release
ConditionPathExistsGlob=|/etc/cmdline.d/*.conf
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/cmdline
ConditionKernelCommandLine=|rd.break=cmdline
ConditionKernelCommandLine=|resume
ConditionKernelCommandLine=|noresume
Conflicts=shutdown.target emergency.target

[Service]
Environment=DRACUT_SYSTEMD=1
Environment=NEWROOT=/sysroot
Type=oneshot
ExecStart=-/bin/dracut-cmdline
StandardInput=null
StandardError=journal+console
KillMode=process
RemainAfterExit=yes

# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
KillSignal=SIGHUP
 070701000001C8000081A400000000000000000000000164DF2CB8000001BA000000000000000000000000000000000000005600000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-cmdline.service.8.asc DRACUT-CMDLINE.SERVICE(8)
=========================
:doctype: manpage
:man source:   dracut
:man manual:   dracut

NAME
----
dracut-cmdline.service - runs the dracut hooks to parse the kernel command line

SYNOPSIS
--------
dracut-cmdline.service

DESCRIPTION
-----------
This service runs all the dracut hooks to parse the kernel command line in
the initramfs.

AUTHORS
-------
Harald Hoyer

SEE ALSO
--------
*dracut.bootup*(7) *dracut*(8)
  070701000001C9000081ED00000000000000000000000164DF2CB8000008C6000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-cmdline.sh    #!/bin/sh

if [ -f /dracut-state.sh ]; then
    . /dracut-state.sh 2> /dev/null
fi
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

[ -f /usr/lib/initrd-release ] && . /usr/lib/initrd-release
[ -n "$VERSION" ] && info "dracut-$VERSION"

if ! getargbool 1 'rd.hostonly'; then
    [ -f /etc/cmdline.d/99-cmdline-ask.conf ] && mv /etc/cmdline.d/99-cmdline-ask.conf /tmp/99-cmdline-ask.conf
    remove_hostonly_files
    [ -f /tmp/99-cmdline-ask.conf ] && mv /tmp/99-cmdline-ask.conf /etc/cmdline.d/99-cmdline-ask.conf
fi

info "Using kernel command line parameters:" "$(getcmdline)"

getargbool 0 rd.udev.log-priority=info -d rd.udev.info -d -n -y rdudevinfo && echo 'udev_log="info"' >> /etc/udev/udev.conf
getargbool 0 rd.udev.log-priority=debug -d rd.udev.debug -d -n -y rdudevdebug && echo 'udev_log="debug"' >> /etc/udev/udev.conf

source_conf /etc/conf.d

# Get the "root=" parameter from the kernel command line, but differentiate
# between the case where it was set to the empty string and the case where it
# wasn't specified at all.
if ! root="$(getarg root=)"; then
    root_unset='UNSET'
fi

rflags="$(getarg rootflags=)"
getargbool 0 ro && rflags="${rflags},ro"
getargbool 0 rw && rflags="${rflags},rw"
rflags="${rflags#,}"

fstype="$(getarg rootfstype=)"
if [ -z "$fstype" ]; then
    fstype="auto"
fi

export root
export rflags
export fstype

make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab'
# run scriptlets to parse the command line
getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
source_hook cmdline

[ -f /lib/dracut/parse-resume.sh ] && . /lib/dracut/parse-resume.sh

case "${root#block:}${root_unset}" in
    LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
        root="block:$(label_uuid_to_dev "${root#block:}")"
        rootok=1
        ;;
    /dev/*)
        root="block:${root#block:}"
        rootok=1
        ;;
    UNSET | gpt-auto | tmpfs)
        # systemd's gpt-auto-generator/fstab-generator handles this case.
        rootok=1
        ;;
esac

[ -z "${root}${root_unset}" ] && die "Empty root= argument"
[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"

export root rflags fstype netroot NEWROOT

export -p > /dracut-state.sh

exit 0
  070701000001CA000081A400000000000000000000000164DF2CB8000002A9000000000000000000000000000000000000005200000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-emergency.service #  This file is part of dracut.
#
# See dracut.bootup(7) for details

[Unit]
Description=Dracut Emergency Shell
DefaultDependencies=no
After=systemd-vconsole-setup.service
Wants=systemd-vconsole-setup.service
Conflicts=shutdown.target emergency.target

[Service]
Environment=HOME=/
Environment=DRACUT_SYSTEMD=1
Environment=NEWROOT=/sysroot
WorkingDirectory=/
ExecStart=-/bin/dracut-emergency
ExecStopPost=-/bin/rm -f -- /.console_lock
Type=oneshot
StandardInput=tty-force
StandardOutput=inherit
StandardError=inherit
KillMode=process
IgnoreSIGPIPE=no
TasksMax=infinity

# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
KillSignal=SIGHUP
   070701000001CB000081ED00000000000000000000000164DF2CB800000664000000000000000000000000000000000000004D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-emergency.sh  #!/bin/sh

export DRACUT_SYSTEMD=1
if [ -f /dracut-state.sh ]; then
    . /dracut-state.sh 2> /dev/null
fi
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

source_conf /etc/conf.d

type plymouth > /dev/null 2>&1 && plymouth quit

export _rdshell_name="dracut" action="Boot" hook="emergency"
_emergency_action=$(getarg rd.emergency)

if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
    FSTXT="/run/dracut/fsck/fsck_help_$fstype.txt"
    RDSOSREPORT="$(rdsosreport)"
    source_hook "$hook"
    while read -r _tty rest; do
        (
            echo
            echo "$RDSOSREPORT"
            echo
            echo
            echo 'Entering emergency mode. Exit the shell to continue.'
            echo 'Type "journalctl" to view system logs.'
            echo 'You might want to save "/run/initramfs/rdsosreport.txt" to a USB stick or /boot'
            echo 'after mounting them and attach it to a bug report.'
            echo
            echo
            [ -f "$FSTXT" ] && cat "$FSTXT"
        ) > /dev/"$_tty"
    done < /proc/consoles
    [ -f /etc/profile ] && . /etc/profile
    [ -z "$PS1" ] && export PS1="$_name:\${PWD}# "
    exec sulogin -e
else
    export hook="shutdown-emergency"
    warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line."
    source_hook "$hook"
    [ -z "$_emergency_action" ] && _emergency_action=halt
fi

/bin/rm -f -- /.console_lock

case "$_emergency_action" in
    reboot)
        reboot || exit 1
        ;;
    poweroff)
        poweroff || exit 1
        ;;
    halt)
        halt || exit 1
        ;;
esac

exit 0
070701000001CC000081A400000000000000000000000164DF2CB800000320000000000000000000000000000000000000005200000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-initqueue.service #  This file is part of dracut.
#
# See dracut.bootup(7) for details

[Unit]
Description=dracut initqueue hook
Documentation=man:dracut-initqueue.service(8)
DefaultDependencies=no
Before=remote-fs-pre.target
Wants=remote-fs-pre.target
After=systemd-udev-trigger.service
Wants=systemd-udev-trigger.service
ConditionPathExists=/usr/lib/initrd-release
ConditionPathExists=|/lib/dracut/need-initqueue
ConditionKernelCommandLine=|rd.break=initqueue
Conflicts=shutdown.target emergency.target

[Service]
Environment=DRACUT_SYSTEMD=1
Environment=NEWROOT=/sysroot
Type=oneshot
ExecStart=-/bin/dracut-initqueue
StandardInput=null
StandardError=journal+console
KillMode=process
RemainAfterExit=yes

# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
KillSignal=SIGHUP
070701000001CD000081A400000000000000000000000164DF2CB8000001B7000000000000000000000000000000000000005800000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-initqueue.service.8.asc   DRACUT-INITQUEUE.SERVICE(8)
===========================
:doctype: manpage
:man source:   dracut
:man manual:   dracut

NAME
----
dracut-initqueue.service - runs the dracut main loop to find the real root

SYNOPSIS
--------
dracut-initqueue.service

DESCRIPTION
-----------
This service runs all the main loop of dracut in the initramfs to find the real root.

AUTHORS
-------
Harald Hoyer

SEE ALSO
--------
*dracut.bootup*(7) *dracut*(8)
 070701000001CE000081ED00000000000000000000000164DF2CB800000A72000000000000000000000000000000000000004D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-initqueue.sh  #!/bin/sh

export DRACUT_SYSTEMD=1
if [ -f /dracut-state.sh ]; then
    . /dracut-state.sh 2> /dev/null
fi
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

source_conf /etc/conf.d

make_trace_mem "hook initqueue" '1:shortmem' '2+:mem' '3+:slab'
getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"

RDRETRY=$(getarg rd.retry -d 'rd_retry=')
RDRETRY=${RDRETRY:-180}
RDRETRY=$((RDRETRY * 2))
export RDRETRY

main_loop=0
export main_loop

while :; do

    check_finished && break

    udevadm settle --exit-if-exists="$hookdir"/initqueue/work

    check_finished && break

    if [ -f "$hookdir"/initqueue/work ]; then
        rm -f -- "$hookdir/initqueue/work"
    fi

    for job in "$hookdir"/initqueue/*.sh; do
        [ -e "$job" ] || break
        # shellcheck disable=SC2097 disable=SC1090 disable=SC2098
        job=$job . "$job"
        check_finished && break 2
    done

    udevadm settle --timeout=0 > /dev/null 2>&1 || continue

    for job in "$hookdir"/initqueue/settled/*.sh; do
        [ -e "$job" ] || break
        # shellcheck disable=SC2097 disable=SC1090 disable=SC2098
        job=$job . "$job"
        check_finished && break 2
    done

    udevadm settle --timeout=0 > /dev/null 2>&1 || continue

    # no more udev jobs and queues empty.
    sleep 0.5

    for i in /run/systemd/ask-password/ask.*; do
        [ -e "$i" ] && continue 2
    done

    if [ $main_loop -gt $((2 * RDRETRY / 3)) ]; then
        warn "dracut-initqueue: timeout, still waiting for following initqueue hooks:"
        for _f in "$hookdir"/initqueue/finished/*.sh; do
            warn "$_f: \"$(cat "$_f")\""
        done
        if [ "$(ls -A "$hookdir"/initqueue/finished)" ]; then
            warn "dracut-initqueue: starting timeout scripts"
            for job in "$hookdir"/initqueue/timeout/*.sh; do
                [ -e "$job" ] || break
                # shellcheck disable=SC2097 disable=SC1090 disable=SC2098
                job=$job . "$job"
                udevadm settle --timeout=0 > /dev/null 2>&1 || main_loop=0
                [ -f "$hookdir"/initqueue/work ] && main_loop=0
                [ $main_loop -eq 0 ] && break
            done
        fi
    fi

    main_loop=$((main_loop + 1))
    if [ $main_loop -gt $RDRETRY ]; then
        if ! [ -f /sysroot/etc/fstab ] || ! [ -e /sysroot/sbin/init ]; then
            emergency_shell "Could not boot."
        fi
        warn "Not all disks have been found."
        warn "You might want to regenerate your initramfs."
        break
    fi
done

unset job
unset queuetriggered
unset main_loop
unset RDRETRY

export -p > /dracut-state.sh

exit 0
  070701000001CF000081A400000000000000000000000164DF2CB800000304000000000000000000000000000000000000004E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-mount.service #  This file is part of dracut.
#
# See dracut.bootup(7) for details

[Unit]
Description=dracut mount hook
Documentation=man:dracut-mount.service(8)
After=initrd-root-fs.target initrd-parse-etc.service
After=dracut-initqueue.service dracut-pre-mount.service
ConditionPathExists=/usr/lib/initrd-release
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/mount
ConditionKernelCommandLine=|rd.break=mount
DefaultDependencies=no
Conflicts=shutdown.target emergency.target

[Service]
Environment=DRACUT_SYSTEMD=1
Environment=NEWROOT=/sysroot
Type=oneshot
ExecStart=-/bin/dracut-mount
StandardInput=null
StandardError=journal+console
KillMode=process
RemainAfterExit=yes

# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
KillSignal=SIGHUP
070701000001D0000081A400000000000000000000000164DF2CB8000001A0000000000000000000000000000000000000005400000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-mount.service.8.asc   DRACUT-MOUNT.SERVICE(8)
=======================
:doctype: manpage
:man source:   dracut
:man manual:   dracut

NAME
----
dracut-mount.service - runs the dracut hooks after /sysroot is mounted

SYNOPSIS
--------
dracut-mount.service

DESCRIPTION
-----------
This service runs all dracut hooks after the real root is mounted on /sysroot.

AUTHORS
-------
Harald Hoyer

SEE ALSO
--------
*dracut.bootup*(7) *dracut*(8)
070701000001D1000081ED00000000000000000000000164DF2CB800000443000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-mount.sh  #!/bin/sh
export DRACUT_SYSTEMD=1
if [ -f /dracut-state.sh ]; then
    . /dracut-state.sh 2> /dev/null
fi
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

source_conf /etc/conf.d

make_trace_mem "hook mount" '1:shortmem' '2+:mem' '3+:slab'

getarg 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break mount"
# mount scripts actually try to mount the root filesystem, and may
# be sourced any number of times. As soon as one suceeds, no more are sourced.
i=0
while :; do
    if ismounted "$NEWROOT"; then
        usable_root "$NEWROOT" && break
        umount "$NEWROOT"
    fi
    for f in "$hookdir"/mount/*.sh; do
        # shellcheck disable=SC1090
        [ -f "$f" ] && . "$f"
        if ismounted "$NEWROOT"; then
            usable_root "$NEWROOT" && break
            warn "$NEWROOT has no proper rootfs layout, ignoring and removing offending mount hook"
            umount "$NEWROOT"
            rm -f -- "$f"
        fi
    done

    i=$((i + 1))
    [ $i -gt 20 ] && emergency_shell "Can't mount root filesystem"
done

export -p > /dracut-state.sh

exit 0
 070701000001D2000081A400000000000000000000000164DF2CB800000321000000000000000000000000000000000000005200000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-pre-mount.service #  This file is part of dracut.
#
# See dracut.bootup(7) for details

[Unit]
Description=dracut pre-mount hook
Documentation=man:dracut-pre-mount.service(8)
DefaultDependencies=no
Before=initrd-root-fs.target sysroot.mount systemd-fsck-root.service
After=dracut-initqueue.service cryptsetup.target
ConditionPathExists=/usr/lib/initrd-release
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-mount
ConditionKernelCommandLine=|rd.break=pre-mount
Conflicts=shutdown.target emergency.target

[Service]
Environment=DRACUT_SYSTEMD=1
Environment=NEWROOT=/sysroot
Type=oneshot
ExecStart=-/bin/dracut-pre-mount
StandardInput=null
StandardError=journal+console
KillMode=process
RemainAfterExit=yes

# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
KillSignal=SIGHUP
   070701000001D3000081A400000000000000000000000164DF2CB8000001B2000000000000000000000000000000000000005800000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-pre-mount.service.8.asc   DRACUT-PRE-MOUNT.SERVICE(8)
===========================
:doctype: manpage
:man source:   dracut
:man manual:   dracut

NAME
----
dracut-pre-mount.service - runs the dracut hooks before /sysroot is mounted

SYNOPSIS
--------
dracut-pre-mount.service

DESCRIPTION
-----------
This service runs all dracut hooks before the real root is mounted on /sysroot.

AUTHORS
-------
Harald Hoyer

SEE ALSO
--------
*dracut.bootup*(7) *dracut*(8)
  070701000001D4000081ED00000000000000000000000164DF2CB8000001F8000000000000000000000000000000000000004D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-pre-mount.sh  #!/bin/sh

export DRACUT_SYSTEMD=1
if [ -f /dracut-state.sh ]; then
    . /dracut-state.sh 2> /dev/null
fi
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

source_conf /etc/conf.d

make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab'
# pre pivot scripts are sourced just before we doing cleanup and switch over
# to the new root.
getarg 'rd.break=pre-mount' 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
source_hook pre-mount

export -p > /dracut-state.sh

exit 0
070701000001D5000081A400000000000000000000000164DF2CB800000463000000000000000000000000000000000000005200000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-pre-pivot.service #  This file is part of dracut.
#
# See dracut.bootup(7) for details

[Unit]
Description=dracut pre-pivot and cleanup hook
Documentation=man:dracut-pre-pivot.service(8)
DefaultDependencies=no
After=initrd.target initrd-parse-etc.service sysroot.mount
After=dracut-initqueue.service dracut-pre-mount.service dracut-mount.service
Before=initrd-cleanup.service
Wants=remote-fs.target
After=remote-fs.target
ConditionPathExists=/usr/lib/initrd-release
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-pivot
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/cleanup
ConditionKernelCommandLine=|rd.break=pre-pivot
ConditionKernelCommandLine=|rd.break=cleanup
ConditionKernelCommandLine=|rd.break
ConditionPathExists=|/dev/root
ConditionPathExists=|/dev/nfs
Conflicts=shutdown.target emergency.target

[Service]
Environment=DRACUT_SYSTEMD=1
Environment=NEWROOT=/sysroot
Type=oneshot
ExecStart=-/bin/dracut-pre-pivot
StandardInput=null
StandardError=journal+console
KillMode=process
RemainAfterExit=yes
KeyringMode=shared

# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
KillSignal=SIGHUP
 070701000001D6000081A400000000000000000000000164DF2CB8000001AD000000000000000000000000000000000000005800000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-pre-pivot.service.8.asc   DRACUT-PRE-PIVOT.SERVICE(8)
===========================
:doctype: manpage
:man source:   dracut
:man manual:   dracut

NAME
----
dracut-pre-pivot.service - runs the dracut hooks before switching root

SYNOPSIS
--------
dracut-pre-pivot.service

DESCRIPTION
-----------
This service runs all dracut hooks before the system switched to the real root.

AUTHORS
-------
Harald Hoyer

SEE ALSO
--------
*dracut.bootup*(7) *dracut*(8)
   070701000001D7000081ED00000000000000000000000164DF2CB800000383000000000000000000000000000000000000004D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-pre-pivot.sh  #!/bin/sh

export DRACUT_SYSTEMD=1
if [ -f /dracut-state.sh ]; then
    . /dracut-state.sh 2> /dev/null
fi
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

source_conf /etc/conf.d

make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab'
# pre pivot scripts are sourced just before we doing cleanup and switch over
# to the new root.
getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot"
source_hook pre-pivot

# pre pivot cleanup scripts are sourced just before we switch over to the new root.
getarg 'rd.break=cleanup' 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup"
source_hook cleanup

_bv=$(getarg rd.break -d rdbreak) && [ -z "$_bv" ] \
    && emergency_shell -n switch_root "Break before switch_root"
unset _bv

# remove helper symlink
[ -h /dev/root ] && rm -f -- /dev/root
[ -h /dev/nfs ] && rm -f -- /dev/nfs

exit 0
 070701000001D8000081A400000000000000000000000164DF2CB80000037D000000000000000000000000000000000000005400000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-pre-trigger.service   #  This file is part of dracut.
#
# See dracut.bootup(7) for details

[Unit]
Description=dracut pre-trigger hook
Documentation=man:dracut-pre-trigger.service(8)
DefaultDependencies=no
Before=systemd-udev-trigger.service dracut-initqueue.service
After=dracut-pre-udev.service systemd-udevd.service systemd-tmpfiles-setup-dev.service
Wants=dracut-pre-udev.service systemd-udevd.service
ConditionPathExists=/usr/lib/initrd-release
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-trigger
ConditionKernelCommandLine=|rd.break=pre-trigger
Conflicts=shutdown.target emergency.target

[Service]
Environment=DRACUT_SYSTEMD=1
Environment=NEWROOT=/sysroot
Type=oneshot
ExecStart=-/bin/dracut-pre-trigger
StandardInput=null
StandardError=journal+console
KillMode=process
RemainAfterExit=yes

# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
KillSignal=SIGHUP
   070701000001D9000081A400000000000000000000000164DF2CB8000001B8000000000000000000000000000000000000005A00000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-pre-trigger.service.8.asc DRACUT-PRE-TRIGGER.SERVICE(8)
=============================
:doctype: manpage
:man source:   dracut
:man manual:   dracut

NAME
----
dracut-pre-trigger.service - runs the dracut hooks before udevd is triggered

SYNOPSIS
--------
dracut-pre-trigger.service

DESCRIPTION
-----------
This service runs all dracut hooks before udevd is triggered in the initramfs.

AUTHORS
-------
Harald Hoyer

SEE ALSO
--------
*dracut.bootup*(7) *dracut*(8)
070701000001DA000081ED00000000000000000000000164DF2CB8000001D6000000000000000000000000000000000000004F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-pre-trigger.sh    #!/bin/sh

export DRACUT_SYSTEMD=1
if [ -f /dracut-state.sh ]; then
    . /dracut-state.sh 2> /dev/null
fi
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

source_conf /etc/conf.d

make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab'

source_hook pre-trigger

getarg 'rd.break=pre-trigger' 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break pre-trigger"

udevadm control --reload > /dev/null 2>&1 || :

export -p > /dracut-state.sh

exit 0
  070701000001DB000081A400000000000000000000000164DF2CB8000003CC000000000000000000000000000000000000005100000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-pre-udev.service  #  This file is part of dracut.
#
# See dracut.bootup(7) for details

[Unit]
Description=dracut pre-udev hook
Documentation=man:dracut-pre-udev.service(8)
DefaultDependencies=no
Before=systemd-udevd.service dracut-pre-trigger.service
After=dracut-cmdline.service
Wants=dracut-cmdline.service
ConditionPathExists=/usr/lib/initrd-release
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-udev
ConditionKernelCommandLine=|rd.break=pre-udev
ConditionKernelCommandLine=|rd.driver.blacklist
ConditionKernelCommandLine=|rd.driver.pre
ConditionKernelCommandLine=|rd.driver.post
ConditionPathExistsGlob=|/etc/cmdline.d/*.conf
Conflicts=shutdown.target emergency.target

[Service]
Environment=DRACUT_SYSTEMD=1
Environment=NEWROOT=/sysroot
Type=oneshot
ExecStart=-/bin/dracut-pre-udev
StandardInput=null
StandardError=journal+console
KillMode=process
RemainAfterExit=yes

# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
KillSignal=SIGHUP
070701000001DC000081A400000000000000000000000164DF2CB8000001A8000000000000000000000000000000000000005700000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-pre-udev.service.8.asc    DRACUT-PRE-UDEV.SERVICE(8)
==========================
:doctype: manpage
:man source:   dracut
:man manual:   dracut

NAME
----
dracut-pre-udev.service - runs the dracut hooks before udevd is started

SYNOPSIS
--------
dracut-pre-udev.service

DESCRIPTION
-----------
This service runs all dracut hooks before udevd is started in the initramfs.

AUTHORS
-------
Harald Hoyer

SEE ALSO
--------
*dracut.bootup*(7) *dracut*(8)
070701000001DD000081ED00000000000000000000000164DF2CB800000583000000000000000000000000000000000000004C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-pre-udev.sh   #!/bin/sh
export DRACUT_SYSTEMD=1
if [ -f /dracut-state.sh ]; then
    . /dracut-state.sh 2> /dev/null
fi
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

source_conf /etc/conf.d

make_trace_mem "hook pre-udev" '1:shortmem' '2+:mem' '3+:slab'
# pre pivot scripts are sourced just before we doing cleanup and switch over
# to the new root.
getarg 'rd.break=pre-udev' 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break pre-udev"
source_hook pre-udev

_modprobe_d=/etc/modprobe.d
if [ -d /usr/lib/modprobe.d ]; then
    _modprobe_d=/usr/lib/modprobe.d
elif [ -d /lib/modprobe.d ]; then
    _modprobe_d=/lib/modprobe.d
elif [ ! -d $_modprobe_d ]; then
    mkdir -p $_modprobe_d
fi

for i in $(getargs rd.driver.pre -d rdloaddriver=); do
    (
        IFS=,
        for p in $i; do
            modprobe "$p" 2>&1 | vinfo
        done
    )
done

[ -d /etc/modprobe.d ] || mkdir -p /etc/modprobe.d

for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
    (
        IFS=,
        for p in $i; do
            echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
        done
    )
done

for p in $(getargs rd.driver.post -d rdinsmodpost=); do
    echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
    _do_insmodpost=1
done

[ -n "$_do_insmodpost" ] && initqueue --settled --unique --onetime insmodpost.sh
unset _do_insmodpost _modprobe_d
unset i

export -p > /dracut-state.sh
exit 0
 070701000001DE000081A400000000000000000000000164DF2CB8000001CB000000000000000000000000000000000000005100000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-shutdown.service  #  This file is part of dracut.
#
# See dracut.bootup(7) for details

[Unit]
Description=Restore /run/initramfs on shutdown
Documentation=man:dracut-shutdown.service(8)
After=local-fs.target boot.mount boot.automount
Wants=local-fs.target
Conflicts=shutdown.target umount.target
DefaultDependencies=no
ConditionPathExists=!/run/initramfs/bin/sh

[Service]
RemainAfterExit=yes
Type=oneshot
ExecStart=/bin/true
ExecStop=/usr/lib/dracut/dracut-initramfs-restore
 070701000001DF000081A400000000000000000000000164DF2CB80000069A000000000000000000000000000000000000005700000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-shutdown.service.8.asc    DRACUT-SHUTDOWN.SERVICE(8)
===========================
:doctype: manpage
:man source:   dracut
:man manual:   dracut

NAME
----
dracut-shutdown.service - unpack the initramfs to /run/initramfs

SYNOPSIS
--------
dracut-shutdown.service

DESCRIPTION
-----------
This service unpacks the initramfs image to /run/initramfs.
systemd pivots into /run/initramfs at shutdown, so the root filesystem
can be safely unmounted.

The following steps are executed during a shutdown:

* systemd switches to the shutdown.target
* systemd starts /lib/systemd/system/shutdown.target.wants/dracut-shutdown.service
* dracut-shutdown.service executes /usr/lib/dracut/dracut-initramfs-restore which unpacks the initramfs to /run/initramfs
* systemd finishes shutdown.target
* systemd kills all processes
* systemd tries to unmount everything and mounts the remaining read-only
* systemd checks, if there is a /run/initramfs/shutdown executable
* if yes, it does a pivot_root to /run/initramfs and executes ./shutdown. The old root is then mounted on /oldroot. /usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable.
* shutdown will try to umount every /oldroot mount and calls the various shutdown hooks from the dracut modules 

This ensures, that all devices are disassembled and unmounted cleanly.

To debug the shutdown process, you can get a shell in the shutdown procedure
by injecting "rd.break=pre-shutdown rd.shell" or "rd.break=shutdown rd.shell".
----
# mkdir -p /run/initramfs/etc/cmdline.d
# echo "rd.break=pre-shutdown rd.shell" > /run/initramfs/etc/cmdline.d/debug.conf
# touch /run/initramfs/.need_shutdown
----


AUTHORS
-------
Harald Hoyer

SEE ALSO
--------
*dracut*(8)
  070701000001E0000081A400000000000000000000000164DF2CB800000087000000000000000000000000000000000000004E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/dracut-tmpfiles.conf d /run/initramfs     0755 root root -
d /run/initramfs/log 0755 root root -
L /var/log           -    -    -    - ../run/initramfs/log
 070701000001E1000081A400000000000000000000000164DF2CB8000002B4000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/emergency.service    #  This file is part of dracut.
#
# See dracut.bootup(7) for details

[Unit]
Description=Emergency Shell
DefaultDependencies=no
After=systemd-vconsole-setup.service
Wants=systemd-vconsole-setup.service
Conflicts=shutdown.target
Before=shutdown.target

[Service]
Environment=HOME=/
Environment=DRACUT_SYSTEMD=1
Environment=NEWROOT=/sysroot
WorkingDirectory=/
ExecStart=/bin/dracut-emergency
ExecStopPost=-/usr/bin/systemctl --fail --no-block default
Type=idle
StandardInput=tty-force
StandardOutput=inherit
StandardError=inherit
KillMode=process
IgnoreSIGPIPE=no
TasksMax=infinity

# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
KillSignal=SIGHUP
070701000001E2000081ED00000000000000000000000164DF2CB800000746000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    [[ $mount_needs ]] && return 1

    return 0
}

# called by dracut
depends() {
    echo "systemd-initrd"
    return 0
}

installkernel() {
    return 0
}

# called by dracut
install() {
    inst_script "$moddir/dracut-emergency.sh" /bin/dracut-emergency
    inst_simple "$moddir/emergency.service" "${systemdsystemunitdir}"/emergency.service
    inst_simple "$moddir/dracut-emergency.service" "${systemdsystemunitdir}"/dracut-emergency.service
    inst_simple "$moddir/emergency.service" "${systemdsystemunitdir}"/rescue.service

    ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target"

    inst_script "$moddir/dracut-cmdline.sh" /bin/dracut-cmdline
    inst_script "$moddir/dracut-cmdline-ask.sh" /bin/dracut-cmdline-ask
    inst_script "$moddir/dracut-pre-udev.sh" /bin/dracut-pre-udev
    inst_script "$moddir/dracut-pre-trigger.sh" /bin/dracut-pre-trigger
    inst_script "$moddir/dracut-initqueue.sh" /bin/dracut-initqueue
    inst_script "$moddir/dracut-pre-mount.sh" /bin/dracut-pre-mount
    inst_script "$moddir/dracut-mount.sh" /bin/dracut-mount
    inst_script "$moddir/dracut-pre-pivot.sh" /bin/dracut-pre-pivot

    inst_script "$moddir/rootfs-generator.sh" "$systemdutildir"/system-generators/dracut-rootfs-generator

    for i in \
        dracut-cmdline.service \
        dracut-cmdline-ask.service \
        dracut-initqueue.service \
        dracut-mount.service \
        dracut-pre-mount.service \
        dracut-pre-pivot.service \
        dracut-pre-trigger.service \
        dracut-pre-udev.service; do
        inst_simple "$moddir/${i}" "$systemdsystemunitdir/${i}"
        $SYSTEMCTL -q --root "$initdir" add-wants initrd.target "$i"
    done

    inst_simple "$moddir/dracut-tmpfiles.conf" "$tmpfilesdir/dracut-tmpfiles.conf"

    inst_multiple sulogin
}
  070701000001E3000081ED00000000000000000000000164DF2CB800000E8A000000000000000000000000000000000000004D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/98dracut-systemd/rootfs-generator.sh  #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

generator_wait_for_dev() {
    local _name
    local _timeout

    _name="$(str_replace "$1" '/' '\x2f')"
    _timeout=$(getarg rd.timeout)
    _timeout=${_timeout:-0}

    if ! [ -e "$hookdir/initqueue/finished/devexists-${_name}.sh" ]; then

        # If a LUKS device needs unlocking via systemd in the initrd, assume
        # it's for the root device. In that case, don't block on it if it's
        # after remote-fs-pre.target since the initqueue is ordered before it so
        # it will never actually show up (think Tang-pinned rootfs).
        cat > "$hookdir/initqueue/finished/devexists-${_name}.sh" << EOF
if ! grep -q After=remote-fs-pre.target /run/systemd/generator/systemd-cryptsetup@*.service 2>/dev/null; then
    [ -e "$1" ]
fi
EOF
        {
            printf '[ -e "%s" ] || ' "$1"
            printf 'warn "\"%s\" does not exist"\n' "$1"
        } >> "$hookdir/emergency/80-${_name}.sh"
    fi

    _name=$(dev_unit_name "$1")
    if ! [ -L "$GENERATOR_DIR"/initrd.target.wants/"${_name}".device ]; then
        [ -d "$GENERATOR_DIR"/initrd.target.wants ] || mkdir -p "$GENERATOR_DIR"/initrd.target.wants
        ln -s ../"${_name}".device "$GENERATOR_DIR"/initrd.target.wants/"${_name}".device
    fi

    if ! [ -f "$GENERATOR_DIR"/"${_name}".device.d/timeout.conf ]; then
        mkdir -p "$GENERATOR_DIR"/"${_name}".device.d
        {
            echo "[Unit]"
            echo "JobTimeoutSec=$_timeout"
            echo "JobRunningTimeoutSec=$_timeout"
        } > "$GENERATOR_DIR"/"${_name}".device.d/timeout.conf
    fi
}

generator_mount_rootfs() {
    local _type=$2
    local _flags=$3
    local _name

    [ -z "$1" ] && return 0

    _name=$(dev_unit_name "$1")
    [ -d "$GENERATOR_DIR" ] || mkdir -p "$GENERATOR_DIR"
    if ! [ -f "$GENERATOR_DIR"/sysroot.mount ]; then
        {
            echo "[Unit]"
            echo "Before=initrd-root-fs.target"
            echo "Requires=systemd-fsck@${_name}.service"
            echo "After=systemd-fsck@${_name}.service"
            echo "[Mount]"
            echo "Where=/sysroot"
            echo "What=$1"
            echo "Options=${_flags}"
            echo "Type=${_type}"
        } > "$GENERATOR_DIR"/sysroot.mount
    fi
    if ! [ -L "$GENERATOR_DIR"/initrd-root-fs.target.requires/sysroot.mount ]; then
        [ -d "$GENERATOR_DIR"/initrd-root-fs.target.requires ] || mkdir -p "$GENERATOR_DIR"/initrd-root-fs.target.requires
        ln -s ../sysroot.mount "$GENERATOR_DIR"/initrd-root-fs.target.requires/sysroot.mount
    fi
}

generator_fsck_after_pre_mount() {
    local _name

    [ -z "$1" ] && return 0

    _name=$(dev_unit_name "$1")
    [ -d /run/systemd/generator/systemd-fsck@"${_name}".service.d ] || mkdir -p /run/systemd/generator/systemd-fsck@"${_name}".service.d
    if ! [ -f /run/systemd/generator/systemd-fsck@"${_name}".service.d/after-pre-mount.conf ]; then
        {
            echo "[Unit]"
            echo "After=dracut-pre-mount.service"
        } > /run/systemd/generator/systemd-fsck@"${_name}".service.d/after-pre-mount.conf
    fi

}

root=$(getarg root=)
case "${root#block:}" in
    LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
        root="block:$(label_uuid_to_dev "$root")"
        rootok=1
        ;;
    /dev/nfs) # ignore legacy /dev/nfs
        ;;
    /dev/*)
        root="block:${root}"
        rootok=1
        ;;
esac

GENERATOR_DIR="$1"

if [ "$rootok" = "1" ]; then
    generator_wait_for_dev "${root#block:}" "$RDRETRY"
    generator_fsck_after_pre_mount "${root#block:}"
    strstr "$(cat /proc/cmdline)" 'root=' || generator_mount_rootfs "${root#block:}" "$(getarg rootfstype=)" "$(getarg rootflags=)"
fi

exit 0
  070701000001E4000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003300000000dracut-055+suse.347.gdcb9bdbf/modules.d/98ecryptfs    070701000001E5000081A400000000000000000000000164DF2CB800000927000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/modules.d/98ecryptfs/README # Directions for creating the encrypted key that will be used to mount an
# eCryptfs filesystem

# Create the eCryptfs key (encrypted key type)
#
# The encrypted key type supports two formats: the 'default' format allows
# to generate a random symmetric key of the length specified, the 'ecryptfs'
# format generates an authentication token for the eCryptfs filesystem,
# which contains a randomly generated key. Two requirements for the latter
# format is that the key description must contain exactly 16 hexadecimal
# characters and that the encrypted key length must be equal to 64.
$ keyctl add encrypted 1000100010001000 "new ecryptfs trusted:kmk-trusted 64" @u
782117972

# Save the encrypted key
$ su -c 'keyctl pipe `keyctl search @u encrypted 1000100010001000` > /etc/keys/ecryptfs-trusted.blob'

# The eCryptfs key path name can be set in one of the following ways (specified in
# the order in which the variable is overwritten):

1) use the default value:
--------------------------------------------------------------------------
ECRYPTFSKEY="/etc/keys/ecryptfs-trusted.blob"
--------------------------------------------------------------------------

2) create the configuration file '/etc/sysconfig/ecryptfs' and set the ECRYPTFSKEY
variable;

3) specify the eCryptfs key path name in the 'ecryptfskey=' parameter of the kernel command
line.

# The configuration file '/etc/sysconfig/ecryptfs' is also used to specify
# more options for mounting the eCryptfs filesystem:

ECRYPTFSSRCDIR: existent directory in the lower root filesystem;
ECRYPTFSDSTDIR: mount point directory for the eCryptfs filesystem (the directory must be
                created in the root filesystem before rebooting the platform);
ECRYPTFS_EXTRA_MOUNT_OPTS: extra mount options for the eCryptfs filesystem (the 'ecryptfs_sig'
                           option is automatically added by the dracut script).

# Example of the configuration file:
----------- '/etc/sysconfig/ecryptfs' (with default values) -----------
ECRYPTFS_KEY="/etc/keys/ecryptfs-trusted.blob"
ECRYPTFSSRCDIR="/secret"
ECRYPTFSDSTDIR="${ECRYPTFSSRCDIR}"
ECRYPTFS_EXTRA_MOUNT_OPTS=""
-----------------------------------------------------------------------

# If the variable ECRYPTFSDSTDIR is not specified in the configuration file,
# its value will be equal to that of ECRYPTFSSRCDIR.
 070701000001E6000081ED00000000000000000000000164DF2CB800000AC8000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/98ecryptfs/ecryptfs-mount.sh  #!/bin/sh

# Licensed under the GPLv2
#
# Copyright (C) 2011 Politecnico di Torino, Italy
#                    TORSEC group -- http://security.polito.it
# Roberto Sassu <roberto.sassu@polito.it>

ECRYPTFSCONFIG="${NEWROOT}/etc/sysconfig/ecryptfs"
ECRYPTFSKEYTYPE="encrypted"
ECRYPTFSKEYDESC="1000100010001000"
ECRYPTFSKEYID=""
ECRYPTFSSRCDIR="/secret"
ECRYPTFS_EXTRA_MOUNT_OPTS=""

load_ecryptfs_key() {
    # override the eCryptfs key path name from the 'ecryptfskey=' parameter in the kernel
    # command line
    if ECRYPTFSKEYARG=$(getarg ecryptfskey=); then
        ECRYPTFSKEY=${ECRYPTFSKEYARG}
    fi

    # set the default value
    [ -z "${ECRYPTFSKEY}" ] \
        && ECRYPTFSKEY="/etc/keys/ecryptfs-trusted.blob"

    # set the eCryptfs key path name
    ECRYPTFSKEYPATH="${NEWROOT}${ECRYPTFSKEY}"

    # check for eCryptfs encrypted key's existence
    if [ ! -f "${ECRYPTFSKEYPATH}" ]; then
        if [ "${RD_DEBUG}" = "yes" ]; then
            info "eCryptfs: key file not found: ${ECRYPTFSKEYPATH}"
        fi
        return 1
    fi

    # read the eCryptfs encrypted key blob
    KEYBLOB=$(cat "${ECRYPTFSKEYPATH}")

    # load the eCryptfs encrypted key blob
    if ! ECRYPTFSKEYID=$(keyctl add ${ECRYPTFSKEYTYPE} ${ECRYPTFSKEYDESC} "load ${KEYBLOB}" @u); then
        info "eCryptfs: failed to load the eCryptfs key: ${ECRYPTFSKEYDESC}"
        return 1
    fi

    return 0
}

unload_ecryptfs_key() {
    # unlink the eCryptfs encrypted key
    keyctl unlink "${ECRYPTFSKEYID}" @u || {
        info "eCryptfs: failed to unlink the eCryptfs key: ${ECRYPTFSKEYDESC}"
        return 1
    }

    return 0
}

mount_ecryptfs() {
    # read the configuration from the config file
    # shellcheck disable=SC1090
    [ -f "${ECRYPTFSCONFIG}" ] \
        && . "${ECRYPTFSCONFIG}"

    # load the eCryptfs encrypted key
    load_ecryptfs_key || return 1

    # set the default value for ECRYPTFSDSTDIR
    [ -z "${ECRYPTFSDSTDIR}" ] \
        && ECRYPTFSDSTDIR=${ECRYPTFSSRCDIR}

    # set the eCryptfs filesystem mount point
    ECRYPTFSSRCMNT="${NEWROOT}${ECRYPTFSSRCDIR}"
    ECRYPTFSDSTMNT="${NEWROOT}${ECRYPTFSDSTDIR}"

    # build the mount options variable
    ECRYPTFS_MOUNT_OPTS="ecryptfs_sig=${ECRYPTFSKEYDESC}"
    [ -n "${ECRYPTFS_EXTRA_MOUNT_OPTS}" ] \
        && ECRYPTFS_MOUNT_OPTS="${ECRYPTFS_MOUNT_OPTS},${ECRYPTFS_EXTRA_MOUNT_OPTS}"

    # mount the eCryptfs filesystem
    info "Mounting the configured eCryptfs filesystem"
    mount -i -t ecryptfs -o${ECRYPTFS_MOUNT_OPTS} "${ECRYPTFSSRCMNT}" "${ECRYPTFSDSTMNT}" > /dev/null || {
        info "eCryptfs: mount of the eCryptfs filesystem failed"
        return 1
    }

    # unload the eCryptfs encrypted key
    unload_ecryptfs_key || return 1

    return 0
}

mount_ecryptfs
070701000001E7000081ED00000000000000000000000164DF2CB800000114000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/98ecryptfs/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    echo masterkey
    return 0
}

# called by dracut
installkernel() {
    instmods ecryptfs
}

# called by dracut
install() {
    inst_hook pre-pivot 63 "$moddir/ecryptfs-mount.sh"
}
070701000001E8000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/modules.d/98integrity   070701000001E9000081A400000000000000000000000164DF2CB800000BB4000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/98integrity/README    # Directions for creating the encrypted key that will be used to initialize
# the EVM software.

# Create the EVM key (encrypted key type)
#
# The encrypted key is a random number encrypted/decrypted using the
# kernel master key.  The encrypted key is only exposed to userspace
# as an encrypted datablob.
$ keyctl add encrypted evm-key "new trusted:kmk-trusted 32" @u
782117972

# Save the encrypted key
$ su -c 'keyctl pipe `keyctl search @u encrypted evm-key` > /etc/keys/evm-trusted.blob'

# The EVM key path name can be set in one of the following ways (specified in
# the order in which the variable is overwritten):

1) use the default value:
--------------------------------------------------------------------------
EVMKEY="/etc/keys/evm-trusted.blob"
--------------------------------------------------------------------------

2) create the configuration file '/etc/sysconfig/evm' and set the EVMKEY variable;

3) specify the EVM key path name in the 'evmkey=' parameter of the kernel command
line.


# Directions for loading a custom IMA policy.

# Write the policy following the instructions provided in the file
# 'Documentation/ABI/testing/ima_policy' of the kernel documentation.

# Save the policy in a file.

# Create the configuration file '/etc/sysconfig/ima' to override the path name of
# the IMA custom policy.
------------- '/etc/sysconfig/ima' (with the default value) -------------
IMAPOLICY="/etc/sysconfig/ima-policy"
-------------------------------------------------------------------------


# Information on loading distro, third party or local keys on the trusted IMA keyring

# Loading distro, third party or local keys on the trusted IMA keyring requires
# creating a local certificate authority(local-CA), installing the local-CA's
# public key on the system-keyring and signing the certificates with the local-CA
# key.
#
# Many directions for creating a mini certificate authority exist on the web
# (eg. openssl, yubikey). (Reminder: safely storing the private key offline is
# really important, especially in the case of the local-CA's private key.) The
# local-CA's public key can be loaded onto the system keyring either by building
# the key into the kernel or, on Fedora, storing it in the UEFI/Mok keyring. (As
# of writing, the patches for loading the UEFI/Mok keys on the system-keyring
# have not been upstreamed.)
#
# To view the system keyring: keyctl show %keyring:.system_keyring
#
# Most on-line directions for signing certificates requires creating a Certificate
# Signing Request (CSR).  Creating such a request requires access to the private
# key, which would not be available when signing distro or 3rd party certificates.
# Openssl provides the "-ss_cert" option for directly signing certificates.

# 98integrity/ima-keys-load.sh script loads the signed certificates stored 
# in the $IMAKEYSDIR onto the trusted IMA keyring.  The default $IMAKEYSDIR
# directory is /etc/keys/ima, but can be specified in the /etc/sysconfig/ima
# policy.
070701000001EA000081ED00000000000000000000000164DF2CB80000115F000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/modules.d/98integrity/evm-enable.sh #!/bin/sh

# Licensed under the GPLv2
#
# Copyright (C) 2011 Politecnico di Torino, Italy
#                    TORSEC group -- http://security.polito.it
# Roberto Sassu <roberto.sassu@polito.it>

EVMSECFILE="${SECURITYFSDIR}/evm"
EVMCONFIG="${NEWROOT}/etc/sysconfig/evm"
EVMKEYDESC="evm-key"
EVMKEYTYPE="encrypted"
EVMKEYID=""
EVM_ACTIVATION_BITS=0

# The following variables can be set in /etc/sysconfig/evm:
# EVMKEY: path to the symmetric key; defaults to /etc/keys/evm-trusted.blob
# EVMKEYDESC: Description of the symmetric key; default is 'evm-key'
# EVMKEYTYPE: Type of the symmetric key; default is 'encrypted'
# EVMX509: path to x509 cert; default is /etc/keys/x509_evm.der
# EVM_ACTIVATION_BITS: additional EVM activation bits, such as
#                      EVM_SETUP_COMPLETE; default is 0

load_evm_key() {
    # read the configuration from the config file
    # shellcheck disable=SC1090
    [ -f "${EVMCONFIG}" ] \
        && . "${EVMCONFIG}"

    # override the EVM key path name from the 'evmkey=' parameter in the kernel
    # command line
    if EVMKEYARG=$(getarg evmkey=); then
        EVMKEY=${EVMKEYARG}
    fi

    # set the default value
    [ -z "${EVMKEY}" ] \
        && EVMKEY="/etc/keys/evm-trusted.blob"

    # set the EVM key path name
    EVMKEYPATH="${NEWROOT}${EVMKEY}"

    # check for EVM encrypted key's existence
    if [ ! -f "${EVMKEYPATH}" ]; then
        if [ "${RD_DEBUG}" = "yes" ]; then
            info "integrity: EVM encrypted key file not found: ${EVMKEYPATH}"
        fi
        return 1
    fi

    # read the EVM encrypted key blob
    KEYBLOB=$(cat "${EVMKEYPATH}")

    # load the EVM encrypted key
    if ! EVMKEYID=$(keyctl add ${EVMKEYTYPE} ${EVMKEYDESC} "load ${KEYBLOB}" @u); then
        info "integrity: failed to load the EVM encrypted key: ${EVMKEYDESC}"
        return 1
    fi
    return 0
}

load_evm_x509() {
    info "Load EVM IMA X509"

    # override the EVM key path name from the 'evmx509=' parameter in
    # the kernel command line
    if EVMX509ARG=$(getarg evmx509=); then
        EVMX509=${EVMX509ARG}
    fi

    # set the default value
    [ -z "${EVMX509}" ] \
        && EVMX509="/etc/keys/x509_evm.der"

    # set the EVM public key path name
    EVMX509PATH="${NEWROOT}${EVMX509}"

    # check for EVM public key's existence
    if [ ! -f "${EVMX509PATH}" ]; then
        if [ "${RD_DEBUG}" = "yes" ]; then
            info "integrity: EVM x509 cert file not found: ${EVMX509PATH}"
        fi
        return 1
    fi

    local evm_pubid line
    if line=$(keyctl describe %keyring:.evm); then
        # the kernel already setup a trusted .evm keyring so use that one
        evm_pubid=${line%%:*}
    else
        # look for an existing regular keyring
        evm_pubid=$(keyctl search @u keyring _evm)
        if [ -z "${evm_pubid}" ]; then
            # create a new regular _evm keyring
            evm_pubid=$(keyctl newring _evm @u)
        fi
    fi

    # load the EVM public key onto the EVM keyring
    # FIXME: EVMX509ID unused?
    # shellcheck disable=SC2034
    if ! EVMX509ID=$(evmctl import "${EVMX509PATH}" "${evm_pubid}"); then
        info "integrity: failed to load the EVM X509 cert ${EVMX509PATH}"
        return 1
    fi

    if [ "${RD_DEBUG}" = "yes" ]; then
        keyctl show @u
    fi

    return 0
}

unload_evm_key() {
    # unlink the EVM encrypted key
    keyctl unlink "${EVMKEYID}" @u || {
        info "integrity: failed to unlink the EVM encrypted key: ${EVMKEYDESC}"
        return 1
    }

    return 0
}

enable_evm() {
    # check kernel support for EVM
    if [ ! -e "${EVMSECFILE}" ]; then
        if [ "${RD_DEBUG}" = "yes" ]; then
            info "integrity: EVM kernel support is disabled"
        fi
        return 0
    fi

    local evm_configured=0
    local EVM_INIT_HMAC=1 EVM_INIT_X509=2

    # try to load the EVM encrypted key
    load_evm_key && evm_configured=${EVM_INIT_HMAC}

    # try to load the EVM public key
    load_evm_x509 && evm_configured=$((evm_configured | EVM_INIT_X509))

    # only enable EVM if a key or x509 certificate could be loaded
    if [ $evm_configured -eq 0 ]; then
        return 1
    fi

    # initialize EVM
    info "Enabling EVM"
    echo $((evm_configured | EVM_ACTIVATION_BITS)) > "${EVMSECFILE}"

    if [ "$((evm_configured & EVM_INIT_HMAC))" -ne 0 ]; then
        # unload the EVM encrypted key
        unload_evm_key || return 1
    fi

    return 0
}

enable_evm
 070701000001EB000081ED00000000000000000000000164DF2CB8000005D6000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/modules.d/98integrity/ima-keys-load.sh  #!/bin/sh

SECURITYFSDIR="/sys/kernel/security"
IMASECDIR="${SECURITYFSDIR}/ima"
IMACONFIG="${NEWROOT}/etc/sysconfig/ima"

load_x509_keys() {
    KEYRING_ID=$1

    # override the default configuration
    if [ -f "${IMACONFIG}" ]; then
        # shellcheck disable=SC1090
        . "${IMACONFIG}"
    fi

    if [ -z "${IMAKEYSDIR}" ]; then
        IMAKEYSDIR="/etc/keys/ima"
    fi

    for PUBKEY in "${NEWROOT}${IMAKEYSDIR}"/*; do
        # check for public key's existence
        if [ ! -f "${PUBKEY}" ]; then
            if [ "${RD_DEBUG}" = "yes" ]; then
                info "integrity: IMA x509 cert file not found: ${PUBKEY}"
            fi
            continue
        fi

        # FIXME: X509ID unused?
        # shellcheck disable=SC2034
        if ! X509ID=$(evmctl import "${PUBKEY}" "${KEYRING_ID}"); then
            info "integrity: IMA x509 cert not loaded on keyring: ${PUBKEY}"
        fi
    done

    if [ "${RD_DEBUG}" = "yes" ]; then
        keyctl show "${KEYRING_ID}"
    fi
    return 0
}

# check kernel support for IMA
if [ ! -e "${IMASECDIR}" ]; then
    if [ "${RD_DEBUG}" = "yes" ]; then
        info "integrity: IMA kernel support is disabled"
    fi
    return 0
fi

# get the IMA keyring id

if line=$(keyctl describe %keyring:.ima); then
    _ima_id=${line%%:*}
else
    _ima_id=$(keyctl search @u keyring _ima)
    if [ -z "${_ima_id}" ]; then
        _ima_id=$(keyctl newring _ima @u)
    fi
fi

# load the IMA public key(s)
load_x509_keys "${_ima_id}"
  070701000001EC000081ED00000000000000000000000164DF2CB80000041E000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/98integrity/ima-policy-load.sh    #!/bin/sh

# Licensed under the GPLv2
#
# Copyright (C) 2011 Politecnico di Torino, Italy
#                    TORSEC group -- http://security.polito.it
# Roberto Sassu <roberto.sassu@polito.it>

IMASECDIR="${SECURITYFSDIR}/ima"
IMACONFIG="${NEWROOT}/etc/sysconfig/ima"
IMAPOLICY="/etc/sysconfig/ima-policy"

load_ima_policy() {
    # check kernel support for IMA
    if [ ! -e "${IMASECDIR}" ]; then
        if [ "${RD_DEBUG}" = "yes" ]; then
            info "integrity: IMA kernel support is disabled"
        fi
        return 0
    fi

    # override the default configuration
    # shellcheck disable=SC1090
    [ -f "${IMACONFIG}" ] \
        && . "${IMACONFIG}"

    # set the IMA policy path name
    IMAPOLICYPATH="${NEWROOT}${IMAPOLICY}"

    # check the existence of the IMA policy file
    [ -f "${IMAPOLICYPATH}" ] && {
        info "Loading the provided IMA custom policy"
        printf '%s' "${IMAPOLICYPATH}" > "${IMASECDIR}"/policy \
            || cat "${IMAPOLICYPATH}" > "${IMASECDIR}"/policy
    }

    return 0
}

load_ima_policy
  070701000001ED000081ED00000000000000000000000164DF2CB80000016F000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/98integrity/module-setup.sh   #!/bin/bash

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    echo masterkey securityfs
    return 0
}

# called by dracut
install() {
    dracut_install evmctl keyctl ls
    inst_hook pre-pivot 61 "$moddir/evm-enable.sh"
    inst_hook pre-pivot 61 "$moddir/ima-keys-load.sh"
    inst_hook pre-pivot 62 "$moddir/ima-policy-load.sh"
}
 070701000001EE000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/modules.d/98pollcdrom   070701000001EF000081ED00000000000000000000000164DF2CB8000000C6000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/98pollcdrom/module-setup.sh   #!/bin/bash

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    inst_hook initqueue/settled 99 "$moddir/pollcdrom.sh"
}
  070701000001F0000081ED00000000000000000000000164DF2CB80000027D000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/98pollcdrom/pollcdrom.sh  #!/bin/sh
#
# Licensed under the GPLv2
#
# Copyright 2008-2012, Red Hat, Inc.
# Harald Hoyer <harald@redhat.com>

if [ ! -e /sys/module/block/parameters/events_dfl_poll_msecs ]; then
    # if the kernel does not support autopolling
    # then we have to do a
    # dirty hack for some cdrom drives,
    # which report no medium for quiet
    # some time.
    for cdrom in /sys/block/sr*; do
        [ -e "$cdrom" ] || continue
        # skip, if cdrom medium was already found
        strstr "$(udevadm info --query=env --path="${cdrom##/sys}")" \
            ID_CDROM_MEDIA && continue
        echo change > "$cdrom/uevent"
    done
fi
   070701000001F1000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/modules.d/98selinux 070701000001F2000081ED00000000000000000000000164DF2CB8000000E4000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/modules.d/98selinux/module-setup.sh #!/bin/bash

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    inst_hook pre-pivot 50 "$moddir/selinux-loadpolicy.sh"
    inst_multiple setenforce
}
070701000001F3000081ED00000000000000000000000164DF2CB8000008DF000000000000000000000000000000000000004800000000dracut-055+suse.347.gdcb9bdbf/modules.d/98selinux/selinux-loadpolicy.sh   #!/bin/sh

# FIXME: load selinux policy.  this should really be done after we switchroot

rd_load_policy() {
    # If SELinux is disabled exit now
    getarg "selinux=0" > /dev/null && return 0

    SELINUX="enforcing"
    # shellcheck disable=SC1090
    [ -e "$NEWROOT/etc/selinux/config" ] && . "$NEWROOT/etc/selinux/config"

    # Check whether SELinux is in permissive mode
    permissive=0

    if getarg "enforcing=0" > /dev/null || [ "$SELINUX" = "permissive" ]; then
        permissive=1
    fi

    # Attempt to load SELinux Policy
    if [ -x "$NEWROOT/usr/sbin/load_policy" -o -x "$NEWROOT/sbin/load_policy" ]; then
        local ret=0
        local out
        info "Loading SELinux policy"
        mount -o bind /sys "$NEWROOT"/sys
        # load_policy does mount /proc and /sys/fs/selinux in
        # libselinux,selinux_init_load_policy()
        if [ -x "$NEWROOT/sbin/load_policy" ]; then
            out=$(LANG=C chroot "$NEWROOT" /sbin/load_policy -i 2>&1)
            ret=$?
            info "$out"
        else
            out=$(LANG=C chroot "$NEWROOT" /usr/sbin/load_policy -i 2>&1)
            ret=$?
            info "$out"
        fi
        umount "$NEWROOT"/sys/fs/selinux
        umount "$NEWROOT"/sys

        if [ "$SELINUX" = "disabled" ]; then
            return 0
        fi

        if [ $ret -eq 0 -o $ret -eq 2 ]; then
            # If machine requires a relabel, force to permissive mode
            [ -e "$NEWROOT"/.autorelabel ] && LANG=C /usr/sbin/setenforce 0
            mount --rbind /dev "$NEWROOT/dev"
            LANG=C chroot "$NEWROOT" /sbin/restorecon -R /dev
            umount -R "$NEWROOT/dev"
            return 0
        fi

        warn "Initial SELinux policy load failed."
        if [ $ret -eq 3 -o $permissive -eq 0 ]; then
            warn "Machine in enforcing mode."
            warn "Not continuing"
            emergency_shell -n selinux
            exit 1
        fi
        return 0
    elif [ $permissive -eq 0 -a "$SELINUX" != "disabled" ]; then
        warn "Machine in enforcing mode and cannot execute load_policy."
        warn "To disable selinux, add selinux=0 to the kernel command line."
        warn "Not continuing"
        emergency_shell -n selinux
        exit 1
    fi
}

rd_load_policy
 070701000001F4000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/modules.d/98syslog  070701000001F5000081A400000000000000000000000164DF2CB800000341000000000000000000000000000000000000003800000000dracut-055+suse.347.gdcb9bdbf/modules.d/98syslog/README   Syslog support for dracut

This module provides syslog functionality in the initrd.
This is especially interesting when complex configuration being
used to provide access to the device the rootfs resides on.

When this module is installed into the ramfs it is triggered by
the udev event from the nic being setup (online).

Then if syslog is configured it is started and will forward all
kernel messages to the given syslog server.

The syslog implementation is detected automatically by finding the
appropriate binary with the following order:
rsyslogd
syslogd
syslog-ng
Then if detected the syslog.conf is generated and syslog is started.

Bootparameters:
syslogserver=ip    Where to syslog to
sysloglevel=level  What level has to be logged
syslogtype=rsyslog|syslog|syslogng
                   Don't auto detect syslog but set it
   070701000001F6000081ED00000000000000000000000164DF2CB800000487000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/98syslog/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    # do not add this module by default
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    local _installs
    if find_binary rsyslogd > /dev/null; then
        _installs="rsyslogd"
        inst_libdir_file rsyslog/lmnet.so rsyslog/imklog.so rsyslog/imuxsock.so rsyslog/imjournal.so
    elif find_binary syslogd > /dev/null; then
        _installs="syslogd"
    elif find_binary syslog-ng > /dev/null; then
        _installs="syslog-ng"
    else
        derror "Could not find any syslog binary although the syslogmodule" \
            "is selected to be installed. Please check."
    fi
    if [ -n "$_installs" ]; then
        inst_multiple cat $_installs
        inst_hook cmdline 90 "$moddir/parse-syslog-opts.sh"
        inst_hook cleanup 99 "$moddir/syslog-cleanup.sh"
        inst_hook initqueue/online 70 "$moddir/rsyslogd-start.sh"
        inst_simple "$moddir/rsyslogd-stop.sh" /sbin/rsyslogd-stop
        mkdir -m 0755 -p "${initdir}"/etc/templates
        inst_simple "${moddir}/rsyslog.conf" /etc/templates/rsyslog.conf
    fi
    dracut_need_initqueue
}
 070701000001F7000081ED00000000000000000000000164DF2CB800000487000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/modules.d/98syslog/parse-syslog-opts.sh #!/bin/sh

# Parses the syslog commandline options
#
#Bootparameters:
#syslogserver=ip    Where to syslog to
#sysloglevel=level  What level has to be logged
#syslogtype=rsyslog|syslog|syslogng
#                   Don't auto detect syslog but set it
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

detect_syslog() {
    syslogtype=""
    if [ -e /sbin/rsyslogd ]; then
        syslogtype="rsyslogd"
    elif [ -e /sbin/syslogd ]; then
        syslogtype="syslogd"
    elif [ -e /sbin/syslog-ng ]; then
        syslogtype="syslog-ng"
    else
        warn "Could not find any syslog binary although the syslogmodule is selected to be installed. Please check."
    fi
    echo "$syslogtype"
    [ -n "$syslogtype" ]
}

syslogserver=$(getarg syslog.server -d syslog)
syslogfilters=$(getargs syslog.filter -d filter)
syslogtype=$(getarg syslog.type -d syslogtype)

[ -n "$syslogserver" ] && echo "$syslogserver" > /tmp/syslog.server
[ -n "$syslogfilters" ] && echo "$syslogfilters" > /tmp/syslog.filters
if [ -n "$syslogtype" ]; then
    echo "$syslogtype" > /tmp/syslog.type
else
    syslogtype=$(detect_syslog)
    echo "$syslogtype" > /tmp/syslog.type
fi
 070701000001F8000081A400000000000000000000000164DF2CB800000334000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/98syslog/rsyslog.conf #rsyslog v3 config file

# if you experience problems, check
# http://www.rsyslog.com/troubleshoot for assistance

#### MODULES ####

$ModLoad imuxsock.so    # provides support for local system logging (e.g. via logger command)
$ModLoad imklog.so      # provides kernel logging support (previously done by rklogd)
#$ModLoad immark.so     # provides --MARK-- message capability

# Provides UDP syslog reception
#$ModLoad imudp.so
#$UDPServerRun 514

# Provides TCP syslog reception
#$ModLoad imtcp.so
#$InputTCPServerRun 514


#### GLOBAL DIRECTIVES ####

# Use default timestamp format
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# File syncing capability is disabled by default. This feature is usually not required,
# not useful and an extreme performance hit
#$ActionFileEnableSync on


#### RULES ####
070701000001F9000081ED00000000000000000000000164DF2CB8000004E6000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/98syslog/rsyslogd-start.sh    #!/bin/sh

# Triggered by initqueue/online and starts rsyslogd with bootparameters

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

# prevent starting again if already running
if [ -f /var/run/syslogd.pid ]; then
    read -r pid < /var/run/syslogd.pid
    kill -0 "$pid" && exit 0
fi

rsyslog_config() {
    local server=$1
    shift
    local syslog_template=$1
    shift
    local filters=$*
    local filter=

    cat "$syslog_template"

    (
        # disable shell expansion / globbing
        # since filters contain such characters
        set -f
        for filter in $filters; do
            echo "${filter} @${server}"
        done
    )
    #echo "*.* /tmp/syslog"
}

[ -f /tmp/syslog.type ] && read -r type < /tmp/syslog.type
[ -f /tmp/syslog.server ] && read -r server < /tmp/syslog.server
[ -f /tmp/syslog.filters ] && read -r filters < /tmp/syslog.filters
[ -z "$filters" ] && filters="kern.*"
[ -f /tmp/syslog.conf ] && read -r conf < /tmp/syslog.conf
[ -z "$conf" ] && conf="/etc/rsyslog.conf" && echo "$conf" > /tmp/syslog.conf

if [ "$type" = "rsyslogd" ]; then
    template=/etc/templates/rsyslog.conf
    if [ -n "$server" ]; then
        rsyslog_config "$server" "$template" "$filters" > $conf
        rsyslogd -c3
    fi
fi
  070701000001FA000081ED00000000000000000000000164DF2CB800000128000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/modules.d/98syslog/rsyslogd-stop.sh #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

# Kills rsyslogd

if [ -f /var/run/syslogd.pid ]; then
    read -r pid < /var/run/syslogd.pid
    kill "$pid"
    kill -0 "$pid" && kill -9 "$pid"
else
    warn "rsyslogd-stop: Could not find a pid for rsyslogd. Won't kill it."
fi
070701000001FB000081ED00000000000000000000000164DF2CB80000019F000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/98syslog/syslog-cleanup.sh    #!/bin/sh

# Just cleans up a previously started syslogd

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

if [ -f /tmp/syslog.server ]; then
    read -r syslogtype < /tmp/syslog.type
    if command -v "${syslogtype}-stop" > /dev/null; then
        "${syslogtype}"-stop
    else
        warn "syslog-cleanup: Could not find script to stop syslog of type \"$syslogtype\". Syslog will not be stopped."
    fi
fi
 070701000001FC000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003300000000dracut-055+suse.347.gdcb9bdbf/modules.d/98usrmount    070701000001FD000081ED00000000000000000000000164DF2CB800000125000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/98usrmount/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    [[ $mount_needs ]] && return 1
    return 0
}

# called by dracut
depends() {
    echo 'fs-lib'
}

# called by dracut
install() {
    if ! dracut_module_included "systemd"; then
        inst_hook pre-pivot 50 "$moddir/mount-usr.sh"
    fi
    :
}
   070701000001FE000081ED00000000000000000000000164DF2CB800000D2B000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/modules.d/98usrmount/mount-usr.sh   #!/bin/sh

type info > /dev/null 2>&1 || . /lib/dracut-lib.sh
type fsck_single > /dev/null 2>&1 || . /lib/fs-lib.sh

filtersubvol() {
    local _oldifs
    _oldifs="$IFS"
    local IFS=","
    # shellcheck disable=SC2086
    set -- $1
    IFS="$_oldifs"
    while [ $# -gt 0 ]; do
        case $1 in
            'subvol='*) : ;;
            *) printf '%s' "${1}," ;;
        esac
        shift
    done
}

fsck_usr() {
    local _dev=$1
    local _fs=$2
    local _fsopts=$3
    local _fsckoptions

    if [ -f "$NEWROOT"/fsckoptions ]; then
        _fsckoptions=$(cat "$NEWROOT"/fsckoptions)
    fi

    if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck; then
        _fsckoptions="-f $_fsckoptions"
    elif [ -f "$NEWROOT"/.autofsck ]; then
        # shellcheck disable=SC1090
        [ -f "$NEWROOT"/etc/sysconfig/autofsck ] && . "$NEWROOT"/etc/sysconfig/autofsck
        if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
            AUTOFSCK_OPT="$AUTOFSCK_OPT -f"
        fi
        if [ -n "$AUTOFSCK_SINGLEUSER" ]; then
            warn "*** Warning -- the system did not shut down cleanly. "
            warn "*** Dropping you to a shell; the system will continue"
            warn "*** when you leave the shell."
            emergency_shell
        fi
        _fsckoptions="$AUTOFSCK_OPT $_fsckoptions"
    fi

    fsck_single "$_dev" "$_fs" "$_fsopts" "$_fsckoptions"
}

mount_usr() {
    local _dev _mp _fs _opts _ _usr_found _ _freq _passno
    # check, if we have to mount the /usr filesystem
    while read -r _dev _mp _fs _opts _freq _passno || [ -n "$_dev" ]; do
        [ "${_dev%%#*}" != "$_dev" ] && continue
        if [ "$_mp" = "/usr" ]; then
            _dev="$(label_uuid_to_dev "$_dev")"

            if strstr "$_opts" "subvol=" \
                && [ "${root#block:}" -ef "$_dev" ] \
                && [ -n "$rflags" ]; then
                # for btrfs subvolumes we have to mount /usr with the same rflags
                rflags=$(filtersubvol "$rflags")
                rflags=${rflags%%,}
                _opts="${_opts:+${_opts},}${rflags}"
            elif getargbool 0 ro; then
                # if "ro" is specified, we want /usr to be mounted read-only
                _opts="${_opts:+${_opts},}ro"
            elif getargbool 0 rw; then
                # if "rw" is specified, we want /usr to be mounted read-write
                _opts="${_opts:+${_opts},}rw"
            fi
            echo "$_dev ${NEWROOT}${_mp} $_fs ${_opts} $_freq $_passno"
            _usr_found="1"
            break
        fi
    done < "$NEWROOT/etc/fstab" >> /etc/fstab

    if [ "$_usr_found" != "" ]; then
        # we have to mount /usr
        _fsck_ret=0
        if ! getargbool 0 rd.skipfsck; then
            if [ "0" != "${_passno:-0}" ]; then
                fsck_usr "$_dev" "$_fs" "$_opts"
                _fsck_ret=$?
                [ $_fsck_ret -ne 255 ] && echo $_fsck_ret > /run/initramfs/usr-fsck
            fi
        fi

        info "Mounting /usr with -o $_opts"
        mount "$NEWROOT/usr" 2>&1 | vinfo

        if ! ismounted "$NEWROOT/usr"; then
            warn "Mounting /usr to $NEWROOT/usr failed"
            warn "*** Dropping you to a shell; the system will continue"
            warn "*** when you leave the shell."
            emergency_shell
        fi
    fi
}

if [ -f "$NEWROOT/etc/fstab" ]; then
    mount_usr
fi
 070701000001FF000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/99base    07070100000200000081ED00000000000000000000000164DF2CB800000FE1000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/99base/dracut-dev-lib.sh  #!/bin/sh

# replaces all occurrences of 'search' in 'str' with 'replacement'
#
# str_replace str search replacement
#
# example:
# str_replace '  one two  three  ' ' ' '_'
str_replace() {
    local in="$1"
    local s="$2"
    local r="$3"
    local out=''

    while [ "${in##*"$s"*}" != "$in" ]; do
        chop="${in%%"$s"*}"
        out="${out}${chop}$r"
        in="${in#*"$s"}"
    done
    echo "${out}${in}"
}

# get a systemd-compatible unit name from a path
# (mimicks unit_name_from_path_instance())
dev_unit_name() {
    local dev="$1"

    if command -v systemd-escape > /dev/null; then
        systemd-escape -p -- "$dev"
        return $?
    fi

    if [ "$dev" = "/" -o -z "$dev" ]; then
        printf -- "-"
        return 0
    fi

    dev="${1%%/}"
    dev="${dev##/}"
    # shellcheck disable=SC1003
    dev="$(str_replace "$dev" '\' '\x5c')"
    dev="$(str_replace "$dev" '-' '\x2d')"
    if [ "${dev##.}" != "$dev" ]; then
        dev="\x2e${dev##.}"
    fi
    dev="$(str_replace "$dev" '/' '-')"

    printf -- "%s" "$dev"
}

# set_systemd_timeout_for_dev [-n] <dev> [<timeout>]
# Set 'rd.timeout' as the systemd timeout for <dev>
set_systemd_timeout_for_dev() {
    local _name
    local _needreload
    local _noreload
    local _timeout

    [ -z "$DRACUT_SYSTEMD" ] && return 0

    if [ "$1" = "-n" ]; then
        _noreload=1
        shift
    fi

    if [ -n "$2" ]; then
        _timeout="$2"
    else
        _timeout=$(getarg rd.timeout)
    fi

    _timeout=${_timeout:-0}

    _name=$(dev_unit_name "$1")
    if ! [ -L "${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device" ]; then
        [ -d "${PREFIX}"/etc/systemd/system/initrd.target.wants ] || mkdir -p "${PREFIX}"/etc/systemd/system/initrd.target.wants
        ln -s ../"${_name}".device "${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device"
        type mark_hostonly > /dev/null 2>&1 && mark_hostonly /etc/systemd/system/initrd.target.wants/"${_name}".device
        _needreload=1
    fi

    if ! [ -f "${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf" ]; then
        mkdir -p "${PREFIX}/etc/systemd/system/${_name}.device.d"
        {
            echo "[Unit]"
            echo "JobTimeoutSec=$_timeout"
            echo "JobRunningTimeoutSec=$_timeout"
        } > "${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf"
        type mark_hostonly > /dev/null 2>&1 && mark_hostonly /etc/systemd/system/"${_name}".device.d/timeout.conf
        _needreload=1
    fi

    if [ -z "$PREFIX" ] && [ "$_needreload" = 1 ] && [ -z "$_noreload" ]; then
        /sbin/initqueue --onetime --unique --name daemon-reload systemctl daemon-reload
    fi
}

# wait_for_dev <dev> [<timeout>]
#
# Installs a initqueue-finished script,
# which will cause the main loop only to exit,
# if the device <dev> is recognized by the system.
wait_for_dev() {
    local _name
    local _noreload

    if [ "$1" = "-n" ]; then
        _noreload=-n
        shift
    fi

    _name="$(str_replace "$1" '/' '\x2f')"

    type mark_hostonly > /dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh"

    [ -e "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0

    printf '[ -e "%s" ]\n' "$1" \
        >> "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh"
    {
        printf '[ -e "%s" ] || ' "$1"
        printf 'warn "\"%s\" does not exist"\n' "$1"
    } >> "${PREFIX}$hookdir/emergency/80-${_name}.sh"

    set_systemd_timeout_for_dev $_noreload "$@"
}

cancel_wait_for_dev() {
    local _name
    _name="$(str_replace "$1" '/' '\x2f')"
    rm -f -- "$hookdir/initqueue/finished/devexists-${_name}.sh"
    rm -f -- "$hookdir/emergency/80-${_name}.sh"
    if [ -n "$DRACUT_SYSTEMD" ]; then
        _name=$(dev_unit_name "$1")
        rm -f -- "${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device"
        rm -f -- "${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf"
        /sbin/initqueue --onetime --unique --name daemon-reload systemctl daemon-reload
    fi
}
   07070100000201000081ED00000000000000000000000164DF2CB8000070CF000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/99base/dracut-lib.sh  #!/bin/sh

type wait_for_dev > /dev/null 2>&1 || . /lib/dracut-dev-lib.sh

export DRACUT_SYSTEMD
export NEWROOT
if [ -n "$NEWROOT" ]; then
    [ -d "$NEWROOT" ] || mkdir -p -m 0755 "$NEWROOT"
fi

# shellcheck disable=SC2153
if [ -z "$PREFIX" ]; then
    if ! [ -d /run/initramfs ]; then
        mkdir -p -m 0755 /run/initramfs/log
        ln -sfn /run/initramfs/log /var/log
    fi

    [ -d /run/lock ] || mkdir -p -m 0755 /run/lock
    [ -d /run/log ] || mkdir -p -m 0755 /run/log
fi

debug_off() {
    set +x
}

debug_on() {
    [ "$RD_DEBUG" = "yes" ] && set -x
}

# returns OK if $1 contains literal string $2 (and isn't empty)
strstr() {
    [ "${1##*"$2"*}" != "$1" ]
}

# returns OK if $1 matches (completely) glob pattern $2
# An empty $1 will not be considered matched, even if $2 is * which technically
# matches; as it would match anything, it's not an interesting case.
strglob() {
    [ -n "$1" -a -z "${1##$2}" ]
}

# returns OK if $1 contains (anywhere) a match of glob pattern $2
# An empty $1 will not be considered matched, even if $2 is * which technically
# matches; as it would match anything, it's not an interesting case.
strglobin() {
    [ -n "$1" -a -z "${1##*$2*}" ]
}

# returns OK if $1 contains literal string $2 at the beginning, and isn't empty
str_starts() {
    [ "${1#"$2"*}" != "$1" ]
}

# returns OK if $1 contains literal string $2 at the end, and isn't empty
str_ends() {
    [ "${1%*"$2"}" != "$1" ]
}

trim() {
    local var="$*"
    var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
    var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
    printf "%s" "$var"
}

if [ -z "$DRACUT_SYSTEMD" ]; then

    warn() {
        check_quiet
        echo "<28>dracut Warning: $*" > /dev/kmsg
        echo "dracut Warning: $*" >&2
    }

    info() {
        check_quiet
        echo "<30>dracut: $*" > /dev/kmsg
        if [ "$DRACUT_QUIET" != "yes" ]; then
            echo "dracut: $*" >&2
        fi
    }

else

    warn() {
        echo "Warning: $*" >&2
    }

    info() {
        echo "$*"
    }

fi

vwarn() {
    while read -r line || [ -n "$line" ]; do
        warn "$line"
    done
}

vinfo() {
    while read -r line || [ -n "$line" ]; do
        info "$line"
    done
}

# replaces all occurrences of 'search' in 'str' with 'replacement'
#
# str_replace str search replacement
#
# example:
# str_replace '  one two  three  ' ' ' '_'
str_replace() {
    local in="$1"
    local s="$2"
    local r="$3"
    local out=''

    while strstr "${in}" "$s"; do
        chop="${in%%"$s"*}"
        out="${out}${chop}$r"
        in="${in#*"$s"}"
    done
    echo "${out}${in}"
}

killall_proc_mountpoint() {
    local _pid
    local _killed=0
    for _pid in /proc/*; do
        _pid=${_pid##/proc/}
        case $_pid in
            *[!0-9]*) continue ;;
        esac
        [ -e "/proc/$_pid/exe" ] || continue
        [ -e "/proc/$_pid/root" ] || continue
        if strstr "$(ls -l -- "/proc/$_pid" "/proc/$_pid/fd" 2> /dev/null)" "$1"; then
            kill -9 "$_pid"
            _killed=1
        fi
    done
    return $_killed
}

getcmdline() {
    local _line
    local _i
    local CMDLINE_ETC_D
    local CMDLINE_ETC
    local CMDLINE_PROC
    unset _line

    if [ -e /etc/cmdline ]; then
        while read -r _line || [ -n "$_line" ]; do
            CMDLINE_ETC="$CMDLINE_ETC $_line"
        done < /etc/cmdline
    fi
    for _i in /etc/cmdline.d/*.conf; do
        [ -e "$_i" ] || continue
        while read -r _line || [ -n "$_line" ]; do
            CMDLINE_ETC_D="$CMDLINE_ETC_D $_line"
        done < "$_i"
    done
    if [ -e /proc/cmdline ]; then
        while read -r _line || [ -n "$_line" ]; do
            CMDLINE_PROC="$CMDLINE_PROC $_line"
        done < /proc/cmdline
    fi
    CMDLINE="$CMDLINE_ETC_D $CMDLINE_ETC $CMDLINE_PROC"
    printf "%s" "$CMDLINE"
}

getarg() {
    debug_off
    local _deprecated _newoption
    CMDLINE=$(getcmdline)
    export CMDLINE
    while [ $# -gt 0 ]; do
        case $1 in
            -d)
                _deprecated=1
                shift
                ;;
            -y)
                if dracut-getarg "$2" > /dev/null; then
                    if [ "$_deprecated" = "1" ]; then
                        if [ -n "$_newoption" ]; then
                            warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead."
                        else
                            warn "Option '$2' is deprecated."
                        fi
                    fi
                    echo 1
                    debug_on
                    return 0
                fi
                _deprecated=0
                shift 2
                ;;
            -n)
                if dracut-getarg "$2" > /dev/null; then
                    echo 0
                    if [ "$_deprecated" = "1" ]; then
                        if [ -n "$_newoption" ]; then
                            warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead."
                        else
                            warn "Option '$2' is deprecated."
                        fi
                    fi
                    debug_on
                    return 1
                fi
                _deprecated=0
                shift 2
                ;;
            *)
                if [ -z "$_newoption" ]; then
                    _newoption="$1"
                fi
                if dracut-getarg "$1"; then
                    if [ "$_deprecated" = "1" ]; then
                        if [ -n "$_newoption" ]; then
                            warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead."
                        else
                            warn "Option '$1' is deprecated."
                        fi
                    fi
                    debug_on
                    return 0
                fi
                _deprecated=0
                shift
                ;;
        esac
    done
    debug_on
    return 1
}

# getargbool <defaultval> <args...>
# False if "getarg <args...>" returns "0", "no", or "off".
# True if getarg returns any other non-empty string.
# If not found, assumes <defaultval> - usually 0 for false, 1 for true.
# example: getargbool 0 rd.info
#   true: rd.info, rd.info=1, rd.info=xxx
#   false: rd.info=0, rd.info=off, rd.info not present (default val is 0)
getargbool() {
    local _b
    unset _b
    local _default
    _default="$1"
    shift
    _b=$(getarg "$@") || _b=${_b:-"$_default"}
    if [ -n "$_b" ]; then
        [ "$_b" = "0" ] && return 1
        [ "$_b" = "no" ] && return 1
        [ "$_b" = "off" ] && return 1
    fi
    return 0
}

isdigit() {
    case "$1" in
        *[!0-9]* | "") return 1 ;;
    esac

    return 0
}

# getargnum <defaultval> <minval> <maxval> <arg>
# Will echo the arg if it's in range [minval - maxval].
# If it's not set or it's not valid, will set it <defaultval>.
# Note all values are required to be >= 0 here.
# <defaultval> should be with [minval -maxval].
getargnum() {
    local _b
    unset _b
    local _default _min _max
    _default="$1"
    shift
    _min="$1"
    shift
    _max="$1"
    shift
    _b=$(getarg "$1") || _b=${_b:-"$_default"}
    if [ -n "$_b" ]; then
        isdigit "$_b" && _b=$((_b)) \
            && [ $_b -ge "$_min" ] && [ $_b -le "$_max" ] && echo $_b && return
    fi
    echo "$_default"
}

getargs() {
    debug_off
    CMDLINE=$(getcmdline)
    export CMDLINE
    local _val _i _gfound _deprecated
    unset _val
    unset _gfound
    _newoption="$1"
    for _i in "$@"; do
        if [ "$_i" = "-d" ]; then
            _deprecated=1
            continue
        fi

        if _val="$(dracut-getargs "$_i")"; then
            if [ "$_deprecated" = "1" ]; then
                if [ -n "$_newoption" ]; then
                    warn "Option '$_i' is deprecated, use '$_newoption' instead."
                else
                    warn "Option $_i is deprecated!"
                fi
            fi
            if [ -n "$_val" ]; then
                printf '%s\n' "$_val"
            fi
            _gfound=1
        fi
        _deprecated=0
    done
    if [ -n "$_gfound" ]; then
        debug_on
        return 0
    fi
    debug_on
    return 1
}

# Prints value of given option.  If option is a flag and it's present,
# it just returns 0.  Otherwise 1 is returned.
# $1 = options separated by commas
# $2 = option we are interested in
#
# Example:
# $1 = cipher=aes-cbc-essiv:sha256,hash=sha256,verify
# $2 = hash
# Output:
# sha256
getoptcomma() {
    local line=",$1,"
    local opt="$2"
    local tmp

    case "${line}" in
        *,${opt}=*,*)
            tmp="${line#*,${opt}=}"
            echo "${tmp%%,*}"
            return 0
            ;;
        *,${opt},*) return 0 ;;
    esac
    return 1
}

# Splits given string 'str' with separator 'sep' into variables 'var1', 'var2',
# 'varN'.  If number of fields is less than number of variables, remaining are
# not set.  If number of fields is greater than number of variables, the last
# variable takes remaining fields.  In short - it acts similary to 'read'.
#
# splitsep sep str var1 var2 varN
#
# example:
#   splitsep ':' 'foo:bar:baz' v1 v2
# in result:
#   v1='foo', v2='bar:baz'
#
# TODO: ':' inside fields.
splitsep() {
    debug_off
    local sep="$1"
    local str="$2"
    shift 2
    local tmp

    while [ -n "$str" -a "$#" -gt 1 ]; do
        tmp="${str%%$sep*}"
        eval "$1='${tmp}'"
        str="${str#"$tmp"}"
        str="${str#$sep}"
        shift
    done
    [ -n "$str" -a -n "$1" ] && eval "$1='$str'"
    debug_on
    return 0
}

setdebug() {
    [ -f /usr/lib/initrd-release ] || return
    if [ -z "$RD_DEBUG" ]; then
        if [ -e /proc/cmdline ]; then
            RD_DEBUG=no
            if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
                RD_DEBUG=yes
                [ -n "$BASH" ] \
                    && export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): '
            fi
        fi
        export RD_DEBUG
    fi
    debug_on
}

setdebug

source_all() {
    local f
    local _dir
    _dir=$1
    shift
    [ "$_dir" ] && [ -d "/$_dir" ] || return
    for f in "/$_dir"/*.sh; do
        if [ -e "$f" ]; then
            # shellcheck disable=SC1090
            # shellcheck disable=SC2240
            . "$f" "$@"
        fi
    done
}

hookdir=/lib/dracut/hooks
export hookdir

source_hook() {
    local _dir
    _dir=$1
    shift
    source_all "/lib/dracut/hooks/$_dir" "$@"
}

check_finished() {
    local f
    for f in "$hookdir"/initqueue/finished/*.sh; do
        [ "$f" = "$hookdir/initqueue/finished/*.sh" ] && return 0
        # shellcheck disable=SC1090
        { [ -e "$f" ] && (. "$f"); } || return 1
    done
    return 0
}

source_conf() {
    local f
    [ "$1" ] && [ -d "/$1" ] || return
    # shellcheck disable=SC1090
    for f in "/$1"/*.conf; do [ -e "$f" ] && . "$f"; done
}

die() {
    {
        echo "<24>dracut: FATAL: $*"
        echo "<24>dracut: Refusing to continue"
    } > /dev/kmsg

    {
        echo "warn dracut: FATAL: \"$*\""
        echo "warn dracut: Refusing to continue"
    } >> $hookdir/emergency/01-die.sh
    [ -d /run/initramfs ] || mkdir -p -- /run/initramfs

    : > /run/initramfs/.die

    if getargbool 0 "rd.shell"; then
        emergency_shell
    else
        source_hook "shutdown-emergency"
    fi

    if [ -n "$DRACUT_SYSTEMD" ]; then
        systemctl --no-block --force halt
    fi

    exit 1
}

check_quiet() {
    if [ -z "$DRACUT_QUIET" ]; then
        DRACUT_QUIET="yes"
        getargbool 0 rd.info -d -y rdinfo && DRACUT_QUIET="no"
        getargbool 0 rd.debug -d -y rdinitdebug && DRACUT_QUIET="no"
        getarg quiet || DRACUT_QUIET="yes"
        a=$(getarg loglevel=)
        [ -n "$a" ] && [ "$a" -ge 28 ] && DRACUT_QUIET="yes"
        export DRACUT_QUIET
    fi
}

check_occurances() {
    # Count the number of times the character $ch occurs in $str
    # Return 0 if the count matches the expected number, 1 otherwise
    local str="$1"
    local ch="$2"
    local expected="$3"
    local count=0

    while [ "${str#*$ch}" != "${str}" ]; do
        str="${str#*$ch}"
        count=$((count + 1))
    done

    [ $count -eq "$expected" ]
}

incol2() {
    debug_off
    local check
    local file="$1"
    local str="$2"

    [ -z "$file" ] && return 1
    [ -z "$str" ] && return 1

    while read -r _ check _ || [ -n "$check" ]; do
        if [ "$check" = "$str" ]; then
            debug_on
            return 0
        fi
    done < "$file"
    debug_on
    return 1
}

udevsettle() {
    # shellcheck disable=SC2086
    udevadm settle --exit-if-exists=$hookdir/initqueue/work $settle_exit_if_exists
}

udevproperty() {
    for i in "$@"; do
        udevadm control --property="$i"
    done
}

find_mount() {
    local dev wanted_dev
    wanted_dev="$(readlink -e -q "$1")"
    while read -r dev _ || [ -n "$dev" ]; do
        [ "$dev" = "$wanted_dev" ] && echo "$dev" && return 0
    done < /proc/mounts
    return 1
}

# usage: ismounted <mountpoint>
# usage: ismounted /dev/<device>
if command -v findmnt > /dev/null; then
    ismounted() {
        findmnt "$1" > /dev/null 2>&1
    }
else
    ismounted() {
        if [ -b "$1" ]; then
            find_mount "$1" > /dev/null && return 0
            return 1
        fi

        while read -r _ m _ || [ -n "$m" ]; do
            [ "$m" = "$1" ] && return 0
        done < /proc/mounts
        return 1
    }
fi

# Create udev rule match for a device with its device name, or the udev property
# ID_FS_UUID or ID_FS_LABEL
#
# example:
#   udevmatch LABEL=boot
# prints:
#   ENV{ID_FS_LABEL}="boot"
#
# TODO: symlinks
udevmatch() {
    case "$1" in
        UUID=????????-????-????-????-???????????? | LABEL=* | PARTLABEL=* | PARTUUID=????????-????-????-????-????????????)
            printf 'ENV{ID_FS_%s}=="%s"' "${1%%=*}" "${1#*=}"
            ;;
        UUID=*)
            printf 'ENV{ID_FS_UUID}=="%s*"' "${1#*=}"
            ;;
        PARTUUID=*)
            printf 'ENV{ID_FS_PARTUUID}=="%s*"' "${1#*=}"
            ;;
        /dev/?*) printf -- 'KERNEL=="%s"' "${1#/dev/}" ;;
        *) return 255 ;;
    esac
}

label_uuid_to_dev() {
    local _dev
    _dev="${1#block:}"
    case "$_dev" in
        LABEL=*)
            echo "/dev/disk/by-label/$(echo "${_dev#LABEL=}" | sed 's,/,\\x2f,g;s, ,\\x20,g')"
            ;;
        PARTLABEL=*)
            echo "/dev/disk/by-partlabel/$(echo "${_dev#PARTLABEL=}" | sed 's,/,\\x2f,g;s, ,\\x20,g')"
            ;;
        UUID=*)
            echo "/dev/disk/by-uuid/$(echo "${_dev#UUID=}" | tr "[:upper:]" "[:lower:]")"
            ;;
        PARTUUID=*)
            echo "/dev/disk/by-partuuid/$(echo "${_dev#PARTUUID=}" | tr "[:upper:]" "[:lower:]")"
            ;;
    esac
}

# Prints unique path for potential file inside specified directory.  It consists
# of specified directory, prefix and number at the end which is incremented
# until non-existing file is found.
#
# funiq dir prefix
#
# example:
# # ls /mnt
# cdrom0 cdrom1
#
# # funiq /mnt cdrom
# /mnt/cdrom2
funiq() {
    local dir="$1"
    local prefix="$2"
    local i=0

    [ -d "${dir}" ] || return 1

    while [ -e "${dir}/${prefix}$i" ]; do
        i=$((i + 1)) || return 1
    done

    echo "${dir}/${prefix}$i"
}

# Creates unique directory and prints its path.  It's using funiq to generate
# path.
#
# mkuniqdir subdir new_dir_name
mkuniqdir() {
    local dir="$1"
    local prefix="$2"
    local retdir
    local retdir_new

    [ -d "${dir}" ] || mkdir -m 0755 -p "${dir}" || return 1

    retdir=$(funiq "${dir}" "${prefix}") || return 1
    until mkdir -m 0755 "${retdir}" 2> /dev/null; do
        retdir_new=$(funiq "${dir}" "${prefix}") || return 1
        [ "$retdir_new" = "$retdir" ] && return 1
        retdir="$retdir_new"
    done

    echo "${retdir}"
}

# Copy the contents of SRC into DEST, merging the contents of existing
# directories (kinda like rsync, or cpio -p).
# Creates DEST if it doesn't exist. Overwrites files with the same names.
#
# copytree SRC DEST
copytree() {
    local src="$1" dest="$2"
    [ -d "$src" ] || return 1
    mkdir -p "$dest" || return 1
    dest=$(readlink -e -q "$dest") || return 1
    (
        cd "$src" || exit 1
        cp -af . -t "$dest"
    )
}

# Evaluates command for UUIDs either given as arguments for this function or all
# listed in /dev/disk/by-uuid.  UUIDs doesn't have to be fully specified.  If
# beginning is given it is expanded to all matching UUIDs.  To pass full UUID to
# your command use '$___' as a place holder.  Remember to escape '$'!
#
# foreach_uuid_until [ -p prefix ] command UUIDs
#
# prefix - string to put just before $___
# command - command to be evaluated
# UUIDs - list of UUIDs separated by space
#
# The function returns after *first successful evaluation* of the given command
# with status 0.  If evaluation fails for every UUID function returns with
# status 1.
#
# Example:
# foreach_uuid_until "mount -U \$___ /mnt; echo OK; umount /mnt" \
#       "01234 f512 a235567f-12a3-c123-a1b1-01234567abcb"
foreach_uuid_until() (
    cd /dev/disk/by-uuid || return 1

    [ "$1" = -p ] && local prefix="$2" && shift 2
    local cmd="$1"
    shift
    local uuids_list="$*"
    local uuid
    local full_uuid
    local ___

    [ -n "${cmd}" ] || return 1

    for uuid in ${uuids_list:-*}; do
        for full_uuid in "${uuid}"*; do
            [ -e "${full_uuid}" ] || continue
            # shellcheck disable=SC2034
            ___="${prefix}${full_uuid}"
            eval "${cmd}" && return 0
        done
    done

    return 1
)

# Get kernel name for given device.  Device may be the name too (then the same
# is returned), a symlink (full path), UUID (prefixed with "UUID=") or label
# (prefixed with "LABEL=").  If just a beginning of the UUID is specified or
# even an empty, function prints all device names which UUIDs match - every in
# single line.
#
# NOTICE: The name starts with "/dev/".
#
# Example:
#   devnames UUID=123
# May print:
#   /dev/dm-1
#   /dev/sdb1
#   /dev/sdf3
devnames() {
    local dev="$1"
    local d
    local names

    case "$dev" in
        UUID=*)
            # shellcheck disable=SC2016
            dev="$(foreach_uuid_until '! blkid -U $___' "${dev#UUID=}")" \
                && return 255
            [ -z "$dev" ] && return 255
            ;;
        LABEL=*) dev="$(blkid -L "${dev#LABEL=}")" || return 255 ;;
        /dev/?*) ;;
        *) return 255 ;;
    esac

    for d in $dev; do
        names="$names
$(readlink -e -q "$d")" || return 255
    done

    echo "${names#
}"
}

usable_root() {
    local _i

    [ -d "$1" ] || return 1

    for _i in "$1"/usr/lib*/ld-*.so "$1"/lib*/ld-*.so; do
        [ -e "$_i" ] && return 0
    done

    for _i in proc sys dev; do
        [ -e "$1"/$_i ] || return 1
    done

    return 0
}

inst_hook() {
    local _hookname _unique _name _job _exe
    while [ $# -gt 0 ]; do
        case "$1" in
            --hook)
                _hookname="/$2"
                shift
                ;;
            --unique)
                _unique="yes"
                ;;
            --name)
                _name="$2"
                shift
                ;;
            *)
                break
                ;;
        esac
        shift
    done

    if [ -z "$_unique" ]; then
        _job="${_name}$$"
    else
        _job="${_name:-$1}"
        _job=${_job##*/}
    fi

    _exe=$1
    shift

    [ -x "$_exe" ] || _exe=$(command -v "$_exe")

    if [ -n "$onetime" ]; then
        {
            # shellcheck disable=SC2016
            echo '[ -e "$_job" ] && rm -f -- "$_job"'
            echo "$_exe $*"
        } > "/tmp/$$-${_job}.sh"
    else
        echo "$_exe $*" > "/tmp/$$-${_job}.sh"
    fi

    mv -f "/tmp/$$-${_job}.sh" "$hookdir/${_hookname}/${_job}.sh"
}

# inst_mount_hook <mountpoint> <prio> <name> <script>
#
# Install a mount hook with priority <prio>,
# which executes <script> as soon as <mountpoint> is mounted.
inst_mount_hook() {
    local _prio="$2" _jobname="$3" _script="$4"
    local _hookname
    _hookname="mount-$(str_replace "$1" '/' '\\x2f')"
    [ -d "$hookdir/${_hookname}" ] || mkdir -p "$hookdir/${_hookname}"
    inst_hook --hook "$_hookname" --unique --name "${_prio}-${_jobname}" "$_script"
}

# wait_for_mount <mountpoint>
#
# Installs a initqueue-finished script,
# which will cause the main loop only to exit,
# if <mountpoint> is mounted.
wait_for_mount() {
    local _name
    _name="$(str_replace "$1" '/' '\\x2f')"
    printf '. /lib/dracut-lib.sh\nismounted "%s"\n' "$1" \
        >> "$hookdir/initqueue/finished/ismounted-${_name}.sh"
    {
        printf 'ismounted "%s" || ' "$1"
        printf 'warn "\"%s\" is not mounted"\n' "$1"
    } >> "$hookdir/emergency/90-${_name}.sh"
}

killproc() {
    debug_off
    local _exe
    _exe="$(command -v "$1")"
    local _sig=$2
    local _i
    [ -x "$_exe" ] || return 1
    for _i in /proc/[0-9]*; do
        [ "$_i" = "/proc/1" ] && continue
        if [ -e "$_i"/_exe ] && [ "$_i/_exe" -ef "$_exe" ]; then
            kill "$_sig" "${_i##*/}"
        fi
    done
    debug_on
}

need_shutdown() {
    : > /run/initramfs/.need_shutdown
}

wait_for_loginit() {
    [ "$RD_DEBUG" = "yes" ] || return
    [ -e /run/initramfs/loginit.pipe ] || return
    debug_off
    echo "DRACUT_LOG_END"
    exec 0<> /dev/console 1<> /dev/console 2<> /dev/console
    # wait for loginit
    i=0
    while [ $i -lt 10 ]; do
        if [ ! -e /run/initramfs/loginit.pipe ]; then
            j=$(jobs)
            [ -z "$j" ] && break
            [ -z "${j##*Running*}" ] || break
        fi
        sleep 0.1
        i=$((i + 1))
    done

    if [ $i -eq 10 ]; then
        kill %1 > /dev/null 2>&1
        kill "$(while read -r line || [ -n "$line" ]; do echo "$line"; done < /run/initramfs/loginit.pid)"
    fi

    setdebug
    rm -f -- /run/initramfs/loginit.pipe /run/initramfs/loginit.pid
}

# pidof version for root
if ! command -v pidof > /dev/null 2> /dev/null; then
    pidof() {
        debug_off
        local _cmd
        local _exe
        local _rl
        local _ret=1
        local i
        _cmd="$1"
        if [ -z "$_cmd" ]; then
            debug_on
            return 1
        fi
        _exe=$(command -v "$1")
        for i in /proc/*/exe; do
            [ -e "$i" ] || continue
            if [ -n "$_exe" ]; then
                [ "$i" -ef "$_exe" ] || continue
            else
                _rl=$(readlink -f "$i")
                [ "${_rl%/$_cmd}" != "$_rl" ] || continue
            fi
            i=${i%/exe}
            echo "${i##/proc/}"
            _ret=0
        done
        debug_on
        return $_ret
    }
fi

_emergency_shell() {
    local _name="$1"
    if [ -n "$DRACUT_SYSTEMD" ]; then
        : > /.console_lock
        echo "PS1=\"$_name:\\\${PWD}# \"" > /etc/profile
        systemctl start dracut-emergency.service
        rm -f -- /etc/profile
        rm -f -- /.console_lock
    else
        debug_off
        source_hook "$hook"
        echo
        /sbin/rdsosreport
        echo 'You might want to save "/run/initramfs/rdsosreport.txt" to a USB stick or /boot'
        echo 'after mounting them and attach it to a bug report.'
        if ! RD_DEBUG='' getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
            echo
            echo 'To get more debug information in the report,'
            echo 'reboot with "rd.debug" added to the kernel command line.'
        fi
        echo
        echo 'Dropping to debug shell.'
        echo
        export PS1="$_name:\${PWD}# "
        [ -e /.profile ] || : > /.profile

        _ctty="$(RD_DEBUG='' getarg rd.ctty=)" && _ctty="/dev/${_ctty##*/}"
        if [ -z "$_ctty" ]; then
            _ctty=console
            while [ -f /sys/class/tty/$_ctty/active ]; do
                _ctty=$(cat /sys/class/tty/$_ctty/active)
                _ctty=${_ctty##* } # last one in the list
            done
            _ctty=/dev/$_ctty
        fi
        [ -c "$_ctty" ] || _ctty=/dev/tty1
        case "$(/usr/bin/setsid --help 2>&1)" in *--ctty*) CTTY="--ctty" ;; esac
        setsid $CTTY /bin/sh -i -l 0<> $_ctty 1<> $_ctty 2<> $_ctty
    fi
}

emergency_shell() {
    local _ctty
    set +e
    local _rdshell_name="dracut" action="Boot" hook="emergency"
    local _emergency_action

    if [ "$1" = "-n" ]; then
        _rdshell_name=$2
        shift 2
    elif [ "$1" = "--shutdown" ]; then
        _rdshell_name=$2
        action="Shutdown"
        hook="shutdown-emergency"
        if type plymouth > /dev/null 2>&1; then
            plymouth --hide-splash
        elif [ -x /oldroot/bin/plymouth ]; then
            /oldroot/bin/plymouth --hide-splash
        fi
        shift 2
    fi

    echo
    echo
    warn "$*"
    echo

    _emergency_action=$(getarg rd.emergency)
    [ -z "$_emergency_action" ] \
        && [ -e /run/initramfs/.die ] \
        && _emergency_action=halt

    if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
        _emergency_shell "$_rdshell_name"
    else
        source_hook "$hook"
        warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line."
        [ -z "$_emergency_action" ] && _emergency_action=halt
    fi

    case "$_emergency_action" in
        reboot)
            reboot || exit 1
            ;;
        poweroff)
            poweroff || exit 1
            ;;
        halt)
            halt || exit 1
            ;;
    esac
}

# Retain the values of these variables but ensure that they are unexported
# This is a POSIX-compliant equivalent of bash's "export -n"
export_n() {
    local var
    local val
    for var in "$@"; do
        eval val=\$$var
        unset $var
        [ -n "$val" ] && eval "$var=\"$val\""
    done
}

# returns OK if list1 contains all elements of list2, i.e. checks if list2 is a
# sublist of list1.  An order and a duplication doesn't matter.
#
# $1 = separator
# $2 = list1
# $3 = list2
# $4 = ignore values, separated by $1
listlist() {
    local _sep="$1"
    local _list="${_sep}${2}${_sep}"
    local _sublist="$3"
    [ -n "$4" ] && local _iglist="${_sep}${4}${_sep}"
    local IFS="$_sep"
    local _v

    [ "$_list" = "$_sublist" ] && return 0

    for _v in $_sublist; do
        if [ -n "$_v" ] && ! ([ -n "$_iglist" ] && strstr "$_iglist" "$_v"); then
            strstr "$_list" "$_v" || return 1
        fi
    done

    return 0
}

# returns OK if both lists contain the same values.  An order and a duplication
# doesn't matter.
#
# $1 = separator
# $2 = list1
# $3 = list2
# $4 = ignore values, separated by $1
are_lists_eq() {
    listlist "$1" "$2" "$3" "$4" && listlist "$1" "$3" "$2" "$4"
}

setmemdebug() {
    if [ -z "$DEBUG_MEM_LEVEL" ]; then
        DEBUG_MEM_LEVEL=$(getargnum 0 0 5 rd.memdebug)
        export DEBUG_MEM_LEVEL
    fi
}

setmemdebug

# parameters: func log_level prefix msg [trace_level:trace]...
make_trace_mem() {
    local log_level prefix msg msg_printed
    local trace trace_level trace_in_higher_levels insert_trace

    msg=$1
    shift

    prefix='[debug_mem]'
    log_level=$DEBUG_MEM_LEVEL

    if [ -z "$log_level" ] || [ "$log_level" -le 0 ]; then
        return
    fi

    # FIXME? useless echo?
    # shellcheck disable=SC2116
    msg=$(echo "$msg")

    msg_printed=0
    while [ $# -gt 0 ]; do
        trace=${1%%:*}
        trace_level=${trace%%+}
        [ "$trace" != "$trace_level" ] && trace_in_higher_levels="yes"
        trace=${1##*:}

        if [ -z "$trace_level" ]; then
            trace_level=0
        fi

        insert_trace=0
        if [ -n "$trace_in_higher_levels" ]; then
            if [ "$log_level" -ge "$trace_level" ]; then
                insert_trace=1
            fi
        else
            if [ "$log_level" -eq "$trace_level" ]; then
                insert_trace=1
            fi
        fi

        if [ $insert_trace -eq 1 ]; then
            if [ $msg_printed -eq 0 ]; then
                echo "$prefix $msg"
                msg_printed=1
            fi
            show_memstats "$trace"
        fi
        shift
    done
}

# parameters: type
show_memstats() {
    case $1 in
        shortmem)
            grep -e "^MemFree" -e "^Cached" -e "^Slab" /proc/meminfo
            ;;
        mem)
            cat /proc/meminfo
            ;;
        slab)
            cat /proc/slabinfo
            ;;
        iomem)
            cat /proc/iomem
            ;;
    esac
}

remove_hostonly_files() {
    rm -fr /etc/cmdline /etc/cmdline.d/*.conf "$hookdir/initqueue/finished"
    if [ -f /lib/dracut/hostonly-files ]; then
        while read -r line || [ -n "$line" ]; do
            [ -e "$line" ] || [ -h "$line" ] || continue
            rm -f "$line"
        done < /lib/dracut/hostonly-files
    fi
}
 07070100000202000081ED00000000000000000000000164DF2CB800002E7C000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/modules.d/99base/init.sh    #!/bin/sh
#
# Licensed under the GPLv2
#
# Copyright 2008-2010, Red Hat, Inc.
# Harald Hoyer <harald@redhat.com>
# Jeremy Katz <katzj@redhat.com>

export -p > /tmp/export.orig

NEWROOT="/sysroot"
[ -d $NEWROOT ] || mkdir -p -m 0755 $NEWROOT

OLDPATH=$PATH
PATH=/usr/sbin:/usr/bin:/sbin:/bin
export PATH

# mount some important things
if [ ! -d /proc/self ]; then
    if ! mount -t proc -o nosuid,noexec,nodev proc /proc > /dev/null; then
        echo "Cannot mount proc on /proc! Compile the kernel with CONFIG_PROC_FS!"
        exit 1
    fi
fi

if [ ! -d /sys/kernel ]; then
    if ! mount -t sysfs -o nosuid,noexec,nodev sysfs /sys > /dev/null; then
        echo "Cannot mount sysfs on /sys! Compile the kernel with CONFIG_SYSFS!"
        exit 1
    fi
fi

RD_DEBUG=""
. /lib/dracut-lib.sh

setdebug

if ! ismounted /dev; then
    mount -t devtmpfs -o mode=0755,noexec,nosuid,strictatime devtmpfs /dev > /dev/null
fi

if ! ismounted /dev; then
    echo "Cannot mount devtmpfs on /dev! Compile the kernel with CONFIG_DEVTMPFS!"
    exit 1
fi

# prepare the /dev directory
[ ! -h /dev/fd ] && ln -s /proc/self/fd /dev/fd > /dev/null 2>&1
[ ! -h /dev/stdin ] && ln -s /proc/self/fd/0 /dev/stdin > /dev/null 2>&1
[ ! -h /dev/stdout ] && ln -s /proc/self/fd/1 /dev/stdout > /dev/null 2>&1
[ ! -h /dev/stderr ] && ln -s /proc/self/fd/2 /dev/stderr > /dev/null 2>&1

if ! ismounted /dev/pts; then
    mkdir -m 0755 -p /dev/pts
    mount -t devpts -o gid=5,mode=620,noexec,nosuid devpts /dev/pts > /dev/null
fi

if ! ismounted /dev/shm; then
    mkdir -m 0755 -p /dev/shm
    mount -t tmpfs -o mode=1777,noexec,nosuid,nodev,strictatime tmpfs /dev/shm > /dev/null
fi

if ! ismounted /run; then
    mkdir -m 0755 -p /newrun
    if ! str_starts "$(readlink -f /bin/sh)" "/run/"; then
        mount -t tmpfs -o mode=0755,noexec,nosuid,nodev,strictatime tmpfs /newrun > /dev/null
    else
        # the initramfs binaries are located in /run, so don't mount it with noexec
        mount -t tmpfs -o mode=0755,nosuid,nodev,strictatime tmpfs /newrun > /dev/null
    fi
    cp -a /run/* /newrun > /dev/null 2>&1
    mount --move /newrun /run
    rm -fr -- /newrun
fi

if command -v kmod > /dev/null 2> /dev/null; then
    kmod static-nodes --format=tmpfiles 2> /dev/null \
        | while read -r type file mode _ _ _ majmin || [ -n "$type" ]; do
            type=${type%\!}
            case $type in
                d)
                    mkdir -m "$mode" -p "$file"
                    ;;
                c)
                    mknod -m "$mode" "$file" "$type" "${majmin%:*}" "${majmin#*:}"
                    ;;
            esac
        done
fi

trap "emergency_shell Signal caught!" 0

export UDEVRULESD=/run/udev/rules.d
[ -d /run/udev ] || mkdir -p -m 0755 /run/udev
[ -d "$UDEVRULESD" ] || mkdir -p -m 0755 "$UDEVRULESD"

if [ "$RD_DEBUG" = "yes" ]; then
    mkfifo /run/initramfs/loginit.pipe
    loginit "$DRACUT_QUIET" < /run/initramfs/loginit.pipe > /dev/console 2>&1 &
    exec > /run/initramfs/loginit.pipe 2>&1
else
    exec 0<> /dev/console 1<> /dev/console 2<> /dev/console
fi

[ -f /usr/lib/initrd-release ] && . /usr/lib/initrd-release
[ -n "$VERSION_ID" ] && info "$NAME-$VERSION_ID"

source_conf /etc/conf.d

if getarg "rd.cmdline=ask"; then
    echo "Enter additional kernel command line parameter (end with ctrl-d or .)"
    while read -r -p "> " ${BASH:+-e} line || [ -n "$line" ]; do
        [ "$line" = "." ] && break
        echo "$line" >> /etc/cmdline.d/99-cmdline-ask.conf
    done
fi

if ! getargbool 1 'rd.hostonly'; then
    [ -f /etc/cmdline.d/99-cmdline-ask.conf ] && mv /etc/cmdline.d/99-cmdline-ask.conf /tmp/99-cmdline-ask.conf
    remove_hostonly_files
    [ -f /tmp/99-cmdline-ask.conf ] && mv /tmp/99-cmdline-ask.conf /etc/cmdline.d/99-cmdline-ask.conf
fi

# run scriptlets to parse the command line
make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab'
getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
source_hook cmdline

[ -z "$root" ] && die "No or empty root= argument"
[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"

export root rflags fstype netroot NEWROOT

# pre-udev scripts run before udev starts, and are run only once.
make_trace_mem "hook pre-udev" '1:shortmem' '2+:mem' '3+:slab'
getarg 'rd.break=pre-udev' -d 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break before pre-udev"
source_hook pre-udev

UDEV_LOG=err
getargbool 0 rd.udev.info -d -y rdudevinfo && UDEV_LOG=info
getargbool 0 rd.udev.debug -d -y rdudevdebug && UDEV_LOG=debug

# start up udev and trigger cold plugs
UDEV_LOG=$UDEV_LOG "$systemdutildir"/systemd-udevd --daemon --resolve-names=never

UDEV_QUEUE_EMPTY="udevadm settle --timeout=0"

udevproperty "hookdir=$hookdir"

make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab'
getarg 'rd.break=pre-trigger' -d 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger"
source_hook pre-trigger

udevadm control --reload > /dev/null 2>&1 || :
# then the rest
udevadm trigger --type=subsystems --action=add > /dev/null 2>&1
udevadm trigger --type=devices --action=add > /dev/null 2>&1

make_trace_mem "hook initqueue" '1:shortmem' '2+:mem' '3+:slab'
getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"

RDRETRY=$(getarg rd.retry -d 'rd_retry=')
RDRETRY=${RDRETRY:-180}
RDRETRY=$((RDRETRY * 2))
export RDRETRY
main_loop=0
export main_loop
while :; do

    check_finished && break

    udevsettle

    check_finished && break

    if [ -f "$hookdir"/initqueue/work ]; then
        rm -f -- "$hookdir"/initqueue/work
    fi

    for job in "$hookdir"/initqueue/*.sh; do
        [ -e "$job" ] || break
        # shellcheck disable=SC2097 disable=SC1090 disable=SC2098
        job=$job . "$job"
        check_finished && break 2
    done

    $UDEV_QUEUE_EMPTY > /dev/null 2>&1 || continue

    for job in "$hookdir"/initqueue/settled/*.sh; do
        [ -e "$job" ] || break
        # shellcheck disable=SC2097 disable=SC1090 disable=SC2098
        job=$job . "$job"
        check_finished && break 2
    done

    $UDEV_QUEUE_EMPTY > /dev/null 2>&1 || continue

    # no more udev jobs and queues empty.
    sleep 0.5

    if [ $main_loop -gt $((2 * RDRETRY / 3)) ]; then
        for job in "$hookdir"/initqueue/timeout/*.sh; do
            [ -e "$job" ] || break
            # shellcheck disable=SC2097 disable=SC1090 disable=SC2098
            job=$job . "$job"
            udevadm settle --timeout=0 > /dev/null 2>&1 || main_loop=0
            [ -f "$hookdir"/initqueue/work ] && main_loop=0
        done
    fi

    main_loop=$((main_loop + 1))
    [ $main_loop -gt $RDRETRY ] \
        && {
            flock -s 9
            emergency_shell "Could not boot."
        } 9> /.console_lock
done
unset job
unset queuetriggered
unset main_loop
unset RDRETRY

# pre-mount happens before we try to mount the root filesystem,
# and happens once.
make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab'
getarg 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
source_hook pre-mount

getarg 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break mount"
# mount scripts actually try to mount the root filesystem, and may
# be sourced any number of times. As soon as one suceeds, no more are sourced.
_i_mount=0
while :; do
    if ismounted "$NEWROOT"; then
        usable_root "$NEWROOT" && break
        umount "$NEWROOT"
    fi
    for f in "$hookdir"/mount/*.sh; do
        # shellcheck disable=SC1090
        [ -f "$f" ] && . "$f"
        if ismounted "$NEWROOT"; then
            usable_root "$NEWROOT" && break
            warn "$NEWROOT has no proper rootfs layout, ignoring and removing offending mount hook"
            umount "$NEWROOT"
            rm -f -- "$f"
        fi
    done

    _i_mount=$((_i_mount + 1))
    [ $_i_mount -gt 20 ] \
        && {
            flock -s 9
            emergency_shell "Can't mount root filesystem"
        } 9> /.console_lock
done

{
    printf "Mounted root filesystem "
    while read -r dev mp _ || [ -n "$dev" ]; do [ "$mp" = "$NEWROOT" ] && echo "$dev"; done < /proc/mounts
} | vinfo

# pre pivot scripts are sourced just before we doing cleanup and switch over
# to the new root.
make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab'
getarg 'rd.break=pre-pivot' -d 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot"
source_hook pre-pivot

make_trace_mem "hook cleanup" '1:shortmem' '2+:mem' '3+:slab'
# pre pivot cleanup scripts are sourced just before we switch over to the new root.
getarg 'rd.break=cleanup' -d 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup"
source_hook cleanup

# By the time we get here, the root filesystem should be mounted.
# Try to find init.
for i in "$(getarg real_init=)" "$(getarg init=)" $(getargs rd.distroinit=) /sbin/init; do
    [ -n "$i" ] || continue

    __p="${NEWROOT}/${i}"
    if [ -h "$__p" ]; then
        # relative links need to be left alone,
        # while absolute links need to be resolved and prefixed.
        __pt=$(readlink "$__p")
        [ "${__pt#/}" = "$__pt" ] || __p="${NEWROOT}/$__pt"
    fi
    if [ -x "$__p" ]; then
        INIT="$i"
        break
    fi
done

[ "$INIT" ] || {
    echo "Cannot find init!"
    echo "Please check to make sure you passed a valid root filesystem!"
    emergency_shell
}

udevadm control --exit
udevadm info --cleanup-db

debug_off # Turn off debugging for this section

# unexport some vars
export_n root rflags fstype netroot NEWROOT
unset CMDLINE
export RD_TIMESTAMP
# Clean up the environment
for i in $(export -p); do
    i=${i#declare -x}
    i=${i#export}
    strstr "$i" "=" || continue
    i=${i%%=*}
    [ -z "$i" ] && continue
    case $i in
        root | PATH | HOME | TERM | PS4 | RD_*)
            :
            ;;
        *)
            unset "$i"
            ;;
    esac
done
. /tmp/export.orig 2> /dev/null || :
rm -f -- /tmp/export.orig

initargs=""
read -r CLINE < /proc/cmdline
if getarg init= > /dev/null; then
    ignoreargs="console BOOT_IMAGE"
    # only pass arguments after init= to the init
    CLINE=${CLINE#*init=}
    set -- "$CLINE"
    shift # clear out the rest of the "init=" arg
    for x in "$@"; do
        for s in $ignoreargs; do
            [ "${x%%=*}" = "$s" ] && continue 2
        done
        initargs="$initargs $x"
    done
    unset CLINE
else
    debug_off # Turn off debugging for this section
    set -- "$CLINE"
    for x in "$@"; do
        case "$x" in
            [0-9] | s | S | single | emergency | auto)
                initargs="$initargs $x"
                ;;
        esac
    done
fi
debug_on

if ! [ -d "$NEWROOT"/run ]; then
    NEWRUN=/dev/.initramfs
    mkdir -m 0755 -p "$NEWRUN"
    mount --rbind /run/initramfs "$NEWRUN"
fi

wait_for_loginit

# remove helper symlink
[ -h /dev/root ] && rm -f -- /dev/root

bv=$(getarg rd.break -d rdbreak) && [ -z "$bv" ] \
    && emergency_shell -n switch_root "Break before switch_root"
unset bv
info "Switching root"

unset PS4

CAPSH=$(command -v capsh)
SWITCH_ROOT=$(command -v switch_root)
PATH=$OLDPATH
export PATH

if [ -f /etc/capsdrop ]; then
    . /etc/capsdrop
    info "Calling $INIT with capabilities $CAPS_INIT_DROP dropped."
    unset RD_DEBUG
    exec "$CAPSH" --drop="$CAPS_INIT_DROP" -- \
        -c "exec switch_root \"$NEWROOT\" \"$INIT\" $initargs" \
        || {
            warn "Command:"
            warn capsh --drop="$CAPS_INIT_DROP" -- -c exec switch_root "$NEWROOT" "$INIT" "$initargs"
            warn "failed."
            emergency_shell
        }
else
    unset RD_DEBUG
    exec "$SWITCH_ROOT" "$NEWROOT" "$INIT" "$initargs" || {
        warn "Something went very badly wrong in the initramfs.  Please "
        warn "file a bug against dracut."
        emergency_shell
    }
fi
07070100000203000081ED00000000000000000000000164DF2CB80000053D000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/modules.d/99base/initqueue.sh   #!/bin/sh
#
# Licensed under the GPLv2+
#
# Copyright 2008-2010, Red Hat, Inc.
# Harald Hoyer <harald@redhat.com>

PATH=/usr/sbin:/usr/bin:/sbin:/bin

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

while [ $# -gt 0 ]; do
    case "$1" in
        --onetime)
            onetime="yes"
            ;;
        --online)
            qname="/online"
            ;;
        --settled)
            qname="/settled"
            ;;
        --finished)
            qname="/finished"
            ;;
        --timeout)
            qname="/timeout"
            ;;
        --unique)
            unique="yes"
            ;;
        --name)
            name="$2"
            shift
            ;;
        --env)
            env="$2"
            shift
            ;;
        *)
            break
            ;;
    esac
    shift
done

if [ -z "$unique" ]; then
    job="${name}$$"
else
    job="${name:-$1}"
    job=${job##*/}
fi

exe=$1
shift

[ -x "$exe" ] || exe=$(command -v "$exe")
if [ -z "$exe" ]; then
    echo "Invalid command"
    exit 1
fi

{
    # shellcheck disable=SC2016
    [ -n "$onetime" ] && echo '[ -e "$job" ] && rm -f -- "$job"'
    [ -n "$env" ] && echo "$env"
    echo "$exe" "$@"
} > "/tmp/$$-${job}.sh"

mv -f "/tmp/$$-${job}.sh" "$hookdir/initqueue${qname}/${job}.sh"
[ -z "$qname" ] && : >> "$hookdir"/initqueue/work
exit 0
   07070100000204000081ED00000000000000000000000164DF2CB800000210000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/modules.d/99base/loginit.sh #!/bin/sh

# turn off debugging
set +x

QUIET=$1

printf "%s" "$$" > /run/initramfs/loginit.pid

# shellcheck disable=SC2015
[ -e /dev/kmsg ] && exec 5> /dev/kmsg || exec 5> /dev/null
exec 6> /run/initramfs/init.log

while read -r line || [ -n "$line" ]; do
    if [ "$line" = "DRACUT_LOG_END" ]; then
        rm -f -- /run/initramfs/loginit.pipe
        exit 0
    fi
    echo "<31>dracut: $line" >&5
    # if "quiet" is specified we output to /dev/console
    [ -n "$QUIET" ] || echo "dracut: $line"
    echo "$line" >&6
done
07070100000205000081ED00000000000000000000000164DF2CB800001502000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/99base/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    return 0
}

# called by dracut
depends() {
    echo udev-rules
    return 0
}

# called by dracut
install() {
    inst_multiple mount mknod mkdir sleep chroot chown \
        sed ls flock cp mv dmesg rm ln rmmod mkfifo umount readlink setsid \
        modprobe chmod

    inst_multiple -o findmnt less kmod

    inst_binary "${dracutsysrootdir}${dracutbasedir}/dracut-util" "/usr/bin/dracut-util"

    ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
    ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

    if [ ! -e "${initdir}/bin/sh" ]; then
        inst_multiple bash
        (ln -s bash "${initdir}/bin/sh" || :)
    fi

    # add common users in /etc/passwd, it will be used by nfs/ssh currently
    # use password for hostonly images to facilitate secure sulogin in emergency console
    [[ $hostonly ]] && pwshadow='x'
    grep '^root:' "$initdir/etc/passwd" 2> /dev/null || echo "root:$pwshadow:0:0::/root:/bin/sh" >> "$initdir/etc/passwd"
    grep '^nobody:' "$dracutsysrootdir"/etc/passwd >> "$initdir/etc/passwd"

    [[ $hostonly ]] && grep '^root:' "$dracutsysrootdir"/etc/shadow >> "$initdir/etc/shadow"

    # install our scripts and hooks
    inst_script "$moddir/init.sh" "/init"
    inst_script "$moddir/initqueue.sh" "/sbin/initqueue"
    inst_script "$moddir/loginit.sh" "/sbin/loginit"
    inst_script "$moddir/rdsosreport.sh" "/sbin/rdsosreport"

    [ -e "${initdir}/lib" ] || mkdir -m 0755 -p "${initdir}"/lib
    mkdir -m 0755 -p "${initdir}"/lib/dracut
    mkdir -m 0755 -p "${initdir}"/lib/dracut/hooks

    mkdir -p "${initdir}"/tmp

    inst_simple "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
    inst_simple "$moddir/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
    mkdir -p "${initdir}"/var

    if ! dracut_module_included "systemd"; then
        inst_multiple switch_root || dfatal "Failed to install switch_root"
        inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
        inst_multiple -o "$systemdutildir"/systemd-timestamp
    fi

    if [[ $realinitpath ]]; then
        for i in $realinitpath; do
            echo "rd.distroinit=$i"
        done > "${initdir}/etc/cmdline.d/distroinit.conf"
    fi

    ln -fs /proc/self/mounts "$initdir/etc/mtab"
    if [[ $ro_mnt == yes ]]; then
        echo ro >> "${initdir}/etc/cmdline.d/base.conf"
    fi

    [ -e "${initdir}/usr/lib" ] || mkdir -m 0755 -p "${initdir}"/usr/lib

    local VERSION=""
    local PRETTY_NAME=""
    # Derive an os-release file from the host, if it exists
    if [[ -e $dracutsysrootdir/etc/os-release ]]; then
        # shellcheck disable=SC1090
        . "$dracutsysrootdir"/etc/os-release
        grep -hE -ve '^VERSION=' -ve '^PRETTY_NAME' "$dracutsysrootdir"/etc/os-release > "${initdir}"/usr/lib/initrd-release
        [[ -n ${VERSION} ]] && VERSION+=" "
        [[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" "
    else
        # Fall back to synthesizing one, since dracut is presently used
        # on non-systemd systems as well.
        {
            echo "NAME=dracut"
            echo "ID=dracut"
            echo "VERSION_ID=\"$DRACUT_VERSION\""
            echo 'ANSI_COLOR="0;34"'
        } > "${initdir}"/usr/lib/initrd-release
    fi
    VERSION+="dracut-$DRACUT_VERSION"
    PRETTY_NAME+="dracut-$DRACUT_VERSION (Initramfs)"
    {
        echo "VERSION=\"$VERSION\""
        echo "PRETTY_NAME=\"$PRETTY_NAME\""
        # This addition is relatively new, intended to allow software
        # to easily detect the dracut version if need be without
        # having it mixed in with the real underlying OS version.
        echo "DRACUT_VERSION=\"${DRACUT_VERSION}\""
    } >> "$initdir"/usr/lib/initrd-release
    echo "dracut-$DRACUT_VERSION" > "$initdir/lib/dracut/dracut-$DRACUT_VERSION"
    ln -sf ../usr/lib/initrd-release "$initdir"/etc/initrd-release
    ln -sf initrd-release "$initdir"/usr/lib/os-release
    ln -sf initrd-release "$initdir"/etc/os-release

    ## save host_devs which we need bring up
    if [[ $hostonly_cmdline == "yes" ]]; then
        if [[ -n ${host_devs[*]} ]]; then
            dracut_need_initqueue
        fi
        if [[ -f $initdir/lib/dracut/need-initqueue ]] || ! dracut_module_included "systemd"; then
            (
                if dracut_module_included "systemd"; then
                    export DRACUT_SYSTEMD=1
                fi
                export PREFIX="$initdir"
                export hookdir=/lib/dracut/hooks

                # shellcheck source=dracut-dev-lib.sh
                . "$moddir/dracut-dev-lib.sh"

                for _dev in "${host_devs[@]}"; do
                    for _dev2 in "${root_devs[@]}"; do
                        [[ $_dev == "$_dev2" ]] && continue 2
                    done

                    # We only actually wait for real devs - swap is only needed
                    # for resume and udev rules generated when parsing resume=
                    # argument take care of the waiting for us
                    for _dev2 in "${swap_devs[@]}"; do
                        [[ $_dev == "$_dev2" ]] && continue 2
                    done

                    _pdev=$(get_persistent_dev "$_dev")

                    case "$_pdev" in
                        /dev/?*) wait_for_dev "$_pdev" 0 ;;
                        *) ;;
                    esac
                done
            )
        fi
    fi
}
  07070100000206000081ED00000000000000000000000164DF2CB800000111000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/modules.d/99base/parse-root-opts.sh #!/bin/sh

# shellcheck disable=SC2034
root=$(getarg root=)

rflags="$(getarg rootflags=)"
getargbool 0 ro && rflags="${rflags},ro"
getargbool 0 rw && rflags="${rflags},rw"
rflags="${rflags#,}"

fstype="$(getarg rootfstype=)"
if [ -z "$fstype" ]; then
    fstype="auto"
fi
   07070100000207000081ED00000000000000000000000164DF2CB8000005AA000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/modules.d/99base/rdsosreport.sh #!/bin/sh

echo 'Generating "/run/initramfs/rdsosreport.txt"'

[ -d /run/initramfs ] || mkdir -p /run/initramfs

exec > /run/initramfs/rdsosreport.txt 2>&1

PWFILTER='s/\(ftp:\/\/.*\):.*@/\1:*******@/g;s/\(cifs:\/\/.*\):.*@/\1:*******@/g;s/cifspass=[^ ]*/cifspass=*******/g;s/iscsi:.*@/iscsi:******@/g;s/rd.iscsi.password=[^ ]*/rd.iscsi.password=******/g;s/rd.iscsi.in.password=[^ ]*/rd.iscsi.in.password=******/g'
set -x
cat /lib/dracut/dracut-*

echo "/proc/cmdline"
sed -e "$PWFILTER" /proc/cmdline

if [ -f /etc/cmdline ]; then
    echo "/etc/cmdline"
    sed -e "$PWFILTER" /etc/cmdline
fi

for _i in /etc/cmdline.d/*.conf; do
    [ -f "$_i" ] || break
    echo "$_i"
    sed -e "$PWFILTER" "$_i"
done

cat /proc/self/mountinfo
cat /proc/mounts

blkid
blkid -o udev

ls -l /dev/disk/by*

for _i in /etc/conf.d/*.conf; do
    [ -f "$_i" ] || break
    echo "$_i"
    sed -e "$PWFILTER" "$_i"
done

if command -v lvm > /dev/null 2> /dev/null; then
    lvm pvdisplay
    lvm vgdisplay
    lvm lvdisplay
fi

command -v dmsetup > /dev/null 2> /dev/null && dmsetup ls --tree

cat /proc/mdstat

command -v ip > /dev/null 2> /dev/null && ip addr

if command -v journalctl > /dev/null 2> /dev/null; then
    journalctl -ab --no-pager -o short-monotonic | sed -e "$PWFILTER"
else
    dmesg | sed -e "$PWFILTER"
    if [ -f /run/initramfs/init.log ]; then
        echo "/run/initramfs/init.log"
        sed -e "$PWFILTER" /run/initramfs/init.log
    fi
fi
  07070100000208000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/modules.d/99fs-lib  07070100000209000081ED00000000000000000000000164DF2CB800001A23000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/modules.d/99fs-lib/fs-lib.sh    #!/bin/sh

type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh

fsck_ask_reboot() {
    info "note - fsck suggests reboot, if you"
    info "leave shell, booting will continue normally"
    emergency_shell -n "(reboot ?)"
}

fsck_ask_err() {
    warn "*** An error occurred during the file system check."
    warn "*** Dropping you to a shell; the system will try"
    warn "*** to mount the filesystem(s), when you leave the shell."
    emergency_shell -n "(Repair filesystem)"
}

# inherits: _ret _drv _out
fsck_tail() {
    [ "$_ret" -gt 0 ] && warn "$_drv returned with $_ret"
    if [ "$_ret" -ge 4 ]; then
        [ -n "$_out" ] && echo "$_out" | vwarn
        fsck_ask_err
    else
        [ -n "$_out" ] && echo "$_out" | vinfo
        [ "$_ret" -ge 2 ] && fsck_ask_reboot
    fi
}

# note: this function sets _drv of the caller
fsck_able() {
    case "$1" in
        xfs)
            # {
            #     type xfs_db &&
            #     type xfs_repair &&
            #     type xfs_check &&
            #     type mount &&
            #     type umount
            # } >/dev/null 2>&1 &&
            # _drv="_drv=none fsck_drv_xfs" &&
            # return 0
            return 1
            ;;
        ext?)
            type e2fsck > /dev/null 2>&1 \
                && _drv="fsck_drv_com e2fsck" \
                && return 0
            ;;
        f2fs)
            type fsck.f2fs > /dev/null 2>&1 \
                && _drv="fsck_drv_com fsck.f2fs" \
                && return 0
            ;;
        jfs)
            type jfs_fsck > /dev/null 2>&1 \
                && _drv="fsck_drv_com jfs_fsck" \
                && return 0
            ;;
        reiserfs)
            type reiserfsck > /dev/null 2>&1 \
                && _drv="fsck_drv_com reiserfsck" \
                && return 0
            ;;
        btrfs)
            # type btrfsck >/dev/null 2>&1 &&
            # _drv="_drv=none fsck_drv_btrfs" &&
            # return 0
            return 1
            ;;
        nfs*)
            # nfs can be a nop, returning success
            _drv=":" \
                && return 0
            ;;
        *)
            type fsck > /dev/null 2>&1 \
                && _drv="fsck_drv_std fsck" \
                && return 0
            ;;
    esac

    return 1
}

# note: all drivers inherit: _drv _fop _dev

fsck_drv_xfs() {
    # xfs fsck is not necessary... Either it mounts or not
    return 0
}

fsck_drv_btrfs() {
    # btrfs fsck is not necessary... Either it mounts or not
    return 0
}

# common code for checkers that follow usual subset of options and return codes
fsck_drv_com() {
    local _drv="$1"
    local _ret
    local _out

    if ! strglobin "$_fop" "-[ynap]"; then
        _fop="-a${_fop:+ "$_fop"}"
    fi

    info "issuing $_drv $_fop $_dev"
    # we enforce non-interactive run, so $() is fine
    _out=$($_drv "$_fop" "$_dev")
    _ret=$?
    fsck_tail

    return $_ret
}

# code for generic fsck, if the filesystem checked is "unknown" to us
fsck_drv_std() {
    local _ret
    local _out
    unset _out

    info "issuing fsck $_fop $_dev"
    # note, we don't enforce -a here, thus fsck is being run (in theory)
    # interactively; otherwise some tool might complain about lack of terminal
    # (and using -a might not be safe)
    # shellcheck disable=SC2086
    fsck $_fop "$_dev" > /dev/console 2>&1
    _ret=$?
    fsck_tail

    return $_ret
}

# checks single filesystem, relying on specific "driver"; we don't rely on
# automatic checking based on fstab, so empty one is passed;
# takes 4 arguments - device, filesystem, filesystem options, additional fsck options;
# first 2 arguments are mandatory (fs may be auto or "")
# returns 255 if filesystem wasn't checked at all (e.g. due to lack of
# necessary tools or insufficient options)
fsck_single() {
    local FSTAB_FILE=/etc/fstab.empty
    local _dev="$1"
    local _fs="${2:-auto}"
    local _fop="$4"
    local _drv

    [ $# -lt 2 ] && return 255
    # if UUID= marks more than one device, take only the first one
    [ -e "$_dev" ] || _dev=$(devnames "$_dev" | while read -r line || [ -n "$line" ]; do if [ -n "$line" ]; then
        echo "$line"
        break
    fi; done)
    [ -e "$_dev" ] || return 255
    _fs=$(det_fs "$_dev" "$_fs")
    fsck_able "$_fs" || return 255

    info "Checking $_fs: $_dev"
    export FSTAB_FILE
    eval "$_drv"
    return $?
}

# takes list of filesystems to check in parallel; we don't rely on automatic
# checking based on fstab, so empty one is passed
fsck_batch() {
    local FSTAB_FILE=/etc/fstab.empty
    local _drv=fsck
    local _dev
    local _ret
    local _out

    [ $# -eq 0 ] || ! type fsck > /dev/null 2>&1 && return 255

    info "Checking filesystems (fsck -M -T -a):"
    for _dev in "$@"; do
        info "    $_dev"
    done

    export FSTAB_FILE
    _out="$(fsck -M -T "$@" -- -a)"
    _ret=$?

    fsck_tail

    return $_ret
}

# verify supplied filesystem type:
# if user provided the fs and we couldn't find it, assume user is right
# if we found the fs, assume we're right
det_fs() {
    local _dev="$1"
    local _orig="${2:-auto}"
    local _fs

    _fs=$(udevadm info --query=env --name="$_dev" \
        | while read -r line || [ -n "$line" ]; do
            if str_starts "$line" "ID_FS_TYPE="; then
                echo "${line#ID_FS_TYPE=}"
                break
            fi
        done)
    _fs=${_fs:-auto}

    if [ "$_fs" = "auto" ]; then
        _fs="$_orig"
    fi
    echo "$_fs"
}

write_fs_tab() {
    local _o
    local _rw
    local _root
    local _rootfstype
    local _rootflags
    local _fspassno

    _fspassno="0"
    _root="$1"
    _rootfstype="$2"
    _rootflags="$3"
    [ -z "$_rootfstype" ] && _rootfstype=$(getarg rootfstype=)
    [ -z "$_rootflags" ] && _rootflags=$(getarg rootflags=)

    [ -z "$_rootfstype" ] && _rootfstype="auto"

    if [ -z "$_rootflags" ]; then
        _rootflags="ro,x-initrd.mount"
    else
        _rootflags="ro,$_rootflags,x-initrd.mount"
    fi

    _rw=0

    CMDLINE=$(getcmdline)
    for _o in $CMDLINE; do
        case $_o in
            rw)
                _rw=1
                ;;
            ro)
                _rw=0
                ;;
        esac
    done
    if [ "$_rw" = "1" ]; then
        _rootflags="$_rootflags,rw"
        if ! getargbool 0 rd.skipfsck; then
            _fspassno="1"
        fi
    fi

    if grep -q "$_root /sysroot" /etc/fstab; then
        echo "$_root /sysroot $_rootfstype $_rootflags $_fspassno 0" >> /etc/fstab
    else
        return
    fi

    if type systemctl > /dev/null 2> /dev/null; then
        systemctl daemon-reload
        systemctl --no-block start initrd-root-fs.target
    fi
}
 0707010000020A000081ED00000000000000000000000164DF2CB8000006EB000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/99fs-lib/module-setup.sh  #!/bin/bash

# called by dracut
check() {
    return 0
}

# called by dracut
depends() {
    return 0
}

echo_fs_helper() {
    local fs=$2
    case "$fs" in
        xfs)
            echo -n " xfs_db xfs_repair xfs_check xfs_metadump "
            ;;
        ext?)
            echo -n " e2fsck "
            ;;
        jfs)
            echo -n " jfs_fsck "
            ;;
        reiserfs)
            echo -n " reiserfsck "
            ;;
        btrfs)
            echo -n " btrfsck "
            ;;
    esac

    echo -n " fsck.$fs "
    return 0
}

include_fs_helper_modules() {
    local fs=$2
    case "$fs" in
        xfs | btrfs | ext4 | ext3)
            instmods crc32c
            ;;
        f2fs)
            instmods crc32
            ;;
    esac
}

# called by dracut
installkernel() {
    # xfs/btrfs/ext4 need crc32c, f2fs needs crc32
    if [[ $hostonly ]]; then
        for_each_host_dev_fs include_fs_helper_modules
        :
    else
        instmods crc32c crc32
    fi
}

# called by dracut
install() {
    local _helpers

    inst "$moddir/fs-lib.sh" "/lib/fs-lib.sh"
    : > "${initdir}"/etc/fstab.empty

    [[ $nofscks == "yes" ]] && return

    if [[ $fscks == "${fscks#*[^ ]*}" ]]; then
        _helpers=(
            /sbin/fsck* /usr/sbin/fsck*
            xfs_db xfs_check xfs_repair xfs_metadump
            e2fsck jfs_fsck reiserfsck btrfsck
        )
        if [[ $hostonly ]]; then
            read -r -a _helpers < <(for_each_host_dev_fs echo_fs_helper)
        fi
    else
        read -r -a _helpers <<< "$fscks"
    fi

    _helpers+=(umount mount)

    if [[ ${_helpers[*]} == *e2fsck* ]] && [[ -e $dracutsysrootdir/etc/e2fsck.conf ]]; then
        inst_simple /etc/e2fsck.conf
    fi

    inst_multiple -o "${_helpers[@]}" fsck
}
 0707010000020B000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/modules.d/99img-lib 0707010000020C000081ED00000000000000000000000164DF2CB800000A79000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/modules.d/99img-lib/img-lib.sh  #!/bin/sh
# img-lib.sh: utilities for dealing with archives and filesystem images.
#
# TODO: identify/unpack rpm, deb, maybe others?

# super-simple "file" that only identifies archives.
# works with stdin if $1 is not set.
det_archive() {
    # NOTE: internal echo -e works in ash and bash, but not dash
    local bz xz gz zs
    local headerblock
    bz="BZh"
    # shellcheck disable=SC3037
    xz="$(/bin/echo -e '\xfd7zXZ')"
    # shellcheck disable=SC3037
    gz="$(/bin/echo -e '\x1f\x8b')"
    # shellcheck disable=SC3037
    zs="$(/bin/echo -e '\x28\xB5\x2F\xFD')"
    headerblock="$(dd ${1:+if=$1} bs=262 count=1 2> /dev/null | tr -d '\0')"
    case "$headerblock" in
        $xz*) echo "xz" ;;
        $gz*) echo "gzip" ;;
        $bz*) echo "bzip2" ;;
        $zs*) echo "zstd" ;;
        07070*) echo "cpio" ;;
        *ustar) echo "tar" ;;
    esac
}

# determine filesystem type for a filesystem image
det_fs_img() {
    local dev
    dev=$(losetup --find --show "$1") rv=""
    det_fs "$dev"
    rv=$?
    losetup -d "$dev"
    return $rv
}

# unpack_archive ARCHIVE OUTDIR
# unpack a (possibly compressed) cpio/tar archive
unpack_archive() {
    local img="$1" outdir="$2" archiver="" decompr=""
    local ft
    ft="$(det_archive "$img")"
    case "$ft" in
        xz | gzip | bzip2 | zstd) decompr="$ft -dc" ;;
        cpio | tar) decompr="cat" ;;
        *) return 1 ;;
    esac
    ft="$($decompr "$img" | det_archive)"
    case "$ft" in
        cpio) archiver="cpio -iumd" ;;
        tar) archiver="tar -xf -" ;;
        *) return 2 ;;
    esac
    mkdir -p "$outdir"
    (
        cd "$outdir" || exit
        $decompr | $archiver 2> /dev/null
    ) < "$img"
}

# unpack_fs FSIMAGE OUTDIR
# unpack a filesystem image
unpack_fs() {
    local img="$1" outdir="$2"
    local mnt
    mnt="$(mkuniqdir /tmp unpack_fs.)"
    mount -o loop "$img" "$mnt" || {
        rmdir "$mnt"
        return 1
    }
    mkdir -p "$outdir"
    outdir="$(
        cd "$outdir" || exit
        pwd
    )"
    copytree "$mnt" "$outdir"
    umount "$mnt"
    rmdir "$mnt"
}

# unpack an image file - compressed/uncompressed cpio/tar, filesystem, whatever
# unpack_img IMAGEFILE OUTDIR
unpack_img() {
    local img="$1" outdir="$2"
    [ -r "$img" ] || {
        warn "can't read img!"
        return 1
    }
    [ -n "$outdir" ] || {
        warn "unpack_img: no output dir given"
        return 1
    }

    if [ "$(det_archive "$img")" ]; then
        unpack_archive "$@" || {
            warn "can't unpack archive file!"
            return 1
        }
    else
        unpack_fs "$@" || {
            warn "can't unpack filesystem image!"
            return 1
        }
    fi
}
   0707010000020D000081ED00000000000000000000000164DF2CB8000001A5000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/modules.d/99img-lib/module-setup.sh #!/bin/bash
# module-setup for img-lib

# called by dracut
check() {
    require_binaries tar gzip dd echo tr || return 1
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    inst_multiple tar gzip dd echo tr
    # TODO: make this conditional on a cmdline flag / config option
    inst_multiple -o cpio xz bzip2 zstd
    inst_simple "$moddir/img-lib.sh" "/lib/img-lib.sh"
}
   0707010000020E000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/modules.d/99memstrack   0707010000020F000081ED00000000000000000000000164DF2CB800000130000000000000000000000000000000000000004800000000dracut-055+suse.347.gdcb9bdbf/modules.d/99memstrack/memstrack-report.sh   #!/bin/sh
. /lib/dracut-lib.sh

if ! [ "$DEBUG_MEM_LEVEL" -ge 4 ]; then
    return 0
fi

if command -v systemctl > /dev/null; then
    systemctl stop memstrack.service
else
    pkill --signal INT '[m]emstrack'
    while pgrep -c '[m]emstrack' > /dev/null; do
        sleep 1
    done
fi

cat /.memstrack
07070100000210000081ED00000000000000000000000164DF2CB80000072D000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/modules.d/99memstrack/memstrack-start.sh    #!/bin/bash
# Mount kernel debug fs so debug tools can work.
# memdebug=4 and memdebug=5 requires debug fs to be mounted.
# And there is no need to umount it.

type getargnum > /dev/null 2>&1 || . /lib/dracut-lib.sh

# "sys/kernel/tracing" has the priority if exists.
get_trace_base() {
    # trace access through debugfs would be obsolete if "/sys/kernel/tracing" is available.
    if [ -d "/sys/kernel/tracing" ]; then
        echo "/sys/kernel"
    else
        echo "/sys/kernel/debug"
    fi
}

is_debugfs_ready() {
    [ -f "$(get_trace_base)/tracing/trace" ]
}

prepare_debugfs() {
    local trace_base

    trace_base=$(get_trace_base)
    # old debugfs interface case.
    if ! [ -d "$trace_base/tracing" ]; then
        mount none -t debugfs "$trace_base"
    # new tracefs interface case.
    elif ! [ -f "$trace_base/tracing/trace" ]; then
        mount none -t tracefs "$trace_base/tracing"
    fi

    if ! [ -f "$trace_base/tracing/trace" ]; then
        echo "WARN: failed to mount debugfs"
        return 1
    fi
}

if ! is_debugfs_ready; then
    prepare_debugfs
fi

if [ -n "$DEBUG_MEM_LEVEL" ]; then
    if [ "$DEBUG_MEM_LEVEL" -ge 5 ]; then
        echo "memstrack - will report kernel module memory usage summary and top allocation stack"
        memstrack --report module_summary,module_top --notui --throttle 80 -o /.memstrack &
    elif [ "$DEBUG_MEM_LEVEL" -ge 4 ]; then
        echo "memstrack - will report memory usage summary"
        memstrack --report module_summary --notui --throttle 80 -o /.memstrack &
    else
        exit 0
    fi
fi

PID=$!
RET=$?

if [ $RET -ne 0 ]; then
    echo "Failed to start memstrack, exit status: $RET"
    exit $RET
fi

# Wait a second for memstrack to setup everything, avoid missing any event
sleep 1

echo $PID > /run/memstrack.pid
# bash specific - non posix
disown
   07070100000211000081A400000000000000000000000164DF2CB800000198000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/modules.d/99memstrack/memstrack.service [Unit]
Description=Memstrack Anylazing Service
DefaultDependencies=no
Before=dracut-cmdline.service systemd-udevd.service local-fs-pre.target
IgnoreOnIsolate=true
ConditionKernelCommandLine=|rd.memdebug=4
ConditionKernelCommandLine=|rd.memdebug=5

[Service]
Type=simple
ExecStart=/bin/memstrack-start
PIDFile=/run/memstrack.pid
StandardInput=null
StandardOutput=journal+console
StandardError=journal+console
07070100000212000081ED00000000000000000000000164DF2CB800000298000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/99memstrack/module-setup.sh   #!/bin/bash

check() {
    if ! require_binaries pgrep pkill memstrack; then
        dinfo "memstrack is not available"
        dinfo "If you need to use rd.memdebug>=4, please install memstrack and procps-ng"
        return 1
    fi

    return 0
}

depends() {
    echo systemd bash
    return 0
}

install() {
    inst_multiple pgrep pkill
    inst "/bin/memstrack" "/bin/memstrack"

    inst "$moddir/memstrack-start.sh" "/bin/memstrack-start"
    inst_hook cleanup 99 "$moddir/memstrack-report.sh"

    inst "$moddir/memstrack.service" "$systemdsystemunitdir/memstrack.service"

    $SYSTEMCTL -q --root "$initdir" add-wants initrd.target memstrack.service
}
07070100000213000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003300000000dracut-055+suse.347.gdcb9bdbf/modules.d/99shutdown    07070100000214000081ED00000000000000000000000164DF2CB80000025A000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/99shutdown/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    return 0
}

# called by dracut
depends() {
    echo base
    return 0
}

# called by dracut
install() {
    local _d
    inst_multiple umount poweroff reboot halt losetup stat sleep timeout
    inst_multiple -o kexec
    inst "$moddir/shutdown.sh" "$prefix/shutdown"
    [ -e "${initdir}/lib" ] || mkdir -m 0755 -p "${initdir}"/lib
    mkdir -m 0755 -p "${initdir}"/lib/dracut
    mkdir -m 0755 -p "${initdir}"/lib/dracut/hooks
    for _d in $hookdirs shutdown shutdown-emergency; do
        mkdir -m 0755 -p "${initdir}"/lib/dracut/hooks/"$_d"
    done
}
  07070100000215000081ED00000000000000000000000164DF2CB800001213000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/99shutdown/shutdown.sh    #!/bin/sh
#
# Licensed under the GPLv2
#
# Copyright 2011, Red Hat, Inc.
# Harald Hoyer <harald@redhat.com>
ACTION="$1"

# Before trying to use /dev/console, verify that it exists,
# and that it can actually be used. When console=null is used,
# echo will fail. We do the check in a subshell, because otherwise
# the process will be killed when when running as PID 1.
# shellcheck disable=SC2217
[ -w /dev/console ] \
    && (echo < /dev/console > /dev/null 2> /dev/null) \
    && exec < /dev/console >> /dev/console 2>> /dev/console

export TERM=linux
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
. /lib/dracut-lib.sh

if [ "$(stat -c '%T' -f /)" = "tmpfs" ]; then
    mount -o remount,rw /
fi

mkdir -p /oldsys
for i in sys proc run dev; do
    mkdir -p /oldsys/$i
    mount --move /oldroot/$i /oldsys/$i
done

# if "kexec" was installed after creating the initramfs, we try to copy it from the real root
# libz normally is pulled in via kmod/modprobe and udevadm
if [ "$ACTION" = "kexec" ] && ! command -v kexec > /dev/null 2>&1; then
    for p in /usr/sbin /usr/bin /sbin /bin; do
        cp -a /oldroot/${p}/kexec $p > /dev/null 2>&1 && break
    done
    hash kexec
fi

trap "emergency_shell --shutdown shutdown Signal caught!" 0
getarg 'rd.break=pre-shutdown' && emergency_shell --shutdown pre-shutdown "Break before pre-shutdown"

source_hook pre-shutdown

warn "Killing all remaining processes"

killall_proc_mountpoint /oldroot || sleep 0.2

# Timeout for umount calls. The value can be set to 0 to wait forever.
_umount_timeout=$(getarg rd.shutdown.timeout.umount)
_umount_timeout=${_umount_timeout:-90s}
_timed_out_umounts=""

umount_a() {
    local _verbose="n"
    if [ "$1" = "-v" ]; then
        _verbose="y"
        shift
        exec 7>&2
    else
        exec 7> /dev/null
    fi

    local _did_umount="n"
    while read -r _ mp _ || [ -n "$mp" ]; do
        strstr "$mp" oldroot || continue
        strstr "$_timed_out_umounts" " $mp " && continue

        # Unmount the file system. The operation uses a timeout to avoid waiting
        # indefinitely if this is e.g. a stuck NFS mount. The command is
        # invoked in a subshell to silence also the "Killed" message that might
        # be produced by the shell.
        (
            set +m
            timeout --signal=KILL "$_umount_timeout" umount "$mp"
        ) 2>&7
        local ret=$?
        if [ $ret -eq 0 ]; then
            _did_umount="y"
            warn "Unmounted $mp."
        elif [ $ret -eq 137 ]; then
            _timed_out_umounts="$_timed_out_umounts $mp "
            warn "Unmounting $mp timed out."
        elif [ "$_verbose" = "y" ]; then
            warn "Unmounting $mp failed with status $ret."
        fi
    done < /proc/mounts

    losetup -D 2>&7

    exec 7>&-
    [ "$_did_umount" = "y" ] && return 0
    return 1
}

_cnt=0
while [ $_cnt -le 40 ]; do
    umount_a || break
    _cnt=$((_cnt + 1))
done

[ $_cnt -ge 40 ] && umount_a -v

if strstr "$(cat /proc/mounts)" "/oldroot"; then
    warn "Cannot umount /oldroot"
    for _pid in /proc/*; do
        _pid=${_pid##/proc/}
        case $_pid in
            *[!0-9]*) continue ;;
        esac
        [ "$_pid" -eq $$ ] && continue

        [ -e "/proc/$_pid/exe" ] || continue
        [ -e "/proc/$_pid/root" ] || continue

        if strstr "$(ls -l /proc/"$_pid" /proc/"$_pid"/fd 2> /dev/null)" "oldroot"; then
            warn "Blocking umount of /oldroot [$_pid] $(cat /proc/"$_pid"/cmdline)"
        else
            warn "Still running [$_pid] $(cat /proc/"$_pid"/cmdline)"
        fi

        # shellcheck disable=SC2012
        ls -l "/proc/$_pid/exe" 2>&1 | vwarn
        # shellcheck disable=SC2012
        ls -l "/proc/$_pid/fd" 2>&1 | vwarn
    done
fi

_check_shutdown() {
    local __f
    local __s=0
    for __f in "$hookdir"/shutdown/*.sh; do
        [ -e "$__f" ] || continue
        # shellcheck disable=SC1090 disable=SC2240
        if (final="$1" . "$__f" "$1"); then
            rm -f -- "$__f"
        else
            __s=1
        fi
    done
    return $__s
}

_cnt=0
while [ $_cnt -le 40 ]; do
    _check_shutdown && break
    _cnt=$((_cnt + 1))
done
[ $_cnt -ge 40 ] && _check_shutdown final

getarg 'rd.break=shutdown' && emergency_shell --shutdown shutdown "Break before shutdown"

case "$ACTION" in
    reboot | poweroff | halt)
        $ACTION -f -n
        warn "$ACTION failed!"
        ;;
    kexec)
        kexec -e
        warn "$ACTION failed!"
        reboot -f -n
        ;;
    *)
        warn "Shutdown called with argument '$ACTION'. Rebooting!"
        reboot -f -n
        ;;
esac

emergency_shell --shutdown shutdown
 07070100000216000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/modules.d/99squash  07070100000217000081ED00000000000000000000000164DF2CB80000047E000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/modules.d/99squash/init-squash.sh   #!/bin/sh
PATH=/bin:/sbin

[ -e /proc/self/mounts ] \
    || (mkdir -p /proc && mount -t proc -o nosuid,noexec,nodev proc /proc)

grep -q '^sysfs /sys sysfs' /proc/self/mounts \
    || (mkdir -p /sys && mount -t sysfs -o nosuid,noexec,nodev sysfs /sys)

grep -q '^devtmpfs /dev devtmpfs' /proc/self/mounts \
    || (mkdir -p /dev && mount -t devtmpfs -o mode=755,noexec,nosuid,strictatime devtmpfs /dev)

grep -q '^tmpfs /run tmpfs' /proc/self/mounts \
    || (mkdir -p /run && mount -t tmpfs -o mode=755,noexec,nosuid,strictatime tmpfs /run)

# Load required modules
modprobe loop
modprobe squashfs
modprobe overlay

# Mount the squash image
mount -t ramfs ramfs /squash
mkdir -p /squash/root /squash/overlay/upper /squash/overlay/work
mount -t squashfs -o ro,loop /squash-root.img /squash/root

# Setup new root overlay
mkdir /newroot
mount -t overlay overlay -o lowerdir=/squash/root,upperdir=/squash/overlay/upper,workdir=/squash/overlay/work/ /newroot/

# Move all mount points to new root to prepare chroot
mount --move /squash /newroot/squash

# Jump to new root and clean setup files
SYSTEMD_IN_INITRD=lenient exec switch_root /newroot /init
  07070100000218000081A400000000000000000000000164DF2CB8000006DB000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/modules.d/99squash/module-setup.sh  #!/bin/bash

check() {
    require_binaries mksquashfs unsquashfs || return 1

    for i in CONFIG_SQUASHFS CONFIG_BLK_DEV_LOOP CONFIG_OVERLAY_FS; do
        if ! check_kernel_config $i; then
            dinfo "dracut-squash module requires kernel configuration $i (y or m)"
            return 1
        fi
    done

    return 255
}

depends() {
    echo "systemd-initrd"
    return 0
}

installpost() {
    local _busybox
    _busybox=$(find_binary busybox)

    # Move everything under $initdir except $squash_dir
    # itself into squash image
    for i in "$initdir"/*; do
        [[ $squash_dir == "$i"/* ]] || mv "$i" "$squash_dir"/
    done

    # Create mount points for squash loader
    mkdir -p "$initdir"/squash/
    mkdir -p "$squash_dir"/squash/

    # Copy dracut spec files out side of the squash image
    # so dracut rebuild and lsinitrd can work
    for file in "$squash_dir"/usr/lib/dracut/*; do
        [[ -f $file ]] || continue
        DRACUT_RESOLVE_DEPS=1 dracutsysrootdir="$squash_dir" inst "${file#$squash_dir}"
    done

    # Install required modules and binaries for the squash image init script.
    if [[ $_busybox ]]; then
        inst "$_busybox" /usr/bin/busybox
        for _i in sh echo mount modprobe mkdir switch_root grep; do
            ln_r /usr/bin/busybox /usr/bin/$_i
        done
    else
        DRACUT_RESOLVE_DEPS=1 inst_multiple sh mount modprobe mkdir switch_root grep
    fi

    hostonly="" instmods "loop" "squashfs" "overlay"
    dracut_kernel_post

    # Install squash image init script.
    ln -sfn /usr/bin "$initdir/bin"
    ln -sfn /usr/sbin "$initdir/sbin"
    inst_simple "$moddir"/init-squash.sh /init
}

install() {
    if [[ $DRACUT_SQUASH_POST_INST ]]; then
        installpost
    fi
}
 07070100000219000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/99suse    0707010000021A000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003600000000dracut-055+suse.347.gdcb9bdbf/modules.d/99suse-initrd 0707010000021B000081A400000000000000000000000164DF2CB8000006A3000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/modules.d/99suse-initrd/module-setup.sh #!/bin/bash

# Parse SUSE kernel module dependencies
#
# Kernel modules using "request_module" function may not show up in modprobe
# To worka round this, add depedencies in the following form:
# # SUSE_INITRD: module_name REQUIRES module1 module2 ...
# to /etc/modprobe.d/*.conf

# called by dracut
check() {
    # Skip the module if no SUSE INITRD is used
    local conf_files=$(get_modprobe_conf_files)
    [[ $conf_files ]] && grep -q "^# SUSE INITRD: " $conf_files
}

get_modprobe_conf_files() {
    ls /etc/modprobe.d/*.conf /run/modprobe.d/*.conf \
       /lib/modprobe.d/*.conf /usr/lib/modprobe.d/*.conf \
       2>/dev/null
    return 0
}

get_suse_initrd_lines() {
    local conf_files=$(get_modprobe_conf_files)
    [[ -z "$conf_files" ]] || grep -h "^# SUSE INITRD: " $conf_files
}

read_initrd_modules() {
    if [[ -f /etc/sysconfig/kernel ]]; then
        INITRD_MODULES=
        . /etc/sysconfig/kernel
        echo "$INITRD_MODULES"
    fi
}

filter_builtin() {
    while [[ $# -gt 0 ]]; do
        grep -q "/$1.ko" "/lib/modules/$kernel/modules.builtin" || echo "$1"
        shift
    done
}

# called by dracut
installkernel() {
    local line mod reqs all_mods="$(filter_builtin $(read_initrd_modules))"

    while read -r line; do
        mod="${line##*SUSE INITRD: }"
        mod="${mod%% REQUIRES*}"
        reqs="${line##*REQUIRES }"
        if [[ ! $hostonly ]] || grep -q "^$mod\$" "$DRACUT_KERNEL_MODALIASES"
        then
            all_mods="$all_mods $(filter_builtin $reqs)"
        fi
    done <<< "$(get_suse_initrd_lines)"

    # strip whitespace
    all_mods="$(echo $all_mods)"
    if [[ "$all_mods" ]]; then
        hostonly= dracut_instmods $all_mods
    fi
}
 0707010000021C000081ED00000000000000000000000164DF2CB80000012F000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/99suse/module-setup.sh    #!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# module-setup.sh for openSUSE / SLE initrd parameters conversion

install() {
    inst_hook cmdline 99 "$moddir/parse-suse-initrd.sh"

    inst_rules \
    60-io-scheduler.rules
}
 0707010000021D000081ED00000000000000000000000164DF2CB8000004FB000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/modules.d/99suse/parse-suse-initrd.sh   #!/bin/sh
# convert openSUSE / SLE initrd command lines into dracut ones
# linuxrc=trace shell=1 sysrq=yes sysrq=1-9 journaldev mduuid
# TargetAddress TargetPort TargetName

# sysrq
sysrq=$(getarg sysrq)
if [ "$sysrq" ] && [ "$sysrq" != "no" ]; then
    echo 1 > /proc/sys/kernel/sysrq
    case "$sysrq" in
        0|1|2|3|4|5|6|7|8|9)
            echo $sysrq > /proc/sysrq-trigger
            ;;
    esac
fi

# debug
if getarg linuxrc=trace; then
    echo "rd.debug rd.udev.debug" >> /etc/cmdline.d/99-suse.conf
    unset CMDLINE
fi

# debug shell
if getargbool 0 shell; then
    echo "rd.break" >> /etc/cmdline.d/99-suse.conf
    unset CMDLINE
fi

# journaldev
journaldev=$(getarg journaldev)
if [ -n "$journaldev" ]; then
    echo "root.journaldev=$journaldev" >> /etc/cmdline.d/99-suse.conf
    unset CMDLINE
fi

# mduuid
mduuid=$(getarg mduuid)
if [ -n "$mduuid" ]; then
    echo "rd.md.uuid=$mduuid" >> /etc/cmdline.d/99-suse.conf
    unset CMDLINE
fi

# TargetAddress / TargetPort / TargetName
TargetAddress=$(getarg TargetAddress)
TargetPort=$(getarg TargetPort)
TargetName=$(getarg TargetName)

if [ -n "$TargetAddress" -a -n "$TargetName" ]; then
    echo "netroot=iscsi:$TargetAddress::$TargetPort::$TargetName" >> /etc/cmdline.d/99-suse.conf
    unset CMDLINE
fi
 0707010000021E000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003300000000dracut-055+suse.347.gdcb9bdbf/modules.d/99uefi-lib    0707010000021F000081ED00000000000000000000000164DF2CB8000000D3000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/modules.d/99uefi-lib/module-setup.sh    #!/bin/bash

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    echo bash
    return 0
}

# called by dracut
install() {
    inst_simple "$moddir/uefi-lib.sh" "/lib/uefi-lib.sh"
}
 07070100000220000081ED00000000000000000000000164DF2CB80000169A000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/modules.d/99uefi-lib/uefi-lib.sh    #!/bin/bash
#
# Copyright 2013 Red Hat, Inc.  All rights reserved.
# Copyright 2013 Harald Hoyer <harald@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

getbyte() {
    local IFS= LC_CTYPE=C res c=0
    read -r -n 1 -d '' c
    res=$?
    # the single quote in the argument of the printf
    # yields the numeric value of $c (ASCII since LC_CTYPE=C)
    [[ -n $c ]] && c=$(printf '%u' "'$c") || c=0
    printf "%s" "$c"
    return $res
}

getword() {
    local b1=0 b2=0 val=0
    b1=$(getbyte)
    b2=$(getbyte)
    ((val = b2 * 256 + b1))
    echo "$val"
    return 0
}

# E.g. Acpi(PNP0A08,0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)/MAC(90E2BA265ED4,0x0)/Vlan(172)/Fibre(0x4EA06104A0CC0050,0x0)
uefi_device_path() {
    data=${1:-/sys/firmware/efi/efivars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac}
    [ -f "$data" ] || return 1

    local IFS= LC_CTYPE=C res tt len type hextype first
    first=1
    {
        getword > /dev/null
        getword > /dev/null
        while :; do
            type=$(getbyte) || return 1
            subtype=$(getbyte) || return 1
            len=$(getword) || return 1
            hextype=$(printf "%02x%02x" "$type" "$subtype")
            if [[ $first == 1 ]]; then
                first=0
            elif [[ $hextype != "7fff" ]]; then
                printf "/"
            fi
            case $hextype in
                0101)
                    # PCI
                    tt=$(getword)
                    printf "PCI(0x%x,0x%x)" $((tt / 256)) $((tt & 255))
                    ;;
                0201)
                    # ACPI
                    printf "Acpi(0x%x,0x%x)" $(($(getword) + $(getword) * 65536)) $(($(getword) + $(getword) * 65536))
                    ;;
                0303)
                    # FIBRE
                    getword &> /dev/null
                    getword &> /dev/null
                    printf "Fibre(0x%x%x%x%x%x%x%x%x,0x%x)" \
                        "$(getbyte)" "$(getbyte)" "$(getbyte)" "$(getbyte)" \
                        "$(getbyte)" "$(getbyte)" "$(getbyte)" "$(getbyte)" \
                        "$(($(getword) + $(getword) * 65536 + 4294967296 * ($(getword) + $(getword) * 65536)))"
                    ;;
                030b)
                    # MAC
                    printf "MAC(%02x%02x%02x%02x%02x%02x," "$(getbyte)" "$(getbyte)" "$(getbyte)" "$(getbyte)" "$(getbyte)" "$(getbyte)"
                    for ((i = 0; i < 26; i++)); do tt=$(getbyte) || return 1; done
                    printf "0x%x)" "$(getbyte)"
                    ;;
                0314)
                    # VLAN
                    printf "VLAN(%d)" "$(getword)"
                    ;;
                7fff)
                    # END
                    printf "\n"
                    return 0
                    ;;
                *)
                    #printf "Unknown(Type:0x%02x SubType:0x%02x len=%d)\n" "$type" "$subtype" "$len" >&2
                    for ((i = 0; i < len - 4; i++)); do tt=$(getbyte); done
                    ;;
            esac
        done
    } < "$data"
}

get_fcoe_boot_mac() {
    data=${1:-/sys/firmware/efi/efivars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac}
    [ -f "$data" ] || return 1
    local IFS= LC_CTYPE=C tt len type hextype
    {
        getword > /dev/null
        getword > /dev/null
        while :; do
            type=$(getbyte) || return 1
            subtype=$(getbyte) || return 1
            len=$(getword) || return 1
            hextype=$(printf "%02x%02x" "$type" "$subtype")
            case $hextype in
                030b)
                    # MAC
                    printf "%02x:%02x:%02x:%02x:%02x:%02x" "$(getbyte)" "$(getbyte)" "$(getbyte)" "$(getbyte)" "$(getbyte)" "$(getbyte)"
                    for ((i = 0; i < 27; i++)); do tt=$(getbyte) || return 1; done
                    ;;
                7fff)
                    # END
                    return 0
                    ;;
                *)
                    #printf "Unknown(Type:0x%02x SubType:0x%02x len=%d)\n" "$type" "$subtype" "$len" >&2
                    for ((i = 0; i < len - 4; i++)); do tt=$(getbyte); done
                    ;;
            esac
        done
    } < "$data"
}

get_fcoe_boot_vlan() {
    data=${1:-/sys/firmware/efi/efivars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac}
    [ -f "$data" ] || return 1
    local IFS= LC_CTYPE=C tt len type hextype
    {
        getword > /dev/null
        getword > /dev/null
        while :; do
            type=$(getbyte) || return 1
            subtype=$(getbyte) || return 1
            len=$(getword) || return 1
            hextype=$(printf "%02x%02x" "$type" "$subtype")
            case $hextype in
                0314)
                    # VLAN
                    printf "%d" "$(getword)"
                    ;;
                7fff)
                    # END
                    return 0
                    ;;
                *)
                    #printf "Unknown(Type:0x%02x SubType:0x%02x len=%d)\n" "$type" "$subtype" "$len" >&2
                    for ((i = 0; i < len; i++)); do tt=$(getbyte); done
                    ;;
            esac
        done
    } < "$data"
}
  07070100000221000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002700000000dracut-055+suse.347.gdcb9bdbf/pkgbuild    07070100000222000081A400000000000000000000000164DF2CB8000002B5000000000000000000000000000000000000003000000000dracut-055+suse.347.gdcb9bdbf/pkgbuild/PKGBUILD   pkgname=dracut-git
pkgver=1
pkgrel=1
pkgdesc="Initramfs generation utility"
arch=('i686' 'x86_64')
url="https://dracut.wiki.kernel.org/"
license=('GPL')
conflicts=('dracut' 'mkinitcpio')
provides=('dracut=9999' 'mkinitcpio=9999')
depends=('bash')
optdepends=('cryptsetup' 'lvm2')
makedepends=('libxslt')
backup=(etc/dracut.conf)
source=()
md5sums=()

# out of tree builds disallowed for this PKGFILE
BUILDDIR="${PWD}"
PKGDEST="${PWD}"
SRCDEST=""
SRCPKGDEST=""
LOGDEST=""

pkgver() {
  cd ..
  desc="$(git describe)"
  printf "%s.%s.%s" ${desc//-/ }
}

build() {
  cd ..
  make sysconfdir=/etc || return 1
}

package() {
  cd ..
  make DESTDIR="${pkgdir}" sysconfdir=/etc install || return 1
}
   07070100000223000081A400000000000000000000000164DF2CB800003D37000000000000000000000000000000000000003300000000dracut-055+suse.347.gdcb9bdbf/pkgbuild/dracut.spec    %define dracutlibdir %{_prefix}/lib/dracut
%bcond_without doc

# We ship a .pc file but don't want to have a dep on pkg-config. We
# strip the automatically generated dep here and instead co-own the
# directory.
%global __requires_exclude pkg-config
%define dist_free_release xxx

Name: dracut
Version: xxx
Release: %{dist_free_release}%{?dist}

Summary: Initramfs generator using udev
%if 0%{?fedora} || 0%{?rhel}
Group: System Environment/Base
%endif
%if 0%{?suse_version}
Group: System/Base
%endif

# The entire source code is GPLv2+
# except install/* which is LGPLv2+
# except util/* which is GPLv2
License: GPLv2+ and LGPLv2+ and GPLv2

URL: https://dracut.wiki.kernel.org/

# Source can be generated by
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%%{version};sf=tgz
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.xz
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt

BuildRequires: bash
BuildRequires: git-core
BuildRequires: pkgconfig(libkmod) >= 23
BuildRequires: gcc

%if 0%{?fedora} || 0%{?rhel}
BuildRequires: pkgconfig
BuildRequires: systemd
%endif
%if 0%{?fedora}
BuildRequires: bash-completion
%endif

%if %{with doc}
%if 0%{?fedora} || 0%{?rhel}
BuildRequires: docbook-style-xsl docbook-dtds libxslt
%endif

%if 0%{?suse_version}
BuildRequires: docbook-xsl-stylesheets libxslt
%endif

BuildRequires: asciidoc
%endif

Obsoletes: dracut-fips <= 047
Provides:  dracut-fips = %{version}-%{release}
Obsoletes: dracut-fips-aesni <= 047
Provides:  dracut-fips-aesni = %{version}-%{release}

Requires: bash >= 4
Requires: coreutils
Requires: cpio
Requires: filesystem >= 2.1.0
Requires: findutils
Requires: grep
Requires: kmod
Requires: sed
Requires: xz
Requires: gzip

%if 0%{?fedora} || 0%{?rhel}
Recommends: memstrack
Recommends: hardlink
Recommends: pigz
Recommends: kpartx
Requires: util-linux >= 2.21
Requires: systemd >= 219
Requires: systemd-udev >= 219
Requires: procps-ng
%else
Requires: hardlink
Requires: gzip
Requires: kpartx
Requires: udev > 166
Requires: util-linux-ng >= 2.21
%endif

%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
Requires: libkcapi-hmaccalc
%endif

%description
dracut contains tools to create bootable initramfses for the Linux
kernel. Unlike other implementations, dracut hard-codes as little
as possible into the initramfs. dracut contains various modules which
are driven by the event-based udev. Having root on MD, DM, LVM2, LUKS
is supported as well as NFS, iSCSI, NBD, FCoE with the dracut-network
package.

%package network
Summary: dracut modules to build a dracut initramfs with network support
%if 0%{?_module_build}
# In the module-build-service, we have pieces of dracut provided by different
# modules ("base-runtime" provides most functionality, but we need
# dracut-network in "installer". Since these two modules build with separate
# dist-tags, we need to reduce this strict requirement to ignore the dist-tag.
Requires: %{name} >= %{version}-%{dist_free_release}
%else
Requires: %{name} = %{version}-%{release}
%endif
Requires: iputils
Requires: iproute
Requires: (NetworkManager >= 1.20 or dhclient)
Suggests: NetworkManager
Obsoletes: dracut-generic < 008
Provides:  dracut-generic = %{version}-%{release}

%description network
This package requires everything which is needed to build a generic
all purpose initramfs with network support with dracut.

%package caps
Summary: dracut modules to build a dracut initramfs which drops capabilities
Requires: %{name} = %{version}-%{release}
Requires: libcap

%description caps
This package requires everything which is needed to build an
initramfs with dracut, which drops capabilities.

%package live
Summary: dracut modules to build a dracut initramfs with live image capabilities
%if 0%{?_module_build}
# See the network subpackage comment.
Requires: %{name} >= %{version}-%{dist_free_release}
%else
Requires: %{name} = %{version}-%{release}
%endif
Requires: %{name}-network = %{version}-%{release}
Requires: tar gzip coreutils bash device-mapper curl
%if 0%{?fedora}
Requires: fuse ntfs-3g
%endif

%description live
This package requires everything which is needed to build an
initramfs with dracut, with live image capabilities, like Live CDs.

%package config-generic
Summary: dracut configuration to turn off hostonly image generation
Requires: %{name} = %{version}-%{release}
Obsoletes: dracut-nohostonly < 030
Provides:  dracut-nohostonly = %{version}-%{release}

%description config-generic
This package provides the configuration to turn off the host specific initramfs
generation with dracut and generates a generic image by default.

%package config-rescue
Summary: dracut configuration to turn on rescue image generation
Requires: %{name} = %{version}-%{release}
Obsoletes: dracut < 030

%description config-rescue
This package provides the configuration to turn on the rescue initramfs
generation with dracut.

%package tools
Summary: dracut tools to build the local initramfs
Requires: %{name} = %{version}-%{release}

%description tools
This package contains tools to assemble the local initrd and host configuration.

%package squash
Summary: dracut module to build an initramfs with most files in a squashfs image
Requires: %{name} = %{version}-%{release}
Requires: squashfs-tools

%description squash
This package provides a dracut module to build an initramfs, but store most files
in a squashfs image, result in a smaller initramfs size and reduce runtime memory
usage.

%prep
%autosetup -n %{name}-%{version} -S git_am
cp %{SOURCE1} .

%build
%configure  --systemdsystemunitdir=%{_unitdir} \
            --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) \
            --libdir=%{_prefix}/lib \
%if %{without doc}
            --disable-documentation \
%endif
            ${NULL}

%make_build

%install
%make_install %{?_smp_mflags} \
     libdir=%{_prefix}/lib

echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh

%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} == 0
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
%endif

# we do not support dash in the initramfs
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash

# we do not support mksh in the initramfs
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00mksh

# remove gentoo specific modules
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash

%if %{defined _unitdir}
# with systemd IMA and selinux modules do not make sense
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/96securityfs
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/97masterkey
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98integrity
%endif

%ifnarch s390 s390x
# remove architecture specific modules
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/80cms
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/81cio_ignore
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/91zipl
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd_mod
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd_rules
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dcssblk
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95qeth_rules
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95zfcp
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95zfcp_rules
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95znet
%else
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00warpclock
%endif

mkdir -p $RPM_BUILD_ROOT/boot/dracut
mkdir -p $RPM_BUILD_ROOT/var/lib/dracut/overlay
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log
touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs

%if 0%{?fedora} || 0%{?rhel}
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
%endif
%if 0%{?suse_version}
install -m 0644 dracut.conf.d/suse.conf.example   $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
%else
rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse*
%endif

%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} <= 9999
rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
rm -f -- $RPM_BUILD_ROOT%{_mandir}/man1/lsinitrd.1*
%endif

echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf

%files
%if %{with doc}
%doc README.md docs/HACKING.md AUTHORS NEWS.md dracut.html docs/dracut.png docs/dracut.svg
%endif
%{!?_licensedir:%global license %%doc}
%license COPYING lgpl-2.1.txt
%{_bindir}/dracut
%{_datadir}/bash-completion/completions/dracut
%{_datadir}/bash-completion/completions/lsinitrd
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999
%{_bindir}/lsinitrd
%endif
%dir %{dracutlibdir}
%dir %{dracutlibdir}/modules.d
%{dracutlibdir}/dracut-functions.sh
%{dracutlibdir}/dracut-init.sh
%{dracutlibdir}/dracut-functions
%{dracutlibdir}/dracut-version.sh
%{dracutlibdir}/dracut-logger.sh
%{dracutlibdir}/dracut-initramfs-restore
%{dracutlibdir}/dracut-install
%{dracutlibdir}/dracut-util
%{dracutlibdir}/skipcpio
%config(noreplace) %{_sysconfdir}/dracut.conf
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
%{dracutlibdir}/dracut.conf.d/01-dist.conf
%endif
%dir %{_sysconfdir}/dracut.conf.d
%dir %{dracutlibdir}/dracut.conf.d
%dir %{_datadir}/pkgconfig
%{_datadir}/pkgconfig/dracut.pc

%if %{with doc}
%{_mandir}/man8/dracut.8*
%{_mandir}/man8/*service.8*
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999
%{_mandir}/man1/lsinitrd.1*
%endif
%{_mandir}/man7/dracut.kernel.7*
%{_mandir}/man7/dracut.cmdline.7*
%{_mandir}/man7/dracut.modules.7*
%{_mandir}/man7/dracut.bootup.7*
%{_mandir}/man5/dracut.conf.5*
%endif

%if %{undefined _unitdir}
%endif
%{dracutlibdir}/modules.d/00bash
%{dracutlibdir}/modules.d/00systemd
%{dracutlibdir}/modules.d/00systemd-network-management
%ifnarch s390 s390x
%{dracutlibdir}/modules.d/00warpclock
%endif
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
%{dracutlibdir}/modules.d/01fips
%endif
%{dracutlibdir}/modules.d/01systemd-ac-power
%{dracutlibdir}/modules.d/01systemd-ask-password
%{dracutlibdir}/modules.d/01systemd-coredump
%{dracutlibdir}/modules.d/01systemd-hostnamed
%{dracutlibdir}/modules.d/01systemd-initrd
%{dracutlibdir}/modules.d/01systemd-journald
%{dracutlibdir}/modules.d/01systemd-ldconfig
%{dracutlibdir}/modules.d/01systemd-modules-load
%{dracutlibdir}/modules.d/01systemd-repart
%{dracutlibdir}/modules.d/01systemd-resolved
%{dracutlibdir}/modules.d/01systemd-rfkill
%{dracutlibdir}/modules.d/01systemd-sysext
%{dracutlibdir}/modules.d/01systemd-sysctl
%{dracutlibdir}/modules.d/01systemd-sysusers
%{dracutlibdir}/modules.d/01systemd-timedated
%{dracutlibdir}/modules.d/01systemd-timesyncd
%{dracutlibdir}/modules.d/01systemd-tmpfiles
%{dracutlibdir}/modules.d/01systemd-udevd
%{dracutlibdir}/modules.d/01systemd-veritysetup
%{dracutlibdir}/modules.d/03modsign
%{dracutlibdir}/modules.d/03rescue
%{dracutlibdir}/modules.d/04watchdog
%{dracutlibdir}/modules.d/04watchdog-modules
%{dracutlibdir}/modules.d/05busybox
%{dracutlibdir}/modules.d/06dbus-broker
%{dracutlibdir}/modules.d/06dbus-daemon
%{dracutlibdir}/modules.d/06rngd
%{dracutlibdir}/modules.d/09dbus
%{dracutlibdir}/modules.d/10i18n
%{dracutlibdir}/modules.d/30convertfs
%{dracutlibdir}/modules.d/45url-lib
%{dracutlibdir}/modules.d/50drm
%{dracutlibdir}/modules.d/50plymouth
%{dracutlibdir}/modules.d/62bluetooth
%{dracutlibdir}/modules.d/80lvmmerge
%{dracutlibdir}/modules.d/90btrfs
%{dracutlibdir}/modules.d/90crypt
%{dracutlibdir}/modules.d/90dm
%{dracutlibdir}/modules.d/90dmraid
%{dracutlibdir}/modules.d/90kernel-modules
%{dracutlibdir}/modules.d/90kernel-modules-extra
%{dracutlibdir}/modules.d/90lvm
%{dracutlibdir}/modules.d/90mdraid
%{dracutlibdir}/modules.d/90multipath
%{dracutlibdir}/modules.d/90nvdimm
%{dracutlibdir}/modules.d/90ppcmac
%{dracutlibdir}/modules.d/90qemu
%{dracutlibdir}/modules.d/91crypt-gpg
%{dracutlibdir}/modules.d/91crypt-loop
%{dracutlibdir}/modules.d/91fido2
%{dracutlibdir}/modules.d/91tpm2-tss
%{dracutlibdir}/modules.d/95debug
%{dracutlibdir}/modules.d/95fstab-sys
%{dracutlibdir}/modules.d/95lunmask
%{dracutlibdir}/modules.d/95nvmf
%{dracutlibdir}/modules.d/95resume
%{dracutlibdir}/modules.d/95rootfs-block
%{dracutlibdir}/modules.d/95terminfo
%{dracutlibdir}/modules.d/95udev-rules
%{dracutlibdir}/modules.d/95virtfs
%ifarch s390 s390x
%{dracutlibdir}/modules.d/80cms
%{dracutlibdir}/modules.d/81cio_ignore
%{dracutlibdir}/modules.d/91zipl
%{dracutlibdir}/modules.d/95dasd
%{dracutlibdir}/modules.d/95dasd_mod
%{dracutlibdir}/modules.d/95dasd_rules
%{dracutlibdir}/modules.d/95dcssblk
%{dracutlibdir}/modules.d/95qeth_rules
%{dracutlibdir}/modules.d/95zfcp
%{dracutlibdir}/modules.d/95zfcp_rules
%endif
%if %{undefined _unitdir}
%{dracutlibdir}/modules.d/96securityfs
%{dracutlibdir}/modules.d/97masterkey
%{dracutlibdir}/modules.d/98integrity
%endif
%{dracutlibdir}/modules.d/97biosdevname
%{dracutlibdir}/modules.d/98dracut-systemd
%{dracutlibdir}/modules.d/98ecryptfs
%{dracutlibdir}/modules.d/98pollcdrom
%{dracutlibdir}/modules.d/98selinux
%{dracutlibdir}/modules.d/98syslog
%{dracutlibdir}/modules.d/98usrmount
%{dracutlibdir}/modules.d/99base
%{dracutlibdir}/modules.d/99memstrack
%{dracutlibdir}/modules.d/99fs-lib
%{dracutlibdir}/modules.d/99shutdown
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
%dir %{_sharedstatedir}/initramfs
%if %{defined _unitdir}
%{_unitdir}/dracut-shutdown.service
%{_unitdir}/sysinit.target.wants/dracut-shutdown.service
%{_unitdir}/dracut-cmdline.service
%{_unitdir}/dracut-initqueue.service
%{_unitdir}/dracut-mount.service
%{_unitdir}/dracut-pre-mount.service
%{_unitdir}/dracut-pre-pivot.service
%{_unitdir}/dracut-pre-trigger.service
%{_unitdir}/dracut-pre-udev.service
%{_unitdir}/initrd.target.wants/dracut-cmdline.service
%{_unitdir}/initrd.target.wants/dracut-initqueue.service
%{_unitdir}/initrd.target.wants/dracut-mount.service
%{_unitdir}/initrd.target.wants/dracut-pre-mount.service
%{_unitdir}/initrd.target.wants/dracut-pre-pivot.service
%{_unitdir}/initrd.target.wants/dracut-pre-trigger.service
%{_unitdir}/initrd.target.wants/dracut-pre-udev.service
%endif
%{_prefix}/lib/kernel/install.d/50-dracut.install

%files network
%{dracutlibdir}/modules.d/01systemd-networkd
%{dracutlibdir}/modules.d/35network-manager
%{dracutlibdir}/modules.d/35network-legacy
%{dracutlibdir}/modules.d/35network-wicked
%{dracutlibdir}/modules.d/40network
%{dracutlibdir}/modules.d/45ifcfg
%{dracutlibdir}/modules.d/90kernel-network-modules
%{dracutlibdir}/modules.d/90qemu-net
%{dracutlibdir}/modules.d/95cifs
%{dracutlibdir}/modules.d/95fcoe
%{dracutlibdir}/modules.d/95fcoe-uefi
%{dracutlibdir}/modules.d/95iscsi
%{dracutlibdir}/modules.d/95nbd
%{dracutlibdir}/modules.d/95nfs
%{dracutlibdir}/modules.d/95ssh-client
%ifarch s390 s390x
%{dracutlibdir}/modules.d/95znet
%endif
%{dracutlibdir}/modules.d/99uefi-lib

%files caps
%{dracutlibdir}/modules.d/02caps

%files live
%{dracutlibdir}/modules.d/99img-lib
%{dracutlibdir}/modules.d/90dmsquash-live
%{dracutlibdir}/modules.d/90dmsquash-live-ntfs
%{dracutlibdir}/modules.d/90livenet

%files tools
%if %{with doc}
%doc %{_mandir}/man8/dracut-catimages.8*
%endif

%{_bindir}/dracut-catimages
%dir /boot/dracut
%dir /var/lib/dracut
%dir /var/lib/dracut/overlay

%files squash
%{dracutlibdir}/modules.d/99squash

%files config-generic
%{dracutlibdir}/dracut.conf.d/02-generic-image.conf

%files config-rescue
%{dracutlibdir}/dracut.conf.d/02-rescue.conf
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install

%changelog
 07070100000224000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/shell-completion    07070100000225000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/shell-completion/bash   07070100000226000081A400000000000000000000000164DF2CB800000EC8000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/shell-completion/bash/dracut    #!/bin/bash
# Copyright 2013 Red Hat, Inc.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

__contains_word() {
    local word="$1"
    shift
    for w in "$@"; do [[ $w == "$word" ]] && return 0; done
    return 1
}

_dracut() {
    local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD - 1]}
    local -A OPTS=(
        [STANDALONE]='-f -v -q -l -H -h -M -N
            --ro-mnt --force --kernel-only --no-kernel --strip --nostrip
            --hardlink --nohardlink --noprefix --mdadmconf --nomdadmconf
            --lvmconf --nolvmconf --debug --profile --verbose --quiet
            --local --hostonly --no-hostonly --fstab --help --bzip2 --lzma
            --xz --zstd --no-compress --gzip --list-modules --show-modules --keep
            --printsize --regenerate-all --noimageifnotneeded --early-microcode
            --no-early-microcode --print-cmdline --reproducible --uefi
            --enhanced-cpio'
        [ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers
            --omit-drivers --modules --omit --drivers --filesystems --install
            --fwdir --libdirs --fscks --add-fstab --mount --device --nofscks
            --kmoddir --conf --confdir --tmpdir --stdlog --compress --prefix
            --kernel-cmdline --sshkey --persistent-policy --install-optional
            --loginstall --uefi-stub --kernel-image
            '
    )

    # shellcheck disable=SC2086
    if __contains_word "$prev" ${OPTS[ARG]}; then
        case $prev in
            --kmoddir | -k | --fwdir | --confdir | --tmpdir)
                comps=$(compgen -d -- "$cur")
                compopt -o filenames
                ;;
            -c | --conf | --sshkey | --add-fstab | --add-device | -I | --install | --install-optional)
                comps=$(compgen -f -- "$cur")
                compopt -o filenames
                ;;
            -a | -m | -o | --add | --modules | --omit)
                comps=$(dracut --list-modules 2> /dev/null)
                ;;
            --persistent-policy)
                comps=$(
                    cd /dev/disk/ || return 0
                    printf -- "%s " *
                )
                ;;
            --kver)
                comps=$(
                    cd /lib/modules || return 0
                    echo [0-9]*
                )
                ;;
            *)
                return 0
                ;;
        esac
        # shellcheck disable=SC2207
        # shellcheck disable=SC2016
        COMPREPLY=($(compgen -W '$comps' -- "$cur"))
        return 0
    fi

    if [[ $cur == -* ]]; then
        # shellcheck disable=SC2207
        # shellcheck disable=SC2016
        COMPREPLY=($(compgen -W '${OPTS[*]}' -- "$cur"))
        return 0
    fi

    local args
    _count_args
    if [[ $args -eq 1 ]]; then
        _filedir
        return 0
    elif [[ $args -eq 2 ]]; then
        # shellcheck disable=SC2034
        comps=$(
            cd /lib/modules || return 0
            echo [0-9]*
        )
        # shellcheck disable=SC2207
        # shellcheck disable=SC2016
        COMPREPLY=($(compgen -W '$comps' -- "$cur"))
        return 0
    fi
}

complete -F _dracut dracut
07070100000227000081A400000000000000000000000164DF2CB800000820000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/shell-completion/bash/lsinitrd  #!/bin/bash
# Copyright 2013 Red Hat, Inc.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

__contains_word() {
    local word="$1"
    shift
    for w in "$@"; do [[ $w == "$word" ]] && return 0; done
    return 1
}

_lsinitrd() {
    local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD - 1]}
    local -A OPTS=(
        [STANDALONE]='-s --size -h --help'
        [ARG]='-f --file -k --kver'
    )

    # shellcheck disable=SC2086
    if __contains_word "$prev" ${OPTS[ARG]}; then
        case $prev in
            --file | -f)
                comps=$(compgen -f -- "$cur")
                compopt -o filenames
                ;;
            --kver | -k)
                comps=$(
                    cd /lib/modules || return 1
                    echo [0-9]*
                )
                ;;
            *)
                return 0
                ;;
        esac
        # shellcheck disable=SC2207
        # shellcheck disable=SC2016
        COMPREPLY=($(compgen -W '$comps' -- "$cur"))
        return 0
    fi

    if [[ $cur == -* ]]; then
        # shellcheck disable=SC2207
        # shellcheck disable=SC2016
        COMPREPLY=($(compgen -W '${OPTS[*]}' -- "$cur"))
        return 0
    fi

    # shellcheck disable=SC2034
    comps=$(compgen -f -- "$cur")
    compopt -o filenames
    # shellcheck disable=SC2207
    # shellcheck disable=SC2016
    COMPREPLY=($(compgen -W '$comps' -- "$cur"))
    return 0
}

complete -F _lsinitrd lsinitrd
07070100000228000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002200000000dracut-055+suse.347.gdcb9bdbf/src 07070100000229000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002E00000000dracut-055+suse.347.gdcb9bdbf/src/dracut-cpio 0707010000022A000081A400000000000000000000000164DF2CB8000000DB000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/src/dracut-cpio/Cargo.lock  # This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "crosvm"
version = "0.1.0"

[[package]]
name = "dracut-cpio"
version = "0.1.0"
dependencies = [
 "crosvm",
]
 0707010000022B000081A400000000000000000000000164DF2CB80000010C000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/src/dracut-cpio/Cargo.toml  [package]
name = "dracut-cpio"
description = "cpio archive generator for Dracut"
authors = ["David Disseldorp"]
license = "GPL-2.0"
version = "0.1.0"
edition = "2018"

[dependencies]
crosvm = { path = "third_party/crosvm" }
# please avoid adding any more dependencies
0707010000022C000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/src/dracut-cpio/src 0707010000022D000081A400000000000000000000000164DF2CB80000FFE3000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/src/dracut-cpio/src/main.rs // SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2021 SUSE LLC

use std::convert::TryInto;
use std::env;
use std::ffi::OsStr;
use std::fs;
use std::io;
use std::io::prelude::*;
use std::os::unix::ffi::OsStrExt;
use std::os::unix::fs::FileTypeExt;
use std::os::unix::fs::MetadataExt as UnixMetadataExt;
use std::path::{Path, PathBuf};

use crosvm::argument::{self, Argument};

macro_rules! NEWC_HDR_FMT {
    () => {
        concat!(
            "{magic}{ino:08X}{mode:08X}{uid:08X}{gid:08X}{nlink:08X}",
            "{mtime:08X}{filesize:08X}{major:08X}{minor:08X}{rmajor:08X}",
            "{rminor:08X}{namesize:08X}{chksum:08X}"
        )
    };
}

// Don't print debug messages on release builds...
#[cfg(debug_assertions)]
macro_rules! dout {
    ($($l:tt)*) => { println!($($l)*); }
}
#[cfg(not(debug_assertions))]
macro_rules! dout {
    ($($l:tt)*) => {};
}

const NEWC_HDR_LEN: u64 = 110;
const PATH_MAX: u64 = 4096;

struct HardlinkPath {
    infile: PathBuf,
    outfile: PathBuf,
}

struct HardlinkState {
    names: Vec<HardlinkPath>,
    source_ino: u64,
    mapped_ino: u32,
    nlink: u32,
    seen: u32,
}

struct DevState {
    dev: u64,
    hls: Vec<HardlinkState>,
}

struct ArchiveProperties {
    // first inode number to use. @ArchiveState.ino increments from this.
    initial_ino: u32,
    // if non-zero, then align file data segments to this offset by injecting
    // extra zeros after the filename string terminator.
    data_align: u32,
    // When injecting extra zeros into the filename field for data alignment,
    // ensure that it doesn't exceed this size. The linux kernel will ignore
    // files where namesize is larger than PATH_MAX, hence the need for this.
    namesize_max: u32,
    // if the archive is being appended to the end of an existing file, then
    // @initial_data_off is used when calculating @data_align alignment.
    initial_data_off: u64,
    // delimiter character for the stdin file list
    list_separator: u8,
    // mtime, uid and gid to use for archived inodes, instead of the value
    // reported by stat.
    fixed_mtime: Option<u32>,
    fixed_uid: Option<u32>,
    fixed_gid: Option<u32>,
    // When archiving a subset of hardlinks, nlink values in the archive can
    // represent the subset (renumber_nlink=true) or the original source file
    // nlink values (renumber_nlink=false), where the latter matches GNU cpio.
    renumber_nlink: bool,
    // If OUTPUT file exists, then zero-truncate it instead of appending. The
    // default append behaviour chains archives back-to-back, i.e. multiple
    // archives will be separated by a TRAILER and 512-byte padding.
    // See Linux's Documentation/driver-api/early-userspace/buffer-format.rst
    // for details on how chained initramfs archives are handled.
    truncate_existing: bool,
}

impl ArchiveProperties {
    pub fn default() -> ArchiveProperties {
        ArchiveProperties {
            initial_ino: 0, // match GNU cpio numbering
            data_align: 0,
            namesize_max: PATH_MAX as u32,
            initial_data_off: 0,
            list_separator: b'\n',
            fixed_mtime: None,
            fixed_uid: None,
            fixed_gid: None,
            renumber_nlink: false,
            truncate_existing: false,
        }
    }
}

struct ArchiveState {
    // 2d dev + inode vector serves two purposes:
    // - dev index provides reproducible major,minor values
    // - inode@dev provides hardlink state tracking
    ids: Vec<DevState>,
    // offset from the start of this archive
    off: u64,
    // next mapped inode number, used instead of source file inode numbers to
    // ensure reproducability. XXX: should track inode per mapped dev?
    ino: u32,
}

impl ArchiveState {
    pub fn new(ino_start: u32) -> ArchiveState {
        ArchiveState {
            ids: Vec::new(),
            off: 0,
            ino: ino_start,
        }
    }

    // lookup or create DevState for @dev. Return @major/@minor based on index
    pub fn dev_seen(&mut self, dev: u64) -> Option<(u32, u32)> {
        let index: u64 = match self.ids.iter().position(|i| i.dev == dev) {
            Some(idx) => idx.try_into().ok()?,
            None => {
                self.ids.push(DevState {
                    dev: dev,
                    hls: Vec::new(),
                });
                (self.ids.len() - 1).try_into().ok()?
            }
        };

        let major: u32 = (index >> 32).try_into().unwrap();
        let minor: u32 = (index & u64::from(u32::MAX)).try_into().unwrap();
        Some((major, minor))
    }

    // Check whether we've already seen this hardlink's dev/inode combination.
    // If already seen, fill the existing mapped_ino.
    // Return true if this entry has been deferred (seen != nlinks)
    pub fn hardlink_seen<W: Write + Seek>(
        &mut self,
        props: &ArchiveProperties,
        mut writer: W,
        major: u32,
        minor: u32,
        md: fs::Metadata,
        inpath: &Path,
        outpath: &Path,
        mapped_ino: &mut Option<u32>,
        mapped_nlink: &mut Option<u32>,
    ) -> std::io::Result<bool> {
        assert!(md.nlink() > 1);
        let index = u64::from(major) << 32 | u64::from(minor);
        // reverse index->major/minor conversion that was just done
        let devstate: &mut DevState = &mut self.ids[index as usize];
        let (_index, hl) = match devstate
            .hls
            .iter_mut()
            .enumerate()
            .find(|(_, hl)| hl.source_ino == md.ino())
        {
            Some(hl) => hl,
            None => {
                devstate.hls.push(HardlinkState {
                    names: vec![HardlinkPath {
                        infile: inpath.to_path_buf(),
                        outfile: outpath.to_path_buf(),
                    }],
                    source_ino: md.ino(),
                    mapped_ino: self.ino,
                    nlink: md.nlink().try_into().unwrap(), // pre-checked
                    seen: 1,
                });
                self.ino += 1; // ino is reserved for all subsequent links
                return Ok(true);
            }
        };

        if (*hl).names.iter().any(|n| n.infile == inpath) {
            println!(
                "duplicate hardlink path {} for {}",
                inpath.display(),
                md.ino()
            );
            // GNU cpio doesn't swallow duplicates
        }

        // hl.nlink may not match md.nlink if we've come here via
        // archive_flush_unseen_hardlinks() .

        (*hl).seen += 1;
        if (*hl).seen > (*hl).nlink {
            // GNU cpio powers through if a hardlink is listed multiple times,
            // exceeding nlink.
            println!("hardlink seen {} exceeds nlink {}", (*hl).seen, (*hl).nlink);
        }

        if (*hl).seen < (*hl).nlink {
            (*hl).names.push(HardlinkPath {
                infile: inpath.to_path_buf(),
                outfile: outpath.to_path_buf(),
            });
            return Ok(true);
        }

        // a new HardlinkPath entry isn't added, as return path handles cpio
        // outpath header *and* data segment.

        for path in (*hl).names.iter().rev() {
            dout!("writing hardlink {}", path.outfile.display());
            // length already PATH_MAX validated
            let fname = path.outfile.as_os_str().as_bytes();

            write!(
                writer,
                NEWC_HDR_FMT!(),
                magic = "070701",
                ino = (*hl).mapped_ino,
                mode = md.mode(),
                uid = match props.fixed_uid {
                    Some(u) => u,
                    None => md.uid(),
                },
                gid = match props.fixed_gid {
                    Some(g) => g,
                    None => md.gid(),
                },
                nlink = match props.renumber_nlink {
                    true => (*hl).nlink,
                    false => md.nlink().try_into().unwrap(),
                },
                mtime = match props.fixed_mtime {
                    Some(t) => t,
                    None => md.mtime().try_into().unwrap(),
                },
                filesize = 0,
                major = major,
                minor = major,
                rmajor = 0,
                rminor = 0,
                namesize = fname.len() + 1,
                chksum = 0
            )?;
            self.off += NEWC_HDR_LEN;
            writer.write_all(fname)?;
            self.off += fname.len() as u64;
            // +1 as padding starts after fname nulterm
            let seeklen = 1 + archive_padlen(self.off + 1, 4);
            {
                let z = vec![0u8; seeklen.try_into().unwrap()];
                writer.write_all(&z)?;
            }
            self.off += seeklen;
        }
        *mapped_ino = Some((*hl).mapped_ino);
        // cpio nlink may be different to stat nlink if only a subset of links
        // are archived.
        if props.renumber_nlink {
            *mapped_nlink = Some((*hl).nlink);
        }

        // GNU cpio: if a name is given multiple times, exceeding nlink, then
        // subsequent names continue to be packed (with a repeat data segment),
        // using the same mapped inode.
        dout!("resetting hl at index {}", index);
        hl.seen = 0;
        hl.names.clear();

        return Ok(false);
    }
}

fn archive_path<W: Seek + Write>(
    state: &mut ArchiveState,
    props: &ArchiveProperties,
    path: &Path,
    mut writer: W,
) -> std::io::Result<()> {
    let inpath = path;
    let mut outpath = path.clone();
    let mut datalen: u32 = 0;
    let mut rmajor: u32 = 0;
    let mut rminor: u32 = 0;
    let mut hardlink_ino: Option<u32> = None;
    let mut hardlink_nlink: Option<u32> = None;
    let mut symlink_tgt = PathBuf::new();
    let mut data_align_seek: u32 = 0;

    outpath = match outpath.strip_prefix("./") {
        Ok(p) => {
            if p.as_os_str().as_bytes().len() == 0 {
                outpath // retain './' and '.' paths
            } else {
                p
            }
        }
        Err(_) => outpath,
    };
    let fname = outpath.as_os_str().as_bytes();
    if fname.len() + 1 >= PATH_MAX.try_into().unwrap() {
        return Err(io::Error::new(io::ErrorKind::InvalidInput, "path too long"));
    }

    let md = match fs::symlink_metadata(inpath) {
        Ok(m) => m,
        Err(e) => {
            println!("failed to get metadata for {}: {}", inpath.display(), e);
            return Err(e);
        }
    };
    dout!("archiving {} with mode {:o}", outpath.display(), md.mode());

    let (major, minor) = match state.dev_seen(md.dev()) {
        Some((maj, min)) => (maj, min),
        None => return Err(io::Error::new(io::ErrorKind::Other, "failed to map dev")),
    };

    if md.nlink() > u32::MAX as u64 {
        return Err(io::Error::new(
            io::ErrorKind::InvalidInput,
            "nlink too large",
        ));
    }

    let mtime: u32 = match props.fixed_mtime {
        Some(t) => t,
        None => {
            // check for 2106 epoch overflow
            if md.mtime() > i64::from(u32::MAX) {
                return Err(io::Error::new(
                    io::ErrorKind::InvalidInput,
                    "mtime too large for cpio",
                ));
            }
            md.mtime().try_into().unwrap()
        }
    };

    let ftype = md.file_type();
    if ftype.is_symlink() {
        symlink_tgt = fs::read_link(inpath)?;
        datalen = {
            let d: usize = symlink_tgt.as_os_str().as_bytes().len();
            if d >= PATH_MAX.try_into().unwrap() {
                return Err(io::Error::new(
                    io::ErrorKind::InvalidInput,
                    "symlink path too long",
                ));
            }
            d.try_into().unwrap()
        };
        // no zero terminator for symlink target path
    }

    // Linux kernel uses 32-bit dev_t, encoded as mmmM MMmm. glibc uses 64-bit
    // MMMM Mmmm mmmM MMmm, which is compatible with the former.
    if ftype.is_block_device() || ftype.is_char_device() {
        let rd = md.rdev();
        rmajor = (((rd >> 32) & 0xfffff000) | ((rd >> 8) & 0x00000fff)) as u32;
        rminor = (((rd >> 12) & 0xffffff00) | (rd & 0x000000ff)) as u32;
    }

    if ftype.is_file() {
        datalen = {
            if md.len() > u64::from(u32::MAX) {
                return Err(io::Error::new(
                    io::ErrorKind::InvalidInput,
                    "file too large for newc",
                ));
            }
            md.len().try_into().unwrap()
        };

        if md.nlink() > 1 {
            // follow GNU cpio's behaviour of attaching hardlink data only to
            // the last entry in the archive.
            let deferred = state.hardlink_seen(
                &props,
                &mut writer,
                major,
                minor,
                md.clone(),
                &inpath,
                outpath,
                &mut hardlink_ino,
                &mut hardlink_nlink,
            )?;
            if deferred {
                dout!("deferring hardlink {} data portion", outpath.display());
                return Ok(());
            }
        }

        if props.data_align > 0 && datalen > props.data_align {
            // XXX we're "bending" the newc spec a bit here to inject zeros
            // after fname to provide data segment alignment. These zeros are
            // accounted for in the namesize, but some applications may only
            // expect a single zero-terminator (and 4 byte alignment). GNU cpio
            // and Linux initramfs handle this fine as long as PATH_MAX isn't
            // exceeded.
            data_align_seek = {
                let len: u64 = archive_padlen(
                    props.initial_data_off + state.off + NEWC_HDR_LEN + fname.len() as u64 + 1,
                    u64::from(props.data_align),
                );
                let padded_namesize = len + fname.len() as u64 + 1;
                if padded_namesize > u64::from(props.namesize_max) {
                    dout!(
                        "{} misaligned. Required padding {} exceeds namesize maximum {}.",
                        outpath.display(),
                        len,
                        props.namesize_max
                    );
                    0
                } else {
                    len.try_into().unwrap()
                }
            };
        }
    }

    write!(
        writer,
        NEWC_HDR_FMT!(),
        magic = "070701",
        ino = match hardlink_ino {
            Some(i) => i,
            None => {
                let i = state.ino;
                state.ino += 1;
                i
            }
        },
        mode = md.mode(),
        uid = match props.fixed_uid {
            Some(u) => u,
            None => md.uid(),
        },
        gid = match props.fixed_gid {
            Some(g) => g,
            None => md.gid(),
        },
        nlink = match hardlink_nlink {
            Some(n) => n,
            None => md.nlink().try_into().unwrap(),
        },
        mtime = mtime,
        filesize = datalen,
        major = major,
        minor = major,
        rmajor = rmajor,
        rminor = rminor,
        namesize = fname.len() + 1 + data_align_seek as usize,
        chksum = 0
    )?;
    state.off += NEWC_HDR_LEN;

    writer.write_all(fname)?;
    state.off += fname.len() as u64;

    let mut seek_len: i64 = 1; // fname nulterm
    if data_align_seek > 0 {
        seek_len += data_align_seek as i64;
        assert_eq!(archive_padlen(state.off + seek_len as u64, 4), 0);
    } else {
        let padding_len = archive_padlen(state.off + seek_len as u64, 4);
        seek_len += padding_len as i64;
    }
    {
        let z = vec![0u8; seek_len.try_into().unwrap()];
        writer.write_all(&z)?;
    }
    state.off += seek_len as u64;

    // io::copy() can reflink: https://github.com/rust-lang/rust/pull/75272 \o/
    if datalen > 0 {
        if ftype.is_file() {
            let mut reader = io::BufReader::new(fs::File::open(inpath)?);
            let copied = io::copy(&mut reader, &mut writer)?;
            if copied != u64::from(datalen) {
                return Err(io::Error::new(
                    io::ErrorKind::UnexpectedEof,
                    "copy returned unexpected length",
                ));
            }
        } else if ftype.is_symlink() {
            writer.write_all(symlink_tgt.as_os_str().as_bytes())?;
        }
        state.off += u64::from(datalen);
        let dpad_len: usize = archive_padlen(state.off, 4).try_into().unwrap();
        write!(writer, "{pad:.padlen$}", padlen = dpad_len, pad = "\0\0\0")?;
        state.off += dpad_len as u64;
    }

    Ok(())
}

fn archive_padlen(off: u64, alignment: u64) -> u64 {
    (alignment - (off & (alignment - 1))) % alignment
}

// this fn is inefficient, but optimizing for hardlinks isn't high priority
fn archive_flush_unseen_hardlinks<W: Write + Seek>(
    state: &mut ArchiveState,
    props: &ArchiveProperties,
    mut writer: W,
) -> std::io::Result<()> {
    let mut deferred_inpaths: Vec<PathBuf> = Vec::new();
    for id in state.ids.iter_mut() {
        for hl in id.hls.iter_mut() {
            if hl.seen == 0 || hl.seen == hl.nlink {
                dout!("HardlinkState complete with seen {}", hl.seen);
                continue;
            }
            dout!(
                "pending HardlinkState with seen {} != nlinks {}",
                hl.seen,
                hl.nlink
            );

            while hl.names.len() > 0 {
                let path = hl.names.pop().unwrap();
                deferred_inpaths.push(path.infile);
            }
            // ensure that data segment gets added on archive_path recall
            hl.nlink = hl.seen;
            hl.seen = 0;
            // existing allocated inode should be used
        }
    }

    if deferred_inpaths.len() > 0 {
        // rotate-right to match gnu ordering
        deferred_inpaths.rotate_right(1);

        // .reverse() to match gnu ordering
        for p in deferred_inpaths.iter().rev() {
            archive_path(state, props, p.as_path(), &mut writer)?;
        }
    }

    Ok(())
}

fn archive_trailer<W: Write>(mut writer: W, cur_off: u64) -> std::io::Result<u64> {
    let fname = "TRAILER!!!";
    let fname_len = fname.len() + 1;

    write!(
        writer,
        NEWC_HDR_FMT!(),
        magic = "070701",
        ino = 0,
        mode = 0,
        uid = 0,
        gid = 0,
        nlink = 1,
        mtime = 0,
        filesize = 0,
        major = 0,
        minor = 0,
        rmajor = 0,
        rminor = 0,
        namesize = fname_len,
        chksum = 0
    )?;
    let mut off: u64 = cur_off + NEWC_HDR_LEN;

    let padding_len = archive_padlen(off + fname_len as u64, 4);
    write!(
        writer,
        "{}\0{pad:.padlen$}",
        fname,
        padlen = padding_len as usize,
        pad = "\0\0\0"
    )?;
    off += fname_len as u64 + padding_len as u64;

    Ok(off)
}

fn archive_loop<R: BufRead, W: Seek + Write>(
    mut reader: R,
    mut writer: W,
    props: &ArchiveProperties,
) -> std::io::Result<u64> {
    if props.data_align > 0 && (props.initial_data_off + u64::from(props.data_align)) % 4 != 0 {
        // must satisfy both data_align and cpio 4-byte padding alignment
        return Err(io::Error::new(
            io::ErrorKind::InvalidInput,
            "data alignment must be a multiple of 4",
        ));
    }

    let mut state = ArchiveState::new(props.initial_ino);
    loop {
        let mut linebuf: Vec<u8> = Vec::new();
        let mut r = reader.by_ref().take(PATH_MAX);
        match r.read_until(props.list_separator, &mut linebuf) {
            Ok(l) => {
                if l == 0 {
                    break; // EOF
                }
                if l >= PATH_MAX.try_into().unwrap() {
                    return Err(io::Error::new(io::ErrorKind::InvalidInput, "path too long"));
                }
            }
            Err(e) => {
                println!("read_until() failed: {}", e);
                return Err(e);
            }
        };

        // trim separator. len > 0 already checked.
        let last_byte = linebuf.last().unwrap();
        if *last_byte == props.list_separator {
            linebuf.pop().unwrap();
            if linebuf.len() == 0 {
                continue;
            }
        } else {
            println!(
                "\'{:0x}\' ending not separator \'{:0x}\' terminated",
                last_byte, props.list_separator
            );
        }

        let linestr = OsStr::from_bytes(linebuf.as_slice());
        let path = Path::new(linestr);
        archive_path(&mut state, props, path, &mut writer)?;
    }
    archive_flush_unseen_hardlinks(&mut state, props, &mut writer)?;
    state.off = archive_trailer(&mut writer, state.off)?;

    // GNU cpio pads the end of an archive out to blocklen with zeros
    let block_padlen = archive_padlen(state.off, 512);
    if block_padlen > 0 {
        let z = vec![0u8; block_padlen.try_into().unwrap()];
        writer.write_all(&z)?;
        state.off += block_padlen;
    }
    writer.flush()?;

    Ok(state.off)
}

fn params_usage(params: &[Argument]) {
    argument::print_help("dracut-cpio", "OUTPUT", params);
    println!("\nExample: find fs-tree/ | dracut-cpio archive.cpio\n");
}

fn params_process(props: &mut ArchiveProperties) -> argument::Result<PathBuf> {
    let params = &[
        Argument::positional("OUTPUT", "Write cpio archive to this file path."),
        Argument::value(
            "data-align",
            "ALIGNMENT",
            "Attempt to pad archive to achieve ALIGNMENT for file data.",
        ),
        Argument::short_flag(
            '0',
            "null",
            "Expect null delimeters in stdin filename list instead of newline.",
        ),
        Argument::value(
            "mtime",
            "EPOCH",
            "Use EPOCH for archived mtime instead of filesystem reported values.",
        ),
        Argument::value(
            "owner",
            "UID:GID",
            "Use UID and GID instead of filesystem reported owner values.",
        ),
        Argument::flag(
            "truncate-existing",
            "Truncate and overwrite any existing OUTPUT file, instead of appending.",
        ),
        Argument::short_flag('h', "help", "Print help message."),
    ];

    let mut positional_args = 0;
    let args = env::args().skip(1); // skip binary name
    let match_res = argument::set_arguments(args, params, |name, value| {
        match name {
            "" => positional_args += 1,
            "data-align" => {
                let v: u32 = value
                    .unwrap()
                    .parse()
                    .map_err(|_| argument::Error::InvalidValue {
                        value: value.unwrap().to_owned(),
                        expected: String::from("data-align must be an integer"),
                    })?;
                if v > props.namesize_max {
                    println!(
                        concat!(
                            "Requested data-align {} larger than namesize maximum {}.",
                            " This will likely result in misalignment."
                        ),
                        v, props.namesize_max
                    );
                }
                props.data_align = v;
            }
            "null" => props.list_separator = b'\0',
            "mtime" => {
                let v: u32 = value
                    .unwrap()
                    .parse()
                    .map_err(|_| argument::Error::InvalidValue {
                        value: value.unwrap().to_owned(),
                        expected: String::from("mtime must be an integer"),
                    })?;
                props.fixed_mtime = Some(v);
            }
            "owner" => {
                let ugv_parsed: argument::Result<Vec<u32>> = value
                    .unwrap()
                    .split(':')
                    .map(|id| {
                        id.parse().map_err(|_| argument::Error::InvalidValue {
                            value: id.to_owned(),
                            expected: String::from("uid/gid must be an integer"),
                        })
                    })
                    .collect();

                let ugv_parsed = ugv_parsed?;
                if ugv_parsed.len() != 2 {
                    return Err(argument::Error::InvalidValue {
                        value: value.unwrap().to_owned(),
                        expected: String::from("owner must be UID:GID"),
                    });
                }
                props.fixed_uid = Some(ugv_parsed[0]);
                props.fixed_gid = Some(ugv_parsed[1]);
            }
            "truncate-existing" => props.truncate_existing = true,
            "help" => return Err(argument::Error::PrintHelp),
            _ => unreachable!(),
        };
        Ok(())
    });

    match match_res {
        Ok(_) => {
            if positional_args != 1 {
                params_usage(params);
                return Err(argument::Error::ExpectedArgument(
                    "one OUTPUT parameter required".to_string(),
                ));
            }
        }
        Err(e) => {
            params_usage(params);
            return Err(e);
        }
    }

    let last_arg = env::args_os().last().unwrap();
    Ok(PathBuf::from(&last_arg))
}

fn main() -> std::io::Result<()> {
    let mut props = ArchiveProperties::default();
    let output_path = match params_process(&mut props) {
        Ok(p) => p,
        Err(argument::Error::PrintHelp) => return Ok(()),
        Err(e) => return Err(io::Error::new(io::ErrorKind::InvalidInput, e.to_string())),
    };

    let mut f = fs::OpenOptions::new()
        .read(false)
        .write(true)
        .create(true)
        .truncate(props.truncate_existing)
        .open(&output_path)?;
    if !props.truncate_existing {
        props.initial_data_off = f.seek(io::SeekFrom::End(0))?;
    }
    let mut writer = io::BufWriter::new(f);

    let stdin = std::io::stdin();
    let mut reader = io::BufReader::new(stdin);

    let _wrote = archive_loop(&mut reader, &mut writer, &props)?;

    if props.initial_data_off > 0 {
        dout!(
            "appended {} bytes to archive {} at offset {}",
            _wrote,
            output_path.display(),
            props.initial_data_off
        );
    } else {
        dout!(
            "wrote {} bytes to archive {}",
            _wrote,
            output_path.display()
        );
    }

    Ok(())
}

// tests change working directory, so need to be run with:
// cargo test -- --test-threads=1 --nocapture
#[cfg(test)]
mod tests {
    use super::*;
    use std::cmp;
    use std::os::unix::fs as unixfs;
    use std::path::PathBuf;
    use std::process::{Command, Stdio};

    struct TempWorkDir {
        prev_dir: PathBuf,
        parent_tmp_dir: PathBuf,
        cleanup_files: Vec<PathBuf>,
        cleanup_dirs: Vec<PathBuf>,
        ignore_cleanup: bool, // useful for debugging
    }

    impl TempWorkDir {
        // create a temporary directory under CWD and cd into it.
        // The directory will be cleaned up when twd goes out of scope.
        pub fn new() -> TempWorkDir {
            let mut buf = [0u8; 16];
            let mut s = String::from("cpio-selftest-");
            fs::File::open("/dev/urandom")
                .unwrap()
                .read_exact(&mut buf)
                .unwrap();
            for i in &buf {
                s.push_str(&format!("{:02x}", i).to_string());
            }
            let mut twd = TempWorkDir {
                prev_dir: env::current_dir().unwrap(),
                parent_tmp_dir: {
                    let mut t = env::current_dir().unwrap().clone();
                    t.push(s);
                    println!("parent_tmp_dir: {}", t.display());
                    t
                },
                cleanup_files: Vec::new(),
                cleanup_dirs: Vec::new(),
                ignore_cleanup: false,
            };
            fs::create_dir(&twd.parent_tmp_dir).unwrap();
            twd.cleanup_dirs.push(twd.parent_tmp_dir.clone());
            env::set_current_dir(&twd.parent_tmp_dir).unwrap();

            twd
        }

        pub fn create_tmp_file(&mut self, name: &str, len_bytes: u64) {
            let mut bytes = len_bytes;
            let f = fs::File::create(name).unwrap();
            self.cleanup_files.push(PathBuf::from(name));
            let mut writer = io::BufWriter::new(f);
            let mut buf = [0u8; 512];

            for (i, elem) in buf.iter_mut().enumerate() {
                *elem = !(i & 0xFF) as u8;
            }

            while bytes > 0 {
                let this_len = cmp::min(buf.len(), bytes.try_into().unwrap());
                writer.write_all(&buf[0..this_len]).unwrap();
                bytes -= this_len as u64;
            }

            writer.flush().unwrap();
        }

        pub fn create_tmp_dir(&mut self, name: &str) {
            fs::create_dir(name).unwrap();
            self.cleanup_dirs.push(PathBuf::from(name));
        }

        // execute coreutils mknod NAME TYPE [MAJOR MINOR]
        pub fn create_tmp_mknod(&mut self, name: &str, typ: char,
                                maj_min: Option<(u32, u32)>) {
            let t = typ.to_string();
            let proc = match maj_min {
                Some(maj_min) => {
                    let (maj, min) = maj_min;
                    Command::new("mknod")
                        .args(&[name, &t, &maj.to_string(), &min.to_string()])
                        .spawn()
                },
                None => Command::new("mknod").args(&[name, &t]).spawn()
            };
            let status = proc.expect("mknod failed to start").wait().unwrap();
            assert!(status.success());

            self.cleanup_files.push(PathBuf::from(name));
        }
    }

    impl Drop for TempWorkDir {
        fn drop(&mut self) {
            for f in self.cleanup_files.iter().rev() {
                if self.ignore_cleanup {
                    println!("ignoring cleanup of file {}", f.display());
                    continue;
                }
                println!("cleaning up test file at {}", f.display());
                match fs::remove_file(f) {
                    Err(e) => println!("file removal failed {}", e),
                    Ok(_) => {}
                };
            }
            for f in self.cleanup_dirs.iter().rev() {
                if self.ignore_cleanup {
                    println!("ignoring cleanup of dir {}", f.display());
                    continue;
                }
                println!("cleaning up test dir at {}", f.display());
                match fs::remove_dir(f) {
                    Err(e) => println!("dir removal failed {}", e),
                    Ok(_) => {}
                };
            }
            println!("returning cwd to {}", self.prev_dir.display());
            env::set_current_dir(self.prev_dir.as_path()).unwrap();
        }
    }

    fn gnu_cpio_create(stdinput: &[u8], out: &str) {
        let mut proc = Command::new("cpio")
            .args(&["--quiet", "-o", "-H", "newc", "--reproducible", "-F", out])
            .stdin(Stdio::piped())
            .spawn()
            .expect("GNU cpio failed to start");
        {
            let mut stdin = proc.stdin.take().unwrap();
            stdin.write_all(stdinput).expect("Failed to write to stdin");
        }

        let status = proc.wait().unwrap();
        assert!(status.success());
    }

    #[test]
    fn test_archive_empty_file() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file.txt", 0);

        gnu_cpio_create("file.txt\n".as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        // use dracut-cpio to archive file.txt
        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new("file.txt\n".as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert_eq!(wrote, 512);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_small_file() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file.txt", 33);

        gnu_cpio_create("file.txt\n".as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new("file.txt\n".as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert!(wrote > NEWC_HDR_LEN * 2 + 33);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_prefixed_path() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file.txt", 0);

        gnu_cpio_create("./file.txt\n".as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new("./file.txt\n".as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert_eq!(wrote, 512);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_absolute_path() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file.txt", 0);

        let canon_path = fs::canonicalize("file.txt").unwrap();
        let mut canon_file_list = canon_path.into_os_string();
        canon_file_list.push("\n");

        gnu_cpio_create(canon_file_list.as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new(canon_file_list.as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert_eq!(wrote, 512);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_dir() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_dir("dir");

        gnu_cpio_create("dir\n".as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new("dir\n".as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert_eq!(wrote, 512);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_dir_file() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_dir("dir");
        twd.create_tmp_file("dir/file.txt", 512 * 32);
        let file_list: &str = "dir\n\ndir/file.txt\n"; // double separator

        gnu_cpio_create(file_list.as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new(file_list.as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert!(wrote > NEWC_HDR_LEN * 3 + 512 * 32);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_dot_path() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_dir("dir");
        twd.create_tmp_file("dir/file.txt", 512 * 32);
        let file_list: &str = ".\ndir\ndir/file.txt\n";

        gnu_cpio_create(file_list.as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new(file_list.as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert!(wrote > NEWC_HDR_LEN * 4 + 512 * 32);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_dot_slash_path() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_dir("dir");
        twd.create_tmp_file("dir/file.txt", 512 * 32);
        let file_list: &str = "./\ndir\ndir/file.txt\n";

        gnu_cpio_create(file_list.as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new(file_list.as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert!(wrote > NEWC_HDR_LEN * 4 + 512 * 32);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_symlink() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file.txt", 0);
        unixfs::symlink("file.txt", "symlink.txt").unwrap();
        twd.cleanup_files.push(PathBuf::from("symlink.txt"));

        gnu_cpio_create("file.txt\nsymlink.txt\n".as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new("file.txt\nsymlink.txt\n".as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert_eq!(wrote, 512);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_fifo() {
        let mut twd = TempWorkDir::new();

        twd.create_tmp_mknod("fifo", 'p', None);

        gnu_cpio_create("fifo\n".as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new("fifo\n".as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert_eq!(wrote, 512);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_char() {
        let mut twd = TempWorkDir::new();

        gnu_cpio_create("/dev/zero\n".as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new("/dev/zero\n".as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert_eq!(wrote, 512);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_data_align() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_dir("dir");
        twd.create_tmp_file("dir/file.txt", 1024 * 1024); // 1M

        twd.create_tmp_dir("extractor");
        let f = fs::File::create("extractor/dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new("dir\ndir/file.txt\n".as_bytes());
        // 4k cpio data segment alignment injects zeros after filename nullterm
        let wrote = archive_loop(
            &mut reader,
            &mut writer,
            &ArchiveProperties {
                data_align: 4096,
                ..ArchiveProperties::default()
            },
        )
        .unwrap();
        twd.cleanup_files
            .push(PathBuf::from("extractor/dracut.cpio"));
        assert!(wrote > NEWC_HDR_LEN * 3 + 1024 * 1024);

        // check 4k data segment alignment
        let mut proc = Command::new("diff")
            .args(&["dir/file.txt", "-"])
            .stdin(Stdio::piped())
            .spawn()
            .expect("diff failed to start");
        {
            let f = fs::File::open("extractor/dracut.cpio").unwrap();
            let mut reader = io::BufReader::new(f);
            reader.seek(io::SeekFrom::Start(4096)).unwrap();
            let mut take = reader.take(1024 * 1024 as u64);
            let mut stdin = proc.stdin.take().unwrap();
            let copied = io::copy(&mut take, &mut stdin).unwrap();
            assert_eq!(copied, 1024 * 1024);
        }
        let status = proc.wait().unwrap();
        assert!(status.success());

        // confirm that GNU cpio can extract fname-zeroed paths
        let status = Command::new("cpio")
            .current_dir("extractor")
            .args(&["--quiet", "-i", "-H", "newc", "-F", "dracut.cpio"])
            .status()
            .expect("GNU cpio failed to start");
        assert!(status.success());
        twd.cleanup_files
            .push(PathBuf::from("extractor/dir/file.txt"));
        twd.cleanup_dirs.push(PathBuf::from("extractor/dir"));

        let status = Command::new("diff")
            .args(&["dir/file.txt", "extractor/dir/file.txt"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_data_align_off() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_dir("dir1");
        twd.create_tmp_dir("dir2");
        twd.create_tmp_dir("dir3");
        twd.create_tmp_file("dir1/file.txt", 514 * 1024);

        twd.create_tmp_dir("extractor");
        let data_before_cpio = [5u8; 16384 + 4];
        let f = fs::File::create("extractor/dracut.cpio").unwrap();
        twd.cleanup_files
            .push(PathBuf::from("extractor/dracut.cpio"));
        let mut writer = io::BufWriter::new(f);
        writer.write_all(&data_before_cpio).unwrap();
        let mut reader = io::BufReader::new("dir1\ndir2\ndir3\ndir1/file.txt\n".as_bytes());
        let wrote = archive_loop(
            &mut reader,
            &mut writer,
            &ArchiveProperties {
                data_align: 4096,
                initial_data_off: data_before_cpio.len() as u64,
                ..ArchiveProperties::default()
            },
        )
        .unwrap();
        assert!(wrote > NEWC_HDR_LEN * 5 + 514 * 1024);

        let mut proc = Command::new("diff")
            .args(&["dir1/file.txt", "-"])
            .stdin(Stdio::piped())
            .spawn()
            .expect("diff failed to start");
        {
            let f = fs::File::open("extractor/dracut.cpio").unwrap();
            let mut reader = io::BufReader::new(f);
            reader.seek(io::SeekFrom::Start(16384 + 4096)).unwrap();
            let mut take = reader.take(514 * 1024 as u64);
            let mut stdin = proc.stdin.take().unwrap();
            let copied = io::copy(&mut take, &mut stdin).unwrap();
            assert_eq!(copied, 514 * 1024);
        }
        let status = proc.wait().unwrap();
        assert!(status.success());
    }

    #[test]
    fn test_archive_data_align_off_bad() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file.txt", 514 * 1024);

        let data_before_cpio = [5u8; 16384 + 3];
        let f = fs::File::create("dracut.cpio").unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        let mut writer = io::BufWriter::new(f);
        writer.write_all(&data_before_cpio).unwrap();
        let mut reader = io::BufReader::new("file.txt\n".as_bytes());
        let res = archive_loop(
            &mut reader,
            &mut writer,
            &ArchiveProperties {
                data_align: 4096,
                initial_data_off: data_before_cpio.len() as u64,
                ..ArchiveProperties::default()
            },
        );
        assert!(res.is_err());
        assert_eq!(io::ErrorKind::InvalidInput, res.unwrap_err().kind());
    }

    #[test]
    fn test_archive_hardlinks_order() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file.txt", 512 * 4);
        fs::hard_link("file.txt", "link1.txt").unwrap();
        twd.cleanup_files.push(PathBuf::from("link1.txt"));
        fs::hard_link("file.txt", "link2.txt").unwrap();
        twd.cleanup_files.push(PathBuf::from("link2.txt"));
        twd.create_tmp_file("another.txt", 512 * 4);
        let file_list: &str = "file.txt\nanother.txt\nlink1.txt\nlink2.txt\n";

        gnu_cpio_create(file_list.as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new(file_list.as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert!(wrote > NEWC_HDR_LEN * 5 + 512 * 8);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_hardlinks_empty() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file.txt", 0);
        fs::hard_link("file.txt", "link1.txt").unwrap();
        twd.cleanup_files.push(PathBuf::from("link1.txt"));
        fs::hard_link("file.txt", "link2.txt").unwrap();
        twd.cleanup_files.push(PathBuf::from("link2.txt"));
        twd.create_tmp_file("another.txt", 512 * 4);
        let file_list: &str = "file.txt\nanother.txt\nlink1.txt\nlink2.txt\n";

        gnu_cpio_create(file_list.as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new(file_list.as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert!(wrote > NEWC_HDR_LEN * 5 + 512 * 4);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_hardlinks_missing() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file.txt", 512 * 4);
        fs::hard_link("file.txt", "link1.txt").unwrap();
        twd.cleanup_files.push(PathBuf::from("link1.txt"));
        fs::hard_link("file.txt", "link2.txt").unwrap();
        twd.cleanup_files.push(PathBuf::from("link2.txt"));
        fs::hard_link("file.txt", "link3.txt").unwrap();
        twd.cleanup_files.push(PathBuf::from("link3.txt"));
        twd.create_tmp_file("another.txt", 512 * 4);
        // link2 missing from the archive, throwing off deferrals
        let file_list: &str = "file.txt\nanother.txt\nlink1.txt\nlink3.txt\n";

        gnu_cpio_create(file_list.as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new(file_list.as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert!(wrote > NEWC_HDR_LEN * 5 + 512 * 8);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_hardlinks_multi() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file.txt", 512 * 4);
        fs::hard_link("file.txt", "link1.txt").unwrap();
        twd.cleanup_files.push(PathBuf::from("link1.txt"));
        fs::hard_link("file.txt", "link2.txt").unwrap();
        twd.cleanup_files.push(PathBuf::from("link2.txt"));
        twd.create_tmp_file("another.txt", 512 * 4);
        fs::hard_link("another.txt", "anotherlink.txt").unwrap();
        twd.cleanup_files.push(PathBuf::from("anotherlink.txt"));
        // link2 missing from the archive, throwing off deferrals
        let file_list: &str = "file.txt\nanother.txt\nlink1.txt\nanotherlink.txt\n";

        gnu_cpio_create(file_list.as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new(file_list.as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert!(wrote > NEWC_HDR_LEN * 5 + 512 * 8);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_duplicates() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file.txt", 512 * 4);
        twd.create_tmp_file("another.txt", 512 * 4);
        // file.txt is listed twice
        let file_list: &str = "file.txt\nanother.txt\nfile.txt\n";

        gnu_cpio_create(file_list.as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new(file_list.as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert!(wrote > NEWC_HDR_LEN * 4 + 512 * 12);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_hardlink_duplicates() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file.txt", 512 * 4);
        fs::hard_link("file.txt", "ln1.txt").unwrap();
        twd.cleanup_files.push(PathBuf::from("ln1.txt"));
        fs::hard_link("file.txt", "ln2.txt").unwrap();
        twd.cleanup_files.push(PathBuf::from("ln2.txt"));
        twd.create_tmp_file("f2.txt", 512 * 4);
        // ln1 listed twice
        let file_list: &str = "file.txt\nf2.txt\nln1.txt\nln1.txt\nln1.txt\n";

        gnu_cpio_create(file_list.as_bytes(), "gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new(file_list.as_bytes());
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert!(wrote > NEWC_HDR_LEN * 4 + 512 * 8);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_list_separator() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file1", 33);
        twd.create_tmp_file("file2", 55);
        let file_list_nulldelim: &str = "file1\0file2\0";

        let mut proc = Command::new("cpio")
            .args(&[
                "--quiet",
                "-o",
                "-H",
                "newc",
                "--reproducible",
                "-F",
                "gnu.cpio",
                "--null",
            ])
            .stdin(Stdio::piped())
            .spawn()
            .expect("GNU cpio failed to start");
        {
            let mut stdin = proc.stdin.take().unwrap();
            stdin
                .write_all(file_list_nulldelim.as_bytes())
                .expect("Failed to write to stdin");
        }

        let status = proc.wait().unwrap();
        assert!(status.success());
        twd.cleanup_files.push(PathBuf::from("gnu.cpio"));

        let f = fs::File::create("dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new(file_list_nulldelim.as_bytes());
        let wrote = archive_loop(
            &mut reader,
            &mut writer,
            &ArchiveProperties {
                list_separator: b'\0',
                ..ArchiveProperties::default()
            },
        )
        .unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut.cpio"));
        assert!(wrote > NEWC_HDR_LEN * 3 + 33 + 55);

        let status = Command::new("diff")
            .args(&["gnu.cpio", "dracut.cpio"])
            .status()
            .expect("diff failed to start");
        assert!(status.success());
    }

    #[test]
    fn test_archive_fixed_mtime() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file1", 33);
        twd.create_tmp_file("file2", 55);
        let file_list: &str = "file1\nfile2\n";

        twd.create_tmp_dir("extractor");
        let f = fs::File::create("extractor/dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new(file_list.as_bytes());
        let wrote = archive_loop(
            &mut reader,
            &mut writer,
            &ArchiveProperties {
                fixed_mtime: Some(0),
                ..ArchiveProperties::default()
            },
        )
        .unwrap();
        twd.cleanup_files
            .push(PathBuf::from("extractor/dracut.cpio"));
        assert!(wrote > NEWC_HDR_LEN * 3 + 33 + 55);

        let status = Command::new("cpio")
            .current_dir("extractor")
            .args(&[
                "--quiet",
                "-i",
                "--preserve-modification-time",
                "-H",
                "newc",
                "-F",
                "dracut.cpio",
            ])
            .status()
            .expect("GNU cpio failed to start");
        assert!(status.success());
        twd.cleanup_files.push(PathBuf::from("extractor/file1"));
        twd.cleanup_files.push(PathBuf::from("extractor/file2"));

        let md = fs::symlink_metadata("extractor/file1").unwrap();
        assert_eq!(md.mtime(), 0);
        let md = fs::symlink_metadata("extractor/file2").unwrap();
        assert_eq!(md.mtime(), 0);
    }

    #[test]
    fn test_archive_stat_mtime() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file1", 33);
        twd.create_tmp_file("file2", 55);
        let file_list: &str = "file1\nfile2\n";

        twd.create_tmp_dir("extractor");
        let f = fs::File::create("extractor/dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new(file_list.as_bytes());
        assert_eq!(ArchiveProperties::default().fixed_mtime, None);
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files
            .push(PathBuf::from("extractor/dracut.cpio"));
        assert!(wrote > NEWC_HDR_LEN * 3 + 33 + 55);

        let status = Command::new("cpio")
            .current_dir("extractor")
            .args(&[
                "--quiet",
                "-i",
                "--preserve-modification-time",
                "-H",
                "newc",
                "-F",
                "dracut.cpio",
            ])
            .status()
            .expect("GNU cpio failed to start");
        assert!(status.success());
        twd.cleanup_files.push(PathBuf::from("extractor/file1"));
        twd.cleanup_files.push(PathBuf::from("extractor/file2"));

        let src_md = fs::symlink_metadata("file1").unwrap();
        let ex_md = fs::symlink_metadata("extractor/file1").unwrap();
        assert_eq!(src_md.mtime(), ex_md.mtime());
        let src_md = fs::symlink_metadata("file2").unwrap();
        let ex_md = fs::symlink_metadata("extractor/file2").unwrap();
        assert_eq!(src_md.mtime(), ex_md.mtime());
    }

    #[test]
    fn test_archive_fixed_owner() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file1", 33);
        twd.create_tmp_file("file2", 55);
        let file_list: &str = "file1\nfile2\n";

        let md = fs::symlink_metadata("file1").unwrap();
        // ideally we should check the process euid, but this will do...
        if md.uid() != 0 {
            println!("SKIPPED: this test requires root");
            return;
        }

        twd.create_tmp_dir("extractor");
        let f = fs::File::create("extractor/dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new(file_list.as_bytes());
        let wrote = archive_loop(
            &mut reader,
            &mut writer,
            &ArchiveProperties {
                fixed_uid: Some(65534),
                fixed_gid: Some(65534),
                ..ArchiveProperties::default()
            },
        )
        .unwrap();
        twd.cleanup_files
            .push(PathBuf::from("extractor/dracut.cpio"));
        assert!(wrote > NEWC_HDR_LEN * 3 + 33 + 55);

        let status = Command::new("cpio")
            .current_dir("extractor")
            .args(&["--quiet", "-i", "-H", "newc", "-F", "dracut.cpio"])
            .status()
            .expect("GNU cpio failed to start");
        assert!(status.success());
        twd.cleanup_files.push(PathBuf::from("extractor/file1"));
        twd.cleanup_files.push(PathBuf::from("extractor/file2"));

        let md = fs::symlink_metadata("extractor/file1").unwrap();
        assert_eq!(md.uid(), 65534);
        assert_eq!(md.gid(), 65534);
        let md = fs::symlink_metadata("extractor/file2").unwrap();
        assert_eq!(md.uid(), 65534);
        assert_eq!(md.gid(), 65534);
    }

    #[test]
    fn test_archive_stat_owner() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file1", 33);
        twd.create_tmp_file("file2", 55);
        let file_list: &str = "file1\nfile2\n";

        twd.create_tmp_dir("extractor");
        let f = fs::File::create("extractor/dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new(file_list.as_bytes());
        assert_eq!(ArchiveProperties::default().fixed_uid, None);
        assert_eq!(ArchiveProperties::default().fixed_gid, None);
        let wrote = archive_loop(&mut reader, &mut writer, &ArchiveProperties::default()).unwrap();
        twd.cleanup_files
            .push(PathBuf::from("extractor/dracut.cpio"));
        assert!(wrote > NEWC_HDR_LEN * 3 + 33 + 55);

        let status = Command::new("cpio")
            .current_dir("extractor")
            .args(&["--quiet", "-i", "-H", "newc", "-F", "dracut.cpio"])
            .status()
            .expect("GNU cpio failed to start");
        assert!(status.success());
        twd.cleanup_files.push(PathBuf::from("extractor/file1"));
        twd.cleanup_files.push(PathBuf::from("extractor/file2"));

        let src_md = fs::symlink_metadata("file1").unwrap();
        let ex_md = fs::symlink_metadata("extractor/file1").unwrap();
        assert_eq!(src_md.uid(), ex_md.uid());
        assert_eq!(src_md.gid(), ex_md.gid());
        let src_md = fs::symlink_metadata("file2").unwrap();
        let ex_md = fs::symlink_metadata("extractor/file2").unwrap();
        assert_eq!(src_md.uid(), ex_md.uid());
        assert_eq!(src_md.gid(), ex_md.gid());
    }

    #[test]
    fn test_archive_dev_maj_min() {
        let mut twd = TempWorkDir::new();
        twd.create_tmp_file("file1", 0);

        let md = fs::symlink_metadata("file1").unwrap();
        if md.uid() != 0 {
            println!("SKIPPED: this test requires root");
            return;
        }

        twd.create_tmp_mknod("bdev1", 'b', Some((0x01, 0x01)));
        twd.create_tmp_mknod("bdev2", 'b', Some((0x02, 0x100)));
        twd.create_tmp_mknod("bdev3", 'b', Some((0x03, 0x1000)));
        twd.create_tmp_mknod("bdev4", 'b', Some((0x04, 0x10000)));
        twd.create_tmp_mknod("bdev5", 'b', Some((0x100, 0x05)));
        twd.create_tmp_mknod("bdev6", 'b', Some((0x100, 0x06)));
        let file_list: &str = "file1\nbdev1\nbdev2\nbdev3\nbdev4\nbdev5\nbdev6\n";

        // create GNU cpio archive
        twd.create_tmp_dir("gnucpio_xtr");
        gnu_cpio_create(file_list.as_bytes(), "gnucpio_xtr/gnu.cpio");
        twd.cleanup_files.push(PathBuf::from("gnucpio_xtr/gnu.cpio"));

        // create Dracut cpio archive
        twd.create_tmp_dir("dracut_xtr");
        let f = fs::File::create("dracut_xtr/dracut.cpio").unwrap();
        let mut writer = io::BufWriter::new(f);
        let mut reader = io::BufReader::new(file_list.as_bytes());
        let wrote = archive_loop(
            &mut reader,
            &mut writer,
            &ArchiveProperties::default()
        )
        .unwrap();
        twd.cleanup_files.push(PathBuf::from("dracut_xtr/dracut.cpio"));

        let file_list_count = file_list.split_terminator('\n').count() as u64;
        assert!(wrote >= NEWC_HDR_LEN * file_list_count
                         + (file_list.len() as u64));

        let status = Command::new("cpio")
            .current_dir("gnucpio_xtr")
            .args(&["--quiet", "-i", "-H", "newc", "-F", "gnu.cpio"])
            .status()
            .expect("GNU cpio failed to start");
        assert!(status.success());
        for s in file_list.split_terminator('\n') {
            let p = PathBuf::from("gnucpio_xtr/".to_owned() + s);
            twd.cleanup_files.push(p);
        }

        let status = Command::new("cpio")
            .current_dir("dracut_xtr")
            .args(&["--quiet", "-i", "-H", "newc", "-F", "dracut.cpio"])
            .status()
            .expect("GNU cpio failed to start");
        assert!(status.success());
        for s in file_list.split_terminator('\n') {
            let dp = PathBuf::from("dracut_xtr/".to_owned() + s);
            twd.cleanup_files.push(dp);
        }

        // diff extracted major/minor between dracut and GNU cpio created archives
        for s in file_list.split_terminator('\n') {
            let gmd = fs::symlink_metadata("gnucpio_xtr/".to_owned() + s).unwrap();
            let dmd = fs::symlink_metadata("dracut_xtr/".to_owned() + s).unwrap();
            print!("{}: cpio extracted dev_t gnu: {:#x}, dracut: {:#x}\n",
                   s, gmd.rdev(), dmd.rdev());
            assert!(gmd.rdev() == dmd.rdev());
        }
    }
}
 0707010000022E000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/src/dracut-cpio/third_party 0707010000022F000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/src/dracut-cpio/third_party/crosvm  07070100000230000081A400000000000000000000000164DF2CB80000007D000000000000000000000000000000000000004C00000000dracut-055+suse.347.gdcb9bdbf/src/dracut-cpio/third_party/crosvm/Cargo.toml   [package]
name = "crosvm"
version = "0.1.0"
authors = ["The Chromium OS Authors"]
edition = "2018"

[lib]
path = "crosvm.rs"
   07070100000231000081A400000000000000000000000164DF2CB80000061A000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/src/dracut-cpio/third_party/crosvm/LICENSE  // Copyright 2017 The Chromium OS Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//    * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//    * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//    * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  07070100000232000081A400000000000000000000000164DF2CB800004B81000000000000000000000000000000000000004D00000000dracut-055+suse.347.gdcb9bdbf/src/dracut-cpio/third_party/crosvm/argument.rs  // Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//! Handles argument parsing.
//!
//! # Example
//!
//! ```
//! # use crosvm::argument::{Argument, Error, print_help, set_arguments};
//! # let args: std::slice::Iter<String> = [].iter();
//! let arguments = &[
//!     Argument::positional("FILES", "files to operate on"),
//!     Argument::short_value('p', "program", "PROGRAM", "Program to apply to each file"),
//!     Argument::short_value('c', "cpus", "N", "Number of CPUs to use. (default: 1)"),
//!     Argument::flag("unmount", "Unmount the root"),
//!     Argument::short_flag('h', "help", "Print help message."),
//! ];
//!
//! let match_res = set_arguments(args, arguments, |name, value| {
//!     match name {
//!         "" => println!("positional arg! {}", value.unwrap()),
//!         "program" => println!("gonna use program {}", value.unwrap()),
//!         "cpus" => {
//!             let v: u32 = value.unwrap().parse().map_err(|_| {
//!                 Error::InvalidValue {
//!                     value: value.unwrap().to_owned(),
//!                     expected: String::from("this value for `cpus` needs to be integer"),
//!                 }
//!             })?;
//!         }
//!         "unmount" => println!("gonna unmount"),
//!         "help" => return Err(Error::PrintHelp),
//!         _ => unreachable!(),
//!     }
//!     unreachable!();
//! });
//!
//! match match_res {
//!     Ok(_) => println!("running with settings"),
//!     Err(Error::PrintHelp) => print_help("best_program", "FILES", arguments),
//!     Err(e) => println!("{}", e),
//! }
//! ```

use std::fmt::{self, Display};
use std::result;

/// An error with argument parsing.
#[derive(Debug)]
pub enum Error {
    /// There was a syntax error with the argument.
    Syntax(String),
    /// The argument's name is unused.
    UnknownArgument(String),
    /// The argument was required.
    ExpectedArgument(String),
    /// The argument's given value is invalid.
    InvalidValue { value: String, expected: String },
    /// The argument was already given and none more are expected.
    TooManyArguments(String),
    /// The argument expects a value.
    ExpectedValue(String),
    /// The argument does not expect a value.
    UnexpectedValue(String),
    /// The help information was requested
    PrintHelp,
}

impl Display for Error {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        use self::Error::*;

        match self {
            Syntax(s) => write!(f, "syntax error: {}", s),
            UnknownArgument(s) => write!(f, "unknown argument: {}", s),
            ExpectedArgument(s) => write!(f, "expected argument: {}", s),
            InvalidValue { value, expected } => {
                write!(f, "invalid value {:?}: {}", value, expected)
            }
            TooManyArguments(s) => write!(f, "too many arguments: {}", s),
            ExpectedValue(s) => write!(f, "expected parameter value: {}", s),
            UnexpectedValue(s) => write!(f, "unexpected parameter value: {}", s),
            PrintHelp => write!(f, "help was requested"),
        }
    }
}

/// Result of a argument parsing.
pub type Result<T> = result::Result<T, Error>;

#[derive(Debug, PartialEq)]
pub enum ArgumentValueMode {
    /// Specifies that an argument requires a value and that an error should be generated if
    /// no value is provided during parsing.
    Required,

    /// Specifies that an argument does not allow a value and that an error should be returned
    /// if a value is provided during parsing.
    Disallowed,

    /// Specifies that an argument may have a value during parsing but is not required to.
    Optional,
}

/// Information about an argument expected from the command line.
///
/// # Examples
///
/// To indicate a flag style argument:
///
/// ```
/// # use crosvm::argument::Argument;
/// Argument::short_flag('f', "flag", "enable awesome mode");
/// ```
///
/// To indicate a parameter style argument that expects a value:
///
/// ```
/// # use crosvm::argument::Argument;
/// // "VALUE" and "NETMASK" are placeholder values displayed in the help message for these
/// // arguments.
/// Argument::short_value('v', "val", "VALUE", "how much do you value this usage information");
/// Argument::value("netmask", "NETMASK", "hides your netface");
/// ```
///
/// To indicate an argument with no short version:
///
/// ```
/// # use crosvm::argument::Argument;
/// Argument::flag("verbose", "this option is hard to type quickly");
/// ```
///
/// To indicate a positional argument:
///
/// ```
/// # use crosvm::argument::Argument;
/// Argument::positional("VALUES", "these are positional arguments");
/// ```
pub struct Argument {
    /// The name of the value to display in the usage information.
    pub value: Option<&'static str>,
    /// Specifies how values should be handled for this this argument.
    pub value_mode: ArgumentValueMode,
    /// Optional single character shortened argument name.
    pub short: Option<char>,
    /// The long name of this argument.
    pub long: &'static str,
    /// Helpfuly usage information for this argument to display to the user.
    pub help: &'static str,
}

impl Argument {
    pub fn positional(value: &'static str, help: &'static str) -> Argument {
        Argument {
            value: Some(value),
            value_mode: ArgumentValueMode::Required,
            short: None,
            long: "",
            help,
        }
    }

    pub fn value(long: &'static str, value: &'static str, help: &'static str) -> Argument {
        Argument {
            value: Some(value),
            value_mode: ArgumentValueMode::Required,
            short: None,
            long,
            help,
        }
    }

    pub fn short_value(
        short: char,
        long: &'static str,
        value: &'static str,
        help: &'static str,
    ) -> Argument {
        Argument {
            value: Some(value),
            value_mode: ArgumentValueMode::Required,
            short: Some(short),
            long,
            help,
        }
    }

    pub fn flag(long: &'static str, help: &'static str) -> Argument {
        Argument {
            value: None,
            value_mode: ArgumentValueMode::Disallowed,
            short: None,
            long,
            help,
        }
    }

    pub fn short_flag(short: char, long: &'static str, help: &'static str) -> Argument {
        Argument {
            value: None,
            value_mode: ArgumentValueMode::Disallowed,
            short: Some(short),
            long,
            help,
        }
    }

    pub fn flag_or_value(long: &'static str, value: &'static str, help: &'static str) -> Argument {
        Argument {
            value: Some(value),
            value_mode: ArgumentValueMode::Optional,
            short: None,
            long,
            help,
        }
    }
}

fn parse_arguments<I, R, F>(args: I, mut f: F) -> Result<()>
where
    I: Iterator<Item = R>,
    R: AsRef<str>,
    F: FnMut(&str, Option<&str>) -> Result<()>,
{
    enum State {
        // Initial state at the start and after finishing a single argument/value.
        Top,
        // The remaining arguments are all positional.
        Positional,
        // The next string is the value for the argument `name`.
        Value { name: String },
    }
    let mut s = State::Top;
    for arg in args {
        let arg = arg.as_ref();
        loop {
            let mut arg_consumed = true;
            s = match s {
                State::Top => {
                    if arg == "--" {
                        State::Positional
                    } else if arg.starts_with("--") {
                        let param = arg.trim_start_matches('-');
                        if param.contains('=') {
                            let mut iter = param.splitn(2, '=');
                            let name = iter.next().unwrap();
                            let value = iter.next().unwrap();
                            if name.is_empty() {
                                return Err(Error::Syntax(
                                    "expected parameter name before `=`".to_owned(),
                                ));
                            }
                            if value.is_empty() {
                                return Err(Error::Syntax(
                                    "expected parameter value after `=`".to_owned(),
                                ));
                            }
                            f(name, Some(value))?;
                            State::Top
                        } else {
                            State::Value {
                                name: param.to_owned(),
                            }
                        }
                    } else if arg.starts_with('-') {
                        if arg.len() == 1 {
                            return Err(Error::Syntax(
                                "expected argument short name after `-`".to_owned(),
                            ));
                        }
                        let name = &arg[1..2];
                        let value = if arg.len() > 2 { Some(&arg[2..]) } else { None };
                        if let Err(e) = f(name, value) {
                            if let Error::ExpectedValue(_) = e {
                                State::Value {
                                    name: name.to_owned(),
                                }
                            } else {
                                return Err(e);
                            }
                        } else {
                            State::Top
                        }
                    } else {
                        f("", Some(&arg))?;
                        State::Positional
                    }
                }
                State::Positional => {
                    f("", Some(&arg))?;
                    State::Positional
                }
                State::Value { name } => {
                    if arg.starts_with('-') {
                        arg_consumed = false;
                        f(&name, None)?;
                    } else if let Err(e) = f(&name, Some(&arg)) {
                        arg_consumed = false;
                        f(&name, None).map_err(|_| e)?;
                    }
                    State::Top
                }
            };

            if arg_consumed {
                break;
            }
        }
    }

    // If we ran out of arguments while parsing the last parameter, which may be either a
    // value parameter or a flag, try to parse it as a flag. This will produce "missing value"
    // error if the parameter is in fact a value parameter, which is the desired outcome.
    match s {
        State::Value { name } => f(&name, None),
        _ => Ok(()),
    }
}

/// Parses the given `args` against the list of know arguments `arg_list` and calls `f` with each
/// present argument and value if required.
///
/// This function guarantees that only valid long argument names from `arg_list` are sent to the
/// callback `f`. It is also guaranteed that if an arg requires a value (i.e.
/// `arg.value.is_some()`), the value will be `Some` in the callbacks arguments. If the callback
/// returns `Err`, this function will end parsing and return that `Err`.
///
/// See the [module level](index.html) example for a usage example.
pub fn set_arguments<I, R, F>(args: I, arg_list: &[Argument], mut f: F) -> Result<()>
where
    I: Iterator<Item = R>,
    R: AsRef<str>,
    F: FnMut(&str, Option<&str>) -> Result<()>,
{
    parse_arguments(args, |name, value| {
        let mut matches = None;
        for arg in arg_list {
            if let Some(short) = arg.short {
                if name.len() == 1 && name.starts_with(short) {
                    if value.is_some() != arg.value.is_some() {
                        return Err(Error::ExpectedValue(short.to_string()));
                    }
                    matches = Some(arg.long);
                }
            }
            if matches.is_none() && arg.long == name {
                if value.is_none() && arg.value_mode == ArgumentValueMode::Required {
                    return Err(Error::ExpectedValue(arg.long.to_owned()));
                }
                if value.is_some() && arg.value_mode == ArgumentValueMode::Disallowed {
                    return Err(Error::UnexpectedValue(arg.long.to_owned()));
                }
                matches = Some(arg.long);
            }
        }
        match matches {
            Some(long) => f(long, value),
            None => Err(Error::UnknownArgument(name.to_owned())),
        }
    })
}

/// Prints command line usage information to stdout.
///
/// Usage information is printed according to the help fields in `args` with a leading usage line.
/// The usage line is of the format "`program_name` \[ARGUMENTS\] `required_arg`".
pub fn print_help(program_name: &str, required_arg: &str, args: &[Argument]) {
    println!(
        "Usage: {} {}{}\n",
        program_name,
        if args.is_empty() { "" } else { "[ARGUMENTS] " },
        required_arg
    );
    if args.is_empty() {
        return;
    }
    println!("Argument{}:", if args.len() > 1 { "s" } else { "" });
    for arg in args {
        match arg.short {
            Some(s) => print!(" -{}, ", s),
            None => print!("     "),
        }
        if arg.long.is_empty() {
            print!("  ");
        } else {
            print!("--");
        }
        print!("{:<12}", arg.long);
        if let Some(v) = arg.value {
            if arg.long.is_empty() {
                print!(" ");
            } else {
                print!("=");
            }
            print!("{:<10}", v);
        } else {
            print!("{:<11}", "");
        }
        println!("{}", arg.help);
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn request_help() {
        let arguments = [Argument::short_flag('h', "help", "Print help message.")];

        let match_res = set_arguments(["-h"].iter(), &arguments[..], |name, _| {
            match name {
                "help" => return Err(Error::PrintHelp),
                _ => unreachable!(),
            };
        });
        match match_res {
            Err(Error::PrintHelp) => {}
            _ => unreachable!(),
        }
    }

    #[test]
    fn mixed_args() {
        let arguments = [
            Argument::positional("FILES", "files to operate on"),
            Argument::short_value('p', "program", "PROGRAM", "Program to apply to each file"),
            Argument::short_value('c', "cpus", "N", "Number of CPUs to use. (default: 1)"),
            Argument::flag("unmount", "Unmount the root"),
            Argument::short_flag('h', "help", "Print help message."),
        ];

        let mut unmount = false;
        let match_res = set_arguments(
            ["--cpus", "3", "--program", "hello", "--unmount", "file"].iter(),
            &arguments[..],
            |name, value| {
                match name {
                    "" => assert_eq!(value.unwrap(), "file"),
                    "program" => assert_eq!(value.unwrap(), "hello"),
                    "cpus" => {
                        let c: u32 = value.unwrap().parse().map_err(|_| Error::InvalidValue {
                            value: value.unwrap().to_owned(),
                            expected: String::from("this value for `cpus` needs to be integer"),
                        })?;
                        assert_eq!(c, 3);
                    }
                    "unmount" => unmount = true,
                    "help" => return Err(Error::PrintHelp),
                    _ => unreachable!(),
                };
                Ok(())
            },
        );
        assert!(match_res.is_ok());
        assert!(unmount);
    }

    #[test]
    fn name_value_pair() {
        let arguments = [Argument::short_value(
            'c',
            "cpus",
            "N",
            "Number of CPUs to use. (default: 1)",
        )];
        let match_res = set_arguments(
            ["-c", "5", "--cpus", "5", "-c5", "--cpus=5"].iter(),
            &arguments[..],
            |name, value| {
                assert_eq!(name, "cpus");
                assert_eq!(value, Some("5"));
                Ok(())
            },
        );
        assert!(match_res.is_ok());
        let not_match_res = set_arguments(
            ["-c", "5", "--cpus"].iter(),
            &arguments[..],
            |name, value| {
                assert_eq!(name, "cpus");
                assert_eq!(value, Some("5"));
                Ok(())
            },
        );
        assert!(not_match_res.is_err());
    }

    #[test]
    fn flag_or_value() {
        let run_case = |args| -> Option<String> {
            let arguments = [
                Argument::positional("FILES", "files to operate on"),
                Argument::flag_or_value("gpu", "[2D|3D]", "Enable or configure gpu"),
                Argument::flag("foo", "Enable foo."),
                Argument::value("bar", "stuff", "Configure bar."),
            ];

            let mut gpu_value: Option<String> = None;
            let match_res =
                set_arguments(args, &arguments[..], |name: &str, value: Option<&str>| {
                    match name {
                        "" => assert_eq!(value.unwrap(), "file1"),
                        "foo" => assert!(value.is_none()),
                        "bar" => assert_eq!(value.unwrap(), "stuff"),
                        "gpu" => match value {
                            Some(v) => match v {
                                "2D" | "3D" => {
                                    gpu_value = Some(v.to_string());
                                }
                                _ => {
                                    return Err(Error::InvalidValue {
                                        value: v.to_string(),
                                        expected: String::from("2D or 3D"),
                                    })
                                }
                            },
                            None => {
                                gpu_value = None;
                            }
                        },
                        _ => unreachable!(),
                    };
                    Ok(())
                });

            assert!(match_res.is_ok());
            gpu_value
        };

        // Used as flag and followed by positional
        assert_eq!(run_case(["--gpu", "file1"].iter()), None);
        // Used as flag and followed by flag
        assert_eq!(run_case(["--gpu", "--foo", "file1",].iter()), None);
        // Used as flag and followed by value
        assert_eq!(run_case(["--gpu", "--bar=stuff", "file1"].iter()), None);

        // Used as value and followed by positional
        assert_eq!(run_case(["--gpu=2D", "file1"].iter()).unwrap(), "2D");
        // Used as value and followed by flag
        assert_eq!(run_case(["--gpu=2D", "--foo"].iter()).unwrap(), "2D");
        // Used as value and followed by value
        assert_eq!(
            run_case(["--gpu=2D", "--bar=stuff", "file1"].iter()).unwrap(),
            "2D"
        );
    }
}
   07070100000233000081A400000000000000000000000164DF2CB800000060000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/src/dracut-cpio/third_party/crosvm/crosvm.rs    // ensure that existing crosvm::argument imports work without modification...
pub mod argument;
07070100000234000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002A00000000dracut-055+suse.347.gdcb9bdbf/src/install 07070100000235000081A400000000000000000000000164DF2CB80000004F000000000000000000000000000000000000003600000000dracut-055+suse.347.gdcb9bdbf/src/install/.kateconfig kate: space-indent on; tab-width 8; indent-width 8; replace-tabs on; eol unix;
 07070100000236000081A400000000000000000000000164DF2CB800000044000000000000000000000000000000000000003300000000dracut-055+suse.347.gdcb9bdbf/src/install/Makefile    all:
	$(MAKE) -C ..

clean:
	$(MAKE) -C .. clean

.PHONY: all clean
07070100000237000081A400000000000000000000000164DF2CB80001417E000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/src/install/dracut-install.c    /* dracut-install.c  -- install files and executables

   Copyright (C) 2012 Harald Hoyer
   Copyright (C) 2012 Red Hat, Inc.  All rights reserved.

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

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

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

#define PROGRAM_VERSION_STRING "2"

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef _FILE_OFFSET_BITS
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <glob.h>
#include <libgen.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <libkmod.h>
#include <fts.h>
#include <regex.h>
#include <sys/utsname.h>

#include "log.h"
#include "hashmap.h"
#include "util.h"
#include "strv.h"

static bool arg_hmac = false;
static bool arg_createdir = false;
static int arg_loglevel = -1;
static bool arg_optional = false;
static bool arg_silent = false;
static bool arg_all = false;
static bool arg_module = false;
static bool arg_modalias = false;
static bool arg_resolvelazy = false;
static bool arg_resolvedeps = false;
static bool arg_hostonly = false;
static bool no_xattr = false;
static bool arg_supported = false;
static char *destrootdir = NULL;
static char *sysrootdir = NULL;
static size_t sysrootdirlen = 0;
static char *kerneldir = NULL;
static size_t kerneldirlen = 0;
static char **firmwaredirs = NULL;
static char **pathdirs;
static char *ldd = NULL;
static char *logdir = NULL;
static char *logfile = NULL;
FILE *logfile_f = NULL;
static Hashmap *items = NULL;
static Hashmap *items_failed = NULL;
static Hashmap *modules_loaded = NULL;
static regex_t mod_filter_path;
static regex_t mod_filter_nopath;
static regex_t mod_filter_symbol;
static regex_t mod_filter_nosymbol;
static regex_t mod_filter_noname;
static bool arg_mod_filter_path = false;
static bool arg_mod_filter_nopath = false;
static bool arg_mod_filter_symbol = false;
static bool arg_mod_filter_nosymbol = false;
static bool arg_mod_filter_noname = false;

static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst);

static inline void kmod_module_unrefp(struct kmod_module **p)
{
        if (*p)
                kmod_module_unref(*p);
}

#define _cleanup_kmod_module_unref_ _cleanup_(kmod_module_unrefp)

static inline void kmod_module_unref_listp(struct kmod_list **p)
{
        if (*p)
                kmod_module_unref_list(*p);
}

#define _cleanup_kmod_module_unref_list_ _cleanup_(kmod_module_unref_listp)

static inline void kmod_module_info_free_listp(struct kmod_list **p)
{
        if (*p)
                kmod_module_info_free_list(*p);
}

#define _cleanup_kmod_module_info_free_list_ _cleanup_(kmod_module_info_free_listp)

static inline void kmod_unrefp(struct kmod_ctx **p)
{
        kmod_unref(*p);
}

#define _cleanup_kmod_unref_ _cleanup_(kmod_unrefp)

static inline void kmod_module_dependency_symbols_free_listp(struct kmod_list **p)
{
        if (*p)
                kmod_module_dependency_symbols_free_list(*p);
}

#define _cleanup_kmod_module_dependency_symbols_free_list_ _cleanup_(kmod_module_dependency_symbols_free_listp)

static inline void fts_closep(FTS **p)
{
        if (*p)
                fts_close(*p);
}

#define _cleanup_fts_close_ _cleanup_(fts_closep)

#define _cleanup_globfree_ _cleanup_(globfree)

static size_t dir_len(char const *file)
{
        size_t length;

        if (!file)
                return 0;

        /* Strip the basename and any redundant slashes before it.  */
        for (length = strlen(file) - 1; 0 < length; length--)
                if (file[length] == '/' && file[length - 1] != '/')
                        break;
        return length;
}

static char *convert_abs_rel(const char *from, const char *target)
{
        /* we use the 4*MAXPATHLEN, which should not overrun */
        char relative_from[MAXPATHLEN * 4];
        _cleanup_free_ char *realtarget = NULL;
        _cleanup_free_ char *target_dir_p = NULL, *realpath_p = NULL;
        const char *realfrom = from;
        size_t level = 0, fromlevel = 0, targetlevel = 0;
        int l;
        size_t i, rl, dirlen;
        int ret;

        target_dir_p = strdup(target);
        if (!target_dir_p)
                return strdup(from);

        dirlen = dir_len(target_dir_p);
        target_dir_p[dirlen] = '\0';
        realpath_p = realpath(target_dir_p, NULL);

        if (realpath_p == NULL) {
                log_warning("convert_abs_rel(): target '%s' directory has no realpath.", target);
                return strdup(from);
        }

        /* dir_len() skips double /'s e.g. //lib64, so we can't skip just one
         * character - need to skip all leading /'s */
        rl = strlen(target);
        for (i = dirlen + 1; i < rl; ++i)
                if (target_dir_p[i] != '/')
                        break;
        ret = asprintf(&realtarget, "%s/%s", realpath_p, &target_dir_p[i]);
        if (ret < 0) {
                log_error("Out of memory!");
                exit(EXIT_FAILURE);
        }

        /* now calculate the relative path from <from> to <target> and
           store it in <relative_from>
         */
        relative_from[0] = 0;
        rl = 0;

        /* count the pathname elements of realtarget */
        for (targetlevel = 0, i = 0; realtarget[i]; i++)
                if (realtarget[i] == '/')
                        targetlevel++;

        /* count the pathname elements of realfrom */
        for (fromlevel = 0, i = 0; realfrom[i]; i++)
                if (realfrom[i] == '/')
                        fromlevel++;

        /* count the pathname elements, which are common for both paths */
        for (level = 0, i = 0; realtarget[i] && (realtarget[i] == realfrom[i]); i++)
                if (realtarget[i] == '/')
                        level++;

        /* add "../" to the relative_from path, until the common pathname is
           reached */
        for (i = level; i < targetlevel; i++) {
                if (i != level)
                        relative_from[rl++] = '/';
                relative_from[rl++] = '.';
                relative_from[rl++] = '.';
        }

        /* set l to the next uncommon pathname element in realfrom */
        for (l = 1, i = 1; i < level; i++)
                for (l++; realfrom[l] && realfrom[l] != '/'; l++) ;
        /* skip next '/' */
        l++;

        /* append the uncommon rest of realfrom to the relative_from path */
        for (i = level; i <= fromlevel; i++) {
                if (rl)
                        relative_from[rl++] = '/';
                while (realfrom[l] && realfrom[l] != '/')
                        relative_from[rl++] = realfrom[l++];
                l++;
        }

        relative_from[rl] = 0;
        return strdup(relative_from);
}

static int ln_r(const char *src, const char *dst)
{
        int ret;
        _cleanup_free_ const char *points_to = convert_abs_rel(src, dst);

        log_info("ln -s '%s' '%s'", points_to, dst);
        ret = symlink(points_to, dst);

        if (ret != 0) {
                log_error("ERROR: ln -s '%s' '%s': %m", points_to, dst);
                return 1;
        }

        return 0;
}

/* Perform the O(1) btrfs clone operation, if possible.
   Upon success, return 0.  Otherwise, return -1 and set errno.  */
static inline int clone_file(int dest_fd, int src_fd)
{
#undef BTRFS_IOCTL_MAGIC
#define BTRFS_IOCTL_MAGIC 0x94
#undef BTRFS_IOC_CLONE
#define BTRFS_IOC_CLONE _IOW (BTRFS_IOCTL_MAGIC, 9, int)
        return ioctl(dest_fd, BTRFS_IOC_CLONE, src_fd);
}

static bool use_clone = true;

static int cp(const char *src, const char *dst)
{
        int pid;
        int ret = 0;

        if (use_clone) {
                struct stat sb;
                _cleanup_close_ int dest_desc = -1, source_desc = -1;

                if (lstat(src, &sb) != 0)
                        goto normal_copy;

                if (S_ISLNK(sb.st_mode))
                        goto normal_copy;

                source_desc = open(src, O_RDONLY | O_CLOEXEC);
                if (source_desc < 0)
                        goto normal_copy;

                dest_desc =
                        open(dst, O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC,
                             (sb.st_mode) & (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO));

                if (dest_desc < 0) {
                        goto normal_copy;
                }

                ret = clone_file(dest_desc, source_desc);

                if (ret == 0) {
                        struct timeval tv[2];
                        if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0)
                                if (fchown(dest_desc, (uid_t) - 1, sb.st_gid) != 0) {
                                        if (geteuid() == 0)
                                                log_error("Failed to chown %s: %m", dst);
                                        else
                                                log_info("Failed to chown %s: %m", dst);
                                }

                        tv[0].tv_sec = sb.st_atime;
                        tv[0].tv_usec = 0;
                        tv[1].tv_sec = sb.st_mtime;
                        tv[1].tv_usec = 0;
                        futimes(dest_desc, tv);
                        return ret;
                }
                close(dest_desc);
                dest_desc = -1;
                /* clone did not work, remove the file */
                unlink(dst);
                /* do not try clone again */
                use_clone = false;
        }

normal_copy:
        pid = fork();
        if (pid == 0) {
                if (geteuid() == 0 && no_xattr == false)
                        execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,xattr,timestamps,ownership", "-fL",
                               src, dst, NULL);
                else
                        execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,timestamps,ownership", "-fL", src,
                               dst, NULL);
                _exit(EXIT_FAILURE);
        }

        while (waitpid(pid, &ret, 0) < 0) {
                if (errno != EINTR) {
                        ret = -1;
                        if (geteuid() == 0 && no_xattr == false)
                                log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,xattr,timestamps,ownership -fL %s %s",
                                          src, dst);
                        else
                                log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,timestamps,ownership -fL %s %s",
                                          src, dst);
                        break;
                }
        }
        log_debug("cp ret = %d", ret);
        return ret;
}

static int library_install(const char *src, const char *lib)
{
        _cleanup_free_ char *p = NULL;
        _cleanup_free_ char *pdir = NULL, *ppdir = NULL, *clib = NULL;
        char *q;
        int r, ret = 0;

        p = strdup(lib);

        r = dracut_install(p, p, false, false, true);
        if (r != 0)
                log_error("ERROR: failed to install '%s' for '%s'", p, src);
        else
                log_debug("Lib install: '%s'", p);
        ret += r;

        /* also install lib.so for lib.so.* files */
        q = strstr(p, ".so.");
        if (q) {
                q[3] = '\0';

                /* ignore errors for base lib symlink */
                if (dracut_install(p, p, false, false, true) == 0)
                        log_debug("Lib install: '%s'", p);
        }

        /* Also try to install the same library from one directory above.
           This fixes the case, where only the HWCAP lib would be installed
           # ldconfig -p|grep -F libc.so
           libc.so.6 (libc6,64bit, hwcap: 0x0000001000000000, OS ABI: Linux 2.6.32) => /lib64/power6/libc.so.6
           libc.so.6 (libc6,64bit, hwcap: 0x0000000000000200, OS ABI: Linux 2.6.32) => /lib64/power6x/libc.so.6
           libc.so.6 (libc6,64bit, OS ABI: Linux 2.6.32) => /lib64/libc.so.6
         */

        free(p);
        p = strdup(lib);

        pdir = dirname(p);
        if (!pdir)
                return ret;

        pdir = strdup(pdir);
        ppdir = dirname(pdir);
        if (!ppdir)
                return ret;

        ppdir = strdup(ppdir);

        strcpy(p, lib);

        clib = strjoin(ppdir, "/", basename(p), NULL);
        if (dracut_install(clib, clib, false, false, true) == 0)
                log_debug("Lib install: '%s'", clib);
        /* also install lib.so for lib.so.* files */
        q = strstr(clib, ".so.");
        if (q) {
                q[3] = '\0';

                /* ignore errors for base lib symlink */
                if (dracut_install(clib, clib, false, false, true) == 0)
                        log_debug("Lib install: '%s'", p);
        }

        return ret;
}

static char *get_real_file(const char *src, bool fullyresolve)
{
        char linktarget[PATH_MAX + 1];
        ssize_t linksz;
        _cleanup_free_ char *fullsrcpath;
        char *abspath = NULL;
        struct stat sb;

        if (sysrootdirlen) {
                if (strncmp(src, sysrootdir, sysrootdirlen) == 0)
                        fullsrcpath = strdup(src);
                else if (asprintf
                         (&fullsrcpath, "%s/%s", (sysrootdirlen ? sysrootdir : ""),
                          (src[0] == '/' ? src + 1 : src)) < 0)
                        _exit(EXIT_FAILURE);
        } else
                fullsrcpath = strdup(src);

        log_debug("get_real_file('%s')", fullsrcpath);

        if (lstat(fullsrcpath, &sb) < 0)
                return NULL;

        switch (sb.st_mode & S_IFMT) {
        case S_IFDIR:
        case S_IFREG:
                return strdup(fullsrcpath);
        case S_IFLNK:
                break;
        default:
                return NULL;
        }

        linksz = readlink(fullsrcpath, linktarget, sizeof(linktarget));
        if (linksz < 0)
                return NULL;
        linktarget[linksz] = '\0';

        log_debug("get_real_file: readlink('%s') returns '%s'", fullsrcpath, linktarget);

        if (streq(fullsrcpath, linktarget)) {
                log_error("ERROR: '%s' is pointing to itself", fullsrcpath);
                return NULL;
        }

        if (linktarget[0] == '/') {
                if (asprintf(&abspath, "%s%s", (sysrootdirlen ? sysrootdir : ""), linktarget) < 0)
                        return NULL;
        } else {
                _cleanup_free_ char *fullsrcdir = strdup(fullsrcpath);

                if (!fullsrcdir) {
                        log_error("Out of memory!");
                        return NULL;
                }

                fullsrcdir[dir_len(fullsrcdir)] = '\0';

                if (asprintf(&abspath, "%s/%s", fullsrcdir, linktarget) < 0)
                        return NULL;
        }

        if (fullyresolve) {
                struct stat st;
                if (lstat(abspath, &st) < 0) {
                        if (errno != ENOENT)
                                return NULL;
                }
                if (S_ISLNK(st.st_mode))
                        return get_real_file(abspath, fullyresolve);
        }

        log_debug("get_real_file('%s') => '%s'", src, abspath);
        return abspath;
}

static int resolve_deps(const char *src)
{
        int ret = 0;

        _cleanup_free_ char *buf = NULL;
        size_t linesize = LINE_MAX;
        _cleanup_pclose_ FILE *fptr = NULL;
        _cleanup_free_ char *cmd = NULL;
        _cleanup_free_ char *fullsrcpath = NULL;

        fullsrcpath = get_real_file(src, true);
        log_debug("resolve_deps('%s') -> get_real_file('%s', true) = '%s'", src, src, fullsrcpath);
        if (!fullsrcpath)
                return 0;

        buf = malloc(LINE_MAX);
        if (buf == NULL)
                return -errno;

        if (strstr(src, ".so") == 0) {
                _cleanup_close_ int fd = -1;
                fd = open(fullsrcpath, O_RDONLY | O_CLOEXEC);
                if (fd < 0)
                        return -errno;

                ret = read(fd, buf, LINE_MAX);
                if (ret == -1)
                        return -errno;

                buf[LINE_MAX - 1] = '\0';
                if (buf[0] == '#' && buf[1] == '!') {
                        /* we have a shebang */
                        char *p, *q;
                        for (p = &buf[2]; *p && isspace(*p); p++) ;
                        for (q = p; *q && (!isspace(*q)); q++) ;
                        *q = '\0';
                        log_debug("Script install: '%s'", p);
                        ret = dracut_install(p, p, false, true, false);
                        if (ret != 0)
                                log_error("ERROR: failed to install '%s'", p);
                        return ret;
                }
        }

        /* run ldd */
        ret = asprintf(&cmd, "%s %s 2>&1", ldd, fullsrcpath);
        if (ret < 0) {
                log_error("Out of memory!");
                exit(EXIT_FAILURE);
        }

        log_debug("%s", cmd);

        ret = 0;

        fptr = popen(cmd, "r");

        while (!feof(fptr)) {
                char *p;

                if (getline(&buf, &linesize, fptr) <= 0)
                        continue;

                log_debug("ldd: '%s'", buf);

                if (strstr(buf, "you do not have execution permission")) {
                        log_error("%s", buf);
                        ret += 1;
                        break;
                }

                /* errors from cross-compiler-ldd */
                if (strstr(buf, "unable to find sysroot") || strstr(buf, "command not found")) {
                        log_error("%s", buf);
                        ret += 1;
                        break;
                }

                /* musl ldd */
                if (strstr(buf, "Not a valid dynamic program"))
                        break;

                /* glibc */
                if (strstr(buf, "cannot execute binary file"))
                        continue;

                if (strstr(buf, "not a dynamic executable"))
                        break;

                if (strstr(buf, "loader cannot load itself"))
                        break;

                if (strstr(buf, "not regular file"))
                        break;

                if (strstr(buf, "cannot read header"))
                        break;

                if (strstr(buf, "cannot be preloaded"))
                        break;

                if (strstr(buf, destrootdir))
                        break;

                p = buf;
                if (strchr(p, '$')) {
                        /* take ldd variable expansion into account */
                        p = strstr(p, "=>");
                        if (!p)
                                p = buf;
                }
                p = strchr(p, '/');

                if (p) {
                        char *q;

                        for (q = p; *q && *q != ' ' && *q != '\n'; q++) ;
                        *q = '\0';

                        ret += library_install(src, p);

                }
        }

        return ret;
}

/* Install ".<filename>.hmac" file for FIPS self-checks */
static int hmac_install(const char *src, const char *dst, const char *hmacpath)
{
        _cleanup_free_ char *srcpath = strdup(src);
        _cleanup_free_ char *dstpath = strdup(dst);
        _cleanup_free_ char *srchmacname = NULL;
        _cleanup_free_ char *dsthmacname = NULL;
        int ret;

        if (!(srcpath && dstpath))
                return -ENOMEM;

        size_t dlen = dir_len(src);

        if (endswith(src, ".hmac"))
                return 0;

        if (!hmacpath) {
                hmac_install(src, dst, "/lib/fipscheck");
                hmac_install(src, dst, "/lib64/fipscheck");
                hmac_install(src, dst, "/lib/hmaccalc");
                hmac_install(src, dst, "/lib64/hmaccalc");
        }

        srcpath[dlen] = '\0';
        dstpath[dir_len(dst)] = '\0';
        if (hmacpath) {
                ret = asprintf(&srchmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
                if (ret < 0) {
                        log_error("Out of memory!");
                        exit(EXIT_FAILURE);
                }

                ret = asprintf(&dsthmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
                if (ret < 0) {
                        log_error("Out of memory!");
                        exit(EXIT_FAILURE);
                }
        } else {
                ret = asprintf(&srchmacname, "%s/.%s.hmac", srcpath, &src[dlen + 1]);
                if (ret < 0) {
                        log_error("Out of memory!");
                        exit(EXIT_FAILURE);
                }

                ret = asprintf(&dsthmacname, "%s/.%s.hmac", dstpath, &src[dlen + 1]);
                if (ret < 0) {
                        log_error("Out of memory!");
                        exit(EXIT_FAILURE);
                }
        }
        log_debug("hmac cp '%s' '%s')", srchmacname, dsthmacname);
        dracut_install(srchmacname, dsthmacname, false, false, true);
        return 0;
}

void mark_hostonly(const char *path)
{
        _cleanup_free_ char *fulldstpath = NULL;
        _cleanup_fclose_ FILE *f = NULL;
        int ret;

        ret = asprintf(&fulldstpath, "%s/lib/dracut/hostonly-files", destrootdir);
        if (ret < 0) {
                log_error("Out of memory!");
                exit(EXIT_FAILURE);
        }

        f = fopen(fulldstpath, "a");

        if (f == NULL) {
                log_error("Could not open '%s' for writing.", fulldstpath);
                return;
        }

        fprintf(f, "%s\n", path);
}

void dracut_log_cp(const char *path)
{
        int ret;
        ret = fprintf(logfile_f, "%s\n", path);
        if (ret < 0)
                log_error("Could not append '%s' to logfile '%s': %m", path, logfile);
}

static bool check_hashmap(Hashmap *hm, const char *item)
{
        char *existing;
        existing = hashmap_get(hm, item);
        if (existing) {
                if (strcmp(existing, item) == 0) {
                        return true;
                }
        }
        return false;
}

static int dracut_mkdir(const char *src)
{
        _cleanup_free_ char *parent = NULL;
        char *path;
        struct stat sb;

        parent = strdup(src);
        if (!parent)
                return 1;

        path = parent[0] == '/' ? parent + 1 : parent;
        while (path) {
                path = strstr(path, "/");
                if (path)
                        *path = '\0';

                if (stat(parent, &sb) == 0) {
                        if (!S_ISDIR(sb.st_mode)) {
                                log_error("%s exists but is not a directory!", parent);
                                return 1;
                        }
                } else if (errno != ENOENT) {
                        log_error("ERROR: stat '%s': %s", parent, strerror(errno));
                        return 1;
                } else {
                        if (mkdir(parent, 0755) < 0) {
                                log_error("ERROR: mkdir '%s': %s", parent, strerror(errno));
                                return 1;
                        }
                }

                if (path) {
                        *path = '/';
                        path++;
                }
        }

        return 0;
}

static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir, bool resolvedeps, bool hashdst)
{
        struct stat sb, db;
        _cleanup_free_ char *fullsrcpath = NULL;
        _cleanup_free_ char *fulldstpath = NULL;
        _cleanup_free_ char *fulldstdir = NULL;
        int ret;
        bool src_islink = false;
        bool src_isdir = false;
        mode_t src_mode = 0;
        bool dst_exists = true;
        char *i = NULL;
        _cleanup_free_ char *src;
        _cleanup_free_ char *dst;

        if (sysrootdirlen) {
                if (strncmp(orig_src, sysrootdir, sysrootdirlen) == 0) {
                        src = strdup(orig_src + sysrootdirlen);
                        fullsrcpath = strdup(orig_src);
                } else {
                        src = strdup(orig_src);
                        if (asprintf(&fullsrcpath, "%s%s", sysrootdir, src) < 0)
                                _exit(EXIT_FAILURE);
                }
                if (strncmp(orig_dst, sysrootdir, sysrootdirlen) == 0)
                        dst = strdup(orig_dst + sysrootdirlen);
                else
                        dst = strdup(orig_dst);
        } else {
                src = strdup(orig_src);
                fullsrcpath = strdup(src);
                dst = strdup(orig_dst);
        }

        log_debug("dracut_install('%s', '%s', %d, %d, %d)", src, dst, isdir, resolvedeps, hashdst);

        if (check_hashmap(items_failed, src)) {
                log_debug("hash hit items_failed for '%s'", src);
                return 1;
        }

        if (hashdst && check_hashmap(items, dst)) {
                log_debug("hash hit items for '%s'", dst);
                return 0;
        }

        if (lstat(fullsrcpath, &sb) < 0) {
                if (!isdir) {
                        i = strdup(src);
                        hashmap_put(items_failed, i, i);
                        /* src does not exist */
                        return 1;
                }
        } else {
                src_islink = S_ISLNK(sb.st_mode);
                src_isdir = S_ISDIR(sb.st_mode);
                src_mode = sb.st_mode;
        }

        ret = asprintf(&fulldstpath, "%s/%s", destrootdir, (dst[0] == '/' ? (dst + 1) : dst));
        if (ret < 0) {
                log_error("Out of memory!");
                exit(EXIT_FAILURE);
        }

        ret = stat(fulldstpath, &sb);

        if (ret != 0) {
                dst_exists = false;
                if (errno != ENOENT) {
                        log_error("ERROR: stat '%s': %m", fulldstpath);
                        return 1;
                }
        }

        if (ret == 0) {
                if (resolvedeps && S_ISREG(sb.st_mode) && (sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
                        log_debug("'%s' already exists, but checking for any deps", fulldstpath);
                        ret = resolve_deps(fullsrcpath + sysrootdirlen);
                } else
                        log_debug("'%s' already exists", fulldstpath);

                /* dst does already exist */
        } else {

                /* check destination directory */
                fulldstdir = strdup(fulldstpath);
                if (!fulldstdir) {
                        log_error("Out of memory!");
                        return 1;
                }
                fulldstdir[dir_len(fulldstdir)] = '\0';

                ret = stat(fulldstdir, &db);

                if (ret < 0) {
                        _cleanup_free_ char *dname = NULL;

                        if (errno != ENOENT) {
                                log_error("ERROR: stat '%s': %m", fulldstdir);
                                return 1;
                        }
                        /* create destination directory */
                        log_debug("dest dir '%s' does not exist", fulldstdir);
                        dname = strdup(dst);
                        if (!dname)
                                return 1;

                        dname[dir_len(dname)] = '\0';
                        ret = dracut_install(dname, dname, true, false, true);

                        if (ret != 0) {
                                log_error("ERROR: failed to create directory '%s'", fulldstdir);
                                return 1;
                        }
                }

                if (src_isdir) {
                        if (dst_exists) {
                                if (S_ISDIR(sb.st_mode)) {
                                        log_debug("dest dir '%s' already exists", fulldstpath);
                                        return 0;
                                }
                                log_error("dest dir '%s' already exists but is not a directory", fulldstpath);
                                return 1;
                        }

                        log_info("mkdir '%s'", fulldstpath);
                        ret = dracut_mkdir(fulldstpath);
                        if (ret == 0) {
                                i = strdup(dst);
                                if (!i)
                                        return -ENOMEM;

                                hashmap_put(items, i, i);
                        }
                        return ret;
                }

                /* ready to install src */

                if (src_islink) {
                        _cleanup_free_ char *abspath = NULL;

                        abspath = get_real_file(src, false);

                        if (abspath == NULL)
                                return 1;

                        if (dracut_install(abspath, abspath, false, resolvedeps, hashdst)) {
                                log_debug("'%s' install error", abspath);
                                return 1;
                        }

                        if (lstat(abspath, &sb) != 0) {
                                log_debug("lstat '%s': %m", abspath);
                                return 1;
                        }

                        if (lstat(fulldstpath, &sb) != 0) {
                                _cleanup_free_ char *absdestpath = NULL;

                                ret =
                                        asprintf(&absdestpath, "%s/%s", destrootdir,
                                                 (abspath[0] == '/' ? (abspath + 1) : abspath) + sysrootdirlen);
                                if (ret < 0) {
                                        log_error("Out of memory!");
                                        exit(EXIT_FAILURE);
                                }

                                ln_r(absdestpath, fulldstpath);
                        }

                        if (arg_hmac) {
                                /* copy .hmac files also */
                                hmac_install(src, dst, NULL);
                        }

                        return 0;
                }

                if (src_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) {
                        if (resolvedeps)
                                ret += resolve_deps(fullsrcpath + sysrootdirlen);
                        if (arg_hmac) {
                                /* copy .hmac files also */
                                hmac_install(src, dst, NULL);
                        }
                }

                log_debug("dracut_install ret = %d", ret);

                if (arg_hostonly && !arg_module)
                        mark_hostonly(dst);

                if (isdir) {
                        log_info("mkdir '%s'", fulldstpath);
                        ret += dracut_mkdir(fulldstpath);
                } else {
                        log_info("cp '%s' '%s'", fullsrcpath, fulldstpath);
                        ret += cp(fullsrcpath, fulldstpath);
                }
        }

        if (ret == 0) {
                i = strdup(dst);
                if (!i)
                        return -ENOMEM;

                hashmap_put(items, i, i);

                if (logfile_f)
                        dracut_log_cp(src);
        }

        log_debug("dracut_install ret = %d", ret);

        return ret;
}

static void item_free(char *i)
{
        assert(i);
        free(i);
}

static void usage(int status)
{
        /*                                                                                */
        printf("Usage: %s -D DESTROOTDIR [-r SYSROOTDIR] [OPTION]... -a SOURCE...\n"
               "or: %s -D DESTROOTDIR [-r SYSROOTDIR] [OPTION]... SOURCE DEST\n"
               "or: %s -D DESTROOTDIR [-r SYSROOTDIR] [OPTION]... -m KERNELMODULE [KERNELMODULE …]\n"
               "\n"
               "Install SOURCE (from rootfs or SYSROOTDIR) to DEST in DESTROOTDIR with all needed dependencies.\n"
               "\n"
               "  KERNELMODULE can have the format:\n"
               "     <absolute path> with a leading /\n"
               "     =<kernel subdir>[/<kernel subdir>…] like '=drivers/hid'\n"
               "     <module name>\n"
               "\n"
               "  -D --destrootdir  Install all files to DESTROOTDIR as the root\n"
               "  -r --sysrootdir   Install all files from SYSROOTDIR\n"
               "  -a --all          Install all SOURCE arguments to DESTROOTDIR\n"
               "  -o --optional     If SOURCE does not exist, do not fail\n"
               "  -d --dir          SOURCE is a directory\n"
               "  -l --ldd          Also install shebang executables and libraries\n"
               "  -L --logdir <DIR> Log files, which were installed from the host to <DIR>\n"
               "  -R --resolvelazy  Only install shebang executables and libraries\n"
               "                     for all SOURCE files\n"
               "  -H --hostonly     Mark all SOURCE files as hostonly\n\n"
               "  -f --fips         Also install all '.SOURCE.hmac' files\n"
               "\n"
               "  --module,-m       Install kernel modules, instead of files\n"
               "  --kerneldir       Specify the kernel module directory\n"
               "                     (default: /lib/modules/`uname -r`)\n"
               "  --firmwaredirs    Specify the firmware directory search path with : separation\n"
               "                     (default: DRACUT_FIRMWARE_PATH env var, /lib/firmware if not set)\n"
               "  --silent          Don't display error messages for kernel module install\n"
               "  --modalias        Only generate module list from /sys/devices modalias list\n"
               "  --check-supported Check if module is supported by a vendor\n"
               "  -o --optional     If kernel module does not exist, do not fail\n"
               "  -p --mod-filter-path      Filter kernel modules by path regexp\n"
               "  -P --mod-filter-nopath    Exclude kernel modules by path regexp\n"
               "  -s --mod-filter-symbol    Filter kernel modules by symbol regexp\n"
               "  -S --mod-filter-nosymbol  Exclude kernel modules by symbol regexp\n"
               "  -N --mod-filter-noname    Exclude kernel modules by name regexp\n"
               "\n"
               "  -v --verbose      Show more output\n"
               "     --debug        Show debug output\n"
               "     --version      Show package version\n"
               "  -h --help         Show this help\n"
               "\n", program_invocation_short_name, program_invocation_short_name, program_invocation_short_name);
        exit(status);
}

static int parse_argv(int argc, char *argv[])
{
        int c;

        enum {
                ARG_VERSION = 0x100,
                ARG_SILENT,
                ARG_MODALIAS,
                ARG_KERNELDIR,
                ARG_FIRMWAREDIRS,
                ARG_DEBUG,
                ARG_SUPPORTED
        };

        static struct option const options[] = {
                {"help", no_argument, NULL, 'h'},
                {"version", no_argument, NULL, ARG_VERSION},
                {"check-supported", no_argument, NULL, ARG_SUPPORTED},
                {"dir", no_argument, NULL, 'd'},
                {"debug", no_argument, NULL, ARG_DEBUG},
                {"verbose", no_argument, NULL, 'v'},
                {"ldd", no_argument, NULL, 'l'},
                {"resolvelazy", no_argument, NULL, 'R'},
                {"optional", no_argument, NULL, 'o'},
                {"hostonly", no_argument, NULL, 'H'},
                {"all", no_argument, NULL, 'a'},
                {"module", no_argument, NULL, 'm'},
                {"fips", no_argument, NULL, 'f'},
                {"destrootdir", required_argument, NULL, 'D'},
                {"sysrootdir", required_argument, NULL, 'r'},
                {"logdir", required_argument, NULL, 'L'},
                {"mod-filter-path", required_argument, NULL, 'p'},
                {"mod-filter-nopath", required_argument, NULL, 'P'},
                {"mod-filter-symbol", required_argument, NULL, 's'},
                {"mod-filter-nosymbol", required_argument, NULL, 'S'},
                {"mod-filter-noname", required_argument, NULL, 'N'},
                {"modalias", no_argument, NULL, ARG_MODALIAS},
                {"silent", no_argument, NULL, ARG_SILENT},
                {"kerneldir", required_argument, NULL, ARG_KERNELDIR},
                {"firmwaredirs", required_argument, NULL, ARG_FIRMWAREDIRS},
                {NULL, 0, NULL, 0}
        };

        while ((c = getopt_long(argc, argv, "madfhlL:oD:Hr:Rp:P:s:S:N:v", options, NULL)) != -1) {
                switch (c) {
                case ARG_VERSION:
                        puts(PROGRAM_VERSION_STRING);
                        return 0;
                case 'd':
                        arg_createdir = true;
                        break;
                case ARG_DEBUG:
                        arg_loglevel = LOG_DEBUG;
                        break;
                case ARG_SILENT:
                        arg_silent = true;
                        break;
                case ARG_SUPPORTED:
                        arg_supported = true;
                        break;
                case ARG_MODALIAS:
                        arg_modalias = true;
                        return 1;
                        break;
                case 'v':
                        arg_loglevel = LOG_INFO;
                        break;
                case 'o':
                        arg_optional = true;
                        break;
                case 'l':
                        arg_resolvedeps = true;
                        break;
                case 'R':
                        arg_resolvelazy = true;
                        break;
                case 'a':
                        arg_all = true;
                        break;
                case 'm':
                        arg_module = true;
                        break;
                case 'D':
                        destrootdir = strdup(optarg);
                        break;
                case 'r':
                        sysrootdir = strdup(optarg);
                        sysrootdirlen = strlen(sysrootdir);
                        break;
                case 'p':
                        if (regcomp(&mod_filter_path, optarg, REG_NOSUB | REG_EXTENDED) != 0) {
                                log_error("Module path filter %s is not a regular expression", optarg);
                                exit(EXIT_FAILURE);
                        }
                        arg_mod_filter_path = true;
                        break;
                case 'P':
                        if (regcomp(&mod_filter_nopath, optarg, REG_NOSUB | REG_EXTENDED) != 0) {
                                log_error("Module path filter %s is not a regular expression", optarg);
                                exit(EXIT_FAILURE);
                        }
                        arg_mod_filter_nopath = true;
                        break;
                case 's':
                        if (regcomp(&mod_filter_symbol, optarg, REG_NOSUB | REG_EXTENDED) != 0) {
                                log_error("Module symbol filter %s is not a regular expression", optarg);
                                exit(EXIT_FAILURE);
                        }
                        arg_mod_filter_symbol = true;
                        break;
                case 'S':
                        if (regcomp(&mod_filter_nosymbol, optarg, REG_NOSUB | REG_EXTENDED) != 0) {
                                log_error("Module symbol filter %s is not a regular expression", optarg);
                                exit(EXIT_FAILURE);
                        }
                        arg_mod_filter_nosymbol = true;
                        break;
                case 'N':
                        if (regcomp(&mod_filter_noname, optarg, REG_NOSUB | REG_EXTENDED) != 0) {
                                log_error("Module symbol filter %s is not a regular expression", optarg);
                                exit(EXIT_FAILURE);
                        }
                        arg_mod_filter_noname = true;
                        break;
                case 'L':
                        logdir = strdup(optarg);
                        break;
                case ARG_KERNELDIR:
                        kerneldir = strdup(optarg);
                        break;
                case ARG_FIRMWAREDIRS:
                        firmwaredirs = strv_split(optarg, ":");
                        break;
                case 'f':
                        arg_hmac = true;
                        break;
                case 'H':
                        arg_hostonly = true;
                        break;
                case 'h':
                        usage(EXIT_SUCCESS);
                        break;
                default:
                        usage(EXIT_FAILURE);
                }
        }

        if (arg_loglevel >= 0) {
                log_set_max_level(arg_loglevel);
        }

        if (!kerneldir) {
                struct utsname buf;
                uname(&buf);
                if (asprintf(&kerneldir, "%s%s", "/lib/modules/", buf.release) < 0) {
                        log_error("Out of memory!");
                        exit(EXIT_FAILURE);
                }
        }

        if (arg_modalias) {
                return 1;
        }

        if (arg_module) {
                if (!firmwaredirs) {
                        char *path = NULL;

                        path = getenv("DRACUT_FIRMWARE_PATH");

                        if (path) {
                                log_debug("DRACUT_FIRMWARE_PATH=%s", path);
                                firmwaredirs = strv_split(path, ":");
                        } else {
                                firmwaredirs = strv_new("/lib/firmware", NULL);
                        }
                }
        }

        if (!optind || optind == argc) {
                log_error("No SOURCE argument given");
                usage(EXIT_FAILURE);
        }

        return 1;
}

static int resolve_lazy(int argc, char **argv)
{
        int i;
        size_t destrootdirlen = strlen(destrootdir);
        int ret = 0;
        char *item;
        for (i = 0; i < argc; i++) {
                const char *src = argv[i];
                char *p = argv[i];
                char *existing;

                log_debug("resolve_deps('%s')", src);

                if (strstr(src, destrootdir)) {
                        p = &argv[i][destrootdirlen];
                }

                existing = hashmap_get(items, p);
                if (existing) {
                        if (strcmp(existing, p) == 0)
                                continue;
                }

                item = strdup(p);
                hashmap_put(items, item, item);

                ret += resolve_deps(src);
        }
        return ret;
}

static char **find_binary(const char *src)
{
        char **ret = NULL;
        char **q;
        char *fullsrcpath;
        char *newsrc = NULL;

        STRV_FOREACH(q, pathdirs) {
                struct stat sb;
                int r;

                r = asprintf(&newsrc, "%s/%s", *q, src);
                if (r < 0) {
                        log_error("Out of memory!");
                        exit(EXIT_FAILURE);
                }

                fullsrcpath = get_real_file(newsrc, false);

                if (!fullsrcpath) {
                        log_debug("get_real_file(%s) not found", newsrc);
                        free(newsrc);
                        newsrc = NULL;
                        continue;
                }

                if (lstat(fullsrcpath, &sb) != 0) {
                        log_debug("stat(%s) != 0", fullsrcpath);
                        free(newsrc);
                        newsrc = NULL;
                        free(fullsrcpath);
                        fullsrcpath = NULL;
                        continue;
                }

                strv_push(&ret, newsrc);

                free(fullsrcpath);
                fullsrcpath = NULL;
        };

        if (ret) {
                STRV_FOREACH(q, ret) {
                        log_debug("find_binary(%s) == %s", src, *q);
                }
        }

        return ret;
}

static int install_one(const char *src, const char *dst)
{
        int r = EXIT_SUCCESS;
        int ret = 0;

        if (strchr(src, '/') == NULL) {
                char **p = find_binary(src);
                if (p) {
                        char **q = NULL;
                        STRV_FOREACH(q, p) {
                                char *newsrc = *q;
                                log_debug("dracut_install '%s' '%s'", newsrc, dst);
                                ret = dracut_install(newsrc, dst, arg_createdir, arg_resolvedeps, true);
                                if (ret == 0) {
                                        log_debug("dracut_install '%s' '%s' OK", newsrc, dst);
                                }
                        }
                        strv_free(p);
                } else {
                        ret = -1;
                }
        } else {
                ret = dracut_install(src, dst, arg_createdir, arg_resolvedeps, true);
        }

        if ((ret != 0) && (!arg_optional)) {
                log_error("ERROR: installing '%s' to '%s'", src, dst);
                r = EXIT_FAILURE;
        }

        return r;
}

static int install_all(int argc, char **argv)
{
        int r = EXIT_SUCCESS;
        int i;
        for (i = 0; i < argc; i++) {
                int ret = 0;
                log_debug("Handle '%s'", argv[i]);

                if (strchr(argv[i], '/') == NULL) {
                        char **p = find_binary(argv[i]);
                        if (p) {
                                char **q = NULL;
                                STRV_FOREACH(q, p) {
                                        char *newsrc = *q;
                                        log_debug("dracut_install '%s'", newsrc);
                                        ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true);
                                        if (ret == 0) {
                                                log_debug("dracut_install '%s' OK", newsrc);
                                        }
                                }
                                strv_free(p);
                        } else {
                                ret = -1;
                        }

                } else {
                        if (strchr(argv[i], '*') == NULL) {
                                _cleanup_free_ char *dest = strdup(argv[i]);
                                ret = dracut_install(argv[i], dest, arg_createdir, arg_resolvedeps, true);
                        } else {
                                _cleanup_free_ char *realsrc = NULL;
                                _cleanup_globfree_ glob_t globbuf;

                                ret = asprintf(&realsrc, "%s%s", sysrootdir ? sysrootdir : "", argv[i]);
                                if (ret < 0) {
                                        log_error("Out of memory!");
                                        exit(EXIT_FAILURE);
                                }

                                ret = glob(realsrc, 0, NULL, &globbuf);
                                if (ret == 0) {
                                        int j;

                                        for (j = 0; j < globbuf.gl_pathc; j++) {
                                                char *dest = strdup(globbuf.gl_pathv[j] + sysrootdirlen);
                                                ret |=
                                                        dracut_install(globbuf.gl_pathv[j] + sysrootdirlen, dest,
                                                                       arg_createdir, arg_resolvedeps, true);
                                                free(dest);
                                        }
                                }
                        }
                }

                if ((ret != 0) && (!arg_optional)) {
                        log_error("ERROR: installing '%s'", argv[i]);
                        r = EXIT_FAILURE;
                }
        }
        return r;
}

static int install_firmware_fullpath(const char *fwpath)
{
        const char *fw;
        _cleanup_free_ char *fwpath_xz = NULL;
        fw = fwpath;
        struct stat sb;
        int ret, r;
        if (stat(fwpath, &sb) != 0) {
                r = asprintf(&fwpath_xz, "%s.xz", fwpath);
                if (r < 0) {
                        log_error("Out of memory!");
                        exit(EXIT_FAILURE);
                }
                if (stat(fwpath_xz, &sb) != 0) {
                        log_debug("stat(%s) != 0", fwpath);
                        return 1;
                }
                fw = fwpath_xz;
        }
        ret = dracut_install(fw, fw, false, false, true);
        if (ret == 0) {
                log_debug("dracut_install '%s' OK", fwpath);
        }
        return ret;
}

static int install_firmware(struct kmod_module *mod)
{
        struct kmod_list *l;
        _cleanup_kmod_module_info_free_list_ struct kmod_list *list = NULL;
        int ret;

        char **q;

        ret = kmod_module_get_info(mod, &list);
        if (ret < 0) {
                log_error("could not get modinfo from '%s': %s\n", kmod_module_get_name(mod), strerror(-ret));
                return ret;
        }
        kmod_list_foreach(l, list) {
                const char *key = kmod_module_info_get_key(l);
                const char *value = NULL;

                if (!streq("firmware", key))
                        continue;

                value = kmod_module_info_get_value(l);
                log_debug("Firmware %s", value);
                ret = -1;
                STRV_FOREACH(q, firmwaredirs) {
                        _cleanup_free_ char *fwpath = NULL;
                        struct stat sb;
                        int r;

                        r = asprintf(&fwpath, "%s/%s", *q, value);
                        if (r < 0) {
                                log_error("Out of memory!");
                                exit(EXIT_FAILURE);
                        }

                        if ((strstr(value, "*") != 0 || strstr(value, "?") != 0 || strstr(value, "[") != 0)
                            && stat(fwpath, &sb) != 0) {
                                int i;
                                _cleanup_globfree_ glob_t globbuf;
                                glob(fwpath, 0, NULL, &globbuf);
                                for (i = 0; i < globbuf.gl_pathc; i++) {
                                        install_firmware_fullpath(globbuf.gl_pathv[i]);
                                        if (ret != 0) {
                                                log_info("Possible missing firmware %s for kernel module %s", value,
                                                         kmod_module_get_name(mod));
                                        }
                                }
                        } else {
                                install_firmware_fullpath(fwpath);
                                if (ret != 0) {
                                        log_info("Possible missing firmware %s for kernel module %s", value,
                                                 kmod_module_get_name(mod));
                                }
                        }
                }
        }
        return 0;
}

static bool check_module_symbols(struct kmod_module *mod)
{
        struct kmod_list *itr;
        _cleanup_kmod_module_dependency_symbols_free_list_ struct kmod_list *deplist = NULL;

        if (!arg_mod_filter_symbol && !arg_mod_filter_nosymbol)
                return true;

        if (kmod_module_get_dependency_symbols(mod, &deplist) < 0) {
                log_debug("kmod_module_get_dependency_symbols failed");
                if (arg_mod_filter_symbol)
                        return false;
                return true;
        }

        if (arg_mod_filter_nosymbol) {
                kmod_list_foreach(itr, deplist) {
                        const char *symbol = kmod_module_symbol_get_symbol(itr);
                        // log_debug("Checking symbol %s", symbol);
                        if (regexec(&mod_filter_nosymbol, symbol, 0, NULL, 0) == 0) {
                                log_debug("Module %s: symbol %s matched exclusion filter", kmod_module_get_name(mod),
                                          symbol);
                                return false;
                        }
                }
        }

        if (arg_mod_filter_symbol) {
                kmod_list_foreach(itr, deplist) {
                        const char *symbol = kmod_module_dependency_symbol_get_symbol(itr);
                        // log_debug("Checking symbol %s", symbol);
                        if (regexec(&mod_filter_symbol, symbol, 0, NULL, 0) == 0) {
                                log_debug("Module %s: symbol %s matched inclusion filter", kmod_module_get_name(mod),
                                          symbol);
                                return true;
                        }
                }
                return false;
        }

        return true;
}

static bool check_module_path(const char *path)
{
        if (arg_mod_filter_nopath && (regexec(&mod_filter_nopath, path, 0, NULL, 0) == 0)) {
                log_debug("Path %s matched exclusion filter", path);
                return false;
        }

        if (arg_mod_filter_path && (regexec(&mod_filter_path, path, 0, NULL, 0) != 0)) {
                log_debug("Path %s matched inclusion filter", path);
                return false;
        }
        return true;
}

static int check_module_supported(struct kmod_module *mod) {
        struct kmod_list *l;
        _cleanup_kmod_module_info_free_list_ struct kmod_list *list = NULL;
        int ret;

        ret = kmod_module_get_info(mod, &list);
        if (ret < 0) {
                log_error("could not get modinfo from '%s': %s\n",
                          kmod_module_get_name(mod), strerror(-ret));
                return ret;
        }

        kmod_list_foreach(l, list) {
                const char *key = kmod_module_info_get_key(l);
                const char *value = NULL;

                if (!streq("supported", key))
                        continue;

                value = kmod_module_info_get_value(l);
                if (!streq("yes", value) && !streq("external", value)) {
                        log_warning("Module '%s' is unsupported. This may cause" \
                                "problems while booting.", kmod_module_get_name(mod));
             }
        }
        return ret;
}

static int install_dependent_modules(struct kmod_list *modlist)
{
        struct kmod_list *itr;
        const char *path = NULL;
        const char *name = NULL;
        int ret = 0;

        kmod_list_foreach(itr, modlist) {
                _cleanup_kmod_module_unref_ struct kmod_module *mod = NULL;
                mod = kmod_module_get_module(itr);
                path = kmod_module_get_path(mod);

                if (path == NULL)
                        continue;

                if (check_hashmap(items_failed, path))
                        return -1;

                if (check_hashmap(items, path)) {
                        continue;
                }

                name = kmod_module_get_name(mod);

                if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) {
                        continue;
                }

                if (arg_supported) {
                        ret = check_module_supported(mod);
                        if (ret < 0)
                                return ret;
                }

                ret = dracut_install(path, &path[kerneldirlen], false, false, true);
                if (ret == 0) {
                        _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
                        _cleanup_kmod_module_unref_list_ struct kmod_list *modpre = NULL;
                        _cleanup_kmod_module_unref_list_ struct kmod_list *modpost = NULL;
                        log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]);
                        install_firmware(mod);
                        modlist = kmod_module_get_dependencies(mod);
                        ret = install_dependent_modules(modlist);
                        if (ret == 0) {
                                ret = kmod_module_get_softdeps(mod, &modpre, &modpost);
                                if (ret == 0) {
                                        int r;
                                        ret = install_dependent_modules(modpre);
                                        r = install_dependent_modules(modpost);
                                        ret = ret ? : r;
                                }
                        }
                } else {
                        log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
                }
        }

        return ret;
}

static int install_module(struct kmod_module *mod)
{
        int ret = 0;
        _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
        _cleanup_kmod_module_unref_list_ struct kmod_list *modpre = NULL;
        _cleanup_kmod_module_unref_list_ struct kmod_list *modpost = NULL;
        const char *path = NULL;
        const char *name = NULL;

        name = kmod_module_get_name(mod);

        path = kmod_module_get_path(mod);
        if (!path) {
                log_debug("dracut_install '%s' is a builtin kernel module", name);
                return 0;
        }

        if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) {
                log_debug("dracut_install '%s' is excluded", name);
                return 0;
        }

        if (arg_hostonly && !check_hashmap(modules_loaded, name)) {
                log_debug("dracut_install '%s' not hostonly", name);
                return 0;
        }

        if (check_hashmap(items_failed, path))
                return -1;

        if (check_hashmap(items, path))
                return 0;

        if (!check_module_path(path) || !check_module_symbols(mod)) {
                log_debug("No symbol or path match for '%s'", path);
                return 1;
        }

        if (arg_supported) {
                ret = check_module_supported(mod);
                if (ret < 0)
                        return ret;
        }

        log_debug("dracut_install '%s' '%s'", path, &path[kerneldirlen]);

        ret = dracut_install(path, &path[kerneldirlen], false, false, true);
        if (ret == 0) {
                log_debug("dracut_install '%s' OK", kmod_module_get_name(mod));
        } else if (!arg_optional) {
                if (!arg_silent)
                        log_error("dracut_install '%s' ERROR", kmod_module_get_name(mod));
                return ret;
        }
        install_firmware(mod);

        modlist = kmod_module_get_dependencies(mod);
        ret = install_dependent_modules(modlist);

        if (ret == 0) {
                ret = kmod_module_get_softdeps(mod, &modpre, &modpost);
                if (ret == 0) {
                        int r;
                        ret = install_dependent_modules(modpre);
                        r = install_dependent_modules(modpost);
                        ret = ret ? : r;
                }
        }

        return ret;
}

static int modalias_list(struct kmod_ctx *ctx)
{
        int err;
        struct kmod_list *loaded_list = NULL;
        struct kmod_list *itr, *l;
        _cleanup_fts_close_ FTS *fts = NULL;

        {
                char *paths[] = { "/sys/devices", NULL };
                fts = fts_open(paths, FTS_NOCHDIR | FTS_NOSTAT, NULL);
        }
        for (FTSENT *ftsent = fts_read(fts); ftsent != NULL; ftsent = fts_read(fts)) {
                _cleanup_fclose_ FILE *f = NULL;
                _cleanup_kmod_module_unref_list_ struct kmod_list *list = NULL;
                struct kmod_list *l;

                int err;

                char alias[2048];
                size_t len;

                if (strncmp("modalias", ftsent->fts_name, 8) != 0)
                        continue;
                if (!(f = fopen(ftsent->fts_accpath, "r")))
                        continue;

                if (!fgets(alias, sizeof(alias), f))
                        continue;

                len = strlen(alias);

                if (len == 0)
                        continue;

                if (alias[len - 1] == '\n')
                        alias[len - 1] = 0;

                err = kmod_module_new_from_lookup(ctx, alias, &list);
                if (err < 0)
                        continue;

                kmod_list_foreach(l, list) {
                        struct kmod_module *mod = kmod_module_get_module(l);
                        char *name = strdup(kmod_module_get_name(mod));
                        kmod_module_unref(mod);
                        hashmap_put(modules_loaded, name, name);
                }
        }

        err = kmod_module_new_from_loaded(ctx, &loaded_list);
        if (err < 0) {
                errno = err;
                log_error("Could not get list of loaded modules: %m. Switching to non-hostonly mode.");
                arg_hostonly = false;
        } else {
                kmod_list_foreach(itr, loaded_list) {
                        _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;

                        struct kmod_module *mod = kmod_module_get_module(itr);
                        char *name = strdup(kmod_module_get_name(mod));
                        hashmap_put(modules_loaded, name, name);
                        kmod_module_unref(mod);

                        /* also put the modules from the new kernel in the hashmap,
                         * which resolve the name as an alias, in case a kernel module is
                         * renamed.
                         */
                        err = kmod_module_new_from_lookup(ctx, name, &modlist);
                        if (err < 0)
                                continue;
                        if (!modlist)
                                continue;
                        kmod_list_foreach(l, modlist) {
                                mod = kmod_module_get_module(l);
                                char *name = strdup(kmod_module_get_name(mod));
                                hashmap_put(modules_loaded, name, name);
                                kmod_module_unref(mod);
                        }
                }
                kmod_module_unref_list(loaded_list);
        }
        return 0;
}

static int install_modules(int argc, char **argv)
{
        _cleanup_kmod_unref_ struct kmod_ctx *ctx = NULL;
        struct kmod_list *itr;

        struct kmod_module *mod = NULL, *mod_o = NULL;

        const char *abskpath = NULL;
        char *p;
        int i;
        int modinst = 0;

        ctx = kmod_new(kerneldir, NULL);
        abskpath = kmod_get_dirname(ctx);

        p = strstr(abskpath, "/lib/modules/");
        if (p != NULL)
                kerneldirlen = p - abskpath;

        if (arg_hostonly) {
                char *modalias_file;
                modalias_file = getenv("DRACUT_KERNEL_MODALIASES");

                if (modalias_file == NULL) {
                        modalias_list(ctx);
                } else {
                        _cleanup_fclose_ FILE *f = NULL;
                        if ((f = fopen(modalias_file, "r"))) {
                                char name[2048];

                                while (!feof(f)) {
                                        size_t len;
                                        char *dupname = NULL;

                                        if (!(fgets(name, sizeof(name), f)))
                                                continue;
                                        len = strlen(name);

                                        if (len == 0)
                                                continue;

                                        if (name[len - 1] == '\n')
                                                name[len - 1] = 0;

                                        log_debug("Adding module '%s' to hostonly module list", name);
                                        dupname = strdup(name);
                                        hashmap_put(modules_loaded, dupname, dupname);
                                }
                        }
                }

        }

        for (i = 0; i < argc; i++) {
                int r = 0;
                int ret = -1;
                log_debug("Handle module '%s'", argv[i]);

                if (argv[i][0] == '/') {
                        _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
                        _cleanup_free_ const char *modname = NULL;

                        r = kmod_module_new_from_path(ctx, argv[i], &mod_o);
                        if (r < 0) {
                                log_debug("Failed to lookup modules path '%s': %m", argv[i]);
                                if (!arg_optional)
                                        return -ENOENT;
                                continue;
                        }
                        /* Check, if we have to load another module with that name instead */
                        modname = strdup(kmod_module_get_name(mod_o));

                        if (!modname) {
                                if (!arg_optional) {
                                        if (!arg_silent)
                                                log_error("Failed to get name for module '%s'", argv[i]);
                                        return -ENOENT;
                                }
                                log_info("Failed to get name for module '%s'", argv[i]);
                                continue;
                        }

                        r = kmod_module_new_from_lookup(ctx, modname, &modlist);
                        kmod_module_unref(mod_o);
                        mod_o = NULL;

                        if (r < 0) {
                                if (!arg_optional) {
                                        if (!arg_silent)
                                                log_error("3 Failed to lookup alias '%s': %d", modname, r);
                                        return -ENOENT;
                                }
                                log_info("3 Failed to lookup alias '%s': %d", modname, r);
                                continue;
                        }
                        if (!modlist) {
                                if (!arg_optional) {
                                        if (!arg_silent)
                                                log_error("Failed to find module '%s' %s", modname, argv[i]);
                                        return -ENOENT;
                                }
                                log_info("Failed to find module '%s' %s", modname, argv[i]);
                                continue;
                        }
                        kmod_list_foreach(itr, modlist) {
                                mod = kmod_module_get_module(itr);
                                r = install_module(mod);
                                kmod_module_unref(mod);
                                if ((r < 0) && !arg_optional) {
                                        if (!arg_silent)
                                                log_error("ERROR: installing module '%s'", modname);
                                        return -ENOENT;
                                };
                                ret = (ret == 0 ? 0 : r);
                                modinst = 1;
                        }
                } else if (argv[i][0] == '=') {
                        _cleanup_free_ char *path1 = NULL, *path2 = NULL, *path3 = NULL;
                        _cleanup_fts_close_ FTS *fts = NULL;

                        log_debug("Handling =%s", &argv[i][1]);
                        /* FIXME and add more paths */
                        r = asprintf(&path2, "%s/kernel/%s", kerneldir, &argv[i][1]);
                        if (r < 0) {
                                log_error("Out of memory!");
                                exit(EXIT_FAILURE);
                        }

                        r = asprintf(&path1, "%s/extra/%s", kerneldir, &argv[i][1]);
                        if (r < 0) {
                                log_error("Out of memory!");
                                exit(EXIT_FAILURE);
                        }

                        r = asprintf(&path3, "%s/updates/%s", kerneldir, &argv[i][1]);
                        if (r < 0) {
                                log_error("Out of memory!");
                                exit(EXIT_FAILURE);
                        }

                        {
                                char *paths[] = { path1, path2, path3, NULL };
                                fts = fts_open(paths, FTS_COMFOLLOW | FTS_NOCHDIR | FTS_NOSTAT | FTS_LOGICAL, NULL);
                        }

                        for (FTSENT *ftsent = fts_read(fts); ftsent != NULL; ftsent = fts_read(fts)) {
                                _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
                                _cleanup_free_ const char *modname = NULL;

                                if ((ftsent->fts_info == FTS_D) && !check_module_path(ftsent->fts_accpath)) {
                                        fts_set(fts, ftsent, FTS_SKIP);
                                        log_debug("Skipping %s", ftsent->fts_accpath);
                                        continue;
                                }
                                if ((ftsent->fts_info != FTS_F) && (ftsent->fts_info != FTS_SL)) {
                                        log_debug("Ignoring %s", ftsent->fts_accpath);
                                        continue;
                                }
                                log_debug("Handling %s", ftsent->fts_accpath);
                                r = kmod_module_new_from_path(ctx, ftsent->fts_accpath, &mod_o);
                                if (r < 0) {
                                        log_debug("Failed to lookup modules path '%s': %m", ftsent->fts_accpath);
                                        if (!arg_optional) {
                                                return -ENOENT;
                                        }
                                        continue;
                                }

                                /* Check, if we have to load another module with that name instead */
                                modname = strdup(kmod_module_get_name(mod_o));

                                if (!modname) {
                                        log_error("Failed to get name for module '%s'", ftsent->fts_accpath);
                                        if (!arg_optional) {
                                                return -ENOENT;
                                        }
                                        continue;
                                }
                                r = kmod_module_new_from_lookup(ctx, modname, &modlist);
                                kmod_module_unref(mod_o);
                                mod_o = NULL;

                                if (r < 0) {
                                        log_error("Failed to lookup alias '%s': %m", modname);
                                        if (!arg_optional) {
                                                return -ENOENT;
                                        }
                                        continue;
                                }

                                if (!modlist) {
                                        log_error("Failed to find module '%s' %s", modname, ftsent->fts_accpath);
                                        if (!arg_optional) {
                                                return -ENOENT;
                                        }
                                        continue;
                                }
                                kmod_list_foreach(itr, modlist) {
                                        mod = kmod_module_get_module(itr);
                                        r = install_module(mod);
                                        kmod_module_unref(mod);
                                        if ((r < 0) && !arg_optional) {
                                                if (!arg_silent)
                                                        log_error("ERROR: installing module '%s'", modname);
                                                return -ENOENT;
                                        };
                                        ret = (ret == 0 ? 0 : r);
                                        modinst = 1;
                                }
                        }
                        if (errno) {
                                log_error("FTS ERROR: %m");
                        }
                } else {
                        _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
                        char *modname = argv[i];

                        if (endswith(modname, ".ko")) {
                                int len = strlen(modname);
                                modname[len - 3] = 0;
                        }
                        if (endswith(modname, ".ko.xz") || endswith(modname, ".ko.gz")) {
                                int len = strlen(modname);
                                modname[len - 6] = 0;
                        }
                        if (endswith(modname, ".ko.zst")) {
                                int len = strlen(modname);
                                modname[len - 7] = 0;
                        }
                        r = kmod_module_new_from_lookup(ctx, modname, &modlist);
                        if (r < 0) {
                                if (!arg_optional) {
                                        if (!arg_silent)
                                                log_error("Failed to lookup alias '%s': %m", modname);
                                        return -ENOENT;
                                }
                                log_info("Failed to lookup alias '%s': %m", modname);
                                continue;
                        }
                        if (!modlist) {
                                if (!arg_optional) {
                                        if (!arg_silent)
                                                log_error("Failed to find module '%s'", modname);
                                        return -ENOENT;
                                }
                                log_info("Failed to find module '%s'", modname);
                                continue;
                        }
                        kmod_list_foreach(itr, modlist) {
                                mod = kmod_module_get_module(itr);
                                r = install_module(mod);
                                kmod_module_unref(mod);
                                if ((r < 0) && !arg_optional) {
                                        if (!arg_silent)
                                                log_error("ERROR: installing '%s'", argv[i]);
                                        return -ENOENT;
                                };
                                ret = (ret == 0 ? 0 : r);
                                modinst = 1;
                        }
                }

                if ((modinst != 0) && (ret != 0) && (!arg_optional)) {
                        if (!arg_silent)
                                log_error("ERROR: installing '%s'", argv[i]);
                        return EXIT_FAILURE;
                }
        }

        return EXIT_SUCCESS;
}

int main(int argc, char **argv)
{
        int r;
        char *i;
        char *path = NULL;
        char *env_no_xattr = NULL;

        log_set_target(LOG_TARGET_CONSOLE);
        log_parse_environment();
        log_open();

        r = parse_argv(argc, argv);
        if (r <= 0)
                return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;

        modules_loaded = hashmap_new(string_hash_func, string_compare_func);
        if (arg_modalias) {
                Iterator i;
                char *name;
                _cleanup_kmod_unref_ struct kmod_ctx *ctx = NULL;
                ctx = kmod_new(kerneldir, NULL);

                modalias_list(ctx);
                HASHMAP_FOREACH(name, modules_loaded, i) {
                        printf("%s\n", name);
                }
                exit(0);
        }

        log_debug("Program arguments:");
        for (r = 0; r < argc; r++)
                log_debug("%s", argv[r]);

        path = getenv("DRACUT_INSTALL_PATH");
        if (path == NULL)
                path = getenv("PATH");

        if (path == NULL) {
                log_error("PATH is not set");
                exit(EXIT_FAILURE);
        }

        log_debug("PATH=%s", path);

        ldd = getenv("DRACUT_LDD");
        if (ldd == NULL)
                ldd = "ldd";
        log_debug("LDD=%s", ldd);

        env_no_xattr = getenv("DRACUT_NO_XATTR");
        if (env_no_xattr != NULL)
                no_xattr = true;

        pathdirs = strv_split(path, ":");

        umask(0022);

        if (destrootdir == NULL || strlen(destrootdir) == 0) {
                destrootdir = getenv("DESTROOTDIR");
                if (destrootdir == NULL || strlen(destrootdir) == 0) {
                        log_error("Environment DESTROOTDIR or argument -D is not set!");
                        usage(EXIT_FAILURE);
                }
                destrootdir = strdup(destrootdir);
        }

        if (strcmp(destrootdir, "/") == 0) {
                log_error("Environment DESTROOTDIR or argument -D is set to '/'!");
                usage(EXIT_FAILURE);
        }

        i = destrootdir;
        destrootdir = realpath(destrootdir, NULL);
        if (!destrootdir) {
                log_error("Environment DESTROOTDIR or argument -D is set to '%s': %m", i);
                r = EXIT_FAILURE;
                goto finish;
        }
        free(i);

        items = hashmap_new(string_hash_func, string_compare_func);
        items_failed = hashmap_new(string_hash_func, string_compare_func);

        if (!items || !items_failed || !modules_loaded) {
                log_error("Out of memory");
                r = EXIT_FAILURE;
                goto finish;
        }

        if (logdir) {
                int ret;

                ret = asprintf(&logfile, "%s/%d.log", logdir, getpid());
                if (ret < 0) {
                        log_error("Out of memory!");
                        exit(EXIT_FAILURE);
                }

                logfile_f = fopen(logfile, "a");
                if (logfile_f == NULL) {
                        log_error("Could not open %s for logging: %m", logfile);
                        r = EXIT_FAILURE;
                        goto finish;
                }
        }

        r = EXIT_SUCCESS;

        if (((optind + 1) < argc) && (strcmp(argv[optind + 1], destrootdir) == 0)) {
                /* ugly hack for compat mode "inst src $destrootdir" */
                if ((optind + 2) == argc) {
                        argc--;
                } else {
                        /* ugly hack for compat mode "inst src $destrootdir dst" */
                        if ((optind + 3) == argc) {
                                argc--;
                                argv[optind + 1] = argv[optind + 2];
                        }
                }
        }

        if (arg_module) {
                r = install_modules(argc - optind, &argv[optind]);
        } else if (arg_resolvelazy) {
                r = resolve_lazy(argc - optind, &argv[optind]);
        } else if (arg_all || (argc - optind > 2) || ((argc - optind) == 1)) {
                r = install_all(argc - optind, &argv[optind]);
        } else {
                /* simple "inst src dst" */
                r = install_one(argv[optind], argv[optind + 1]);
        }

        if (arg_optional)
                r = EXIT_SUCCESS;

finish:
        if (logfile_f)
                fclose(logfile_f);

        while ((i = hashmap_steal_first(modules_loaded)))
                item_free(i);

        while ((i = hashmap_steal_first(items)))
                item_free(i);

        while ((i = hashmap_steal_first(items_failed)))
                item_free(i);

        hashmap_free(items);
        hashmap_free(items_failed);
        hashmap_free(modules_loaded);

        free(destrootdir);
        strv_free(firmwaredirs);
        strv_free(pathdirs);
        return r;
}
  07070100000238000081A400000000000000000000000164DF2CB800003787000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/src/install/hashmap.c   /***
  This file is part of systemd.

  Copyright 2010 Lennart Poettering

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

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

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

#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

#include "util.h"
#include "hashmap.h"
#include "macro.h"

#define NBUCKETS 127

struct hashmap_entry {
        const void *key;
        void *value;
        struct hashmap_entry *bucket_next, *bucket_previous;
        struct hashmap_entry *iterate_next, *iterate_previous;
};

struct Hashmap {
        hash_func_t hash_func;
        compare_func_t compare_func;

        struct hashmap_entry *iterate_list_head, *iterate_list_tail;
        unsigned n_entries;
};

#define BY_HASH(h) ((struct hashmap_entry**) ((uint8_t*) (h) + ALIGN(sizeof(Hashmap))))

unsigned string_hash_func(const void *p)
{
        unsigned hash = 5381;
        const signed char *c;

        /* DJB's hash function */

        for (c = p; *c; c++)
                hash = (hash << 5) + hash + (unsigned)*c;

        return hash;
}

int string_compare_func(const void *a, const void *b)
{
        return strcmp(a, b);
}

unsigned trivial_hash_func(const void *p)
{
        return PTR_TO_UINT(p);
}

int trivial_compare_func(const void *a, const void *b)
{
        return a < b ? -1 : (a > b ? 1 : 0);
}

Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func)
{
        Hashmap *h;
        size_t size;

        size = ALIGN(sizeof(Hashmap)) + NBUCKETS * sizeof(struct hashmap_entry *);

        h = malloc0(size);

        if (!h)
                return NULL;

        h->hash_func = hash_func ? hash_func : trivial_hash_func;
        h->compare_func = compare_func ? compare_func : trivial_compare_func;

        h->n_entries = 0;
        h->iterate_list_head = h->iterate_list_tail = NULL;

        return h;
}

int hashmap_ensure_allocated(Hashmap **h, hash_func_t hash_func, compare_func_t compare_func)
{
        assert(h);

        if (*h)
                return 0;

        if (!(*h = hashmap_new(hash_func, compare_func)))
                return -ENOMEM;

        return 0;
}

static void link_entry(Hashmap *h, struct hashmap_entry *e, unsigned hash)
{
        assert(h);
        assert(e);

        /* Insert into hash table */
        e->bucket_next = BY_HASH(h)[hash];
        e->bucket_previous = NULL;
        if (BY_HASH(h)[hash])
                BY_HASH(h)[hash]->bucket_previous = e;
        BY_HASH(h)[hash] = e;

        /* Insert into iteration list */
        e->iterate_previous = h->iterate_list_tail;
        e->iterate_next = NULL;
        if (h->iterate_list_tail) {
                assert(h->iterate_list_head);
                h->iterate_list_tail->iterate_next = e;
        } else {
                assert(!h->iterate_list_head);
                h->iterate_list_head = e;
        }
        h->iterate_list_tail = e;

        h->n_entries++;
        assert(h->n_entries >= 1);
}

static void unlink_entry(Hashmap *h, struct hashmap_entry *e, unsigned hash)
{
        assert(h);
        assert(e);

        /* Remove from iteration list */
        if (e->iterate_next)
                e->iterate_next->iterate_previous = e->iterate_previous;
        else
                h->iterate_list_tail = e->iterate_previous;

        if (e->iterate_previous)
                e->iterate_previous->iterate_next = e->iterate_next;
        else
                h->iterate_list_head = e->iterate_next;

        /* Remove from hash table bucket list */
        if (e->bucket_next)
                e->bucket_next->bucket_previous = e->bucket_previous;

        if (e->bucket_previous)
                e->bucket_previous->bucket_next = e->bucket_next;
        else
                BY_HASH(h)[hash] = e->bucket_next;

        assert(h->n_entries >= 1);
        h->n_entries--;
}

static void remove_entry(Hashmap *h, struct hashmap_entry **ep)
{
        struct hashmap_entry *e = *ep;
        unsigned hash;

        assert(h);
        assert(e);

        hash = h->hash_func(e->key) % NBUCKETS;

        unlink_entry(h, e, hash);

        free(e);
        *ep = NULL;
}

void hashmap_free(Hashmap *h)
{

        if (!h)
                return;

        hashmap_clear(h);

        free(h);
}

void hashmap_free_free(Hashmap *h)
{
        void *p;

        while ((p = hashmap_steal_first(h)))
                free(p);

        hashmap_free(h);
}

void hashmap_clear(Hashmap *h)
{
        if (!h)
                return;

        while (h->iterate_list_head) {
                struct hashmap_entry *e = h->iterate_list_head;
                remove_entry(h, &e);
        }
}

static struct hashmap_entry *hash_scan(Hashmap *h, unsigned hash, const void *key)
{
        struct hashmap_entry *e;
        assert(h);
        assert(hash < NBUCKETS);

        for (e = BY_HASH(h)[hash]; e; e = e->bucket_next)
                if (h->compare_func(e->key, key) == 0)
                        return e;

        return NULL;
}

int hashmap_put(Hashmap *h, const void *key, void *value)
{
        struct hashmap_entry *e;
        unsigned hash;

        assert(h);

        hash = h->hash_func(key) % NBUCKETS;

        if ((e = hash_scan(h, hash, key))) {

                if (e->value == value)
                        return 0;

                return -EEXIST;
        }

        e = new(struct hashmap_entry, 1);

        if (!e)
                return -ENOMEM;

        e->key = key;
        e->value = value;

        link_entry(h, e, hash);

        return 1;
}

int hashmap_replace(Hashmap *h, const void *key, void *value)
{
        struct hashmap_entry *e;
        unsigned hash;

        assert(h);

        hash = h->hash_func(key) % NBUCKETS;

        if ((e = hash_scan(h, hash, key))) {
                e->key = key;
                e->value = value;
                return 0;
        }

        return hashmap_put(h, key, value);
}

void *hashmap_get(Hashmap *h, const void *key)
{
        unsigned hash;
        struct hashmap_entry *e;

        if (!h)
                return NULL;

        hash = h->hash_func(key) % NBUCKETS;

        if (!(e = hash_scan(h, hash, key)))
                return NULL;

        return e->value;
}

void *hashmap_remove(Hashmap *h, const void *key)
{
        struct hashmap_entry *e;
        unsigned hash;
        void *data;

        if (!h)
                return NULL;

        hash = h->hash_func(key) % NBUCKETS;

        if (!(e = hash_scan(h, hash, key)))
                return NULL;

        data = e->value;
        remove_entry(h, &e);

        return data;
}

int hashmap_remove_and_put(Hashmap *h, const void *old_key, const void *new_key, void *value)
{
        struct hashmap_entry *e;
        unsigned old_hash, new_hash;

        if (!h)
                return -ENOENT;

        old_hash = h->hash_func(old_key) % NBUCKETS;
        if (!(e = hash_scan(h, old_hash, old_key)))
                return -ENOENT;

        new_hash = h->hash_func(new_key) % NBUCKETS;
        if (hash_scan(h, new_hash, new_key))
                return -EEXIST;

        unlink_entry(h, e, old_hash);

        e->key = new_key;
        e->value = value;

        link_entry(h, e, new_hash);

        return 0;
}

int hashmap_remove_and_replace(Hashmap *h, const void *old_key, const void *new_key, void *value)
{
        struct hashmap_entry *e, *k;
        unsigned old_hash, new_hash;

        if (!h)
                return -ENOENT;

        old_hash = h->hash_func(old_key) % NBUCKETS;
        if (!(e = hash_scan(h, old_hash, old_key)))
                return -ENOENT;

        new_hash = h->hash_func(new_key) % NBUCKETS;

        if ((k = hash_scan(h, new_hash, new_key)))
                if (e != k)
                        remove_entry(h, &k);

        unlink_entry(h, e, old_hash);

        e->key = new_key;
        e->value = value;

        link_entry(h, e, new_hash);

        return 0;
}

void *hashmap_remove_value(Hashmap *h, const void *key, void *value)
{
        struct hashmap_entry *e;
        unsigned hash;

        if (!h)
                return NULL;

        hash = h->hash_func(key) % NBUCKETS;

        if (!(e = hash_scan(h, hash, key)))
                return NULL;

        if (e->value != value)
                return NULL;

        remove_entry(h, &e);

        return value;
}

void *hashmap_iterate(Hashmap *h, Iterator *i, const void **key)
{
        struct hashmap_entry *e;

        assert(i);

        if (!h)
                goto at_end;

        if (*i == ITERATOR_LAST)
                goto at_end;

        if (*i == ITERATOR_FIRST && !h->iterate_list_head)
                goto at_end;

        e = *i == ITERATOR_FIRST ? h->iterate_list_head : (struct hashmap_entry *)*i;

        if (e->iterate_next)
                *i = (Iterator) e->iterate_next;
        else
                *i = ITERATOR_LAST;

        if (key)
                *key = e->key;

        return e->value;

at_end:
        *i = ITERATOR_LAST;

        if (key)
                *key = NULL;

        return NULL;
}

void *hashmap_iterate_backwards(Hashmap *h, Iterator *i, const void **key)
{
        struct hashmap_entry *e;

        assert(i);

        if (!h)
                goto at_beginning;

        if (*i == ITERATOR_FIRST)
                goto at_beginning;

        if (*i == ITERATOR_LAST && !h->iterate_list_tail)
                goto at_beginning;

        e = *i == ITERATOR_LAST ? h->iterate_list_tail : (struct hashmap_entry *)*i;

        if (e->iterate_previous)
                *i = (Iterator) e->iterate_previous;
        else
                *i = ITERATOR_FIRST;

        if (key)
                *key = e->key;

        return e->value;

at_beginning:
        *i = ITERATOR_FIRST;

        if (key)
                *key = NULL;

        return NULL;
}

void *hashmap_iterate_skip(Hashmap *h, const void *key, Iterator *i)
{
        unsigned hash;
        struct hashmap_entry *e;

        if (!h)
                return NULL;

        hash = h->hash_func(key) % NBUCKETS;

        if (!(e = hash_scan(h, hash, key)))
                return NULL;

        *i = (Iterator) e;

        return e->value;
}

void *hashmap_first(Hashmap *h)
{

        if (!h)
                return NULL;

        if (!h->iterate_list_head)
                return NULL;

        return h->iterate_list_head->value;
}

void *hashmap_first_key(Hashmap *h)
{

        if (!h)
                return NULL;

        if (!h->iterate_list_head)
                return NULL;

        return (void *)h->iterate_list_head->key;
}

void *hashmap_last(Hashmap *h)
{

        if (!h)
                return NULL;

        if (!h->iterate_list_tail)
                return NULL;

        return h->iterate_list_tail->value;
}

void *hashmap_steal_first(Hashmap *h)
{
        struct hashmap_entry *e;
        void *data;

        if (!h)
                return NULL;

        if (!h->iterate_list_head)
                return NULL;

        e = h->iterate_list_head;
        data = e->value;
        remove_entry(h, &e);

        return data;
}

void *hashmap_steal_first_key(Hashmap *h)
{
        struct hashmap_entry *e;
        void *key;

        if (!h)
                return NULL;

        if (!h->iterate_list_head)
                return NULL;

        e = h->iterate_list_head;
        key = (void *)e->key;
        remove_entry(h, &e);

        return key;
}

unsigned hashmap_size(Hashmap *h)
{

        if (!h)
                return 0;

        return h->n_entries;
}

bool hashmap_isempty(Hashmap *h)
{

        if (!h)
                return true;

        return h->n_entries == 0;
}

int hashmap_merge(Hashmap *h, Hashmap *other)
{
        struct hashmap_entry *e;

        assert(h);

        if (!other)
                return 0;

        for (e = other->iterate_list_head; e; e = e->iterate_next) {
                int r;

                if ((r = hashmap_put(h, e->key, e->value)) < 0)
                        if (r != -EEXIST)
                                return r;
        }

        return 0;
}

void hashmap_move(Hashmap *h, Hashmap *other)
{
        struct hashmap_entry *e, *n;

        assert(h);

        /* The same as hashmap_merge(), but every new item from other
         * is moved to h. This function is guaranteed to succeed. */

        if (!other)
                return;

        for (e = other->iterate_list_head; e; e = n) {
                unsigned h_hash, other_hash;

                n = e->iterate_next;

                h_hash = h->hash_func(e->key) % NBUCKETS;

                if (hash_scan(h, h_hash, e->key))
                        continue;

                other_hash = other->hash_func(e->key) % NBUCKETS;

                unlink_entry(other, e, other_hash);
                link_entry(h, e, h_hash);
        }
}

int hashmap_move_one(Hashmap *h, Hashmap *other, const void *key)
{
        unsigned h_hash, other_hash;
        struct hashmap_entry *e;

        if (!other)
                return 0;

        assert(h);

        h_hash = h->hash_func(key) % NBUCKETS;
        if (hash_scan(h, h_hash, key))
                return -EEXIST;

        other_hash = other->hash_func(key) % NBUCKETS;
        if (!(e = hash_scan(other, other_hash, key)))
                return -ENOENT;

        unlink_entry(other, e, other_hash);
        link_entry(h, e, h_hash);

        return 0;
}

char **hashmap_get_strv(Hashmap *h)
{
        char **sv;
        Iterator it;
        char *item;
        int n;

        sv = new(char *, h->n_entries + 1);
        if (!sv)
                return NULL;

        n = 0;
        HASHMAP_FOREACH(item, h, it) {
                sv[n++] = item;
        }
        sv[n] = NULL;

        return sv;
}
 07070100000239000081A400000000000000000000000164DF2CB800000DAB000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/src/install/hashmap.h   #ifndef foohashmaphfoo
#define foohashmaphfoo

/***
  This file is part of systemd.

  Copyright 2010 Lennart Poettering

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

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

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

#include <stdbool.h>

/* Pretty straightforward hash table implementation. As a minor
 * optimization a NULL hashmap object will be treated as empty hashmap
 * for all read operations. That way it is not necessary to
 * instantiate an object for each Hashmap use. */

typedef struct Hashmap Hashmap;
typedef struct _IteratorStruct _IteratorStruct;
typedef _IteratorStruct *Iterator;

#define ITERATOR_FIRST ((Iterator) 0)
#define ITERATOR_LAST ((Iterator) -1)

typedef unsigned (*hash_func_t)(const void *p);
typedef int (*compare_func_t)(const void *a, const void *b);

unsigned string_hash_func(const void *p);
int string_compare_func(const void *a, const void *b);

unsigned trivial_hash_func(const void *p);
int trivial_compare_func(const void *a, const void *b);

Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func);
void hashmap_free(Hashmap *h);
void hashmap_free_free(Hashmap *h);
int hashmap_ensure_allocated(Hashmap **h, hash_func_t hash_func, compare_func_t compare_func);

int hashmap_put(Hashmap *h, const void *key, void *value);
int hashmap_replace(Hashmap *h, const void *key, void *value);
void *hashmap_get(Hashmap *h, const void *key);
void *hashmap_remove(Hashmap *h, const void *key);
void *hashmap_remove_value(Hashmap *h, const void *key, void *value);
int hashmap_remove_and_put(Hashmap *h, const void *old_key, const void *new_key, void *value);
int hashmap_remove_and_replace(Hashmap *h, const void *old_key, const void *new_key, void *value);

int hashmap_merge(Hashmap *h, Hashmap *other);
void hashmap_move(Hashmap *h, Hashmap *other);
int hashmap_move_one(Hashmap *h, Hashmap *other, const void *key);

unsigned hashmap_size(Hashmap *h);
bool hashmap_isempty(Hashmap *h);

void *hashmap_iterate(Hashmap *h, Iterator *i, const void **key);
void *hashmap_iterate_backwards(Hashmap *h, Iterator *i, const void **key);
void *hashmap_iterate_skip(Hashmap *h, const void *key, Iterator *i);

void hashmap_clear(Hashmap *h);
void *hashmap_steal_first(Hashmap *h);
void *hashmap_steal_first_key(Hashmap *h);
void *hashmap_first(Hashmap *h);
void *hashmap_first_key(Hashmap *h);
void *hashmap_last(Hashmap *h);

char **hashmap_get_strv(Hashmap *h);

#define HASHMAP_FOREACH(e, h, i) \
        for ((i) = ITERATOR_FIRST, (e) = hashmap_iterate((h), &(i), NULL); (e); (e) = hashmap_iterate((h), &(i), NULL))

#define HASHMAP_FOREACH_KEY(e, k, h, i) \
        for ((i) = ITERATOR_FIRST, (e) = hashmap_iterate((h), &(i), (const void**) &(k)); (e); (e) = hashmap_iterate((h), &(i), (const void**) &(k)))

#define HASHMAP_FOREACH_BACKWARDS(e, h, i) \
        for ((i) = ITERATOR_LAST, (e) = hashmap_iterate_backwards((h), &(i), NULL); (e); (e) = hashmap_iterate_backwards((h), &(i), NULL))

#endif
 0707010000023A000081A400000000000000000000000164DF2CB80000011C000000000000000000000000000000000000003500000000dracut-055+suse.347.gdcb9bdbf/src/install/hashmap.lo  # src/shared/hashmap.lo - a libtool object file
# Generated by libtool (GNU libtool) 2.4.2
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# Name of the PIC object.
pic_object='.libs/hashmap.o'

# Name of the non-PIC object
non_pic_object='hashmap.o'

0707010000023B000081A400000000000000000000000164DF2CB800001D32000000000000000000000000000000000000003000000000dracut-055+suse.347.gdcb9bdbf/src/install/log.c   /***
  This file is part of systemd.

  Copyright 2010 Lennart Poettering

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

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

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

#include <stdarg.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <stddef.h>

#include "log.h"
#include "util.h"
#include "macro.h"

#define SNDBUF_SIZE (8*1024*1024)

static LogTarget log_target = LOG_TARGET_CONSOLE;
static int log_max_level = LOG_WARNING;
static int log_facility = LOG_DAEMON;

static int console_fd = STDERR_FILENO;

static bool show_location = false;

/* Akin to glibc's __abort_msg; which is private and we hence cannot
 * use here. */
static char *log_abort_msg = NULL;

void log_close_console(void)
{

        if (console_fd < 0)
                return;

        if (getpid() == 1) {
                if (console_fd >= 3)
                        close_nointr_nofail(console_fd);

                console_fd = -1;
        }
}

static int log_open_console(void)
{

        if (console_fd >= 0)
                return 0;

        if (getpid() == 1) {

                console_fd = open_terminal("/dev/console", O_WRONLY | O_NOCTTY | O_CLOEXEC);
                if (console_fd < 0) {
                        log_error("Failed to open /dev/console for logging: %s", strerror(-console_fd));
                        return console_fd;
                }

                log_debug("Successfully opened /dev/console for logging.");
        } else
                console_fd = STDERR_FILENO;

        return 0;
}

int log_open(void)
{
        return log_open_console();
}

void log_close(void)
{
        log_close_console();
}

void log_set_max_level(int level)
{
        assert((level & LOG_PRIMASK) == level);

        log_max_level = level;
}

void log_set_facility(int facility)
{
        log_facility = facility;
}

static int write_to_console(int level, const char *file, unsigned int line, const char *func, const char *buffer)
{

        struct iovec iovec[5];
        unsigned n = 0;

        if (console_fd < 0)
                return 0;

        zero(iovec);

        IOVEC_SET_STRING(iovec[n++], "dracut-install: ");

        if (show_location) {
                char location[64];
                if (snprintf(location, sizeof(location), "(%s:%u) ", file, line) <= 0)
                        return -errno;
                IOVEC_SET_STRING(iovec[n++], location);
        }

        IOVEC_SET_STRING(iovec[n++], buffer);
        IOVEC_SET_STRING(iovec[n++], "\n");

        if (writev(console_fd, iovec, n) < 0)
                return -errno;

        return 1;
}

static int log_dispatch(int level, const char *file, int line, const char *func, char *buffer)
{

        int r = 0;

        if (log_target == LOG_TARGET_NULL)
                return 0;

        /* Patch in LOG_DAEMON facility if necessary */
        if ((level & LOG_FACMASK) == 0)
                level = log_facility | LOG_PRI(level);

        do {
                char *e;
                int k = 0;

                buffer += strspn(buffer, NEWLINE);

                if (buffer[0] == 0)
                        break;

                if ((e = strpbrk(buffer, NEWLINE)))
                        *(e++) = 0;

                k = write_to_console(level, file, line, func, buffer);
                if (k < 0)
                        return k;
                buffer = e;
        } while (buffer);

        return r;
}

int log_metav(int level, const char *file, int line, const char *func, const char *format, va_list ap)
{

        char buffer[LINE_MAX];
        int saved_errno, r;

        if (_likely_(LOG_PRI(level) > log_max_level))
                return 0;

        saved_errno = errno;
        vsnprintf(buffer, sizeof(buffer), format, ap);
        char_array_0(buffer);

        r = log_dispatch(level, file, line, func, buffer);
        errno = saved_errno;

        return r;
}

int log_meta(int level, const char *file, int line, const char *func, const char *format, ...)
{

        int r;
        va_list ap;

        va_start(ap, format);
        r = log_metav(level, file, line, func, format, ap);
        va_end(ap);

        return r;
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
_noreturn_ static void log_assert(const char *text, const char *file, int line, const char *func, const char *format)
{
        static char buffer[LINE_MAX];

        snprintf(buffer, sizeof(buffer), format, text, file, line, func);

        char_array_0(buffer);
        log_abort_msg = buffer;

        log_dispatch(LOG_CRIT, file, line, func, buffer);
        abort();
}

#pragma GCC diagnostic pop

_noreturn_ void log_assert_failed(const char *text, const char *file, int line, const char *func)
{
        log_assert(text, file, line, func, "Assertion '%s' failed at %s:%u, function %s(). Aborting.");
}

_noreturn_ void log_assert_failed_unreachable(const char *text, const char *file, int line, const char *func)
{
        log_assert(text, file, line, func, "Code should not be reached '%s' at %s:%u, function %s(). Aborting.");
}

void log_set_target(LogTarget target)
{
        assert(target >= 0);
        assert(target < _LOG_TARGET_MAX);

        log_target = target;
}

int log_set_target_from_string(const char *e)
{
        LogTarget t;

        t = log_target_from_string(e);
        if (t < 0)
                return -EINVAL;

        log_set_target(t);
        return 0;
}

int log_set_max_level_from_string(const char *e)
{
        int t;

        t = log_level_from_string(e);
        if (t < 0)
                return t;

        log_set_max_level(t);
        return 0;
}

void log_parse_environment(void)
{
        const char *e;

        if ((e = getenv("DRACUT_INSTALL_LOG_TARGET"))) {
                if (log_set_target_from_string(e) < 0)
                        log_warning("Failed to parse log target %s. Ignoring.", e);
        } else if ((e = getenv("DRACUT_LOG_TARGET"))) {
                if (log_set_target_from_string(e) < 0)
                        log_warning("Failed to parse log target %s. Ignoring.", e);
        }

        if ((e = getenv("DRACUT_INSTALL_LOG_LEVEL"))) {
                if (log_set_max_level_from_string(e) < 0)
                        log_warning("Failed to parse log level %s. Ignoring.", e);
        } else if ((e = getenv("DRACUT_LOG_LEVEL"))) {
                if (log_set_max_level_from_string(e) < 0)
                        log_warning("Failed to parse log level %s. Ignoring.", e);
        }
}

LogTarget log_get_target(void)
{
        return log_target;
}

int log_get_max_level(void)
{
        return log_max_level;
}

static const char *const log_target_table[] = {
        [LOG_TARGET_CONSOLE] = "console",
        [LOG_TARGET_AUTO] = "auto",
        [LOG_TARGET_SAFE] = "safe",
        [LOG_TARGET_NULL] = "null"
};

DEFINE_STRING_TABLE_LOOKUP(log_target, LogTarget);
  0707010000023C000081A400000000000000000000000164DF2CB800000D48000000000000000000000000000000000000003000000000dracut-055+suse.347.gdcb9bdbf/src/install/log.h   #ifndef foologhfoo
#define foologhfoo

/***
  This file is part of systemd.

  Copyright 2010 Lennart Poettering

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

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

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

#include <syslog.h>
#include <stdbool.h>
#include <stdarg.h>

#include "macro.h"

typedef enum LogTarget {
        LOG_TARGET_CONSOLE,
        LOG_TARGET_KMSG,
        LOG_TARGET_JOURNAL,
        LOG_TARGET_JOURNAL_OR_KMSG,
        LOG_TARGET_SYSLOG,
        LOG_TARGET_SYSLOG_OR_KMSG,
        LOG_TARGET_AUTO,        /* console if stderr is tty, JOURNAL_OR_KMSG otherwise */
        LOG_TARGET_SAFE,        /* console if stderr is tty, KMSG otherwise */
        LOG_TARGET_NULL,
        _LOG_TARGET_MAX,
        _LOG_TARGET_INVALID = -1
} LogTarget;

void log_set_target(LogTarget target);
void log_set_max_level(int level);
void log_set_facility(int facility);

int log_set_target_from_string(const char *e);
int log_set_max_level_from_string(const char *e);

void log_show_color(bool b);
void log_show_location(bool b);

int log_show_color_from_string(const char *e);
int log_show_location_from_string(const char *e);

LogTarget log_get_target(void);
int log_get_max_level(void);

int log_open(void);
void log_close(void);
void log_forget_fds(void);

void log_close_syslog(void);
void log_close_journal(void);
void log_close_kmsg(void);
void log_close_console(void);

void log_parse_environment(void);

int log_meta(int level, const char *file, int line, const char *func, const char *format, ...) _printf_attr_(5, 6);

int log_metav(int level, const char *file, int line, const char *func, const char *format, va_list ap);

_noreturn_ void log_assert_failed(const char *text, const char *file, int line, const char *func);
_noreturn_ void log_assert_failed_unreachable(const char *text, const char *file, int line, const char *func);

/* This modifies the buffer passed! */
int log_dump_internal(int level, const char *file, int line, const char *func, char *buffer);

#define log_full(level, ...) log_meta(level,   __FILE__, __LINE__, __func__, __VA_ARGS__)

#define log_debug(...)   log_meta(LOG_DEBUG,   __FILE__, __LINE__, __func__, __VA_ARGS__)
#define log_info(...)    log_meta(LOG_INFO,    __FILE__, __LINE__, __func__, __VA_ARGS__)
#define log_notice(...)  log_meta(LOG_NOTICE,  __FILE__, __LINE__, __func__, __VA_ARGS__)
#define log_warning(...) log_meta(LOG_WARNING, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define log_error(...)   log_meta(LOG_ERR,     __FILE__, __LINE__, __func__, __VA_ARGS__)

/* This modifies the buffer passed! */
#define log_dump(level, buffer) log_dump_internal(level, __FILE__, __LINE__, __func__, buffer)

const char *log_target_to_string(LogTarget target);
LogTarget log_target_from_string(const char *s);

const char *log_level_to_string(int i);
int log_level_from_string(const char *s);

#endif
0707010000023D000081A400000000000000000000000164DF2CB800002D5C000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/src/install/macro.h #pragma once

/***
  This file is part of systemd.

  Copyright 2010 Lennart Poettering

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

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

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

#include <assert.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <inttypes.h>

#define _printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
#define _sentinel_ __attribute__ ((sentinel))
#define _noreturn_ __attribute__((noreturn))
#define _unused_ __attribute__ ((unused))
#define _destructor_ __attribute__ ((destructor))
#define _pure_ __attribute__ ((pure))
#define _const_ __attribute__ ((const))
#define _deprecated_ __attribute__ ((deprecated))
#define _packed_ __attribute__ ((packed))
#define _malloc_ __attribute__ ((malloc))
#define _weak_ __attribute__ ((weak))
#define _likely_(x) (__builtin_expect(!!(x),1))
#define _unlikely_(x) (__builtin_expect(!!(x),0))
#define _public_ __attribute__ ((visibility("default")))
#define _hidden_ __attribute__ ((visibility("hidden")))
#define _weakref_(x) __attribute__((weakref(#x)))
#define _introspect_(x) __attribute__((section("introspect." x)))
#define _alignas_(x) __attribute__((aligned(__alignof(x))))
#define _cleanup_(x) __attribute__((cleanup(x)))

/* automake test harness */
#define EXIT_TEST_SKIP 77

#define XSTRINGIFY(x) #x
#define STRINGIFY(x) XSTRINGIFY(x)

/* Rounds up */

#define ALIGN4(l) (((l) + 3) & ~3)
#define ALIGN8(l) (((l) + 7) & ~7)

#if __SIZEOF_POINTER__ == 8
#define ALIGN(l) ALIGN8(l)
#elif __SIZEOF_POINTER__ == 4
#define ALIGN(l) ALIGN4(l)
#else
#error "Wut? Pointers are neither 4 nor 8 bytes long?"
#endif

#define ALIGN_PTR(p) ((void*) ALIGN((unsigned long) p))
#define ALIGN4_PTR(p) ((void*) ALIGN4((unsigned long) p))
#define ALIGN8_PTR(p) ((void*) ALIGN8((unsigned long) p))

static inline size_t ALIGN_TO(size_t l, size_t ali)
{
        return ((l + ali - 1) & ~(ali - 1));
}

#define ALIGN_TO_PTR(p, ali) ((void*) ALIGN_TO((unsigned long) p))

#define ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))

/*
 * container_of - cast a member of a structure out to the containing structure
 * @ptr: the pointer to the member.
 * @type: the type of the container struct this is embedded in.
 * @member: the name of the member within the struct.
 *
 */
#define container_of(ptr, type, member)                                 \
        __extension__ ({                                                \
                        const typeof( ((type *)0)->member ) *__mptr = (ptr); \
                        (type *)( (char *)__mptr - offsetof(type,member) ); \
                })

#undef MAX
#define MAX(a,b)                                 \
        __extension__ ({                         \
                        typeof(a) _a = (a);      \
                        typeof(b) _b = (b);      \
                        _a > _b ? _a : _b;       \
                })

#define MAX3(x,y,z)                              \
        __extension__ ({                         \
                        typeof(x) _c = MAX(x,y); \
                        MAX(_c, z);              \
                })

#undef MIN
#define MIN(a,b)                                \
        __extension__ ({                        \
                        typeof(a) _a = (a);     \
                        typeof(b) _b = (b);     \
                        _a < _b ? _a : _b;      \
                })

#ifndef CLAMP
#define CLAMP(x, low, high)                                             \
        __extension__ ({                                                \
                        typeof(x) _x = (x);                             \
                        typeof(low) _low = (low);                       \
                        typeof(high) _high = (high);                    \
                        ((_x > _high) ? _high : ((_x < _low) ? _low : _x)); \
                })
#endif

#define assert_se(expr)                                                 \
        do {                                                            \
                if (_unlikely_(!(expr)))                                \
                        log_assert_failed(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
        } while (false)                                                 \

/* We override the glibc assert() here. */
#undef assert
#ifdef NDEBUG
#define assert(expr) do {} while(false)
#else
#define assert(expr) assert_se(expr)
#endif

#define assert_not_reached(t)                                           \
        do {                                                            \
                log_assert_failed_unreachable(t, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
        } while (false)

#if defined(static_assert)
#define assert_cc(expr)                         \
        do {                                    \
                static_assert(expr, #expr);     \
        } while (false)
#else
#define assert_cc(expr)                         \
        do {                                    \
                switch (0) {                    \
                case 0:                         \
                case !!(expr):                  \
                        ;                       \
                }                               \
        } while (false)
#endif

#define PTR_TO_UINT(p) ((unsigned int) ((uintptr_t) (p)))
#define UINT_TO_PTR(u) ((void*) ((uintptr_t) (u)))

#define PTR_TO_UINT32(p) ((uint32_t) ((uintptr_t) (p)))
#define UINT32_TO_PTR(u) ((void*) ((uintptr_t) (u)))

#define PTR_TO_ULONG(p) ((unsigned long) ((uintptr_t) (p)))
#define ULONG_TO_PTR(u) ((void*) ((uintptr_t) (u)))

#define PTR_TO_INT(p) ((int) ((intptr_t) (p)))
#define INT_TO_PTR(u) ((void*) ((intptr_t) (u)))

#define TO_INT32(p) ((int32_t) ((intptr_t) (p)))
#define INT32_TO_PTR(u) ((void*) ((intptr_t) (u)))

#define PTR_TO_LONG(p) ((long) ((intptr_t) (p)))
#define LONG_TO_PTR(u) ((void*) ((intptr_t) (u)))

#define memzero(x,l) (memset((x), 0, (l)))
#define zero(x) (memzero(&(x), sizeof(x)))

#define CHAR_TO_STR(x) ((char[2]) { x, 0 })

#define char_array_0(x) x[sizeof(x)-1] = 0;

#define IOVEC_SET_STRING(i, s)                  \
        do {                                    \
                struct iovec *_i = &(i);        \
                char *_s = (char *)(s);         \
                _i->iov_base = _s;              \
                _i->iov_len = strlen(_s);       \
        } while(false)

static inline size_t IOVEC_TOTAL_SIZE(const struct iovec *i, unsigned n)
{
        unsigned j;
        size_t r = 0;

        for (j = 0; j < n; j++)
                r += i[j].iov_len;

        return r;
}

static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k)
{
        unsigned j;

        for (j = 0; j < n; j++) {
                size_t sub;

                if (_unlikely_(k == 0))
                        break;

                sub = MIN(i[j].iov_len, k);
                i[j].iov_len -= sub;
                i[j].iov_base = (uint8_t *) i[j].iov_base + sub;
                k -= sub;
        }

        return k;
}

#define VA_FORMAT_ADVANCE(format, ap)                                   \
do {                                                                    \
        int _argtypes[128];                                             \
        size_t _i, _k;                                                  \
        _k = parse_printf_format((format), ELEMENTSOF(_argtypes), _argtypes); \
        assert(_k < ELEMENTSOF(_argtypes));                             \
        for (_i = 0; _i < _k; _i++) {                                   \
                if (_argtypes[_i] & PA_FLAG_PTR)  {                     \
                        (void) va_arg(ap, void*);                       \
                        continue;                                       \
                }                                                       \
                                                                        \
                switch (_argtypes[_i]) {                                \
                case PA_INT:                                            \
                case PA_INT|PA_FLAG_SHORT:                              \
                case PA_CHAR:                                           \
                        (void) va_arg(ap, int);                         \
                        break;                                          \
                case PA_INT|PA_FLAG_LONG:                               \
                        (void) va_arg(ap, long int);                    \
                        break;                                          \
                case PA_INT|PA_FLAG_LONG_LONG:                          \
                        (void) va_arg(ap, long long int);               \
                        break;                                          \
                case PA_WCHAR:                                          \
                        (void) va_arg(ap, wchar_t);                     \
                        break;                                          \
                case PA_WSTRING:                                        \
                case PA_STRING:                                         \
                case PA_POINTER:                                        \
                        (void) va_arg(ap, void*);                       \
                        break;                                          \
                case PA_FLOAT:                                          \
                case PA_DOUBLE:                                         \
                        (void) va_arg(ap, double);                      \
                        break;                                          \
                case PA_DOUBLE|PA_FLAG_LONG_DOUBLE:                     \
                        (void) va_arg(ap, long double);                 \
                        break;                                          \
                default:                                                \
                        assert_not_reached("Unknown format string argument."); \
                }                                                       \
        }                                                               \
} while(false)

/* Because statfs.t_type can be int on some architecures, we have to cast
 * the const magic to the type, otherwise the compiler warns about
 * signed/unsigned comparison, because the magic can be 32 bit unsigned.
 */
#define F_TYPE_CMP(a, b) (a == (typeof(a)) b)

/* Returns the number of chars needed to format variables of the
 * specified type as a decimal string. Adds in extra space for a
 * negative '-' prefix. */

#define DECIMAL_STR_MAX(type)                                           \
        (1+(sizeof(type) <= 1 ? 3 :                                     \
            sizeof(type) <= 2 ? 5 :                                     \
            sizeof(type) <= 4 ? 10 :                                    \
            sizeof(type) <= 8 ? 20 : sizeof(int[-2*(sizeof(type) > 8)])))

#include "log.h"
0707010000023E000081A400000000000000000000000164DF2CB800002F37000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/src/install/strv.c  /***
  This file is part of systemd.

  Copyright 2010 Lennart Poettering

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

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

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

#include <assert.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>

#include "util.h"
#include "strv.h"

char *strv_find(char **l, const char *name)
{
        char **i;

        assert(name);

        STRV_FOREACH(i, l) {
                if (streq(*i, name))
                        return *i;
        }

        return NULL;
}

char *strv_find_prefix(char **l, const char *name)
{
        char **i;

        assert(name);

        STRV_FOREACH(i, l) {
                if (startswith(*i, name))
                        return *i;
        }

        return NULL;
}

void strv_free(char **l)
{
        char **k;

        if (!l)
                return;

        for (k = l; *k; k++)
                free(*k);

        free(l);
}

char **strv_copy(char *const *l)
{
        char **r, **k;

        k = r = new(char *, strv_length(l) + 1);
        if (!r)
                return NULL;

        if (l)
                for (; *l; k++, l++) {
                        *k = strdup(*l);
                        if (!*k) {
                                strv_free(r);
                                return NULL;
                        }
                }

        *k = NULL;
        return r;
}

unsigned int strv_length(char *const *l)
{
        unsigned n = 0;

        if (!l)
                return 0;

        for (; *l; l++)
                n++;

        return n;
}

char **strv_new_ap(const char *x, va_list ap)
{
        const char *s;
        char **a;
        unsigned n = 0, i = 0;
        va_list aq;

        /* As a special trick we ignore all listed strings that equal
         * (const char*) -1. This is supposed to be used with the
         * STRV_IFNOTNULL() macro to include possibly NULL strings in
         * the string list. */

        if (x) {
                n = x == (const char *)-1 ? 0 : 1;

                va_copy(aq, ap);
                while ((s = va_arg(aq, const char *))) {
                        if (s == (const char *)-1)
                                continue;

                        n++;
                }

                va_end(aq);
        }

        a = new(char *, n + 1);
        if (!a)
                return NULL;

        if (x) {
                if (x != (const char *)-1) {
                        a[i] = strdup(x);
                        if (!a[i])
                                goto fail;
                        i++;
                }

                while ((s = va_arg(ap, const char *))) {

                        if (s == (const char *)-1)
                                continue;

                        a[i] = strdup(s);
                        if (!a[i])
                                goto fail;

                        i++;
                }
        }

        a[i] = NULL;

        return a;

fail:
        strv_free(a);
        return NULL;
}

char **strv_new(const char *x, ...)
{
        char **r;
        va_list ap;

        va_start(ap, x);
        r = strv_new_ap(x, ap);
        va_end(ap);

        return r;
}

char **strv_merge(char **a, char **b)
{
        char **r, **k;

        if (!a)
                return strv_copy(b);

        if (!b)
                return strv_copy(a);

        r = new(char *, strv_length(a) + strv_length(b) + 1);
        if (!r)
                return NULL;

        for (k = r; *a; k++, a++) {
                *k = strdup(*a);
                if (!*k)
                        goto fail;
        }

        for (; *b; k++, b++) {
                *k = strdup(*b);
                if (!*k)
                        goto fail;
        }

        *k = NULL;
        return r;

fail:
        strv_free(r);
        return NULL;
}

char **strv_merge_concat(char **a, char **b, const char *suffix)
{
        char **r, **k;

        /* Like strv_merge(), but appends suffix to all strings in b, before adding */

        if (!b)
                return strv_copy(a);

        r = new(char *, strv_length(a) + strv_length(b) + 1);
        if (!r)
                return NULL;

        k = r;
        if (a)
                for (; *a; k++, a++) {
                        *k = strdup(*a);
                        if (!*k)
                                goto fail;
                }

        for (; *b; k++, b++) {
                *k = strappend(*b, suffix);
                if (!*k)
                        goto fail;
        }

        *k = NULL;
        return r;

fail:
        strv_free(r);
        return NULL;

}

char **strv_split(const char *s, const char *separator)
{
        char *state;
        char *w;
        size_t l;
        unsigned n, i;
        char **r;

        assert(s);

        n = 0;
        FOREACH_WORD_SEPARATOR(w, l, s, separator, state) {
                n++;
        }

        r = new(char *, n + 1);
        if (!r)
                return NULL;

        i = 0;
        FOREACH_WORD_SEPARATOR(w, l, s, separator, state) {
                r[i] = strndup(w, l);
                if (!r[i]) {
                        strv_free(r);
                        return NULL;
                }

                i++;
        }

        r[i] = NULL;
        return r;
}

char **strv_split_quoted(const char *s)
{
        char *state;
        char *w;
        size_t l;
        unsigned n, i;
        char **r;

        assert(s);

        n = 0;
        FOREACH_WORD_QUOTED(w, l, s, state) {
                n++;
        }

        r = new(char *, n + 1);
        if (!r)
                return NULL;

        i = 0;
        FOREACH_WORD_QUOTED(w, l, s, state) {
                r[i] = cunescape_length(w, l);
                if (!r[i]) {
                        strv_free(r);
                        return NULL;
                }
                i++;
        }

        r[i] = NULL;
        return r;
}

char **strv_split_newlines(const char *s)
{
        char **l;
        unsigned int n;

        assert(s);

        /* Special version of strv_split() that splits on newlines and
         * suppresses an empty string at the end */

        l = strv_split(s, NEWLINE);
        if (!l)
                return NULL;

        n = strv_length(l);
        if (n == 0)
                return l;

        if (isempty(l[n - 1])) {
                free(l[n - 1]);
                l[n - 1] = NULL;
        }

        return l;
}

char *strv_join(char **l, const char *separator)
{
        char *r, *e;
        char **s;
        size_t n, k;

        if (!separator)
                separator = " ";

        k = strlen(separator);

        n = 0;
        STRV_FOREACH(s, l) {
                if (n != 0)
                        n += k;
                n += strlen(*s);
        }

        r = new(char, n + 1);
        if (!r)
                return NULL;

        e = r;
        STRV_FOREACH(s, l) {
                if (e != r)
                        e = stpcpy(e, separator);

                e = stpcpy(e, *s);
        }

        *e = 0;

        return r;
}

char **strv_append(char **l, const char *s)
{
        char **r, **k;

        if (!l)
                return strv_new(s, NULL);

        if (!s)
                return strv_copy(l);

        r = new(char *, strv_length(l) + 2);
        if (!r)
                return NULL;

        for (k = r; *l; k++, l++) {
                *k = strdup(*l);
                if (!*k)
                        goto fail;
        }

        k[0] = strdup(s);
        if (!k[0])
                goto fail;

        k[1] = NULL;
        return r;

fail:
        strv_free(r);
        return NULL;
}

int strv_push(char ***l, char *value)
{
        char **c;
        unsigned n;

        if (!value)
                return 0;

        n = strv_length(*l);
        c = realloc(*l, sizeof(char *) * (n + 2));
        if (!c)
                return -ENOMEM;

        c[n] = value;
        c[n + 1] = NULL;

        *l = c;
        return 0;
}

int strv_extend(char ***l, const char *value)
{
        char *v;
        int r;

        if (!value)
                return 0;

        v = strdup(value);
        if (!v)
                return -ENOMEM;

        r = strv_push(l, v);
        if (r < 0)
                free(v);

        return r;
}

char **strv_uniq(char **l)
{
        char **i;

        /* Drops duplicate entries. The first identical string will be
         * kept, the others dropped */

        STRV_FOREACH(i, l) {
                strv_remove(i + 1, *i);
        }
        return l;
}

char **strv_remove(char **l, const char *s)
{
        char **f, **t;

        if (!l)
                return NULL;

        assert(s);

        /* Drops every occurrence of s in the string list, edits
         * in-place. */

        for (f = t = l; *f; f++) {

                if (streq(*f, s)) {
                        free(*f);
                        continue;
                }

                *(t++) = *f;
        }

        *t = NULL;
        return l;
}

char **strv_remove_prefix(char **l, const char *s)
{
        char **f, **t;

        if (!l)
                return NULL;

        assert(s);

        /* Drops every occurrence of a string prefixed with s in the
         * string list, edits in-place. */

        for (f = t = l; *f; f++) {

                if (startswith(*f, s)) {
                        free(*f);
                        continue;
                }

                *(t++) = *f;
        }

        *t = NULL;
        return l;
}

char **strv_parse_nulstr(const char *s, size_t l)
{
        const char *p;
        unsigned c = 0, i = 0;
        char **v;

        assert(s || l == 0);

        if (l == 0)
                return new0(char *, 1);

        for (p = s; p < s + l; p++)
                if (*p == 0)
                        c++;

        if (s[l - 1] != 0)
                c++;

        v = new0(char *, c + 1);
        if (!v)
                return NULL;

        p = s;
        while (p < s + l) {
                const char *e;

                e = memchr(p, 0, s + l - p);

                v[i] = strndup(p, e ? e - p : s + l - p);
                if (!v[i]) {
                        strv_free(v);
                        return NULL;
                }

                i++;

                if (!e)
                        break;

                p = e + 1;
        }

        assert(i == c);

        return v;
}

char **strv_split_nulstr(const char *s)
{
        const char *i;
        char **r = NULL;

        NULSTR_FOREACH(i, s) {
                if (strv_extend(&r, i) < 0) {
                        strv_free(r);
                        return NULL;
                }
        }

        if (!r)
                return strv_new(NULL, NULL);

        return r;
}

bool strv_overlap(char **a, char **b)
{
        char **i, **j;

        STRV_FOREACH(i, a) {
                STRV_FOREACH(j, b) {
                        if (streq(*i, *j))
                                return true;
                }
        }

        return false;
}

static int str_compare(const void *_a, const void *_b)
{
        const char **a = (const char **)_a, **b = (const char **)_b;

        return strcmp(*a, *b);
}

char **strv_sort(char **l)
{

        if (strv_isempty(l))
                return l;

        qsort(l, strv_length(l), sizeof(char *), str_compare);
        return l;
}

void strv_print(char **l)
{
        char **s;

        if (!l)
                return;

        STRV_FOREACH(s, l) {
                puts(*s);
        }
}
 0707010000023F000081A400000000000000000000000164DF2CB8000011BE000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/src/install/strv.h  #pragma once

/***
  This file is part of systemd.

  Copyright 2010 Lennart Poettering

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

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

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

#include <stdarg.h>
#include <stdbool.h>

#include "util.h"

char *strv_find(char **l, const char *name) _pure_;
char *strv_find_prefix(char **l, const char *name) _pure_;

void strv_free(char **l);
DEFINE_TRIVIAL_CLEANUP_FUNC(char **, strv_free);
#define _cleanup_strv_free_ _cleanup_(strv_freep)

char **strv_copy(char *const *l);
unsigned int strv_length(char *const *l) _pure_;

char **strv_merge(char **a, char **b);
char **strv_merge_concat(char **a, char **b, const char *suffix);
char **strv_append(char **l, const char *s);
int strv_extend(char ***l, const char *value);
int strv_push(char ***l, char *value);

char **strv_remove(char **l, const char *s);
char **strv_remove_prefix(char **l, const char *s);
char **strv_uniq(char **l);

#define strv_contains(l, s) (!!strv_find((l), (s)))

char **strv_new(const char *x, ...) _sentinel_;
char **strv_new_ap(const char *x, va_list ap);

static inline const char *STRV_IFNOTNULL(const char *x)
{
        return x ? x : (const char *)-1;
}

static inline bool strv_isempty(char *const *l)
{
        return !l || !*l;
}

char **strv_split(const char *s, const char *separator);
char **strv_split_quoted(const char *s);
char **strv_split_newlines(const char *s);

char *strv_join(char **l, const char *separator);

char **strv_parse_nulstr(const char *s, size_t l);
char **strv_split_nulstr(const char *s);

bool strv_overlap(char **a, char **b) _pure_;

#define STRV_FOREACH(s, l)                      \
        for ((s) = (l); (s) && *(s); (s)++)

#define STRV_FOREACH_BACKWARDS(s, l)            \
        STRV_FOREACH(s, l)                      \
                ;                               \
        for ((s)--; (l) && ((s) >= (l)); (s)--)

#define STRV_FOREACH_PAIR(x, y, l)               \
        for ((x) = (l), (y) = (x+1); (x) && *(x) && *(y); (x) += 2, (y) = (x + 1))

char **strv_sort(char **l);
void strv_print(char **l);

#define STRV_MAKE(...) ((char**) ((const char*[]) { __VA_ARGS__, NULL }))

#define STRV_MAKE_EMPTY ((char*[1]) { NULL })

#define strv_from_stdarg_alloca(first)                          \
        ({                                                      \
                char **_l;                                      \
                                                                \
                if (!first)                                     \
                        _l = (char**) &first;                   \
                else {                                          \
                        unsigned _n;                            \
                        va_list _ap;                            \
                                                                \
                        _n = 1;                                 \
                        va_start(_ap, first);                   \
                        while (va_arg(_ap, char*))              \
                                _n++;                           \
                        va_end(_ap);                            \
                                                                \
                        _l = newa(char*, _n+1);                 \
                        _l[_n = 0] = (char*) first;             \
                        va_start(_ap, first);                   \
                        for (;;) {                              \
                                _l[++_n] = va_arg(_ap, char*);  \
                                if (!_l[_n])                    \
                                        break;                  \
                        }                                       \
                        va_end(_ap);                            \
                }                                               \
                _l;                                             \
        })
  07070100000240000081A400000000000000000000000164DF2CB800003215000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/src/install/util.c  /***
  This file is part of systemd.

  Copyright 2010 Lennart Poettering

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

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

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

#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/syscall.h>

#include "util.h"

static inline pid_t gettid(void)
{
        return (pid_t) syscall(SYS_gettid);
}

size_t page_size(void)
{
        static __thread size_t pgsz = 0;
        long r;

        if (_likely_(pgsz > 0))
                return pgsz;

        assert_se((r = sysconf(_SC_PAGESIZE)) > 0);

        pgsz = (size_t)r;

        return pgsz;
}

bool endswith(const char *s, const char *postfix)
{
        size_t sl, pl;

        assert(s);
        assert(postfix);

        sl = strlen(s);
        pl = strlen(postfix);

        if (pl == 0)
                return true;

        if (sl < pl)
                return false;

        return memcmp(s + sl - pl, postfix, pl) == 0;
}

int close_nointr(int fd)
{
        assert(fd >= 0);

        for (;;) {
                int r;

                r = close(fd);
                if (r >= 0)
                        return r;

                if (errno != EINTR)
                        return -errno;
        }
}

void close_nointr_nofail(int fd)
{
        int saved_errno = errno;

        /* like close_nointr() but cannot fail, and guarantees errno
         * is unchanged */

        assert_se(close_nointr(fd) == 0);

        errno = saved_errno;
}

int open_terminal(const char *name, int mode)
{
        int fd, r;
        unsigned c = 0;

        /*
         * If a TTY is in the process of being closed opening it might
         * cause EIO. This is horribly awful, but unlikely to be
         * changed in the kernel. Hence we work around this problem by
         * retrying a couple of times.
         *
         * https://bugs.launchpad.net/ubuntu/+source/linux/+bug/554172/comments/245
         */

        for (;;) {
                if ((fd = open(name, mode)) >= 0)
                        break;

                if (errno != EIO)
                        return -errno;

                if (c >= 20)
                        return -errno;

                usleep(50 * USEC_PER_MSEC);
                c++;
        }

        if (fd < 0)
                return -errno;

        if ((r = isatty(fd)) < 0) {
                close_nointr_nofail(fd);
                return -errno;
        }

        if (!r) {
                close_nointr_nofail(fd);
                return -ENOTTY;
        }

        return fd;
}

bool streq_ptr(const char *a, const char *b)
{

        /* Like streq(), but tries to make sense of NULL pointers */

        if (a && b)
                return streq(a, b);

        if (!a && !b)
                return true;

        return false;
}

bool is_main_thread(void)
{
        static __thread int cached = 0;

        if (_unlikely_(cached == 0))
                cached = getpid() == gettid()? 1 : -1;

        return cached > 0;
}

int safe_atou(const char *s, unsigned *ret_u)
{
        char *x = NULL;
        unsigned long l;

        assert(s);
        assert(ret_u);

        errno = 0;
        l = strtoul(s, &x, 0);

        if (!x || *x || errno)
                return errno ? -errno : -EINVAL;

        if ((unsigned long)(unsigned)l != l)
                return -ERANGE;

        *ret_u = (unsigned)l;
        return 0;
}

static const char *const log_level_table[] = {
        [LOG_EMERG] = "emerg",
        [LOG_ALERT] = "alert",
        [LOG_CRIT] = "crit",
        [LOG_ERR] = "err",
        [LOG_WARNING] = "warning",
        [LOG_NOTICE] = "notice",
        [LOG_INFO] = "info",
        [LOG_DEBUG] = "debug"
};

DEFINE_STRING_TABLE_LOOKUP(log_level, int);

char *strnappend(const char *s, const char *suffix, size_t b)
{
        size_t a;
        char *r;

        if (!s && !suffix)
                return strdup("");

        if (!s)
                return strndup(suffix, b);

        if (!suffix)
                return strdup(s);

        assert(s);
        assert(suffix);

        a = strlen(s);
        if (b > ((size_t)-1) - a)
                return NULL;

        r = new(char, a + b + 1);
        if (!r)
                return NULL;

        memcpy(r, s, a);
        memcpy(r + a, suffix, b);
        r[a + b] = 0;

        return r;
}

char *strappend(const char *s, const char *suffix)
{
        return strnappend(s, suffix, suffix ? strlen(suffix) : 0);
}

char *strjoin(const char *x, ...)
{
        va_list ap;
        size_t l;
        char *r;

        va_start(ap, x);

        if (x) {
                l = strlen(x);

                for (;;) {
                        const char *t;
                        size_t n;

                        t = va_arg(ap, const char *);
                        if (!t)
                                break;

                        n = strlen(t);
                        if (n > ((size_t)-1) - l) {
                                va_end(ap);
                                return NULL;
                        }

                        l += n;
                }
        } else
                l = 0;

        va_end(ap);

        r = new(char, l + 1);
        if (!r)
                return NULL;

        if (x) {
                char *p;

                p = stpcpy(r, x);

                va_start(ap, x);

                for (;;) {
                        const char *t;

                        t = va_arg(ap, const char *);
                        if (!t)
                                break;

                        p = stpcpy(p, t);
                }

                va_end(ap);
        } else
                r[0] = 0;

        return r;
}

char *cunescape_length_with_prefix(const char *s, size_t length, const char *prefix)
{
        char *r, *t;
        const char *f;
        size_t pl;

        assert(s);

        /* Undoes C style string escaping, and optionally prefixes it. */

        pl = prefix ? strlen(prefix) : 0;

        r = new(char, pl + length + 1);
        if (!r)
                return r;

        if (prefix)
                memcpy(r, prefix, pl);

        for (f = s, t = r + pl; f < s + length; f++) {

                if (*f != '\\') {
                        *(t++) = *f;
                        continue;
                }

                f++;

                switch (*f) {

                case 'a':
                        *(t++) = '\a';
                        break;
                case 'b':
                        *(t++) = '\b';
                        break;
                case 'f':
                        *(t++) = '\f';
                        break;
                case 'n':
                        *(t++) = '\n';
                        break;
                case 'r':
                        *(t++) = '\r';
                        break;
                case 't':
                        *(t++) = '\t';
                        break;
                case 'v':
                        *(t++) = '\v';
                        break;
                case '\\':
                        *(t++) = '\\';
                        break;
                case '"':
                        *(t++) = '"';
                        break;
                case '\'':
                        *(t++) = '\'';
                        break;

                case 's':
                        /* This is an extension of the XDG syntax files */
                        *(t++) = ' ';
                        break;

                case 'x': {
                        /* hexadecimal encoding */
                        int a, b;

                        a = unhexchar(f[1]);
                        b = unhexchar(f[2]);

                        if (a < 0 || b < 0) {
                                /* Invalid escape code, let's take it literal then */
                                *(t++) = '\\';
                                *(t++) = 'x';
                        } else {
                                *(t++) = (char)((a << 4) | b);
                                f += 2;
                        }

                        break;
                }

                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7': {
                        /* octal encoding */
                        int a, b, c;

                        a = unoctchar(f[0]);
                        b = unoctchar(f[1]);
                        c = unoctchar(f[2]);

                        if (a < 0 || b < 0 || c < 0) {
                                /* Invalid escape code, let's take it literal then */
                                *(t++) = '\\';
                                *(t++) = f[0];
                        } else {
                                *(t++) = (char)((a << 6) | (b << 3) | c);
                                f += 2;
                        }

                        break;
                }

                case 0:
                        /* premature end of string. */
                        *(t++) = '\\';
                        goto finish;

                default:
                        /* Invalid escape code, let's take it literal then */
                        *(t++) = '\\';
                        *(t++) = *f;
                        break;
                }
        }

finish:
        *t = 0;
        return r;
}

char *cunescape_length(const char *s, size_t length)
{
        return cunescape_length_with_prefix(s, length, NULL);
}

/* Split a string into words, but consider strings enclosed in '' and
 * "" as words even if they include spaces. */
char *split_quoted(const char *c, size_t *l, char **state)
{
        const char *current, *e;
        bool escaped = false;

        assert(c);
        assert(l);
        assert(state);

        current = *state ? *state : c;

        current += strspn(current, WHITESPACE);

        if (*current == 0)
                return NULL;

        else if (*current == '\'') {
                current++;

                for (e = current; *e; e++) {
                        if (escaped)
                                escaped = false;
                        else if (*e == '\\')
                                escaped = true;
                        else if (*e == '\'')
                                break;
                }

                *l = e - current;
                *state = (char *)(*e == 0 ? e : e + 1);

        } else if (*current == '\"') {
                current++;

                for (e = current; *e; e++) {
                        if (escaped)
                                escaped = false;
                        else if (*e == '\\')
                                escaped = true;
                        else if (*e == '\"')
                                break;
                }

                *l = e - current;
                *state = (char *)(*e == 0 ? e : e + 1);

        } else {
                for (e = current; *e; e++) {
                        if (escaped)
                                escaped = false;
                        else if (*e == '\\')
                                escaped = true;
                        else if (strchr(WHITESPACE, *e))
                                break;
                }
                *l = e - current;
                *state = (char *)e;
        }

        return (char *)current;
}

/* Split a string into words. */
char *split(const char *c, size_t *l, const char *separator, char **state)
{
        char *current;

        current = *state ? *state : (char *)c;

        if (!*current || *c == 0)
                return NULL;

        current += strspn(current, separator);
        *l = strcspn(current, separator);
        *state = current + *l;

        return (char *)current;
}

int unhexchar(char c)
{

        if (c >= '0' && c <= '9')
                return c - '0';

        if (c >= 'a' && c <= 'f')
                return c - 'a' + 10;

        if (c >= 'A' && c <= 'F')
                return c - 'A' + 10;

        return -1;
}

int unoctchar(char c)
{

        if (c >= '0' && c <= '7')
                return c - '0';

        return -1;
}
   07070100000241000081A400000000000000000000000164DF2CB80000493E000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/src/install/util.h  #ifndef fooutilhfoo
#define fooutilhfoo

/***
  This file is part of systemd.

  Copyright 2010 Lennart Poettering

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

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

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

#define _GNU_SOURCE

#include <inttypes.h>
#include <time.h>
#include <sys/time.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <sched.h>
#include <limits.h>
#include <sys/stat.h>
#include <dirent.h>
#include <sys/resource.h>

#include "macro.h"

typedef uint64_t usec_t;
typedef uint64_t nsec_t;

typedef struct dual_timestamp {
        usec_t realtime;
        usec_t monotonic;
} dual_timestamp;

#define MSEC_PER_SEC  1000ULL
#define USEC_PER_SEC  1000000ULL
#define USEC_PER_MSEC 1000ULL
#define NSEC_PER_SEC  1000000000ULL
#define NSEC_PER_MSEC 1000000ULL
#define NSEC_PER_USEC 1000ULL

#define USEC_PER_MINUTE (60ULL*USEC_PER_SEC)
#define NSEC_PER_MINUTE (60ULL*NSEC_PER_SEC)
#define USEC_PER_HOUR (60ULL*USEC_PER_MINUTE)
#define NSEC_PER_HOUR (60ULL*NSEC_PER_MINUTE)
#define USEC_PER_DAY (24ULL*USEC_PER_HOUR)
#define NSEC_PER_DAY (24ULL*NSEC_PER_HOUR)
#define USEC_PER_WEEK (7ULL*USEC_PER_DAY)
#define NSEC_PER_WEEK (7ULL*NSEC_PER_DAY)
#define USEC_PER_MONTH (2629800ULL*USEC_PER_SEC)
#define NSEC_PER_MONTH (2629800ULL*NSEC_PER_SEC)
#define USEC_PER_YEAR (31557600ULL*USEC_PER_SEC)
#define NSEC_PER_YEAR (31557600ULL*NSEC_PER_SEC)

/* What is interpreted as whitespace? */
#define WHITESPACE " \t\n\r"
#define NEWLINE "\n\r"
#define QUOTES "\"\'"
#define COMMENTS "#;\n"

#define FORMAT_TIMESTAMP_MAX 64
#define FORMAT_TIMESTAMP_PRETTY_MAX 256
#define FORMAT_TIMESPAN_MAX 64
#define FORMAT_BYTES_MAX 8

#define ANSI_HIGHLIGHT_ON "\x1B[1;39m"
#define ANSI_HIGHLIGHT_RED_ON "\x1B[1;31m"
#define ANSI_HIGHLIGHT_GREEN_ON "\x1B[1;32m"
#define ANSI_HIGHLIGHT_YELLOW_ON "\x1B[1;33m"
#define ANSI_HIGHLIGHT_OFF "\x1B[0m"

usec_t now(clockid_t clock);

dual_timestamp *dual_timestamp_get(dual_timestamp *ts);
dual_timestamp *dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u);

#define dual_timestamp_is_set(ts) ((ts)->realtime > 0)

usec_t timespec_load(const struct timespec *ts);
struct timespec *timespec_store(struct timespec *ts, usec_t u);

usec_t timeval_load(const struct timeval *tv);
struct timeval *timeval_store(struct timeval *tv, usec_t u);

size_t page_size(void);
#define PAGE_ALIGN(l) ALIGN_TO((l), page_size())

#define streq(a,b) (strcmp((a),(b)) == 0)
#define strneq(a, b, n) (strncmp((a), (b), (n)) == 0)

bool streq_ptr(const char *a, const char *b);

#define new(t, n) ((t*) malloc(sizeof(t)*(n)))

#define new0(t, n) ((t*) calloc((n), sizeof(t)))

#define newa(t, n) ((t*) alloca(sizeof(t)*(n)))

#define newdup(t, p, n) ((t*) memdup(p, sizeof(t)*(n)))

#define malloc0(n) (calloc((n), 1))

static inline const char *yes_no(bool b)
{
        return b ? "yes" : "no";
}

static inline const char *strempty(const char *s)
{
        return s ? s : "";
}

static inline const char *strnull(const char *s)
{
        return s ? s : "(null)";
}

static inline const char *strna(const char *s)
{
        return s ? s : "n/a";
}

static inline bool isempty(const char *p)
{
        return !p || !p[0];
}

static inline const char *startswith(const char *s, const char *prefix)
{
        if (strncmp(s, prefix, strlen(prefix)) == 0)
                return s + strlen(prefix);
        return NULL;
}

bool endswith(const char *s, const char *postfix);

bool startswith_no_case(const char *s, const char *prefix);

bool first_word(const char *s, const char *word);

int close_nointr(int fd);
void close_nointr_nofail(int fd);
void close_many(const int fds[], unsigned n_fd);

int parse_boolean(const char *v);
int parse_usec(const char *t, usec_t *usec);
int parse_nsec(const char *t, nsec_t *nsec);
int parse_bytes(const char *t, off_t *bytes);
int parse_pid(const char *s, pid_t *ret_pid);
int parse_uid(const char *s, uid_t *ret_uid);
#define parse_gid(s, ret_uid) parse_uid(s, ret_uid)

int safe_atou(const char *s, unsigned *ret_u);
int safe_atoi(const char *s, int *ret_i);

int safe_atollu(const char *s, unsigned long long *ret_u);
int safe_atolli(const char *s, long long int *ret_i);

#if LONG_MAX == INT_MAX
static inline int safe_atolu(const char *s, unsigned long *ret_u)
{
        assert_cc(sizeof(unsigned long) == sizeof(unsigned));
        return safe_atou(s, (unsigned *)ret_u);
}

static inline int safe_atoli(const char *s, long int *ret_u)
{
        assert_cc(sizeof(long int) == sizeof(int));
        return safe_atoi(s, (int *)ret_u);
}
#else
static inline int safe_atolu(const char *s, unsigned long *ret_u)
{
        assert_cc(sizeof(unsigned long) == sizeof(unsigned long long));
        return safe_atollu(s, (unsigned long long *)ret_u);
}

static inline int safe_atoli(const char *s, long int *ret_u)
{
        assert_cc(sizeof(long int) == sizeof(long long int));
        return safe_atolli(s, (long long int *)ret_u);
}
#endif

static inline int safe_atou32(const char *s, uint32_t *ret_u)
{
        assert_cc(sizeof(uint32_t) == sizeof(unsigned));
        return safe_atou(s, (unsigned *)ret_u);
}

static inline int safe_atoi32(const char *s, int32_t *ret_i)
{
        assert_cc(sizeof(int32_t) == sizeof(int));
        return safe_atoi(s, (int *)ret_i);
}

static inline int safe_atou64(const char *s, uint64_t *ret_u)
{
        assert_cc(sizeof(uint64_t) == sizeof(unsigned long long));
        return safe_atollu(s, (unsigned long long *)ret_u);
}

static inline int safe_atoi64(const char *s, int64_t *ret_i)
{
        assert_cc(sizeof(int64_t) == sizeof(long long int));
        return safe_atolli(s, (long long int *)ret_i);
}

char *split(const char *c, size_t *l, const char *separator, char **state);
char *split_quoted(const char *c, size_t *l, char **state);

#define FOREACH_WORD(word, length, s, state)                            \
        for ((state) = NULL, (word) = split((s), &(length), WHITESPACE, &(state)); (word); (word) = split((s), &(length), WHITESPACE, &(state)))

#define FOREACH_WORD_SEPARATOR(word, length, s, separator, state)       \
        for ((state) = NULL, (word) = split((s), &(length), (separator), &(state)); (word); (word) = split((s), &(length), (separator), &(state)))

#define FOREACH_WORD_QUOTED(word, length, s, state)                     \
        for ((state) = NULL, (word) = split_quoted((s), &(length), &(state)); (word); (word) = split_quoted((s), &(length), &(state)))

pid_t get_parent_of_pid(pid_t pid, pid_t *ppid);
int get_starttime_of_pid(pid_t pid, unsigned long long *st);

int write_one_line_file(const char *fn, const char *line);
int write_one_line_file_atomic(const char *fn, const char *line);
int read_one_line_file(const char *fn, char **line);
int read_full_file(const char *fn, char **contents, size_t *size);

int parse_env_file(const char *fname, const char *separator, ...) _sentinel_;
int load_env_file(const char *fname, char ***l);
int write_env_file(const char *fname, char **l);

char *strappend(const char *s, const char *suffix);
char *strnappend(const char *s, const char *suffix, size_t length);

char *replace_env(const char *format, char **env);
char **replace_env_argv(char **argv, char **env);

int readlink_malloc(const char *p, char **r);
int readlink_and_make_absolute(const char *p, char **r);
int readlink_and_canonicalize(const char *p, char **r);

int reset_all_signal_handlers(void);

char *strstrip(char *s);
char *delete_chars(char *s, const char *bad);
char *truncate_nl(char *s);

char *file_in_same_dir(const char *path, const char *filename);

int rmdir_parents(const char *path, const char *stop);

int get_process_comm(pid_t pid, char **name);
int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char **line);
int get_process_exe(pid_t pid, char **name);
int get_process_uid(pid_t pid, uid_t *uid);

char hexchar(int x);
int unhexchar(char c);
char octchar(int x);
int unoctchar(char c);
char decchar(int x);
int undecchar(char c);

char *cescape(const char *s);
char *cunescape(const char *s);
char *cunescape_length(const char *s, size_t length);

char *xescape(const char *s, const char *bad);

char *bus_path_escape(const char *s);
char *bus_path_unescape(const char *s);

char *ascii_strlower(char *path);

bool dirent_is_file(const struct dirent *de);
bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix);

bool ignore_file(const char *filename);

bool chars_intersect(const char *a, const char *b);

char *format_timestamp(char *buf, size_t l, usec_t t);
char *format_timestamp_pretty(char *buf, size_t l, usec_t t);
char *format_timespan(char *buf, size_t l, usec_t t);

int make_stdio(int fd);
int make_null_stdio(void);

unsigned long long random_ull(void);

#define __DEFINE_STRING_TABLE_LOOKUP(name,type,scope)                   \
        scope const char *name##_to_string(type i) {                    \
                if (i < 0 || i >= (type) ELEMENTSOF(name##_table))      \
                        return NULL;                                    \
                return name##_table[i];                                 \
        }                                                               \
        scope type name##_from_string(const char *s) {                  \
                type i;                                                 \
                unsigned u = 0;                                         \
                assert(s);                                              \
                for (i = 0; i < (type)ELEMENTSOF(name##_table); i++)    \
                        if (name##_table[i] &&                          \
                            streq(name##_table[i], s))                  \
                                return i;                               \
                if (safe_atou(s, &u) >= 0 &&                            \
                    u < ELEMENTSOF(name##_table))                       \
                        return (type) u;                                \
                return (type) -1;                                       \
        }                                                               \
        struct __useless_struct_to_allow_trailing_semicolon__

#define DEFINE_STRING_TABLE_LOOKUP(name,type) __DEFINE_STRING_TABLE_LOOKUP(name,type,)
#define DEFINE_PRIVATE_STRING_TABLE_LOOKUP(name,type) __DEFINE_STRING_TABLE_LOOKUP(name,type,static)

int fd_nonblock(int fd, bool nonblock);
int fd_cloexec(int fd, bool cloexec);

int close_all_fds(const int except[], unsigned n_except);

bool fstype_is_network(const char *fstype);

int chvt(int vt);

int read_one_char(FILE *f, char *ret, usec_t timeout, bool *need_nl);
int ask(char *ret, const char *replies, const char *text, ...);

int reset_terminal_fd(int fd, bool switch_to_text);
int reset_terminal(const char *name);

int open_terminal(const char *name, int mode);
int acquire_terminal(const char *name, bool fail, bool force, bool ignore_tiocstty_eperm);
int release_terminal(void);

int flush_fd(int fd);

int ignore_signals(int sig, ...);
int default_signals(int sig, ...);
int sigaction_many(const struct sigaction *sa, ...);

int close_pipe(int p[]);
int fopen_temporary(const char *path, FILE **_f, char **_temp_path);

ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll);
ssize_t loop_write(int fd, const void *buf, size_t nbytes, bool do_poll);

bool is_device_path(const char *path);

int dir_is_empty(const char *path);

void rename_process(const char name[8]);

void sigset_add_many(sigset_t *ss, ...);

char *gethostname_malloc(void);
bool hostname_is_set(void);
char *getlogname_malloc(void);

int getttyname_malloc(int fd, char **r);
int getttyname_harder(int fd, char **r);

int get_ctty_devnr(pid_t pid, dev_t *d);
int get_ctty(pid_t, dev_t *_devnr, char **r);

int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid);
int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid);

int rm_rf_children(int fd, bool only_dirs, bool honour_sticky, struct stat *root_dev);
int rm_rf(const char *path, bool only_dirs, bool delete_root, bool honour_sticky);

int pipe_eof(int fd);

cpu_set_t *cpu_set_malloc(unsigned *ncpus);

void status_vprintf(const char *status, bool ellipse, const char *format, va_list ap);
void status_printf(const char *status, bool ellipse, const char *format, ...);
void status_welcome(void);

int fd_columns(int fd);
unsigned columns(void);

int fd_lines(int fd);
unsigned lines(void);

int running_in_chroot(void);

char *ellipsize(const char *s, size_t length, unsigned percent);
char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigned percent);

int touch(const char *path);

char *unquote(const char *s, const char *quotes);
char *normalize_env_assignment(const char *s);

int wait_for_terminate(pid_t pid, siginfo_t *status);
int wait_for_terminate_and_warn(const char *name, pid_t pid);

_noreturn_ void freeze(void);

bool null_or_empty(struct stat *st);
int null_or_empty_path(const char *fn);

DIR *xopendirat(int dirfd, const char *name, int flags);

void dual_timestamp_serialize(FILE *f, const char *name, dual_timestamp *t);
void dual_timestamp_deserialize(const char *value, dual_timestamp *t);

char *fstab_node_to_udev_node(const char *p);

bool tty_is_vc(const char *tty);
bool tty_is_vc_resolve(const char *tty);
bool tty_is_console(const char *tty);
int vtnr_from_tty(const char *tty);
const char *default_term_for_tty(const char *tty);

void execute_directory(const char *directory, DIR *_d, char *argv[]);

int kill_and_sigcont(pid_t pid, int sig);

bool nulstr_contains(const char *nulstr, const char *needle);

bool plymouth_running(void);

void parse_syslog_priority(char **p, int *priority);
void skip_syslog_pid(char **buf);
void skip_syslog_date(char **buf);

bool hostname_is_valid(const char *s);
char *hostname_cleanup(char *s);

char *strshorten(char *s, size_t l);

int terminal_vhangup_fd(int fd);
int terminal_vhangup(const char *name);

int vt_disallocate(const char *name);

int copy_file(const char *from, const char *to);
int symlink_or_copy(const char *from, const char *to);
int symlink_or_copy_atomic(const char *from, const char *to);

int fchmod_umask(int fd, mode_t mode);

bool display_is_local(const char *display);
int socket_from_display(const char *display, char **path);

int get_user_creds(const char **username, uid_t *uid, gid_t *gid, const char **home);
int get_group_creds(const char **groupname, gid_t *gid);

int in_group(const char *name);

int glob_exists(const char *path);

int dirent_ensure_type(DIR *d, struct dirent *de);

int in_search_path(const char *path, char **search);
int get_files_in_directory(const char *path, char ***list);

char *join(const char *x, ...) _sentinel_;

bool is_main_thread(void);

bool in_charset(const char *s, const char *charset);

int block_get_whole_disk(dev_t d, dev_t *ret);

int file_is_priv_sticky(const char *p);

int strdup_or_null(const char *a, char **b);

#define NULSTR_FOREACH(i, l)                                    \
        for ((i) = (l); (i) && *(i); (i) = strchr((i), 0)+1)

#define NULSTR_FOREACH_PAIR(i, j, l)                             \
        for ((i) = (l), (j) = strchr((i), 0)+1; (i) && *(i); (i) = strchr((j), 0)+1, (j) = *(i) ? strchr((i), 0)+1 : (i))

const char *ioprio_class_to_string(int i);
int ioprio_class_from_string(const char *s);

const char *sigchld_code_to_string(int i);
int sigchld_code_from_string(const char *s);

const char *log_facility_unshifted_to_string(int i);
int log_facility_unshifted_from_string(const char *s);

const char *log_level_to_string(int i);
int log_level_from_string(const char *s);

const char *sched_policy_to_string(int i);
int sched_policy_from_string(const char *s);

const char *rlimit_to_string(int i);
int rlimit_from_string(const char *s);

const char *ip_tos_to_string(int i);
int ip_tos_from_string(const char *s);

const char *signal_to_string(int i);
int signal_from_string(const char *s);

int signal_from_string_try_harder(const char *s);

extern int saved_argc;
extern char **saved_argv;

bool kexec_loaded(void);

int prot_from_flags(int flags);

char *format_bytes(char *buf, size_t l, off_t t);

int fd_wait_for_event(int fd, int event, usec_t timeout);

void *memdup(const void *p, size_t l);

int is_kernel_thread(pid_t pid);

static inline void freep(void *p)
{
        free(*(void **)p);
}

static inline void fclosep(FILE **f)
{
        if (*f)
                fclose(*f);
}

static inline void pclosep(FILE **f)
{
        if (*f)
                pclose(*f);
}

static inline void closep(int *fd)
{
        if (*fd >= 0)
                close_nointr_nofail(*fd);
}

static inline void closedirp(DIR **d)
{
        if (*d)
                closedir(*d);
}

static inline void umaskp(mode_t *u)
{
        umask(*u);
}

#define _cleanup_free_ _cleanup_(freep)
#define _cleanup_fclose_ _cleanup_(fclosep)
#define _cleanup_pclose_ _cleanup_(pclosep)
#define _cleanup_close_ _cleanup_(closep)
#define _cleanup_closedir_ _cleanup_(closedirp)
#define _cleanup_umask_ _cleanup_(umaskp)
#define _cleanup_globfree_ _cleanup_(globfree)

int fd_inc_sndbuf(int fd, size_t n);
int fd_inc_rcvbuf(int fd, size_t n);

int fork_agent(pid_t *pid, const int except[], unsigned n_except, const char *path, ...);

int setrlimit_closest(int resource, const struct rlimit *rlim);

int getenv_for_pid(pid_t pid, const char *field, char **_value);

int can_sleep(const char *type);

bool is_valid_documentation_url(const char *url);

bool in_initrd(void);

void warn_melody(void);

char *strjoin(const char *x, ...) _sentinel_;

#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func)                 \
        static inline void func##p(type *p) {                   \
                if (*p)                                         \
                        func(*p);                               \
        }                                                       \
        struct __useless_struct_to_allow_trailing_semicolon__

char *split_quoted(const char *c, size_t *l, char **state);
char *cunescape_length(const char *s, size_t length);
int unhexchar(char c) _const_;
int unoctchar(char c) _const_;

#endif
  07070100000242000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002900000000dracut-055+suse.347.gdcb9bdbf/src/logtee  07070100000243000081A400000000000000000000000164DF2CB8000007A7000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/src/logtee/logtee.c #define _GNU_SOURCE
#include <fcntl.h>
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <limits.h>

#define BUFLEN 4096

int main(int argc, char *argv[])
{
        int fd;
        int len, slen;
        int ret;
        int timeout;
        char *timeout_env;
        struct pollfd fds[] = { {
                        .fd = STDIN_FILENO,
                        .events = POLLIN | POLLERR,
                }
        };

        timeout_env = getenv("LOGTEE_TIMEOUT_MS");
        if (timeout_env)
                timeout = atoi(timeout_env);
        else
                timeout = -1;

        if (argc != 2) {
                fprintf(stderr, "Usage: %s <file>\n", argv[0]);
                exit(EXIT_FAILURE);
        }

        fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC | O_NONBLOCK, 0644);
        if (fd == -1) {
                perror("open");
                exit(EXIT_FAILURE);
        }

        fprintf(stderr, "Logging to %s: ", argv[1]);

        slen = 0;

        do {
                ret = poll(fds, sizeof(fds) / sizeof(fds[0]), timeout);
                if (ret == 0) {
                        fprintf(stderr, "Timed out after %d milliseconds of no output.\n", timeout);
                        exit(EXIT_FAILURE);
                }
                len = splice(STDIN_FILENO, NULL, fd, NULL, BUFLEN, SPLICE_F_MOVE | SPLICE_F_NONBLOCK);

                if (len < 0) {
                        if (errno == EAGAIN)
                                continue;
                        perror("tee");
                        exit(EXIT_FAILURE);
                } else if (len == 0)
                        break;
                slen += len;
                if ((slen / BUFLEN) > 0) {
                        fprintf(stderr, ".");
                }
                slen = slen % BUFLEN;

        } while (1);
        close(fd);
        fprintf(stderr, "\n");
        exit(EXIT_SUCCESS);
}
 07070100000244000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002B00000000dracut-055+suse.347.gdcb9bdbf/src/skipcpio    07070100000245000081A400000000000000000000000164DF2CB800000034000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/src/skipcpio/.dir-locals.el (setq c-basic-offset 8)
(setq indent-tabs-mode nil)
07070100000246000081A400000000000000000000000164DF2CB80000004F000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/src/skipcpio/.kateconfig    kate: space-indent on; tab-width 8; indent-width 8; replace-tabs on; eol unix;
 07070100000247000081A400000000000000000000000164DF2CB800001562000000000000000000000000000000000000003600000000dracut-055+suse.347.gdcb9bdbf/src/skipcpio/skipcpio.c /* dracut-install.c  -- install files and executables

   Copyright (C) 2012 Harald Hoyer
   Copyright (C) 2012 Red Hat, Inc.  All rights reserved.

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

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

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

#define PROGRAM_VERSION_STRING "1"

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define CPIO_MAGIC "070701"
#define CPIO_END "TRAILER!!!"
#define CPIO_ENDLEN (sizeof(CPIO_END) - 1)

#define CPIO_ALIGNMENT 4

struct cpio_header {
        char c_magic[6];
        char c_ino[8];
        char c_mode[8];
        char c_uid[8];
        char c_gid[8];
        char c_nlink[8];
        char c_mtime[8];
        char c_filesize[8];
        char c_dev_maj[8];
        char c_dev_min[8];
        char c_rdev_maj[8];
        char c_rdev_min[8];
        char c_namesize[8];
        char c_chksum[8];
} __attribute__((packed));

struct buf_struct {
        struct cpio_header h;
        char filename[CPIO_ENDLEN];
} __attribute__((packed));

union buf_union {
        struct buf_struct cpio;
        char copy_buffer[2048];
};

static union buf_union buf;

#define ALIGN_UP(n, a) (((n) + (a) - 1) & (~((a) - 1)))

int main(int argc, char **argv)
{
        FILE *f;
        size_t s;

        if (argc != 2) {
                fprintf(stderr, "Usage: %s <file>\n", argv[0]);
                exit(1);
        }

        f = fopen(argv[1], "r");

        if (f == NULL) {
                fprintf(stderr, "Cannot open file '%s'\n", argv[1]);
                exit(1);
        }

        s = fread(&buf.cpio, sizeof(buf.cpio), 1, f);
        if (s <= 0) {
                fprintf(stderr, "Read error from file '%s'\n", argv[1]);
                fclose(f);
                exit(1);
        }
        fseek(f, 0, SEEK_SET);

        /* check, if this is a cpio archive */
        if (memcmp(buf.cpio.h.c_magic, CPIO_MAGIC, 6) == 0) {

                long pos = 0;

                unsigned long filesize;
                unsigned long filename_length;

                do {
                        // zero string, spilling into next unused field, to use strtol
                        buf.cpio.h.c_chksum[0] = 0;
                        filename_length = strtoul(buf.cpio.h.c_namesize, NULL, 16);
                        pos = ALIGN_UP(pos + sizeof(struct cpio_header) + filename_length, CPIO_ALIGNMENT);

                        // zero string, spilling into next unused field, to use strtol
                        buf.cpio.h.c_dev_maj[0] = 0;
                        filesize = strtoul(buf.cpio.h.c_filesize, NULL, 16);
                        pos = ALIGN_UP(pos + filesize, CPIO_ALIGNMENT);

                        if (filename_length == (CPIO_ENDLEN + 1)
                            && strncmp(buf.cpio.filename, CPIO_END, CPIO_ENDLEN) == 0) {
                                fseek(f, pos, SEEK_SET);
                                break;
                        }

                        if (fseek(f, pos, SEEK_SET) != 0) {
                                perror("fseek");
                                exit(1);
                        }

                        if (fread(&buf.cpio, sizeof(buf.cpio), 1, f) != 1) {
                                perror("fread");
                                exit(1);
                        }

                        if (memcmp(buf.cpio.h.c_magic, CPIO_MAGIC, 6) != 0) {
                                fprintf(stderr, "Corrupt CPIO archive!\n");
                                exit(1);
                        }
                } while (!feof(f));

                if (feof(f)) {
                        /* CPIO_END not found, just cat the whole file */
                        fseek(f, 0, SEEK_SET);
                } else {
                        /* skip zeros */
                        do {
                                size_t i;

                                s = fread(buf.copy_buffer, 1, sizeof(buf.copy_buffer) - 1, f);
                                if (s <= 0)
                                        break;

                                for (i = 0; (i < s) && (buf.copy_buffer[i] == 0); i++) ;

                                if (buf.copy_buffer[i] != 0) {
                                        pos += i;

                                        fseek(f, pos, SEEK_SET);
                                        break;
                                }

                                pos += s;
                        } while (!feof(f));
                }
        }
        /* cat out the rest */
        while (!feof(f)) {
                s = fread(buf.copy_buffer, 1, sizeof(buf.copy_buffer), f);
                if (s <= 0)
                        break;

                s = fwrite(buf.copy_buffer, 1, s, stdout);
                if (s <= 0)
                        break;
        }
        fclose(f);

        return EXIT_SUCCESS;
}
  07070100000248000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002700000000dracut-055+suse.347.gdcb9bdbf/src/util    07070100000249000081A400000000000000000000000164DF2CB80000007A000000000000000000000000000000000000003600000000dracut-055+suse.347.gdcb9bdbf/src/util/CMakeLists.txt cmake_minimum_required(VERSION 3.17)
project(dracut-util C)

set(CMAKE_C_STANDARD 99)

add_executable(dracut-util util.c)
  0707010000024A000081A400000000000000000000000164DF2CB80000265A000000000000000000000000000000000000002E00000000dracut-055+suse.347.gdcb9bdbf/src/util/util.c // SPDX-License-Identifier: GPL-2.0

// Parts are copied from the linux kernel

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>

// CODE FROM LINUX KERNEL START

#define _U  0x01                /* upper */
#define _L  0x02                /* lower */
#define _D  0x04                /* digit */
#define _C  0x08                /* cntrl */
#define _P  0x10                /* punct */
#define _S  0x20                /* white space (space/lf/tab) */
#define _X  0x40                /* hex digit */
#define _SP 0x80                /* hard space (0x20) */

const unsigned char _ctype[] = {
        _C, _C, _C, _C, _C, _C, _C, _C, /* 0-7 */
        _C, _C | _S, _C | _S, _C | _S, _C | _S, _C | _S, _C, _C,        /* 8-15 */
        _C, _C, _C, _C, _C, _C, _C, _C, /* 16-23 */
        _C, _C, _C, _C, _C, _C, _C, _C, /* 24-31 */
        _S | _SP, _P, _P, _P, _P, _P, _P, _P,   /* 32-39 */
        _P, _P, _P, _P, _P, _P, _P, _P, /* 40-47 */
        _D, _D, _D, _D, _D, _D, _D, _D, /* 48-55 */
        _D, _D, _P, _P, _P, _P, _P, _P, /* 56-63 */
        _P, _U | _X, _U | _X, _U | _X, _U | _X, _U | _X, _U | _X, _U,   /* 64-71 */
        _U, _U, _U, _U, _U, _U, _U, _U, /* 72-79 */
        _U, _U, _U, _U, _U, _U, _U, _U, /* 80-87 */
        _U, _U, _U, _P, _P, _P, _P, _P, /* 88-95 */
        _P, _L | _X, _L | _X, _L | _X, _L | _X, _L | _X, _L | _X, _L,   /* 96-103 */
        _L, _L, _L, _L, _L, _L, _L, _L, /* 104-111 */
        _L, _L, _L, _L, _L, _L, _L, _L, /* 112-119 */
        _L, _L, _L, _P, _P, _P, _P, _C, /* 120-127 */
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 128-143 */
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 144-159 */
        _S | _SP, _P, _P, _P, _P, _P, _P, _P, _P, _P, _P, _P, _P, _P, _P, _P,   /* 160-175 */
        _P, _P, _P, _P, _P, _P, _P, _P, _P, _P, _P, _P, _P, _P, _P, _P, /* 176-191 */
        _U, _U, _U, _U, _U, _U, _U, _U, _U, _U, _U, _U, _U, _U, _U, _U, /* 192-207 */
        _U, _U, _U, _U, _U, _U, _U, _P, _U, _U, _U, _U, _U, _U, _U, _L, /* 208-223 */
        _L, _L, _L, _L, _L, _L, _L, _L, _L, _L, _L, _L, _L, _L, _L, _L, /* 224-239 */
        _L, _L, _L, _L, _L, _L, _L, _P, _L, _L, _L, _L, _L, _L, _L, _L  /* 240-255 */
};

#define __ismask(x) (_ctype[(int)(unsigned char)(x)])

#define kernel_isspace(c)  ((__ismask(c)&(_S)) != 0)

static char *skip_spaces(const char *str)
{
        while (kernel_isspace(*str))
                ++str;
        return (char *)str;
}

/*
 * Parse a string to get a param value pair.
 * You can use " around spaces, but can't escape ".
 * Hyphens and underscores equivalent in parameter names.
 */
static char *next_arg(char *args, char **param, char **val)
{
        unsigned int i, equals = 0;
        int in_quote = 0, quoted = 0;
        char *next;

        if (*args == '"') {
                args++;
                in_quote = 1;
                quoted = 1;
        }

        for (i = 0; args[i]; i++) {
                if (kernel_isspace(args[i]) && !in_quote)
                        break;
                if (equals == 0) {
                        if (args[i] == '=')
                                equals = i;
                }
                if (args[i] == '"')
                        in_quote = !in_quote;
        }

        *param = args;
        if (!equals)
                *val = NULL;
        else {
                args[equals] = '\0';
                *val = args + equals + 1;

                /* Don't include quotes in value. */
                if (**val == '"') {
                        (*val)++;
                        if (args[i - 1] == '"')
                                args[i - 1] = '\0';
                }
        }
        if (quoted && args[i - 1] == '"')
                args[i - 1] = '\0';

        if (args[i]) {
                args[i] = '\0';
                next = args + i + 1;
        } else
                next = args + i;

        /* Chew up trailing spaces. */
        return skip_spaces(next);
}

// CODE FROM LINUX KERNEL STOP

enum EXEC_MODE {
        UNDEFINED,
        GETARG,
        GETARGS,
};

static void usage(enum EXEC_MODE enumExecMode, int ret, char *msg)
{
        switch (enumExecMode) {
        case UNDEFINED:
                fprintf(stderr, "ERROR: 'dracut-util' has to be called via a symlink to the tool name.\n");
                break;
        case GETARG:
                fprintf(stderr, "ERROR: %s\nUsage: dracut-getarg <KEY>[=[<VALUE>]]\n", msg);
                break;
        case GETARGS:
                fprintf(stderr, "ERROR: %s\nUsage: dracut-getargs <KEY>[=]\n", msg);
                break;
        }
        exit(ret);
}

#define ARGV0_GETARG "dracut-getarg"
#define ARGV0_GETARGS "dracut-getargs"

static enum EXEC_MODE get_mode(const char *argv_0)
{
        struct _mode_table {
                enum EXEC_MODE mode;
                const char *arg;
                size_t arg_len;
                const char *s_arg;
        } modeTable[] = {
                {GETARG, ARGV0_GETARG, sizeof(ARGV0_GETARG), "/" ARGV0_GETARG},
                {GETARGS, ARGV0_GETARGS, sizeof(ARGV0_GETARGS), "/" ARGV0_GETARGS},
                {UNDEFINED, NULL, 0, NULL}
        };
        int i;

        size_t argv_0_len = strlen(argv_0);

        if (!argv_0_len)
                return UNDEFINED;

        for (i = 0; modeTable[i].mode != UNDEFINED; i++) {
                if (argv_0_len == (modeTable[i].arg_len - 1)) {
                        if (strncmp(argv_0, modeTable[i].arg, argv_0_len) == 0) {
                                return modeTable[i].mode;
                        }
                }

                if (modeTable[i].arg_len > argv_0_len)
                        continue;

                if (strncmp(argv_0 + argv_0_len - modeTable[i].arg_len, modeTable[i].s_arg, modeTable[i].arg_len) == 0)
                        return modeTable[i].mode;
        }
        return UNDEFINED;
}

static int getarg(int argc, char **argv)
{
        char *search_key;
        char *search_value;
        char *end_value = NULL;
        bool bool_value = false;
        char *cmdline = NULL;

        char *p = getenv("CMDLINE");
        if (p == NULL) {
                usage(GETARG, EXIT_FAILURE, "CMDLINE env not set");
        }
        cmdline = strdup(p);

        if (argc != 2) {
                usage(GETARG, EXIT_FAILURE, "Number of arguments invalid");
        }

        search_key = argv[1];

        search_value = strchr(argv[1], '=');
        if (search_value != NULL) {
                *search_value = 0;
                search_value++;
                if (*search_value == 0)
                        search_value = NULL;
        }

        if (strlen(search_key) == 0)
                usage(GETARG, EXIT_FAILURE, "search key undefined");

        do {
                char *key = NULL, *value = NULL;
                cmdline = next_arg(cmdline, &key, &value);
                if (strcmp(key, search_key) == 0) {
                        if (value) {
                                end_value = value;
                                bool_value = -1;
                        } else {
                                end_value = NULL;
                                bool_value = true;
                        }
                }
        } while (cmdline[0]);

        if (search_value) {
                if (end_value && strcmp(end_value, search_value) == 0) {
                        return EXIT_SUCCESS;
                }
                return EXIT_FAILURE;
        }

        if (end_value) {
                // includes "=0"
                puts(end_value);
                return EXIT_SUCCESS;
        }

        if (bool_value) {
                return EXIT_SUCCESS;
        }

        return EXIT_FAILURE;
}

static int getargs(int argc, char **argv)
{
        char *search_key;
        char *search_value;
        bool found_value = false;
        char *cmdline = NULL;

        char *p = getenv("CMDLINE");
        if (p == NULL) {
                usage(GETARGS, EXIT_FAILURE, "CMDLINE env not set");
        }
        cmdline = strdup(p);

        if (argc != 2) {
                usage(GETARGS, EXIT_FAILURE, "Number of arguments invalid");
        }

        search_key = argv[1];

        search_value = strchr(argv[1], '=');
        if (search_value != NULL) {
                *search_value = 0;
                search_value++;
                if (*search_value == 0)
                        search_value = NULL;
        }

        if (strlen(search_key) == 0)
                usage(GETARGS, EXIT_FAILURE, "search key undefined");

        do {
                char *key = NULL, *value = NULL;
                cmdline = next_arg(cmdline, &key, &value);
                if (strcmp(key, search_key) == 0) {
                        if (search_value) {
                                if (strcmp(value, search_value) == 0) {
                                        printf("%s\n", value);
                                        found_value = true;
                                }
                        } else {
                                if (value) {
                                        printf("%s\n", value);
                                } else {
                                        puts(key);
                                }
                                found_value = true;
                        }
                }
        } while (cmdline[0]);
        return found_value ? EXIT_SUCCESS : EXIT_FAILURE;
}

int main(int argc, char **argv)
{
        switch (get_mode(argv[0])) {
        case UNDEFINED:
                usage(UNDEFINED, EXIT_FAILURE, NULL);
                break;
        case GETARG:
                return getarg(argc, argv);
        case GETARGS:
                return getargs(argc, argv);
        }

        return EXIT_FAILURE;
}
  0707010000024B000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002300000000dracut-055+suse.347.gdcb9bdbf/suse    0707010000024C000081A400000000000000000000000164DF2CB8000001E7000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/suse/99-debug.conf  # Below adds additional tools to the initrd which are not urgently necessary to
# bring up the system, but help to debug problems.
# See /usr/lib/dracut/modules.d/95debug/module-setup.sh which additional tools
# are installed and add more if you need them. This specifically helps if you
# use:
# rd.break=[cmdline|pre-udev|pre-trigger|initqueue|pre-mount|
# mount|pre-pivot|cleanup]
# boot parameter or if you are forced to enter the dracut emergency shell.

# add_dracutmodules+=debug
 0707010000024D000081A400000000000000000000000164DF2CB8000002C1000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/suse/README.susemaint   Maintaining Dracut
==================

1. Adding/Submitting patches:

Patches get added as merge requests on Github against the respective maintenance branch.
If the dracut version is 049, the maintenance branch is SUSE/049. Please make sure
to provide an adiquate patch description. If you fix a modules, please prepend the module
name in the first line. Also add bugzilla and fate references in their own line:

  99example: Provide a useful description

  Explain the use cases for the module in more detail, give a general summary of
  its purpose.

  Reference: bsc#4566

2. Updating the OBS repo from git:

  rm dracut*.xz
  rm dracut*.obscpio
  osc service manualrun
  osc ar
  osc commit
  osc sr
   0707010000024E000081A400000000000000000000000164DF2CB800003A4C000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/suse/dracut.spec    #
# spec file for package dracut
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%define dracutlibdir %{_prefix}/lib/dracut

%if 0%{?suse_version} >= 1550
%define dracut_sbindir %{_sbindir}
%else
%define dracut_sbindir /sbin
%endif

Name:           dracut
Version:        054
Release:        0
Summary:        Initramfs generator using udev
License:        GPL-2.0-or-later AND LGPL-2.1-or-later
Group:          System/Base
URL:            https://dracut.wiki.kernel.org/
Source0:        dracut-%{version}.tar.xz
Source1:        dracut-rpmlintrc
Source2:        README.susemaint
BuildRequires:  asciidoc
BuildRequires:  bash
BuildRequires:  docbook-xsl-stylesheets
BuildRequires:  libxslt
BuildRequires:  suse-module-tools
BuildRequires:  pkgconfig(libkmod)
BuildRequires:  pkgconfig(systemd) >= 219
BuildRequires:  cargo
BuildRequires:  rust
Requires:       %{_bindir}/get_kernel_version
Requires:       bash
# systemd-sysvinit provides: poweroff, reboot, halt
Requires:       coreutils
Requires(post): coreutils
Requires:       cpio
Requires:       elfutils
Requires:       file
Requires:       filesystem
Requires:       findutils
Requires:       grep
Requires:       hardlink
Requires:       modutils
Requires:       pigz
Requires:       sed
Requires:       systemd >= 219
Requires:       systemd-sysvinit
Requires:       udev > 166
Requires:       util-linux >= 2.21
Requires:       util-linux-systemd >= 2.36.2
Recommends:     xz
Requires:       zstd
# We use 'btrfs fi usage' that was not present before
Conflicts:      btrfsprogs < 3.18
# suse-module-tools >= 15.4.7 is prepared for the removal of mkinitrd-suse.sh
Conflicts: suse-module-tools < 15.4.7
%{?systemd_requires}

%description
Dracut contains tools to create a bootable initramfs for Linux kernels >= 2.6.
Dracut contains various modules which are driven by the event-based udev
and systemd. Having root on MD, DM, LVM2, LUKS is supported as well as
NFS, iSCSI, NBD, FCoE.

%package fips
Summary:        Dracut modules to build a dracut initramfs with an integrity check
Group:          System/Base
Requires:       %{name} = %{version}-%{release}
Requires:       libcryptsetup12-hmac
Requires:       libgcrypt20-hmac
Requires:       libkcapi-tools
Requires:       libopenssl1_1-hmac

%description fips
This package requires everything which is needed to build an
initramfs with dracut, which does an integrity check of the kernel
and its cryptography during startup.

%package ima
Summary:        Dracut modules to build a dracut initramfs with IMA
Group:          System/Base
Requires:       %{name} = %{version}-%{release}
Requires:       evmctl
Requires:       keyutils

%description ima
This package requires everything which is needed to build an
initramfs (using dracut) which tries to load an IMA policy during startup.

%package tools
Summary:        Tools to build a local initramfs
Group:          System/Base
Requires:       %{name}
# split-provides for upgrade from SLES12 SP1 to SLES12 SP2
Provides:       %{name}:%{_bindir}/dracut-catimages

%description tools
This package contains tools to assemble the local initrd and host configuration.

%package extra
Summary:        Dracut modules usually not required for normal operation
Group:          System/Base
Requires:       %{name} = %{version}-%{release}
Requires:       evmctl
Requires:       keyutils

%description extra
This package contains all modules that are part of dracut upstream
but are not normally supported or required.

%package mkinitrd-deprecated
Summary:        Dracut mkinitrd wrapper
Group:          System/Base
Requires:       %{name} = %{version}-%{release}
Requires:       dracut
Obsoletes:      mkinitrd < 2.8.2
Provides:       mkinitrd = 2.8.2
Provides:       dracut:/sbin/mkinitrd

%description mkinitrd-deprecated
This package contains the legacy initrd script for dracut.
Call dracut directly instead.

%prep
%autosetup

%build
%configure \
  --systemdsystemunitdir=%{_unitdir} \
  --bashcompletiondir=%{_datarootdir}/bash-completion/completions \
  --libdir=%{_prefix}/lib \
  --enable-dracut-cpio
%make_build all CFLAGS="%{optflags}" %{?_smp_mflags}

%install
%make_install

echo -e "#!/bin/bash\nDRACUT_VERSION=%{version}-%{release}" > %{buildroot}/%{dracutlibdir}/dracut-version.sh

mkdir -p %{buildroot}/boot/dracut
mkdir -p %{buildroot}%{_localstatedir}/lib/dracut/overlay
mkdir -p %{buildroot}%{_localstatedir}/log
touch %{buildroot}%{_localstatedir}/log/dracut.log

install -D -m 0644 dracut.conf.d/suse.conf.example %{buildroot}/usr/lib/dracut/dracut.conf.d/01-dist.conf
install -m 0644 suse/99-debug.conf %{buildroot}%{_sysconfdir}/dracut.conf.d/99-debug.conf
install -m 0644 dracut.conf.d/fips.conf.example %{buildroot}%{_sysconfdir}/dracut.conf.d/40-fips.conf
install -m 0644 dracut.conf.d/ima.conf.example %{buildroot}%{_sysconfdir}/dracut.conf.d/40-ima.conf
# bsc#915218
%ifarch s390 s390x
install -m 0644 suse/s390x_persistent_device.conf %{buildroot}%{_sysconfdir}/dracut.conf.d/10-s390x_persistent_device.conf
%endif

install -D -m 0755 suse/mkinitrd-suse.sh %{buildroot}/%{dracut_sbindir}/mkinitrd

mv %{buildroot}%{_mandir}/man8/mkinitrd-suse.8 %{buildroot}%{_mandir}/man8/mkinitrd.8

%if 0%{?suse_version}
rm -f %{buildroot}/%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg.sh
ln -s %{dracutlibdir}/modules.d/45ifcfg/write-ifcfg-suse.sh %{buildroot}/%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg.sh
%else
mv %{buildroot}/%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg.sh %{buildroot}/%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg-redhat.sh
ln -s %{dracutlibdir}/modules.d/45ifcfg/write-ifcfg-redhat.sh %{buildroot}/%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg.sh
%endif

# create a link to dracut-util to be able to parse kernel command line arguments at generation time
ln -s %{dracutlibdir}/dracut-util %{buildroot}/%{dracutlibdir}/dracut-getarg

%post
# check whether /var/run has been converted to a symlink
if [ ! -L /var/run ]; then
    grep -q '^[ 	]*GRUB_CMDLINE_LINUX_DEFAULT=.*rd.convertfs' /etc/default/grub || \
    sed -i '/^[ 	]*GRUB_CMDLINE_LINUX_DEFAULT.*/s/"$/ rd.convertfs"/' /etc/default/grub  || :
    if ! grep --no-message 'add_dracutmodules+=" convertfs "' /etc/dracut.conf.d/05-convertfs.conf; then
        cat >>/etc/dracut.conf.d/05-convertfs.conf<<EOF
add_dracutmodules+=" convertfs "
EOF
    fi
fi
#clean up after the conversion is done
if [ -L /var/run ] && [ -f /etc/dracut.conf.d/05-convertfs.conf ]; then
    sed -i '/^[ 	]*GRUB_CMDLINE_LINUX_DEFAULT.*/s/rd.convertfs//' /etc/default/grub || :
    [ -f /etc/dracut.conf.d/05-convertfs.conf ] && sed -i '/add_dracutmodules+="[ 	]*convertfs[ 	]*"/d' /etc/dracut.conf.d/05-convertfs.conf || :
    [ -s /etc/dracut.conf.d/05-convertfs.conf ] || rm -f /etc/dracut.conf.d/05-convertfs.conf || :
    [ -d /var/lock.lockmove~ ] && rm -rf /var/lock.lockmove~ || :
    [ -d /var/run.runmove~ ] && rm -rf /var/run.runmove~ || :
fi
%{?regenerate_initrd_post}

%post fips
%{?regenerate_initrd_post}

%post ima
%{?regenerate_initrd_post}

%postun
%{?regenerate_initrd_post}

%postun fips
%{?regenerate_initrd_post}

%postun ima
%{?regenerate_initrd_post}

%posttrans
%{?regenerate_initrd_posttrans}

%posttrans fips
%{?regenerate_initrd_posttrans}

%posttrans ima
%{?regenerate_initrd_posttrans}

%files fips
%license COPYING
%config %{_sysconfdir}/dracut.conf.d/40-fips.conf
%{dracutlibdir}/modules.d/01fips

%files ima
%license COPYING
%config %{_sysconfdir}/dracut.conf.d/40-ima.conf
%{dracutlibdir}/modules.d/96securityfs
%{dracutlibdir}/modules.d/97masterkey
%{dracutlibdir}/modules.d/98integrity

%files tools
%{_bindir}/dracut-catimages
%{_mandir}/man8/dracut-catimages.8*
%dir /boot/dracut
%dir %{_localstatedir}/lib/dracut
%dir %{_localstatedir}/lib/dracut/overlay

%files extra
%license COPYING

%{dracutlibdir}/modules.d/00mksh
%{dracutlibdir}/modules.d/02caps
%{dracutlibdir}/modules.d/00dash
%{dracutlibdir}/modules.d/05busybox
%{dracutlibdir}/modules.d/50gensplash
%{dracutlibdir}/modules.d/90ppcmac

# RH-specific s390 modules, we take another approach
%{dracutlibdir}/modules.d/95dasd
%{dracutlibdir}/modules.d/95zfcp
%{dracutlibdir}/modules.d/95znet

%files mkinitrd-deprecated
%{dracut_sbindir}/mkinitrd
%{_mandir}/man8/mkinitrd.8*

%files
%license COPYING
%doc README.md NEWS.md AUTHORS dracut.html
%doc docs/README.cross docs/README.generic docs/README.kernel
%doc docs/HACKING.md docs/dracut.png docs/dracut.svg
%{_bindir}/dracut
%{_bindir}/lsinitrd
%{_datarootdir}/bash-completion/completions/lsinitrd
%{_datadir}/pkgconfig/dracut.pc

%config(noreplace) %{_sysconfdir}/dracut.conf
%dir %{_sysconfdir}/dracut.conf.d
%dir /usr/lib/dracut/dracut.conf.d
%config %{_sysconfdir}/dracut.conf.d/99-debug.conf
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
/usr/lib/dracut/dracut.conf.d/01-dist.conf
%endif
%ifarch s390 s390x
%config %{_sysconfdir}/dracut.conf.d/10-s390x_persistent_device.conf
%endif

%{_mandir}/man8/dracut.8*
%{_mandir}/man1/lsinitrd.1*
%{_mandir}/man7/dracut.kernel.7*
%{_mandir}/man7/dracut.cmdline.7*
%{_mandir}/man7/dracut.bootup.7*
%{_mandir}/man7/dracut.modules.7*
%{_mandir}/man8/dracut-cmdline.service.8*
%{_mandir}/man8/dracut-initqueue.service.8*
%{_mandir}/man8/dracut-pre-pivot.service.8*
%{_mandir}/man8/dracut-pre-trigger.service.8*
%{_mandir}/man8/dracut-pre-udev.service.8*
%{_mandir}/man8/dracut-mount.service.8.*
%{_mandir}/man8/dracut-pre-mount.service.8.*
%{_mandir}/man8/dracut-shutdown.service.8.*
%{_mandir}/man5/dracut.conf.5*

%dir %{_prefix}/lib/kernel
%dir %{_prefix}/lib/kernel/install.d
%{_prefix}/lib/kernel/install.d/50-dracut.install
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install

%dir %{dracutlibdir}
%{dracutlibdir}/skipcpio
%{dracutlibdir}/dracut-functions.sh
%{dracutlibdir}/dracut-init.sh
%{dracutlibdir}/dracut-functions
%{dracutlibdir}/dracut-version.sh
%{dracutlibdir}/dracut-logger.sh
%{dracutlibdir}/dracut-initramfs-restore
%{dracutlibdir}/dracut-install
%{dracutlibdir}/dracut-util
%{dracutlibdir}/dracut-getarg
%{dracutlibdir}/dracut-cpio

%dir %{dracutlibdir}/modules.d
%{dracutlibdir}/modules.d/00bash
%{dracutlibdir}/modules.d/00systemd
%{dracutlibdir}/modules.d/00systemd-network-management
%{dracutlibdir}/modules.d/00warpclock
%{dracutlibdir}/modules.d/01systemd-ac-power
%{dracutlibdir}/modules.d/01systemd-ask-password
%{dracutlibdir}/modules.d/01systemd-coredump
%{dracutlibdir}/modules.d/01systemd-hostnamed
%{dracutlibdir}/modules.d/01systemd-initrd
%{dracutlibdir}/modules.d/01systemd-journald
%{dracutlibdir}/modules.d/01systemd-ldconfig
%{dracutlibdir}/modules.d/01systemd-modules-load
%{dracutlibdir}/modules.d/01systemd-networkd
%{dracutlibdir}/modules.d/01systemd-repart
%{dracutlibdir}/modules.d/01systemd-resolved
%{dracutlibdir}/modules.d/01systemd-rfkill
%{dracutlibdir}/modules.d/01systemd-sysctl
%{dracutlibdir}/modules.d/01systemd-sysext
%{dracutlibdir}/modules.d/01systemd-sysusers
%{dracutlibdir}/modules.d/01systemd-timedated
%{dracutlibdir}/modules.d/01systemd-timesyncd
%{dracutlibdir}/modules.d/01systemd-tmpfiles
%{dracutlibdir}/modules.d/01systemd-udevd
%{dracutlibdir}/modules.d/01systemd-veritysetup

%{dracutlibdir}/modules.d/03modsign
%{dracutlibdir}/modules.d/03rescue
%{dracutlibdir}/modules.d/04watchdog
%{dracutlibdir}/modules.d/04watchdog-modules
%{dracutlibdir}/modules.d/06dbus-broker
%{dracutlibdir}/modules.d/06dbus-daemon
%{dracutlibdir}/modules.d/06rngd
%{dracutlibdir}/modules.d/09dbus
%{dracutlibdir}/modules.d/10i18n
%{dracutlibdir}/modules.d/30convertfs
%{dracutlibdir}/modules.d/35network-legacy
%{dracutlibdir}/modules.d/35network-manager
%{dracutlibdir}/modules.d/35network-wicked
%{dracutlibdir}/modules.d/40network
%{dracutlibdir}/modules.d/45ifcfg
%{dracutlibdir}/modules.d/45url-lib
%{dracutlibdir}/modules.d/50drm
%{dracutlibdir}/modules.d/50plymouth
%{dracutlibdir}/modules.d/62bluetooth
%{dracutlibdir}/modules.d/80cms
%{dracutlibdir}/modules.d/80lvmmerge
%{dracutlibdir}/modules.d/81cio_ignore
%{dracutlibdir}/modules.d/90btrfs
%{dracutlibdir}/modules.d/90crypt
%{dracutlibdir}/modules.d/90dm
%{dracutlibdir}/modules.d/90dmraid
%{dracutlibdir}/modules.d/90dmsquash-live
%{dracutlibdir}/modules.d/90dmsquash-live-ntfs
%{dracutlibdir}/modules.d/90kernel-modules-extra
%{dracutlibdir}/modules.d/90kernel-modules
%{dracutlibdir}/modules.d/90kernel-network-modules
%{dracutlibdir}/modules.d/90livenet
%{dracutlibdir}/modules.d/90lvm
%{dracutlibdir}/modules.d/90mdraid
%{dracutlibdir}/modules.d/90multipath
%{dracutlibdir}/modules.d/90nvdimm
%{dracutlibdir}/modules.d/90qemu
%{dracutlibdir}/modules.d/90qemu-net
%{dracutlibdir}/modules.d/91crypt-gpg
%{dracutlibdir}/modules.d/91crypt-loop
%{dracutlibdir}/modules.d/91fido2
%{dracutlibdir}/modules.d/91tpm2-tss
%{dracutlibdir}/modules.d/91zipl
%{dracutlibdir}/modules.d/95cifs
%{dracutlibdir}/modules.d/95dasd_mod
%{dracutlibdir}/modules.d/95dasd_rules
%{dracutlibdir}/modules.d/95dcssblk
%{dracutlibdir}/modules.d/95debug
%{dracutlibdir}/modules.d/95fcoe
%{dracutlibdir}/modules.d/95fcoe-uefi
%{dracutlibdir}/modules.d/95fstab-sys
%{dracutlibdir}/modules.d/95iscsi
%{dracutlibdir}/modules.d/95lunmask
%{dracutlibdir}/modules.d/95nbd
%{dracutlibdir}/modules.d/95nfs
%{dracutlibdir}/modules.d/95nvmf
%{dracutlibdir}/modules.d/95qeth_rules
%{dracutlibdir}/modules.d/95resume
%{dracutlibdir}/modules.d/95rootfs-block
%{dracutlibdir}/modules.d/95ssh-client
%{dracutlibdir}/modules.d/95terminfo
%{dracutlibdir}/modules.d/95udev-rules
%{dracutlibdir}/modules.d/95virtfs
%{dracutlibdir}/modules.d/95zfcp_rules
%{dracutlibdir}/modules.d/97biosdevname
%{dracutlibdir}/modules.d/98dracut-systemd
%{dracutlibdir}/modules.d/98ecryptfs
%{dracutlibdir}/modules.d/98pollcdrom
%{dracutlibdir}/modules.d/98selinux
%{dracutlibdir}/modules.d/98syslog
%{dracutlibdir}/modules.d/98usrmount
%{dracutlibdir}/modules.d/99base
%{dracutlibdir}/modules.d/99fs-lib
%{dracutlibdir}/modules.d/99img-lib
%{dracutlibdir}/modules.d/99memstrack
%{dracutlibdir}/modules.d/99shutdown
%{dracutlibdir}/modules.d/99squash
%{dracutlibdir}/modules.d/99suse
%{dracutlibdir}/modules.d/99suse-initrd
%{dracutlibdir}/modules.d/99uefi-lib
%attr(0640,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
%dir %{_unitdir}/initrd.target.wants
%dir %{_unitdir}/sysinit.target.wants
%{_unitdir}/*.service
%{_unitdir}/*/*.service
%{_datarootdir}/bash-completion/completions/dracut

%changelog
0707010000024F000081A400000000000000000000000164DF2CB800000C2A000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/suse/mkinitrd-suse.8.asc    MKINITRD(8)
===========
:doctype: manpage
:man source:   dracut
:man manual:   dracut

NAME
----
mkinitrd-suse - is a compat wrapper, which calls dracut to generate an initramfs

SYNOPSIS
--------
*mkinitrd* ['OPTION...']

DESCRIPTION
-----------
*mkinitrd* creates an initramfs image <initrd-image> for the kernel with
version <kernel-version> by calling *dracut*.

[IMPORTANT]
This version of mkinitrd is provided for compatibility with older
versions of mkinitrd. If a more fine grained control over the
resulting image is needed, *dracut* should be called directly.

OPTIONS
-------
**-R, --version**::
    print info about the version

**-k** _<kernel_list>_::
    List of kernel images for which initrd files are created (relative
    to _boot_dir_), Image name should begin with the following string,
    defaults to _vmlinux_ on ppc/ppc64, _image_ on s390/s390x and _vmlinuz_
    for everything else.

**-i** _<initrd_list>_::
    List of file names (relative to _boot_dir_) for the initrd; positions
    have to match the _kernel_list_. Defaults to _initrd_.

**-m** _<module_list>_::
    Modules to include in initrd, defaults to the settings in the
    dracut kernel-modules module.

**-f** _<feature_list>_::
    Features to be enabled for the initrd. In general mkinitrd
    configures the initrd for the root device it is started from. With
    this option additional feature can be enabled.

**-b** _<bootdir>_::
    Boot directory, defaults to */boot*, where the initrd is created.

**-d** _<root_device>_::
    Root device, defaults to the device from which the root_dir is
    mounted; overwrites the rootdev environment variable if set

**-s** _<size>_::
    Add splash animation and bootscreen to initrd.

**-D** _<interface>::
    Run dhcp on the specified interface (for example "eth0").

**-I** _<interface>::
    Configure the specified interface statically.

**-a** _<acpi_dsdt>::
    Attach compiled ACPI DSDT (Differentiated System Description Table)
    to initrd. This replaces the DSDT of the BIOS. Defaults to the
    _ACPI_DSDT_ variable in */etc/sysconfig/kernel*.

**-M** _<map>::
    System.map file to use.

**-B**::
    Don’t run the *update-bootloader(8)* script after the initrd(s) have
    been created. This is useful if you call mkinitrd(8) for anything
    else than the running system.

**-A**::
    Create a so called "monster initrd" which includes all available
    features and modules. This calls dracut with --no-hostonly and
    --no-hostonly-cmdline parameters internally, instead of the default
    --hostonly and --hostonly-cmdline.

**-v, --verbose**::
    increase verbosity level

**-L**::
    Disable logging to _/var/log/YaST2/mkinitrd.log_. This is useful for
    testing if you don’t want to clutter the system log.

**--help**::
    print a help message and exit.

AVAILABILITY
------------
The mkinitrd command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]

AUTHORS
-------
Harald Hoyer, Hannes Reinecke

SEE ALSO
--------
*dracut*(8)
*update-bootloader*(8)
  07070100000250000081ED00000000000000000000000164DF2CB8000032F9000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/suse/mkinitrd-suse.sh   #!/bin/bash --norc
#
# mkinitrd compatibility wrapper for SUSE.
#
# Copyright (c) 2013 SUSE Linux Products GmbH. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

boot_dir="/boot"
quiet=0
logfile=/var/log/YaST2/mkinitrd.log
dracut_cmd=dracut

error() { echo "$@" >&2; }

usage () {
    [[ $1 = '-n' ]] && cmd=echo || cmd=error

    $cmd "usage: ${0##*/} [options]"
    $cmd ""
    $cmd "	Create initial ramdisk images that contain all kernel modules needed"
    $cmd "	in the early boot process, before the root file system becomes"
    $cmd "	available."
    $cmd "	This usually includes SCSI and/or RAID modules, a file system module"
    $cmd "	for the root file system, or a network interface driver module for dhcp."
    $cmd ""
    $cmd "	options:"
    $cmd "	-f \"feature list\"	Features to be enabled when generating initrd."
    $cmd "				Available features are:"
    $cmd "					iscsi, md, multipath, lvm, lvm2,"
    $cmd "					ifup, fcoe, dcbd"
    $cmd "	-k \"kernel list\"	List of kernel images for which initrd files are"
    $cmd "				created. Defaults to all kernels found in /boot."
    $cmd "	-i \"initrd list\"	List of file names for the initrd; position have"
    $cmd "				match to \"kernel list\". Defaults to all kernels"
    $cmd "				found in /boot."
    $cmd "	-b boot_dir		Boot directory. Defaults to /boot."
    $cmd "	-t tmp_dir		Temporary directory. Defaults to /var/tmp."
    $cmd "	-M map			System.map file to use."
    $cmd "	-A			Create a so called \"monster initrd\" which"
    $cmd "				includes all features and modules possible."
    $cmd "	-B			Do not update bootloader configuration."
    $cmd "	-v			Verbose mode."
    $cmd "	-L			Disable logging."
    $cmd "	-h			This help screen."
    $cmd "	-m \"module list\"	Modules to include in initrd. Defaults to the"
    $cmd "				settings in the dracut kernel-modules module"
    $cmd "	-u \"DomU module list\"	Modules to include in initrd. Defaults to the"
    $cmd "				settings in the dracut kernel-modules module"
    $cmd "	-d root_device		Root device. Defaults to the device from"
    $cmd "				which / is mounted. Overrides the rootdev"
    $cmd "				environment variable if set."
    $cmd "	-j device		Journal device"
    $cmd "	-D interface		Run dhcp on the specified interface."
    $cmd "	-I interface		Configure the specified interface statically."
    $cmd "	-a acpi_dsdt		Obsolete, do not use."
    $cmd "	-s size			Add splash animation and bootscreen to initrd."

    [[ $1 = '-n' ]] && exit 0
    exit 1
}

# Little helper function for reading args from the commandline.
# it automatically handles -a b and -a=b variants, and returns 1 if
# we need to shift $3.
read_arg() {
    # $1 = arg name
    # $2 = arg value
    # $3 = arg parameter
    param="$1"
    local rematch='^[^=]*=(.*)$' result
    if [[ $2 =~ $rematch ]]; then
        read "$param" <<< "${BASH_REMATCH[1]}"
    else
	for ((i=3; $i <= $#; i++)); do
            # Only read next arg if it not an arg itself.
            if [[ ${*:$i:1} = -* ]];then
		break
            fi
            result="$result ${@:$i:1}"
            # There is no way to shift our callers args, so
            # return "no of args" to indicate they should do it instead.
	done
	read "$1" <<< "$result"
        return $(($i - 3))
    fi
}

# Helper functions to calculate ipconfig command line
calc_netmask() {
    local prefix=$1

    [ -z "$prefix" ] && return
    mask=$(( 0xffffffff << (32 - $prefix) ))
    byte1=$(( mask >> 24 ))
    byte2=$(( mask >> 16 ))
    byte3=$(( mask >> 8 ))
    byte4=$(( mask & 0xff ))
    netmask=$(printf "%d.%d.%d.%d" $(( byte1 & 0xff )) $(( byte2 & 0xff )) $(( byte3 & 0xff )) $byte4);

    echo $netmask
}

ipconfig() {
    local interface=$1
    local iplink macaddr broadcast gateway ipaddr prefix netmask

    iplink=$(ip addr show dev $interface | sed -n 's/ *inet \(.*\) brd.*/\1/p')
    macaddr=$(ip addr show dev $interface | sed -n 's/.*ether \(.*\) brd.*/\1/p')
    broadcast=$(ip addr show dev $interface | sed -n 's/.*brd \(.*\) scope.*/\1/p')
    gateway=$(ip route show dev $interface | sed -n 's/default via \([0-9\.]*\).*/\1/p')

    ipaddr=${iplink%%/*}
    prefix=${iplink##*/}
    netmask=$(calc_netmask $prefix)

    echo "${ipaddr}:${serveraddr}:${gateway}:${netmask}:${hostname}:${interface}:none::${macaddr}"
}

is_xen_kernel() {
    local kversion=$1
    local root_dir=$2
    local cfg

    for cfg in ${root_dir}/boot/config-$kversion $root_dir/lib/modules/$kversion/build/.config
    do
        test -r $cfg || continue
        grep -q "^CONFIG_XEN=y\$" $cfg
        return
    done
    test $kversion != "${kversion%-xen*}"
    return
}

kernel_version_from_image() {
    local dir="${1%/*}/"
    [[ "$dir" != "$1" ]] || dir=""
    local kernel_image="$1" kernel_image_gz="${dir}vmlinux-${1#*-}.gz"
    echo kernel_image_gz="'$kernel_image_gz'" >&2

    if get_kernel_version "$kernel_image" 2>/dev/null; then
        return
    fi

    # As a last resort, try vmlinux-$version.gz, which might be around
    get_kernel_version "$kernel_image_gz" 2>/dev/null
}

# Taken over from SUSE mkinitrd
default_kernel_images() {
    local regex kernel_image kernel_version version_version initrd_image
    local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'

    case "${DRACUT_ARCH:-$(uname -m)}" in
        s390|s390x)
            regex='image'
            ;;
        ppc|ppc64)
            regex='vmlinux'
            ;;
        i?86|x86_64)
            regex='vmlinuz'
            ;;
        arm*)
            regex='[uz]Image'
            ;;
        aarch64|riscv64)
            regex='Image'
            ;;
        *)  regex='vmlinu.'
            ;;
    esac

    kernel_images=""
    initrd_images=""
    for kernel_image in $(ls $boot_dir \
            | sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
            | grep -v kdump$ ) ; do

        # Note that we cannot check the RPM database here -- this
        # script is itself called from within the binary kernel
        # packages, and rpm does not allow recursive calls.

        if [ -L "$boot_dir/$kernel_image" ]; then
            # check for usrmerged kernel. in That case the link point to
            # /usr/lib/modules
            link=$(readlink "$boot_dir/$kernel_image")
            [ "${link#/usr/lib/modules}" = "$link" ] && \
                [ "${link#../usr/lib/modules}" = "$link" ] && continue
        fi
        [ "${kernel_image%%.gz}" != "$kernel_image" ] && continue

        kernel_version=$(kernel_version_from_image \
                         $boot_dir/$kernel_image 2> /dev/null)
        initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
        if [ "$kernel_image" != "$initrd_image" -a \
             -n "$kernel_version" -a \
             -d "/lib/modules/$kernel_version" ]; then
                kernel_images="$kernel_images $boot_dir/$kernel_image"
                initrd_images="$initrd_images $boot_dir/$initrd_image"
        fi
    done
    for kernel_image in $kernel_images;do
	kernels="$kernels ${kernel_image#*-}"
    done
    for initrd_image in $initrd_images;do
	targets="$targets $initrd_image"
    done
}

while (($# > 0)); do
    case ${1%%=*} in
	-f) read_arg feature_list "$@" || shift $?
	    echo "Obsolete -f param, use add_dracutmodules+= variable in /etc/dracut.conf.d/"
	    exit 1
	    # Could be several features
	    ;;
	-k) # Would be nice to get a list of images here
	    read_arg kernel_images "$@" || shift $?
	    for kernel_image in $kernel_images;do
		[ -L "/boot/$kernel_image" ] && kernel_image="$(readlink "/boot/$kernel_image")"
		kernels="$kernels ${kernel_image#*-}"
	    done
	    ;;
	-i) read_arg initrd_images "$@" || shift $?
	    for initrd_image in $initrd_images;do
		[ -L "/boot/$initrd_image" ] && initrd_image="$(readlink "/boot/$initrd_image")"
		# Check if the initrd_image contains a path.
		# if not, then add the default boot_dir
		dname=`dirname $initrd_image`
		if [ "$dname" == "." ]; then
                    targets="$targets $boot_dir/$initrd_image";
		else
                    targets="$targets $initrd_image";
		fi
	    done
	    ;;
	-b) read_arg boot_dir "$@" || shift $?
	    if [ ! -d $boot_dir ];then
		error "Boot directory $boot_dir does not exist"
		exit 1
	    fi
	    ;;
	-t) read_arg tmp_dir "$@" || shift $?
	    dracut_args="${dracut_args} --tmpdir $tmp_dir"
	    ;;
	-M) read_arg map_file "$@" || shift $?
	    ;;
	-A) dracut_args="${dracut_args} --no-host-only";;
	-B) skip_update_bootloader=1;;
        -v|--verbose) dracut_args="${dracut_args} -v";;
	-L) logfile=;;
        -h|--help) usage -n;;
	-m) read_arg module_list "$@" || shift $? ;;
	-u) read_arg domu_module_list "$@" || shift $?
	    echo "mkinitrd: DomU modules not yet supported" ;;
        -d) read_arg rootfs "$@" || shift $?
            dracut_args="${dracut_args} --filesystems $rootfs" ;;
	-D) read_arg dhcp_if "$@" || shift $?
	    dracut_cmdline="${dracut_cmdline} ip=${dhcp_if}:dhcp"
	    ;;
	-I) read_arg static_if "$@" || shift $?
	    dracut_cmdline="${dracut_cmdline} ip=$(ipconfig $static_if)":
	    ;;
	-a) read_arg acpi_dsdt "$@" || shift $?
	    echo "Obsolete -a param, use acpi_table_dir= and acpi_override= variables in /etc/dracut.conf.d/"
	    exit 1
	    ;;
	-s) read_arg boot_splash "$@" || shift $?
	    echo "mkinitrd: boot splash not yet supported"
	    exit 1
	    ;;
	-V) echo "mkinitrd: vendor scipts are no longer supported"
	    exit 1;;
	--dracut)
	    read_arg dracut_cmd "$@" || shift $? ;;
        --version|-R)
            echo "mkinitrd: dracut compatibility wrapper"
            exit 0;;
	--quiet|-q) quiet=1;;
        *)  if [[ ! $targets ]]; then
            targets=$1
            elif [[ ! $kernels ]]; then
            kernels=$1
            else
            usage
            fi;;
    esac
    shift
done

[[ $targets && $kernels ]] || default_kernel_images
if [[ ! $targets || ! $kernels ]];then
    error "No kernel found in $boot_dir or bad modules dir in /lib/modules"
    exit 1
fi

# We can have several targets/kernels, transform the list to an array
targets=( $targets )
[[ $kernels ]] && kernels=( $kernels )

[[ $logfile ]]        && dracut_args="${dracut_args} --logfile $logfile"
dracut_args="${dracut_args} --force"

[[ $dracut_cmdline ]] && dracut_args="${dracut_args} --kernel-cmdline ${dracut_cmdline}"
[ -z "$(type -p update-bootloader)" ] && skip_update_bootloader=1

# Update defaults from /etc/sysconfig/kernel
if [ -f /etc/sysconfig/kernel ] ; then
    . /etc/sysconfig/kernel
fi
[[ $module_list ]] || module_list=""
[[ $domu_module_list ]] || domu_module_list=""
shopt -s extglob

failed=""

for ((i=0 ; $i<${#targets[@]} ; i++)); do

    if [[ $img_vers ]];then
	target="${targets[$i]}-${kernels[$i]}"
    else
	target="${targets[$i]}"
    fi
    kernel="${kernels[$i]}"

    if is_xen_kernel $kernel $rootfs ; then
	modules_all="${module_list} ${domu_module_list}"
    else
        modules_all="${module_list}"
    fi

    # Remove leading and trailing spaces needs (set above): shopt -s extglob
    modules_all=${modules_all%%+([[:space:]])}
    modules_all=${modules_all##+([[:space:]])}

    echo "Creating initrd: $target"

    # Duplicate code: No way found how to redirect output based on $quiet
    if [[ $quiet == 1 ]];then
        # Duplicate code: --force-drivers must not be called with empty string
        # -> dracut bug workarounded ugly, because of complex whitespace
        # expansion magics
        if [ -n "${modules_all}" ];then
            $dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel" &>/dev/null
            [ $? -ne 0 ] && failed="$failed $target"
        else
            $dracut_cmd $dracut_args "$target" "$kernel" &>/dev/null
            [ $? -ne 0 ] && failed="$failed $target"
        fi
    else
        if [ -n "${modules_all}" ];then
            $dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel"
            [ $? -ne 0 ] && failed="$failed $target"
        else
            $dracut_cmd $dracut_args "$target" "$kernel"
            [ $? -ne 0 ] && failed="$failed $target"
        fi
    fi
done

if [ "$skip_update_bootloader" ] ; then
    echo 2>&1 "Did not refresh the bootloader. You might need to refresh it manually."
else
    update-bootloader --refresh
    [ $? -ne 0 ] && echo "Updating bootloader failed" && exit 1
fi

if [ "$failed" != "" ]; then
    echo "Generating $failed targets failed"
    exit 1
fi

exit 0
   07070100000251000081A400000000000000000000000164DF2CB8000001C8000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/suse/s390x_persistent_device.conf   # Set persistent policy by-path on s390 platforms, to prevent
# the system from hanging during the boot when vDISKs are used
# as swap devices (bsc#915218).
#
# Indeed, they are required to be present early in the boot
# process to possibly resume the system. However, since
# they are cleared after logoff/logon and the UUID will likely
# change after reinitialization, these will not be found with
# the default by-uuid policy.
persistent_policy=by-path
07070100000252000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002300000000dracut-055+suse.347.gdcb9bdbf/test    07070100000253000081A400000000000000000000000164DF2CB800000286000000000000000000000000000000000000002C00000000dracut-055+suse.347.gdcb9bdbf/test/Makefile   .PHONY: all check clean $(wildcard TEST-??-*)

$(wildcard TEST-??-*):
	@[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; }
	@{ \
		[ -d $@ ] || exit 0; \
		[ -f $@/Makefile ] || exit 0; \
		if [ -n "$$TESTS" ]; then t=$${$@##TEST-}; t=$${t%%-*}; [ "$${TESTS#*$$t*}" != "$$TESTS" ] || exit 0; fi; \
		if [ -n "$$SKIP" ]; then t=$${$@##TEST-}; t=$${t%%-*}; [ "$${SKIP#*$$t*}" != "$$SKIP" ] && exit 0; fi; \
		$(MAKE) -C $@ all ; \
	}

check: $(wildcard TEST-??-*)

clean:
	@for i in TEST-[0-9]*; do \
		[ -d $$i ] || continue ; \
		[ -f $$i/Makefile ] || continue ; \
		$(MAKE) -C $$i clean ; \
	done

all:

  07070100000254000081A400000000000000000000000164DF2CB8000001BB000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/test/Makefile.testdir   .PHONY: all setup clean run

all:
	@$(MAKE) -s --no-print-directory -C ../.. all
	@V=$(V) basedir="$(realpath ../..)" testdir="$(realpath ../)" ./test.sh --all
setup:
	@$(MAKE) --no-print-directory -C ../.. all
	@basedir="$(realpath ../..)" testdir="$(realpath ../)" ./test.sh --setup
clean:
	@basedir="$(realpath ../..)" testdir="$(realpath ../)" ./test.sh --clean
run:
	@basedir="$(realpath ../..)" testdir="$(realpath ../)" ./test.sh --run
 07070100000255000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-01-BASIC  07070100000256000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-01-BASIC/Makefile -include ../Makefile.testdir
   07070100000257000081ED00000000000000000000000164DF2CB80000021F000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-01-BASIC/create-root.sh   #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
udevadm settle

set -ex

mkfs.ext3 -L '  rdinit=/bin/sh' /dev/disk/by-id/ata-disk_root
mkdir -p /root
mount /dev/disk/by-id/ata-disk_root /root
cp -a -t /root /source/*
mkdir -p /root/run
umount /root
echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
poweroff -f
 07070100000258000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/test/TEST-01-BASIC/finished-false.sh    #!/bin/sh
exit 1
   07070100000259000081ED00000000000000000000000164DF2CB800000052000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-01-BASIC/hard-off.sh  #!/bin/sh
getargbool 0 rd.shell || poweroff -f
getargbool 0 failme && poweroff -f
  0707010000025A000081ED00000000000000000000000164DF2CB800000279000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-01-BASIC/test-init.sh #!/bin/sh
: > /dev/watchdog

. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker

export TERM=linux
export PS1='initramfs-test:\w\$ '
[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
if getargbool 0 rd.shell; then
    strstr "$(setsid --help)" "control" && CTTY="-c"
    setsid $CTTY sh -i
fi
echo "Powering down."
mount -n -o remount,ro /
poweroff -f
   0707010000025B000081ED00000000000000000000000164DF2CB800001413000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/test/TEST-01-BASIC/test.sh  #!/bin/bash
# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem on a ext3 filesystem"

KVERSION=${KVERSION-$(uname -r)}

# Uncomment this to debug failures
# DEBUGFAIL="rd.shell rd.break"

test_run() {
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -watchdog i6300esb -watchdog-action poweroff \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot \"root=LABEL=  rdinit=/bin/sh\" rw systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.debug console=ttyS0,115200n81 rd.shell=0 $DEBUGFAIL" \
        -initrd "$TESTDIR"/initramfs.testing || return 1

    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success "$TESTDIR"/marker.img
}

test_setup() {
    kernel=$KVERSION
    # Create what will eventually be our root filesystem onto an overlay
    (
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        mkdir -p "$initdir"
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        (
            cd "$initdir" || exit
            mkdir -p -- dev sys proc etc var/run tmp
            mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
        )
        inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
            mount dmesg dhclient mkdir cp ping dhclient \
            umount strace less setsid dd sync
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux
        inst "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
        inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst_multiple grep
        inst_simple /etc/os-release
        inst ./test-init.sh /sbin/init
        find_binary plymouth > /dev/null && inst_multiple plymouth
        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mkfs.ext3 poweroff cp umount sync dd
        inst_hook initqueue 01 ./create-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
        --nomdadmconf \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/overlay

    dd if=/dev/zero of="$TESTDIR"/root.img bs=1MiB count=80
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root

    # Invoke KVM and/or QEMU to actually create the target filesystem.
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1
    rm -- "$TESTDIR"/marker.img

    (
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown dd
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook emergency 000 ./hard-off.sh
    )
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -a "debug watchdog" \
        -d "piix ide-gd_mod ata_piix ext3 sd_mod i6300esb ib700wdt" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1

    #       -o "plymouth network md dmraid multipath fips caps crypt btrfs resume dmsquash-live dm"
}

test_cleanup() {
    return 0
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
 0707010000025C000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003300000000dracut-055+suse.347.gdcb9bdbf/test/TEST-02-SYSTEMD    0707010000025D000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-02-SYSTEMD/Makefile   -include ../Makefile.testdir
   0707010000025E000081ED00000000000000000000000164DF2CB800000211000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/test/TEST-02-SYSTEMD/create-root.sh #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
set -e

udevadm settle
mkfs.ext3 -L dracut /dev/disk/by-id/ata-disk_root
mkdir -p /root
mount /dev/disk/by-id/ata-disk_root /root
cp -a -t /root /source/*
mkdir -p /root/run
umount /root
echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
poweroff -f
   0707010000025F000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/test/TEST-02-SYSTEMD/finished-false.sh  #!/bin/sh
exit 1
   07070100000260000081ED00000000000000000000000164DF2CB800000052000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-02-SYSTEMD/hard-off.sh    #!/bin/sh
getargbool 0 rd.shell || poweroff -f
getargbool 0 failme && poweroff -f
  07070100000261000081ED00000000000000000000000164DF2CB800000151000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/test/TEST-02-SYSTEMD/systemd-analyze.sh #!/bin/bash

cp /usr/bin/true /usr/bin/man

for i in \
    sysinit.target \
    basic.target \
    initrd-fs.target \
    initrd.target \
    initrd-switch-root.target \
    emergency.target \
    shutdown.target; do
    if ! systemd-analyze verify "$i"; then
        warn "systemd-analyze verify $i failed"
        poweroff
    fi
done
   07070100000262000081ED00000000000000000000000164DF2CB800000279000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-02-SYSTEMD/test-init.sh   #!/bin/sh
: > /dev/watchdog

. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker

export TERM=linux
export PS1='initramfs-test:\w\$ '
[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
if getargbool 0 rd.shell; then
    strstr "$(setsid --help)" "control" && CTTY="-c"
    setsid $CTTY sh -i
fi
echo "Powering down."
mount -n -o remount,ro /
poweroff -f
   07070100000263000081ED00000000000000000000000164DF2CB80000147F000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-02-SYSTEMD/test.sh    #!/bin/bash
# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem on a ext3 filesystem"

KVERSION="${KVERSION-$(uname -r)}"

# Uncomment this to debug failures
#DEBUGFAIL="rd.shell=1 rd.break=pre-mount"
test_run() {
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut rw loglevel=77 systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.shell=0 $DEBUGFAIL" \
        -initrd "$TESTDIR"/initramfs.testing || return 1

    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success "$TESTDIR"/marker.img
}

test_setup() {
    kernel=$KVERSION
    # Create what will eventually be our root filesystem onto an overlay
    (
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        mkdir -p "$initdir"
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        (
            cd "$initdir" || exit
            mkdir -p -- dev sys proc etc var/run tmp
            mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
            mkdir -p -- var/lib/nfs/rpc_pipefs
        )
        inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
            mount dmesg dhclient mkdir cp ping dhclient \
            umount strace less setsid systemd-analyze dd sync
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux
        inst "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
        inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst_multiple grep
        inst_simple /etc/os-release
        inst ./test-init.sh /sbin/init
        find_binary plymouth > /dev/null && inst_multiple plymouth
        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mkfs.ext3 poweroff cp umount dd
        inst_hook initqueue 01 ./create-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "dash udev-rules base rootfs-block fs-lib kernel-modules qemu" \
        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
        --nomdadmconf \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/overlay

    dd if=/dev/zero of="$TESTDIR"/root.img bs=1MiB count=80
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root

    # Invoke KVM and/or QEMU to actually create the target filesystem.
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/fakeroot rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1
    rm -- "$TESTDIR"/marker.img

    (
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown dd
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook pre-pivot 000 ./systemd-analyze.sh
        inst_hook emergency 000 ./hard-off.sh
    )
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -a "debug systemd" \
        -o "network kernel-network-modules" \
        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1

    #       -o "plymouth network md dmraid multipath fips caps crypt btrfs resume dmsquash-live dm"
}

test_cleanup() {
    return 0
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
 07070100000264000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003500000000dracut-055+suse.347.gdcb9bdbf/test/TEST-03-USR-MOUNT  07070100000265000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-03-USR-MOUNT/Makefile -include ../Makefile.testdir
   07070100000266000081ED00000000000000000000000164DF2CB8000003E7000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/test/TEST-03-USR-MOUNT/create-root.sh   #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
set -e

udevadm settle
modprobe btrfs || :
mkfs.btrfs -L dracut /dev/disk/by-id/ata-disk_root
mkfs.btrfs -L dracutusr /dev/disk/by-id/ata-disk_usr
btrfs device scan /dev/disk/by-id/ata-disk_root
btrfs device scan /dev/disk/by-id/ata-disk_usr
mkdir -p /root
mount -t btrfs /dev/disk/by-id/ata-disk_root /root
[ -d /root/usr ] || mkdir -p /root/usr
mount -t btrfs /dev/disk/by-id/ata-disk_usr /root/usr
btrfs subvolume create /root/usr/usr
umount /root/usr
mount -t btrfs -o subvol=usr /dev/disk/by-id/ata-disk_usr /root/usr
cp -a -t /root /source/*
mkdir -p /root/run
btrfs filesystem sync /root/usr
btrfs filesystem sync /root
umount /root/usr
umount /root
echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
poweroff -f
 07070100000267000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-03-USR-MOUNT/finished-false.sh    #!/bin/sh
exit 1
   07070100000268000081A400000000000000000000000164DF2CB8000000A5000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-03-USR-MOUNT/fstab    /dev/disk/by-id/ata-disk_root	/                       btrfs   defaults         0 0
/dev/disk/by-id/ata-disk_usr	/usr                    btrfs   subvol=usr,ro    0 0
   07070100000269000081ED00000000000000000000000164DF2CB800000052000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-03-USR-MOUNT/hard-off.sh  #!/bin/sh
getargbool 0 rd.shell || poweroff -f
getargbool 0 failme && poweroff -f
  0707010000026A000081ED00000000000000000000000164DF2CB800000279000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/test/TEST-03-USR-MOUNT/test-init.sh #!/bin/sh
: > /dev/watchdog

. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker

export TERM=linux
export PS1='initramfs-test:\w\$ '
[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
if getargbool 0 rd.shell; then
    strstr "$(setsid --help)" "control" && CTTY="-c"
    setsid $CTTY sh -i
fi
echo "Powering down."
mount -n -o remount,ro /
poweroff -f
   0707010000026B000081ED00000000000000000000000164DF2CB800001777000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-03-USR-MOUNT/test.sh  #!/bin/bash

# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem on a btrfs filesystem with /usr subvolume"

KVERSION=${KVERSION-$(uname -r)}

# Uncomment this to debug failures
#DEBUGFAIL="rd.shell rd.break"

client_run() {
    local test_name="$1"
    shift
    local client_opts="$*"

    echo "CLIENT TEST START: $test_name"

    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.btrfs root
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/usr.btrfs usr

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -watchdog i6300esb -watchdog-action poweroff \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut $client_opts loglevel=7 rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \
        -initrd "$TESTDIR"/initramfs.testing || return 1

    if ! grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success "$TESTDIR"/marker.img; then
        echo "CLIENT TEST END: $test_name [FAILED]"
        return 1
    fi
    echo "CLIENT TEST END: $test_name [OK]"

}

test_run() {
    client_run "no option specified" || return 1
    client_run "readonly root" "ro" || return 1
    client_run "writeable root" "rw" || return 1
    return 0
}

test_setup() {
    kernel=$KVERSION
    # Create what will eventually be our root filesystem onto an overlay
    (
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        mkdir -p "$initdir"
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        (
            cd "$initdir" || exit
            mkdir -p -- dev sys proc etc var/run tmp
            mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
        )
        inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
            mount dmesg dhclient mkdir cp ping dhclient \
            umount strace less setsid dd sync
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux
        inst "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
        inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst_multiple grep df
        inst_simple ./fstab /etc/fstab
        inst_simple /etc/os-release
        inst ./test-init.sh /sbin/init
        find_binary plymouth > /dev/null && inst_multiple plymouth
        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mkfs.btrfs btrfs poweroff cp umount sync dd
        inst_hook initqueue 01 ./create-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "dash udev-rules btrfs base rootfs-block fs-lib kernel-modules qemu" \
        -d "piix ide-gd_mod ata_piix btrfs sd_mod" \
        --nomdadmconf \
        --nohardlink \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/overlay

    # Create the blank file to use as a root filesystem
    dd if=/dev/zero of="$TESTDIR"/root.btrfs bs=1MiB count=160
    dd if=/dev/zero of="$TESTDIR"/usr.btrfs bs=1MiB count=160
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.btrfs root
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/usr.btrfs usr

    # Invoke KVM and/or QEMU to actually create the target filesystem.
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/dracut/root rw rootfstype=btrfs quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1

    if ! grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img; then
        echo "Could not create root filesystem"
        return 1
    fi

    (
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown dd
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook emergency 000 ./hard-off.sh
    )
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -a "debug watchdog" \
        -o "network kernel-network-modules" \
        -d "piix ide-gd_mod ata_piix btrfs sd_mod i6300esb ib700wdt" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1

    rm -rf -- "$TESTDIR"/overlay

    #       -o "plymouth network md dmraid multipath fips caps crypt btrfs resume dmsquash-live dm"
}

test_cleanup() {
    return 0
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
 0707010000026C000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003800000000dracut-055+suse.347.gdcb9bdbf/test/TEST-04-FULL-SYSTEMD   0707010000026D000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-04-FULL-SYSTEMD/Makefile  -include ../Makefile.testdir
   0707010000026E000081ED00000000000000000000000164DF2CB8000003E7000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-04-FULL-SYSTEMD/create-root.sh    #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
set -e

udevadm settle
modprobe btrfs || :
mkfs.btrfs -L dracut /dev/disk/by-id/ata-disk_root
mkfs.btrfs -L dracutusr /dev/disk/by-id/ata-disk_usr
btrfs device scan /dev/disk/by-id/ata-disk_root
btrfs device scan /dev/disk/by-id/ata-disk_usr
mkdir -p /root
mount -t btrfs /dev/disk/by-id/ata-disk_root /root
[ -d /root/usr ] || mkdir -p /root/usr
mount -t btrfs /dev/disk/by-id/ata-disk_usr /root/usr
btrfs subvolume create /root/usr/usr
umount /root/usr
mount -t btrfs -o subvol=usr /dev/disk/by-id/ata-disk_usr /root/usr
cp -a -t /root /source/*
mkdir -p /root/run
btrfs filesystem sync /root/usr
btrfs filesystem sync /root
umount /root/usr
umount /root
echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
poweroff -f
 0707010000026F000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000004A00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-04-FULL-SYSTEMD/finished-false.sh #!/bin/sh
exit 1
   07070100000270000081A400000000000000000000000164DF2CB8000000A5000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-04-FULL-SYSTEMD/fstab /dev/disk/by-id/ata-disk_root	/                       btrfs   defaults         0 0
/dev/disk/by-id/ata-disk_usr	/usr                    btrfs   subvol=usr,ro    0 0
   07070100000271000081ED00000000000000000000000164DF2CB800000052000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/test/TEST-04-FULL-SYSTEMD/hard-off.sh   #!/bin/sh
getargbool 0 rd.shell || poweroff -f
getargbool 0 failme && poweroff -f
  07070100000272000081ED00000000000000000000000164DF2CB800000482000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/test/TEST-04-FULL-SYSTEMD/test-init.sh  #!/bin/sh
: > /dev/watchdog

. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

systemctl --failed --no-legend --no-pager > /failed

if ! ismounted /usr; then
    echo "**************************FAILED**************************"
    echo "/usr not mounted!!"
    cat /proc/mounts
    echo "**************************FAILED**************************"
else
    if [ -s /failed ]; then
        echo "**************************FAILED**************************"
        cat /failed
        echo "**************************FAILED**************************"

    else
        echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
        echo "All OK"
    fi
fi

export TERM=linux
export PS1='initramfs-test:\w\$ '
[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
if getargbool 0 rd.shell; then
    strstr "$(setsid --help)" "control" && CTTY="-c"
    setsid $CTTY sh -i
fi
echo "Powering down."
systemctl --no-block poweroff
exit 0
  07070100000273000081ED00000000000000000000000164DF2CB800002AB5000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-04-FULL-SYSTEMD/test.sh   #!/bin/bash

# shellcheck disable=SC2034
TEST_DESCRIPTION="Full systemd serialization/deserialization test with /usr mount"

export KVERSION=${KVERSION-$(uname -r)}

# Uncomment this to debug failures
#DEBUGFAIL="rd.shell rd.break"
#DEBUGFAIL="rd.shell"
#DEBUGOUT="quiet systemd.log_level=debug systemd.log_target=console loglevel=77  rd.info rd.debug"
DEBUGOUT="loglevel=0 "
client_run() {
    local test_name="$1"
    shift
    local client_opts="$*"

    echo "CLIENT TEST START: $test_name"

    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.btrfs root
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/usr.btrfs usr

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut $client_opts rd.retry=3 console=ttyS0,115200n81 selinux=0 $DEBUGOUT rd.shell=0 $DEBUGFAIL" \
        -initrd "$TESTDIR"/initramfs.testing || return 1

    if ! grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success "$TESTDIR"/marker.img; then
        echo "CLIENT TEST END: $test_name [FAILED]"
        return 1
    fi
    echo "CLIENT TEST END: $test_name [OK]"

}

test_run() {
    client_run "no option specified" || return 1
    client_run "readonly root" "ro" || return 1
    client_run "writeable root" "rw" || return 1
    return 0
}

test_setup() {
    # shellcheck disable=SC2064
    trap "$(shopt -p nullglob globstar)" RETURN
    shopt -q -s nullglob globstar

    export kernel=$KVERSION
    # Create what will eventually be our root filesystem onto an overlay
    (
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        mkdir -p "$initdir"
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh

        for d in usr/bin usr/sbin bin etc lib "$libdir" sbin tmp usr var var/log dev proc sys sysroot root run; do
            if [ -L "/$d" ]; then
                inst_symlink "/$d"
            else
                inst_dir "/$d"
            fi
        done

        ln -sfn /run "$initdir/var/run"
        ln -sfn /run/lock "$initdir/var/lock"

        inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
            mount dmesg mkdir cp ping dd \
            umount strace less setsid systemctl reset sync

        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux
        inst_multiple grep
        inst_simple ./fstab /etc/fstab
        if type -P rpm &> /dev/null; then
            rpm -ql systemd | xargs -r "$DRACUT_INSTALL" ${initdir:+-D "$initdir"} -o -a -l
        elif type -P pacman &> /dev/null; then
            pacman -Q -l systemd | while read -r _ a; do printf -- "%s\0" "$a"; done | xargs -0 -r "$DRACUT_INSTALL" ${initdir:+-D "$initdir"} -o -a -l
            rm "$initdir"/usr/lib/systemd/system/sysinit.target.wants/systemd-firstboot.service
        else
            echo "Can't install systemd base"
            return 1
        fi
        inst /sbin/init
        inst_multiple -o {,/usr}/lib/systemd/system/"dracut*"

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        # make a journal directory
        mkdir -p "$initdir"/var/log/journal

        # install some basic config files
        inst_multiple -o \
            /etc/machine-id \
            /etc/adjtime \
            /etc/passwd \
            /etc/shadow \
            /etc/group \
            /etc/shells \
            {,/usr}/etc/nsswitch.conf \
            /etc/pam.conf \
            /etc/securetty \
            /etc/os-release \
            /etc/localtime

        # we want an empty environment
        : > "$initdir"/etc/environment

        # setup the testsuite target
        mkdir -p "$initdir"/etc/systemd/system
        cat > "$initdir"/etc/systemd/system/testsuite.target << EOF
[Unit]
Description=Testsuite target
Requires=basic.target
After=basic.target
Conflicts=rescue.target
AllowIsolate=yes
EOF

        inst ./test-init.sh /sbin/test-init

        # setup the testsuite service
        cat > "$initdir"/etc/systemd/system/testsuite.service << EOF
[Unit]
Description=Testsuite service
After=basic.target

[Service]
ExecStart=/sbin/test-init
Type=oneshot
StandardInput=tty
StandardOutput=tty
EOF
        mkdir -p "$initdir"/etc/systemd/system/testsuite.target.wants
        ln -fs ../testsuite.service "$initdir"/etc/systemd/system/testsuite.target.wants/testsuite.service

        # make the testsuite the default target
        systemctl --root="$initdir" set-default testsuite.target

        # install basic tools needed
        inst_multiple sh bash setsid loadkeys setfont \
            login sulogin gzip sleep echo mount umount
        inst_multiple modprobe

        # install libnss_files for login
        inst_libdir_file "libnss_files*"

        # install dbus and pam
        inst_multiple -o \
            /etc/dbus-1/** \
            /etc/pam.d/** \
            /etc/security/** \
            /lib64/security/** \
            /lib/security/**

        # install dbus socket and service file
        inst_multiple -o \
            /usr/lib/systemd/system/dbus.socket \
            /usr/lib/systemd/system/dbus.service \
            /usr/lib/systemd/system/dbus-broker.service \
            /usr/lib/systemd/system/dbus-daemon.service

        (
            echo "FONT=eurlatgr"
            echo "KEYMAP=us"
        ) > "$initrd"/etc/vconsole.conf

        # install basic keyboard maps and fonts
        for i in \
            /usr/lib/kbd/consolefonts/eurlatgr* \
            /usr/lib/kbd/keymaps/{legacy/,/}include/* \
            /usr/lib/kbd/keymaps/{legacy/,/}i386/include/* \
            /usr/lib/kbd/keymaps/{legacy/,/}i386/qwerty/us.*; do
            [[ -f $i ]] || continue
            inst "$i"
        done

        # some basic terminfo files
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux

        # softlink mtab
        ln -fs /proc/self/mounts "$initdir"/etc/mtab

        # install any Execs from the service files
        grep -Eho '^Exec[^ ]*=[^ ]+' "$initdir"{,/usr}/lib/systemd/system/*.service \
            | while read -r i || [ -n "$i" ]; do
                i=${i##Exec*=}
                i=${i##-}
                inst_multiple -o "$i"
            done

        # some helper tools for debugging
        [[ $DEBUGTOOLS ]] && inst_multiple "$DEBUGTOOLS"

        # install ld.so.conf* and run ldconfig
        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
        ddebug "Strip binaeries"
        find "$initdir" -perm /0111 -type f -print0 | xargs -0 -r strip --strip-unneeded | ddebug

        hostonly='' instmods fuse

        # copy depmod files
        inst /lib/modules/"$kernel"/modules.order
        inst /lib/modules/"$kernel"/modules.builtin
        # generate module dependencies
        if [[ -d $initdir/lib/modules/$kernel ]] \
            && ! depmod -a -b "$initdir" "$kernel"; then
            dfatal "\"depmod -a $kernel\" failed."
            exit 1
        fi
        # disable some services
        systemctl --root "$initdir" mask systemd-update-utmp
        systemctl --root "$initdir" mask systemd-tmpfiles-setup
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2030
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mkfs.btrfs btrfs poweroff cp umount sync dd
        inst_hook initqueue 01 ./create-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "bash udev-rules btrfs base rootfs-block fs-lib kernel-modules qemu" \
        -d "piix ide-gd_mod ata_piix btrfs sd_mod" \
        --nomdadmconf \
        --nohardlink \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/overlay

    # Create the blank file to use as a root filesystem
    dd if=/dev/zero of="$TESTDIR"/root.btrfs bs=1MiB count=160
    dd if=/dev/zero of="$TESTDIR"/usr.btrfs bs=1MiB count=160
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.btrfs root
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/usr.btrfs usr

    # Invoke KVM and/or QEMU to actually create the target filesystem.
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/fakeroot rw rootfstype=btrfs quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1

    if ! grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img; then
        echo "Could not create root filesystem"
        return 1
    fi

    (
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown dd
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook emergency 000 ./hard-off.sh
    )

    [ -e /etc/machine-id ] && EXTRA_MACHINE="/etc/machine-id"
    [ -e /etc/machine-info ] && EXTRA_MACHINE+=" /etc/machine-info"

    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -a "debug systemd i18n qemu" \
        ${EXTRA_MACHINE:+-I "$EXTRA_MACHINE"} \
        -o "dash network plymouth lvm mdraid resume crypt caps dm terminfo usrmount kernel-network-modules rngd" \
        -d "piix ide-gd_mod ata_piix btrfs sd_mod i6300esb ib700wdt" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1

    rm -rf -- "$TESTDIR"/overlay
}

test_cleanup() {
    return 0
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
   07070100000274000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-10-RAID   07070100000275000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/test/TEST-10-RAID/Makefile  -include ../Makefile.testdir
   07070100000276000081ED00000000000000000000000164DF2CB8000005EA000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-10-RAID/create-root.sh    #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
udevadm settle
set -ex
mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/disk/by-id/ata-disk_raid[123]
# wait for the array to finish initailizing, otherwise this sometimes fails
# randomly.
mdadm -W /dev/md0 || :
printf test > keyfile
cryptsetup -q luksFormat /dev/md0 /keyfile
echo "The passphrase is test"
cryptsetup luksOpen /dev/md0 dracut_crypt_test < /keyfile
lvm pvcreate -ff -y /dev/mapper/dracut_crypt_test
lvm vgcreate dracut /dev/mapper/dracut_crypt_test
lvm lvcreate -l 100%FREE -n root dracut
lvm vgchange -ay
mke2fs -L root /dev/dracut/root
mkdir -p /sysroot
mount /dev/dracut/root /sysroot
cp -a -t /sysroot /source/*
mkdir -p /sysroot/run
umount /sysroot
lvm lvchange -a n /dev/dracut/root
udevadm settle
cryptsetup luksClose /dev/mapper/dracut_crypt_test
udevadm settle
mdadm -W /dev/md0 || :
udevadm settle
mdadm --detail --export /dev/md0 | grep -F MD_UUID > /tmp/mduuid
. /tmp/mduuid
udevadm settle
eval "$(udevadm info --query=env --name=/dev/md0 | while read -r line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo "$line"; done)"
{
    echo "dracut-root-block-created"
    echo MD_UUID="$MD_UUID"
    echo "ID_FS_UUID=$ID_FS_UUID"
} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
sync
poweroff -f
  07070100000277000081ED00000000000000000000000164DF2CB800000073000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-10-RAID/cryptroot-ask.sh  #!/bin/sh

[ -b "/dev/mapper/$2" ] && exit 0
printf test > /keyfile
/sbin/cryptsetup luksOpen "$1" "$2" < /keyfile
 07070100000278000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/test/TEST-10-RAID/finished-false.sh #!/bin/sh
exit 1
   07070100000279000081ED00000000000000000000000164DF2CB800000052000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-10-RAID/hard-off.sh   #!/bin/sh
getargbool 0 rd.shell || poweroff -f
getargbool 0 failme && poweroff -f
  0707010000027A000081ED00000000000000000000000164DF2CB800000279000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-10-RAID/test-init.sh  #!/bin/sh
: > /dev/watchdog

. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker

export TERM=linux
export PS1='initramfs-test:\w\$ '
[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
if getargbool 0 rd.shell; then
    strstr "$(setsid --help)" "control" && CTTY="-c"
    setsid $CTTY sh -i
fi
echo "Powering down."
mount -n -o remount,ro /
poweroff -f
   0707010000027B000081ED00000000000000000000000164DF2CB800001696000000000000000000000000000000000000003800000000dracut-055+suse.347.gdcb9bdbf/test/TEST-10-RAID/test.sh   #!/bin/bash
# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem on an encrypted LVM PV on a RAID-5"

KVERSION=${KVERSION-$(uname -r)}

# Uncomment this to debug failures
#DEBUGFAIL="rd.shell rd.udev.log-priority=debug loglevel=70 systemd.log_target=kmsg"
#DEBUGFAIL="rd.break rd.shell rd.debug debug"
test_run() {
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-1.img raid1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rd.auto rw rd.retry=10 console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \
        -initrd "$TESTDIR"/initramfs.testing || return 1

    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success "$TESTDIR"/marker.img
}

test_setup() {
    kernel=$KVERSION
    # Create what will eventually be our root filesystem onto an overlay
    (
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        (
            cd "$initdir" || exit
            mkdir -p -- dev sys proc etc var/run tmp
            mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
        )
        inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
            mount dmesg dhclient mkdir cp ping dhclient dd sync
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst_simple /etc/os-release
        inst ./test-init.sh /sbin/init
        inst "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
        inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
        inst_multiple grep
        inst_multiple -o /lib/systemd/systemd-shutdown
        find_binary plymouth > /dev/null && inst_multiple plymouth
        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mke2fs poweroff cp umount dd sync grep
        inst_hook initqueue 01 ./create-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "bash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
        --nomdadmconf \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/overlay

    # Create the blank files to use as a root filesystem
    dd if=/dev/zero of="$TESTDIR"/raid-1.img bs=1MiB count=40
    dd if=/dev/zero of="$TESTDIR"/raid-2.img bs=1MiB count=40
    dd if=/dev/zero of="$TESTDIR"/raid-3.img bs=1MiB count=40
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-1.img raid1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/cannotreach rw rootfstype=ext2 console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1
    eval "$(grep -F -a -m 1 ID_FS_UUID "$TESTDIR"/marker.img)"

    (
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown dd
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook emergency 000 ./hard-off.sh
        inst ./cryptroot-ask.sh /sbin/cryptroot-ask
        mkdir -p "$initdir"/etc
        echo "testluks UUID=$ID_FS_UUID /etc/key" > "$initdir"/etc/crypttab
        #echo "luks-$ID_FS_UUID /dev/md0 none" > $initdir/etc/crypttab
        echo -n "test" > "$initdir"/etc/key
    )

    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -o "plymouth network kernel-network-modules" \
        -a "debug" \
        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
}

test_cleanup() {
    return 0
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
  0707010000027C000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-11-LVM    0707010000027D000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000003800000000dracut-055+suse.347.gdcb9bdbf/test/TEST-11-LVM/Makefile   -include ../Makefile.testdir
   0707010000027E000081ED00000000000000000000000164DF2CB8000002CE000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-11-LVM/create-root.sh #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
udevadm settle

set -ex
for dev in /dev/disk/by-id/ata-disk_disk[123]; do
    lvm pvcreate -ff -y "$dev"
done

lvm vgcreate dracut /dev/disk/by-id/ata-disk_disk[123]
lvm lvcreate -l 100%FREE -n root dracut
lvm vgchange -ay
mke2fs /dev/dracut/root
mkdir -p /sysroot
mount /dev/dracut/root /sysroot
cp -a -t /sysroot /source/*
umount /sysroot
lvm lvchange -a n /dev/dracut/root
echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
poweroff -f
  0707010000027F000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-11-LVM/finished-false.sh  #!/bin/sh
exit 1
   07070100000280000081ED00000000000000000000000164DF2CB800000052000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-11-LVM/hard-off.sh    #!/bin/sh
getargbool 0 rd.shell || poweroff -f
getargbool 0 failme && poweroff -f
  07070100000281000081ED00000000000000000000000164DF2CB800000279000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-11-LVM/test-init.sh   #!/bin/sh
: > /dev/watchdog

. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker

export TERM=linux
export PS1='initramfs-test:\w\$ '
[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
if getargbool 0 rd.shell; then
    strstr "$(setsid --help)" "control" && CTTY="-c"
    setsid $CTTY sh -i
fi
echo "Powering down."
mount -n -o remount,ro /
poweroff -f
   07070100000282000081ED00000000000000000000000164DF2CB8000014D8000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-11-LVM/test.sh    #!/bin/bash

# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem on LVM PV"

KVERSION=${KVERSION-$(uname -r)}

# Uncomment this to debug failures
#DEBUGFAIL="rd.break rd.shell"

test_run() {
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \
        -initrd "$TESTDIR"/initramfs.testing || return 1

    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success "$TESTDIR"/marker.img
}

test_setup() {
    kernel=$KVERSION
    # Create what will eventually be our root filesystem onto an overlay
    (
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        (
            cd "$initdir" || exit
            mkdir -p -- dev sys proc etc var/run tmp
            mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
            mkdir -p -- var/lib/nfs/rpc_pipefs
        )
        inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
            mount dmesg dhclient mkdir cp ping dhclient dd sync
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux
        inst "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
        inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst_multiple grep
        inst_simple /etc/os-release
        inst ./test-init.sh /sbin/init
        find_binary plymouth > /dev/null && inst_multiple plymouth
        cp -a /etc/ld.so.conf* "$initdir"/etc
        mkdir -p "$initdir"/run
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mke2fs poweroff cp umount dd sync
        inst_hook initqueue 01 ./create-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "bash lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/overlay

    # Create the blank files to use as a root filesystem
    dd if=/dev/zero of="$TESTDIR"/disk-1.img bs=1MiB count=40
    dd if=/dev/zero of="$TESTDIR"/disk-2.img bs=1MiB count=40
    dd if=/dev/zero of="$TESTDIR"/disk-3.img bs=1MiB count=40
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1

    (
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown dd
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook emergency 000 ./hard-off.sh
    )
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -o "plymouth network kernel-network-modules" \
        -a "debug" \
        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
}

test_cleanup() {
    return 0
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
07070100000283000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/test/TEST-12-RAID-DEG   07070100000284000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-12-RAID-DEG/Makefile  -include ../Makefile.testdir
   07070100000285000081ED00000000000000000000000164DF2CB8000005EA000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/test/TEST-12-RAID-DEG/create-root.sh    #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
udevadm settle
set -ex
mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/disk/by-id/ata-disk_raid[123]
# wait for the array to finish initailizing, otherwise this sometimes fails
# randomly.
mdadm -W /dev/md0 || :
printf test > keyfile
cryptsetup -q luksFormat /dev/md0 /keyfile
echo "The passphrase is test"
cryptsetup luksOpen /dev/md0 dracut_crypt_test < /keyfile
lvm pvcreate -ff -y /dev/mapper/dracut_crypt_test
lvm vgcreate dracut /dev/mapper/dracut_crypt_test
lvm lvcreate -l 100%FREE -n root dracut
lvm vgchange -ay
mke2fs -L root /dev/dracut/root
mkdir -p /sysroot
mount /dev/dracut/root /sysroot
cp -a -t /sysroot /source/*
mkdir -p /sysroot/run
umount /sysroot
lvm lvchange -a n /dev/dracut/root
udevadm settle
cryptsetup luksClose /dev/mapper/dracut_crypt_test
udevadm settle
mdadm -W /dev/md0 || :
udevadm settle
mdadm --detail --export /dev/md0 | grep -F MD_UUID > /tmp/mduuid
. /tmp/mduuid
udevadm settle
eval "$(udevadm info --query=env --name=/dev/md0 | while read -r line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo "$line"; done)"
{
    echo "dracut-root-block-created"
    echo MD_UUID="$MD_UUID"
    echo "ID_FS_UUID=$ID_FS_UUID"
} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
sync
poweroff -f
  07070100000286000081ED00000000000000000000000164DF2CB800000073000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/test/TEST-12-RAID-DEG/cryptroot-ask.sh  #!/bin/sh

[ -b /dev/mapper/"$2" ] && exit 0
printf test > /keyfile
/sbin/cryptsetup luksOpen "$1" "$2" < /keyfile
 07070100000287000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/test/TEST-12-RAID-DEG/finished-false.sh #!/bin/sh
exit 1
   07070100000288000081ED00000000000000000000000164DF2CB800000075000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-12-RAID-DEG/hard-off.sh   #!/bin/sh
sleep 5
getargbool 0 rd.shell || poweroff -f
! getargbool 0 rd.break && getargbool 0 failme && poweroff -f
   07070100000289000081ED00000000000000000000000164DF2CB8000002D5000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-12-RAID-DEG/test-init.sh  #!/bin/sh
: > /dev/watchdog

. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker

export TERM=linux
export PS1='initramfs-test:\w\$ '
[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
if getargbool 0 rd.shell; then
    strstr "$(setsid --help)" "control" && CTTY="-c"
    setsid $CTTY sh -i
fi
echo "Powering down."
mount -n -o remount,ro /
if [ -d /run/initramfs/etc ]; then
    echo " rd.debug=0 " >> /run/initramfs/etc/cmdline
fi
poweroff -f
   0707010000028A000081ED00000000000000000000000164DF2CB800001CAE000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-12-RAID-DEG/test.sh   #!/bin/bash
# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem on an encrypted LVM PV on a degraded RAID-5"

KVERSION=${KVERSION-$(uname -r)}

# Uncomment this to debug failures
#DEBUGFAIL="rd.shell rd.break rd.debug"
#DEBUGFAIL="rd.shell rd.break=pre-mount udev.log-priority=debug"
#DEBUGFAIL="rd.shell rd.udev.log-priority=debug loglevel=70 systemd.log_target=kmsg"
#DEBUGFAIL="rd.shell loglevel=70 systemd.log_target=kmsg"

client_run() {
    echo "CLIENT TEST START: $*"
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    # degrade the RAID
    # qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-1.img raid1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot $* systemd.log_target=kmsg root=LABEL=root rw rd.retry=10 rd.info console=ttyS0,115200n81 log_buf_len=2M selinux=0 rd.shell=0 $DEBUGFAIL " \
        -initrd "$TESTDIR"/initramfs.testing

    if ! grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success "$TESTDIR"/marker.img; then
        echo "CLIENT TEST END: $* [FAIL]"
        return 1
    fi

    echo "CLIENT TEST END: $* [OK]"
    return 0
}

test_run() {
    read -r LUKS_UUID < "$TESTDIR"/luksuuid
    read -r MD_UUID < "$TESTDIR"/mduuid

    client_run failme && return 1
    client_run rd.auto || return 1

    client_run rd.luks.uuid="$LUKS_UUID" rd.md.uuid="$MD_UUID" rd.md.conf=0 rd.lvm.vg=dracut || return 1

    client_run rd.luks.uuid="$LUKS_UUID" rd.md.uuid=failme rd.md.conf=0 rd.lvm.vg=dracut failme && return 1

    client_run rd.luks.uuid="$LUKS_UUID" rd.md.uuid="$MD_UUID" rd.lvm=0 failme && return 1
    client_run rd.luks.uuid="$LUKS_UUID" rd.md.uuid="$MD_UUID" rd.lvm=0 rd.auto=1 failme && return 1
    client_run rd.luks.uuid="$LUKS_UUID" rd.md.uuid="$MD_UUID" rd.lvm.vg=failme failme && return 1
    client_run rd.luks.uuid="$LUKS_UUID" rd.md.uuid="$MD_UUID" rd.lvm.vg=dracut || return 1
    client_run rd.luks.uuid="$LUKS_UUID" rd.md.uuid="$MD_UUID" rd.lvm.lv=dracut/failme failme && return 1
    client_run rd.luks.uuid="$LUKS_UUID" rd.md.uuid="$MD_UUID" rd.lvm.lv=dracut/root || return 1

    return 0
}

test_setup() {
    kernel=$KVERSION
    # Create what will eventually be our root filesystem onto an overlay
    (
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        (
            cd "$initdir" || exit
            mkdir -p -- dev sys proc etc var/run tmp
            mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
        )
        inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
            mount dmesg dhclient mkdir cp ping dhclient dd sync
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux
        inst "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
        inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst_multiple grep
        inst_simple /etc/os-release
        inst ./test-init.sh /sbin/init
        find_binary plymouth > /dev/null && inst_multiple plymouth
        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2030
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mke2fs poweroff cp umount dd grep sync
        inst_hook initqueue 01 ./create-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "bash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/overlay

    # Create the blank files to use as a root filesystem
    dd if=/dev/zero of="$TESTDIR"/raid-1.img bs=1MiB count=40
    dd if=/dev/zero of="$TESTDIR"/raid-2.img bs=1MiB count=40
    dd if=/dev/zero of="$TESTDIR"/raid-3.img bs=1MiB count=40
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-1.img raid1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1

    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1
    eval "$(grep -F --binary-files=text -m 1 MD_UUID "$TESTDIR"/marker.img)"
    eval "$(grep -F -a -m 1 ID_FS_UUID "$TESTDIR"/marker.img)"
    echo "$ID_FS_UUID" > "$TESTDIR"/luksuuid
    eval "$(grep -F --binary-files=text -m 1 MD_UUID "$TESTDIR"/marker.img)"
    echo "$MD_UUID" > "$TESTDIR"/mduuid

    (
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown dd
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook emergency 000 ./hard-off.sh
        inst ./cryptroot-ask.sh /sbin/cryptroot-ask
        mkdir -p "$initdir"/etc
        echo "ARRAY /dev/md0 level=raid5 num-devices=3 UUID=$MD_UUID" > "$initdir"/etc/mdadm.conf
        echo "luks-$ID_FS_UUID UUID=$ID_FS_UUID /etc/key" > "$initdir"/etc/crypttab
        echo -n test > "$initdir"/etc/key
        chmod 0600 "$initdir"/etc/key
    )

    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -o "plymouth network kernel-network-modules" \
        -a "debug" \
        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
}

test_cleanup() {
    return 0
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
  0707010000028B000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003800000000dracut-055+suse.347.gdcb9bdbf/test/TEST-13-ENC-RAID-LVM   0707010000028C000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-13-ENC-RAID-LVM/Makefile  -include ../Makefile.testdir
   0707010000028D000081ED00000000000000000000000164DF2CB80000067C000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-13-ENC-RAID-LVM/create-root.sh    #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
set -x
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
udevadm settle

set -ex
printf test > keyfile
cryptsetup -q luksFormat /dev/disk/by-id/ata-disk_disk1 /keyfile
cryptsetup -q luksFormat /dev/disk/by-id/ata-disk_disk2 /keyfile
cryptsetup -q luksFormat /dev/disk/by-id/ata-disk_disk3 /keyfile
cryptsetup luksOpen /dev/disk/by-id/ata-disk_disk1 dracut_disk1 < /keyfile
cryptsetup luksOpen /dev/disk/by-id/ata-disk_disk2 dracut_disk2 < /keyfile
cryptsetup luksOpen /dev/disk/by-id/ata-disk_disk3 dracut_disk3 < /keyfile
mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/mapper/dracut_disk1 /dev/mapper/dracut_disk2 /dev/mapper/dracut_disk3
# wait for the array to finish initailizing, otherwise this sometimes fails
# randomly.
mdadm -W /dev/md0
lvm pvcreate -ff -y /dev/md0
lvm vgcreate dracut /dev/md0

lvm lvcreate -l 100%FREE -n root dracut
lvm vgchange -ay
mke2fs /dev/dracut/root
mkdir -p /sysroot
mount /dev/dracut/root /sysroot
cp -a -t /sysroot /source/*
umount /sysroot
lvm lvchange -a n /dev/dracut/root
mdadm -W /dev/md0 || :
mdadm --stop /dev/md0
cryptsetup luksClose /dev/mapper/dracut_disk1
cryptsetup luksClose /dev/mapper/dracut_disk2
cryptsetup luksClose /dev/mapper/dracut_disk3

{
    echo "dracut-root-block-created"
    for i in /dev/disk/by-id/ata-disk_disk[123]; do
        udevadm info --query=env --name="$i" | grep -F 'ID_FS_UUID='
    done
} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
sync
poweroff -f
0707010000028E000081ED00000000000000000000000164DF2CB800000073000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/test/TEST-13-ENC-RAID-LVM/cryptroot-ask.sh  #!/bin/sh

[ -b /dev/mapper/"$2" ] && exit 0
printf test > /keyfile
/sbin/cryptsetup luksOpen "$1" "$2" < /keyfile
 0707010000028F000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000004A00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-13-ENC-RAID-LVM/finished-false.sh #!/bin/sh
exit 1
   07070100000290000081ED00000000000000000000000164DF2CB800000052000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/test/TEST-13-ENC-RAID-LVM/hard-off.sh   #!/bin/sh
getargbool 0 rd.shell || poweroff -f
getargbool 0 failme && poweroff -f
  07070100000291000081ED00000000000000000000000164DF2CB8000002D5000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/test/TEST-13-ENC-RAID-LVM/test-init.sh  #!/bin/sh
: > /dev/watchdog

. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker

export TERM=linux
export PS1='initramfs-test:\w\$ '
[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
if getargbool 0 rd.shell; then
    strstr "$(setsid --help)" "control" && CTTY="-c"
    setsid $CTTY sh -i
fi
echo "Powering down."
mount -n -o remount,ro /
if [ -d /run/initramfs/etc ]; then
    echo " rd.debug=0 " >> /run/initramfs/etc/cmdline
fi
poweroff -f
   07070100000292000081ED00000000000000000000000164DF2CB800001CF0000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-13-ENC-RAID-LVM/test.sh   #!/bin/bash
# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem on LVM on encrypted partitions of a RAID-5"

KVERSION=${KVERSION-$(uname -r)}

# Uncomment this to debug failures
#DEBUGFAIL="rd.shell rd.break" # udev.log-priority=debug
#DEBUGFAIL="rd.shell rd.udev.log-priority=debug loglevel=70 systemd.log_target=kmsg systemd.log_target=debug"
#DEBUGFAIL="rd.shell loglevel=70 systemd.log_target=kmsg systemd.log_target=debug"

test_run() {
    LUKSARGS=$(cat "$TESTDIR"/luks.txt)

    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1

    echo "CLIENT TEST START: $LUKSARGS"

    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug rootwait $LUKSARGS rd.shell=0 $DEBUGFAIL" \
        -initrd "$TESTDIR"/initramfs.testing
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success "$TESTDIR"/marker.img || return 1
    echo "CLIENT TEST END: [OK]"

    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1

    echo "CLIENT TEST START: Any LUKS"
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rw quiet rd.auto rd.retry=20 rd.info console=ttyS0,115200n81 selinux=0 rd.debug  $DEBUGFAIL" \
        -initrd "$TESTDIR"/initramfs.testing
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success "$TESTDIR"/marker.img || return 1
    echo "CLIENT TEST END: [OK]"

    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1

    echo "CLIENT TEST START: Wrong LUKS UUID"
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rw quiet rd.auto rd.retry=10 rd.info console=ttyS0,115200n81 selinux=0 rd.debug  $DEBUGFAIL rd.luks.uuid=failme" \
        -initrd "$TESTDIR"/initramfs.testing
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success "$TESTDIR"/marker.img && return 1
    echo "CLIENT TEST END: [OK]"

    return 0
}

test_setup() {
    kernel=$KVERSION
    # Create what will eventually be our root filesystem onto an overlay
    (
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        (
            cd "$initdir" || exit
            mkdir -p -- dev sys proc etc var/run tmp
            mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
            mkdir -p -- var/lib/nfs/rpc_pipefs
        )
        inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
            mount dmesg dhclient mkdir cp ping dhclient dd
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux
        inst "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
        inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst_multiple grep
        inst_simple /etc/os-release
        inst ./test-init.sh /sbin/init
        find_binary plymouth > /dev/null && inst_multiple plymouth
        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mke2fs poweroff cp umount grep dd sync
        inst_hook initqueue 01 ./create-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "bash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/overlay

    # Create the blank files to use as a root filesystem
    dd if=/dev/zero of="$TESTDIR"/disk-1.img bs=1MiB count=40
    dd if=/dev/zero of="$TESTDIR"/disk-2.img bs=1MiB count=40
    dd if=/dev/zero of="$TESTDIR"/disk-3.img bs=1MiB count=40
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1
    cryptoUUIDS=$(grep -F --binary-files=text -m 3 ID_FS_UUID "$TESTDIR"/marker.img)
    for uuid in $cryptoUUIDS; do
        eval "$uuid"
        printf ' rd.luks.uuid=luks-%s ' "$ID_FS_UUID"
    done > "$TESTDIR"/luks.txt

    (
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown dd
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook emergency 000 ./hard-off.sh
        inst ./cryptroot-ask.sh /sbin/cryptroot-ask
        mkdir -p "$initdir"/etc
        i=1
        for uuid in $cryptoUUIDS; do
            eval "$uuid"
            printf 'luks-%s /dev/disk/by-id/ata-disk_disk%s /etc/key timeout=0\n' "$ID_FS_UUID" $i
            ((i += 1))
        done > "$initdir"/etc/crypttab
        echo -n test > "$initdir"/etc/key
        chmod 0600 "$initdir"/etc/key
    )
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -o "plymouth network kernel-network-modules" \
        -a "debug" \
        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
}

test_cleanup() {
    return 0
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
07070100000293000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-14-IMSM   07070100000294000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/test/TEST-14-IMSM/Makefile  -include ../Makefile.testdir
   07070100000295000081ED00000000000000000000000164DF2CB800000776000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-14-IMSM/create-root.sh    #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 61-dmraid-imsm.rules 64-md-raid.rules 65-md-incremental-imsm.rules 65-md-incremental.rules 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    rm -f -- "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf

udevadm control --reload
udevadm settle

# dmraid does not want symlinks in --disk "..."
echo y | dmraid -f isw -C Test0 --type 1 --disk "$(realpath /dev/disk/by-id/ata-disk_disk1) $(realpath /dev/disk/by-id/ata-disk_disk2)"
udevadm settle

SETS=$(dmraid -c -s)
# scan and activate all DM RAIDS
for s in $SETS; do
    dmraid -ay -i -p --rm_partitions "$s"
    [ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s"
done

udevadm settle
sleep 1
udevadm settle

sfdisk -g /dev/mapper/isw*Test0
sfdisk --no-reread /dev/mapper/isw*Test0 << EOF
,4M
,28M
,28M
,28M
EOF

set -x

udevadm settle
dmraid -a n
udevadm settle

SETS=$(dmraid -c -s -i)
# scan and activate all DM RAIDS
for s in $SETS; do
    dmraid -ay -i -p --rm_partitions "$s"
    [ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s"
done

udevadm settle

mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 \
    /dev/mapper/isw*p*[234]
# wait for the array to finish initailizing, otherwise this sometimes fails
# randomly.
mdadm -W /dev/md0
set -e
lvm pvcreate -ff -y /dev/md0
lvm vgcreate dracut /dev/md0
lvm lvcreate -l 100%FREE -n root dracut
lvm vgchange -ay
mke2fs -L root /dev/dracut/root
mkdir -p /sysroot
mount /dev/dracut/root /sysroot
cp -a -t /sysroot /source/*
umount /sysroot
lvm lvchange -a n /dev/dracut/root
udevadm settle
mdadm --detail --export /dev/md0 | grep -F MD_UUID > /tmp/mduuid
. /tmp/mduuid
echo "MD_UUID=$MD_UUID"
{
    echo "dracut-root-block-created"
    echo MD_UUID="$MD_UUID"
} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
mdadm --wait-clean /dev/md0
sync
poweroff -f
  07070100000296000081ED00000000000000000000000164DF2CB800000073000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-14-IMSM/cryptroot-ask.sh  #!/bin/sh

[ -b /dev/mapper/"$2" ] && exit 0
printf test > /keyfile
/sbin/cryptsetup luksOpen "$1" "$2" < /keyfile
 07070100000297000081ED00000000000000000000000164DF2CB800000052000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-14-IMSM/hard-off.sh   #!/bin/sh
getargbool 0 rd.shell || poweroff -f
getargbool 0 failme && poweroff -f
  07070100000298000081ED00000000000000000000000164DF2CB8000002D5000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-14-IMSM/test-init.sh  #!/bin/sh
: > /dev/watchdog

. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker

export TERM=linux
export PS1='initramfs-test:\w\$ '
[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
if getargbool 0 rd.shell; then
    strstr "$(setsid --help)" "control" && CTTY="-c"
    setsid $CTTY sh -i
fi
echo "Powering down."
mount -n -o remount,ro /
if [ -d /run/initramfs/etc ]; then
    echo " rd.debug=0 " >> /run/initramfs/etc/cmdline
fi
poweroff -f
   07070100000299000081ED00000000000000000000000164DF2CB800001871000000000000000000000000000000000000003800000000dracut-055+suse.347.gdcb9bdbf/test/TEST-14-IMSM/test.sh   #!/bin/bash
# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem on LVM PV on a isw dmraid"

KVERSION=${KVERSION-$(uname -r)}

# Uncomment this to debug failures
#DEBUGFAIL="rd.shell"
#DEBUGFAIL="$DEBUGFAIL udev.log-priority=debug"

client_run() {
    echo "CLIENT TEST START: $*"

    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot $* root=LABEL=root rw debug rd.retry=5 rd.debug console=ttyS0,115200n81 selinux=0 rd.info rd.shell=0 $DEBUGFAIL" \
        -initrd "$TESTDIR"/initramfs.testing || return 1

    if ! grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success "$TESTDIR"/marker.img; then
        echo "CLIENT TEST END: $* [FAIL]"
        return 1
    fi

    echo "CLIENT TEST END: $* [OK]"
    return 0
}

test_run() {
    read -r MD_UUID < "$TESTDIR"/mduuid
    if [[ -z $MD_UUID ]]; then
        echo "Setup failed"
        return 1
    fi

    client_run rd.auto rd.md.imsm=0 || return 1
    client_run rd.md.uuid="$MD_UUID" rd.dm=0 || return 1
    # This test succeeds, because the mirror parts are found without
    # assembling the mirror itsself, which is what we want
    client_run rd.md.uuid="$MD_UUID" rd.md=0 rd.md.imsm failme && return 1
    client_run rd.md.uuid="$MD_UUID" rd.md=0 failme && return 1
    # the following test hangs on newer md
    client_run rd.md.uuid="$MD_UUID" rd.dm=0 rd.md.imsm rd.md.conf=0 || return 1
    return 0
}

test_setup() {
    kernel=$KVERSION
    # Create what will eventually be our root filesystem onto an overlay
    (
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        (
            cd "$initdir" || exit
            mkdir -p -- dev sys proc etc var/run tmp
            mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
        )
        inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
            mount dmesg dhclient mkdir cp ping dhclient dd sync
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux
        inst_simple /etc/os-release
        inst "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
        inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst_multiple grep
        inst ./test-init.sh /sbin/init
        find_binary plymouth > /dev/null && inst_multiple plymouth
        cp -a /etc/ld.so.conf* "$initdir"/etc
        mkdir -p "$initdir"/run
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2030
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mke2fs poweroff cp umount grep dd sync realpath
        inst_hook initqueue 01 ./create-root.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "bash lvm mdraid dmraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
        -d "piix ide-gd_mod ata_piix ext2 sd_mod dm-multipath dm-crypt dm-round-robin faulty linear multipath raid0 raid10 raid1 raid456" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/overlay

    # Create the blank files to use as a root filesystem
    dd if=/dev/zero of="$TESTDIR"/disk-1.img bs=1MiB count=100
    dd if=/dev/zero of="$TESTDIR"/disk-2.img bs=1MiB count=100
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2

    # Invoke KVM and/or QEMU to actually create the target filesystem.
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1
    eval "$(grep -F --binary-files=text -m 1 MD_UUID "$TESTDIR"/marker.img)"

    if [[ -z $MD_UUID ]]; then
        echo "Setup failed"
        return 1
    fi

    echo "$MD_UUID" > "$TESTDIR"/mduuid
    (
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook emergency 000 ./hard-off.sh
    )
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -o "plymouth network kernel-network-modules" \
        -a "debug" \
        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
}

test_cleanup() {
    return 0
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
   0707010000029A000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003500000000dracut-055+suse.347.gdcb9bdbf/test/TEST-15-BTRFSRAID  0707010000029B000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-15-BTRFSRAID/Makefile -include ../Makefile.testdir
   0707010000029C000081ED00000000000000000000000164DF2CB80000025D000000000000000000000000000000000000004400000000dracut-055+suse.347.gdcb9bdbf/test/TEST-15-BTRFSRAID/create-root.sh   #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
modprobe btrfs || :
udevadm control --reload
udevadm settle

set -e

mkfs.btrfs -draid10 -mraid10 -L root /dev/disk/by-id/ata-disk_raid[1234]
udevadm settle

btrfs device scan
udevadm settle

mkdir -p /sysroot
mount -t btrfs /dev/disk/by-id/ata-disk_raid4 /sysroot
cp -a -t /sysroot /source/*
umount /sysroot

echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
sync
poweroff -f
   0707010000029D000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-15-BTRFSRAID/finished-false.sh    #!/bin/sh
exit 1
   0707010000029E000081ED00000000000000000000000164DF2CB800000052000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-15-BTRFSRAID/hard-off.sh  #!/bin/sh
getargbool 0 rd.shell || poweroff -f
getargbool 0 failme && poweroff -f
  0707010000029F000081ED00000000000000000000000164DF2CB80000027A000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/test/TEST-15-BTRFSRAID/test-init.sh #!/bin/sh
: > /dev/watchdog

. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker

export TERM=linux
export PS1='initramfs-test:\w\$ '
[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
if getargbool 0 rd.shell; then
    strstr "$(setsid --help)" "control" && CTTY="-c"
    setsid $CTTY sh -i
fi
echo "Powering down."
mount -n -o remount,ro /

poweroff -f
  070701000002A0000081ED00000000000000000000000164DF2CB800001632000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-15-BTRFSRAID/test.sh  #!/bin/bash
# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem on multiple device btrfs"

KVERSION=${KVERSION-$(uname -r)}

# Uncomment this to debug failures
#DEBUGFAIL="rd.shell"
test_run() {
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-1.img raid1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-4.img raid4

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=root rw rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \
        -initrd "$TESTDIR"/initramfs.testing
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success "$TESTDIR"/marker.img || return 1
}

test_setup() {
    # Create the blank file to use as a root filesystem
    DISKIMAGE=$TESTDIR/TEST-15-BTRFSRAID-root.img
    rm -f -- "$DISKIMAGE"
    dd if=/dev/zero of="$DISKIMAGE" bs=1M count=1024

    kernel=$KVERSION
    # Create what will eventually be our root filesystem onto an overlay
    (
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        (
            cd "$initdir" || exit
            mkdir -p -- dev sys proc etc var/run tmp
            mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
            mkdir -p -- var/lib/nfs/rpc_pipefs
        )
        inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
            mount dmesg dhclient mkdir cp ping dhclient sync dd
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux
        inst "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
        inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst_multiple grep
        inst ./test-init.sh /sbin/init
        inst_simple /etc/os-release
        find_binary plymouth > /dev/null && inst_multiple plymouth
        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mkfs.btrfs poweroff cp umount dd sync
        inst_hook initqueue 01 ./create-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "bash btrfs udev-rules base rootfs-block fs-lib kernel-modules qemu" \
        -d "piix ide-gd_mod ata_piix btrfs sd_mod" \
        --nomdadmconf \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1

    rm -rf -- "$TESTDIR"/overlay

    # Create the blank files to use as a root filesystem
    dd if=/dev/zero of="$TESTDIR"/raid-1.img bs=1MiB count=150
    dd if=/dev/zero of="$TESTDIR"/raid-2.img bs=1MiB count=150
    dd if=/dev/zero of="$TESTDIR"/raid-3.img bs=1MiB count=150
    dd if=/dev/zero of="$TESTDIR"/raid-4.img bs=1MiB count=150
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-1.img raid1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-4.img raid4

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/fakeroot rw quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1

    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1

    (
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook emergency 000 ./hard-off.sh
    )
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -o "plymouth network kernel-network-modules" \
        -a "debug" \
        -d "piix ide-gd_mod ata_piix btrfs sd_mod" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
}

test_cleanup() {
    return 0
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
  070701000002A1000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/test/TEST-16-DMSQUASH   070701000002A2000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-16-DMSQUASH/Makefile  -include ../Makefile.testdir
   070701000002A3000081A400000000000000000000000164DF2CB800001D98000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-16-DMSQUASH/create.py #!/usr/bin/python3 -tt
#
# livecd-creator : Creates Live CD based for Fedora.
#
# Copyright 2007, Red Hat  Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

import os
import os.path
import sys
import time
import optparse
import logging
import shutil
from distutils.dir_util import copy_tree

import imgcreate
from imgcreate.fs import makedirs

class myLiveImageCreator(imgcreate.x86LiveImageCreator):
    def __init__(self, ks, name, fslabel=None, releasever=None, tmpdir="/tmp",
                 title="Linux", product="Linux"):

        imgcreate.x86LiveImageCreator.__init__(self, ks, name,
                                               fslabel=fslabel,
                                               releasever=releasever,
                                               tmpdir=tmpdir)

        #self._outdir=os.getenv("TESTDIR", ".")

    def install(self, repo_urls = {}):
        copy_tree(os.environ.get("TESTDIR", ".") + "/root-source", self._instroot)

    def configure(self):
        self._create_bootconfig()

    def _get_kernel_versions(self):
        ret = {}
        version=os.uname()
        version=version[2]
        ret["kernel-" + version] = [version]
        return ret

    def __sanity_check(self):
        pass

class Usage(Exception):
    def __init__(self, msg = None, no_error = False):
        Exception.__init__(self, msg, no_error)

def parse_options(args):
    parser = optparse.OptionParser()

    imgopt = optparse.OptionGroup(parser, "Image options",
                                  "These options define the created image.")
    imgopt.add_option("-c", "--config", type="string", dest="kscfg",
                      help="Path or url to kickstart config file")
    imgopt.add_option("-b", "--base-on", type="string", dest="base_on",
                      help="Add packages to an existing live CD iso9660 image.")
    imgopt.add_option("-f", "--fslabel", type="string", dest="fslabel",
                      help="File system label (default based on config name)")
    # Provided for img-create compatibility
    imgopt.add_option("-n", "--name", type="string", dest="fslabel",
                      help=optparse.SUPPRESS_HELP)
    imgopt.add_option("", "--image-type", type="string", dest="image_type",
                      help=optparse.SUPPRESS_HELP)
    imgopt.add_option("", "--compression-type", type="string", dest="compress_type",
                      help="Compression type recognized by mksquashfs "
                           "(default xz needs a 2.6.38+ kernel, gzip works "
                           "with all kernels, lzo needs a 2.6.36+ kernel, lzma "
                           "needs custom kernel.) Set to 'None' to force read "
                           "from base_on.",
                      default="xz")
    imgopt.add_option("", "--releasever", type="string", dest="releasever",
                      default=None,
                      help="Value to substitute for $releasever in kickstart repo urls")
    parser.add_option_group(imgopt)

    # options related to the config of your system
    sysopt = optparse.OptionGroup(parser, "System directory options",
                                  "These options define directories used on your system for creating the live image")
    sysopt.add_option("-t", "--tmpdir", type="string",
                      dest="tmpdir", default="/var/tmp",
                      help="Temporary directory to use (default: /var/tmp)")
    sysopt.add_option("", "--cache", type="string",
                      dest="cachedir", default=None,
                      help="Cache directory to use (default: private cache")
    parser.add_option_group(sysopt)

    imgcreate.setup_logging(parser)

    # debug options not recommended for "production" images
    # Start a shell in the chroot for post-configuration.
    parser.add_option("-l", "--shell", action="store_true", dest="give_shell",
                      help=optparse.SUPPRESS_HELP)
    # Don't compress the image.
    parser.add_option("-s", "--skip-compression", action="store_true", dest="skip_compression",
                      help=optparse.SUPPRESS_HELP)
    parser.add_option("", "--skip-minimize", action="store_true", dest="skip_minimize",
                      help=optparse.SUPPRESS_HELP)

    (options, args) = parser.parse_args()

    # Pretend to be a image-creator if called with that name
    options.image_type = 'livecd'
    if options.image_type not in ('livecd', 'image'):
        raise Usage("'%s' is a recognized image type" % options.image_type)

    # image-create compatibility: Last argument is kickstart file
    if len(args) == 1:
        options.kscfg = args.pop()
    if len(args):
        raise Usage("Extra arguments given")

    if options.base_on and not os.path.isfile(options.base_on):
        raise Usage("Image file '%s' does not exist" %(options.base_on,))
    if options.image_type == 'livecd':
        if options.fslabel and len(options.fslabel) > imgcreate.FSLABEL_MAXLEN:
            raise Usage("CD labels are limited to 32 characters")
        if options.fslabel and options.fslabel.find(" ") != -1:
            raise Usage("CD labels cannot contain spaces.")

    return options

def main():
    try:
        options = parse_options(sys.argv[1:])
    except Usage as e:
        msg, no_error = e.args
        if no_error:
            out = sys.stdout
            ret = 0
        else:
            out = sys.stderr
            ret = 2
        if msg:
            print >> out, msg
        return ret

    if os.geteuid () != 0:
        print >> sys.stderr, "You must run %s as root" % sys.argv[0]
        return 1

    if options.fslabel:
        fslabel = options.fslabel
        name = fslabel
    else:
        name = "livecd"

        fslabel = "LiveCD"
        logging.info("Using label '%s' and name '%s'" % (fslabel, name))

    ks = imgcreate.read_kickstart(options.kscfg)

    creator = myLiveImageCreator(ks, name,
                                 fslabel=fslabel,
                                 releasever=options.releasever,
                                 tmpdir=os.path.abspath(options.tmpdir))

    creator.compress_type = options.compress_type
    creator.skip_compression = options.skip_compression
    creator.skip_minimize = options.skip_minimize
    if options.cachedir:
        options.cachedir = os.path.abspath(options.cachedir)

    try:
        creator.mount(options.base_on, options.cachedir)
        creator.install()
        creator.configure()
        if options.give_shell:
            print("Launching shell. Exit to continue.")
            print("----------------------------------")
            creator.launch_shell()
        creator.unmount()
        creator.package(os.environ.get("TESTDIR", "."))
    except imgcreate.CreatorError as e:
        logging.error(u"Error creating Live CD : %s" % e)
        return 1
    finally:
        creator.cleanup()

    return 0

if __name__ == "__main__":
    sys.exit(main())
070701000002A4000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/test/TEST-16-DMSQUASH/finished-false.sh #!/bin/sh
exit 1
   070701000002A5000081ED00000000000000000000000164DF2CB800000052000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-16-DMSQUASH/hard-off.sh   #!/bin/sh
getargbool 0 rd.shell || poweroff -f
getargbool 0 failme && poweroff -f
  070701000002A6000081A400000000000000000000000164DF2CB800000164000000000000000000000000000000000000004D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-16-DMSQUASH/livecd-fedora-minimal.ks  lang en_US.UTF-8
keyboard us
timezone US/Eastern
auth --useshadow --enablemd5
selinux --enforcing
firewall --disabled
part / --size 1024

repo --name=fedora --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$version&arch=$basearch

%packages
@core
anaconda-runtime
bash
kernel
passwd
policycoreutils
chkconfig
authconfig
rootfiles

%end
070701000002A7000081ED00000000000000000000000164DF2CB80000027A000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-16-DMSQUASH/test-init.sh  #!/bin/sh
: > /dev/watchdog

. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker

export TERM=linux
export PS1='initramfs-test:\w\$ '
[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
if getargbool 0 rd.shell; then
    strstr "$(setsid --help)" "control" && CTTY="-c"
    setsid $CTTY sh -i
fi
echo "Powering down."
mount -n -o remount,ro /

poweroff -f
  070701000002A8000081ED00000000000000000000000164DF2CB8000012F2000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-16-DMSQUASH/test.sh   #!/bin/bash
# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem on a LiveCD dmsquash filesystem"

KVERSION="${KVERSION-$(uname -r)}"

# Uncomment this to debug failures
#DEBUGFAIL="rd.shell rd.break rd.debug systemd.log_level=debug systemd.log_target=console"

test_check() {
    for pdir in $(python3 -c "import site; print(site.getsitepackages())" | sed -e 's/\[\(.*\)\]/\1/' -e "s/', /' /g"); do
        # shellcheck disable=SC2001
        pdir1=$(echo "$pdir" | sed "s/^'\(.*\)'$/\1/")
        if [[ -d $pdir1/imgcreate ]]; then
            return 0
        fi
    done
    echo "python-imgcreate not installed"
    return 1
}

test_run() {
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/livecd.iso livecd 1

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -boot order=d \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=live:CDLABEL=LiveCD live rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \
        -initrd "$TESTDIR"/initramfs.testing

    # mediacheck test with qemu GUI
    # "$testdir"/run-qemu \
    #     -drive format=raw,bps=1000000,index=0,media=disk,file="$TESTDIR"/livecd.iso \
    #     -drive format=raw,index=1,media=disk,file="$TESTDIR"/root.img \
    #     -m 512M  -smp 2 \
    #     -net none \
    #     -append "root=live:CDLABEL=LiveCD live quiet rhgb selinux=0 rd.live.check" \
    #     -initrd "$TESTDIR"/initramfs.testing

    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success -- "$TESTDIR"/marker.img || return 1
}

test_setup() {
    mkdir -p -- "$TESTDIR"/overlay
    (
        # shellcheck disable=SC2030
        export initdir="$TESTDIR"/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook emergency 000 ./hard-off.sh
    )

    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -a "debug dmsquash-live qemu" \
        -o "rngd" \
        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1

    mkdir -p -- "$TESTDIR"/root-source
    kernel="$KVERSION"
    # Create what will eventually be our root filesystem onto an overlay
    (
        # shellcheck disable=SC2031
        export initdir="$TESTDIR"/root-source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        (
            cd "$initdir" || exit
            mkdir -p -- dev sys proc etc var/run tmp
            mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
        )
        inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
            mount dmesg dhclient mkdir cp ping dhclient \
            umount strace less dd sync
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [[ -f ${_terminfodir}/l/linux ]] && break
        done
        inst_multiple -o "${_terminfodir}"/l/linux
        inst "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
        inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst_multiple grep syslinux isohybrid
        for f in /usr/share/syslinux/*; do
            inst_simple "$f"
        done
        inst_simple /etc/os-release
        inst ./test-init.sh /sbin/init
        inst "$TESTDIR"/initramfs.testing "/boot/initramfs-$KVERSION.img"
        [[ -f /etc/machine-id ]] && read -r MACHINE_ID < /etc/machine-id

        VMLINUZ="/lib/modules/${KVERSION}/vmlinuz"
        if ! [[ -e $VMLINUZ ]]; then
            if [[ $MACHINE_ID ]] && { [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]]; }; then
                VMLINUZ="/boot/${MACHINE_ID}/$KVERSION/linux"
            fi
        fi
        [[ -e $VMLINUZ ]] || VMLINUZ="/boot/vmlinuz-${KVERSION}"

        inst "$VMLINUZ" "/boot/vmlinuz-${KVERSION}"
        find_binary plymouth > /dev/null && inst_multiple plymouth
        cp -a -- /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
    )
    python3 create.py -d -c livecd-fedora-minimal.ks
    return 0
}

test_cleanup() {
    return 0
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
  070701000002A9000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/test/TEST-17-LVM-THIN   070701000002AA000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-17-LVM-THIN/Makefile  -include ../Makefile.testdir
   070701000002AB000081ED00000000000000000000000164DF2CB800000341000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/test/TEST-17-LVM-THIN/create-root.sh    #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
udevadm settle

set -ex
for dev in /dev/disk/by-id/ata-disk_disk[123]; do
    lvm pvcreate -ff -y "$dev"
done

lvm vgcreate dracut /dev/disk/by-id/ata-disk_disk[123]
lvm lvcreate -l 17 -T dracut/mythinpool
lvm lvcreate -V1G -T dracut/mythinpool -n root
lvm vgchange -ay
mke2fs /dev/dracut/root
mkdir -p /sysroot
mount /dev/dracut/root /sysroot
cp -a -t /sysroot /source/*
umount /sysroot
lvm lvchange -a n /dev/dracut/root

if ! dmsetup status | grep -q out_of_data_space; then
    echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
fi

sync
poweroff -f
   070701000002AC000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/test/TEST-17-LVM-THIN/finished-false.sh #!/bin/sh
exit 1
   070701000002AD000081ED00000000000000000000000164DF2CB80000004C000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-17-LVM-THIN/hard-off.sh   #!/bin/sh
getargbool 0 rd.shell || poweroff -f
getarg failme && poweroff -f
070701000002AE000081ED00000000000000000000000164DF2CB800000279000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-17-LVM-THIN/test-init.sh  #!/bin/sh
: > /dev/watchdog

. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker

export TERM=linux
export PS1='initramfs-test:\w\$ '
[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
if getargbool 0 rd.shell; then
    strstr "$(setsid --help)" "control" && CTTY="-c"
    setsid $CTTY sh -i
fi
echo "Powering down."
mount -n -o remount,ro /
poweroff -f
   070701000002AF000081ED00000000000000000000000164DF2CB800001502000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-17-LVM-THIN/test.sh   #!/bin/bash
# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem on LVM PV with thin pool"

KVERSION=${KVERSION-$(uname -r)}

# Uncomment this to debug failures
#DEBUGFAIL="rd.break rd.shell"

test_run() {
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \
        -initrd "$TESTDIR"/initramfs.testing || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success "$TESTDIR"/marker.img || return 1
}

test_setup() {
    kernel=$KVERSION
    # Create what will eventually be our root filesystem onto an overlay
    (
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        (
            cd "$initdir" || exit
            mkdir -p -- dev sys proc etc var/run tmp
            mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
            mkdir -p -- var/lib/nfs/rpc_pipefs
        )
        inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
            mount dmesg dhclient mkdir cp ping dhclient dd sync
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux
        inst "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
        inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst_multiple grep
        inst_simple /etc/os-release
        inst ./test-init.sh /sbin/init
        find_binary plymouth > /dev/null && inst_multiple plymouth
        cp -a /etc/ld.so.conf* "$initdir"/etc
        mkdir -p "$initdir"/run
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2030
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mke2fs poweroff cp umount grep dmsetup dd sync
        inst_hook initqueue 01 ./create-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "bash lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/overlay

    # Create the blank files to use as a root filesystem
    dd if=/dev/zero of="$TESTDIR"/disk-1.img bs=1MiB count=40
    dd if=/dev/zero of="$TESTDIR"/disk-2.img bs=1MiB count=40
    dd if=/dev/zero of="$TESTDIR"/disk-3.img bs=1MiB count=40
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1

    (
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook emergency 000 ./hard-off.sh
    )
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -o "plymouth network kernel-network-modules" \
        -a "debug" -I lvs \
        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
}

test_cleanup() {
    return 0
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
  070701000002B0000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-20-NFS    070701000002B1000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000003800000000dracut-055+suse.347.gdcb9bdbf/test/TEST-20-NFS/Makefile   -include ../Makefile.testdir
   070701000002B2000081ED00000000000000000000000164DF2CB8000002DB000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-20-NFS/client-init.sh #!/bin/sh
: > /dev/watchdog
. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

export TERM=linux
export PS1='initramfs-test:\w\$ '
stty sane
if getargbool 0 rd.shell; then
    [ -c /dev/watchdog ] && printf 'V' > /dev/watchdog
    strstr "$(setsid --help)" "control" && CTTY="-c"
    setsid $CTTY sh -i
fi

echo "made it to the rootfs! Powering down."

while read -r dev _ fstype opts rest || [ -n "$dev" ]; do
    [ "$fstype" != "nfs" -a "$fstype" != "nfs4" ] && continue
    echo "nfs-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
    break
done < /proc/mounts

: > /dev/watchdog

sync
poweroff -f
 070701000002B3000081A400000000000000000000000164DF2CB800000067000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-20-NFS/client.link    [Match]
OriginalName=*

[Link]
NamePolicy=keep kernel database onboard slot path
MACAddressPolicy=keep
 070701000002B4000081ED00000000000000000000000164DF2CB800000218000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-20-NFS/create-root.sh #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
udevadm settle

set -ex

mkfs.ext3 -L dracut /dev/disk/by-id/ata-disk_root
mkdir -p /root
mount /dev/disk/by-id/ata-disk_root /root
cp -a -t /root /source/*
mkdir -p /root/run
umount /root
echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
sync
poweroff -f
070701000002B5000081A400000000000000000000000164DF2CB8000015A8000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-20-NFS/dhcpd.conf ddns-update-style none;

use-host-decl-names true;

subnet 192.168.50.0 netmask 255.255.255.0 {
option subnet-mask      255.255.255.0;
option routers          192.168.50.1;
next-server             192.168.50.1;
server-identifier       192.168.50.1;
option domain-name-servers 192.168.50.1;
option domain-search "example.com";
option domain-name "other.com";

# MAC numbering scheme:
# NFSv3: last octect starts at 0x00 and works up

    group {
        # NFSv3 root=dhcp or root={/dev/,}nfs, use server-id
        option root-path "/nfs/client";

        host nfs3-1 {
            hardware ethernet 52:54:00:12:34:00;
                        fixed-address 192.168.50.101;
                }
        }

        group {
                # NFSv3 root=dhcp or root={/dev/,}nfs, use given IP
                option root-path "192.168.50.2:/nfs/client";

                host nfs3-2 {
                        hardware ethernet 52:54:00:12:34:01;
                        fixed-address 192.168.50.101;
                }
        }

        group {
                # NFSv3 root=dhcp, use protocol from root-path
                option root-path "nfs:192.168.50.3:/nfs/client";

                host nfs3-3 {
                        hardware ethernet 52:54:00:12:34:02;
                        fixed-address 192.168.50.101;
                }
        }

        group {
                # NFSv3 root=dhcp, use protocol, options from root-path
                option root-path "nfs:192.168.50.3:/nfs/client:wsize=4096";

                host nfs3-4 {
                        hardware ethernet 52:54:00:12:34:03;
                        fixed-address 192.168.50.101;
                }
        }

        group {
                # NFSv3 root=dhcp, nfsroot=/path and nfsroot=IP:/path testing

                host nfs3-5 {
                        hardware ethernet 52:54:00:12:34:04;
                        fixed-address 192.168.50.101;
                }
        }

        group {
                # NFSv3 root=dhcp, use path, comma-separated options
                option root-path "/nfs/client,wsize=4096";

                host nfs3-6 {
                        hardware ethernet 52:54:00:12:34:05;
                        fixed-address 192.168.50.101;
                }
        }

        group {
                # NFSv3 root=dhcp, use IP, path, comma-separated options
                option root-path "192.168.50.2:/nfs/client,wsize=4096";

                host nfs3-7 {
                        hardware ethernet 52:54:00:12:34:06;
                        fixed-address 192.168.50.101;
                }
        }

        group {
                # NFSv3 root=dhcp, use proto, IP, path, comma-separated options
                option root-path "nfs:192.168.50.3:/nfs/client,wsize=4096";

                host nfs3-8 {
                        hardware ethernet 52:54:00:12:34:07;
                        fixed-address 192.168.50.101;
                }
        }

        # MAC numbering scheme:
        # NFSv4: last octect starts at 0x80 and works up

        group {
                # NFSv4 root={/dev/,}nfs4, use server-id
                option root-path "/client";

                host nfs4-1 {
                        hardware ethernet 52:54:00:12:34:80;
                        fixed-address 192.168.50.101;
                }
        }

        group {
                # NFSv4 root={/dev/,}nfs4, use given IP
                option root-path "192.168.50.2:/client";

                host nfs4-2 {
                        hardware ethernet 52:54:00:12:34:81;
                        fixed-address 192.168.50.101;
                }
        }

        group {
                # NFSv4 root=dhcp, use profocol from root-path
                option root-path "nfs4:192.168.50.3:/client";

                host nfs4-3 {
                        hardware ethernet 52:54:00:12:34:82;
                        fixed-address 192.168.50.101;
                }
        }

        group {
                # NFSv4 root=dhcp, use profocol, options from root-path
                option root-path "nfs4:192.168.50.3:/client:wsize=4096";

                host nfs4-4 {
                        hardware ethernet 52:54:00:12:34:83;
                        fixed-address 192.168.50.101;
                }
        }

        group {
                # NFSv3 root=nfs4, nfsroot=/path and nfsroot=IP:/path testing
                host nfs4-5 {
                        hardware ethernet 52:54:00:12:34:84;
                        fixed-address 192.168.50.101;
                }
        }

        group {
                # NFSv4 root={/dev/,}nfs4, use server-id, comma-separated opts
                option root-path "/client,wsize=4096";

                host nfs4-6 {
                        hardware ethernet 52:54:00:12:34:85;
                        fixed-address 192.168.50.101;
                }
        }

        group {
                # NFSv4 root={/dev/,}nfs4, use given IP, comma-separated opts
                option root-path "192.168.50.2:/client,wsize=4096";

                host nfs4-7 {
                        hardware ethernet 52:54:00:12:34:86;
                        fixed-address 192.168.50.101;
                }
        }

        group {
                # NFSv4 root=dhcp, use comma-separated opts
                option root-path "nfs4:192.168.50.3:/client,wsize=4096";

                host nfs4-8 {
                        hardware ethernet 52:54:00:12:34:87;
                        fixed-address 192.168.50.101;
                }
        }

}
070701000002B6000081A400000000000000000000000164DF2CB800000197000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-20-NFS/exports    /nfs		192.168.50.0/24(ro,fsid=0,insecure,no_subtree_check,no_root_squash)
/nfs/client	192.168.50.0/24(ro,insecure,no_subtree_check,no_root_squash)
/nfs/nfs3-5	192.168.50.0/24(ro,insecure,no_subtree_check,no_root_squash,nohide)
/nfs/ip/192.168.50.101	192.168.50.0/24(ro,insecure,no_subtree_check,no_root_squash,nohide)
/nfs/tftpboot/nfs4-5	192.168.50.0/24(ro,insecure,no_subtree_check,no_root_squash,nohide)
 070701000002B7000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-20-NFS/finished-false.sh  #!/bin/sh
exit 1
   070701000002B8000081ED00000000000000000000000164DF2CB800000052000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-20-NFS/hard-off.sh    #!/bin/sh
getargbool 0 rd.shell || poweroff -f
getargbool 0 failme && poweroff -f
  070701000002B9000081A400000000000000000000000164DF2CB8000000CC000000000000000000000000000000000000003500000000dracut-055+suse.347.gdcb9bdbf/test/TEST-20-NFS/hosts  127.0.0.1	localhost
192.168.50.1	server
192.168.50.2	server-ip
192.168.50.3	server-proto-ip
192.168.50.100	workstation1
192.168.50.101	workstation2
192.168.50.102	workstation3
192.168.50.103	workstation4
070701000002BA000081ED00000000000000000000000164DF2CB80000098E000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-20-NFS/server-init.sh #!/bin/sh
exec < /dev/console > /dev/console 2>&1
set -x
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
export TERM=linux
export PS1='nfstest-server:\w\$ '
: > /dev/watchdog
stty sane
echo "made it to the rootfs!"
echo server > /proc/sys/kernel/hostname

wait_for_if_link() {
    local cnt=0
    local li
    while [ $cnt -lt 600 ]; do
        li=$(ip -o link show dev "$1" 2> /dev/null)
        [ -n "$li" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_if_up() {
    local cnt=0
    local li
    while [ $cnt -lt 200 ]; do
        li=$(ip -o link show up dev "$1")
        [ -n "$li" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_route_ok() {
    local cnt=0
    while [ $cnt -lt 200 ]; do
        li=$(ip route show)
        [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

linkup() {
    wait_for_if_link "$1" 2> /dev/null && ip link set "$1" up 2> /dev/null && wait_for_if_up "$1" 2> /dev/null
}

wait_for_if_link enx525400123456

ip addr add 127.0.0.1/8 dev lo
ip link set lo up
ip addr add 192.168.50.1/24 dev enx525400123456
ip addr add 192.168.50.2/24 dev enx525400123456
ip addr add 192.168.50.3/24 dev enx525400123456
linkup enx525400123456

: > /dev/watchdog
modprobe af_packet
: > /dev/watchdog
mkdir /nfs/nfs3-5
mount --bind /nfs/client /nfs/nfs3-5
: > /dev/watchdog
mkdir -p /nfs/ip/192.168.50.101
mount --bind /nfs/client /nfs/ip/192.168.50.101
: > /dev/watchdog
mkdir -p /nfs/tftpboot/nfs4-5
mount --bind /nfs/client /nfs/tftpboot/nfs4-5
: > /dev/watchdog
modprobe sunrpc
: > /dev/watchdog
mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs
: > /dev/watchdog
[ -x /sbin/portmap ] && portmap
: > /dev/watchdog
mkdir -p /run/rpcbind
[ -x /sbin/rpcbind ] && rpcbind
: > /dev/watchdog
modprobe nfsd
: > /dev/watchdog
mount -t nfsd nfsd /proc/fs/nfsd
: > /dev/watchdog
exportfs -r
: > /dev/watchdog
rpc.nfsd
: > /dev/watchdog
rpc.mountd
: > /dev/watchdog
rpc.idmapd
: > /dev/watchdog
exportfs -r
: > /dev/watchdog
mkdir -p /var/lib/dhcpd
: > /var/lib/dhcpd/dhcpd.leases
: > /dev/watchdog
chmod 777 /var/lib/dhcpd/dhcpd.leases
: > /dev/watchdog
rm -f /var/run/dhcpd.pid
dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases &
exportfs -s
echo "Serving NFS mounts"
while :; do
    [ -n "$(jobs -rp)" ] && : > /dev/watchdog
    sleep 10
done
mount -n -o remount,ro /
poweroff -f
  070701000002BB000081A400000000000000000000000164DF2CB800000044000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-20-NFS/server.link    [Match]
OriginalName=*

[Link]
NamePolicy=mac
MACAddressPolicy=keep
070701000002BC000081ED00000000000000000000000164DF2CB800003DCF000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-20-NFS/test.sh    #!/bin/bash

if [[ $NM ]]; then
    USE_NETWORK="network-manager"
    OMIT_NETWORK="network-legacy"
else
    USE_NETWORK="network-legacy"
    OMIT_NETWORK="network-manager"
fi

# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem on NFS with $USE_NETWORK"

KVERSION=${KVERSION-$(uname -r)}

# Uncomment this to debug failures
DEBUGFAIL="rd.debug loglevel=7"
#DEBUGFAIL="rd.shell rd.break rd.debug loglevel=7 "
#DEBUGFAIL="rd.debug loglevel=7 rd.break=initqueue rd.shell"
SERVER_DEBUG="rd.debug loglevel=7"
#SERIAL="unix:/tmp/server.sock"

run_server() {
    # Start server first
    echo "NFS TEST SETUP: Starting DHCP/NFS server"
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root 1

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -net socket,listen=127.0.0.1:12320 \
        -net nic,macaddr=52:54:00:12:34:56,model=e1000 \
        -serial "${SERIAL:-"file:$TESTDIR/server.log"}" \
        -watchdog i6300esb -watchdog-action poweroff \
        -append "panic=1 oops=panic softlockup_panic=1 root=LABEL=dracut rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \
        -initrd "$TESTDIR"/initramfs.server \
        -pidfile "$TESTDIR"/server.pid -daemonize || return 1
    chmod 644 "$TESTDIR"/server.pid || return 1

    # Cleanup the terminal if we have one
    tty -s && stty sane

    if ! [[ $SERIAL ]]; then
        while ! grep -q Serving "$TESTDIR"/server.log; do
            echo "Waiting for the server to startup"
            sleep 1
        done
    else
        echo Sleeping 10 seconds to give the server a head start
        sleep 10
    fi
}

client_test() {
    local test_name="$1"
    local mac=$2
    local cmdline="$3"
    local server="$4"
    local check_opt="$5"
    local nfsinfo opts found expected

    echo "CLIENT TEST START: $test_name"

    # Need this so kvm-qemu will boot (needs non-/dev/zero local disk)
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker

    if dhclient --help 2>&1 | grep -q -F -- '--timeout' 2> /dev/null; then
        cmdline="$cmdline rd.net.timeout.dhcp=3"
    fi

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -net nic,macaddr="$mac",model=e1000 \
        -net socket,connect=127.0.0.1:12320 \
        -watchdog i6300esb -watchdog-action poweroff \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.retry=10 quiet ro console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.testing

    # shellcheck disable=SC2181
    if [[ $? -ne 0 ]] || ! grep -U --binary-files=binary -F -m 1 -q nfs-OK "$TESTDIR"/marker.img; then
        echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
        return 1
    fi

    # nfsinfo=( server:/path nfs{,4} options )
    read -r -a nfsinfo < <(awk '{print $2, $3, $4; exit}' "$TESTDIR"/marker.img)

    if [[ ${nfsinfo[0]%%:*} != "$server" ]]; then
        echo "CLIENT TEST INFO: got server: ${nfsinfo[0]%%:*}"
        echo "CLIENT TEST INFO: expected server: $server"
        echo "CLIENT TEST END: $test_name [FAILED - WRONG SERVER]"
        return 1
    fi

    found=0
    expected=1
    if [[ ${check_opt:0:1} == '-' ]]; then
        expected=0
        check_opt=${check_opt:1}
    fi

    opts=${nfsinfo[2]},
    while [[ $opts ]]; do
        if [[ ${opts%%,*} == "$check_opt" ]]; then
            found=1
            break
        fi
        opts=${opts#*,}
    done

    if [[ $found -ne $expected ]]; then
        echo "CLIENT TEST INFO: got options: ${nfsinfo[2]%%:*}"
        if [[ $expected -eq 0 ]]; then
            echo "CLIENT TEST INFO: did not expect: $check_opt"
            echo "CLIENT TEST END: $test_name [FAILED - UNEXPECTED OPTION]"
        else
            echo "CLIENT TEST INFO: missing: $check_opt"
            echo "CLIENT TEST END: $test_name [FAILED - MISSING OPTION]"
        fi
        return 1
    fi

    echo "CLIENT TEST END: $test_name [OK]"
    return 0
}

test_nfsv3() {
    # MAC numbering scheme:
    # NFSv3: last octect starts at 0x00 and works up
    # NFSv4: last octect starts at 0x80 and works up

    client_test "NFSv3 root=dhcp DHCP path only" 52:54:00:12:34:00 \
        "root=dhcp" 192.168.50.1 -wsize=4096 || return 1

    if [[ "$(systemctl --version)" != *"systemd 230"* ]] 2> /dev/null; then
        client_test "NFSv3 Legacy root=/dev/nfs nfsroot=IP:path" 52:54:00:12:34:01 \
            "root=/dev/nfs nfsroot=192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1

        client_test "NFSv3 Legacy root=/dev/nfs DHCP path only" 52:54:00:12:34:00 \
            "root=/dev/nfs" 192.168.50.1 -wsize=4096 || return 1

        client_test "NFSv3 Legacy root=/dev/nfs DHCP IP:path" 52:54:00:12:34:01 \
            "root=/dev/nfs" 192.168.50.2 -wsize=4096 || return 1
    fi

    client_test "NFSv3 root=dhcp DHCP IP:path" 52:54:00:12:34:01 \
        "root=dhcp" 192.168.50.2 -wsize=4096 || return 1

    client_test "NFSv3 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:02 \
        "root=dhcp" 192.168.50.3 -wsize=4096 || return 1

    client_test "NFSv3 root=dhcp DHCP proto:IP:path:options" 52:54:00:12:34:03 \
        "root=dhcp" 192.168.50.3 wsize=4096 || return 1

    client_test "NFSv3 root=nfs:..." 52:54:00:12:34:04 \
        "root=nfs:192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1

    client_test "NFSv3 Bridge root=nfs:..." 52:54:00:12:34:04 \
        "root=nfs:192.168.50.1:/nfs/client bridge net.ifnames=0" 192.168.50.1 -wsize=4096 || return 1

    client_test "NFSv3 Legacy root=IP:path" 52:54:00:12:34:04 \
        "root=192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1

    # This test must fail: nfsroot= requires root=/dev/nfs
    client_test "NFSv3 Invalid root=dhcp nfsroot=/nfs/client" 52:54:00:12:34:04 \
        "root=dhcp nfsroot=/nfs/client failme rd.debug" 192.168.50.1 -wsize=4096 && return 1

    client_test "NFSv3 root=dhcp DHCP path,options" \
        52:54:00:12:34:05 "root=dhcp" 192.168.50.1 wsize=4096 || return 1

    client_test "NFSv3 Bridge Customized root=dhcp DHCP path,options" \
        52:54:00:12:34:05 "root=dhcp bridge=foobr0:enp0s1" 192.168.50.1 wsize=4096 || return 1

    client_test "NFSv3 root=dhcp DHCP IP:path,options" \
        52:54:00:12:34:06 "root=dhcp" 192.168.50.2 wsize=4096 || return 1

    client_test "NFSv3 root=dhcp DHCP proto:IP:path,options" \
        52:54:00:12:34:07 "root=dhcp" 192.168.50.3 wsize=4096 || return 1

    return 0
}

test_nfsv4() {
    # There is a mandatory 90 second recovery when starting the NFSv4
    # server, so put these later in the list to avoid a pause when doing
    # switch_root

    client_test "NFSv4 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:82 \
        "root=dhcp" 192.168.50.3 -wsize=4096 || return 1

    client_test "NFSv4 root=dhcp DHCP proto:IP:path:options" 52:54:00:12:34:83 \
        "root=dhcp" 192.168.50.3 wsize=4096 || return 1

    client_test "NFSv4 root=nfs4:..." 52:54:00:12:34:84 \
        "root=nfs4:192.168.50.1:/client" 192.168.50.1 \
        -wsize=4096 || return 1

    client_test "NFSv4 root=dhcp DHCP proto:IP:path,options" \
        52:54:00:12:34:87 "root=dhcp" 192.168.50.3 wsize=4096 || return 1

    return 0
}

test_run() {
    if [[ -s server.pid ]]; then
        kill -TERM "$(cat "$TESTDIR"/server.pid)"
        rm -f -- "$TESTDIR"/server.pid
    fi

    if ! run_server; then
        echo "Failed to start server" 1>&2
        return 1
    fi

    test_nfsv3 \
        && test_nfsv4

    ret=$?

    if [[ -s $TESTDIR/server.pid ]]; then
        kill -TERM "$(cat "$TESTDIR"/server.pid)"
        rm -f -- "$TESTDIR"/server.pid
    fi

    return $ret
}

test_setup() {
    export kernel=$KVERSION
    export srcmods="/lib/modules/$kernel/"
    # Detect lib paths

    rm -rf -- "$TESTDIR"/overlay
    (
        mkdir -p "$TESTDIR"/server/overlay/source
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/server/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh

        (
            cd "$initdir" || exit
            mkdir -p dev sys proc run etc var/run tmp var/lib/{dhcpd,rpcbind}
            mkdir -p var/lib/nfs/{v4recovery,rpc_pipefs}
            chmod 777 var/lib/rpcbind var/lib/nfs
        )

        inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
            dmesg mkdir cp ping exportfs \
            modprobe rpc.nfsd rpc.mountd showmount tcpdump \
            sleep mount chmod rm
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            if [ -f "${_terminfodir}"/l/linux ]; then
                inst_multiple -o "${_terminfodir}"/l/linux
                break
            fi
        done
        type -P portmap > /dev/null && inst_multiple portmap
        type -P rpcbind > /dev/null && inst_multiple rpcbind
        [ -f /etc/netconfig ] && inst_multiple /etc/netconfig
        type -P dhcpd > /dev/null && inst_multiple dhcpd
        [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
        instmods nfsd sunrpc ipv6 lockd af_packet
        inst ./server-init.sh /sbin/init
        inst_simple /etc/os-release
        inst ./hosts /etc/hosts
        inst ./exports /etc/exports
        inst ./dhcpd.conf /etc/dhcpd.conf
        inst_multiple -o {,/usr}/etc/nsswitch.conf {,/usr}/etc/rpc \
            {,/usr}/etc/protocols {,/usr}/etc/services
        inst_multiple rpc.idmapd /etc/idmapd.conf

        inst_libdir_file 'libnfsidmap_nsswitch.so*'
        inst_libdir_file 'libnfsidmap/*.so*'
        inst_libdir_file 'libnfsidmap*.so*'

        _nsslibs=$(
            cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
                | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \
                | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
        )
        _nsslibs=${_nsslibs#|}
        _nsslibs=${_nsslibs%|}
        inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'

        inst /etc/passwd /etc/passwd
        inst /etc/group /etc/group

        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
        dracut_kernel_post
    )

    # Make client root inside server root
    (
        # shellcheck disable=SC2030
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/server/overlay/source/nfs/client
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh

        (
            cd "$initdir" || exit
            mkdir -p dev sys proc etc run root usr var/lib/nfs/rpc_pipefs
        )

        inst_multiple sh shutdown poweroff stty cat ps ln ip dd \
            mount dmesg mkdir cp ping grep setsid ls vi less cat sync
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            if [ -f "${_terminfodir}"/l/linux ]; then
                inst_multiple -o "${_terminfodir}"/l/linux
                break
            fi
        done

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst ./client-init.sh /sbin/init
        inst_simple /etc/os-release
        inst_multiple -o {,/usr}/etc/nsswitch.conf
        inst /etc/passwd /etc/passwd
        inst /etc/group /etc/group

        inst_libdir_file 'libnfsidmap_nsswitch.so*'
        inst_libdir_file 'libnfsidmap/*.so*'
        inst_libdir_file 'libnfsidmap*.so*'

        _nsslibs=$(
            cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
                | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \
                | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
        )
        _nsslibs=${_nsslibs#|}
        _nsslibs=${_nsslibs%|}
        inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'

        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2030
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/server/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mkfs.ext3 poweroff cp umount sync dd
        inst_hook initqueue 01 ./create-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/server/overlay / \
        -m "bash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
        --nomdadmconf \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/server

    dd if=/dev/zero of="$TESTDIR"/server.img bs=1MiB count=80
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root

    # Invoke KVM and/or QEMU to actually create the target filesystem.
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1

    # Make an overlay with needed tools for the test harness
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir="$TESTDIR"/overlay
        mkdir -p "$TESTDIR"/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook emergency 000 ./hard-off.sh
        inst_simple ./client.link /etc/systemd/network/01-client.link
    )

    # Make client's dracut image
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -o "plymouth dash ${OMIT_NETWORK}" \
        -a "debug watchdog ${USE_NETWORK}" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1

    (
        # shellcheck disable=SC2031
        export initdir="$TESTDIR"/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        rm "$initdir"/etc/systemd/network/01-client.link
        inst_simple ./server.link /etc/systemd/network/01-server.link
        inst_hook pre-mount 99 ./wait-if-server.sh
    )
    # Make server's dracut image
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "dash udev-rules base rootfs-block fs-lib debug kernel-modules watchdog qemu network network-legacy" \
        -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 i6300esb" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1

    rm -rf -- "$TESTDIR"/overlay
}

test_cleanup() {
    if [[ -s $TESTDIR/server.pid ]]; then
        kill -TERM "$(cat "$TESTDIR"/server.pid)"
        rm -f -- "$TESTDIR"/server.pid
    fi
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
 070701000002BD000081A400000000000000000000000164DF2CB80000003D000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-20-NFS/wait-if-server.sh  #!/bin/sh
. /lib/net-lib.sh
wait_for_if_link enx525400123456
   070701000002BE000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/test/TEST-21-NFS-NM 070701000002BF000081A400000000000000000000000164DF2CB80000013A000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-21-NFS-NM/Makefile    .PHONY: all setup clean run

BASETEST=../TEST-20-NFS

all:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) all
setup:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) setup
clean:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) clean
run:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) run
  070701000002C0000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-30-ISCSI  070701000002C1000081A400000000000000000000000164DF2CB800000153000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-30-ISCSI/Makefile -include ../Makefile.testdir

ibft.table: Makefile ibft.pl
	perl ibft.pl \
		--initiator iqn=iqn.1994-05.com.redhat:633114aacf2 \
		--nic ip=192.168.50.101,prefix=24,gw=192.168.50.1,dns1=192.168.50.1,dhcp=192.168.50.1,mac=52:54:00:12:34:00,pci=00:03.0 \
		--target nic=0,ip=192.168.50.1,port=3260,lun=1,name=iqn.2009-06.dracut:target0 >$@
 070701000002C2000081ED00000000000000000000000164DF2CB80000026A000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-30-ISCSI/client-init.sh   #!/bin/sh
. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

export TERM=linux
export PS1='initramfs-test:\w\$ '
stty sane
echo "made it to the rootfs! Powering down."
while read -r dev _ fstype opts rest || [ -n "$dev" ]; do
    [ "$fstype" != "ext3" ] && continue
    echo "iscsi-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
    break
done < /proc/mounts

if getargbool 0 rd.shell; then
    strstr "$(setsid --help)" "control" && CTTY="-c"
    setsid $CTTY sh -i
fi

sync
poweroff -f
  070701000002C3000081A400000000000000000000000164DF2CB800000067000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-30-ISCSI/client.link  [Match]
OriginalName=*

[Link]
NamePolicy=keep kernel database onboard slot path
MACAddressPolicy=keep
 070701000002C4000081ED00000000000000000000000164DF2CB8000003D4000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-30-ISCSI/create-client-root.sh    #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
udevadm settle

set -ex

mkfs.ext3 -j -L singleroot -F /dev/disk/by-id/ata-disk_singleroot
mkdir -p /sysroot
mount /dev/disk/by-id/ata-disk_singleroot /sysroot
cp -a -t /sysroot /source/*
umount /sysroot
mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/disk/by-id/ata-disk_raid0-1 /dev/disk/by-id/ata-disk_raid0-2
mdadm -W /dev/md0 || :
lvm pvcreate -ff -y /dev/md0
lvm vgcreate dracut /dev/md0
lvm lvcreate -l 100%FREE -n root dracut
lvm vgchange -ay
mkfs.ext3 -j -L sysroot /dev/dracut/root
mount /dev/dracut/root /sysroot
cp -a -t /sysroot /source/*
umount /sysroot
lvm lvchange -a n /dev/dracut/root
echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
sync
poweroff -f
070701000002C5000081ED00000000000000000000000164DF2CB80000020A000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-30-ISCSI/create-server-root.sh    #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
udevadm settle

mkfs.ext3 -L dracut /dev/disk/by-id/ata-disk_root
mkdir -p /root
mount /dev/disk/by-id/ata-disk_root /root
cp -a -t /root /source/*
mkdir -p /root/run
umount /root
echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
poweroff -f
  070701000002C6000081A400000000000000000000000164DF2CB80000054E000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-30-ISCSI/dhcpd.conf   ddns-update-style none;

use-host-decl-names true;

subnet 192.168.50.0 netmask 255.255.255.0 {
	option subnet-mask      255.255.255.0;
	option routers          192.168.50.1;
	next-server             192.168.50.1;
	server-identifier       192.168.50.1;
	option domain-name-servers 192.168.50.1;
	option domain-search "example.com";
	option domain-name "other.com";

	# MAC numbering scheme:
	# NFSv3: last octect starts at 0x00 and works up

	group {
		option root-path "iscsi:192.168.50.1:::1:iqn.2009-06.dracut:target0";

		host iscsi-1 {
			hardware ethernet 52:54:00:12:34:00;
			fixed-address 192.168.50.101;
		}
	}
}

subnet 192.168.51.0 netmask 255.255.255.0 {
        option subnet-mask      255.255.255.0;
        option routers          192.168.51.1;
        next-server             192.168.51.1;
        server-identifier       192.168.51.1;
        option domain-name-servers 192.168.51.1;
        option domain-search "example.com";
        option domain-name "other.com";

        # MAC numbering scheme:
        # NFSv3: last octect starts at 0x00 and works up

        group {
                #option root-path "iscsi:192.168.51.1:::1:iqn.2009-06.dracut:target1";

                host iscsi-2 {
                        hardware ethernet 52:54:00:12:34:01;
                        fixed-address 192.168.51.101;
                }

        }
}
  070701000002C7000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/test/TEST-30-ISCSI/finished-false.sh    #!/bin/sh
exit 1
   070701000002C8000081ED00000000000000000000000164DF2CB800000052000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-30-ISCSI/hard-off.sh  #!/bin/sh
getargbool 0 rd.shell || poweroff -f
getargbool 0 failme && poweroff -f
  070701000002C9000081A400000000000000000000000164DF2CB8000000CC000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-30-ISCSI/hosts    127.0.0.1	localhost
192.168.50.1	server
192.168.50.2	server-ip
192.168.50.3	server-proto-ip
192.168.50.100	workstation1
192.168.50.101	workstation2
192.168.50.102	workstation3
192.168.50.103	workstation4
070701000002CA000081A400000000000000000000000164DF2CB800002F8B000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/test/TEST-30-ISCSI/ibft.pl  #!/usr/bin/perl
# SPDX-License-Identifier: GPL-2.0+
#
# iBFT ACPI table generator
# $ perldoc ibft.pl if you'd like to read the manual, poor you:

=head1 NAME

ibft.pl - Generate iBFT ACPI table

=head1 SYNOPSIS

ibft.pl
[--oemid <oemid>]
[--tableid <tableid>
[--initiator isns=<ip>,slp=<ip>,radius1=<ip>,radius2=<ip>,iqn=<iqn>]
[--nic ip=<ip>[,prefix=<prefix>][,gw=<ip>][,dns1=<ip>][,dns2=<ip>][,dhcp=<ip>][,vlan=<id>][,mac=<mac>][,pci=<pci>][,hostname=<hostname>] ...]
[--target ip=<ip>[,port=<port>][,lun=<lun>][,name=<iqn> ...]

=head1 DESCRIPTION

B<ibft.pl> creates an image of iBFT ACPI table similar to what a real network
boot firmware would do. This is mainly useful for testing.

=head1 OPTIONS

=over 4

=item B<< --oemid <oemid> >>

Create a table with a particular OEM ID, limited to 6 characters.
It generally doesn't matter.

Defaults to I<DRACUT>.

=item B<< --tableid <tableid> >>

Create a table with a particular OEM Table ID.

Defaults to I<TEST>, but any four-letter word would do. Any.

=item B<< --initiator >>

Configure the Initiator Structure.
Following parameters are supported:

=over 4

=item B<< isns=<ip> >>

iSNS server address.

=item B<< slp=<ip> >>

SLP server address.

=item B<< radius1=<ip> >>, B<< radius2=<ip> >>

Primary and secondary Radius server addresses.

=item B<< iqn=<iqn> >>

Override the IQN, which defaults to I<iqn.2009-06.dracut:initiator0>.

=back

=item B<< --nic >>

Configure a NIC Structure. This option can be used up multiple times.

Following parameters are supported:

=over 4

=item B<< ip=<ip> >>

Set the IP address. Both I<AF_INET> and I<AF_INET6> families are supported.
This parameter is mandatory.

=item B<< prefix=<prefix> >>

Set the IP address prefix. You generally also want to set this in order to
get a sensible iBFT.

=item B<< gw=<ip> >>

Set the gateway IP address.

=item B<< dns1=<ip> >>, B<< dns2=<ip> >>

Set the domain service server addresses.

=item B<< dhcp=<ip> >>

Specify the address of the DHCP server in case dynamic configuration is used.

=item B<< vlan=<id> >>

The VLAN Id. Duh.

=item B<< mac=<mac> >>

Specify the ethernet hardware address, in form of six colon-delimited
hexadecimal octets.

=item B<< pci=<pci> >>

Specify the ethernet hardware's PCI bus location, in form of
B<< <bus> >>:B<< <device> >>.B<< <function> >> where the numbers are in
hexadecimal.

=item B<< hostname=<hostname> >>

The host name. Defaults to B<client>.

=back

=item B<< --target >>

Configure a Target Structure. This option can be used multiple times.

Following parameters are supported:

=over 4

=item B<< ip=<ip> >>

The iSCSI target IP address.

=item B<< port=<port> >>

The iSCSI TCP port, in case the default of I<3260> is not good enough for
you.

=item B<< lun=<1> >>

The LUN number. Defaults to I<1> no less.

=item B<< name=<iqn> >>

The iSCSI volume name. Defaults to I<iqn.2009-06.dracut:target0> for the first
target, I<iqn.2009-06.dracut:target1> for the second one.

=back

=back

=cut

use strict;
use warnings;

sub ip4 {
	shift =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/
		or die 'not an INET address';
	return (map { 0x00 } 0..9), 0xff, 0xff, $1, $2, $3, $4;
}

sub ip6
{
	my ($beg, $end) = map { [ map { /^([0-9a-fA-F]{0,2}?)([0-9a-fA-F]{1,2})$/
		? (hex $1, hex $2)
		: die "'$_' not valid in a INET6 address"
	} split /:/ ] } split /::/, shift;

	$beg ||= [];
	$end ||= [];

	my $fill = 16 - scalar @$beg + scalar@$end;
	die 'INET6 address too long' if $fill < 0;

	@$beg, (map { 0 } 1..$fill), @$end;
}

sub ip
{
	my @val;
	@val = eval { @val = ip6 ($_[0]) };
	@val = eval { @val = ip4 ($_[0]) } unless @val;
	die "Saatana: $_[0] is not an INET or INET6 address" unless @val;

	return pack 'C16', @val;
}

sub mac
{
	return pack 'C8', map { hex $_ } split /:/, shift;
}

sub pci
{
	shift =~ /^([0-9a-fA-F]{1,2}?):([0-9a-fA-F]{1,2})\.([0-9a-fA-F]+)$/
		or die 'Not a PCI address';
	return (hex $1) << 8 | (hex $2) << 3 | (hex $3);
}

sub lun
{
	return pack 'C8', 0, shift, 0, 0, 0, 0, 0, 0;
}

# signature, length, revision, checksum, oem_id, oem_table_id, reserved
sub pack_table_hdr { pack 'a4 V C C a6 a8 a24  x![C8]', @_ }

# id, version, length, index, flags
# extensions, initiator_off, nic0_off, tgt0_off, nic1_off, tgt1_off, ext*
sub pack_control { pack 'C C S C C  S  S  S S  S S  S*  x![C8]', @_ }

# id, version, length, index, flags
# isns_adr, slp_adr, radius1_adr, radius2_adr, iqn_len, iqn_off
sub pack_initiator { pack 'C C S C C  a16 a16 a16 a16 SS  x![C8]', @_ }

# id, version, length, index, flags
# adr, prefix, origin, gw, dns1, dns2, dhcp, vlan_id, mac, pci_bdf, hostname_len, hostname_off
sub pack_nic { $_[5] ? pack 'C C S C C  a16 C C a16 a16 a16 a16 S a6 S SS  x![C8]', @_ : '' }

# id, version, length, index, flags
# tgt_adr, tgt_port, tgt_lun, chap_type, nic_id, tgt_len, tgt_off,
# chap_name_len, chap_name_off, chap_secret_len, chap_secret_off
# rchap_name_len, rchap_name_off, rchap_secret_len, rchap_secret_off
sub pack_tgt { $_[5] ? pack 'C C S C C  a16 S a8 C C SS SS SS SS SS  x![C8]', @_ : '' };

# str
sub pack_str { pack 'Z*', @_ }

# Initialize some defaults
my @table_hdr = ('iBFT', 0000, 1, 0000, 'DRACUT', 'TEST', '');
my @control = (1, 1, 18, 0, 0, 0000, 0000, 0000, 0000, 0000, 0000);
my @initiator = (2, 1, 74, 0, 0x03, '', '', '', '', (0000, 0000));
my @nics;
my @tgts;
my $iqn = 'iqn.2009-06.dracut:initiator0';
my @hostnames;
my @tgt_names;

while (@ARGV) {
	my $arg = shift @ARGV;
	die "Saatana: $arg is missing an argument" unless @ARGV;

	if ($arg eq '--oemid') {
		$table_hdr[4] = shift @ARGV;
	} elsif ($arg eq '--tableid') {
		$table_hdr[5] = shift @ARGV;
	} elsif ($arg eq '--initiator') {
		my %val = split /[,=]/, shift @ARGV;
		$initiator[5] = ip (delete $val{isns}) if exists $val{isns};
		$initiator[6] = ip (delete $val{slp}) if exists $val{slp};
		$initiator[7] = ip (delete $val{radius1}) if exists $val{radius1};
		$initiator[8] = ip (delete $val{radius2}) if exists $val{radius2};
		$iqn = delete $val{iqn} if exists $val{iqn};
		die "Saatana: Extra arguments to --initiator: ".join (', ', %val) if %val;
	} elsif ($arg eq '--nic') {
		my @nic = (3, 1, 102, 0, 0x03,
			undef, 0, 0x01, '', '', '', '', 0, '', 0, (0000, 0000));
		push @nics, \@nic;

		my %val = split /[,=]/, shift @ARGV;
		die 'Saatana: --nic needs an ip' unless exists $val{ip};
		$nic[3] = $#nics;
		$nic[5] = ip (delete $val{ip});
		$nic[6] = delete $val{prefix} if exists $val{prefix};
		$nic[7] = 0x03 if exists $val{dhcp};
		$nic[8] = ip (delete $val{gw}) if exists $val{gw};
		$nic[9] = ip (delete $val{dns1}) if exists $val{dns1};
		$nic[10] = ip (delete $val{dns2}) if exists $val{dns2};
		$nic[11] = ip (delete $val{dhcp}) if exists $val{dhcp};
		$nic[12] = delete $val{vlan} if exists $val{vlan};
		$nic[13] = mac (delete $val{mac}) if exists $val{mac};
		$nic[14] = pci (delete $val{pci}) if exists $val{pci};
		$hostnames[$#nics] = exists $val{hostname} ? delete $val{hostname} : 'client';
		$hostnames[$#nics] = pack_str $hostnames[$#nics];
		die "Saatana: Extra arguments to --nic: ".join (', ', %val) if %val;

		# Allocate an control expansion entry
		if ($#nics > 1) {
			$control[2] += 2;
			push @control, (0x4444);
		}
	} elsif ($arg eq '--target') {
		my @tgt = (4, 1, 54, 0, 0x03,
			undef, 3260, lun (1), 0, 0,
			(0000, 0000),
			(0000, 0000),
			(0000, 0000),
			(0000, 0000),
			(0000, 0000));
		push @tgts, \@tgt;

		my %val = split /[,=]/, shift @ARGV;
		die 'Saatana: --target needs an ip' unless exists $val{ip};
		$tgt[3] = $#tgts;
		$tgt[5] = ip (delete $val{ip}) if exists $val{ip};
		$tgt[6] = delete $val{port} if exists $val{port};
		$tgt[7] = lun (delete $val{lun}) if exists $val{lun};
		$tgt[9] = delete $val{nic} if exists $val{nic};
		$tgt_names[$#tgts] = exists $val{name} ? delete $val{name}
			: 'iqn.2009-06.dracut:target'.$#tgts;
		$tgt_names[$#tgts] = pack_str $tgt_names[$#tgts];
		die "Saatana: Extra arguments to --target: ".join (', ', %val) if %val;

		# Allocate an control expansion entry if necessary
		if ($#tgts > 1) {
			$control[2] += 2;
			push @control, (0x1111);
		}
	} else {
		die "Saatana: Unknown argument: $arg";
	}
}

# Pass 1
my $table_hdr = pack_table_hdr @table_hdr;
my $control = pack_control @control;
my $initiator = pack_initiator @initiator;
my @packed_nics = map { pack_nic @$_ } @nics;
my @packed_tgts = map { pack_tgt @$_ } @tgts;
$iqn = pack_str $iqn;


# Resolve the offsets
my $len = 0;
$len += length $table_hdr;
$len += length $control;
$control[6] = $len;
$len += length $initiator;

for my $i (0..$#packed_nics) {
	if ($i == 0) {
		# NIC 0
		$control[7] = $len;
	} elsif ($i == 1) {
		# NIC 1
		$control[9] = $len;
	} else {
		# Expansion
		$control[11 + $i - 2] = $len;
	}
	$len += length $packed_nics[$i];
}

for my $i (0..$#packed_tgts) {
	if ($i == 0) {
		# Target 0
		$control[8] = $len;
	} elsif ($i == 1) {
		# Target 1
		$control[10] = $len;
	} else {
		# Expansion
		$control[11 + scalar @packed_nics - 2 + $i - 2] = $len;
	}
	$len += length $packed_tgts[$i];
}

$initiator[9] = -1 + length $iqn;
$initiator[10] = $len;
$len += length $iqn;

for my $i (0..$#hostnames) {
	$nics[$i]->[15] = -1 + length $hostnames[$i];
	$nics[$i]->[16] = $len;
	$len += length $hostnames[$i];
}

for my $i (0..$#tgt_names) {
	$tgts[$i]->[10] = -1 + length $tgt_names[$i];
	$tgts[$i]->[11] = $len;
	$len += length $tgt_names[$i];
}

@table_hdr[1] = $len;

# Pass 2, with the offsets resolved
$table_hdr = pack_table_hdr @table_hdr;
$control = pack_control @control;
$initiator = pack_initiator @initiator;
@packed_nics = map { pack_nic @$_ } @nics;
@packed_tgts = map { pack_tgt @$_ } @tgts;

# Pass 3, calculate checksum
my $cksum = 0xff;
$cksum += ord $_ foreach split //, join '', $table_hdr, $control, $initiator,
	@packed_nics, @packed_tgts, $iqn, @hostnames, @tgt_names;
$cksum = ~$cksum & 0xff;
$table_hdr[3] = $cksum;
$table_hdr = pack_table_hdr @table_hdr;

# Puke stuff out
print $table_hdr;
print $control;
print $initiator;
print @packed_nics;
print @packed_tgts;
print $iqn;
print @hostnames;
print @tgt_names;

=head1 EXAMPLES

=over

=item B<< perl ibft.pl --oemid FENSYS --tableid iPXE --nic ip=192.168.50.101,prefix=24,gw=192.168.50.1,dns1=192.168.50.1,dhcp=192.168.50.1,vlan=0,mac=52:54:00:12:34:00,pci=00:02.0,hostname=iscsi-1 --target ip=192.168.50.1 >ibft.img >>

Generate an iBFT image with a single NIC while pretending we're iPXE for
no good reason.

=item B<<perl ibft.pl --initiator iqn=iqn.1994-05.com.redhat:633114aacf2 --nic ip=192.168.50.101,prefix=24,gw=192.168.50.1,dns1=192.168.50.1,dhcp=192.168.50.1,mac=52:54:00:12:34:00,pci=00:03.0 --nic ip=192.168.51.101,prefix=24,gw=192.168.51.1,dns1=192.168.51.1,dhcp=192.168.51.1,mac=52:54:00:12:34:01,pci=00:04.0 --target ip=192.168.50.1,port=3260,lun=1,name=iqn.2009-06.dracut:target0 --target ip=192.168.51.1,port=3260,lun=2,name=iqn.2009-06.dracut:target1 >ibft.img >>

Generate an iBFT image for two NICs while being slightly more expressive
than necessary.

=item B<qemy-system-x86_64 -acpitable file=ibft.img>

Use the image with QEMU.

=back

=head1 BUGS

No support for CHAP secrets.

=head1 SEE ALSO

=over 4

=item L<qemu(1)>,

=item L<iSCSI Boot Firmware Table (iBFT)|ftp://ftp.software.ibm.com/systems/support/bladecenter/iscsi_boot_firmware_table_v1.03.pdf>,

=item L<NL_PREFIX_ORIGIN Enumeration|https://docs.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_prefix_origin>

=back

=head1 COPYRIGHT

Copyright (C) 2019 Lubomir Rintel

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

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

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

=head1 AUTHOR

Lubomir Rintel C<lkundrak@v3.sk>

=cut

# Forgive me.
# This would have been much easier with FORTH.
 070701000002CB000081A400000000000000000000000164DF2CB80000017D000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-30-ISCSI/ibft.table   iBFT}  DRACUTTEST                                 H             J                                                                  " 8      f            2e          2          2                          2  RT 4   [  6            2          b                  iqn.1994-05.com.redhat:633114aacf2 client iqn.2009-06.dracut:target0    070701000002CC000081ED00000000000000000000000164DF2CB80000096A000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-30-ISCSI/server-init.sh   #!/bin/sh
exec < /dev/console > /dev/console 2>&1
set -x
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
export TERM=linux
export PS1='server:\w\$ '
stty sane
echo "made it to the rootfs!"
echo server > /proc/sys/kernel/hostname

wait_for_if_link() {
    local cnt=0
    local li
    while [ $cnt -lt 600 ]; do
        li=$(ip -o link show dev "$1" 2> /dev/null)
        [ -n "$li" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_if_up() {
    local cnt=0
    local li
    while [ $cnt -lt 200 ]; do
        li=$(ip -o link show up dev "$1")
        [ -n "$li" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_route_ok() {
    local cnt=0
    while [ $cnt -lt 200 ]; do
        li=$(ip route show)
        [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

linkup() {
    wait_for_if_link "$1" 2> /dev/null && ip link set "$1" up 2> /dev/null && wait_for_if_up "$1" 2> /dev/null
}

wait_for_if_link enx525400123456
wait_for_if_link enx525400123457

ip addr add 127.0.0.1/8 dev lo
ip link set lo up

ip addr add 192.168.50.1/24 dev enx525400123456
linkup enx525400123456

ip addr add 192.168.51.1/24 dev enx525400123457
linkup enx525400123457

modprobe af_packet

: > /var/lib/dhcpd/dhcpd.leases
chmod 777 /var/lib/dhcpd/dhcpd.leases
dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases &

tgtd
tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2009-06.dracut:target0
tgtadm --lld iscsi --mode target --op new --tid 2 --targetname iqn.2009-06.dracut:target1
tgtadm --lld iscsi --mode target --op new --tid 3 --targetname iqn.2009-06.dracut:target2
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/disk/by-id/ata-disk_singleroot
tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/disk/by-id/ata-disk_raid0-1
tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/disk/by-id/ata-disk_raid0-2
tgtadm --lld iscsi --mode target --op bind --tid 1 -I 192.168.50.101
tgtadm --lld iscsi --mode target --op bind --tid 2 -I 192.168.51.101
tgtadm --lld iscsi --mode target --op bind --tid 3 -I 192.168.50.101

# Wait forever for the VM to die
echo "Serving iSCSI"
while pidof tgtd > /dev/null; do
    : > /dev/watchdog
    dmesg -c
    sleep 1
done
dmesg -c
mount -n -o remount,ro /
poweroff -f
  070701000002CD000081A400000000000000000000000164DF2CB800000044000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-30-ISCSI/server.link  [Match]
OriginalName=*

[Link]
NamePolicy=mac
MACAddressPolicy=keep
070701000002CE000081ED00000000000000000000000164DF2CB800003368000000000000000000000000000000000000003900000000dracut-055+suse.347.gdcb9bdbf/test/TEST-30-ISCSI/test.sh  #!/bin/bash

if [[ $NM ]]; then
    USE_NETWORK="network-manager"
    OMIT_NETWORK="network-legacy"
else
    USE_NETWORK="network-legacy"
    OMIT_NETWORK="network-manager"
fi

# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem over iSCSI with $USE_NETWORK"

KVERSION=${KVERSION-$(uname -r)}

DEBUGFAIL="loglevel=1"
#DEBUGFAIL="rd.shell rd.break rd.debug loglevel=7 "
DEBUGFAIL="rd.debug loglevel=7 "
#SERVER_DEBUG="rd.debug loglevel=7"
#SERIAL="tcp:127.0.0.1:9999"

run_server() {
    # Start server first
    echo "iSCSI TEST SETUP: Starting DHCP/iSCSI server"

    declare -a disk_args=()
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img serverroot 1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/singleroot.img singleroot
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -serial "${SERIAL:-"file:$TESTDIR/server.log"}" \
        -net nic,macaddr=52:54:00:12:34:56,model=e1000 \
        -net nic,macaddr=52:54:00:12:34:57,model=e1000 \
        -net socket,listen=127.0.0.1:12330 \
        -append "panic=1 oops=panic softlockup_panic=1 quiet root=/dev/disk/by-id/ata-disk_serverroot rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \
        -initrd "$TESTDIR"/initramfs.server \
        -pidfile "$TESTDIR"/server.pid -daemonize || return 1
    chmod 644 "$TESTDIR"/server.pid || return 1

    # Cleanup the terminal if we have one
    tty -s && stty sane

    if ! [[ $SERIAL ]]; then
        while :; do
            grep Serving "$TESTDIR"/server.log && break
            echo "Waiting for the server to startup"
            tail "$TESTDIR"/server.log
            sleep 1
        done
    else
        echo Sleeping 10 seconds to give the server a head start
        sleep 10
    fi

}

run_client() {
    local test_name=$1
    shift
    echo "CLIENT TEST START: $test_name"

    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -net nic,macaddr=52:54:00:12:34:00,model=e1000 \
        -net nic,macaddr=52:54:00:12:34:01,model=e1000 \
        -net socket,connect=127.0.0.1:12330 \
        -acpitable file=ibft.table \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 rd.shell=0 $DEBUGFAIL $*" \
        -initrd "$TESTDIR"/initramfs.testing

    # shellcheck disable=SC2181
    if [[ $? -ne 0 ]] || ! grep -U --binary-files=binary -F -m 1 -q iscsi-OK "$TESTDIR"/marker.img; then
        echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
        return 1
    fi

    echo "CLIENT TEST END: $test_name [OK]"
    return 0
}

do_test_run() {
    initiator=$(iscsi-iname)

    run_client "root=dhcp" \
        "root=/dev/root netroot=dhcp ip=enp0s1:dhcp" \
        "rd.iscsi.initiator=$initiator" \
        || return 1

    run_client "netroot=iscsi target0" \
        "root=LABEL=singleroot netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \
        "ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:enp0s1:off" \
        "rd.iscsi.initiator=$initiator" \
        || return 1

    run_client "netroot=iscsi target1 target2" \
        "root=LABEL=sysroot" \
        "ip=dhcp" \
        "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
        "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
        "rd.iscsi.initiator=$initiator" \
        || return 1

    run_client "root=ibft" \
        "root=LABEL=singleroot" \
        "rd.iscsi.ibft=1" \
        "rd.iscsi.firmware=1" \
        || return 1

    echo "All tests passed [OK]"
    return 0
}

test_run() {
    if ! run_server; then
        echo "Failed to start server" 1>&2
        return 1
    fi
    do_test_run
    ret=$?
    if [[ -s $TESTDIR/server.pid ]]; then
        kill -TERM "$(cat "$TESTDIR"/server.pid)"
        rm -f -- "$TESTDIR"/server.pid
    fi
    return $ret
}

test_setup() {
    if ! command -v tgtd &> /dev/null || ! command -v tgtadm &> /dev/null; then
        echo "Need tgtd and tgtadm from scsi-target-utils"
        return 1
    fi

    kernel=$KVERSION
    # Create what will eventually be our root filesystem onto an overlay
    rm -rf -- "$TESTDIR"/overlay
    (
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        (
            cd "$initdir" || exit
            mkdir -p -- dev sys proc etc var/run tmp
            mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
            mkdir -p -- var/lib/nfs/rpc_pipefs
        )
        inst_multiple sh shutdown poweroff stty cat ps ln ip \
            mount dmesg mkdir cp ping grep setsid dd sync
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux
        inst_simple /etc/os-release

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst ./client-init.sh /sbin/init
        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mkfs.ext3 poweroff cp umount setsid dd sync blockdev
        inst_hook initqueue 01 ./create-client-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/overlay

    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    dd if=/dev/zero of="$TESTDIR"/singleroot.img bs=1MiB count=200
    dd if=/dev/zero of="$TESTDIR"/raid0-1.img bs=1MiB count=100
    dd if=/dev/zero of="$TESTDIR"/raid0-2.img bs=1MiB count=100

    declare -a disk_args=()
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/singleroot.img singleroot
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2

    # Invoke KVM and/or QEMU to actually create the target filesystem.
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/fakeroot rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1
    rm -- "$TESTDIR"/marker.img

    # shellcheck disable=SC2031
    export kernel=$KVERSION
    rm -rf -- "$TESTDIR"/overlay
    (
        mkdir -p "$TESTDIR"/overlay/source
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        (
            cd "$initdir" || exit
            mkdir -p dev sys proc etc var/run tmp var/lib/dhcpd /etc/iscsi
        )
        inst /etc/passwd /etc/passwd
        inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
            dmesg mkdir cp ping modprobe tcpdump setsid \
            sleep mount chmod pidof
        inst_multiple tgtd tgtadm
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux
        instmods iscsi_tcp crc32c ipv6 af_packet
        [ -f /etc/netconfig ] && inst_multiple /etc/netconfig
        type -P dhcpd > /dev/null && inst_multiple dhcpd
        [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
        inst ./server-init.sh /sbin/init
        inst ./hosts /etc/hosts
        inst ./dhcpd.conf /etc/dhcpd.conf
        inst_multiple -o {,/usr}/etc/nsswitch.conf {,/usr}/etc/rpc \
            {,/usr}/etc/protocols {,/usr}/etc/services \
            /etc/group /etc/os-release

        _nsslibs=$(
            cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
                | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \
                | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
        )
        _nsslibs=${_nsslibs#|}
        _nsslibs=${_nsslibs%|}

        inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'

        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
        dracut_kernel_post
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mkfs.ext3 poweroff cp umount sync dd
        inst_hook initqueue 01 ./create-server-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
        --nomdadmconf \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/overlay

    dd if=/dev/zero of="$TESTDIR"/server.img bs=1MiB count=60
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root

    # Invoke KVM and/or QEMU to actually create the target filesystem.
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1
    rm -- "$TESTDIR"/marker.img

    # Make an overlay with needed tools for the test harness
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook emergency 000 ./hard-off.sh
        inst_simple ./client.link /etc/systemd/network/01-client.link
    )
    # Make client's dracut image
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -o "dash plymouth dmraid nfs ${OMIT_NETWORK}" \
        -a "debug ${USE_NETWORK}" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1

    (
        # shellcheck disable=SC2031
        export initdir="$TESTDIR"/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        rm "$initdir"/etc/systemd/network/01-client.link
        inst_simple ./server.link /etc/systemd/network/01-server.link
        inst_hook pre-mount 99 ./wait-if-server.sh
    )
    # Make server's dracut image
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -a "dash udev-rules base rootfs-block fs-lib debug kernel-modules network network-legacy" \
        -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 drbg" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1

    rm -rf -- "$TESTDIR"/overlay
}

test_cleanup() {
    if [[ -s $TESTDIR/server.pid ]]; then
        kill -TERM "$(cat "$TESTDIR"/server.pid)"
        rm -f -- "$TESTDIR"/server.pid
    fi
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
070701000002CF000081A400000000000000000000000164DF2CB80000005E000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/test/TEST-30-ISCSI/wait-if-server.sh    #!/bin/sh
. /lib/net-lib.sh
wait_for_if_link enx525400123456
wait_for_if_link enx525400123457
  070701000002D0000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/test/TEST-31-ISCSI-NM   070701000002D1000081A400000000000000000000000164DF2CB80000013C000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-31-ISCSI-NM/Makefile  .PHONY: all setup clean run

BASETEST=../TEST-30-ISCSI

all:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) all
setup:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) setup
clean:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) clean
run:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) run
070701000002D2000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-35-ISCSI-MULTI    070701000002D3000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-35-ISCSI-MULTI/Makefile   -include ../Makefile.testdir
   070701000002D4000081ED00000000000000000000000164DF2CB80000026A000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/test/TEST-35-ISCSI-MULTI/client-init.sh #!/bin/sh
. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

export TERM=linux
export PS1='initramfs-test:\w\$ '
stty sane
echo "made it to the rootfs! Powering down."
while read -r dev _ fstype opts rest || [ -n "$dev" ]; do
    [ "$fstype" != "ext3" ] && continue
    echo "iscsi-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
    break
done < /proc/mounts

if getargbool 0 rd.shell; then
    strstr "$(setsid --help)" "control" && CTTY="-c"
    setsid $CTTY sh -i
fi

sync
poweroff -f
  070701000002D5000081A400000000000000000000000164DF2CB800000067000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/test/TEST-35-ISCSI-MULTI/client.link    [Match]
OriginalName=*

[Link]
NamePolicy=keep kernel database onboard slot path
MACAddressPolicy=keep
 070701000002D6000081ED00000000000000000000000164DF2CB8000003D4000000000000000000000000000000000000004D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-35-ISCSI-MULTI/create-client-root.sh  #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
udevadm settle

set -ex

mkfs.ext3 -j -L singleroot -F /dev/disk/by-id/ata-disk_singleroot
mkdir -p /sysroot
mount /dev/disk/by-id/ata-disk_singleroot /sysroot
cp -a -t /sysroot /source/*
umount /sysroot
mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/disk/by-id/ata-disk_raid0-1 /dev/disk/by-id/ata-disk_raid0-2
mdadm -W /dev/md0 || :
lvm pvcreate -ff -y /dev/md0
lvm vgcreate dracut /dev/md0
lvm lvcreate -l 100%FREE -n root dracut
lvm vgchange -ay
mkfs.ext3 -j -L sysroot /dev/dracut/root
mount /dev/dracut/root /sysroot
cp -a -t /sysroot /source/*
umount /sysroot
lvm lvchange -a n /dev/dracut/root
echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
sync
poweroff -f
070701000002D7000081ED00000000000000000000000164DF2CB80000020A000000000000000000000000000000000000004D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-35-ISCSI-MULTI/create-server-root.sh  #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
udevadm settle

mkfs.ext3 -L dracut /dev/disk/by-id/ata-disk_root
mkdir -p /root
mount /dev/disk/by-id/ata-disk_root /root
cp -a -t /root /source/*
mkdir -p /root/run
umount /root
echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
poweroff -f
  070701000002D8000081A400000000000000000000000164DF2CB80000054E000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/test/TEST-35-ISCSI-MULTI/dhcpd.conf ddns-update-style none;

use-host-decl-names true;

subnet 192.168.50.0 netmask 255.255.255.0 {
	option subnet-mask      255.255.255.0;
	option routers          192.168.50.1;
	next-server             192.168.50.1;
	server-identifier       192.168.50.1;
	option domain-name-servers 192.168.50.1;
	option domain-search "example.com";
	option domain-name "other.com";

	# MAC numbering scheme:
	# NFSv3: last octect starts at 0x00 and works up

	group {
		option root-path "iscsi:192.168.50.1:::1:iqn.2009-06.dracut:target0";

		host iscsi-1 {
			hardware ethernet 52:54:00:12:34:00;
			fixed-address 192.168.50.101;
		}
	}
}

subnet 192.168.51.0 netmask 255.255.255.0 {
        option subnet-mask      255.255.255.0;
        option routers          192.168.51.1;
        next-server             192.168.51.1;
        server-identifier       192.168.51.1;
        option domain-name-servers 192.168.51.1;
        option domain-search "example.com";
        option domain-name "other.com";

        # MAC numbering scheme:
        # NFSv3: last octect starts at 0x00 and works up

        group {
                #option root-path "iscsi:192.168.51.1:::1:iqn.2009-06.dracut:target1";

                host iscsi-2 {
                        hardware ethernet 52:54:00:12:34:01;
                        fixed-address 192.168.51.101;
                }

        }
}
  070701000002D9000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/test/TEST-35-ISCSI-MULTI/finished-false.sh  #!/bin/sh
exit 1
   070701000002DA000081ED00000000000000000000000164DF2CB800000052000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/test/TEST-35-ISCSI-MULTI/hard-off.sh    #!/bin/sh
getargbool 0 rd.shell || poweroff -f
getargbool 0 failme && poweroff -f
  070701000002DB000081A400000000000000000000000164DF2CB8000000CC000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-35-ISCSI-MULTI/hosts  127.0.0.1	localhost
192.168.50.1	server
192.168.50.2	server-ip
192.168.50.3	server-proto-ip
192.168.50.100	workstation1
192.168.50.101	workstation2
192.168.50.102	workstation3
192.168.50.103	workstation4
070701000002DC000081ED00000000000000000000000164DF2CB80000096A000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/test/TEST-35-ISCSI-MULTI/server-init.sh #!/bin/sh
exec < /dev/console > /dev/console 2>&1
set -x
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
export TERM=linux
export PS1='server:\w\$ '
stty sane
echo "made it to the rootfs!"
echo server > /proc/sys/kernel/hostname

wait_for_if_link() {
    local cnt=0
    local li
    while [ $cnt -lt 600 ]; do
        li=$(ip -o link show dev "$1" 2> /dev/null)
        [ -n "$li" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_if_up() {
    local cnt=0
    local li
    while [ $cnt -lt 200 ]; do
        li=$(ip -o link show up dev "$1")
        [ -n "$li" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_route_ok() {
    local cnt=0
    while [ $cnt -lt 200 ]; do
        li=$(ip route show)
        [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

linkup() {
    wait_for_if_link "$1" 2> /dev/null && ip link set "$1" up 2> /dev/null && wait_for_if_up "$1" 2> /dev/null
}

wait_for_if_link enx525400123456
wait_for_if_link enx525400123457

ip addr add 127.0.0.1/8 dev lo
ip link set lo up

ip addr add 192.168.50.1/24 dev enx525400123456
linkup enx525400123456

ip addr add 192.168.51.1/24 dev enx525400123457
linkup enx525400123457

modprobe af_packet

: > /var/lib/dhcpd/dhcpd.leases
chmod 777 /var/lib/dhcpd/dhcpd.leases
dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases &

tgtd
tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2009-06.dracut:target0
tgtadm --lld iscsi --mode target --op new --tid 2 --targetname iqn.2009-06.dracut:target1
tgtadm --lld iscsi --mode target --op new --tid 3 --targetname iqn.2009-06.dracut:target2
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/disk/by-id/ata-disk_singleroot
tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/disk/by-id/ata-disk_raid0-1
tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/disk/by-id/ata-disk_raid0-2
tgtadm --lld iscsi --mode target --op bind --tid 1 -I 192.168.50.101
tgtadm --lld iscsi --mode target --op bind --tid 2 -I 192.168.51.101
tgtadm --lld iscsi --mode target --op bind --tid 3 -I 192.168.50.101

# Wait forever for the VM to die
echo "Serving iSCSI"
while pidof tgtd > /dev/null; do
    : > /dev/watchdog
    dmesg -c
    sleep 1
done
dmesg -c
mount -n -o remount,ro /
poweroff -f
  070701000002DD000081A400000000000000000000000164DF2CB800000044000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/test/TEST-35-ISCSI-MULTI/server.link    [Match]
OriginalName=*

[Link]
NamePolicy=mac
MACAddressPolicy=keep
070701000002DE000081ED00000000000000000000000164DF2CB800003762000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-35-ISCSI-MULTI/test.sh    #!/bin/bash

if [[ $NM ]]; then
    USE_NETWORK="network-manager"
    OMIT_NETWORK="network-legacy"
else
    USE_NETWORK="network-legacy"
    OMIT_NETWORK="network-manager"
fi

# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem over multiple iSCSI with $USE_NETWORK"

KVERSION=${KVERSION-$(uname -r)}

#DEBUGFAIL="loglevel=1"
#DEBUGFAIL="rd.shell rd.break rd.debug loglevel=7 "
DEBUGFAIL="rd.debug loglevel=7 "
#SERVER_DEBUG="rd.debug loglevel=7"
#SERIAL="tcp:127.0.0.1:9999"

run_server() {
    # Start server first
    echo "iSCSI TEST SETUP: Starting DHCP/iSCSI server"

    declare -a disk_args=()
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img serverroot 1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/singleroot.img singleroot
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -serial "${SERIAL:-"file:$TESTDIR/server.log"}" \
        -net nic,macaddr=52:54:00:12:34:56,model=e1000 \
        -net nic,macaddr=52:54:00:12:34:57,model=e1000 \
        -net socket,listen=127.0.0.1:12331 \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/disk/by-id/ata-disk_serverroot rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \
        -initrd "$TESTDIR"/initramfs.server \
        -pidfile "$TESTDIR"/server.pid -daemonize || return 1
    chmod 644 "$TESTDIR"/server.pid || return 1

    # Cleanup the terminal if we have one
    tty -s && stty sane

    if ! [[ $SERIAL ]]; then
        while :; do
            grep Serving "$TESTDIR"/server.log && break
            echo "Waiting for the server to startup"
            tail "$TESTDIR"/server.log
            sleep 1
        done
    else
        echo Sleeping 10 seconds to give the server a head start
        sleep 10
    fi
}

run_client() {
    local test_name=$1
    shift
    echo "CLIENT TEST START: $test_name"

    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -net nic,macaddr=52:54:00:12:34:00,model=e1000 \
        -net nic,macaddr=52:54:00:12:34:01,model=e1000 \
        -net socket,connect=127.0.0.1:12331 \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 rd.shell=0 $DEBUGFAIL $*" \
        -initrd "$TESTDIR"/initramfs.testing
    if ! grep -U --binary-files=binary -F -m 1 -q iscsi-OK "$TESTDIR"/marker.img; then
        echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
        return 1
    fi

    echo "CLIENT TEST END: $test_name [OK]"
    return 0
}

do_test_run() {
    initiator=$(iscsi-iname)
    run_client "netroot=iscsi target1 target2" \
        "root=LABEL=sysroot" \
        "ip=192.168.50.101:::255.255.255.0::enp0s1:off" \
        "ip=192.168.51.101:::255.255.255.0::enp0s2:off" \
        "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
        "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
        "rd.iscsi.initiator=$initiator" \
        || return 1

    run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0" \
        "root=LABEL=sysroot" \
        "ip=192.168.50.101:::255.255.255.0::enp0s1:off" \
        "ip=192.168.51.101:::255.255.255.0::enp0s2:off" \
        "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
        "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
        "rd.iscsi.firmware" \
        "rd.iscsi.initiator=$initiator" \
        "rd.iscsi.waitnet=0" \
        || return 1

    run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
        "root=LABEL=sysroot" \
        "ip=192.168.50.101:::255.255.255.0::enp0s1:off" \
        "ip=192.168.51.101:::255.255.255.0::enp0s2:off" \
        "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
        "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
        "rd.iscsi.firmware" \
        "rd.iscsi.initiator=$initiator" \
        "rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
        || return 1

    run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0 default GW" \
        "root=LABEL=sysroot" \
        "ip=192.168.50.101::192.168.50.1:255.255.255.0::enp0s1:off" \
        "ip=192.168.51.101::192.168.51.1:255.255.255.0::enp0s2:off" \
        "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
        "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
        "rd.iscsi.firmware" \
        "rd.iscsi.initiator=$initiator" \
        "rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
        || return 1

    echo "All tests passed [OK]"
    return 0
}

test_run() {
    if ! run_server; then
        echo "Failed to start server" 1>&2
        return 1
    fi
    do_test_run
    ret=$?
    if [[ -s $TESTDIR/server.pid ]]; then
        kill -TERM "$(cat "$TESTDIR"/server.pid)"
        rm -f -- "$TESTDIR"/server.pid
    fi
    return $ret
}

test_setup() {
    if ! command -v tgtd &> /dev/null || ! command -v tgtadm &> /dev/null; then
        echo "Need tgtd and tgtadm from scsi-target-utils"
        return 1
    fi

    kernel=$KVERSION
    # Create what will eventually be our root filesystem onto an overlay
    rm -rf -- "$TESTDIR"/overlay
    (
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        (
            cd "$initdir" || exit
            mkdir -p -- dev sys proc etc var/run tmp
            mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
            mkdir -p -- var/lib/nfs/rpc_pipefs
        )
        inst_multiple sh shutdown poweroff stty cat ps ln ip \
            mount dmesg mkdir cp ping grep setsid dd sync
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux
        inst_simple /etc/os-release

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst ./client-init.sh /sbin/init
        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mkfs.ext3 poweroff cp umount setsid dd sync blockdev
        inst_hook initqueue 01 ./create-client-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/overlay

    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    dd if=/dev/zero of="$TESTDIR"/singleroot.img bs=1MiB count=200
    dd if=/dev/zero of="$TESTDIR"/raid0-1.img bs=1MiB count=100
    dd if=/dev/zero of="$TESTDIR"/raid0-2.img bs=1MiB count=100

    declare -a disk_args=()
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/singleroot.img singleroot
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2

    # Invoke KVM and/or QEMU to actually create the target filesystem.
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/fakeroot rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1
    rm -- "$TESTDIR"/marker.img

    # shellcheck disable=SC2031
    export kernel=$KVERSION
    rm -rf -- "$TESTDIR"/overlay
    (
        mkdir -p "$TESTDIR"/overlay/source
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        (
            cd "$initdir" || exit
            mkdir -p dev sys proc etc var/run tmp var/lib/dhcpd /etc/iscsi
        )
        inst /etc/passwd /etc/passwd
        inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
            dmesg mkdir cp ping modprobe tcpdump setsid \
            sleep mount chmod pidof
        inst_multiple tgtd tgtadm
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux
        instmods iscsi_tcp crc32c ipv6 af_packet
        [ -f /etc/netconfig ] && inst_multiple /etc/netconfig
        type -P dhcpd > /dev/null && inst_multiple dhcpd
        [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
        inst ./server-init.sh /sbin/init
        inst ./hosts /etc/hosts
        inst ./dhcpd.conf /etc/dhcpd.conf
        inst_multiple -o {,/usr}/etc/nsswitch.conf {,/usr}/etc/rpc \
            {,/usr}/etc/protocols {,/usr}/etc/services \
            /etc/group /etc/os-release

        _nsslibs=$(
            cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
                | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \
                | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
        )
        _nsslibs=${_nsslibs#|}
        _nsslibs=${_nsslibs%|}

        inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'

        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
        dracut_kernel_post
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mkfs.ext3 poweroff cp umount sync dd
        inst_hook initqueue 01 ./create-server-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
        --nomdadmconf \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/overlay

    dd if=/dev/zero of="$TESTDIR"/server.img bs=1MiB count=60
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root

    # Invoke KVM and/or QEMU to actually create the target filesystem.
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1
    rm -- "$TESTDIR"/marker.img

    # Make an overlay with needed tools for the test harness
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook emergency 000 ./hard-off.sh
        inst_simple ./client.link /etc/systemd/network/01-client.link
    )
    # Make client's dracut image
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -o "dash plymouth dmraid nfs ${OMIT_NETWORK}" \
        -a "debug ${USE_NETWORK}" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1

    (
        # shellcheck disable=SC2031
        export initdir="$TESTDIR"/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        rm "$initdir"/etc/systemd/network/01-client.link
        inst_simple ./server.link /etc/systemd/network/01-server.link
        inst_hook pre-mount 99 ./wait-if-server.sh
    )
    # Make server's dracut image
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -a "dash udev-rules base rootfs-block fs-lib debug kernel-modules network network-legacy" \
        -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 drbg" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1

    rm -rf -- "$TESTDIR"/overlay
}

test_cleanup() {
    if [[ -s $TESTDIR/server.pid ]]; then
        kill -TERM "$(cat "$TESTDIR"/server.pid)"
        rm -f -- "$TESTDIR"/server.pid
    fi
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
  070701000002DF000081A400000000000000000000000164DF2CB80000005E000000000000000000000000000000000000004900000000dracut-055+suse.347.gdcb9bdbf/test/TEST-35-ISCSI-MULTI/wait-if-server.sh  #!/bin/sh
. /lib/net-lib.sh
wait_for_if_link enx525400123456
wait_for_if_link enx525400123457
  070701000002E0000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-36-ISCSI-MULTI-NM 070701000002E1000081A400000000000000000000000164DF2CB800000142000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/test/TEST-36-ISCSI-MULTI-NM/Makefile    .PHONY: all setup clean run

BASETEST=../TEST-35-ISCSI-MULTI

all:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) all
setup:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) setup
clean:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) clean
run:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) run
  070701000002E2000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-40-NBD    070701000002E3000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000003800000000dracut-055+suse.347.gdcb9bdbf/test/TEST-40-NBD/Makefile   -include ../Makefile.testdir
   070701000002E4000081ED00000000000000000000000164DF2CB8000002CF000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-40-NBD/client-init.sh #!/bin/sh
: > /dev/watchdog
. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

while read -r dev fs fstype opts rest || [ -n "$dev" ]; do
    [ "$dev" = "rootfs" ] && continue
    [ "$fs" != "/" ] && continue
    echo "nbd-OK $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
    echo "nbd-OK $fstype $opts"
    break
done < /proc/mounts
export TERM=linux
export PS1='nbdclient-test:\w\$ '
stty sane
echo "made it to the rootfs! Powering down."

if getargbool 0 rd.shell; then
    strstr "$(setsid --help)" "control" && CTTY="-c"
    setsid $CTTY sh -i
fi

mount -n -o remount,ro /

sync
poweroff -f
 070701000002E5000081A400000000000000000000000164DF2CB800000067000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-40-NBD/client.link    [Match]
OriginalName=*

[Link]
NamePolicy=keep kernel database onboard slot path
MACAddressPolicy=keep
 070701000002E6000081ED00000000000000000000000164DF2CB80000023B000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/test/TEST-40-NBD/create-client-root.sh  #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
set -e

udevadm settle
mkfs.ext3 -L dracut /dev/disk/by-id/ata-disk_root
mkdir -p /root
mount /dev/disk/by-id/ata-disk_root /root
cp -a -t /root /source/*
mkdir -p /root/run
umount /root
{
    echo "dracut-root-block-created"
    echo "ID_FS_UUID=$ID_FS_UUID"
} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
poweroff -f
 070701000002E7000081ED00000000000000000000000164DF2CB8000004C6000000000000000000000000000000000000004800000000dracut-055+suse.347.gdcb9bdbf/test/TEST-40-NBD/create-encrypted-root.sh   #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
udevadm settle

set -ex

printf test > keyfile
cryptsetup -q luksFormat /dev/disk/by-id/ata-disk_root /keyfile
echo "The passphrase is test"
cryptsetup luksOpen /dev/disk/by-id/ata-disk_root dracut_crypt_test < /keyfile
lvm pvcreate -ff -y /dev/mapper/dracut_crypt_test
lvm vgcreate dracut /dev/mapper/dracut_crypt_test
lvm lvcreate -l 100%FREE -n root dracut
lvm vgchange -ay
udevadm settle
mkfs.ext3 -L dracut -j /dev/dracut/root
mkdir -p /sysroot
mount /dev/dracut/root /sysroot
cp -a -t /sysroot /source/*
umount /sysroot
sleep 1
lvm lvchange -a n /dev/dracut/root
udevadm settle
cryptsetup luksClose /dev/mapper/dracut_crypt_test
udevadm settle
sleep 1
eval "$(udevadm info --query=env --name=/dev/disk/by-id/ata-disk_root | while read -r line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo "$line"; done)"
{
    echo "dracut-root-block-created"
    echo "ID_FS_UUID=$ID_FS_UUID"
} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
sync
poweroff -f
  070701000002E8000081ED00000000000000000000000164DF2CB80000024F000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/test/TEST-40-NBD/create-server-root.sh  #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
udevadm settle
set -e

udevadm settle
mkfs.ext3 -L dracut /dev/disk/by-id/ata-disk_root
mkdir -p /root
mount /dev/disk/by-id/ata-disk_root /root
cp -a -t /root /source/*
mkdir -p /root/run
umount /root
{
    echo "dracut-root-block-created"
    echo "ID_FS_UUID=$ID_FS_UUID"
} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
sync
poweroff -f
 070701000002E9000081ED00000000000000000000000164DF2CB800000073000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-40-NBD/cryptroot-ask.sh   #!/bin/sh

[ -b /dev/mapper/"$2" ] && exit 0
printf test > /keyfile
/sbin/cryptsetup luksOpen "$1" "$2" < /keyfile
 070701000002EA000081A400000000000000000000000164DF2CB800000520000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-40-NBD/dhcpd.conf ddns-update-style none;

use-host-decl-names true;

subnet 192.168.50.0 netmask 255.255.255.0 {
	option subnet-mask      255.255.255.0;
	option routers          192.168.50.1;
	next-server             192.168.50.1;
	server-identifier       192.168.50.1;
	option domain-name-servers 192.168.50.1;
	option domain-search "example.com";
	option domain-name "other.com";

	group {
		host nbd-1 {
			hardware ethernet 52:54:00:12:34:00;
			fixed-address 192.168.50.101;
		}
	}

	group {
		host nbd-2 {
			option root-path "nbd:192.168.50.1:raw";

			hardware ethernet 52:54:00:12:34:01;
			fixed-address 192.168.50.101;
		}
	}

	group {
		host nbd-3 {
			option root-path "nbd:192.168.50.1:raw:ext2";

			hardware ethernet 52:54:00:12:34:02;
			fixed-address 192.168.50.101;
		}
	}

	group {
		host nbd-4 {
			option root-path "nbd:192.168.50.1:raw::errors=panic";

			hardware ethernet 52:54:00:12:34:03;
			fixed-address 192.168.50.101;
		}
	}

	group {
		host nbd-5 {
			option root-path "nbd:192.168.50.1:raw:ext2:errors=panic";

			hardware ethernet 52:54:00:12:34:04;
			fixed-address 192.168.50.101;
		}
	}

	group {
		host nbd-6 {
			# Use the encrypted image
			option root-path "nbd:192.168.50.1:encrypted:ext2:errors=panic";

			hardware ethernet 52:54:00:12:34:05;
			fixed-address 192.168.50.101;
		}
	}
}
070701000002EB000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-40-NBD/finished-false.sh  #!/bin/sh
exit 1
   070701000002EC000081ED00000000000000000000000164DF2CB800000052000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-40-NBD/hard-off.sh    #!/bin/sh
getargbool 0 rd.shell || poweroff -f
getargbool 0 failme && poweroff -f
  070701000002ED000081A400000000000000000000000164DF2CB8000000CC000000000000000000000000000000000000003500000000dracut-055+suse.347.gdcb9bdbf/test/TEST-40-NBD/hosts  127.0.0.1	localhost
192.168.50.1	server
192.168.50.2	server-ip
192.168.50.3	server-proto-ip
192.168.50.100	workstation1
192.168.50.101	workstation2
192.168.50.102	workstation3
192.168.50.103	workstation4
070701000002EE000081ED00000000000000000000000164DF2CB8000005DB000000000000000000000000000000000000003E00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-40-NBD/server-init.sh #!/bin/sh
exec < /dev/console > /dev/console 2>&1
set -x
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
export TERM=linux
export PS1='nbdtest-server:\w\$ '
stty sane
echo "made it to the rootfs!"
echo server > /proc/sys/kernel/hostname

wait_for_if_link() {
    local cnt=0
    local li
    while [ $cnt -lt 600 ]; do
        li=$(ip -o link show dev "$1" 2> /dev/null)
        [ -n "$li" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_if_up() {
    local cnt=0
    local li
    while [ $cnt -lt 200 ]; do
        li=$(ip -o link show up dev "$1")
        [ -n "$li" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_route_ok() {
    local cnt=0
    while [ $cnt -lt 200 ]; do
        li=$(ip route show)
        [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

linkup() {
    wait_for_if_link "$1" 2> /dev/null && ip link set "$1" up 2> /dev/null && wait_for_if_up "$1" 2> /dev/null
}

ip addr add 127.0.0.1/8 dev lo
ip link set lo up

wait_for_if_link enx525400123456
ip addr add 192.168.50.1/24 dev enx525400123456
linkup enx525400123456

modprobe af_packet
nbd-server
: > /var/lib/dhcpd/dhcpd.leases
chmod 777 /var/lib/dhcpd/dhcpd.leases
dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases &
echo "Serving NBD disks"
while pidof nbd-server && pidof dhcpd; do
    echo > /dev/watchdog
    sleep 1
done
mount -n -o remount,ro /
poweroff -f
 070701000002EF000081A400000000000000000000000164DF2CB800000044000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-40-NBD/server.link    [Match]
OriginalName=*

[Link]
NamePolicy=mac
MACAddressPolicy=keep
070701000002F0000081ED00000000000000000000000164DF2CB800004C9D000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-40-NBD/test.sh    #!/bin/bash

if [[ $NM ]]; then
    USE_NETWORK="network-manager"
    OMIT_NETWORK="network-legacy"
else
    USE_NETWORK="network-legacy"
    OMIT_NETWORK="network-manager"
fi

# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem on NBD with $USE_NETWORK"

KVERSION=${KVERSION-$(uname -r)}

# Uncomment this to debug failures
# DEBUGFAIL="rd.debug systemd.log_target=console loglevel=7"
#DEBUGFAIL="rd.shell rd.break rd.debug systemd.log_target=console loglevel=7 systemd.log_level=debug"
#SERIAL="tcp:127.0.0.1:9999"

test_check() {
    if ! type -p nbd-server &> /dev/null; then
        echo "Test needs nbd-server... Skipping"
        return 1
    fi

    if ! modinfo -k "$KVERSION" nbd &> /dev/null; then
        echo "Kernel module nbd does not exist"
        return 1
    fi

    return 0
}

run_server() {
    # Start server first
    echo "NBD TEST SETUP: Starting DHCP/NBD server"

    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/unencrypted.img unencrypted
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/encrypted.img encrypted
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img serverroot

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -serial "${SERIAL:-"file:$TESTDIR/server.log"}" \
        -net nic,macaddr=52:54:00:12:34:56,model=e1000 \
        -net socket,listen=127.0.0.1:12340 \
        -append "panic=1 oops=panic softlockup_panic=1 rd.luks=0 systemd.crash_reboot quiet root=/dev/disk/by-id/ata-disk_serverroot rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \
        -initrd "$TESTDIR"/initramfs.server \
        -pidfile "$TESTDIR"/server.pid -daemonize || return 1
    chmod 644 "$TESTDIR"/server.pid || return 1

    # Cleanup the terminal if we have one
    tty -s && stty sane

    if ! [[ $SERIAL ]]; then
        echo "Waiting for the server to startup"
        while :; do
            grep Serving "$TESTDIR"/server.log && break
            tail "$TESTDIR"/server.log
            sleep 1
        done
    else
        echo Sleeping 10 seconds to give the server a head start
        sleep 10
    fi
}

client_test() {
    local test_name="$1"
    local mac=$2
    local cmdline="$3"
    local fstype=$4
    local fsopt=$5
    local found opts nbdinfo

    [[ $fstype ]] || fstype=ext3
    [[ $fsopt ]] || fsopt="ro"

    echo "CLIENT TEST START: $test_name"

    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -net nic,macaddr="$mac",model=e1000 \
        -net socket,connect=127.0.0.1:12340 \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.auto rd.info rd.retry=10 ro console=ttyS0,115200n81  selinux=0  " \
        -initrd "$TESTDIR"/initramfs.testing

    # shellcheck disable=SC2181
    if [[ $? -ne 0 ]] || ! grep -U --binary-files=binary -F -m 1 -q nbd-OK "$TESTDIR"/marker.img; then
        echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
        return 1
    fi

    # nbdinfo=( fstype fsoptions )
    read -r -a nbdinfo < <(awk '{print $2, $3; exit}' "$TESTDIR"/marker.img)

    if [[ ${nbdinfo[0]} != "$fstype" ]]; then
        echo "CLIENT TEST END: $test_name [FAILED - WRONG FS TYPE] \"${nbdinfo[0]}\" != \"$fstype\""
        return 1
    fi

    opts=${nbdinfo[1]},
    while [[ $opts ]]; do
        if [[ ${opts%%,*} == "$fsopt" ]]; then
            found=1
            break
        fi
        opts=${opts#*,}
    done

    if [[ ! $found ]]; then
        echo "CLIENT TEST END: $test_name [FAILED - BAD FS OPTS] \"${nbdinfo[1]}\" != \"$fsopt\""
        return 1
    fi

    echo "CLIENT TEST END: $test_name [OK]"
}

test_run() {
    if ! run_server; then
        echo "Failed to start server" 1>&2
        return 1
    fi
    client_run
    kill_server
}

client_run() {
    # The default is ext3,errors=continue so use that to determine
    # if our options were parsed and used
    client_test "NBD root=nbd:IP:port" 52:54:00:12:34:00 \
        "root=nbd:192.168.50.1:raw rd.luks=0" || return 1

    client_test "NBD root=nbd:IP:port::fsopts" 52:54:00:12:34:00 \
        "root=nbd:192.168.50.1:raw::errors=panic rd.luks=0" \
        ext3 errors=panic || return 1

    client_test "NBD root=nbd:IP:port:fstype" 52:54:00:12:34:00 \
        "root=nbd:192.168.50.1:raw:ext3 rd.luks=0" ext3 || return 1

    client_test "NBD root=nbd:IP:port:fstype:fsopts" 52:54:00:12:34:00 \
        "root=nbd:192.168.50.1:raw:ext3:errors=panic rd.luks=0" \
        ext3 errors=panic || return 1

    # DHCP root-path parsing

    client_test "NBD root=/dev/root netroot=dhcp DHCP root-path nbd:srv:port" 52:54:00:12:34:01 \
        "root=/dev/root netroot=dhcp ip=dhcp rd.luks=0" || return 1

    client_test "NBD root=/dev/root netroot=dhcp DHCP root-path nbd:srv:port:fstype" \
        52:54:00:12:34:02 "root=/dev/root netroot=dhcp ip=dhcp rd.luks=0" ext2 || return 1

    client_test "NBD root=/dev/root netroot=dhcp DHCP root-path nbd:srv:port::fsopts" \
        52:54:00:12:34:03 "root=/dev/root netroot=dhcp ip=dhcp rd.luks=0" ext3 errors=panic || return 1

    client_test "NBD root=/dev/root netroot=dhcp DHCP root-path nbd:srv:port:fstype:fsopts" \
        52:54:00:12:34:04 "root=/dev/root netroot=dhcp ip=dhcp rd.luks=0" ext2 errors=panic || return 1

    # netroot handling

    client_test "NBD netroot=nbd:IP:port" 52:54:00:12:34:00 \
        "root=LABEL=dracut netroot=nbd:192.168.50.1:raw ip=dhcp rd.luks=0" || return 1

    client_test "NBD root=/dev/root netroot=dhcp DHCP root-path nbd:srv:port:fstype:fsopts" \
        52:54:00:12:34:04 "root=/dev/root netroot=dhcp ip=dhcp rd.luks=0" ext2 errors=panic || return 1

    # Encrypted root handling via LVM/LUKS over NBD

    # shellcheck disable=SC1090
    . "$TESTDIR"/luks.uuid

    client_test "NBD root=LABEL=dracut netroot=nbd:IP:port" \
        52:54:00:12:34:00 \
        "root=LABEL=dracut rd.luks.uuid=$ID_FS_UUID rd.lv.vg=dracut ip=dhcp netroot=nbd:192.168.50.1:encrypted" || return 1

    # XXX This should be ext3,errors=panic but that doesn't currently
    # XXX work when you have a real root= line in addition to netroot=
    # XXX How we should work here needs clarification
    #    client_test "NBD root=LABEL=dracut netroot=dhcp (w/ fstype and opts)" \
    #                52:54:00:12:34:05 \
    #                "root=LABEL=dracut rd.luks.uuid=$ID_FS_UUID rd.lv.vg=dracut netroot=dhcp" || return 1

    if [[ -s server.pid ]]; then
        kill -TERM "$(cat "$TESTDIR"/server.pid)"
        rm -f -- "$TESTDIR"/server.pid
    fi

}

make_encrypted_root() {
    rm -fr "$TESTDIR"/overlay
    kernel=$KVERSION
    # Create what will eventually be our root filesystem onto an overlay
    (
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        mkdir -p "$initdir"
        (
            cd "$initdir" || exit
            mkdir -p dev sys proc etc run var/run tmp
        )

        inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
            mount dmesg mkdir cp ping dd sync
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst ./client-init.sh /sbin/init
        inst_simple /etc/os-release
        find_binary plymouth > /dev/null && inst_multiple plymouth
        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2030
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        (
            cd "$initdir" || exit
            mkdir -p dev sys proc etc tmp var run root
            ln -s ../run var/run
        )
        inst_multiple mkfs.ext3 poweroff cp umount dd sync
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook emergency 000 ./hard-off.sh
        inst_hook initqueue 01 ./create-encrypted-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
        -d "piix ide-gd_mod ata_piix ext3 ext3 sd_mod" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/overlay

    dd if=/dev/zero of="$TESTDIR"/encrypted.img bs=1MiB count=120
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/encrypted.img root

    # Invoke KVM and/or QEMU to actually create the target filesystem.
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/fakeroot rw quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1
    grep -F -a -m 1 ID_FS_UUID "$TESTDIR"/marker.img > "$TESTDIR"/luks.uuid
}

make_client_root() {
    rm -fr "$TESTDIR"/overlay
    kernel=$KVERSION
    (
        mkdir -p "$TESTDIR"/overlay/source
        # shellcheck disable=SC2030
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        mkdir -p "$initdir"
        (
            cd "$initdir" || exit
            mkdir -p dev sys proc etc run var/run tmp
        )
        inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
            dmesg mkdir cp ping dd mount sync
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst ./client-init.sh /sbin/init
        inst_simple /etc/os-release
        inst_multiple -o {,/usr}/etc/nsswitch.conf
        inst /etc/passwd /etc/passwd
        inst /etc/group /etc/group
        for i in /usr/lib*/libnss_files* /lib*/libnss_files*; do
            [ -e "$i" ] || continue
            inst "$i"
        done
        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2030
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mkfs.ext3 poweroff cp umount sync dd
        inst_hook initqueue 01 ./create-client-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
        --nomdadmconf \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1

    dd if=/dev/zero of="$TESTDIR"/unencrypted.img bs=1MiB count=120
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/unencrypted.img root

    # Invoke KVM and/or QEMU to actually create the target filesystem.
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1
    rm -fr "$TESTDIR"/overlay
}

make_server_root() {
    rm -fr "$TESTDIR"/overlay
    # shellcheck disable=SC2031
    export kernel=$KVERSION
    (
        mkdir -p "$TESTDIR"/overlay/source
        # shellcheck disable=SC2030
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        mkdir -p "$initdir"
        (
            cd "$initdir" || exit
            mkdir -p run dev sys proc etc var var/lib/dhcpd tmp etc/nbd-server
            ln -s ../run var/run
        )
        cat > "$initdir/etc/nbd-server/config" << EOF
[generic]
[raw]
exportname = /dev/disk/by-id/ata-disk_unencrypted
port = 2000
bs = 4096
[encrypted]
exportname = /dev/disk/by-id/ata-disk_encrypted
port = 2001
bs = 4096
EOF
        inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
            dmesg mkdir cp ping grep \
            sleep nbd-server chmod modprobe vi pidof
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f ${_terminfodir}/l/linux ] && break
        done
        inst_multiple -o ${_terminfodir}/l/linux
        instmods nfsd sunrpc ipv6 lockd af_packet 8021q ipvlan macvlan
        type -P dhcpd > /dev/null && inst_multiple dhcpd
        [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
        inst ./server-init.sh /sbin/init
        inst_simple /etc/os-release
        inst ./hosts /etc/hosts
        inst ./dhcpd.conf /etc/dhcpd.conf
        inst_multiple -o {,/usr}/etc/nsswitch.conf
        inst /etc/passwd /etc/passwd
        inst /etc/group /etc/group
        _nsslibs=$(
            cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
                | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \
                | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
        )
        _nsslibs=${_nsslibs#|}
        _nsslibs=${_nsslibs%|}

        inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'

        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
        dracut_kernel_post
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2030
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mkfs.ext3 poweroff cp umount sync dd sync
        inst_hook initqueue 01 ./create-server-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
        --nomdadmconf \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1

    dd if=/dev/zero of="$TESTDIR"/server.img bs=1MiB count=120
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root

    # Invoke KVM and/or QEMU to actually create the target filesystem.
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1
    rm -fr "$TESTDIR"/overlay
}

test_setup() {
    make_encrypted_root || return 1
    make_client_root || return 1
    make_server_root || return 1

    rm -fr "$TESTDIR"/overlay
    # Make the test image
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown dd
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst ./cryptroot-ask.sh /sbin/cryptroot-ask

        #        inst ./debug-shell.service /lib/systemd/system/debug-shell.service
        #        mkdir -p "${initdir}/lib/systemd/system/sysinit.target.wants"
        #        ln -fs ../debug-shell.service "${initdir}/lib/systemd/system/sysinit.target.wants/debug-shell.service"

        # shellcheck disable=SC1090
        . "$TESTDIR"/luks.uuid
        mkdir -p "$initdir"/etc
        echo "luks-$ID_FS_UUID /dev/nbd0 /etc/key" > "$initdir"/etc/crypttab
        echo -n test > "$initdir"/etc/key
        inst_simple ./client.link /etc/systemd/network/01-client.link
    )

    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -o "plymouth dash iscsi nfs ${OMIT_NETWORK}" \
        -a "debug watchdog ${USE_NETWORK}" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1

    (
        # shellcheck disable=SC2031
        export initdir="$TESTDIR"/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        rm "$initdir"/etc/systemd/network/01-client.link
        inst_simple ./server.link /etc/systemd/network/01-server.link
        inst_hook pre-mount 99 ./wait-if-server.sh
    )
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -a "udev-rules base rootfs-block fs-lib debug kernel-modules network network-legacy" \
        -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 drbg" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1

    rm -rf -- "$TESTDIR"/overlay
}

kill_server() {
    if [[ -s $TESTDIR/server.pid ]]; then
        kill -TERM "$(cat "$TESTDIR"/server.pid)"
        rm -f -- "$TESTDIR"/server.pid
    fi
}

test_cleanup() {
    kill_server
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
   070701000002F1000081A400000000000000000000000164DF2CB80000003D000000000000000000000000000000000000004100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-40-NBD/wait-if-server.sh  #!/bin/sh
. /lib/net-lib.sh
wait_for_if_link enx525400123456
   070701000002F2000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/test/TEST-41-NBD-NM 070701000002F3000081A400000000000000000000000164DF2CB80000013A000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-41-NBD-NM/Makefile    .PHONY: all setup clean run

BASETEST=../TEST-40-NBD

all:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) all
setup:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) setup
clean:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) clean
run:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) run
  070701000002F4000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/test/TEST-50-MULTINIC   070701000002F5000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-50-MULTINIC/Makefile  -include ../Makefile.testdir
   070701000002F6000081ED00000000000000000000000164DF2CB8000003A2000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/test/TEST-50-MULTINIC/client-init.sh    #!/bin/sh
. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

export TERM=linux
export PS1='initramfs-test:\w\$ '
stty sane
echo "made it to the rootfs! Powering down."

set -x

for i in /sys/class/net/*; do
    # booting with network-manager module
    state=/run/NetworkManager/devices/$(cat "$i"/ifindex)
    grep -q connection-uuid= "$state" 2> /dev/null || continue
    i=${i##*/}
    ip link show "$i" | grep -q master && continue
    IFACES="${IFACES}${i} "
done

for i in /run/initramfs/net.*.did-setup; do
    # booting with network-legacy module
    [ -f "$i" ] || continue
    strglobin "$i" ":*:*:*:*:" && continue
    i=${i%.did-setup}
    IFACES="${IFACES}${i##*/net.} "
done
{
    echo "OK"
    echo "$IFACES"
} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker

getargbool 0 rd.shell && sh -i

sync
poweroff -f
  070701000002F7000081A400000000000000000000000164DF2CB800000067000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-50-MULTINIC/client.link   [Match]
OriginalName=*

[Link]
NamePolicy=keep kernel database onboard slot path
MACAddressPolicy=keep
 070701000002F8000081ED00000000000000000000000164DF2CB800000218000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/test/TEST-50-MULTINIC/create-root.sh    #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
udevadm settle

set -ex

mkfs.ext3 -L dracut /dev/disk/by-id/ata-disk_root
mkdir -p /root
mount /dev/disk/by-id/ata-disk_root /root
cp -a -t /root /source/*
mkdir -p /root/run
umount /root
echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
sync
poweroff -f
070701000002F9000081A400000000000000000000000164DF2CB8000002ED000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-50-MULTINIC/dhcpd.conf    ddns-update-style none;

use-host-decl-names true;

subnet 192.168.50.0 netmask 255.255.255.0 {
	option subnet-mask      255.255.255.0;
	option routers          192.168.50.1;
	next-server             192.168.50.1;
	server-identifier       192.168.50.1;
	option domain-name-servers 192.168.50.1;
	option domain-search "example.com";
	option domain-name "other.com";

	group {
		host client-if1 {
			hardware ethernet 52:54:00:12:34:00;
			fixed-address 192.168.50.100;
		}
	}

	group {
		host client-if2 {
			hardware ethernet 52:54:00:12:34:01;
			fixed-address 192.168.50.101;
		}
	}

	group {
		option root-path "nfs:192.168.50.1:/nfs/client";

		host client-if3 {
			hardware ethernet 52:54:00:12:34:02;
			fixed-address 192.168.50.102;
		}
	}
}
   070701000002FA000081A400000000000000000000000164DF2CB800000049000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-50-MULTINIC/exports   /nfs/client	192.168.50.0/24(rw,insecure,no_subtree_check,no_root_squash)
   070701000002FB000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/test/TEST-50-MULTINIC/finished-false.sh #!/bin/sh
exit 1
   070701000002FC000081ED00000000000000000000000164DF2CB800000052000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-50-MULTINIC/hard-off.sh   #!/bin/sh
getargbool 0 rd.shell || poweroff -f
getargbool 0 failme && poweroff -f
  070701000002FD000081A400000000000000000000000164DF2CB800000076000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-50-MULTINIC/hosts 127.0.0.1	localhost
192.168.50.1	server
192.168.50.100	client-if1
192.168.50.101	client-if2
192.168.50.102	client-if3
  070701000002FE000081ED00000000000000000000000164DF2CB800000825000000000000000000000000000000000000004300000000dracut-055+suse.347.gdcb9bdbf/test/TEST-50-MULTINIC/server-init.sh    #!/bin/sh
exec < /dev/console > /dev/console 2>&1
set -x
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
export TERM=linux
export PS1='nfstest-server:\w\$ '
: > /dev/watchdog
stty sane
echo "made it to the rootfs!"
echo server > /proc/sys/kernel/hostname

wait_for_if_link() {
    local cnt=0
    local li
    while [ $cnt -lt 600 ]; do
        li=$(ip -o link show dev "$1" 2> /dev/null)
        [ -n "$li" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_if_up() {
    local cnt=0
    local li
    while [ $cnt -lt 200 ]; do
        li=$(ip -o link show up dev "$1")
        [ -n "$li" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_route_ok() {
    local cnt=0
    while [ $cnt -lt 200 ]; do
        li=$(ip route show)
        [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

linkup() {
    wait_for_if_link "$1" 2> /dev/null && ip link set "$1" up 2> /dev/null && wait_for_if_up "$1" 2> /dev/null
}

wait_for_if_link enx525401123456

ip addr add 127.0.0.1/8 dev lo
ip link set lo up
ip addr add 192.168.50.1/24 dev enx525401123456
linkup enx525401123456

: > /dev/watchdog
modprobe af_packet
: > /dev/watchdog
modprobe sunrpc
: > /dev/watchdog
mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs
: > /dev/watchdog
[ -x /sbin/portmap ] && portmap
: > /dev/watchdog
mkdir -p /run/rpcbind
[ -x /sbin/rpcbind ] && rpcbind
: > /dev/watchdog
modprobe nfsd
: > /dev/watchdog
mount -t nfsd nfsd /proc/fs/nfsd
: > /dev/watchdog
exportfs -r
: > /dev/watchdog
rpc.nfsd
: > /dev/watchdog
rpc.mountd
: > /dev/watchdog
rpc.idmapd
: > /dev/watchdog
exportfs -r
: > /dev/watchdog
mkdir -p /var/lib/dhcpd
: > /var/lib/dhcpd/dhcpd.leases
: > /dev/watchdog
chmod 777 /var/lib/dhcpd/dhcpd.leases
: > /dev/watchdog
rm -f /var/run/dhcpd.pid
dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases &
exportfs -s
echo "Serving NFS mounts"
while :; do
    [ -n "$(jobs -rp)" ] && : > /dev/watchdog
    sleep 10
done
mount -n -o remount,ro /
poweroff -f
   070701000002FF000081A400000000000000000000000164DF2CB800000044000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-50-MULTINIC/server.link   [Match]
OriginalName=*

[Link]
NamePolicy=mac
MACAddressPolicy=keep
07070100000300000081ED00000000000000000000000164DF2CB80000365C000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-50-MULTINIC/test.sh   #!/bin/bash

if [[ $NM ]]; then
    USE_NETWORK="network-manager"
    OMIT_NETWORK="network-legacy"
else
    USE_NETWORK="network-legacy"
    OMIT_NETWORK="network-manager"
fi

# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem on NFS with multiple nics with $USE_NETWORK"

KVERSION=${KVERSION-$(uname -r)}

# Uncomment this to debug failures
#DEBUGFAIL="loglevel=7 rd.shell rd.break"
#SERIAL="tcp:127.0.0.1:9999"

run_server() {
    # Start server first
    echo "MULTINIC TEST SETUP: Starting DHCP/NFS server"

    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root

    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -net socket,listen=127.0.0.1:12350 \
        -net nic,macaddr=52:54:01:12:34:56,model=e1000 \
        -serial "${SERIAL:-"file:$TESTDIR/server.log"}" \
        -watchdog i6300esb -watchdog-action poweroff \
        -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.server \
        -pidfile "$TESTDIR"/server.pid -daemonize || return 1

    chmod 644 -- "$TESTDIR"/server.pid || return 1

    # Cleanup the terminal if we have one
    tty -s && stty sane

    if ! [[ $SERIAL ]]; then
        while :; do
            grep Serving "$TESTDIR"/server.log && break
            echo "Waiting for the server to startup"
            tail "$TESTDIR"/server.log
            sleep 1
        done
    else
        echo Sleeping 10 seconds to give the server a head start
        sleep 10
    fi
}

client_test() {
    local test_name="$1"
    local mac1="$2"
    local mac2="$3"
    local mac3="$4"
    local cmdline="$5"
    local check="$6"

    echo "CLIENT TEST START: $test_name"

    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker

    if dhclient --help 2>&1 | grep -q -F -- '--timeout' 2> /dev/null; then
        cmdline="$cmdline rd.net.timeout.dhcp=3"
    fi

    # Invoke KVM and/or QEMU to actually create the target filesystem.
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -net socket,connect=127.0.0.1:12350 \
        -net nic,macaddr=52:54:00:12:34:"$mac1",model=e1000 \
        -net nic,macaddr=52:54:00:12:34:"$mac2",model=e1000 \
        -net nic,macaddr=52:54:00:12:34:"$mac3",model=e1000 \
        -netdev hubport,id=n1,hubid=1 \
        -netdev hubport,id=n2,hubid=2 \
        -device e1000,netdev=n1,mac=52:54:00:12:34:98 \
        -device e1000,netdev=n2,mac=52:54:00:12:34:99 \
        -watchdog i6300esb -watchdog-action poweroff \
        -append "quiet panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.retry=5 ro console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.debug systemd.log_target=console" \
        -initrd "$TESTDIR"/initramfs.testing || return 1

    {
        read -r OK
        read -r IFACES
    } < "$TESTDIR"/marker.img

    if [[ $OK != "OK" ]]; then
        echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
        return 1
    fi

    for i in $check; do
        if [[ " $IFACES " != *\ $i\ * ]]; then
            echo "$i not in '$IFACES'"
            echo "CLIENT TEST END: $test_name [FAILED - BAD IF]"
            return 1
        fi
    done

    for i in $IFACES; do
        if [[ " $check " != *\ $i\ * ]]; then
            echo "$i in '$IFACES', but should not be"
            echo "CLIENT TEST END: $test_name [FAILED - BAD IF]"
            return 1
        fi
    done

    echo "CLIENT TEST END: $test_name [OK]"
    return 0
}

test_run() {
    if ! run_server; then
        echo "Failed to start server" 1>&2
        return 1
    fi
    test_client
    ret=$?
    kill_server
    return $ret
}

test_client() {
    # Mac Numbering Scheme
    # ...:00-02 receive IP adresses all others don't
    # ...:02 receives a dhcp root-path

    # PXE Style BOOTIF=
    client_test "MULTINIC root=nfs BOOTIF=" \
        00 01 02 \
        "root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00" \
        "enp0s1" || return 1

    client_test "MULTINIC root=nfs BOOTIF= ip=enp0s3:dhcp" \
        00 01 02 \
        "root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00 ip=enp0s2:dhcp" \
        "enp0s1 enp0s2" || return 1

    # PXE Style BOOTIF= with dhcp root-path
    client_test "MULTINIC root=dhcp BOOTIF=" \
        00 01 02 \
        "root=dhcp BOOTIF=52-54-00-12-34-02" \
        "enp0s3" || return 1

    # Multinic case, where only one nic works
    client_test "MULTINIC root=nfs ip=dhcp" \
        FF 00 FE \
        "root=nfs:192.168.50.1:/nfs/client ip=dhcp" \
        "enp0s2" || return 1

    # Require two interfaces
    client_test "MULTINIC root=nfs ip=enp0s2:dhcp ip=enp0s3:dhcp bootdev=enp0s2" \
        00 01 02 \
        "root=nfs:192.168.50.1:/nfs/client ip=enp0s2:dhcp ip=enp0s3:dhcp bootdev=enp0s2" \
        "enp0s2 enp0s3" || return 1

    # Require three interfaces with dhcp root-path
    client_test "MULTINIC root=dhcp ip=enp0s1:dhcp ip=enp0s2:dhcp ip=enp0s3:dhcp bootdev=enp0s3" \
        00 01 02 \
        "root=dhcp ip=enp0s1:dhcp ip=enp0s2:dhcp ip=enp0s3:dhcp bootdev=enp0s3" \
        "enp0s1 enp0s2 enp0s3" || return 1

    client_test "MULTINIC bonding" \
        00 01 02 \
        "root=nfs:192.168.50.1:/nfs/client ip=bond0:dhcp  bond=bond0:enp0s1,enp0s2,enp0s3:mode=balance-rr" \
        "bond0" || return 1

    # bridge, where only one interface is actually connected
    client_test "MULTINIC bridging" \
        00 01 02 \
        "root=nfs:192.168.50.1:/nfs/client ip=bridge0:dhcp  bridge=bridge0:enp0s1,enp0s5,enp0s6" \
        "bridge0" || return 1
    return 0
}

test_setup() {
    export kernel=$KVERSION
    export srcmods="/lib/modules/$kernel/"
    rm -rf -- "$TESTDIR"/overlay
    (
        mkdir -p "$TESTDIR"/overlay/source
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh

        (
            cd "$initdir" || exit
            mkdir -p dev sys proc run etc var/run tmp var/lib/{dhcpd,rpcbind}
            mkdir -p var/lib/nfs/{v4recovery,rpc_pipefs}
            chmod 777 var/lib/rpcbind var/lib/nfs
        )

        inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
            dmesg mkdir cp ping exportfs \
            modprobe rpc.nfsd rpc.mountd showmount tcpdump \
            sleep mount chmod rm
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            if [ -f "${_terminfodir}"/l/linux ]; then
                inst_multiple -o "${_terminfodir}"/l/linux
                break
            fi
        done
        type -P portmap > /dev/null && inst_multiple portmap
        type -P rpcbind > /dev/null && inst_multiple rpcbind
        [ -f /etc/netconfig ] && inst_multiple /etc/netconfig
        type -P dhcpd > /dev/null && inst_multiple dhcpd
        [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
        instmods nfsd sunrpc ipv6 lockd af_packet
        inst ./server-init.sh /sbin/init
        inst_simple /etc/os-release
        inst ./hosts /etc/hosts
        inst ./exports /etc/exports
        inst ./dhcpd.conf /etc/dhcpd.conf
        inst_multiple -o {,/usr}/etc/nsswitch.conf {,/usr}/etc/rpc \
            {,/usr}/etc/protocols {,/usr}/etc/services
        inst_multiple rpc.idmapd /etc/idmapd.conf

        inst_libdir_file 'libnfsidmap_nsswitch.so*'
        inst_libdir_file 'libnfsidmap/*.so*'
        inst_libdir_file 'libnfsidmap*.so*'

        _nsslibs=$(
            cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
                | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \
                | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
        )
        _nsslibs=${_nsslibs#|}
        _nsslibs=${_nsslibs%|}
        inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'

        inst /etc/passwd /etc/passwd
        inst /etc/group /etc/group

        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
        dracut_kernel_post
    )

    # Make client root inside server root
    (
        # shellcheck disable=SC2030
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay/source/nfs/client
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh

        (
            cd "$initdir" || exit
            mkdir -p dev sys proc etc run root usr var/lib/nfs/rpc_pipefs
        )

        inst_multiple sh shutdown poweroff stty cat ps ln ip dd \
            mount dmesg mkdir cp ping grep setsid ls vi less cat sync
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            if [ -f "${_terminfodir}"/l/linux ]; then
                inst_multiple -o "${_terminfodir}"/l/linux
                break
            fi
        done

        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"

        inst ./client-init.sh /sbin/init
        inst_simple /etc/os-release
        inst_multiple -o {,/usr}/etc/nsswitch.conf
        inst /etc/passwd /etc/passwd
        inst /etc/group /etc/group

        inst_libdir_file 'libnfsidmap_nsswitch.so*'
        inst_libdir_file 'libnfsidmap/*.so*'
        inst_libdir_file 'libnfsidmap*.so*'

        _nsslibs=$(
            cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
                | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \
                | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
        )
        _nsslibs=${_nsslibs#|}
        _nsslibs=${_nsslibs%|}
        inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'

        cp -a /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2030
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mkfs.ext3 poweroff cp umount sync dd
        inst_hook initqueue 01 ./create-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "bash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
        --nomdadmconf \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
    rm -rf -- "$TESTDIR"/overlay

    dd if=/dev/zero of="$TESTDIR"/server.img bs=1MiB count=120
    dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
    declare -a disk_args=()
    # shellcheck disable=SC2034
    declare -i disk_index=0
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
    qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root

    # Invoke KVM and/or QEMU to actually create the target filesystem.
    "$testdir"/run-qemu \
        "${disk_args[@]}" \
        -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/marker.img || return 1

    # Make an overlay with needed tools for the test harness
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir="$TESTDIR"/overlay
        mkdir -p "$TESTDIR"/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown
        inst_hook shutdown-emergency 000 ./hard-off.sh
        inst_hook emergency 000 ./hard-off.sh
        inst_simple ./client.link /etc/systemd/network/01-client.link

        inst_binary awk
        inst_hook pre-pivot 85 "$basedir/modules.d/45ifcfg/write-ifcfg.sh"
    )
    # Make client's dracut image
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -o "ifcfg plymouth dash ${OMIT_NETWORK}" \
        -a "debug watchdog ${USE_NETWORK}" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1

    (
        # shellcheck disable=SC2031
        export initdir="$TESTDIR"/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        rm "$initdir"/etc/systemd/network/01-client.link
        inst_simple ./server.link /etc/systemd/network/01-server.link
        inst_hook pre-mount 99 ./wait-if-server.sh
    )
    # Make server's dracut image
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "dash udev-rules base rootfs-block fs-lib debug kernel-modules watchdog qemu network network-legacy" \
        -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd e1000 i6300esb ib700wdt" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1

}

kill_server() {
    if [[ -s "$TESTDIR"/server.pid ]]; then
        kill -TERM -- "$(cat "$TESTDIR"/server.pid)"
        rm -f -- "$TESTDIR"/server.pid
    fi
}

test_cleanup() {
    kill_server
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
07070100000301000081A400000000000000000000000164DF2CB80000003D000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/test/TEST-50-MULTINIC/wait-if-server.sh #!/bin/sh
. /lib/net-lib.sh
wait_for_if_link enx525401123456
   07070100000302000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-51-MULTINIC-NM    07070100000303000081A400000000000000000000000164DF2CB80000013F000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-51-MULTINIC-NM/Makefile   .PHONY: all setup clean run

BASETEST=../TEST-50-MULTINIC

all:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) all
setup:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) setup
clean:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) clean
run:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) run
 07070100000304000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-60-BONDBRIDGEVLANIFCFG    07070100000305000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000004800000000dracut-055+suse.347.gdcb9bdbf/test/TEST-60-BONDBRIDGEVLANIFCFG/Makefile   -include ../Makefile.testdir
   07070100000306000081ED00000000000000000000000164DF2CB800000279000000000000000000000000000000000000004E00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-60-BONDBRIDGEVLANIFCFG/client-init.sh #!/bin/sh
exec > /dev/console 2>&1
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
strstr() { [ "${1#*$2*}" != "$1" ]; }
CMDLINE=$(while read -r line; do echo "$line"; done < /proc/cmdline)
export TERM=linux
export PS1='initramfs-test:\w\$ '
stty sane
echo "made it to the rootfs! Powering down."

(
    echo OK
    ip -o -4 address show scope global | while read -r _ if rest; do echo "$if"; done | sort
    for i in /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-*; do
        echo "$i"
        grep -v 'UUID=' "$i"
    done
    echo EOF
) | dd oflag=direct,dsync of=/dev/sda

strstr "$CMDLINE" "rd.shell" && sh -i
poweroff -f
   07070100000307000081A400000000000000000000000164DF2CB800000067000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-60-BONDBRIDGEVLANIFCFG/client.link    [Match]
OriginalName=*

[Link]
NamePolicy=keep kernel database onboard slot path
MACAddressPolicy=keep
 07070100000308000081ED00000000000000000000000164DF2CB800000249000000000000000000000000000000000000004E00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-60-BONDBRIDGEVLANIFCFG/create-root.sh #!/bin/sh

trap 'poweroff -f' EXIT

# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
    : > "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
udevadm settle
set -e
# save a partition at the beginning for future flagging purposes
sfdisk /dev/sda << EOF
,1M
,
EOF

udevadm settle
mkfs.ext3 -L dracut /dev/sda2
mkdir -p /root
mount /dev/sda2 /root
cp -a -t /root /source/*
mkdir -p /root/run
umount /root
echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/sda1
sync
poweroff -f
   07070100000309000081A400000000000000000000000164DF2CB800000359000000000000000000000000000000000000004A00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-60-BONDBRIDGEVLANIFCFG/dhcpd.conf ddns-update-style none;

use-host-decl-names true;

subnet 192.168.50.0 netmask 255.255.255.0 {
	option subnet-mask      255.255.255.0;
	option routers          192.168.50.1;
	next-server             192.168.50.1;
	server-identifier       192.168.50.1;
	option domain-name-servers 192.168.50.1;
	option domain-search "example.com";
	option domain-name "other.com";
	option root-path "nfs:192.168.50.1:/nfs/client";
	range 192.168.50.10 192.168.50.100;
}

subnet 192.168.51.0 netmask 255.255.255.0 {
	option subnet-mask      255.255.255.0;
	option routers          192.168.51.1;
	next-server             192.168.51.1;
	server-identifier       192.168.51.1;
	option domain-name-servers 192.168.51.1;
	option domain-search "example.com";
	option domain-name "other.com";
	option root-path "nfs:192.168.51.1:/nfs/client";
	range 192.168.51.10 192.168.51.100;
}
   0707010000030A000081A400000000000000000000000164DF2CB800000049000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-60-BONDBRIDGEVLANIFCFG/exports    /nfs/client	192.168.50.0/24(rw,insecure,no_subtree_check,no_root_squash)
   0707010000030B000081ED00000000000000000000000164DF2CB800000011000000000000000000000000000000000000005100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-60-BONDBRIDGEVLANIFCFG/finished-false.sh  #!/bin/sh
exit 1
   0707010000030C000081ED00000000000000000000000164DF2CB800000046000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-60-BONDBRIDGEVLANIFCFG/hard-off.sh    #!/bin/sh
getarg rd.shell || poweroff -f
getarg failme && poweroff -f
  0707010000030D000081A400000000000000000000000164DF2CB800000076000000000000000000000000000000000000004500000000dracut-055+suse.347.gdcb9bdbf/test/TEST-60-BONDBRIDGEVLANIFCFG/hosts  127.0.0.1	localhost
192.168.50.1	server
192.168.50.100	client-if1
192.168.50.101	client-if2
192.168.50.102	client-if3
  0707010000030E000081ED00000000000000000000000164DF2CB800000B90000000000000000000000000000000000000004E00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-60-BONDBRIDGEVLANIFCFG/server-init.sh #!/bin/sh
exec < /dev/console > /dev/console 2>&1
set -x
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
export TERM=linux
export PS1='nfstest-server:\w\$ '
stty sane
echo "made it to the rootfs!"
echo server > /proc/sys/kernel/hostname

wait_for_if_link() {
    local cnt=0
    local li

    while [ $cnt -lt 600 ]; do
        ip link show

        li=$(ip -o link show dev "$1" 2> /dev/null)
        [ -n "$li" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_if_up() {
    local cnt=0
    local li
    while [ $cnt -lt 200 ]; do
        li=$(ip -o link show up dev "$1")
        [ -n "$li" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

wait_for_route_ok() {
    local cnt=0
    while [ $cnt -lt 200 ]; do
        li=$(ip route show)
        [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
        sleep 0.1
        cnt=$((cnt + 1))
    done
    return 1
}

linkup() {
    wait_for_if_link "$1" 2> /dev/null && ip link set "$1" up 2> /dev/null && wait_for_if_up "$1" 2> /dev/null
}

udevadm settle

ip link show

wait_for_if_link enx525401123456
wait_for_if_link enx525401123457
wait_for_if_link enx525401123458
wait_for_if_link enx525401123459

ip link set dev enx525401123456 name net1
ip link set dev enx525401123457 name net2
ip link set dev enx525401123458 name net3
ip link set dev enx525401123459 name net4

modprobe --all -b -q 8021q ipvlan macvlan
: > /dev/watchdog
ip addr add 127.0.0.1/8 dev lo
linkup lo
ip addr add 192.168.50.1/24 dev net1
linkup net1
: > /dev/watchdog
ip link add dev net2.1 link net2 type vlan id 1
ip link add dev net2.2 link net2 type vlan id 2
ip link add dev net2.3 link net2 type vlan id 3
ip link add dev net2.4 link net2 type vlan id 4
ip addr add 192.168.54.1/24 dev net2.1
ip addr add 192.168.55.1/24 dev net2.2
ip addr add 192.168.56.1/24 dev net2.3
ip addr add 192.168.57.1/24 dev net2.4
linkup net2
ip link set dev net2.1 up
ip link set dev net2.2 up
ip link set dev net2.3 up
ip link set dev net2.4 up
ip addr add 192.168.51.1/24 dev net3
linkup net3
linkup net4
: > /dev/watchdog
modprobe af_packet
: > /dev/watchdog
modprobe sunrpc
: > /dev/watchdog
mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs
: > /dev/watchdog
[ -x /sbin/portmap ] && portmap
: > /dev/watchdog
mkdir -p /run/rpcbind
[ -x /sbin/rpcbind ] && rpcbind
: > /dev/watchdog
modprobe nfsd
: > /dev/watchdog
mount -t nfsd nfsd /proc/fs/nfsd
: > /dev/watchdog
exportfs -r
: > /dev/watchdog
rpc.nfsd
: > /dev/watchdog
rpc.mountd
: > /dev/watchdog
rpc.idmapd -S
: > /dev/watchdog
exportfs -r
: > /dev/watchdog
: > /var/lib/dhcpd/dhcpd.leases
: > /dev/watchdog
chmod 777 /var/lib/dhcpd/dhcpd.leases
: > /dev/watchdog
dhcpd -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases net1 net3
#echo -n 'V' : > /dev/watchdog
#sh -i
#tcpdump -i net1
# Wait forever for the VM to die
echo "Serving"
while :; do
    sleep 10
    : > /dev/watchdog
done
mount -n -o remount,ro /
poweroff -f
0707010000030F000081A400000000000000000000000164DF2CB800000044000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-60-BONDBRIDGEVLANIFCFG/server.link    [Match]
OriginalName=*

[Link]
NamePolicy=mac
MACAddressPolicy=keep
07070100000310000081ED00000000000000000000000164DF2CB8000043BC000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-60-BONDBRIDGEVLANIFCFG/test.sh    #!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

if [[ $NM ]]; then
    USE_NETWORK="network-manager"
    OMIT_NETWORK="network-legacy"
else
    USE_NETWORK="network-legacy"
    OMIT_NETWORK="network-manager"
fi

# shellcheck disable=SC2034
TEST_DESCRIPTION="root filesystem on NFS with bridging/bonding/vlan with $USE_NETWORK"

KVERSION=${KVERSION-$(uname -r)}

# Uncomment this to debug failures
#DEBUGFAIL="rd.shell rd.break"
#DEBUGFAIL="rd.shell rd.break rd.debug"
#SERIAL="tcp:127.0.0.1:9999"

run_server() {
    # Start server first
    echo "MULTINIC TEST SETUP: Starting DHCP/NFS server"

    "$testdir"/run-qemu \
        -netdev socket,id=n0,listen=127.0.0.1:12370 \
        -netdev socket,id=n1,listen=127.0.0.1:12371 \
        -netdev socket,id=n2,listen=127.0.0.1:12372 \
        -netdev socket,id=n3,listen=127.0.0.1:12373 \
        -device virtio-net-pci,netdev=n0,mac=52:54:01:12:34:56 \
        -device virtio-net-pci,netdev=n1,mac=52:54:01:12:34:57 \
        -device virtio-net-pci,netdev=n2,mac=52:54:01:12:34:58 \
        -device virtio-net-pci,netdev=n3,mac=52:54:01:12:34:59 \
        -hda "$TESTDIR"/server.ext3 \
        -serial "${SERIAL:-"file:$TESTDIR/server.log"}" \
        -watchdog i6300esb -watchdog-action poweroff \
        -append "panic=1 oops=panic softlockup_panic=1 loglevel=7 root=LABEL=dracut rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 rd.debug" \
        -initrd "$TESTDIR"/initramfs.server \
        -pidfile "$TESTDIR"/server.pid -daemonize || return 1
    chmod 644 -- "$TESTDIR"/server.pid || return 1

    # Cleanup the terminal if we have one
    tty -s && stty sane

    if ! [[ $SERIAL ]]; then
        echo "Waiting for the server to startup"
        while :; do
            grep Serving "$TESTDIR"/server.log && break
            tail "$TESTDIR"/server.log
            sleep 1
        done
    else
        echo Sleeping 10 seconds to give the server a head start
        sleep 10
    fi
}

client_test() {
    local test_name="$1"
    local do_vlan13="$2"
    local cmdline="$3"
    local check="$4"
    local CONF

    echo "CLIENT TEST START: $test_name"

    [ "$do_vlan13" != "yes" ] && unset do_vlan13

    # Need this so kvm-qemu will boot (needs non-/dev/zero local disk)
    if ! dd if=/dev/zero of="$TESTDIR"/client.img bs=1M count=1; then
        echo "Unable to make client sda image" 1>&2
        return 1
    fi
    if [[ $do_vlan13 ]]; then
        nic1=("-netdev" "socket,connect=127.0.0.1:12371,id=n1")
        nic3=("-netdev" "socket,connect=127.0.0.1:12373,id=n3")
    else
        nic1=("-netdev" "hubport,id=n1,hubid=2")
        nic3=("-netdev" "hubport,id=n3,hubid=3")
    fi

    "$testdir"/run-qemu \
        -netdev socket,connect=127.0.0.1:12370,id=s1 \
        -netdev hubport,hubid=1,id=h1,netdev=s1 \
        -netdev hubport,hubid=1,id=h2 -device virtio-net-pci,mac=52:54:00:12:34:01,netdev=h2 \
        -netdev hubport,hubid=1,id=h3 -device virtio-net-pci,mac=52:54:00:12:34:02,netdev=h3 \
        "${nic1[@]}" -device virtio-net-pci,mac=52:54:00:12:34:03,netdev=n1 \
        -netdev socket,connect=127.0.0.1:12372,id=n2 -device virtio-net-pci,mac=52:54:00:12:34:04,netdev=n2 \
        "${nic3[@]}" -device virtio-net-pci,mac=52:54:00:12:34:05,netdev=n3 \
        -hda "$TESTDIR"/client.img \
        -watchdog i6300esb -watchdog-action poweroff \
        -append "
        panic=1 oops=panic softlockup_panic=1
        ifname=net1:52:54:00:12:34:01
        ifname=net2:52:54:00:12:34:02
        ifname=net3:52:54:00:12:34:03
        ifname=net4:52:54:00:12:34:04
        ifname=net5:52:54:00:12:34:05
        $cmdline rd.net.timeout.dhcp=3 systemd.crash_reboot rd.debug
        $DEBUGFAIL rd.retry=5 rw console=ttyS0,115200n81 selinux=0 init=/sbin/init" \
        -initrd "$TESTDIR"/initramfs.testing || return 1

    {
        read -r OK _
        if [[ $OK != "OK" ]]; then
            echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
            return 1
        fi

        while read -r line; do
            [[ $line == END ]] && break
            CONF+="$line "
        done
    } < "$TESTDIR"/client.img || return 1

    if [[ $check != "$CONF" ]]; then
        echo "Expected: '$check'"
        echo
        echo
        echo "Got:      '$CONF'"
        echo "CLIENT TEST END: $test_name [FAILED - BAD CONF]"
        return 1
    fi

    echo "CLIENT TEST END: $test_name [OK]"
    return 0
}

test_run() {
    if ! run_server; then
        echo "Failed to start server" 1>&2
        return 1
    fi
    test_client || {
        kill_server
        return 1
    }
}

test_client() {
    if [[ $NM ]]; then
        EXPECT='net1 net3.0004 net3.3 vlan0001 vlan2 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-* EOF '
    else
        EXPECT='net1 net3.0004 net3.3 vlan0001 vlan2 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-net1 # Generated by dracut initrd NAME="net1" HWADDR="52:54:00:12:34:01" DEVICE="net1" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp TYPE=Ethernet /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-net3.0004 # Generated by dracut initrd NAME="net3.0004" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.57.104" PREFIX="24" GATEWAY="192.168.57.1" TYPE=Vlan DEVICE="net3.0004" VLAN=yes PHYSDEV="net3" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-net3.3 # Generated by dracut initrd NAME="net3.3" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.56.103" PREFIX="24" GATEWAY="192.168.56.1" TYPE=Vlan DEVICE="net3.3" VLAN=yes PHYSDEV="net3" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-vlan0001 # Generated by dracut initrd NAME="vlan0001" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.54.101" PREFIX="24" GATEWAY="192.168.54.1" TYPE=Vlan DEVICE="vlan0001" VLAN=yes PHYSDEV="net3" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-vlan2 # Generated by dracut initrd NAME="vlan2" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.55.102" PREFIX="24" GATEWAY="192.168.55.1" TYPE=Vlan DEVICE="vlan2" VLAN=yes PHYSDEV="net3" EOF '
    fi

    client_test "Multiple VLAN" \
        "yes" \
        "
vlan=vlan0001:net3
vlan=vlan2:net3
vlan=net3.3:net3
vlan=net3.0004:net3
ip=net1:dhcp
ip=192.168.54.101::192.168.54.1:24:test:vlan0001:none
ip=192.168.55.102::192.168.55.1:24:test:vlan2:none
ip=192.168.56.103::192.168.56.1:24:test:net3.3:none
ip=192.168.57.104::192.168.57.1:24:test:net3.0004:none
rd.neednet=1
root=nfs:192.168.50.1:/nfs/client bootdev=net1
" \
        "$EXPECT" \
        || return 1

    if [[ $NM ]]; then
        EXPECT='bond0 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-* EOF '
    else
        EXPECT='bond0 bond1 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-bond0 # Generated by dracut initrd NAME="bond0" DEVICE="bond0" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp BONDING_OPTS="" NAME="bond0" TYPE=Bond /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-bond1 # Generated by dracut initrd NAME="bond1" DEVICE="bond1" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp BONDING_OPTS="" NAME="bond1" TYPE=Bond /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-net1 # Generated by dracut initrd NAME="net1" HWADDR="52:54:00:12:34:01" TYPE=Ethernet ONBOOT=yes NETBOOT=yes SLAVE=yes MASTER="bond0" DEVICE="net1" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-net2 # Generated by dracut initrd NAME="net2" HWADDR="52:54:00:12:34:02" TYPE=Ethernet ONBOOT=yes NETBOOT=yes SLAVE=yes MASTER="bond0" DEVICE="net2" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-net4 # Generated by dracut initrd NAME="net4" HWADDR="52:54:00:12:34:04" TYPE=Ethernet ONBOOT=yes NETBOOT=yes SLAVE=yes MASTER="bond1" DEVICE="net4" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-net5 # Generated by dracut initrd NAME="net5" TYPE=Ethernet ONBOOT=yes NETBOOT=yes SLAVE=yes MASTER="bond1" DEVICE="net5" EOF '
    fi

    client_test "Multiple Bonds" \
        "yes" \
        "
bond=bond0:net1,net2:miimon=100
bond=bond1:net4,net5:miimon=100
ip=bond0:dhcp
ip=bond1:dhcp
rd.neednet=1
root=nfs:192.168.50.1:/nfs/client bootdev=bond0
" \
        "$EXPECT" \
        || return 1

    if [[ $NM ]]; then
        EXPECT='br0 br1 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-* EOF '
    else
        EXPECT='br0 br1 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-br0 # Generated by dracut initrd NAME="br0" DEVICE="br0" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp TYPE=Bridge NAME="br0" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-br1 # Generated by dracut initrd NAME="br1" DEVICE="br1" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp TYPE=Bridge NAME="br1" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-net1 # Generated by dracut initrd NAME="net1" HWADDR="52:54:00:12:34:01" TYPE=Ethernet ONBOOT=yes NETBOOT=yes BRIDGE="br0" DEVICE="net1" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-net2 # Generated by dracut initrd NAME="net2" HWADDR="52:54:00:12:34:02" TYPE=Ethernet ONBOOT=yes NETBOOT=yes BRIDGE="br0" DEVICE="net2" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-net4 # Generated by dracut initrd NAME="net4" TYPE=Ethernet ONBOOT=yes NETBOOT=yes BRIDGE="br1" DEVICE="net4" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-net5 # Generated by dracut initrd NAME="net5" TYPE=Ethernet ONBOOT=yes NETBOOT=yes BRIDGE="br1" DEVICE="net5" EOF '
    fi

    client_test "Multiple Bridges" \
        "no" \
        "
bridge=br0:net1,net2
bridge=br1:net4,net5
ip=br0:dhcp
ip=br1:dhcp
rd.neednet=1
root=nfs:192.168.50.1:/nfs/client bootdev=br0
" \
        "$EXPECT" \
        || return 1

    kill_server
    return 0
}

test_setup() {
    # Make server root
    dd if=/dev/zero of="$TESTDIR"/server.ext3 bs=1M count=120

    kernel=$KVERSION
    rm -rf -- "$TESTDIR"/overlay
    (
        mkdir -p "$TESTDIR"/overlay/source
        # shellcheck disable=SC2030
        export initdir=$TESTDIR/overlay/source
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh

        (
            cd "$initdir" || exit
            mkdir -p -- dev sys proc run etc var/run tmp var/lib/{dhcpd,rpcbind}
            mkdir -p -- var/lib/nfs/{v4recovery,rpc_pipefs}
            chmod 777 -- var/lib/rpcbind var/lib/nfs
        )

        for _f in modules.builtin.bin modules.builtin; do
            [[ -f $srcmods/$_f ]] && break
        done || {
            dfatal "No modules.builtin.bin and modules.builtin found!"
            return 1
        }

        for _f in modules.builtin.bin modules.builtin modules.order; do
            [[ -f $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
        done

        inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
            dmesg mkdir cp ping exportfs \
            modprobe rpc.nfsd rpc.mountd showmount tcpdump \
            /etc/services sleep mount chmod
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [ -f "${_terminfodir}"/l/linux ] && break
        done
        inst_multiple -o "${_terminfodir}"/l/linux
        type -P portmap > /dev/null && inst_multiple portmap
        type -P rpcbind > /dev/null && inst_multiple rpcbind
        [ -f /etc/netconfig ] && inst_multiple /etc/netconfig
        type -P dhcpd > /dev/null && inst_multiple dhcpd
        [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
        instmods nfsd sunrpc ipv6 lockd af_packet 8021q ipvlan macvlan
        inst_simple /etc/os-release
        inst ./server-init.sh /sbin/init
        inst ./hosts /etc/hosts
        inst ./exports /etc/exports
        inst ./dhcpd.conf /etc/dhcpd.conf
        inst_multiple -o {,/usr}/etc/nsswitch.conf {,/usr}/etc/rpc {,/usr}/etc/protocols

        inst_multiple rpc.idmapd /etc/idmapd.conf

        inst_libdir_file 'libnfsidmap_nsswitch.so*'
        inst_libdir_file 'libnfsidmap/*.so*'
        inst_libdir_file 'libnfsidmap*.so*'

        _nsslibs=$(
            cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
                | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \
                | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
        )
        _nsslibs=${_nsslibs#|}
        _nsslibs=${_nsslibs%|}

        inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'

        inst /etc/passwd /etc/passwd
        inst /etc/group /etc/group

        cp -a -- /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
        dracut_kernel_post
    )

    # Make client root inside server root
    (
        # shellcheck disable=SC2030
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay/source/nfs/client
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sh shutdown poweroff stty cat ps ln ip \
            mount dmesg mkdir cp ping grep ls sort dd
        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
            [[ -f ${_terminfodir}/l/linux ]] && break
        done
        inst_multiple -o "${_terminfodir}"/l/linux
        inst_simple /etc/os-release
        inst ./client-init.sh /sbin/init
        (
            cd "$initdir" || exit
            mkdir -p -- dev sys proc etc run
            mkdir -p -- var/lib/nfs/rpc_pipefs
        )
        inst_multiple -o {,/usr}/etc/nsswitch.conf {,/usr}/etc/rpc {,/usr}/etc/protocols
        inst /etc/passwd /etc/passwd
        inst /etc/group /etc/group

        inst_multiple rpc.idmapd /etc/idmapd.conf
        inst_libdir_file 'libnfsidmap_nsswitch.so*'
        inst_libdir_file 'libnfsidmap/*.so*'
        inst_libdir_file 'libnfsidmap*.so*'

        _nsslibs=$(
            cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
                | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \
                | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
        )
        _nsslibs=${_nsslibs#|}
        _nsslibs=${_nsslibs%|}

        inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'

        cp -a -- /etc/ld.so.conf* "$initdir"/etc
        ldconfig -r "$initdir"
    )

    # second, install the files needed to make the root filesystem
    (
        # shellcheck disable=SC2030
        # shellcheck disable=SC2031
        export initdir=$TESTDIR/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple sfdisk mkfs.ext3 poweroff cp umount sync dd
        inst_hook initqueue 01 ./create-root.sh
        inst_hook initqueue/finished 01 ./finished-false.sh
    )

    # create an initramfs that will create the target root filesystem.
    # We do it this way so that we do not risk trashing the host mdraid
    # devices, volume groups, encrypted partitions, etc.
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        -m "bash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
        --nomdadmconf \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1

    # Invoke KVM and/or QEMU to actually create the target filesystem.
    "$testdir"/run-qemu \
        -drive format=raw,index=0,media=disk,file="$TESTDIR"/server.ext3 \
        -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
        -initrd "$TESTDIR"/initramfs.makeroot || return 1
    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/server.ext3 || return 1
    rm -fr "$TESTDIR"/overlay

    # Make an overlay with needed tools for the test harness
    (
        # shellcheck disable=SC2031
        # shellcheck disable=SC2030
        export initdir="$TESTDIR"/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_multiple poweroff shutdown
        inst_hook emergency 000 ./hard-off.sh
        inst_simple ./client.link /etc/systemd/network/01-client.link
    )
    # Make client's dracut image
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        --no-early-microcode \
        -o "plymouth ${OMIT_NETWORK}" \
        -a "debug ${USE_NETWORK}" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1

    (
        # shellcheck disable=SC2031
        export initdir="$TESTDIR"/overlay
        # shellcheck disable=SC1090
        . "$basedir"/dracut-init.sh
        inst_simple ./server.link /etc/systemd/network/01-server.link
        inst_hook pre-mount 99 ./wait-if-server.sh
    )
    # Make server's dracut image
    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
        --no-early-microcode \
        -m "udev-rules base rootfs-block fs-lib debug kernel-modules watchdog qemu network network-legacy" \
        -d "ipvlan macvlan af_packet piix ide-gd_mod ata_piix ext3 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd virtio-net i6300esb ib700wdt" \
        --no-hostonly-cmdline -N \
        -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1
}

kill_server() {
    if [[ -s "$TESTDIR"/server.pid ]]; then
        kill -TERM -- "$(cat "$TESTDIR"/server.pid)"
        rm -f -- "$TESTDIR"/server.pid
    fi
}

test_cleanup() {
    kill_server
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
07070100000311000081A400000000000000000000000164DF2CB8000000A0000000000000000000000000000000000000005100000000dracut-055+suse.347.gdcb9bdbf/test/TEST-60-BONDBRIDGEVLANIFCFG/wait-if-server.sh  #!/bin/sh
. /lib/net-lib.sh
wait_for_if_link enx525401123456
wait_for_if_link enx525401123457
wait_for_if_link enx525401123458
wait_for_if_link enx525401123459
07070100000312000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/test/TEST-61-BONDBRIDGEVLANIFCFG-NM 07070100000313000081A400000000000000000000000164DF2CB80000014A000000000000000000000000000000000000004B00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-61-BONDBRIDGEVLANIFCFG-NM/Makefile    .PHONY: all setup clean run

BASETEST=../TEST-60-BONDBRIDGEVLANIFCFG

all:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) all
setup:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) setup
clean:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) clean
run:
	@$(MAKE) NM=1 -s --no-print-directory -C $(BASETEST) run
  07070100000314000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/test/TEST-62-SKIPCPIO   07070100000315000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-62-SKIPCPIO/Makefile  -include ../Makefile.testdir
   07070100000316000081ED00000000000000000000000164DF2CB80000067B000000000000000000000000000000000000003C00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-62-SKIPCPIO/test.sh   #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# shellcheck disable=SC2034
TEST_DESCRIPTION="test skipcpio"

test_check() {
    which cpio dd truncate find sort diff &> /dev/null
}

skipcpio_simple() {
    mkdir -p "$CPIO_TESTDIR/skipcpio_simple/first_archive"
    pushd "$CPIO_TESTDIR/skipcpio_simple/first_archive"

    for ((i = 0; i < 3; i++)); do
        echo "first archive file $i" >> ./"$i"
    done
    find . -print0 | sort -z \
        | cpio -o --null -H newc --file "$CPIO_TESTDIR/skipcpio_simple.cpio"
    popd

    mkdir -p "$CPIO_TESTDIR/skipcpio_simple/second_archive"
    pushd "$CPIO_TESTDIR/skipcpio_simple/second_archive"

    for ((i = 10; i < 13; i++)); do
        echo "second archive file $i" >> ./"$i"
    done

    find . -print0 | sort -z \
        | cpio -o --null -H newc >> "$CPIO_TESTDIR/skipcpio_simple.cpio"
    popd

    cpio -i --list < "$CPIO_TESTDIR/skipcpio_simple.cpio" \
        > "$CPIO_TESTDIR/skipcpio_simple.list"
    cat << EOF | diff - "$CPIO_TESTDIR/skipcpio_simple.list"
.
0
1
2
EOF

    "$basedir"/src/skipcpio/skipcpio "$CPIO_TESTDIR/skipcpio_simple.cpio" \
        | cpio -i --list > "$CPIO_TESTDIR/skipcpio_simple.list"
    cat << EOF | diff - "$CPIO_TESTDIR/skipcpio_simple.list"
.
10
11
12
EOF
}

test_run() {
    set -x
    set -e

    skipcpio_simple

    return 0
}

test_setup() {
    CPIO_TESTDIR=$(mktemp --directory -p "$TESTDIR" cpio-test.XXXXXXXXXX) \
        || return 1
    export CPIO_TESTDIR
    return 0
}

test_cleanup() {
    [ -d "$CPIO_TESTDIR" ] && rm -rf "$CPIO_TESTDIR"
    return 0
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
 07070100000317000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-63-DRACUT-CPIO    07070100000318000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000004000000000dracut-055+suse.347.gdcb9bdbf/test/TEST-63-DRACUT-CPIO/Makefile   -include ../Makefile.testdir
   07070100000319000081ED00000000000000000000000164DF2CB8000009FF000000000000000000000000000000000000003F00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-63-DRACUT-CPIO/test.sh    #!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# shellcheck disable=SC2034
TEST_DESCRIPTION="kernel cpio extraction tests for dracut-cpio"
# see dracut-cpio source for unit tests

test_check() {
    if ! [[ -x $basedir/dracut-cpio ]]; then
        echo "Test needs dracut-cpio... Skipping"
        return 1
    fi
}

test_dracut_cpio() {
    local tdir="${CPIO_TESTDIR}/${1}"
    shift
    # --enhanced-cpio tells dracut to use dracut-cpio instead of GNU cpio
    local dracut_cpio_params=("--enhanced-cpio" "$@")

    mkdir -p "$tdir"

    # VM script to print sentinel on boot
    # write to kmsg so that sysrq messages don't race with console output
    cat > "$tdir/init.sh" << EOF
echo "Image with ${dracut_cpio_params[*]} booted successfully" > /dev/kmsg
echo 1 > /proc/sys/kernel/sysrq
echo o > /proc/sysrq-trigger
sleep 20
EOF

    "$basedir"/dracut.sh -l --drivers "" \
        "${dracut_cpio_params[@]}" \
        --modules "bash base" \
        --include "$tdir/init.sh" /lib/dracut/hooks/emergency/00-init.sh \
        --no-hostonly --no-hostonly-cmdline \
        "$tdir/initramfs" \
        || return 1

    "$testdir"/run-qemu \
        -watchdog i6300esb -watchdog-action poweroff \
        -daemonize -pidfile "$tdir/vm.pid" \
        -serial "file:$tdir/console.out" \
        -append "panic=1 oops=panic softlockup_panic=1 loglevel=7 console=ttyS0 rd.shell=1" \
        -initrd "$tdir/initramfs" || return 1

    timeout=120
    while [[ -f $tdir/vm.pid ]] \
        && ps -p "$(head -n1 "$tdir/vm.pid")" > /dev/null; do
        echo "$timeout - awaiting VM shutdown"
        sleep 1
        [[ $((timeout--)) -le 0 ]] && return 1
    done

    cat "$tdir/console.out"
    grep -q "Image with ${dracut_cpio_params[*]} booted successfully" \
        "$tdir/console.out"
}

test_run() {
    set -x

    # dracut-cpio is typically used with compression and strip disabled, to
    # increase the chance of (reflink) extent sharing.
    test_dracut_cpio "simple" "--no-compress" "--nostrip" || return 1
    # dracut-cpio should still work fine with compression and stripping enabled
    test_dracut_cpio "compress" "--gzip" "--nostrip" || return 1
    test_dracut_cpio "strip" "--gzip" "--strip" || return 1
}

test_setup() {
    CPIO_TESTDIR=$(mktemp --directory -p "$TESTDIR" cpio-test.XXXXXXXXXX) \
        || return 1
    export CPIO_TESTDIR
    return 0
}

test_cleanup() {
    [ -d "$CPIO_TESTDIR" ] && rm -rf "$CPIO_TESTDIR"
    return 0
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
 0707010000031A000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/test/TEST-98-GETARG 0707010000031B000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000003B00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-98-GETARG/Makefile    -include ../Makefile.testdir
   0707010000031C000081ED00000000000000000000000164DF2CB800001355000000000000000000000000000000000000003A00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-98-GETARG/test.sh #!/bin/bash

# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# shellcheck disable=SC2034
TEST_DESCRIPTION="dracut getarg command"

test_check() {
    return 0
}

test_setup() {
    make -C "$basedir" dracut-util
    ln -sfnr "$basedir"/dracut-util "$TESTDIR"/dracut-getarg
    ln -sfnr "$basedir"/dracut-util "$TESTDIR"/dracut-getargs
    ln -sfnr "$basedir"/modules.d/99base/dracut-lib.sh "$TESTDIR"/dracut-lib.sh
    ln -sfnr "$basedir"/modules.d/99base/dracut-dev-lib.sh "$TESTDIR"/dracut-dev-lib.sh
    return 0
}

test_run() {
    set -x
    (
        cd "$TESTDIR" || exit 1
        export CMDLINE='key1=0 key2=val key2=val2 key3="  val  3  " "  key 4  ="val4 "key  5=val  5" "key 6=""val  6" key7="foo"bar" baz="end "  key8  =  val 8  "
"key 9"="val 9"'

        ret=0

        unset TEST
        declare -A TEST
        TEST=(
            ["key1"]="0"
            ["key2"]="val2"
            ["key3"]="  val  3  "
            ["  key 4  "]="val4"
            ["key  5"]="val  5"
            ["key 6"]='"val  6'
            ["key7"]='foo"bar" baz="end'
            ["  key8  "]="  val 8  "
            ['key 9"']="val 9"
        )
        for key in "${!TEST[@]}"; do
            if ! val=$(./dracut-getarg "${key}="); then
                echo "'$key' == '${TEST[$key]}', but not found" >&2
                ret=$((ret + 1))
            else
                if [[ $val != "${TEST[$key]}" ]]; then
                    echo "'$key' != '${TEST[$key]}' but '$val'" >&2
                    ret=$((ret + 1))
                fi
            fi
        done

        declare -a INVALIDKEYS

        INVALIDKEYS=("key" "4" "5" "6" "key8" "9" '"' "baz")
        for key in "${INVALIDKEYS[@]}"; do
            val=$(./dracut-getarg "$key")
            # shellcheck disable=SC2181
            if (($? == 0)); then
                echo "key '$key' should not be found"
                ret=$((ret + 1))
            fi
            # must have no output
            [[ $val ]] && ret=$((ret + 1))
        done

        RESULT=("val" "val2")
        readarray -t args < <(./dracut-getargs "key2=")
        ((${#RESULT[@]} == ${#args[@]})) || ret=$((ret + 1))
        for ((i = 0; i < ${#RESULT[@]}; i++)); do
            [[ ${args[$i]} == "${RESULT[$i]}" ]] || ret=$((ret + 1))
        done

        val=$(./dracut-getarg "key1") || ret=$((ret + 1))
        [[ $val == "0" ]] || ret=$((ret + 1))

        val=$(./dracut-getarg "key2=val") && ret=$((ret + 1))
        # must have no output
        [[ $val ]] && ret=$((ret + 1))
        val=$(./dracut-getarg "key2=val2") || ret=$((ret + 1))
        # must have no output
        [[ $val ]] && ret=$((ret + 1))

        export PATH=".:$PATH"

        . dracut-dev-lib.sh
        . dracut-lib.sh

        debug_off() {
            :
        }

        debug_on() {
            :
        }

        getcmdline() {
            echo "rdbreak=cmdline rd.lvm rd.auto=0 rd.auto rd.retry=10"
        }
        RDRETRY=$(getarg rd.retry -d 'rd_retry=')
        [[ $RDRETRY == "10" ]] || ret=$((ret + 1))
        getarg rd.break=cmdline -d rdbreak=cmdline || ret=$((ret + 1))
        getargbool 1 rd.lvm -d -n rd_NO_LVM || ret=$((ret + 1))
        getargbool 0 rd.auto || ret=$((ret + 1))

        getcmdline() {
            echo "rd.break=cmdlined rd.lvm=0 rd.auto rd.auto=1 rd.auto=0"
        }
        getarg rd.break=cmdline -d rdbreak=cmdline && ret=$((ret + 1))
        getargbool 1 rd.lvm -d -n rd_NO_LVM && ret=$((ret + 1))
        getargbool 0 rd.auto && ret=$((ret + 1))

        getcmdline() {
            echo "ip=a ip=b ip=dhcp6"
        }
        getargs "ip=dhcp6" &> /dev/null || ret=$((ret + 1))
        readarray -t args < <(getargs "ip=")
        RESULT=("a" "b" "dhcp6")
        ((${#RESULT[@]} || ${#args[@]})) || ret=$((ret + 1))
        for ((i = 0; i < ${#RESULT[@]}; i++)); do
            [[ ${args[$i]} == "${RESULT[$i]}" ]] || ret=$((ret + 1))
        done

        getcmdline() {
            echo "bridge bridge=val"
        }
        readarray -t args < <(getargs bridge=)
        RESULT=("bridge" "val")
        ((${#RESULT[@]} == ${#args[@]})) || ret=$((ret + 1))
        for ((i = 0; i < ${#RESULT[@]}; i++)); do
            [[ ${args[$i]} == "${RESULT[$i]}" ]] || ret=$((ret + 1))
        done

        getcmdline() {
            echo "rd.break rd.md.uuid=bf96e457:230c9ad4:1f3e59d6:745cf942 rd.md.uuid=bf96e457:230c9ad4:1f3e59d6:745cf943 rd.shell"
        }
        readarray -t args < <(getargs rd.md.uuid -d rd_MD_UUID=)
        RESULT=("bf96e457:230c9ad4:1f3e59d6:745cf942" "bf96e457:230c9ad4:1f3e59d6:745cf943")
        ((${#RESULT[@]} == ${#args[@]})) || ret=$((ret + 1))
        for ((i = 0; i < ${#RESULT[@]}; i++)); do
            [[ ${args[$i]} == "${RESULT[$i]}" ]] || ret=$((ret + 1))
        done

        return $ret
    )
}

test_cleanup() {
    rm -fr -- "$TESTDIR"/*.rpm
    return 0
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
   0707010000031D000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/test/TEST-99-RPM    0707010000031E000081A400000000000000000000000164DF2CB80000001D000000000000000000000000000000000000003800000000dracut-055+suse.347.gdcb9bdbf/test/TEST-99-RPM/Makefile   -include ../Makefile.testdir
   0707010000031F000081ED00000000000000000000000164DF2CB800000EA1000000000000000000000000000000000000003700000000dracut-055+suse.347.gdcb9bdbf/test/TEST-99-RPM/test.sh    #!/bin/bash

# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# shellcheck disable=SC2034
TEST_DESCRIPTION="rpm integrity after dracut and kernel install"

test_check() {
    # disable for now
    return 1
    command -v rpm &> /dev/null && (command -v yum || command -v dnf) &> /dev/null
}

test_run() {
    set -x
    set -e
    export rootdir=$TESTDIR/root

    mkdir -p "$rootdir"

    mkdir -p "$rootdir/proc"
    mkdir -p "$rootdir/sys"
    mkdir -p "$rootdir/dev"
    mkdir -p "$rootdir/boot"

    trap 'ret=$?; [[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; } || :; exit $ret;' EXIT
    trap '[[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; } || :; exit 1;' SIGINT

    mount --bind /proc "$rootdir/proc"
    mount --bind /sys "$rootdir/sys"
    mount -t devtmpfs devtmpfs "$rootdir/dev"

    mkdir -p "$rootdir/$TESTDIR"
    cp --reflink=auto -a \
        "$TESTDIR"/dracut-[0-9]*."$(uname -m)".rpm \
        "$TESTDIR"/dracut-network-[0-9]*."$(uname -m)".rpm \
        "$rootdir/$TESTDIR/"
    . /etc/os-release
    dnf_or_yum=yum
    dnf_or_yum_cmd=yum
    command -v dnf > /dev/null && {
        dnf_or_yum="dnf"
        dnf_or_yum_cmd="dnf --allowerasing"
    }
    for ((i = 0; i < 5; i++)); do
        if $dnf_or_yum_cmd -v --nogpgcheck --installroot "$rootdir"/ --releasever "$VERSION_ID" --disablerepo='*' \
            --enablerepo=fedora --enablerepo=updates --setopt=install_weak_deps=False \
            install -y \
            $dnf_or_yum \
            passwd \
            rootfiles \
            systemd \
            systemd-udev \
            kernel \
            kernel-core \
            redhat-release \
            device-mapper-multipath \
            lvm2 \
            mdadm \
            bash \
            iscsi-initiator-utils \
            "$TESTDIR"/dracut-[0-9]*."$(uname -m)".rpm; then
            break
        fi
    done
    ((i < 5))

    cat > "$rootdir"/test.sh << EOF
#!/bin/bash
set -x
export LC_MESSAGES=C
rpm -Va 2>&1 | \\
    grep -F \\
           '85-display-manager.preset| /run| /var| /usr/lib/variant| /etc/machine-id| /etc/systemd/system/dbus-org.freedesktop.network1.service| /etc/systemd/system/dbus-org.freedesktop.resolve1.service| /etc/udev/hwdb.bin| /usr/share/info/dir.old' \\
        &> /test.output

find / -xdev -type f -not -path '/var/*' \\
    -not -path '/usr/lib/modules/*/modules.*' \\
    -not -path '/etc/*-' \\
    -not -path '/etc/.pwd.lock' \\
    -not -path '/run/mount/utab' \\
    -not -path '/test.sh' \\
    -not -path '/test.output' \\
    -not -path '/etc/nsswitch.conf.bak' \\
    -not -path '/etc/iscsi/initiatorname.iscsi' \\
    -not -path '/boot/*0-rescue*' \\
    -not -path '/usr/share/mime/*' \\
    -not -path '/etc/crypto-policies/*' \\
    -not -path '/dev/null' \\
    -not -path "/boot/loader/entries/\$(cat /etc/machine-id)-*" \\
    -not -path "/boot/\$(cat /etc/machine-id)/*" \\
    -not -path '/etc/openldap/certs/*' \\
    -not -path '/etc/dnf/*' \\
    -print0 | xargs -0 rpm -qf | \\
    grep -F 'not owned' &>> /test.output || :
exit 0
EOF

    chmod 0755 "$rootdir/test.sh"

    chroot "$rootdir" /test.sh || :

    if [[ -s "$rootdir"/test.output ]]; then
        failed=1
        echo TEST Failed >&2
        cat "$rootdir"/test.output >&2
    fi

    umount "$rootdir/proc"
    umount "$rootdir/sys"
    umount "$rootdir/dev"

    [[ $failed ]] && return 1
    return 0

}

test_setup() {
    make -C "$basedir" DESTDIR="$TESTDIR/" rpm
    return 0
}

test_cleanup() {
    rm -fr -- "$TESTDIR"/*.rpm
    return 0
}

# shellcheck disable=SC1090
. "$testdir"/test-functions
   07070100000320000081A400000000000000000000000164DF2CB800000039000000000000000000000000000000000000003100000000dracut-055+suse.347.gdcb9bdbf/test/ci-matrix.txt  01
02
03
04
10
11
12
13
14
15
16
17
20
30
31
40
50
60
70
   07070100000321000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002D00000000dracut-055+suse.347.gdcb9bdbf/test/container  07070100000322000081A400000000000000000000000164DF2CB80000048B000000000000000000000000000000000000003D00000000dracut-055+suse.347.gdcb9bdbf/test/container/Dockerfile-Arch  FROM docker.io/archlinux

MAINTAINER https://github.com/dracutdevs/dracut

ENV container docker
LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=host -e NAME=NAME -e IMAGE=IMAGE IMAGE"

RUN echo 'export DRACUT_NO_XATTR=1 KVERSION=$(cd /lib/modules; ls -1 | tail -1)' > /etc/profile.d/dracut-test.sh

# Install needed packages for the dracut CI container
RUN pacman --noconfirm -Sy \
    linux dash strace dhclient asciidoc cpio pigz \
    qemu btrfs-progs mdadm dmraid nfs-utils nfsidmap lvm2 nbd \
    dhcp networkmanager multipath-tools vi tcpdump open-iscsi \
    git shfmt shellcheck astyle which base-devel && yes | pacman  -Scc

RUN useradd -m build
RUN su build -c 'cd && git clone https://aur.archlinux.org/perl-config-general.git && cd perl-config-general && makepkg -s --noconfirm'
RUN pacman -U --noconfirm ~build/perl-config-general/*.pkg.tar.*
RUN su build -c 'cd && git clone https://aur.archlinux.org/tgt.git && cd tgt && echo "CFLAGS=-Wno-error=stringop-truncation" >> PKGBUILD && makepkg -s --noconfirm'
RUN pacman -U --noconfirm ~build/tgt/*.pkg.tar.*
RUN rm -fr ~build

# Set default command
CMD ["/usr/bin/bash"]
 07070100000323000081A400000000000000000000000164DF2CB800000488000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/test/container/Dockerfile-Fedora-33 FROM registry.fedoraproject.org/fedora:33

MAINTAINER https://github.com/dracutdevs/dracut

ENV container docker
LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=host -e NAME=NAME -e IMAGE=IMAGE IMAGE"

RUN echo 'export DRACUT_NO_XATTR=1 KVERSION=$(cd /lib/modules; ls -1 | tail -1)' > /etc/profile.d/dracut-test.sh

# Install needed packages for the dracut CI container
RUN dnf -y install --setopt=install_weak_deps=False \
    dash \
    pigz \
    asciidoc \
    mdadm \
    lvm2 \
    dmraid \
    cryptsetup \
    nfs-utils \
    nbd \
    dhcp-server \
    scsi-target-utils \
    iscsi-initiator-utils \
    strace \
    btrfs-progs \
    kmod-devel \
    gcc \
    bzip2 \
    xz \
    tar \
    wget \
    rpm-build \
    make \
    git \
    bash-completion \
    sudo \
    kernel \
    dhcp-client \
    /usr/bin/qemu-kvm \
    /usr/bin/qemu-system-$(uname -i) \
    e2fsprogs \
    tcpdump \
    iproute \
    iputils \
    dbus-daemon \
    kbd \
    NetworkManager \
    python3-imgcreate \
    which \
    ShellCheck \
    shfmt \
    && dnf -y update && dnf clean all

# Set default command
CMD ["/usr/bin/bash"]
07070100000324000081A400000000000000000000000164DF2CB800000488000000000000000000000000000000000000004200000000dracut-055+suse.347.gdcb9bdbf/test/container/Dockerfile-Fedora-34 FROM registry.fedoraproject.org/fedora:34

MAINTAINER https://github.com/dracutdevs/dracut

ENV container docker
LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=host -e NAME=NAME -e IMAGE=IMAGE IMAGE"

RUN echo 'export DRACUT_NO_XATTR=1 KVERSION=$(cd /lib/modules; ls -1 | tail -1)' > /etc/profile.d/dracut-test.sh

# Install needed packages for the dracut CI container
RUN dnf -y install --setopt=install_weak_deps=False \
    dash \
    pigz \
    asciidoc \
    mdadm \
    lvm2 \
    dmraid \
    cryptsetup \
    nfs-utils \
    nbd \
    dhcp-server \
    scsi-target-utils \
    iscsi-initiator-utils \
    strace \
    btrfs-progs \
    kmod-devel \
    gcc \
    bzip2 \
    xz \
    tar \
    wget \
    rpm-build \
    make \
    git \
    bash-completion \
    sudo \
    kernel \
    dhcp-client \
    /usr/bin/qemu-kvm \
    /usr/bin/qemu-system-$(uname -i) \
    e2fsprogs \
    tcpdump \
    iproute \
    iputils \
    dbus-daemon \
    kbd \
    NetworkManager \
    python3-imgcreate \
    which \
    ShellCheck \
    shfmt \
    && dnf -y update && dnf clean all

# Set default command
CMD ["/usr/bin/bash"]
07070100000325000081A400000000000000000000000164DF2CB80000048C000000000000000000000000000000000000004600000000dracut-055+suse.347.gdcb9bdbf/test/container/Dockerfile-Fedora-latest FROM registry.fedoraproject.org/fedora:latest

MAINTAINER https://github.com/dracutdevs/dracut

ENV container docker
LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=host -e NAME=NAME -e IMAGE=IMAGE IMAGE"

RUN echo 'export DRACUT_NO_XATTR=1 KVERSION=$(cd /lib/modules; ls -1 | tail -1)' > /etc/profile.d/dracut-test.sh

# Install needed packages for the dracut CI container
RUN dnf -y install --setopt=install_weak_deps=False \
    dash \
    pigz \
    asciidoc \
    mdadm \
    lvm2 \
    dmraid \
    cryptsetup \
    nfs-utils \
    nbd \
    dhcp-server \
    scsi-target-utils \
    iscsi-initiator-utils \
    strace \
    btrfs-progs \
    kmod-devel \
    gcc \
    bzip2 \
    xz \
    tar \
    wget \
    rpm-build \
    make \
    git \
    bash-completion \
    sudo \
    kernel \
    dhcp-client \
    /usr/bin/qemu-kvm \
    /usr/bin/qemu-system-$(uname -i) \
    e2fsprogs \
    tcpdump \
    iproute \
    iputils \
    dbus-daemon \
    kbd \
    NetworkManager \
    python3-imgcreate \
    which \
    ShellCheck \
    shfmt \
    && dnf -y update && dnf clean all

# Set default command
CMD ["/usr/bin/bash"]
07070100000326000081A400000000000000000000000164DF2CB80000048D000000000000000000000000000000000000004700000000dracut-055+suse.347.gdcb9bdbf/test/container/Dockerfile-Fedora-rawhide    FROM registry.fedoraproject.org/fedora:rawhide

MAINTAINER https://github.com/dracutdevs/dracut

ENV container docker
LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=host -e NAME=NAME -e IMAGE=IMAGE IMAGE"

RUN echo 'export DRACUT_NO_XATTR=1 KVERSION=$(cd /lib/modules; ls -1 | tail -1)' > /etc/profile.d/dracut-test.sh

# Install needed packages for the dracut CI container
RUN dnf -y install --setopt=install_weak_deps=False \
    dash \
    pigz \
    asciidoc \
    mdadm \
    lvm2 \
    dmraid \
    cryptsetup \
    nfs-utils \
    nbd \
    dhcp-server \
    scsi-target-utils \
    iscsi-initiator-utils \
    strace \
    btrfs-progs \
    kmod-devel \
    gcc \
    bzip2 \
    xz \
    tar \
    wget \
    rpm-build \
    make \
    git \
    bash-completion \
    sudo \
    kernel \
    dhcp-client \
    /usr/bin/qemu-kvm \
    /usr/bin/qemu-system-$(uname -i) \
    e2fsprogs \
    tcpdump \
    iproute \
    iputils \
    dbus-daemon \
    kbd \
    NetworkManager \
    python3-imgcreate \
    which \
    ShellCheck \
    shfmt \
    && dnf -y update && dnf clean all

# Set default command
CMD ["/usr/bin/bash"]
   07070100000327000081A400000000000000000000000164DF2CB800000462000000000000000000000000000000000000004800000000dracut-055+suse.347.gdcb9bdbf/test/container/Dockerfile-OpenSuse-latest   FROM registry.opensuse.org/opensuse/tumbleweed-dnf:latest

MAINTAINER https://github.com/dracutdevs/dracut

ENV container docker
LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=host -e NAME=NAME -e IMAGE=IMAGE IMAGE"

RUN echo 'export DRACUT_NO_XATTR=1 KVERSION=$(cd /lib/modules; ls -1 | tail -1)' > /etc/profile.d/dracut-test.sh

# Install needed packages for the dracut CI container
RUN dnf -y install --setopt=install_weak_deps=False \
    dash asciidoc mdadm lvm2 dmraid cryptsetup nfs-utils nbd dhcp-server \
    strace libkmod-devel gcc bzip2 xz tar wget rpm-build make git bash-completion \
    sudo kernel dhcp-client qemu-kvm /usr/bin/qemu-system-$(uname -m) e2fsprogs \
    tcpdump iproute iputils kbd NetworkManager btrfsprogs tgt dbus-broker \
    iscsiuio open-iscsi which ShellCheck procps pigz \
    && dnf -y update && dnf clean all

RUN shfmt_version=3.2.4; wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O /usr/local/bin/shfmt \
    && chmod +x /usr/local/bin/shfmt

# Set default command
CMD ["/usr/bin/bash"]
  07070100000328000081A400000000000000000000000164DF2CB80000009F000000000000000000000000000000000000003400000000dracut-055+suse.347.gdcb9bdbf/test/dracut.conf.test   #dracutmodules="base crypt lvm kernel-modules debug resume rootfs-block udev-rules network NFS"
#omit_dracutmodules="plymouth"
#drivers="ata_piix ext2 sd_mod"
 07070100000329000081ED00000000000000000000000164DF2CB800000672000000000000000000000000000000000000002C00000000dracut-055+suse.347.gdcb9bdbf/test/run-qemu   #!/bin/bash
# Check which virtualization technology to use
# We prefer kvm, kqemu, userspace in that order.

export PATH=/usr/sbin:/usr/bin:/sbin:/bin

[[ -x /usr/bin/qemu ]] && BIN=/usr/bin/qemu && ARGS=(-cpu max)
(lsmod | grep -q '^kqemu ') && BIN=/usr/bin/qemu && ARGS=(-kernel-kqemu -cpu host)
[[ -c /dev/kvm && -x /usr/bin/kvm ]] && BIN=/usr/bin/kvm && ARGS=(-cpu host)
[[ -c /dev/kvm && -x /usr/bin/qemu-kvm ]] && BIN=/usr/bin/qemu-kvm && ARGS=(-cpu host)
[[ -c /dev/kvm && -x /usr/libexec/qemu-kvm ]] && BIN=/usr/libexec/qemu-kvm && ARGS=(-cpu host)
[[ -x /usr/bin/qemu-system-$(uname -m) ]] && BIN=/usr/bin/qemu-system-$(uname -m) && ARGS=(-cpu max)
[[ -c /dev/kvm && -x /usr/bin/qemu-system-$(uname -m) ]] && BIN=/usr/bin/qemu-system-$(uname -m) && ARGS=(-enable-kvm -cpu host)

[[ $BIN ]] || {
    echo "Could not find a working KVM or QEMU to test with!" >&2
    echo "Please install kvm or qemu." >&2
    exit 1
}

# Provide rng device sourcing the hosts /dev/urandom and other standard parameters
ARGS+=(-M q35 -smp 2 -m 512 -nodefaults -vga none -display none -no-reboot -device virtio-rng-pci)

if ! [[ $* == *-daemonize* ]] && ! [[ $* == *-daemonize* ]]; then
    ARGS+=(-serial stdio)
fi

KVERSION=${KVERSION-$(uname -r)}

VMLINUZ="/lib/modules/${KVERSION}/vmlinuz"

if ! [ -f "$VMLINUZ" ]; then
    [[ -f /etc/machine-id ]] && read -r MACHINE_ID < /etc/machine-id

    if [[ $MACHINE_ID ]] && { [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]]; }; then
        VMLINUZ="/boot/${MACHINE_ID}/$KVERSION/linux"
    else
        VMLINUZ="/boot/vmlinuz-${KVERSION}"
    fi
fi

exec "$BIN" "${ARGS[@]}" -kernel "$VMLINUZ" "$@"
  0707010000032A000081A400000000000000000000000164DF2CB80000177F000000000000000000000000000000000000003200000000dracut-055+suse.347.gdcb9bdbf/test/test-functions #!/bin/bash
PATH=/usr/sbin:/usr/bin:/sbin:/bin
export PATH

# shellcheck disable=SC1090
[[ -e .testdir${TEST_RUN_ID:+-$TEST_RUN_ID} ]] && . .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
if [[ -z $TESTDIR ]] || [[ ! -d $TESTDIR ]]; then
    TESTDIR=$(mktemp -d -p "/var/tmp" -t dracut-test.XXXXXX)
fi
echo "TESTDIR=\"$TESTDIR\"" > .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
export TESTDIR

command -v test_check &> /dev/null || test_check() {
    :
}

# terminal sequence to set color to a 'success' color (currently: green)
function SETCOLOR_SUCCESS() { echo -en '\033[0;32m'; }
# terminal sequence to set color to a 'failure' color (currently: red)
function SETCOLOR_FAILURE() { echo -en '\033[0;31m'; }
# terminal sequence to set color to a 'warning' color (currently: yellow)
function SETCOLOR_WARNING() { echo -en '\033[0;33m'; }
# terminal sequence to reset to the default color.
function SETCOLOR_NORMAL() { echo -en '\033[0;39m'; }

COLOR_SUCCESS='\033[0;32m'
COLOR_FAILURE='\033[0;31m'
COLOR_WARNING='\033[0;33m'
COLOR_NORMAL='\033[0;39m'

check_root() {
    if ((EUID != 0)); then
        SETCOLOR_FAILURE
        echo "Tests must be run as root! Please use 'sudo'."
        SETCOLOR_NORMAL
        exit 1
    fi
}

# generate qemu arguments for named raw disks
#
# qemu_add_drive_args <index> <args> <filename> <id-name> [<bootindex>]
#
# index: name of the index variable (set to 0 at start)
# args: name of the argument array variable (set to () at start)
# filename: filename of the raw disk image
# id-name: name of the disk in /dev/disk/by-id -> /dev/disk/by-id/ata-disk_$name
# bootindex: optional bootindex number
#
# to be used later with `qemu … "${args[@]}" …`
# The <index> variable will be incremented each time the function is called.
#
# can't be easier than this :-/
#
# # EXAMPLES
# ```
#   declare -a disk_args=()
#   declare -i disk_index=0
#   qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.ext3 root 1
#   qemu_add_drive_args disk_index disk_args "$TESTDIR"/client.img client
#   qemu_add_drive_args disk_index disk_args "$TESTDIR"/iscsidisk2.img iscsidisk2
#   qemu_add_drive_args disk_index disk_args "$TESTDIR"/iscsidisk3.img iscsidisk3
#   qemu "${disk_args[@]}"
# ```
qemu_add_drive_args() {
    local index=${!1}
    local file=$3
    local name=${4:-$index}
    local bootindex=$5

    eval "${2}"'+=(' \
        -drive "if=none,format=raw,file=${file},id=drive-sata${index}" \
        -device "ide-hd,bus=ide.${index},drive=drive-sata${index},id=sata${index},${bootindex:+bootindex=$bootindex,}model=disk,serial=${name}" \
        ')'

    # shellcheck disable=SC2219
    let "${1}++"
}

while (($# > 0)); do
    case $1 in
        --run)
            check_root
            echo "TEST RUN: $TEST_DESCRIPTION"
            test_check && test_run
            exit $?
            ;;
        --setup)
            check_root
            echo "TEST SETUP: $TEST_DESCRIPTION"
            test_check && test_setup
            exit $?
            ;;
        --clean)
            echo "TEST CLEANUP: $TEST_DESCRIPTION"
            test_cleanup
            rm -fr -- "$TESTDIR"
            rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
            exit $?
            ;;
        --all)
            check_root
            if ! test_check 2 &> test${TEST_RUN_ID:+-$TEST_RUN_ID}.log; then
                echo -e "TEST: $TEST_DESCRIPTION " "$COLOR_WARNING" "[SKIPPED]" "$COLOR_NORMAL"
                exit 0
            else
                echo -e "TEST: $TEST_DESCRIPTION " "$COLOR_SUCCESS" "[STARTED]" "$COLOR_NORMAL"
            fi
            if [[ $V == "1" ]]; then
                set -o pipefail
                (
                    test_setup && test_run
                    ret=$?
                    test_cleanup
                    if ((ret != 0)) && [[ -f "$TESTDIR"/server.log ]]; then
                        mv "$TESTDIR"/server.log ./server${TEST_RUN_ID:+-$TEST_RUN_ID}.log
                    fi
                    rm -fr -- "$TESTDIR"
                    rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
                    exit $ret
                ) < /dev/null 2>&1 | tee "test${TEST_RUN_ID:+-$TEST_RUN_ID}.log"
            elif [[ $V == "2" ]]; then
                set -o pipefail
                # shellcheck disable=SC2154
                (
                    test_setup && test_run
                    ret=$?
                    test_cleanup
                    if ((ret != 0)) && [[ -f "$TESTDIR"/server.log ]]; then
                        mv "$TESTDIR"/server.log ./server${TEST_RUN_ID:+-$TEST_RUN_ID}.log
                    fi
                    rm -fr -- "$TESTDIR"
                    rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
                    exit $ret
                ) < /dev/null 2>&1 | "$basedir/logtee" "test${TEST_RUN_ID:+-$TEST_RUN_ID}.log"
            else
                (
                    test_setup && test_run
                    ret=$?
                    test_cleanup
                    rm -fr -- "$TESTDIR"
                    rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
                    exit $ret
                ) < /dev/null > test${TEST_RUN_ID:+-$TEST_RUN_ID}.log 2>&1
            fi
            ret=$?
            set +o pipefail
            if [ $ret -eq 0 ]; then
                rm -- test${TEST_RUN_ID:+-$TEST_RUN_ID}.log
                echo -e "TEST: $TEST_DESCRIPTION " "$COLOR_SUCCESS" "[OK]" "$COLOR_NORMAL"
            else
                echo -e "TEST: $TEST_DESCRIPTION " "$COLOR_FAILURE" "[FAILED]" "$COLOR_NORMAL"
                if [ "$V" == "2" ]; then
                    tail -c 1048576 "$(pwd)/server${TEST_RUN_ID:+-$TEST_RUN_ID}.log" "$(pwd)/test${TEST_RUN_ID:+-$TEST_RUN_ID}.log"
                    echo -e "TEST: $TEST_DESCRIPTION " "$COLOR_FAILURE" "[FAILED]" "$COLOR_NORMAL"
                else
                    echo "see $(pwd)/test${TEST_RUN_ID:+-$TEST_RUN_ID}.log"
                fi
            fi
            exit $ret
            ;;
        *) break ;;
    esac
    shift
done
 0707010000032B000041ED00000000000000000000000164DF2CB800000000000000000000000000000000000000000000002400000000dracut-055+suse.347.gdcb9bdbf/tools   0707010000032C000081ED00000000000000000000000164DF2CB800000517000000000000000000000000000000000000003000000000dracut-055+suse.347.gdcb9bdbf/tools/git2spec.pl   #!/usr/bin/perl

sub create_patches {
    my $tag=shift;
    my $pdir=shift;
    my $n=1;
    my @lines;
    my $fname;
    my $f=0;

    mkdir $pdir, 0755;

    open( GIT, 'git log -p --pretty=email --stat -m --first-parent --reverse --binary '.$tag.'..HEAD |');

    while (<GIT>) {
        if (/^From [a-z0-9]{40} .*$/) {
            $fname = sprintf("%04d", $n++).".patch";
            open FH, ">".$pdir."/".$fname;
            $f=1;
        }
        if (/^---$/ && $f == 1) {
            push @lines, $fname;
            $f=0;
        }
        print FH;
    }

    return @lines;
};

use POSIX qw(strftime);
my $datestr = strftime "%Y%m%d", gmtime;

my $tag=shift;
my $pdir=shift;
$tag=`git describe --abbrev=0 --tags` if not defined $tag;
chomp($tag);
my @patches=&create_patches($tag, $pdir);
my $num=$#patches + 2;
$tag=~s/[^0-9]+?([0-9]+)/$1/ if $tag !~ /\b[0-9a-f]{5,40}\b/;
my $release="$num.git$datestr";
$release="1" if $num == 1;

while(<>) {
    if (/^Version:/) {
	print "Version: $tag\n";
    }
    elsif (/^%define dist_free_release/) {
	print "%define dist_free_release $release\n";
    }
    elsif ((/^Source0:/) || (/^Source:/)) {
	print $_;
	$num=1;
	for(@patches) {
	    s/.*\///g;
	    print "Patch$num: $_\n";
	    $num++;
	}
	print "\n";
    }
    else {
	print $_;
    }
}
 0707010000032D000081A400000000000000000000000164DF2CB8000006CC000000000000000000000000000000000000002F00000000dracut-055+suse.347.gdcb9bdbf/tools/profile.py    #
# parse the output of "dracut --profile" and produce profiling information
#
# Copyright 2011 Harald Hoyer <harald@redhat.com>
# Copyright 2011 Red Hat, Inc.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import sys
import operator
import re
loglines = sys.stdin

logpats  = r'[+]+[ \t]+([^ \t]+)[ \t]+([^ \t:]+):[ ]+.*'

logpat   = re.compile(logpats)

groups   = (logpat.match(line) for line in loglines)
tuples   = (g.groups() for g in groups if g)

def gen_times(t):
    oldx=None
    for x in t:
        fx=float(x[0])
        if oldx:
            #print fx - float(oldx[0]), x[0], x[1], oldx[0], oldx[1]
            if ((fx - float(oldx[0])) > 0):
                    yield (fx - float(oldx[0]), oldx[1])

        oldx = x

colnames = ('time','line')

log      = (dict(zip(colnames,t)) for t in gen_times(tuples))

if __name__ == '__main__':
    e={}
    for x in log:
        if not x['line'] in e:
            e[x['line']] = x['time']
        else:
            e[x['line']] += x['time']

    sorted_x = sorted(e.iteritems(), key=operator.itemgetter(1), reverse=True)
    for x in sorted_x:
        print x[0], x[1]

0707010000032E000081ED00000000000000000000000164DF2CB800000536000000000000000000000000000000000000003300000000dracut-055+suse.347.gdcb9bdbf/tools/test-github.sh    #!/bin/bash

set -ex

[[ -d ${0%/*} ]] && cd "${0%/*}"/../

RUN_ID="$1"
TESTS=$2

./configure

NCPU=$(getconf _NPROCESSORS_ONLN)

if ! [[ $TESTS ]]; then
    # GitHub workflows fetch a clone of the dracut repository which doesn't
    # contain git tags, thus "breaking" the RPM build in certain situations
    # i.e.:
    # DRACUT_MAIN_VERSION in Makefile is defined as an output of `git describe`,
    # which in full git clone returns a tag with a numeric version. However,
    # without tags it returns SHA of the last commit, which later propagates into
    # `Provides:` attribute of the built RPM and can break dependency tree when
    # installed
    [[ -d .git ]] && git fetch --tags && git describe --tags
    make -j "$NCPU" all syncheck rpm logtee
else
    if [[ $TESTS == "99" ]]; then
        [[ -d .git ]] && git fetch --tags && git describe --tags
        make_docs=yes
    else
        make_docs=no
    fi

    make -j "$NCPU" enable_documentation=$make_docs all logtee

    cd test

    # shellcheck disable=SC2012
    time LOGTEE_TIMEOUT_MS=590000 make \
        enable_documentation=$make_docs \
        KVERSION="$(
            cd /lib/modules
            ls -1 | tail -1
        )" \
        DRACUT_NO_XATTR=1 \
        TEST_RUN_ID="$RUN_ID" \
        ${TESTS:+TESTS="$TESTS"} \
        -k V=1 \
        check
fi
  07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!                                                                                    3974 blocks
