Compare commits
No commits in common. "master" and "049" have entirely different histories.
|
@ -1,9 +0,0 @@
|
|||
lineend=linux
|
||||
style=linux
|
||||
indent=spaces=8
|
||||
convert-tabs
|
||||
min-conditional-indent=0
|
||||
max-instatement-indent=120
|
||||
align-pointer=name
|
||||
max-code-length=120
|
||||
|
|
@ -1,25 +1,7 @@
|
|||
; 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.
|
||||
;;; Directory Local Variables
|
||||
;;; For more information see (info "(emacs) Directory Variables")
|
||||
|
||||
((sh-mode
|
||||
(indent-tabs-mode)
|
||||
(sh-basic-offset . 4)))
|
||||
|
||||
((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))) )
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
# 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
|
|
@ -1,9 +0,0 @@
|
|||
# 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.
|
||||
* @haraldh @danimo @johannbg
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
---
|
||||
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.
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
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.
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
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.
|
|
@ -1,293 +0,0 @@
|
|||
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/**/*
|
|
@ -1,10 +0,0 @@
|
|||
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 #
|
|
@ -1,21 +0,0 @@
|
|||
# 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
|
|
@ -1,53 +0,0 @@
|
|||
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-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' }}
|
|
@ -1,81 +0,0 @@
|
|||
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 }}
|
|
@ -1,11 +0,0 @@
|
|||
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 }}"
|
|
@ -1,38 +0,0 @@
|
|||
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
|
|
@ -1,19 +0,0 @@
|
|||
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 }}
|
||||
|
|
@ -1,30 +1,23 @@
|
|||
/Makefile.inc
|
||||
/man/dracut.8
|
||||
/man/dracut-catimages.8
|
||||
/man/dracut.conf.5
|
||||
/dracut.8
|
||||
/dracut-catimages.8
|
||||
/dracut.conf.5
|
||||
/dracut.conf.d/*.conf
|
||||
/man/dracut.cmdline.7
|
||||
/dracut-gencmdline.8
|
||||
/dracut.html
|
||||
/man/dracut.kernel.7
|
||||
/man/dracut.bootup.7
|
||||
/man/dracut.modules.7
|
||||
/man/lsinitrd.1
|
||||
/dracut.kernel.7
|
||||
/dracut.pc
|
||||
/dracut-install
|
||||
/modules.d/99base/switch_root
|
||||
/test/*/test.log
|
||||
/test/*/.testdir
|
||||
test*.img
|
||||
/.buildpath
|
||||
/.project
|
||||
/dracut-version.sh
|
||||
/src/install/dracut-install
|
||||
/install/dracut-install
|
||||
/*.rpm
|
||||
/*.[0-9]
|
||||
/modules.d/98dracut-systemd/*.service.8
|
||||
/*.sign
|
||||
*.o
|
||||
/src/skipcpio/skipcpio
|
||||
/src/util/util
|
||||
/dracut-util
|
||||
.idea/
|
||||
skipcpio/skipcpio
|
||||
|
|
11
.mailmap
11
.mailmap
|
@ -2,10 +2,9 @@ Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer-omB+W0Dpw2o@public.gm
|
|||
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@profian.com> <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
|
||||
Harald Hoyer <harald@profian.com> <harald@eeepc.(none)>
|
||||
Harald Hoyer <harald@profian.com> <harald@hoyer.xyz>
|
||||
Harald Hoyer <harald@profian.com> <harald@redhat.com>
|
||||
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>
|
||||
|
@ -32,7 +31,3 @@ 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>
|
||||
|
|
55
.packit.yml
55
.packit.yml
|
@ -1,55 +0,0 @@
|
|||
# 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
|
|
@ -1,34 +0,0 @@
|
|||
# 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
|
|
@ -0,0 +1,47 @@
|
|||
language: generic
|
||||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
env:
|
||||
matrix:
|
||||
- IMAGE=latest
|
||||
- IMAGE=latest TESTS=01
|
||||
- IMAGE=latest TESTS=12
|
||||
- IMAGE=latest TESTS=20
|
||||
- IMAGE=latest TESTS=50
|
||||
- IMAGE=latest TESTS=30
|
||||
- IMAGE=latest TESTS=31
|
||||
- IMAGE=latest TESTS=70
|
||||
- IMAGE=latest TESTS=99
|
||||
- IMAGE=latest TESTS=02
|
||||
- IMAGE=latest TESTS=03
|
||||
- IMAGE=latest TESTS=04
|
||||
- IMAGE=latest TESTS=10
|
||||
- IMAGE=latest TESTS=11
|
||||
- IMAGE=latest TESTS=13
|
||||
- IMAGE=latest TESTS=14
|
||||
- IMAGE=latest TESTS=15
|
||||
- IMAGE=latest TESTS=17
|
||||
|
||||
before_script:
|
||||
- docker pull fedora:$IMAGE
|
||||
- |
|
||||
sudo modprobe kvm-intel nested=1 || :
|
||||
sudo modprobe kvm-amd nested=1 || :
|
||||
dmesg | tail || :
|
||||
- git pull --depth=100
|
||||
- |
|
||||
git describe --abbrev=0 --tags || :
|
||||
git describe --tags || :
|
||||
|
||||
script:
|
||||
- docker run --privileged -it -v $(pwd)/:/dracut fedora:$IMAGE /dracut/fedora-test.sh $IMAGE-$$ "$TESTS"
|
||||
|
||||
notifications:
|
||||
webhooks:
|
||||
urls:
|
||||
- https://webhooks.gitter.im/e/effa917ca3e0ed5fd00e
|
||||
on_success: change # options: [always|never|change] default: always
|
||||
on_failure: always # options: [always|never|change] default: always
|
||||
on_start: never # options: [always|never|change] default: always
|
||||
|
15
.vimrc
15
.vimrc
|
@ -1,15 +0,0 @@
|
|||
" 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
|
|
@ -35,26 +35,21 @@ case "$COMMAND" in
|
|||
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
|
||||
fi
|
||||
|
||||
read -r -d '' -a line < /proc/cmdline
|
||||
for i in "${line[@]}"; do
|
||||
[[ "${i#initrd=*}" != "$i" ]] && continue
|
||||
BOOT_OPTIONS+=("$i")
|
||||
done
|
||||
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
|
||||
read -r -d '' -a BOOT_OPTIONS < /proc/cmdline
|
||||
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"
|
||||
dracut ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
|
||||
ret=$?
|
||||
;;
|
||||
remove)
|
|
@ -0,0 +1,68 @@
|
|||
#!/bin/bash
|
||||
|
||||
export LANG=C
|
||||
|
||||
KERNEL_VERSION="$1"
|
||||
KERNEL_IMAGE="$2"
|
||||
|
||||
[[ -f /etc/os-release ]] && . /etc/os-release
|
||||
|
||||
if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then
|
||||
systemd-machine-id-setup
|
||||
fi
|
||||
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
[[ $MACHINE_ID ]] || exit 1
|
||||
[[ -f $KERNEL_IMAGE ]] || exit 1
|
||||
|
||||
INITRDFILE="/boot/initramfs-0-rescue-${MACHINE_ID}.img"
|
||||
NEW_KERNEL_IMAGE="${KERNEL_IMAGE%/*}/vmlinuz-0-rescue-${MACHINE_ID}"
|
||||
|
||||
[[ -f $INITRDFILE ]] && [[ -f $NEW_KERNEL_IMAGE ]] && exit 0
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
# source our config dir
|
||||
for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
|
||||
[[ $dracut_rescue_image != "yes" ]] && exit 0
|
||||
|
||||
if [[ ! -f $INITRDFILE ]]; then
|
||||
dracut --no-hostonly -a "rescue" "$INITRDFILE" "$KERNEL_VERSION"
|
||||
((ret+=$?))
|
||||
fi
|
||||
|
||||
if [[ ! -f $NEW_KERNEL_IMAGE ]]; then
|
||||
cp --reflink=auto "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
|
||||
((ret+=$?))
|
||||
fi
|
||||
|
||||
new-kernel-pkg --install "$KERNEL_VERSION" --kernel-image "$NEW_KERNEL_IMAGE" --initrdfile "$INITRDFILE" --banner "$NAME $VERSION_ID Rescue $MACHINE_ID"
|
||||
|
||||
((ret+=$?))
|
||||
|
||||
exit $ret
|
|
@ -14,8 +14,8 @@ dropindirs_sort()
|
|||
args=("$@")
|
||||
files=$(
|
||||
while (( $# > 0 )); do
|
||||
for i in "${1}"/*"${suffix}"; do
|
||||
[[ -f $i ]] && echo "${i##*/}"
|
||||
for i in ${1}/*${suffix}; do
|
||||
[[ -f $i ]] && echo ${i##*/}
|
||||
done
|
||||
shift
|
||||
done | sort -Vu
|
||||
|
@ -36,7 +36,7 @@ dropindirs_sort()
|
|||
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
|
||||
read MACHINE_ID < /etc/machine-id
|
||||
fi
|
||||
|
||||
if ! [[ $MACHINE_ID ]]; then
|
||||
|
@ -47,9 +47,9 @@ 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
|
||||
fi
|
||||
|
||||
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
|
||||
read -r -d '' -a line < /proc/cmdline
|
||||
for i in "${line[@]}"; do
|
||||
[[ "${i#initrd=*}" != "$i" ]] && continue
|
||||
|
@ -57,6 +57,12 @@ else
|
|||
done
|
||||
fi
|
||||
|
||||
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
|
||||
echo "Could not determine the kernel command line parameters." >&2
|
||||
echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -d "${BOOT_DIR_ABS%/*}" ]]; then
|
||||
BOOT_DIR="/${MACHINE_ID}/0-rescue"
|
||||
BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}
|
||||
|
@ -80,13 +86,9 @@ case "$COMMAND" in
|
|||
|
||||
# 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
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
[[ $dracut_rescue_image != "yes" ]] && exit 0
|
||||
|
||||
[[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS"
|
||||
|
@ -96,7 +98,7 @@ case "$COMMAND" in
|
|||
fi
|
||||
|
||||
if [[ ! -f "$BOOT_DIR_ABS/$INITRD" ]]; then
|
||||
dracut -f --no-hostonly -a "rescue" "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
|
||||
dracut --no-hostonly -a "rescue" "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
|
||||
((ret+=$?))
|
||||
fi
|
||||
|
||||
|
@ -105,17 +107,13 @@ case "$COMMAND" in
|
|||
echo "title $PRETTY_NAME - Rescue Image"
|
||||
echo "version $KERNEL_VERSION"
|
||||
echo "machine-id $MACHINE_ID"
|
||||
echo "options ${BOOT_OPTIONS[*]} rd.auto=1"
|
||||
echo "options ${BOOT_OPTIONS[@]} rd.auto=1"
|
||||
echo "linux $BOOT_DIR/linux"
|
||||
echo "initrd $BOOT_DIR/initrd"
|
||||
} > "$LOADER_ENTRY"
|
||||
} > $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"
|
||||
cp -aT "${KERNEL_IMAGE%/*}/bls.conf" $LOADER_ENTRY
|
||||
sed -i 's/'$KERNEL_VERSION'/0-rescue-'${MACHINE_ID}'/' $LOADER_ENTRY
|
||||
fi
|
||||
|
||||
((ret+=$?))
|
176
AUTHORS
176
AUTHORS
|
@ -1,133 +1,95 @@
|
|||
Harald Hoyer <harald@profian.com>
|
||||
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>
|
||||
Martin Wilck <mwilck@suse.de>
|
||||
Daniel Molkentin <dmolkentin@suse.com>
|
||||
Amerigo Wang <amwang@redhat.com>
|
||||
Thomas Renninger <trenn@suse.com>
|
||||
Lukas Nykryn <lnykryn@redhat.com>
|
||||
Alexander Tsoy <alexander@tsoy.me>
|
||||
Frederick Grose <fgrose@sugarlabs.org>
|
||||
Antonio Alvarez Feijoo <antonio.feijoo@suse.com>
|
||||
WANG Chao <chaowang@redhat.com>
|
||||
Beniamino Galvani <bgalvani@redhat.com>
|
||||
Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Peter Robinson <pbrobinson@fedoraproject.org>
|
||||
David Disseldorp <ddiss@suse.de>
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
Jonathan Lebon <jonathan@jlebon.com>
|
||||
Frantisek Sumsal <frantisek@sumsal.cz>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
Thomas Blume <thomas.blume@suse.com>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Renaud Métrich <rmetrich@redhat.com>
|
||||
Tomasz Paweł Gajc <tpgxyz@gmail.com>
|
||||
Peter Robinson <pbrobinson@fedoraproject.org>
|
||||
Fabian Vogt <fvogt@suse.com>
|
||||
Nicolas Chauvet <kwizart@gmail.com>
|
||||
Zoltán Böszörményi <zboszor@pr.hu>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Kairui Song <kasong@redhat.com>
|
||||
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>
|
||||
Dusty Mabe <dusty@dustymabe.com>
|
||||
Shreenidhi Shedi <sshedi@vmware.com>
|
||||
Lubomir Rintel <lkundrak@v3.sk>
|
||||
Angelo "pallotron" Failla <pallotron@fb.com>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
David Tardon <dtardon@redhat.com>
|
||||
David Teigland <teigland@redhat.com>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
Ville Skyttä <ville.skytta@iki.fi>
|
||||
Böszörményi Zoltán <zboszor@pr.hu>
|
||||
Cristian Rodríguez <crrodriguez@opensuse.org>
|
||||
Javier Martinez Canillas <javierm@redhat.com>
|
||||
Ondrej Mosnacek <omosnace@redhat.com>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
Baoquan He <bhe@redhat.com>
|
||||
Brendan Germain <brendan.germain@nasdaqomx.com>
|
||||
Jonas Witschel <diabonas@gmx.de>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Leho Kraav <leho@kraav.com>
|
||||
Marcos Mello <marcosfrm@gmail.com>
|
||||
Mike Gilbert <floppym@gentoo.org>
|
||||
Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
|
||||
Moritz Maxeiner <moritz@ucworks.org>
|
||||
Nathan Rini <nate@ucar.edu>
|
||||
Radek Vykydal <rvykydal@redhat.com>
|
||||
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
|
||||
Đoàn Trần Công Danh <congdanhqx@gmail.com>
|
||||
Nicolas Chauvet <kwizart@gmail.com>
|
||||
Ondrej Mosnacek <omosnace@redhat.com>
|
||||
Fabian Deutsch <fabiand@fedoraproject.org>
|
||||
Javier Martinez Canillas <javierm@redhat.com>
|
||||
Kamil Rytarowski <n54@gmx.com>
|
||||
Laszlo Gombos <laszlo.gombos@gmail.com>
|
||||
Lidong Zhong <lidong.zhong@suse.com>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
NeilBrown <neilb@suse.de>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Radek Vykydal <rvykydal@redhat.com>
|
||||
Thorsten Behrens <tbehrens@suse.com>
|
||||
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>
|
||||
Martin Wilck <mwilck@suse.de>
|
||||
Mike Gilbert <floppym@gentoo.org>
|
||||
Milan Broz <mbroz@redhat.com>
|
||||
Mimi Zohar <zohar@linux.vnet.ibm.com>
|
||||
Norbert Lange <norbert.lange@andritz.com>
|
||||
Pingfan Liu <piliu@redhat.com>
|
||||
Roberto Sassu <roberto.sassu@polito.it>
|
||||
Stefan Reimer <it@startux.de>
|
||||
Takashi Iwai <tiwai@suse.de>
|
||||
Tony Asleson <tasleson@redhat.com>
|
||||
Adam Williamson <awilliam@redhat.com>
|
||||
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>
|
||||
Marcos Mello <marcosfrm@gmail.com>
|
||||
Marian Ganisin <mganisin@redhat.com>
|
||||
Masahiro Matsuya <mmatsuya@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>
|
||||
Stefan Berger <stefanb@linux.ibm.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>
|
||||
tpgxyz <tpgxyz@gmail.com>
|
||||
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
||||
Alan Pevec <apevec@redhat.com>
|
||||
Alex Harpin <development@landsofshadow.co.uk>
|
||||
Alexander Wenzel <alexander.wenzel@qbeyond.de>
|
||||
Alexey Shabalin <shaba@altlinux.org>
|
||||
Andre Russ <andre.russ@sap.com>
|
||||
Andreas Schwab <schwab@suse.de>
|
||||
Ankit Kumar <ankit@linux.vnet.ibm.com>
|
||||
Antony Messerli <amesserl@rackspace.com>
|
||||
Chao Fan <cfan@redhat.com>
|
||||
Cornelius Hoffmann <coding@hoffmn.de>
|
||||
Daniel Cordero <dracut@0xdc.io>
|
||||
Daniel Kahn Gillmor <dkg@fifthhorseman.net>
|
||||
Daniel Schaal <farbing@web.de>
|
||||
Denis Silakov <dsilakov@virtuozzo.com>
|
||||
|
@ -139,208 +101,128 @@ 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>
|
||||
José María Fernández <josemariafg@gmail.com>
|
||||
Julian Wolf <juwolf@suse.com>
|
||||
Kairui Song <kasong@tencent.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@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>
|
||||
Zoltán Böszörményi <zboszor@gmail.com>
|
||||
Érico Rolim <erico.erc@gmail.com>
|
||||
наб <nabijaczleweli@nabijaczleweli.xyz>
|
||||
A. Wilcox <AWilcox@Wilcox-Tech.com>
|
||||
Adam Alves <adamoa@gmail.com>
|
||||
Adrien Thierry <athierry@redhat.com>
|
||||
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
|
||||
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 Stieger <astieger@suse.com>
|
||||
Andrew J. Hesford <ajh@sideband.org>
|
||||
Andrey Sokolov <keremet@altlinux.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>
|
||||
Brandon Sloane <btsloane@verizon.net>
|
||||
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>
|
||||
Charles Rose <charles.rose@dell.com>
|
||||
Christian Heinz <christian.ch.heinz@gmail.com>
|
||||
Coiby Xu <coxu@redhat.com>
|
||||
Cong Wang <amwang@redhat.com>
|
||||
Dan Fuhry <dfuhry@datto.com>
|
||||
Dave Jones <davej@redhat.com>
|
||||
David Hildenbrand <david@redhat.com>
|
||||
David Disseldorp <ddiss@suse.de>
|
||||
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>
|
||||
Dirk Müller <dirk@dmllr.de>
|
||||
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>
|
||||
Glenn Morris <rgm@stanford.edu>
|
||||
GuoChuang <guo.chuang@zte.com.cn>
|
||||
HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
|
||||
Hari Bathini <hbathini@linux.ibm.com>
|
||||
Hendrik Brueckner <brueckner@linux.ibm.com>
|
||||
Henrik Gombos <henrik99999@gmail.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>
|
||||
LinkTed <link.ted@mailbox.org>
|
||||
Luca BRUNO <luca.bruno@coreos.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>
|
||||
Marko Myllynen <myllynen@redhat.com>
|
||||
Matt <smoothsailing72@hotmail.com>
|
||||
Matt Smith <shadowfax@gmx.com>
|
||||
Matthias Berndt <matthias_berndt@gmx.de>
|
||||
Matthew Thode <mthode@mthode.org>
|
||||
Mei Liu <liumbj@linux.vnet.ibm.com>
|
||||
Michael Chapman <mike@very.puzzling.org>
|
||||
Michael McCracken <michael.mccracken@gmail.com>
|
||||
Michal Koutný <mkoutny@suse.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 Valena <pvalena@redhat.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>
|
||||
Renaud Métrich <rmetrich@redhat.com>
|
||||
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>
|
||||
Thomas Haller <thaller@redhat.com>
|
||||
Thomas Blume <thomas.blume@suse.com>
|
||||
Tobias Geerinckx <tobias.geerinckx@gmail.com>
|
||||
Tobias Klauser <tklauser@distanz.ch>
|
||||
Tom Gundersen <teg@jklm.no>
|
||||
Tomasz Paweł Gajc <tpgxyz@gmail.com>
|
||||
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>
|
||||
joshuacov1 <joshuacov@gmail.com>
|
||||
lapseofreason <lapseofreason0@gmail.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>
|
||||
tpg <tpgxyz@gmail.com>
|
||||
xtraeme <xtraeme@voidlinux.eu>
|
||||
Дамјан Георгиевски <gdamjan@gmail.com>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
Right now, most of the testing is done using a qemu/kvm guest and
|
||||
generating the initramfs on another box but the support is all present
|
||||
to build for the "running" machine. For the former, you can boot the guest
|
||||
using qemu's -kernel and -initrd options.
|
||||
|
||||
dracut exists and will build an image. It is command-line equivalent
|
||||
to most mkinitrd implementations and should be pretty straight-forward
|
||||
to use.
|
||||
|
||||
To use, just run dracut with an output file name and, optionally, a
|
||||
kernel version (it defaults to using the current). The appropriate
|
||||
modules will be copied over and things should be good to go. If you'd
|
||||
like to customize the list of modules copied in, edit /etc/dracut.conf
|
||||
and set
|
||||
dracutmodules="foo bar baz"
|
||||
|
||||
Note that dracut calls functional components in modules.d "modules"
|
||||
while kernel modules are called "drivers".
|
||||
|
||||
Requirements:
|
||||
* udev
|
||||
* nfs module: nfs daemon and rpc helper
|
||||
* iscsi: iscsi
|
248
Makefile
248
Makefile
|
@ -1,22 +1,10 @@
|
|||
-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)
|
||||
VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags --always 2>/dev/null || echo $(DRACUT_VERSION))
|
||||
GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags --always 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
|
||||
|
||||
-include Makefile.inc
|
||||
|
||||
KVERSION ?= $(shell uname -r)
|
||||
|
||||
prefix ?= /usr
|
||||
libdir ?= ${prefix}/lib
|
||||
datadir ?= ${prefix}/share
|
||||
|
@ -24,20 +12,23 @@ 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
|
||||
CFLAGS ?= -O2 -g -Wall
|
||||
CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 $(KMOD_CFLAGS)
|
||||
bashcompletiondir ?= ${datadir}/bash-completion/completions
|
||||
pkgconfigdatadir ?= $(datadir)/pkgconfig
|
||||
|
||||
man1pages = man/lsinitrd.1
|
||||
man1pages = lsinitrd.1
|
||||
|
||||
man5pages = man/dracut.conf.5
|
||||
man5pages = dracut.conf.5
|
||||
|
||||
man7pages = man/dracut.cmdline.7 \
|
||||
man/dracut.bootup.7 \
|
||||
man/dracut.modules.7
|
||||
man7pages = dracut.cmdline.7 \
|
||||
dracut.bootup.7 \
|
||||
dracut.modules.7
|
||||
|
||||
man8pages = man/dracut.8 \
|
||||
man/dracut-catimages.8 \
|
||||
man8pages = dracut.8 \
|
||||
dracut-catimages.8 \
|
||||
mkinitrd.8 \
|
||||
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 \
|
||||
|
@ -49,68 +40,44 @@ man8pages = man/dracut.8 \
|
|||
|
||||
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
|
||||
|
||||
.PHONY: install clean archive rpm srpm testimage test all check AUTHORS CONTRIBUTORS doc dracut-version.sh
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS 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 $@
|
||||
all: dracut-version.sh dracut.pc dracut-install skipcpio/skipcpio
|
||||
|
||||
DRACUT_INSTALL_OBJECTS = \
|
||||
src/install/dracut-install.o \
|
||||
src/install/hashmap.o\
|
||||
src/install/log.o \
|
||||
src/install/strv.o \
|
||||
src/install/util.o
|
||||
install/dracut-install.o \
|
||||
install/hashmap.o\
|
||||
install/log.o \
|
||||
install/strv.o \
|
||||
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
|
||||
install/dracut-install.o: install/dracut-install.c install/log.h install/macro.h \
|
||||
install/hashmap.h install/util.h
|
||||
install/hashmap.o: install/hashmap.c install/util.h install/macro.h install/log.h \
|
||||
install/hashmap.h
|
||||
install/log.o: install/log.c install/log.h install/macro.h install/util.h
|
||||
install/util.o: install/util.c install/util.h install/macro.h install/log.h
|
||||
install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h install/log.h
|
||||
|
||||
src/install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
|
||||
$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(FTS_LIBS) $(KMOD_LIBS)
|
||||
install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
|
||||
$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(KMOD_LIBS)
|
||||
|
||||
logtee: src/logtee/logtee.c
|
||||
logtee: logtee.c
|
||||
$(CC) $(LDFLAGS) -o $@ $<
|
||||
|
||||
dracut-install: src/install/dracut-install
|
||||
dracut-install: install/dracut-install
|
||||
ln -fs $< $@
|
||||
|
||||
SKIPCPIO_OBJECTS = src/skipcpio/skipcpio.o
|
||||
skipcpio/skipcpio.o: src/skipcpio/skipcpio.c
|
||||
skipcpio/skipcpio: $(SKIPCPIO_OBJECTS)
|
||||
SKIPCPIO_OBJECTS= \
|
||||
skipcpio/skipcpio.o
|
||||
|
||||
UTIL_OBJECTS = src/util/util.o
|
||||
util/util.o: src/util/util.c
|
||||
util/util: $(UTIL_OBJECTS)
|
||||
skipcpio/skipcpio.o: skipcpio/skipcpio.c
|
||||
skipcpio/skipcpio: skipcpio/skipcpio.o
|
||||
|
||||
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
|
||||
indent:
|
||||
indent -i8 -nut -br -linux -l120 install/dracut-install.c
|
||||
indent -i8 -nut -br -linux -l120 skipcpio/skipcpio.c
|
||||
|
||||
doc: $(manpages) dracut.html
|
||||
|
||||
|
@ -124,20 +91,16 @@ endif
|
|||
|
||||
%.xml: %.asc
|
||||
@rm -f -- "$@"
|
||||
asciidoc -a "version=$(DRACUT_FULL_VERSION)" -d manpage -b docbook -o "$@" $<
|
||||
asciidoc -d manpage -b docbook -o "$@" $<
|
||||
|
||||
dracut.8: man/dracut.8.asc \
|
||||
man/dracut.usage.asc
|
||||
dracut.8: dracut.usage.asc dracut.8.asc
|
||||
|
||||
dracut.html: man/dracut.asc $(manpages) docs/dracut.css man/dracut.usage.asc
|
||||
dracut.html: dracut.asc $(manpages) dracut.css 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
|
||||
asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc
|
||||
@rm -f -- dracut.html
|
||||
xsltproc -o dracut.html --xinclude -nonet \
|
||||
--stringparam custom.css.source docs/dracut.css \
|
||||
--stringparam custom.css.source dracut.css \
|
||||
--stringparam generate.css.header 1 \
|
||||
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
|
||||
@rm -f -- dracut.xml
|
||||
|
@ -145,7 +108,7 @@ dracut.html: man/dracut.asc $(manpages) docs/dracut.css man/dracut.usage.asc
|
|||
dracut.pc: Makefile.inc Makefile
|
||||
@echo "Name: dracut" > dracut.pc
|
||||
@echo "Description: dracut" >> dracut.pc
|
||||
@echo "Version: $(DRACUT_FULL_VERSION)" >> dracut.pc
|
||||
@echo "Version: $(VERSION)$(GITVERSION)" >> dracut.pc
|
||||
@echo "dracutdir=$(pkglibdir)" >> dracut.pc
|
||||
@echo "dracutmodulesdir=$(pkglibdir)/modules.d" >> dracut.pc
|
||||
@echo "dracutconfdir=$(pkglibdir)/dracut.conf.d" >> dracut.pc
|
||||
|
@ -158,6 +121,7 @@ install: all
|
|||
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 mkinitrd-dracut.sh $(DESTDIR)$(bindir)/mkinitrd
|
||||
install -m 0755 lsinitrd.sh $(DESTDIR)$(bindir)/lsinitrd
|
||||
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
|
||||
|
@ -178,7 +142,6 @@ ifneq ($(enable_documentation),no)
|
|||
endif
|
||||
if [ -n "$(systemdsystemunitdir)" ]; then \
|
||||
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
|
||||
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/dracut-shutdown-onfailure.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown-onfailure.service; \
|
||||
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 \
|
||||
|
@ -198,30 +161,24 @@ endif
|
|||
$(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; \
|
||||
if [ -f install/dracut-install ]; then \
|
||||
install -m 0755 install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
|
||||
fi
|
||||
if [ -f src/skipcpio/skipcpio ]; then \
|
||||
install -m 0755 src/skipcpio/skipcpio $(DESTDIR)$(pkglibdir)/skipcpio; \
|
||||
if [ -f skipcpio/skipcpio ]; then \
|
||||
install -m 0755 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
|
||||
install -m 0755 50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install
|
||||
install -m 0755 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
|
||||
install -m 0644 dracut-bash-completion.sh $(DESTDIR)${bashcompletiondir}/dracut
|
||||
install -m 0644 lsinitrd-bash-completion.sh $(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
|
||||
@echo "DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh
|
||||
|
||||
clean:
|
||||
$(RM) *~
|
||||
|
@ -231,53 +188,33 @@ clean:
|
|||
$(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) dracut-install 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
|
||||
dist: dracut-$(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
|
||||
dracut-$(VERSION).tar.xz: doc syncheck
|
||||
@echo "DRACUT_VERSION=$(VERSION)" > dracut-version.sh
|
||||
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ > dracut-$(VERSION).tar
|
||||
mkdir -p dracut-$(VERSION)
|
||||
for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(VERSION)/$${i%/*}"; cp "$$i" "dracut-$(VERSION)/$$i"; done
|
||||
tar --owner=root --group=root -rf dracut-$(VERSION).tar $$(find dracut-$(VERSION) -type f)
|
||||
rm -fr -- dracut-$(VERSION).tar.xz dracut-$(VERSION)
|
||||
xz -9 dracut-$(VERSION).tar
|
||||
rm -f -- dracut-$(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; \
|
||||
rpm: dracut-$(VERSION).tar.xz syncheck
|
||||
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
|
||||
cp dracut-$(VERSION).tar.xz "$$rpmbuild"; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < 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
|
||||
( mv "$$rpmbuild"/{,$$(arch)/}*.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
|
||||
|
||||
syncheck:
|
||||
@ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \
|
||||
|
@ -287,56 +224,47 @@ syncheck:
|
|||
[ $$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 \
|
||||
@ret=0;for i in *.sh mkinitrd-dracut.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
|
||||
./dracut.sh -N -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
|
||||
debugtestimage: all
|
||||
./dracut.sh --debug -l -a debug -f test-$(KVERSION).img $(KVERSION)
|
||||
@echo wrote test-$(KVERSION).img
|
||||
./dracut.sh --debug -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).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)
|
||||
./dracut.sh -l -a debug --kernel-only -f test-kernel-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
./dracut.sh -l -a debug --no-kernel -f test-dracut.img $(shell uname -r)
|
||||
@echo wrote test-dracut.img
|
||||
|
||||
debughostimage: all
|
||||
./dracut.sh --debug -H -l -f test-$(KVERSION).img $(KVERSION)
|
||||
@echo wrote test-$(KVERSION).img
|
||||
./dracut.sh --debug -H -l -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
|
||||
hostimage: all
|
||||
./dracut.sh -H -l -f test-$(KVERSION).img $(KVERSION)
|
||||
@echo wrote test-$(KVERSION).img
|
||||
./dracut.sh -H -l -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
|
||||
efi: all
|
||||
./dracut.sh --uefi -H -l -f linux-$(KVERSION).efi $(KVERSION)
|
||||
@echo wrote linux-$(KVERSION).efi
|
||||
./dracut.sh --uefi -H -l -f linux-$(shell uname -r).efi $(shell uname -r)
|
||||
@echo wrote linux-$(shell uname -r).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
|
||||
dracut.html.sign: dracut-$(VERSION).tar.xz dracut.html
|
||||
gpg-sign-all dracut-$(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-$(VERSION).tar.xz dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/
|
||||
kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
dracut
|
||||
------
|
||||
dracut is an event driven initramfs infrastructure.
|
||||
|
||||
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 existing initramfs's, this is an attempt at having as little as
|
||||
possible hard-coded into the initramfs as possible. 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. It's likely that
|
||||
we'll grow some hooks for running arbitrary commands in the flow of
|
||||
the script, but it's worth trying to resist the urge as much as we can
|
||||
as hooks are guaranteed to be the path to slow-down.
|
||||
|
||||
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.
|
||||
|
||||
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 in README.modules.
|
||||
* 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.
|
||||
|
||||
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:
|
||||
git://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
http://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
https://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
|
||||
git@github.com:dracutdevs/dracut.git
|
||||
|
||||
Git Web:
|
||||
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 TODO file for things which still need to be done and HACKING 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
|
73
README.md
73
README.md
|
@ -1,55 +1,30 @@
|
|||
dracut
|
||||
====
|
||||
# dracut - master branch
|
||||
|
||||
dracut is an event driven initramfs infrastructure.
|
||||
dracut is an initramfs infrastructure.
|
||||
|
||||
[](.github/CODE_OF_CONDUCT.md)
|
||||
[](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-32)
|
||||
[](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-33)
|
||||
[](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-latest)
|
||||
## Travis
|
||||
|
||||
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.
|
||||
[](https://travis-ci.org/dracutdevs/dracut)
|
||||
|
||||
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.
|
||||
## CentOS CI
|
||||
|
||||
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.
|
||||
[](https://ci.centos.org/job/dracut-push-master/)
|
||||
|
||||
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
|
||||
- Test 01: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=01,label=dracut-ci-slave01/)
|
||||
- Test 02: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=02,label=dracut-ci-slave01/)
|
||||
- Test 03: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=03,label=dracut-ci-slave01/)
|
||||
- Test 04: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=04,label=dracut-ci-slave01/)
|
||||
- Test 10: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=10,label=dracut-ci-slave01/)
|
||||
- Test 11: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=11,label=dracut-ci-slave01/)
|
||||
- Test 12: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=12,label=dracut-ci-slave01/)
|
||||
- Test 13: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=13,label=dracut-ci-slave01/)
|
||||
- Test 14: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=14,label=dracut-ci-slave01/)
|
||||
- Test 15: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=15,label=dracut-ci-slave01/)
|
||||
- Test 16: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=16,label=dracut-ci-slave01/)
|
||||
- Test 17: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=17,label=dracut-ci-slave01/)
|
||||
- Test 20: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=20,label=dracut-ci-slave01/)
|
||||
- Test 30: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=30,label=dracut-ci-slave01/)
|
||||
- Test 31: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=31,label=dracut-ci-slave01/)
|
||||
- Test 40: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=40,label=dracut-ci-slave01/)
|
||||
- Test 50: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=50,label=dracut-ci-slave01/)
|
||||
- Test 70: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=70,label=dracut-ci-slave01/)
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
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.
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
For the testsuite to work, you will have to install at least the following software packages:
|
||||
dash \
|
||||
asciidoc \
|
||||
mdadm \
|
||||
lvm2 \
|
||||
dmraid \
|
||||
cryptsetup \
|
||||
nfs-utils \
|
||||
nbd \
|
||||
dhcp-server \
|
||||
scsi-target-utils \
|
||||
iscsi-initiator-utils \
|
||||
strace \
|
||||
syslinux \
|
||||
python-imgcreate \
|
||||
genisoimage \
|
||||
btrfs-progs \
|
||||
kmod-devel \
|
||||
gcc \
|
||||
bzip2 \
|
||||
xz \
|
||||
tar \
|
||||
wget \
|
||||
rpm-build \
|
||||
${NULL}
|
||||
|
||||
TEST-04-FULL-SYSTEMD: systemd >= 187
|
||||
|
||||
How to run the testsuite:
|
||||
|
||||
$ 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 ...
|
||||
$ sudo make run
|
||||
to run the test without doing the setup
|
|
@ -0,0 +1,51 @@
|
|||
Current TODO list, broken into things which are relevant for the
|
||||
initramfs itself (/init et al) vs the generator.
|
||||
A lot of things are/should be marked with "FIXME" in the code.
|
||||
|
||||
Items are ordered in priority.
|
||||
|
||||
INITRAMFS TODO
|
||||
|
||||
- search domain string
|
||||
- allow dual stack configuration (IPv4, IPv6) for the same interface
|
||||
- "bind-mount" kernel drivers in real root for the rescue image,
|
||||
if the real root does not have any kernel modules for this kernel
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1046510
|
||||
- use info and warn prefix
|
||||
- generate systemd unit dracut-initramfs-restore in /run/systemd dynamically
|
||||
- put "root=" parsing hooks in separate hook dir
|
||||
- call "root=" parsing hooks after getting new rootpath from dhcp
|
||||
- put mount hook in main initqueue loop / careful about resume!
|
||||
- the hard-coded list of udev rules that we care about is kind of lame.
|
||||
- panic fallback
|
||||
- progress indication for fsck https://bugzilla.redhat.com/show_bug.cgi?id=827118
|
||||
- domain, searchdomain https://bugzilla.redhat.com/show_bug.cgi?id=840778
|
||||
- probably fix "--include" https://bugzilla.redhat.com/show_bug.cgi?id=849338
|
||||
|
||||
GENERATOR TODO
|
||||
|
||||
- report errors on missing files in check()
|
||||
- remove wait for swap devs, if no "resume=" is given on the kernel command line
|
||||
- remove wait for swap devs, if the "resume" dracut module is not included (omitted)
|
||||
- add presets (predefined set of modules)
|
||||
- add interpreter/plugin-scripts to be sourced at the beginning or end (can use dracut-functions)
|
||||
- add mechanism for module specific command line options
|
||||
- pkg-config integration, to make it easy for other packages to use us.
|
||||
- default module specification could use some work
|
||||
- udev rule copying, as mentioned above, is a bit too hard-coded
|
||||
|
||||
- dracut-install parse LD_SHOW_AUXV="" AT_PLATFORM for lib install
|
||||
|
||||
CODE TODO
|
||||
|
||||
- document more functions
|
||||
- make function vars local, and prefix with "_"
|
||||
|
||||
Future Enhancement Requests
|
||||
|
||||
- run ssh server to enter crypto password or perform debugging (supported by debian)
|
||||
- https://bugzilla.redhat.com/show_bug.cgi?id=524727 - dracut + encrypted root + networking
|
||||
|
||||
- lsinitrd --print-cmdline
|
||||
- dracut --print-cmdline error if additional arguments
|
||||
- library for cmdline
|
|
@ -1,14 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# We don't support srcdir != builddir
|
||||
echo \#buildapi-variable-no-builddir > /dev/null
|
||||
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.
|
||||
|
@ -20,9 +18,9 @@ read_arg() {
|
|||
# $3 = arg parameter
|
||||
local rematch='^[^=]*=(.*)$'
|
||||
if [[ $2 =~ $rematch ]]; then
|
||||
read -r "$1" <<< "${BASH_REMATCH[1]}"
|
||||
read "$1" <<< "${BASH_REMATCH[1]}"
|
||||
else
|
||||
read -r "$1" <<< "$3"
|
||||
read "$1" <<< "$3"
|
||||
# There is no way to shift our callers args, so
|
||||
# return 1 to indicate they should do it instead.
|
||||
return 1
|
||||
|
@ -32,25 +30,24 @@ read_arg() {
|
|||
|
||||
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'" ;;
|
||||
--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;;
|
||||
*) echo "Ignoring unknown option '$1'";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
@ -60,60 +57,7 @@ if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then
|
|||
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
|
||||
cat > Makefile.inc.$$ <<EOF
|
||||
prefix ?= ${prefix}
|
||||
libdir ?= ${libdir:-${prefix}/lib}
|
||||
datadir ?= ${datadir:-${prefix}/share}
|
||||
|
@ -121,11 +65,9 @@ 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
|
||||
|
||||
{
|
||||
|
|
213
docs/BASH.md
213
docs/BASH.md
|
@ -1,213 +0,0 @@
|
|||
# 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
|
||||
```
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
# 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@profian.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.
|
278
docs/HACKING.md
278
docs/HACKING.md
|
@ -1,278 +0,0 @@
|
|||
# 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.
|
|
@ -1,48 +0,0 @@
|
|||
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
|
|
@ -1,70 +0,0 @@
|
|||
# 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/)
|
|
@ -1,3 +0,0 @@
|
|||
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@profian.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.
|
|
@ -0,0 +1,78 @@
|
|||
#
|
||||
# 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 field_vals= 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'
|
||||
|
||||
[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
|
||||
'
|
||||
)
|
||||
|
||||
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/; echo *)
|
||||
;;
|
||||
--kver)
|
||||
comps=$(cd /lib/modules; echo [0-9]*)
|
||||
;;
|
||||
*)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ $cur = -* ]]; then
|
||||
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
complete -F _dracut dracut
|
|
@ -16,8 +16,9 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
dwarning() {
|
||||
echo "Warning: $*" >&2
|
||||
echo "Warning: $@" >&2
|
||||
}
|
||||
|
||||
dinfo() {
|
||||
|
@ -25,11 +26,11 @@ dinfo() {
|
|||
}
|
||||
|
||||
derror() {
|
||||
echo "Error: $*" >&2
|
||||
echo "Error: $@" >&2
|
||||
}
|
||||
|
||||
usage() {
|
||||
# 80x25 linebreak here ^
|
||||
# 80x25 linebreak here ^
|
||||
cat << EOF
|
||||
Usage: $0 [OPTION]... <initramfs> <base image> [<image>...]
|
||||
Creates initial ramdisk image by concatenating several images from the command
|
||||
|
@ -48,46 +49,27 @@ line and /boot/dracut/
|
|||
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
|
||||
;;
|
||||
-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) debug="yes";;
|
||||
-v|--verbose) beverbose="yes";;
|
||||
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
|
||||
*) break ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
outfile=$1
|
||||
shift
|
||||
outfile=$1; shift
|
||||
|
||||
if [[ -z $outfile ]]; then
|
||||
derror "No output file specified."
|
||||
|
@ -95,8 +77,7 @@ if [[ -z $outfile ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
baseimage=$1
|
||||
shift
|
||||
baseimage=$1; shift
|
||||
|
||||
if [[ -z $baseimage ]]; then
|
||||
derror "No base image specified."
|
||||
|
@ -122,11 +103,8 @@ 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"
|
||||
)
|
||||
type pigz &>/dev/null && gzip=pigz || gzip=gzip
|
||||
( cd "$overlay"; find . |cpio --quiet -H newc -o |$gzip -9 > "$ofile"; )
|
||||
fi
|
||||
|
||||
if [[ ! $no_imagedir ]]; then
|
||||
|
@ -135,7 +113,7 @@ if [[ ! $no_imagedir ]]; then
|
|||
done
|
||||
fi
|
||||
|
||||
images+=("$@")
|
||||
images+=($@)
|
||||
|
||||
dinfo "Using base image $baseimage"
|
||||
cat -- "$baseimage" > "$outfile"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
561
dracut-init.sh
561
dracut-init.sh
File diff suppressed because it is too large
Load Diff
|
@ -6,58 +6,32 @@ set -e
|
|||
[ -e /run/initramfs/bin/sh ] && exit 0
|
||||
[ -e /run/initramfs/.need_shutdown ] || exit 0
|
||||
|
||||
# SIGTERM signal is received upon forced shutdown: ignore the signal
|
||||
# We want to remain alive to be able to trap unpacking errors to avoid
|
||||
# switching root to an incompletely unpacked initramfs
|
||||
trap 'echo "Received SIGTERM signal, ignoring!" >&2' TERM
|
||||
|
||||
KERNEL_VERSION="$(uname -r)"
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
SKIP="$dracutbasedir/skipcpio"
|
||||
[[ -x $SKIP ]] || SKIP="cat"
|
||||
[[ -x $SKIP ]] || SKIP=cat
|
||||
|
||||
if [[ -d /efi/Default ]] || [[ -d /boot/Default ]] || [[ -d /boot/efi/Default ]]; then
|
||||
MACHINE_ID="Default"
|
||||
elif [[ -f /etc/machine-id ]]; then
|
||||
read -r MACHINE_ID < /etc/machine-id
|
||||
else
|
||||
MACHINE_ID="Default"
|
||||
fi
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
mount -o ro /boot &> /dev/null || true
|
||||
mount -o ro /boot &>/dev/null || true
|
||||
|
||||
if [[ -d /efi/loader/entries ]] || [[ -L /efi/loader/entries ]] \
|
||||
|| [[ -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 ]] \
|
||||
|| [[ -d /boot/$MACHINE_ID ]] || [[ -L /boot/$MACHINE_ID ]]; then
|
||||
if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
|
||||
IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
|
||||
elif [[ -d /boot/efi/loader/entries ]] || [[ -L /boot/efi/loader/entries ]] \
|
||||
|| [[ -d /boot/efi/$MACHINE_ID ]] || [[ -L /boot/efi/$MACHINE_ID ]]; then
|
||||
IMG="/boot/efi/$MACHINE_ID/$KERNEL_VERSION/initrd"
|
||||
elif [[ -f /lib/modules/${KERNEL_VERSION}/initrd ]]; then
|
||||
IMG="/lib/modules/${KERNEL_VERSION}/initrd"
|
||||
elif [[ -f /boot/initramfs-${KERNEL_VERSION}.img ]]; then
|
||||
IMG="/boot/initramfs-${KERNEL_VERSION}.img"
|
||||
elif mountpoint -q /efi; then
|
||||
IMG="/efi/$MACHINE_ID/$KERNEL_VERSION/initrd"
|
||||
elif mountpoint -q /boot/efi; then
|
||||
IMG="/boot/efi/$MACHINE_ID/$KERNEL_VERSION/initrd"
|
||||
else
|
||||
echo "No initramfs image found to restore!"
|
||||
exit 1
|
||||
fi
|
||||
[[ -f $IMG ]] || IMG="/boot/initramfs-${KERNEL_VERSION}.img"
|
||||
|
||||
cd /run/initramfs
|
||||
|
||||
if $SKIP "$IMG" | cpio -id --no-absolute-filenames --quiet > /dev/null \
|
||||
|| $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet > /dev/null \
|
||||
|| $SKIP "$IMG" | bzcat | cpio -id --no-absolute-filenames --quiet > /dev/null \
|
||||
|| $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet > /dev/null \
|
||||
|| $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet > /dev/null \
|
||||
|| $SKIP "$IMG" | lzop -d -c | cpio -id --no-absolute-filenames --quiet > /dev/null \
|
||||
|| $SKIP "$IMG" | zstd -d -c | cpio -id --no-absolute-filenames --quiet > /dev/null; then
|
||||
[ -f .need_shutdown -a -f "$IMG" ] || exit 1
|
||||
|
||||
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
|
||||
|
@ -66,17 +40,4 @@ else
|
|||
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
|
||||
|
|
178
dracut-logger.sh
178
dracut-logger.sh
|
@ -17,7 +17,9 @@
|
|||
# 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
|
||||
|
||||
__DRACUT_LOGGER__=1
|
||||
|
||||
|
||||
## @brief Logging facility module for dracut both at build- and boot-time.
|
||||
#
|
||||
|
@ -84,6 +86,7 @@ export __DRACUT_LOGGER__=1
|
|||
#
|
||||
# @see dlog_init()
|
||||
|
||||
|
||||
## @brief Initializes dracut Logger.
|
||||
#
|
||||
# @retval 1 if something has gone wrong
|
||||
|
@ -102,8 +105,7 @@ export __DRACUT_LOGGER__=1
|
|||
# See file doc comment for details.
|
||||
dlog_init() {
|
||||
local __oldumask
|
||||
local ret=0
|
||||
local errmsg
|
||||
local ret=0; local errmsg
|
||||
[ -z "$stdloglvl" ] && stdloglvl=4
|
||||
[ -z "$sysloglvl" ] && sysloglvl=0
|
||||
[ -z "$kmsgloglvl" ] && kmsgloglvl=0
|
||||
|
@ -112,21 +114,21 @@ dlog_init() {
|
|||
|
||||
if [ -z "$fileloglvl" ]; then
|
||||
[ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
|
||||
elif ((fileloglvl > 0)); then
|
||||
elif (( $fileloglvl > 0 )); then
|
||||
if [[ $logfile ]]; then
|
||||
__oldumask=$(umask)
|
||||
umask 0377
|
||||
! [ -e "$logfile" ] && : > "$logfile"
|
||||
umask "$__oldumask"
|
||||
if [[ -w $logfile ]] && [[ -f $logfile ]]; then
|
||||
! [ -e "$logfile" ] && >"$logfile"
|
||||
umask $__oldumask
|
||||
if [ -w "$logfile" -a -f "$logfile" ]; then
|
||||
# Mark new run in the log file
|
||||
echo >> "$logfile"
|
||||
if command -v date > /dev/null; then
|
||||
echo "=== $(date) ===" >> "$logfile"
|
||||
echo >>"$logfile"
|
||||
if command -v date >/dev/null; then
|
||||
echo "=== $(date) ===" >>"$logfile"
|
||||
else
|
||||
echo "===============================================" >> "$logfile"
|
||||
echo "===============================================" >>"$logfile"
|
||||
fi
|
||||
echo >> "$logfile"
|
||||
echo >>"$logfile"
|
||||
else
|
||||
# We cannot log to file, so turn this facility off.
|
||||
fileloglvl=0
|
||||
|
@ -136,22 +138,22 @@ dlog_init() {
|
|||
fi
|
||||
fi
|
||||
|
||||
if ((UID != 0)); then
|
||||
if (( $UID != 0 )); then
|
||||
kmsgloglvl=0
|
||||
sysloglvl=0
|
||||
fi
|
||||
|
||||
if ((sysloglvl > 0)); then
|
||||
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
|
||||
&& 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
|
||||
systemd-cat -t 'dracut' --level-prefix=true <"$_systemdcatfile" &
|
||||
exec 15>"$_systemdcatfile"
|
||||
elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then
|
||||
# We cannot log to syslog, so turn this facility off.
|
||||
kmsgloglvl=$sysloglvl
|
||||
sysloglvl=0
|
||||
|
@ -160,7 +162,7 @@ dlog_init() {
|
|||
fi
|
||||
fi
|
||||
|
||||
if ((sysloglvl > 0)) || ((kmsgloglvl > 0)); then
|
||||
if (($sysloglvl > 0)) || (($kmsgloglvl > 0 )); then
|
||||
if [ -n "$dracutbasedir" ]; then
|
||||
readonly syslogfacility=user
|
||||
else
|
||||
|
@ -169,44 +171,44 @@ dlog_init() {
|
|||
export syslogfacility
|
||||
fi
|
||||
|
||||
local lvl
|
||||
local maxloglvl_l=0
|
||||
local lvl; local maxloglvl_l=0
|
||||
for lvl in $stdloglvl $sysloglvl $fileloglvl $kmsgloglvl; do
|
||||
((lvl > maxloglvl_l)) && maxloglvl_l=$lvl
|
||||
(( $lvl > $maxloglvl_l )) && maxloglvl_l=$lvl
|
||||
done
|
||||
readonly maxloglvl=$maxloglvl_l
|
||||
export maxloglvl
|
||||
|
||||
if ((stdloglvl < 6)) && ((kmsgloglvl < 6)) && ((fileloglvl < 6)) && ((sysloglvl < 6)); then
|
||||
|
||||
if (($stdloglvl < 6)) && (($kmsgloglvl < 6)) && (($fileloglvl < 6)) && (($sysloglvl < 6)); then
|
||||
unset dtrace
|
||||
dtrace() { :; }
|
||||
dtrace() { :; };
|
||||
fi
|
||||
|
||||
if ((stdloglvl < 5)) && ((kmsgloglvl < 5)) && ((fileloglvl < 5)) && ((sysloglvl < 5)); then
|
||||
if (($stdloglvl < 5)) && (($kmsgloglvl < 5)) && (($fileloglvl < 5)) && (($sysloglvl < 5)); then
|
||||
unset ddebug
|
||||
ddebug() { :; }
|
||||
ddebug() { :; };
|
||||
fi
|
||||
|
||||
if ((stdloglvl < 4)) && ((kmsgloglvl < 4)) && ((fileloglvl < 4)) && ((sysloglvl < 4)); then
|
||||
if (($stdloglvl < 4)) && (($kmsgloglvl < 4)) && (($fileloglvl < 4)) && (($sysloglvl < 4)); then
|
||||
unset dinfo
|
||||
dinfo() { :; }
|
||||
dinfo() { :; };
|
||||
fi
|
||||
|
||||
if ((stdloglvl < 3)) && ((kmsgloglvl < 3)) && ((fileloglvl < 3)) && ((sysloglvl < 3)); then
|
||||
if (($stdloglvl < 3)) && (($kmsgloglvl < 3)) && (($fileloglvl < 3)) && (($sysloglvl < 3)); then
|
||||
unset dwarn
|
||||
dwarn() { :; }
|
||||
dwarn() { :; };
|
||||
unset dwarning
|
||||
dwarning() { :; }
|
||||
dwarning() { :; };
|
||||
fi
|
||||
|
||||
if ((stdloglvl < 2)) && ((kmsgloglvl < 2)) && ((fileloglvl < 2)) && ((sysloglvl < 2)); then
|
||||
if (($stdloglvl < 2)) && (($kmsgloglvl < 2)) && (($fileloglvl < 2)) && (($sysloglvl < 2)); then
|
||||
unset derror
|
||||
derror() { :; }
|
||||
derror() { :; };
|
||||
fi
|
||||
|
||||
if ((stdloglvl < 1)) && ((kmsgloglvl < 1)) && ((fileloglvl < 1)) && ((sysloglvl < 1)); then
|
||||
if (($stdloglvl < 1)) && (($kmsgloglvl < 1)) && (($fileloglvl < 1)) && (($sysloglvl < 1)); then
|
||||
unset dfatal
|
||||
dfatal() { :; }
|
||||
dfatal() { :; };
|
||||
fi
|
||||
|
||||
[ -n "$errmsg" ] && derror "$errmsg"
|
||||
|
@ -222,13 +224,13 @@ dlog_init() {
|
|||
# @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 ;;
|
||||
1) echo F;;
|
||||
2) echo E;;
|
||||
3) echo W;;
|
||||
4) echo I;;
|
||||
5) echo D;;
|
||||
6) echo T;;
|
||||
*) return 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -239,15 +241,15 @@ _lvl2char() {
|
|||
# @retval 0 if @a lvl is correct.
|
||||
# @result Echoes logger priority.
|
||||
_lvl2syspri() {
|
||||
printf -- "%s" "$syslogfacility."
|
||||
printf $syslogfacility.
|
||||
case "$1" in
|
||||
1) echo crit ;;
|
||||
2) echo error ;;
|
||||
3) echo warning ;;
|
||||
4) echo info ;;
|
||||
5) echo debug ;;
|
||||
6) echo debug ;;
|
||||
*) return 1 ;;
|
||||
1) echo crit;;
|
||||
2) echo error;;
|
||||
3) echo warning;;
|
||||
4) echo info;;
|
||||
5) echo debug;;
|
||||
6) echo debug;;
|
||||
*) return 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -277,16 +279,16 @@ _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 ;;
|
||||
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))
|
||||
[ "$syslogfacility" = user ] && echo $((8+$lvl)) || echo $((24+$lvl))
|
||||
}
|
||||
|
||||
## @brief Prints to stderr and/or writes to file, to syslog and/or /dev/kmsg
|
||||
|
@ -316,29 +318,27 @@ _dlvl2syslvl() {
|
|||
# - @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 lvl="$1"; shift
|
||||
local lvlc=$(_lvl2char "$lvl") || return 0
|
||||
local msg="$*"
|
||||
local lmsg="$lvlc: $*"
|
||||
|
||||
((lvl <= stdloglvl)) && printf -- 'dracut: %s\n' "$msg" >&2
|
||||
(( $lvl <= $stdloglvl )) && printf -- 'dracut: %s\n' "$msg" >&2
|
||||
|
||||
if ((lvl <= sysloglvl)); then
|
||||
if (( $lvl <= $sysloglvl )); then
|
||||
if [[ "$_dlogfd" ]]; then
|
||||
printf -- "<%s>%s\n" "$(($(_dlvl2syslvl "$lvl") & 7))" "$msg" >&$_dlogfd
|
||||
printf -- "<%s>%s\n" "$(($(_dlvl2syslvl $lvl) & 7))" "$msg" >&$_dlogfd
|
||||
else
|
||||
logger -t "dracut[$$]" -p "$(_lvl2syspri "$lvl")" -- "$msg"
|
||||
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) -- "$msg"
|
||||
fi
|
||||
fi
|
||||
|
||||
if ((lvl <= fileloglvl)) && [[ -w $logfile ]] && [[ -f $logfile ]]; then
|
||||
echo "$lmsg" >> "$logfile"
|
||||
if (( $lvl <= $fileloglvl )) && [[ -w "$logfile" ]] && [[ -f "$logfile" ]]; then
|
||||
echo "$lmsg" >>"$logfile"
|
||||
fi
|
||||
|
||||
((lvl <= kmsgloglvl)) \
|
||||
&& echo "<$(_dlvl2syslvl "$lvl")>dracut[$$] $msg" > /dev/kmsg
|
||||
(( $lvl <= $kmsgloglvl )) && \
|
||||
echo "<$(_dlvl2syslvl $lvl)>dracut[$$] $msg" >/dev/kmsg
|
||||
}
|
||||
|
||||
## @brief Internal helper function for _do_dlog()
|
||||
|
@ -359,12 +359,12 @@ _do_dlog() {
|
|||
# echo "This is a warning" | dwarn
|
||||
dlog() {
|
||||
[ -z "$maxloglvl" ] && return 0
|
||||
(($1 <= maxloglvl)) || return 0
|
||||
(( $1 <= $maxloglvl )) || return 0
|
||||
|
||||
if (($# > 1)); then
|
||||
if (( $# > 1 )); then
|
||||
_do_dlog "$@"
|
||||
else
|
||||
while read -r line || [ -n "$line" ]; do
|
||||
while read line || [ -n "$line" ]; do
|
||||
_do_dlog "$1" "$line"
|
||||
done
|
||||
fi
|
||||
|
@ -377,9 +377,7 @@ dlog() {
|
|||
dtrace() {
|
||||
set +x
|
||||
dlog 6 "$@"
|
||||
if [ -n "$debug" ]; then
|
||||
set -x
|
||||
fi
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief Logs message at DEBUG level (5)
|
||||
|
@ -389,9 +387,7 @@ dtrace() {
|
|||
ddebug() {
|
||||
set +x
|
||||
dlog 5 "$@"
|
||||
if [ -n "$debug" ]; then
|
||||
set -x
|
||||
fi
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief Logs message at INFO level (4)
|
||||
|
@ -401,9 +397,7 @@ ddebug() {
|
|||
dinfo() {
|
||||
set +x
|
||||
dlog 4 "$@"
|
||||
if [ -n "$debug" ]; then
|
||||
set -x
|
||||
fi
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief Logs message at WARN level (3)
|
||||
|
@ -413,9 +407,7 @@ dinfo() {
|
|||
dwarn() {
|
||||
set +x
|
||||
dlog 3 "$@"
|
||||
if [ -n "$debug" ]; then
|
||||
set -x
|
||||
fi
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief It's an alias to dwarn() function.
|
||||
|
@ -425,9 +417,7 @@ dwarn() {
|
|||
dwarning() {
|
||||
set +x
|
||||
dwarn "$@"
|
||||
if [ -n "$debug" ]; then
|
||||
set -x
|
||||
fi
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief Logs message at ERROR level (2)
|
||||
|
@ -437,9 +427,7 @@ dwarning() {
|
|||
derror() {
|
||||
set +x
|
||||
dlog 2 "$@"
|
||||
if [ -n "$debug" ]; then
|
||||
set -x
|
||||
fi
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief Logs message at FATAL level (1)
|
||||
|
@ -449,7 +437,5 @@ derror() {
|
|||
dfatal() {
|
||||
set +x
|
||||
dlog 1 "$@"
|
||||
if [ -n "$debug" ]; then
|
||||
set -x
|
||||
fi
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ DRACUT(8)
|
|||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
:man version: {version}
|
||||
|
||||
NAME
|
||||
----
|
||||
|
@ -265,9 +264,6 @@ example:
|
|||
**-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>_::
|
||||
|
@ -288,15 +284,6 @@ Default:
|
|||
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
|
||||
|
@ -510,9 +497,6 @@ will not be able to boot.
|
|||
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.
|
||||
|
@ -521,121 +505,18 @@ will not be able to boot.
|
|||
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.
|
||||
or _$prefix/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
|
||||
|
||||
**--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>_
|
||||
|
||||
**--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_::
|
||||
|
@ -679,18 +560,18 @@ Harald Hoyer
|
|||
|
||||
Victor Lowther
|
||||
|
||||
Amadeusz Żołnowski
|
||||
|
||||
Hannes Reinecke
|
||||
|
||||
Daniel Molkentin
|
||||
|
||||
Will Woods
|
||||
|
||||
Philippe Seewer
|
||||
|
||||
Warren Togami
|
||||
|
||||
Amadeusz Żołnowski
|
||||
|
||||
Jeremy Katz
|
||||
|
||||
David Dillow
|
||||
|
||||
Will Woods
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
*dracut.cmdline*(7) *dracut.conf*(5) *lsinitrd*(1)
|
|
@ -1,8 +1,8 @@
|
|||
dracut {mainversion}
|
||||
====================
|
||||
:author: Harald Hoyer
|
||||
:email: harald@profian.com
|
||||
:revnumber: {version}
|
||||
dracut
|
||||
======
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
v3.0, October 2013
|
||||
|
||||
:language: bash
|
||||
|
||||
= Introduction
|
||||
|
@ -61,7 +61,7 @@ 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
|
||||
dracut can generate a customized initrams image which contains only whatever is
|
||||
necessary to boot some particular computer, such as ATA, SCSI and filesystem
|
||||
kernel modules (host-only mode).
|
||||
|
||||
|
@ -142,7 +142,7 @@ The following steps are executed during a shutdown:
|
|||
* 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 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.
|
||||
|
@ -162,6 +162,9 @@ include::dracut.cmdline.7.asc[]
|
|||
[[lsinitrd1]]
|
||||
include::lsinitrd.1.asc[]
|
||||
|
||||
[[mkinitrd8]]
|
||||
include::mkinitrd.8.asc[]
|
||||
|
||||
= Developer Manual
|
||||
|
||||
:leveloffset: 1
|
|
@ -3,7 +3,6 @@ DRACUT.BOOTUP(7)
|
|||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
:man version: {version}
|
||||
|
||||
NAME
|
||||
----
|
|
@ -3,7 +3,6 @@ DRACUT.CMDLINE(7)
|
|||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
:man version: {version}
|
||||
|
||||
NAME
|
||||
----
|
||||
|
@ -113,9 +112,6 @@ resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
|||
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.
|
||||
|
||||
|
@ -151,7 +147,7 @@ Misc
|
|||
|
||||
**rd.retry=**__<seconds>__::
|
||||
specify how long dracut should retry the initqueue to configure devices.
|
||||
The default is 180 seconds. After 2/3 of the time, degraded raids are force
|
||||
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.
|
||||
|
||||
|
@ -167,12 +163,6 @@ Misc
|
|||
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
|
||||
~~~~~
|
||||
|
@ -197,8 +187,8 @@ It should be attached to any report about dracut problems.
|
|||
_/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.
|
||||
**rd.memdebug=[0-4]**::
|
||||
Print memory usage info at various points, set the verbose level from 0 to 4.
|
||||
+
|
||||
Higher level means more debugging output:
|
||||
+
|
||||
|
@ -207,14 +197,10 @@ It should be attached to any report about dracut problems.
|
|||
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.
|
||||
4 - /proc/meminfo + /proc/slabinfo + tracekomem
|
||||
NOTE: tracekomem is a shell script utilizing kernel trace to track
|
||||
the rough total memory consumption of kernel modules during
|
||||
loading. It may override other trace configurations.
|
||||
----
|
||||
|
||||
**rd.break**::
|
||||
|
@ -256,7 +242,7 @@ rd.vconsole.keymap=de-latin1-nodeadkeys
|
|||
[listing]
|
||||
.Example
|
||||
--
|
||||
rd.vconsole.font=eurlatgr
|
||||
rd.vconsole.font=LatArCyrHeb-16
|
||||
--
|
||||
|
||||
**rd.vconsole.font.map=**__<console map base file name>__::
|
||||
|
@ -290,12 +276,12 @@ LVM
|
|||
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.
|
||||
only activate 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.lv=**__<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
|
||||
|
@ -311,8 +297,6 @@ crypto LUKS
|
|||
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
|
||||
|
@ -334,37 +318,22 @@ crypto LUKS
|
|||
|
||||
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.
|
||||
**rd.luks.key=**__<keypath>__:__<keydev>__:__<luksdev>__::
|
||||
_keypath_ is a path to key file to look for. It's REQUIRED. When _keypath_
|
||||
ends with '.gpg' it's considered to be key encrypted symmetrically with GPG.
|
||||
You will be prompted for password on boot. GPG support comes with
|
||||
'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.
|
||||
_keydev_ is a device on which key file resides. It might be kernel name of
|
||||
devices (should start with "/dev/"), UUID (prefixed with "UUID=") or label
|
||||
(prefix with "LABEL="). You don't have to specify 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 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:
|
||||
If _luksdev_ is given, the specified key will only be applied for that 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
|
||||
|
@ -373,84 +342,28 @@ 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 pipes key to cryptsetup with _-d -_ argument, therefore you need to pipe
|
||||
to crypsetup luksFormat with _-d -_, too!
|
||||
|
||||
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):
|
||||
Here follows example for key encrypted with GPG:
|
||||
|
||||
[listing]
|
||||
--
|
||||
gpg --quiet --decrypt rootkey.gpg | \
|
||||
cryptsetup --batch-mode --key-file - \
|
||||
luksFormat /dev/sda47
|
||||
cryptsetup -d - -v --cipher serpent-cbc-essiv:sha256 \
|
||||
--key-size 256 luksFormat /dev/sda3
|
||||
--
|
||||
|
||||
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:
|
||||
If you use plain keys, just add path to _-d_ option:
|
||||
|
||||
[listing]
|
||||
--
|
||||
head -32c /dev/urandom > rootkey.key
|
||||
cryptsetup --batch-mode --key-file rootkey.key \
|
||||
luksFormat /dev/sda47
|
||||
cryptsetup -d rootkey.key -v --cipher serpent-cbc-essiv:sha256 \
|
||||
--key-size 256 luksFormat /dev/sda3
|
||||
--
|
||||
|
||||
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
|
||||
|
@ -489,9 +402,6 @@ MULTIPATH
|
|||
**rd.multipath=0**::
|
||||
disable multipath detection
|
||||
|
||||
**rd.multipath=default**::
|
||||
use default multipath settings
|
||||
|
||||
FIPS
|
||||
~~~~
|
||||
**rd.fips**::
|
||||
|
@ -575,37 +485,23 @@ USB Android phone::
|
|||
* enp0s29u1u2
|
||||
=====================
|
||||
|
||||
The following options are supported by the 'network-legacy' dracut
|
||||
module. Other network modules might support a slightly different set of
|
||||
options; refer to the documentation of the specific network module in use. For
|
||||
NetworkManager, see *nm-initrd-generator*(8).
|
||||
|
||||
**ip=**__{dhcp|on|any|dhcp6|auto6|either6|link6|single-dhcp}__::
|
||||
dhcp|on|any::: get ip from dhcp server from all interfaces. If netroot=dhcp,
|
||||
**ip=**__{dhcp|on|any|dhcp6|auto6|either6}__::
|
||||
dhcp|on|any::: get ip from dhcp server from all interfaces. If root=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>__]]::
|
||||
**ip=**__<interface>__:__{dhcp|on|any|dhcp6|auto6}__[:[__<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>.
|
||||
|
@ -632,7 +528,7 @@ same <interface>.
|
|||
number, encoding the network prefix length.
|
||||
|
||||
**ifname=**__<interface>__:__<MAC>__::
|
||||
Assign network device name <interface> (i.e. "bootnet") to the NIC with
|
||||
Assign network device name <interface> (ie "bootnet") to the NIC with
|
||||
MAC <MAC>.
|
||||
+
|
||||
WARNING: Do **not** use the default kernel naming scheme for the interface name,
|
||||
|
@ -675,7 +571,7 @@ interface name. Better name it "bootnet" or "bluesocket".
|
|||
boolean, bring up network even without netroot set
|
||||
|
||||
**vlan=**__<vlanname>__:__<phydevice>__::
|
||||
Setup vlan device named <vlanname> on <phydevice>.
|
||||
Setup vlan device named <vlanname> on <phydeivce>.
|
||||
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)
|
||||
|
@ -690,13 +586,9 @@ interface name. Better name it "bootnet" or "bluesocket".
|
|||
Bond without parameters assumes
|
||||
bond=bond0:eth0,eth1:mode=balance-rr
|
||||
|
||||
**team=**__<teammaster>__:__<teamslaves>__[:__<teamrunner>__]::
|
||||
**team=**__<teammaster>__:__<teamslaves>__::
|
||||
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
|
||||
|
@ -712,7 +604,7 @@ NFS
|
|||
":" 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
|
||||
root=dhcp alone directs initrd to look at the DHCP root-path where NFS
|
||||
options can be specified.
|
||||
+
|
||||
[listing]
|
||||
|
@ -753,7 +645,7 @@ NFS
|
|||
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.
|
||||
Wait <seconds> until carrier is recognized. Default is 5 seconds.
|
||||
|
||||
CIFS
|
||||
~~~
|
||||
|
@ -865,9 +757,6 @@ 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.
|
||||
|
||||
|
@ -876,9 +765,6 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30
|
|||
|
||||
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
|
||||
|
@ -888,23 +774,6 @@ FCoE
|
|||
+
|
||||
NOTE: letters in the MAC-address must be lowercase!
|
||||
|
||||
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.
|
||||
The _<traddr>_ parameter can be set to 'auto' to select
|
||||
autodiscovery; in that case all other parameters are ignored.
|
||||
This parameter can be specified multiple times.
|
||||
|
||||
NBD
|
||||
~~~
|
||||
**root=**??? **netroot=**nbd:__<server>__:__<port/exportname>__[:__<fstype>__[:__<mountopts>__[:__<nbdopts>__]]]::
|
||||
|
@ -914,8 +783,8 @@ 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
|
||||
**root=dhcp** with **dhcp** **root-path=**nbd:__<server>__:__<port/exportname>__[:__<fstype>__[:__<mountopts>__[:__<nbdopts>__]]]::
|
||||
root=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.
|
||||
+
|
||||
|
@ -956,11 +825,6 @@ ZNET
|
|||
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
|
||||
|
@ -1117,7 +981,7 @@ 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
|
||||
`/<+++<b>rd.live.dir</b>+++>/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.
|
|
@ -3,7 +3,6 @@ DRACUT.CONF(5)
|
|||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
:man version: {version}
|
||||
|
||||
NAME
|
||||
----
|
||||
|
@ -80,13 +79,12 @@ Configuration files must have the extension .conf; other extensions are ignored.
|
|||
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=*"__{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)
|
||||
|
@ -159,7 +157,7 @@ provide a valid _/etc/fstab_.
|
|||
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)
|
||||
to access very early (and cannot make use of uncompress alogrithms yet)
|
||||
like microcode or ACPI tables (default=no).
|
||||
|
||||
*acpi_table_dir=*"__<dir>__"::
|
||||
|
@ -189,7 +187,7 @@ provide a valid _/etc/fstab_.
|
|||
|
||||
*i18n_default_font=*"__<fontname>__"::
|
||||
The font <fontname> to install, if not specified otherwise.
|
||||
Default is "eurlatgr".
|
||||
Default is "LatArCyrHeb-16".
|
||||
|
||||
*i18n_install_all=*"__{yes|no}__"::
|
||||
Install everything regardless of generic or hostonly mode.
|
||||
|
@ -204,13 +202,7 @@ provide a valid _/etc/fstab_.
|
|||
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.
|
||||
or _/usr/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
|
||||
|
||||
*kernel_image=*"_<FILE>_"::
|
||||
Specifies the kernel image, which to include in the UEFI executable. The default is
|
|
@ -10,35 +10,9 @@ 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
|
||||
dbussystemconfdir=/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"
|
||||
|
|
|
@ -12,4 +12,4 @@ ro_mnt=yes
|
|||
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 "
|
||||
omit_drivers+=" i2o_scsi"
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
# SUSE specific dracut settings
|
||||
# SUSE specifc dracut settings
|
||||
#
|
||||
# SUSE by default always builds as small as possible initrd for performance
|
||||
# SUSE by default always builds a 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"
|
||||
compress="xz -0 --check=crc32 --memlimit-compress=50%"
|
||||
|
||||
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 "
|
||||
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.
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
/var/log/dracut.log {
|
||||
missingok
|
||||
notifempty
|
||||
size 30k
|
||||
create 0600 root root
|
||||
}
|
|
@ -3,7 +3,6 @@ DRACUT.MODULES(7)
|
|||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
:man version: {version}
|
||||
|
||||
NAME
|
||||
----
|
||||
|
@ -93,23 +92,18 @@ udev state.
|
|||
|
||||
==== Initqueue settled
|
||||
|
||||
This hook (initqueue/settled) gets executed every time udev has settled.
|
||||
This hooks (initqueue/settled) gets executed every time udev has settled.
|
||||
|
||||
==== Initqueue timeout
|
||||
|
||||
This hook (initqueue/timeout) gets executed, when the main loop counter becomes
|
||||
This hooks (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
|
||||
Abritary scripts can be added here, to loop in the
|
||||
initqueue until something happens, which a dracut module wants to wait for.
|
||||
|
||||
=== Hook: pre-mount
|
||||
|
@ -151,8 +145,8 @@ 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.
|
||||
A simple example module is _96insmodpost_, 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.
|
||||
|
||||
|
@ -164,7 +158,7 @@ check():
|
|||
return 0
|
||||
----
|
||||
|
||||
Then we create the install() function, which installs a cmdline hook with
|
||||
The 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_.
|
||||
|
||||
|
@ -272,7 +266,7 @@ installs an executable/script <src> in the dracut hook <hookdir> with priority
|
|||
|
||||
==== inst_rules <udevrule> [ <udevrule> ...]
|
||||
|
||||
installs one or more udev rules. Non-existant udev rules are reported, but do
|
||||
installs one ore more udev rules. Non-existant udev rules are reported, but do
|
||||
not let dracut fail.
|
||||
|
||||
==== instmods <kernelmodule> [ <kernelmodule> ... ]
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
@ -21,8 +21,7 @@ Group: System/Base
|
|||
|
||||
# The entire source code is GPLv2+
|
||||
# except install/* which is LGPLv2+
|
||||
# except util/* which is GPLv2
|
||||
License: GPLv2+ and LGPLv2+ and GPLv2
|
||||
License: GPLv2+ and LGPLv2+
|
||||
|
||||
URL: https://dracut.wiki.kernel.org/
|
||||
|
||||
|
@ -32,8 +31,8 @@ Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar
|
|||
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
|
||||
|
||||
BuildRequires: bash
|
||||
BuildRequires: git-core
|
||||
BuildRequires: pkgconfig(libkmod) >= 23
|
||||
BuildRequires: git
|
||||
BuildRequires: kmod-devel >= 23
|
||||
BuildRequires: gcc
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
|
@ -56,6 +55,11 @@ BuildRequires: docbook-xsl-stylesheets libxslt
|
|||
BuildRequires: asciidoc
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version} > 9999
|
||||
Obsoletes: mkinitrd < 2.6.1
|
||||
Provides: mkinitrd = 2.6.1
|
||||
%endif
|
||||
|
||||
Obsoletes: dracut-fips <= 047
|
||||
Provides: dracut-fips = %{version}-%{release}
|
||||
Obsoletes: dracut-fips-aesni <= 047
|
||||
|
@ -73,7 +77,6 @@ Requires: xz
|
|||
Requires: gzip
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
Recommends: memstrack
|
||||
Recommends: hardlink
|
||||
Recommends: pigz
|
||||
Recommends: kpartx
|
||||
|
@ -95,7 +98,7 @@ Requires: libkcapi-hmaccalc
|
|||
|
||||
%description
|
||||
dracut contains tools to create bootable initramfses for the Linux
|
||||
kernel. Unlike other implementations, dracut hard-codes as little
|
||||
kernel. Unlike previous 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
|
||||
|
@ -114,8 +117,7 @@ Requires: %{name} = %{version}-%{release}
|
|||
%endif
|
||||
Requires: iputils
|
||||
Requires: iproute
|
||||
Requires: (NetworkManager >= 1.20 or dhclient)
|
||||
Suggests: NetworkManager
|
||||
Requires: dhclient
|
||||
Obsoletes: dracut-generic < 008
|
||||
Provides: dracut-generic = %{version}-%{release}
|
||||
|
||||
|
@ -179,7 +181,7 @@ 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
|
||||
Requires: squash-tools
|
||||
|
||||
%description squash
|
||||
This package provides a dracut module to build an initramfs, but store most files
|
||||
|
@ -199,10 +201,11 @@ cp %{SOURCE1} .
|
|||
%endif
|
||||
${NULL}
|
||||
|
||||
%make_build
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
%make_install %{?_smp_mflags} \
|
||||
make %{?_smp_mflags} install \
|
||||
DESTDIR=$RPM_BUILD_ROOT \
|
||||
libdir=%{_prefix}/lib
|
||||
|
||||
echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh
|
||||
|
@ -211,12 +214,14 @@ echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dr
|
|||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
|
||||
%endif
|
||||
|
||||
%if %{defined _unitdir}
|
||||
# for systemd, better use systemd-bootchart
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00bootchart
|
||||
%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
|
||||
|
||||
|
@ -252,24 +257,29 @@ 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
|
||||
rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse*
|
||||
%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}/mkinitrd
|
||||
rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
|
||||
rm -f -- $RPM_BUILD_ROOT%{_mandir}/man1/lsinitrd.1*
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
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
|
||||
|
||||
# FIXME: remove after F30
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
|
||||
install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
|
||||
%endif
|
||||
|
||||
%files
|
||||
%if %{with doc}
|
||||
%doc README.md docs/HACKING.md AUTHORS NEWS.md dracut.html docs/dracut.png docs/dracut.svg
|
||||
%doc README HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
|
||||
%endif
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%license COPYING lgpl-2.1.txt
|
||||
|
@ -277,6 +287,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
|||
%{_datadir}/bash-completion/completions/dracut
|
||||
%{_datadir}/bash-completion/completions/lsinitrd
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999
|
||||
%{_bindir}/mkinitrd
|
||||
%{_bindir}/lsinitrd
|
||||
%endif
|
||||
%dir %{dracutlibdir}
|
||||
|
@ -288,7 +299,6 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
|||
%{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}
|
||||
|
@ -303,6 +313,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
|||
%{_mandir}/man8/dracut.8*
|
||||
%{_mandir}/man8/*service.8*
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999
|
||||
%{_mandir}/man8/mkinitrd.8*
|
||||
%{_mandir}/man1/lsinitrd.1*
|
||||
%endif
|
||||
%{_mandir}/man7/dracut.kernel.7*
|
||||
|
@ -313,51 +324,26 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
|||
%endif
|
||||
|
||||
%if %{undefined _unitdir}
|
||||
%{dracutlibdir}/modules.d/00bootchart
|
||||
%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-integritysetup
|
||||
%{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
|
||||
|
@ -368,19 +354,13 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
|||
%{dracutlibdir}/modules.d/90lvm
|
||||
%{dracutlibdir}/modules.d/90mdraid
|
||||
%{dracutlibdir}/modules.d/90multipath
|
||||
%{dracutlibdir}/modules.d/90nvdimm
|
||||
%{dracutlibdir}/modules.d/90ppcmac
|
||||
%{dracutlibdir}/modules.d/90stratis
|
||||
%{dracutlibdir}/modules.d/90qemu
|
||||
%{dracutlibdir}/modules.d/91crypt-gpg
|
||||
%{dracutlibdir}/modules.d/91crypt-loop
|
||||
%{dracutlibdir}/modules.d/91fido2
|
||||
%{dracutlibdir}/modules.d/91pcsc
|
||||
%{dracutlibdir}/modules.d/91pkcs11
|
||||
%{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
|
||||
|
@ -411,14 +391,12 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
|||
%{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}/dracut-shutdown-onfailure.service
|
||||
%{_unitdir}/sysinit.target.wants/dracut-shutdown.service
|
||||
%{_unitdir}/dracut-cmdline.service
|
||||
%{_unitdir}/dracut-initqueue.service
|
||||
|
@ -434,14 +412,16 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
|||
%{_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
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
%{_prefix}/lib/kernel/install.d/50-dracut.install
|
||||
%endif
|
||||
|
||||
%files network
|
||||
%{dracutlibdir}/modules.d/01systemd-networkd
|
||||
%{dracutlibdir}/modules.d/02systemd-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
|
||||
|
@ -472,19 +452,23 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
|||
%doc %{_mandir}/man8/dracut-catimages.8*
|
||||
%endif
|
||||
|
||||
%files squash
|
||||
%{dracutlibdir}/modules.d/99squash
|
||||
|
||||
%{_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
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
# FIXME: remove after F30
|
||||
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
|
||||
%endif
|
||||
|
||||
%changelog
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
|
@ -62,7 +62,7 @@ _/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
|
||||
# dracut --add bootchart initramfs-bootchart.img
|
||||
----
|
||||
|
||||
To see a list of available dracut modules, use the --list-modules option:
|
||||
|
@ -83,7 +83,7 @@ on the command line:
|
|||
=== 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_
|
||||
on the command line or the drivers vaiable 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
|
||||
|
@ -94,7 +94,7 @@ 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
|
||||
image. So, you could completly 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.
|
||||
|
@ -151,9 +151,9 @@ If your root partition is on the network see <<NetworkBoot>>.
|
|||
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:
|
||||
A typical german kernel command would contain:
|
||||
----
|
||||
rd.vconsole.font=eurlatgr rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8
|
||||
rd.vconsole.font=latarcyrheb-sun16 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
|
||||
|
@ -185,7 +185,7 @@ 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.
|
||||
process, but then you would lose the posibility to turn it on on demand.
|
||||
|
||||
|
||||
[[Injecting]]
|
||||
|
@ -349,7 +349,7 @@ serial --unit=0 --speed=9600
|
|||
terminal --timeout=5 serial console
|
||||
----
|
||||
+
|
||||
. Also in _/boot/grub2/grub.cfg_, add the following boot arguments to the ''kernel''
|
||||
. Also in _/boot/grub2/grub.cfg_, add the following boot arguemnts to the ''kernel''
|
||||
line:
|
||||
+
|
||||
----
|
|
@ -0,0 +1,61 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
[[ -d ${0%/*} ]] && cd ${0%/*}
|
||||
|
||||
RUN_ID="$1"
|
||||
TESTS=$2
|
||||
|
||||
dnf -y update --best --allowerasing &>/dev/null
|
||||
|
||||
dnf -y install --best --allowerasing \
|
||||
dash \
|
||||
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 \
|
||||
$NULL &>/dev/null
|
||||
|
||||
./configure
|
||||
|
||||
NCPU=$(getconf _NPROCESSORS_ONLN)
|
||||
|
||||
if ! [[ $TESTS ]]; then
|
||||
make -j$NCPU all syncheck rpm logtee
|
||||
else
|
||||
make -j$NCPU all logtee
|
||||
|
||||
cd test
|
||||
|
||||
time sudo make \
|
||||
KVERSION=$(rpm -qa kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -rn | head -1) \
|
||||
TEST_RUN_ID=$RUN_ID \
|
||||
${TESTS:+TESTS="$TESTS"} \
|
||||
-k V=2 \
|
||||
check
|
||||
fi
|
|
@ -10,7 +10,7 @@ sub create_patches {
|
|||
|
||||
mkdir $pdir, 0755;
|
||||
|
||||
open( GIT, 'git log -p --pretty=email --stat -m --first-parent --reverse --binary '.$tag.'..HEAD |');
|
||||
open( GIT, 'git log -p --pretty=email --stat -m --first-parent --reverse '.$tag.'..HEAD |');
|
||||
|
||||
while (<GIT>) {
|
||||
if (/^From [a-z0-9]{40} .*$/) {
|
||||
|
@ -37,7 +37,7 @@ $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/;
|
||||
$tag=~s/[^0-9]+?([0-9]+)/$1/;
|
||||
my $release="$num.git$datestr";
|
||||
$release="1" if $num == 1;
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -40,50 +40,132 @@ struct Hashmap {
|
|||
compare_func_t compare_func;
|
||||
|
||||
struct hashmap_entry *iterate_list_head, *iterate_list_tail;
|
||||
unsigned int n_entries;
|
||||
unsigned n_entries;
|
||||
|
||||
bool from_pool;
|
||||
};
|
||||
|
||||
#define BY_HASH(h) ((struct hashmap_entry**) ((uint8_t*) (h) + ALIGN(sizeof(Hashmap))))
|
||||
|
||||
unsigned int string_hash_func(const void *p)
|
||||
{
|
||||
unsigned int hash = 5381;
|
||||
struct pool {
|
||||
struct pool *next;
|
||||
unsigned n_tiles;
|
||||
unsigned n_used;
|
||||
};
|
||||
|
||||
static struct pool *first_hashmap_pool = NULL;
|
||||
static void *first_hashmap_tile = NULL;
|
||||
|
||||
static struct pool *first_entry_pool = NULL;
|
||||
static void *first_entry_tile = NULL;
|
||||
|
||||
static void* allocate_tile(struct pool **first_pool, void **first_tile, size_t tile_size) {
|
||||
unsigned i;
|
||||
|
||||
if (*first_tile) {
|
||||
void *r;
|
||||
|
||||
r = *first_tile;
|
||||
*first_tile = * (void**) (*first_tile);
|
||||
return r;
|
||||
}
|
||||
|
||||
if (_unlikely_(!*first_pool) || _unlikely_((*first_pool)->n_used >= (*first_pool)->n_tiles)) {
|
||||
unsigned n;
|
||||
size_t size;
|
||||
struct pool *p;
|
||||
|
||||
n = *first_pool ? (*first_pool)->n_tiles : 0;
|
||||
n = MAX(512U, n * 2);
|
||||
size = PAGE_ALIGN(ALIGN(sizeof(struct pool)) + n*tile_size);
|
||||
n = (size - ALIGN(sizeof(struct pool))) / tile_size;
|
||||
|
||||
p = malloc(size);
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
p->next = *first_pool;
|
||||
p->n_tiles = n;
|
||||
p->n_used = 0;
|
||||
|
||||
*first_pool = p;
|
||||
}
|
||||
|
||||
i = (*first_pool)->n_used++;
|
||||
|
||||
return ((uint8_t*) (*first_pool)) + ALIGN(sizeof(struct pool)) + i*tile_size;
|
||||
}
|
||||
|
||||
static void deallocate_tile(void **first_tile, void *p) {
|
||||
* (void**) p = *first_tile;
|
||||
*first_tile = p;
|
||||
}
|
||||
|
||||
#ifndef __OPTIMIZE__
|
||||
|
||||
static void drop_pool(struct pool *p) {
|
||||
while (p) {
|
||||
struct pool *n;
|
||||
n = p->next;
|
||||
free(p);
|
||||
p = n;
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((destructor)) static void cleanup_pool(void) {
|
||||
/* Be nice to valgrind */
|
||||
|
||||
drop_pool(first_hashmap_pool);
|
||||
drop_pool(first_entry_pool);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
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 int)*c;
|
||||
hash = (hash << 5) + hash + (unsigned) *c;
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
int string_compare_func(const void *a, const void *b)
|
||||
{
|
||||
int string_compare_func(const void *a, const void *b) {
|
||||
return strcmp(a, b);
|
||||
}
|
||||
|
||||
unsigned int trivial_hash_func(const void *p)
|
||||
{
|
||||
unsigned trivial_hash_func(const void *p) {
|
||||
return PTR_TO_UINT(p);
|
||||
}
|
||||
|
||||
int trivial_compare_func(const void *a, const void *b)
|
||||
{
|
||||
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 *hashmap_new(hash_func_t hash_func, compare_func_t compare_func) {
|
||||
bool b;
|
||||
Hashmap *h;
|
||||
size_t size;
|
||||
|
||||
size = ALIGN(sizeof(Hashmap)) + NBUCKETS * sizeof(struct hashmap_entry *);
|
||||
b = is_main_thread();
|
||||
|
||||
size = ALIGN(sizeof(Hashmap)) + NBUCKETS * sizeof(struct hashmap_entry*);
|
||||
|
||||
if (b) {
|
||||
h = allocate_tile(&first_hashmap_pool, &first_hashmap_tile, size);
|
||||
if (!h)
|
||||
return NULL;
|
||||
|
||||
memset(h, 0, size);
|
||||
} else {
|
||||
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;
|
||||
|
@ -91,11 +173,12 @@ Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func)
|
|||
h->n_entries = 0;
|
||||
h->iterate_list_head = h->iterate_list_tail = NULL;
|
||||
|
||||
h->from_pool = b;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
int hashmap_ensure_allocated(Hashmap **h, hash_func_t hash_func, compare_func_t compare_func)
|
||||
{
|
||||
int hashmap_ensure_allocated(Hashmap **h, hash_func_t hash_func, compare_func_t compare_func) {
|
||||
assert(h);
|
||||
|
||||
if (*h)
|
||||
|
@ -107,8 +190,7 @@ int hashmap_ensure_allocated(Hashmap **h, hash_func_t hash_func, compare_func_t
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void link_entry(Hashmap *h, struct hashmap_entry *e, unsigned int hash)
|
||||
{
|
||||
static void link_entry(Hashmap *h, struct hashmap_entry *e, unsigned hash) {
|
||||
assert(h);
|
||||
assert(e);
|
||||
|
||||
|
@ -135,8 +217,7 @@ static void link_entry(Hashmap *h, struct hashmap_entry *e, unsigned int hash)
|
|||
assert(h->n_entries >= 1);
|
||||
}
|
||||
|
||||
static void unlink_entry(Hashmap *h, struct hashmap_entry *e, unsigned int hash)
|
||||
{
|
||||
static void unlink_entry(Hashmap *h, struct hashmap_entry *e, unsigned hash) {
|
||||
assert(h);
|
||||
assert(e);
|
||||
|
||||
|
@ -164,10 +245,8 @@ static void unlink_entry(Hashmap *h, struct hashmap_entry *e, unsigned int hash)
|
|||
h->n_entries--;
|
||||
}
|
||||
|
||||
static void remove_entry(Hashmap *h, struct hashmap_entry **ep)
|
||||
{
|
||||
struct hashmap_entry *e = *ep;
|
||||
unsigned int hash;
|
||||
static void remove_entry(Hashmap *h, struct hashmap_entry *e) {
|
||||
unsigned hash;
|
||||
|
||||
assert(h);
|
||||
assert(e);
|
||||
|
@ -176,23 +255,26 @@ static void remove_entry(Hashmap *h, struct hashmap_entry **ep)
|
|||
|
||||
unlink_entry(h, e, hash);
|
||||
|
||||
if (h->from_pool)
|
||||
deallocate_tile(&first_entry_tile, e);
|
||||
else
|
||||
free(e);
|
||||
*ep = NULL;
|
||||
}
|
||||
|
||||
void hashmap_free(Hashmap *h)
|
||||
{
|
||||
void hashmap_free(Hashmap*h) {
|
||||
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
hashmap_clear(h);
|
||||
|
||||
if (h->from_pool)
|
||||
deallocate_tile(&first_hashmap_tile, h);
|
||||
else
|
||||
free(h);
|
||||
}
|
||||
|
||||
void hashmap_free_free(Hashmap *h)
|
||||
{
|
||||
void hashmap_free_free(Hashmap *h) {
|
||||
void *p;
|
||||
|
||||
while ((p = hashmap_steal_first(h)))
|
||||
|
@ -201,19 +283,15 @@ void hashmap_free_free(Hashmap *h)
|
|||
hashmap_free(h);
|
||||
}
|
||||
|
||||
void hashmap_clear(Hashmap *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);
|
||||
}
|
||||
while (h->iterate_list_head)
|
||||
remove_entry(h, h->iterate_list_head);
|
||||
}
|
||||
|
||||
static struct hashmap_entry *hash_scan(Hashmap *h, unsigned int hash, const void *key)
|
||||
{
|
||||
static struct hashmap_entry *hash_scan(Hashmap *h, unsigned hash, const void *key) {
|
||||
struct hashmap_entry *e;
|
||||
assert(h);
|
||||
assert(hash < NBUCKETS);
|
||||
|
@ -225,10 +303,9 @@ static struct hashmap_entry *hash_scan(Hashmap *h, unsigned int hash, const void
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int hashmap_put(Hashmap *h, const void *key, void *value)
|
||||
{
|
||||
int hashmap_put(Hashmap *h, const void *key, void *value) {
|
||||
struct hashmap_entry *e;
|
||||
unsigned int hash;
|
||||
unsigned hash;
|
||||
|
||||
assert(h);
|
||||
|
||||
|
@ -242,6 +319,9 @@ int hashmap_put(Hashmap *h, const void *key, void *value)
|
|||
return -EEXIST;
|
||||
}
|
||||
|
||||
if (h->from_pool)
|
||||
e = allocate_tile(&first_entry_pool, &first_entry_tile, sizeof(struct hashmap_entry));
|
||||
else
|
||||
e = new(struct hashmap_entry, 1);
|
||||
|
||||
if (!e)
|
||||
|
@ -255,10 +335,9 @@ int hashmap_put(Hashmap *h, const void *key, void *value)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int hashmap_replace(Hashmap *h, const void *key, void *value)
|
||||
{
|
||||
int hashmap_replace(Hashmap *h, const void *key, void *value) {
|
||||
struct hashmap_entry *e;
|
||||
unsigned int hash;
|
||||
unsigned hash;
|
||||
|
||||
assert(h);
|
||||
|
||||
|
@ -273,9 +352,8 @@ int hashmap_replace(Hashmap *h, const void *key, void *value)
|
|||
return hashmap_put(h, key, value);
|
||||
}
|
||||
|
||||
void *hashmap_get(Hashmap *h, const void *key)
|
||||
{
|
||||
unsigned int hash;
|
||||
void* hashmap_get(Hashmap *h, const void *key) {
|
||||
unsigned hash;
|
||||
struct hashmap_entry *e;
|
||||
|
||||
if (!h)
|
||||
|
@ -289,10 +367,9 @@ void *hashmap_get(Hashmap *h, const void *key)
|
|||
return e->value;
|
||||
}
|
||||
|
||||
void *hashmap_remove(Hashmap *h, const void *key)
|
||||
{
|
||||
void* hashmap_remove(Hashmap *h, const void *key) {
|
||||
struct hashmap_entry *e;
|
||||
unsigned int hash;
|
||||
unsigned hash;
|
||||
void *data;
|
||||
|
||||
if (!h)
|
||||
|
@ -304,15 +381,14 @@ void *hashmap_remove(Hashmap *h, const void *key)
|
|||
return NULL;
|
||||
|
||||
data = e->value;
|
||||
remove_entry(h, &e);
|
||||
remove_entry(h, e);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
int hashmap_remove_and_put(Hashmap *h, const void *old_key, const void *new_key, void *value)
|
||||
{
|
||||
int hashmap_remove_and_put(Hashmap *h, const void *old_key, const void *new_key, void *value) {
|
||||
struct hashmap_entry *e;
|
||||
unsigned int old_hash, new_hash;
|
||||
unsigned old_hash, new_hash;
|
||||
|
||||
if (!h)
|
||||
return -ENOENT;
|
||||
|
@ -335,10 +411,9 @@ int hashmap_remove_and_put(Hashmap *h, const void *old_key, const void *new_key,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int hashmap_remove_and_replace(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) {
|
||||
struct hashmap_entry *e, *k;
|
||||
unsigned int old_hash, new_hash;
|
||||
unsigned old_hash, new_hash;
|
||||
|
||||
if (!h)
|
||||
return -ENOENT;
|
||||
|
@ -351,7 +426,7 @@ int hashmap_remove_and_replace(Hashmap *h, const void *old_key, const void *new_
|
|||
|
||||
if ((k = hash_scan(h, new_hash, new_key)))
|
||||
if (e != k)
|
||||
remove_entry(h, &k);
|
||||
remove_entry(h, k);
|
||||
|
||||
unlink_entry(h, e, old_hash);
|
||||
|
||||
|
@ -363,10 +438,9 @@ int hashmap_remove_and_replace(Hashmap *h, const void *old_key, const void *new_
|
|||
return 0;
|
||||
}
|
||||
|
||||
void *hashmap_remove_value(Hashmap *h, const void *key, void *value)
|
||||
{
|
||||
void* hashmap_remove_value(Hashmap *h, const void *key, void *value) {
|
||||
struct hashmap_entry *e;
|
||||
unsigned int hash;
|
||||
unsigned hash;
|
||||
|
||||
if (!h)
|
||||
return NULL;
|
||||
|
@ -379,13 +453,12 @@ void *hashmap_remove_value(Hashmap *h, const void *key, void *value)
|
|||
if (e->value != value)
|
||||
return NULL;
|
||||
|
||||
remove_entry(h, &e);
|
||||
remove_entry(h, e);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
void *hashmap_iterate(Hashmap *h, Iterator *i, const void **key)
|
||||
{
|
||||
void *hashmap_iterate(Hashmap *h, Iterator *i, const void **key) {
|
||||
struct hashmap_entry *e;
|
||||
|
||||
assert(i);
|
||||
|
@ -399,7 +472,7 @@ void *hashmap_iterate(Hashmap *h, Iterator *i, const void **key)
|
|||
if (*i == ITERATOR_FIRST && !h->iterate_list_head)
|
||||
goto at_end;
|
||||
|
||||
e = *i == ITERATOR_FIRST ? h->iterate_list_head : (struct hashmap_entry *)*i;
|
||||
e = *i == ITERATOR_FIRST ? h->iterate_list_head : (struct hashmap_entry*) *i;
|
||||
|
||||
if (e->iterate_next)
|
||||
*i = (Iterator) e->iterate_next;
|
||||
|
@ -420,8 +493,7 @@ at_end:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void *hashmap_iterate_backwards(Hashmap *h, Iterator *i, const void **key)
|
||||
{
|
||||
void *hashmap_iterate_backwards(Hashmap *h, Iterator *i, const void **key) {
|
||||
struct hashmap_entry *e;
|
||||
|
||||
assert(i);
|
||||
|
@ -435,7 +507,7 @@ void *hashmap_iterate_backwards(Hashmap *h, Iterator *i, const void **key)
|
|||
if (*i == ITERATOR_LAST && !h->iterate_list_tail)
|
||||
goto at_beginning;
|
||||
|
||||
e = *i == ITERATOR_LAST ? h->iterate_list_tail : (struct hashmap_entry *)*i;
|
||||
e = *i == ITERATOR_LAST ? h->iterate_list_tail : (struct hashmap_entry*) *i;
|
||||
|
||||
if (e->iterate_previous)
|
||||
*i = (Iterator) e->iterate_previous;
|
||||
|
@ -456,9 +528,8 @@ at_beginning:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void *hashmap_iterate_skip(Hashmap *h, const void *key, Iterator *i)
|
||||
{
|
||||
unsigned int hash;
|
||||
void *hashmap_iterate_skip(Hashmap *h, const void *key, Iterator *i) {
|
||||
unsigned hash;
|
||||
struct hashmap_entry *e;
|
||||
|
||||
if (!h)
|
||||
|
@ -474,8 +545,7 @@ void *hashmap_iterate_skip(Hashmap *h, const void *key, Iterator *i)
|
|||
return e->value;
|
||||
}
|
||||
|
||||
void *hashmap_first(Hashmap *h)
|
||||
{
|
||||
void* hashmap_first(Hashmap *h) {
|
||||
|
||||
if (!h)
|
||||
return NULL;
|
||||
|
@ -486,8 +556,7 @@ void *hashmap_first(Hashmap *h)
|
|||
return h->iterate_list_head->value;
|
||||
}
|
||||
|
||||
void *hashmap_first_key(Hashmap *h)
|
||||
{
|
||||
void* hashmap_first_key(Hashmap *h) {
|
||||
|
||||
if (!h)
|
||||
return NULL;
|
||||
|
@ -495,11 +564,10 @@ void *hashmap_first_key(Hashmap *h)
|
|||
if (!h->iterate_list_head)
|
||||
return NULL;
|
||||
|
||||
return (void *)h->iterate_list_head->key;
|
||||
return (void*) h->iterate_list_head->key;
|
||||
}
|
||||
|
||||
void *hashmap_last(Hashmap *h)
|
||||
{
|
||||
void* hashmap_last(Hashmap *h) {
|
||||
|
||||
if (!h)
|
||||
return NULL;
|
||||
|
@ -510,9 +578,7 @@ void *hashmap_last(Hashmap *h)
|
|||
return h->iterate_list_tail->value;
|
||||
}
|
||||
|
||||
void *hashmap_steal_first(Hashmap *h)
|
||||
{
|
||||
struct hashmap_entry *e;
|
||||
void* hashmap_steal_first(Hashmap *h) {
|
||||
void *data;
|
||||
|
||||
if (!h)
|
||||
|
@ -521,16 +587,13 @@ void *hashmap_steal_first(Hashmap *h)
|
|||
if (!h->iterate_list_head)
|
||||
return NULL;
|
||||
|
||||
e = h->iterate_list_head;
|
||||
data = e->value;
|
||||
remove_entry(h, &e);
|
||||
data = h->iterate_list_head->value;
|
||||
remove_entry(h, h->iterate_list_head);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void *hashmap_steal_first_key(Hashmap *h)
|
||||
{
|
||||
struct hashmap_entry *e;
|
||||
void* hashmap_steal_first_key(Hashmap *h) {
|
||||
void *key;
|
||||
|
||||
if (!h)
|
||||
|
@ -539,15 +602,13 @@ void *hashmap_steal_first_key(Hashmap *h)
|
|||
if (!h->iterate_list_head)
|
||||
return NULL;
|
||||
|
||||
e = h->iterate_list_head;
|
||||
key = (void *)e->key;
|
||||
remove_entry(h, &e);
|
||||
key = (void*) h->iterate_list_head->key;
|
||||
remove_entry(h, h->iterate_list_head);
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
unsigned int hashmap_size(Hashmap *h)
|
||||
{
|
||||
unsigned hashmap_size(Hashmap *h) {
|
||||
|
||||
if (!h)
|
||||
return 0;
|
||||
|
@ -555,8 +616,7 @@ unsigned int hashmap_size(Hashmap *h)
|
|||
return h->n_entries;
|
||||
}
|
||||
|
||||
bool hashmap_isempty(Hashmap *h)
|
||||
{
|
||||
bool hashmap_isempty(Hashmap *h) {
|
||||
|
||||
if (!h)
|
||||
return true;
|
||||
|
@ -564,8 +624,7 @@ bool hashmap_isempty(Hashmap *h)
|
|||
return h->n_entries == 0;
|
||||
}
|
||||
|
||||
int hashmap_merge(Hashmap *h, Hashmap *other)
|
||||
{
|
||||
int hashmap_merge(Hashmap *h, Hashmap *other) {
|
||||
struct hashmap_entry *e;
|
||||
|
||||
assert(h);
|
||||
|
@ -584,8 +643,7 @@ int hashmap_merge(Hashmap *h, Hashmap *other)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void hashmap_move(Hashmap *h, Hashmap *other)
|
||||
{
|
||||
void hashmap_move(Hashmap *h, Hashmap *other) {
|
||||
struct hashmap_entry *e, *n;
|
||||
|
||||
assert(h);
|
||||
|
@ -597,7 +655,7 @@ void hashmap_move(Hashmap *h, Hashmap *other)
|
|||
return;
|
||||
|
||||
for (e = other->iterate_list_head; e; e = n) {
|
||||
unsigned int h_hash, other_hash;
|
||||
unsigned h_hash, other_hash;
|
||||
|
||||
n = e->iterate_next;
|
||||
|
||||
|
@ -613,9 +671,8 @@ void hashmap_move(Hashmap *h, Hashmap *other)
|
|||
}
|
||||
}
|
||||
|
||||
int hashmap_move_one(Hashmap *h, Hashmap *other, const void *key)
|
||||
{
|
||||
unsigned int h_hash, other_hash;
|
||||
int hashmap_move_one(Hashmap *h, Hashmap *other, const void *key) {
|
||||
unsigned h_hash, other_hash;
|
||||
struct hashmap_entry *e;
|
||||
|
||||
if (!other)
|
||||
|
@ -637,21 +694,35 @@ int hashmap_move_one(Hashmap *h, Hashmap *other, const void *key)
|
|||
return 0;
|
||||
}
|
||||
|
||||
char **hashmap_get_strv(Hashmap *h)
|
||||
{
|
||||
Hashmap *hashmap_copy(Hashmap *h) {
|
||||
Hashmap *copy;
|
||||
|
||||
assert(h);
|
||||
|
||||
if (!(copy = hashmap_new(h->hash_func, h->compare_func)))
|
||||
return NULL;
|
||||
|
||||
if (hashmap_merge(copy, h) < 0) {
|
||||
hashmap_free(copy);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
char **hashmap_get_strv(Hashmap *h) {
|
||||
char **sv;
|
||||
Iterator it;
|
||||
char *item;
|
||||
int n;
|
||||
|
||||
sv = new(char *, h->n_entries + 1);
|
||||
sv = new(char*, h->n_entries+1);
|
||||
if (!sv)
|
||||
return NULL;
|
||||
|
||||
n = 0;
|
||||
HASHMAP_FOREACH(item, h, it) {
|
||||
HASHMAP_FOREACH(item, h, it)
|
||||
sv[n++] = item;
|
||||
}
|
||||
sv[n] = NULL;
|
||||
|
||||
return sv;
|
|
@ -29,30 +29,31 @@
|
|||
|
||||
typedef struct Hashmap Hashmap;
|
||||
typedef struct _IteratorStruct _IteratorStruct;
|
||||
typedef _IteratorStruct *Iterator;
|
||||
typedef _IteratorStruct* Iterator;
|
||||
|
||||
#define ITERATOR_FIRST ((Iterator) 0)
|
||||
#define ITERATOR_LAST ((Iterator) -1)
|
||||
|
||||
typedef unsigned int (*hash_func_t)(const void *p);
|
||||
typedef unsigned (*hash_func_t)(const void *p);
|
||||
typedef int (*compare_func_t)(const void *a, const void *b);
|
||||
|
||||
unsigned int string_hash_func(const void *p);
|
||||
unsigned string_hash_func(const void *p);
|
||||
int string_compare_func(const void *a, const void *b);
|
||||
|
||||
unsigned int trivial_hash_func(const void *p);
|
||||
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);
|
||||
Hashmap *hashmap_copy(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);
|
||||
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);
|
||||
|
||||
|
@ -60,7 +61,7 @@ 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 int hashmap_size(Hashmap *h);
|
||||
unsigned hashmap_size(Hashmap *h);
|
||||
bool hashmap_isempty(Hashmap *h);
|
||||
|
||||
void *hashmap_iterate(Hashmap *h, Iterator *i, const void **key);
|
||||
|
@ -70,9 +71,9 @@ 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);
|
||||
void* hashmap_first(Hashmap *h);
|
||||
void* hashmap_first_key(Hashmap *h);
|
||||
void* hashmap_last(Hashmap *h);
|
||||
|
||||
char **hashmap_get_strv(Hashmap *h);
|
||||
|
|
@ -44,8 +44,7 @@ static bool show_location = false;
|
|||
* use here. */
|
||||
static char *log_abort_msg = NULL;
|
||||
|
||||
void log_close_console(void)
|
||||
{
|
||||
void log_close_console(void) {
|
||||
|
||||
if (console_fd < 0)
|
||||
return;
|
||||
|
@ -58,15 +57,14 @@ void log_close_console(void)
|
|||
}
|
||||
}
|
||||
|
||||
static int log_open_console(void)
|
||||
{
|
||||
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);
|
||||
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;
|
||||
|
@ -79,35 +77,36 @@ static int log_open_console(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int log_open(void)
|
||||
{
|
||||
|
||||
int log_open(void) {
|
||||
return log_open_console();
|
||||
}
|
||||
|
||||
void log_close(void)
|
||||
{
|
||||
|
||||
void log_close(void) {
|
||||
log_close_console();
|
||||
}
|
||||
|
||||
void log_set_max_level(int level)
|
||||
{
|
||||
|
||||
void log_set_max_level(int level) {
|
||||
assert((level & LOG_PRIMASK) == level);
|
||||
|
||||
log_max_level = level;
|
||||
}
|
||||
|
||||
void log_set_facility(int facility)
|
||||
{
|
||||
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 int n = 0;
|
||||
static int write_to_console(
|
||||
int level,
|
||||
const char*file,
|
||||
unsigned int line,
|
||||
const char *func,
|
||||
const char *buffer) {
|
||||
|
||||
// might be useful going ahead
|
||||
UNUSED(level);
|
||||
struct iovec iovec[5];
|
||||
unsigned n = 0;
|
||||
|
||||
if (console_fd < 0)
|
||||
return 0;
|
||||
|
@ -117,8 +116,8 @@ static int write_to_console(int level, const char *file, unsigned int line, cons
|
|||
IOVEC_SET_STRING(iovec[n++], "dracut-install: ");
|
||||
|
||||
if (show_location) {
|
||||
char location[LINE_MAX] = {0};
|
||||
if (snprintf(location, sizeof(location), "(%s:%s:%u) ", file, func, line) <= 0)
|
||||
char location[64];
|
||||
if (snprintf(location, sizeof(location), "(%s:%u) ", file, line) <= 0)
|
||||
return -errno;
|
||||
IOVEC_SET_STRING(iovec[n++], location);
|
||||
}
|
||||
|
@ -132,8 +131,12 @@ static int write_to_console(int level, const char *file, unsigned int line, cons
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int log_dispatch(int level, const char *file, unsigned int line, const char *func, char *buffer)
|
||||
{
|
||||
static int log_dispatch(
|
||||
int level,
|
||||
const char*file,
|
||||
int line,
|
||||
const char *func,
|
||||
char *buffer) {
|
||||
|
||||
int r = 0;
|
||||
|
||||
|
@ -165,32 +168,36 @@ static int log_dispatch(int level, const char *file, unsigned int line, const ch
|
|||
return r;
|
||||
}
|
||||
|
||||
int log_metav(int level, const char *file, unsigned int line, const char *func, const char *format, va_list ap)
|
||||
{
|
||||
char buffer[LINE_MAX] = {0};
|
||||
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;
|
||||
|
||||
r = vsnprintf(buffer, sizeof(buffer), format, ap);
|
||||
if (r <= 0) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
vsnprintf(buffer, sizeof(buffer), format, ap);
|
||||
char_array_0(buffer);
|
||||
|
||||
r = log_dispatch(level, file, line, func, buffer);
|
||||
|
||||
end:
|
||||
errno = saved_errno;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
int log_meta(int level, const char *file, unsigned int line, const char *func, const char *format, ...)
|
||||
{
|
||||
int log_meta(
|
||||
int level,
|
||||
const char*file,
|
||||
int line,
|
||||
const char *func,
|
||||
const char *format, ...) {
|
||||
|
||||
int r;
|
||||
va_list ap;
|
||||
|
@ -204,42 +211,35 @@ int log_meta(int level, const char *file, unsigned int line, const char *func, c
|
|||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
_noreturn_ static void log_assert(const char *text, const char *file, unsigned int line, const char *func,
|
||||
const char *format)
|
||||
{
|
||||
_noreturn_ static void log_assert(const char *text, const char *file, int line, const char *func, const char *format) {
|
||||
static char buffer[LINE_MAX];
|
||||
|
||||
if (snprintf(buffer, sizeof(buffer), format, text, file, line, func) > 0) {
|
||||
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);
|
||||
}
|
||||
|
||||
log_dispatch(LOG_CRIT, file, line, func, buffer);
|
||||
abort();
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
_noreturn_ void log_assert_failed(const char *text, const char *file, unsigned int line, const char *func)
|
||||
{
|
||||
_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, unsigned int line, const char *func)
|
||||
{
|
||||
_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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
int log_set_target_from_string(const char *e) {
|
||||
LogTarget t;
|
||||
|
||||
t = log_target_from_string(e);
|
||||
|
@ -250,8 +250,7 @@ int log_set_target_from_string(const char *e)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int log_set_max_level_from_string(const char *e)
|
||||
{
|
||||
int log_set_max_level_from_string(const char *e) {
|
||||
int t;
|
||||
|
||||
t = log_level_from_string(e);
|
||||
|
@ -262,37 +261,28 @@ int log_set_max_level_from_string(const char *e)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void log_parse_environment(void)
|
||||
{
|
||||
void log_parse_environment(void) {
|
||||
const char *e;
|
||||
|
||||
if ((e = getenv("DRACUT_INSTALL_LOG_TARGET"))) {
|
||||
if ((e = getenv("DRACUT_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 ((e = getenv("DRACUT_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)
|
||||
{
|
||||
LogTarget log_get_target(void) {
|
||||
return log_target;
|
||||
}
|
||||
|
||||
int log_get_max_level(void)
|
||||
{
|
||||
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",
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "macro.h"
|
||||
|
||||
typedef enum LogTarget {
|
||||
typedef enum LogTarget{
|
||||
LOG_TARGET_CONSOLE,
|
||||
LOG_TARGET_KMSG,
|
||||
LOG_TARGET_JOURNAL,
|
||||
|
@ -67,16 +67,31 @@ void log_close_console(void);
|
|||
|
||||
void log_parse_environment(void);
|
||||
|
||||
int log_meta(int level, const char *file, unsigned int line, const char *func,
|
||||
const char *format, ...) _printf_attr_(5, 6);
|
||||
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, unsigned int line, const char *func, const char *format, va_list ap);
|
||||
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, unsigned int line, const char *func);
|
||||
_noreturn_ void log_assert_failed_unreachable(const char *text, const char *file, unsigned int line, const char *func);
|
||||
_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);
|
||||
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__)
|
||||
|
|
@ -68,8 +68,7 @@
|
|||
#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)
|
||||
{
|
||||
static inline size_t ALIGN_TO(size_t l, size_t ali) {
|
||||
return ((l + ali - 1) & ~(ali - 1));
|
||||
}
|
||||
|
||||
|
@ -190,9 +189,8 @@ static inline size_t ALIGN_TO(size_t l, size_t ali)
|
|||
_i->iov_len = strlen(_s); \
|
||||
} while(false)
|
||||
|
||||
static inline size_t IOVEC_TOTAL_SIZE(const struct iovec *i, unsigned int n)
|
||||
{
|
||||
unsigned int j;
|
||||
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++)
|
||||
|
@ -201,9 +199,8 @@ static inline size_t IOVEC_TOTAL_SIZE(const struct iovec *i, unsigned int n)
|
|||
return r;
|
||||
}
|
||||
|
||||
static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned int n, size_t k)
|
||||
{
|
||||
unsigned int j;
|
||||
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;
|
||||
|
@ -213,7 +210,7 @@ static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned int n, size_t k)
|
|||
|
||||
sub = MIN(i[j].iov_len, k);
|
||||
i[j].iov_len -= sub;
|
||||
i[j].iov_base = (uint8_t *) i[j].iov_base + sub;
|
||||
i[j].iov_base = (uint8_t*) i[j].iov_base + sub;
|
||||
k -= sub;
|
||||
}
|
||||
|
||||
|
@ -265,12 +262,13 @@ do { \
|
|||
} \
|
||||
} while(false)
|
||||
|
||||
/* Because statfs.t_type can be int on some architecures, we have to cast
|
||||
/* 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. */
|
||||
|
@ -281,19 +279,4 @@ do { \
|
|||
sizeof(type) <= 4 ? 10 : \
|
||||
sizeof(type) <= 8 ? 20 : sizeof(int[-2*(sizeof(type) > 8)])))
|
||||
|
||||
/*
|
||||
* Takes inspiration from Rust's Option::take() method: reads and returns a pointer.
|
||||
* But at the same time resets it to NULL.
|
||||
* See: https://doc.rust-lang.org/std/option/enum.Option.html#method.take
|
||||
*/
|
||||
#define TAKE_PTR(ptr) \
|
||||
({ \
|
||||
typeof(ptr) _ptr_ = (ptr); \
|
||||
(ptr) = NULL; \
|
||||
_ptr_; \
|
||||
})
|
||||
|
||||
/* Use to suppress unused variable/function arg warning */
|
||||
#define UNUSED(var) ((void)var)
|
||||
|
||||
#include "log.h"
|
|
@ -26,36 +26,31 @@
|
|||
#include "util.h"
|
||||
#include "strv.h"
|
||||
|
||||
char *strv_find(char **l, const char *name)
|
||||
{
|
||||
char *strv_find(char **l, const char *name) {
|
||||
char **i;
|
||||
|
||||
assert(name);
|
||||
|
||||
STRV_FOREACH(i, l) {
|
||||
STRV_FOREACH(i, l)
|
||||
if (streq(*i, name))
|
||||
return *i;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *strv_find_prefix(char **l, const char *name)
|
||||
{
|
||||
char *strv_find_prefix(char **l, const char *name) {
|
||||
char **i;
|
||||
|
||||
assert(name);
|
||||
|
||||
STRV_FOREACH(i, l) {
|
||||
STRV_FOREACH(i, l)
|
||||
if (startswith(*i, name))
|
||||
return *i;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void strv_free(char **l)
|
||||
{
|
||||
void strv_free(char **l) {
|
||||
char **k;
|
||||
|
||||
if (!l)
|
||||
|
@ -67,11 +62,10 @@ void strv_free(char **l)
|
|||
free(l);
|
||||
}
|
||||
|
||||
char **strv_copy(char *const *l)
|
||||
{
|
||||
char **strv_copy(char * const *l) {
|
||||
char **r, **k;
|
||||
|
||||
k = r = new(char *, strv_length(l) + 1);
|
||||
k = r = new(char*, strv_length(l) + 1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
|
@ -88,9 +82,8 @@ char **strv_copy(char *const *l)
|
|||
return r;
|
||||
}
|
||||
|
||||
unsigned int strv_length(char *const *l)
|
||||
{
|
||||
unsigned int n = 0;
|
||||
unsigned int strv_length(char * const *l) {
|
||||
unsigned n = 0;
|
||||
|
||||
if (!l)
|
||||
return 0;
|
||||
|
@ -101,11 +94,10 @@ unsigned int strv_length(char *const *l)
|
|||
return n;
|
||||
}
|
||||
|
||||
char **strv_new_ap(const char *x, va_list ap)
|
||||
{
|
||||
char **strv_new_ap(const char *x, va_list ap) {
|
||||
const char *s;
|
||||
char **a;
|
||||
unsigned int n = 0, i = 0;
|
||||
unsigned n = 0, i = 0;
|
||||
va_list aq;
|
||||
|
||||
/* As a special trick we ignore all listed strings that equal
|
||||
|
@ -114,11 +106,11 @@ char **strv_new_ap(const char *x, va_list ap)
|
|||
* the string list. */
|
||||
|
||||
if (x) {
|
||||
n = x == (const char *)-1 ? 0 : 1;
|
||||
n = x == (const char*) -1 ? 0 : 1;
|
||||
|
||||
va_copy(aq, ap);
|
||||
while ((s = va_arg(aq, const char *))) {
|
||||
if (s == (const char *)-1)
|
||||
while ((s = va_arg(aq, const char*))) {
|
||||
if (s == (const char*) -1)
|
||||
continue;
|
||||
|
||||
n++;
|
||||
|
@ -127,21 +119,21 @@ char **strv_new_ap(const char *x, va_list ap)
|
|||
va_end(aq);
|
||||
}
|
||||
|
||||
a = new(char *, n + 1);
|
||||
a = new(char*, n+1);
|
||||
if (!a)
|
||||
return NULL;
|
||||
|
||||
if (x) {
|
||||
if (x != (const char *)-1) {
|
||||
if (x != (const char*) -1) {
|
||||
a[i] = strdup(x);
|
||||
if (!a[i])
|
||||
goto fail;
|
||||
i++;
|
||||
}
|
||||
|
||||
while ((s = va_arg(ap, const char *))) {
|
||||
while ((s = va_arg(ap, const char*))) {
|
||||
|
||||
if (s == (const char *)-1)
|
||||
if (s == (const char*) -1)
|
||||
continue;
|
||||
|
||||
a[i] = strdup(s);
|
||||
|
@ -161,8 +153,7 @@ fail:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
char **strv_new(const char *x, ...)
|
||||
{
|
||||
char **strv_new(const char *x, ...) {
|
||||
char **r;
|
||||
va_list ap;
|
||||
|
||||
|
@ -173,8 +164,7 @@ char **strv_new(const char *x, ...)
|
|||
return r;
|
||||
}
|
||||
|
||||
char **strv_merge(char **a, char **b)
|
||||
{
|
||||
char **strv_merge(char **a, char **b) {
|
||||
char **r, **k;
|
||||
|
||||
if (!a)
|
||||
|
@ -183,7 +173,7 @@ char **strv_merge(char **a, char **b)
|
|||
if (!b)
|
||||
return strv_copy(a);
|
||||
|
||||
r = new(char *, strv_length(a) + strv_length(b) + 1);
|
||||
r = new(char*, strv_length(a) + strv_length(b) + 1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
|
@ -207,8 +197,7 @@ fail:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
char **strv_merge_concat(char **a, char **b, const char *suffix)
|
||||
{
|
||||
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 */
|
||||
|
@ -216,7 +205,7 @@ char **strv_merge_concat(char **a, char **b, const char *suffix)
|
|||
if (!b)
|
||||
return strv_copy(a);
|
||||
|
||||
r = new(char *, strv_length(a) + strv_length(b) + 1);
|
||||
r = new(char*, strv_length(a) + strv_length(b) + 1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
|
@ -243,22 +232,20 @@ fail:
|
|||
|
||||
}
|
||||
|
||||
char **strv_split(const char *s, const char *separator)
|
||||
{
|
||||
char **strv_split(const char *s, const char *separator) {
|
||||
char *state;
|
||||
char *w;
|
||||
size_t l;
|
||||
unsigned int n, i;
|
||||
unsigned n, i;
|
||||
char **r;
|
||||
|
||||
assert(s);
|
||||
|
||||
n = 0;
|
||||
FOREACH_WORD_SEPARATOR(w, l, s, separator, state) {
|
||||
FOREACH_WORD_SEPARATOR(w, l, s, separator, state)
|
||||
n++;
|
||||
}
|
||||
|
||||
r = new(char *, n + 1);
|
||||
r = new(char*, n+1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
|
@ -277,22 +264,20 @@ char **strv_split(const char *s, const char *separator)
|
|||
return r;
|
||||
}
|
||||
|
||||
char **strv_split_quoted(const char *s)
|
||||
{
|
||||
char **strv_split_quoted(const char *s) {
|
||||
char *state;
|
||||
char *w;
|
||||
size_t l;
|
||||
unsigned int n, i;
|
||||
unsigned n, i;
|
||||
char **r;
|
||||
|
||||
assert(s);
|
||||
|
||||
n = 0;
|
||||
FOREACH_WORD_QUOTED(w, l, s, state) {
|
||||
FOREACH_WORD_QUOTED(w, l, s, state)
|
||||
n++;
|
||||
}
|
||||
|
||||
r = new(char *, n + 1);
|
||||
r = new(char*, n+1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
|
@ -310,8 +295,7 @@ char **strv_split_quoted(const char *s)
|
|||
return r;
|
||||
}
|
||||
|
||||
char **strv_split_newlines(const char *s)
|
||||
{
|
||||
char **strv_split_newlines(const char *s) {
|
||||
char **l;
|
||||
unsigned int n;
|
||||
|
||||
|
@ -328,16 +312,15 @@ char **strv_split_newlines(const char *s)
|
|||
if (n == 0)
|
||||
return l;
|
||||
|
||||
if (isempty(l[n - 1])) {
|
||||
free(l[n - 1]);
|
||||
l[n - 1] = NULL;
|
||||
if (isempty(l[n-1])) {
|
||||
free(l[n-1]);
|
||||
l[n-1] = NULL;
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
char *strv_join(char **l, const char *separator)
|
||||
{
|
||||
char *strv_join(char **l, const char *separator) {
|
||||
char *r, *e;
|
||||
char **s;
|
||||
size_t n, k;
|
||||
|
@ -354,7 +337,7 @@ char *strv_join(char **l, const char *separator)
|
|||
n += strlen(*s);
|
||||
}
|
||||
|
||||
r = new(char, n + 1);
|
||||
r = new(char, n+1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
|
@ -371,8 +354,7 @@ char *strv_join(char **l, const char *separator)
|
|||
return r;
|
||||
}
|
||||
|
||||
char **strv_append(char **l, const char *s)
|
||||
{
|
||||
char **strv_append(char **l, const char *s) {
|
||||
char **r, **k;
|
||||
|
||||
if (!l)
|
||||
|
@ -381,7 +363,7 @@ char **strv_append(char **l, const char *s)
|
|||
if (!s)
|
||||
return strv_copy(l);
|
||||
|
||||
r = new(char *, strv_length(l) + 2);
|
||||
r = new(char*, strv_length(l)+2);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
|
@ -403,28 +385,26 @@ fail:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int strv_push(char ***l, char *value)
|
||||
{
|
||||
int strv_push(char ***l, char *value) {
|
||||
char **c;
|
||||
unsigned int n;
|
||||
unsigned n;
|
||||
|
||||
if (!value)
|
||||
return 0;
|
||||
|
||||
n = strv_length(*l);
|
||||
c = realloc(*l, sizeof(char *) * (n + 2));
|
||||
c = realloc(*l, sizeof(char*) * (n + 2));
|
||||
if (!c)
|
||||
return -ENOMEM;
|
||||
|
||||
c[n] = value;
|
||||
c[n + 1] = NULL;
|
||||
c[n+1] = NULL;
|
||||
|
||||
*l = c;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int strv_extend(char ***l, const char *value)
|
||||
{
|
||||
int strv_extend(char ***l, const char *value) {
|
||||
char *v;
|
||||
int r;
|
||||
|
||||
|
@ -442,21 +422,19 @@ int strv_extend(char ***l, const char *value)
|
|||
return r;
|
||||
}
|
||||
|
||||
char **strv_uniq(char **l)
|
||||
{
|
||||
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);
|
||||
}
|
||||
STRV_FOREACH(i, l)
|
||||
strv_remove(i+1, *i);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
char **strv_remove(char **l, const char *s)
|
||||
{
|
||||
char **strv_remove(char **l, const char *s) {
|
||||
char **f, **t;
|
||||
|
||||
if (!l)
|
||||
|
@ -481,8 +459,7 @@ char **strv_remove(char **l, const char *s)
|
|||
return l;
|
||||
}
|
||||
|
||||
char **strv_remove_prefix(char **l, const char *s)
|
||||
{
|
||||
char **strv_remove_prefix(char **l, const char *s) {
|
||||
char **f, **t;
|
||||
|
||||
if (!l)
|
||||
|
@ -507,25 +484,24 @@ char **strv_remove_prefix(char **l, const char *s)
|
|||
return l;
|
||||
}
|
||||
|
||||
char **strv_parse_nulstr(const char *s, size_t l)
|
||||
{
|
||||
char **strv_parse_nulstr(const char *s, size_t l) {
|
||||
const char *p;
|
||||
unsigned int c = 0, i = 0;
|
||||
unsigned c = 0, i = 0;
|
||||
char **v;
|
||||
|
||||
assert(s || l == 0);
|
||||
|
||||
if (l == 0)
|
||||
return new0(char *, 1);
|
||||
return new0(char*, 1);
|
||||
|
||||
for (p = s; p < s + l; p++)
|
||||
if (*p == 0)
|
||||
c++;
|
||||
|
||||
if (s[l - 1] != 0)
|
||||
if (s[l-1] != 0)
|
||||
c++;
|
||||
|
||||
v = new0(char *, c + 1);
|
||||
v = new0(char*, c+1);
|
||||
if (!v)
|
||||
return NULL;
|
||||
|
||||
|
@ -554,17 +530,15 @@ char **strv_parse_nulstr(const char *s, size_t l)
|
|||
return v;
|
||||
}
|
||||
|
||||
char **strv_split_nulstr(const char *s)
|
||||
{
|
||||
char **strv_split_nulstr(const char *s) {
|
||||
const char *i;
|
||||
char **r = NULL;
|
||||
|
||||
NULSTR_FOREACH(i, s) {
|
||||
NULSTR_FOREACH(i, s)
|
||||
if (strv_extend(&r, i) < 0) {
|
||||
strv_free(r);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!r)
|
||||
return strv_new(NULL, NULL);
|
||||
|
@ -572,8 +546,7 @@ char **strv_split_nulstr(const char *s)
|
|||
return r;
|
||||
}
|
||||
|
||||
bool strv_overlap(char **a, char **b)
|
||||
{
|
||||
bool strv_overlap(char **a, char **b) {
|
||||
char **i, **j;
|
||||
|
||||
STRV_FOREACH(i, a) {
|
||||
|
@ -586,31 +559,27 @@ bool strv_overlap(char **a, char **b)
|
|||
return false;
|
||||
}
|
||||
|
||||
static int str_compare(const void *_a, const void *_b)
|
||||
{
|
||||
const char **a = (const char **)_a, **b = (const char **)_b;
|
||||
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)
|
||||
{
|
||||
char **strv_sort(char **l) {
|
||||
|
||||
if (strv_isempty(l))
|
||||
return l;
|
||||
|
||||
qsort(l, strv_length(l), sizeof(char *), str_compare);
|
||||
qsort(l, strv_length(l), sizeof(char*), str_compare);
|
||||
return l;
|
||||
}
|
||||
|
||||
void strv_print(char **l)
|
||||
{
|
||||
void strv_print(char **l) {
|
||||
char **s;
|
||||
|
||||
if (!l)
|
||||
return;
|
||||
|
||||
STRV_FOREACH(s, l) {
|
||||
STRV_FOREACH(s, l)
|
||||
puts(*s);
|
||||
}
|
||||
}
|
|
@ -28,11 +28,11 @@ 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_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_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);
|
||||
|
@ -49,13 +49,11 @@ char **strv_uniq(char **l);
|
|||
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 const char* STRV_IFNOTNULL(const char *x) {
|
||||
return x ? x : (const char *) -1;
|
||||
}
|
||||
|
||||
static inline bool strv_isempty(char *const *l)
|
||||
{
|
||||
static inline bool strv_isempty(char * const *l) {
|
||||
return !l || !*l;
|
||||
}
|
||||
|
||||
|
@ -95,7 +93,7 @@ void strv_print(char **l);
|
|||
if (!first) \
|
||||
_l = (char**) &first; \
|
||||
else { \
|
||||
unsigned int _n; \
|
||||
unsigned _n; \
|
||||
va_list _ap; \
|
||||
\
|
||||
_n = 1; \
|
|
@ -17,27 +17,20 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#if __GLIBC_PREREQ(2, 30) == 0
|
||||
#include <sys/syscall.h>
|
||||
#ifndef SYS_gettid
|
||||
#error "SYS_gettid unavailable on this system"
|
||||
#endif
|
||||
static inline pid_t gettid(void) {
|
||||
return (pid_t) syscall(SYS_gettid);
|
||||
}
|
||||
|
||||
#define gettid() ((pid_t) syscall(SYS_gettid))
|
||||
#endif /*__GLIBC_PREREQ */
|
||||
|
||||
size_t page_size(void)
|
||||
{
|
||||
size_t page_size(void) {
|
||||
static __thread size_t pgsz = 0;
|
||||
long r;
|
||||
|
||||
|
@ -46,13 +39,12 @@ size_t page_size(void)
|
|||
|
||||
assert_se((r = sysconf(_SC_PAGESIZE)) > 0);
|
||||
|
||||
pgsz = (size_t)r;
|
||||
pgsz = (size_t) r;
|
||||
|
||||
return pgsz;
|
||||
}
|
||||
|
||||
bool endswith(const char *s, const char *postfix)
|
||||
{
|
||||
bool endswith(const char *s, const char *postfix) {
|
||||
size_t sl, pl;
|
||||
|
||||
assert(s);
|
||||
|
@ -69,9 +61,7 @@ bool endswith(const char *s, const char *postfix)
|
|||
|
||||
return memcmp(s + sl - pl, postfix, pl) == 0;
|
||||
}
|
||||
|
||||
int close_nointr(int fd)
|
||||
{
|
||||
int close_nointr(int fd) {
|
||||
assert(fd >= 0);
|
||||
|
||||
for (;;) {
|
||||
|
@ -86,8 +76,7 @@ int close_nointr(int fd)
|
|||
}
|
||||
}
|
||||
|
||||
void close_nointr_nofail(int fd)
|
||||
{
|
||||
void close_nointr_nofail(int fd) {
|
||||
int saved_errno = errno;
|
||||
|
||||
/* like close_nointr() but cannot fail, and guarantees errno
|
||||
|
@ -98,10 +87,9 @@ void close_nointr_nofail(int fd)
|
|||
errno = saved_errno;
|
||||
}
|
||||
|
||||
int open_terminal(const char *name, int mode)
|
||||
{
|
||||
int open_terminal(const char *name, int mode) {
|
||||
int fd, r;
|
||||
unsigned int c = 0;
|
||||
unsigned c = 0;
|
||||
|
||||
/*
|
||||
* If a TTY is in the process of being closed opening it might
|
||||
|
@ -142,8 +130,7 @@ int open_terminal(const char *name, int mode)
|
|||
return fd;
|
||||
}
|
||||
|
||||
bool streq_ptr(const char *a, const char *b)
|
||||
{
|
||||
bool streq_ptr(const char *a, const char *b) {
|
||||
|
||||
/* Like streq(), but tries to make sense of NULL pointers */
|
||||
|
||||
|
@ -155,19 +142,16 @@ bool streq_ptr(const char *a, const char *b)
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_main_thread(void)
|
||||
{
|
||||
bool is_main_thread(void) {
|
||||
static __thread int cached = 0;
|
||||
|
||||
if (_unlikely_(cached == 0))
|
||||
cached = getpid() == gettid()? 1 : -1;
|
||||
cached = getpid() == gettid() ? 1 : -1;
|
||||
|
||||
return cached > 0;
|
||||
}
|
||||
|
||||
int safe_atou(const char *s, unsigned int *ret_u)
|
||||
{
|
||||
int safe_atou(const char *s, unsigned *ret_u) {
|
||||
char *x = NULL;
|
||||
unsigned long l;
|
||||
|
||||
|
@ -180,10 +164,10 @@ int safe_atou(const char *s, unsigned int *ret_u)
|
|||
if (!x || *x || errno)
|
||||
return errno ? -errno : -EINVAL;
|
||||
|
||||
if ((unsigned long)(unsigned int)l != l)
|
||||
if ((unsigned long) (unsigned) l != l)
|
||||
return -ERANGE;
|
||||
|
||||
*ret_u = (unsigned int)l;
|
||||
*ret_u = (unsigned) l;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -200,8 +184,7 @@ static const char *const log_level_table[] = {
|
|||
|
||||
DEFINE_STRING_TABLE_LOOKUP(log_level, int);
|
||||
|
||||
char *strnappend(const char *s, const char *suffix, size_t b)
|
||||
{
|
||||
char *strnappend(const char *s, const char *suffix, size_t b) {
|
||||
size_t a;
|
||||
char *r;
|
||||
|
||||
|
@ -218,27 +201,25 @@ char *strnappend(const char *s, const char *suffix, size_t b)
|
|||
assert(suffix);
|
||||
|
||||
a = strlen(s);
|
||||
if (b > ((size_t)-1) - a)
|
||||
if (b > ((size_t) -1) - a)
|
||||
return NULL;
|
||||
|
||||
r = new(char, a + b + 1);
|
||||
r = new(char, a+b+1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
memcpy(r, s, a);
|
||||
memcpy(r + a, suffix, b);
|
||||
r[a + b] = 0;
|
||||
memcpy(r+a, suffix, b);
|
||||
r[a+b] = 0;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
char *strappend(const char *s, const char *suffix)
|
||||
{
|
||||
char *strappend(const char *s, const char *suffix) {
|
||||
return strnappend(s, suffix, suffix ? strlen(suffix) : 0);
|
||||
}
|
||||
|
||||
char *strjoin(const char *x, ...)
|
||||
{
|
||||
char *strjoin(const char *x, ...) {
|
||||
va_list ap;
|
||||
size_t l;
|
||||
char *r;
|
||||
|
@ -257,7 +238,7 @@ char *strjoin(const char *x, ...)
|
|||
break;
|
||||
|
||||
n = strlen(t);
|
||||
if (n > ((size_t)-1) - l) {
|
||||
if (n > ((size_t) -1) - l) {
|
||||
va_end(ap);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -269,7 +250,7 @@ char *strjoin(const char *x, ...)
|
|||
|
||||
va_end(ap);
|
||||
|
||||
r = new(char, l + 1);
|
||||
r = new(char, l+1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
|
@ -297,8 +278,7 @@ char *strjoin(const char *x, ...)
|
|||
return r;
|
||||
}
|
||||
|
||||
char *cunescape_length_with_prefix(const char *s, size_t length, const char *prefix)
|
||||
{
|
||||
char *cunescape_length_with_prefix(const char *s, size_t length, const char *prefix) {
|
||||
char *r, *t;
|
||||
const char *f;
|
||||
size_t pl;
|
||||
|
@ -309,7 +289,7 @@ char *cunescape_length_with_prefix(const char *s, size_t length, const char *pre
|
|||
|
||||
pl = prefix ? strlen(prefix) : 0;
|
||||
|
||||
r = new(char, pl + length + 1);
|
||||
r = new(char, pl+length+1);
|
||||
if (!r)
|
||||
return r;
|
||||
|
||||
|
@ -375,7 +355,7 @@ char *cunescape_length_with_prefix(const char *s, size_t length, const char *pre
|
|||
*(t++) = '\\';
|
||||
*(t++) = 'x';
|
||||
} else {
|
||||
*(t++) = (char)((a << 4) | b);
|
||||
*(t++) = (char) ((a << 4) | b);
|
||||
f += 2;
|
||||
}
|
||||
|
||||
|
@ -402,7 +382,7 @@ char *cunescape_length_with_prefix(const char *s, size_t length, const char *pre
|
|||
*(t++) = '\\';
|
||||
*(t++) = f[0];
|
||||
} else {
|
||||
*(t++) = (char)((a << 6) | (b << 3) | c);
|
||||
*(t++) = (char) ((a << 6) | (b << 3) | c);
|
||||
f += 2;
|
||||
}
|
||||
|
||||
|
@ -410,7 +390,7 @@ char *cunescape_length_with_prefix(const char *s, size_t length, const char *pre
|
|||
}
|
||||
|
||||
case 0:
|
||||
/* premature end of string. */
|
||||
/* premature end of string.*/
|
||||
*(t++) = '\\';
|
||||
goto finish;
|
||||
|
||||
|
@ -427,15 +407,14 @@ finish:
|
|||
return r;
|
||||
}
|
||||
|
||||
char *cunescape_length(const char *s, size_t length)
|
||||
{
|
||||
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)
|
||||
{
|
||||
char *split_quoted(const char *c, size_t *l, char **state) {
|
||||
const char *current, *e;
|
||||
bool escaped = false;
|
||||
|
||||
|
@ -451,7 +430,7 @@ char *split_quoted(const char *c, size_t *l, char **state)
|
|||
return NULL;
|
||||
|
||||
else if (*current == '\'') {
|
||||
current++;
|
||||
current ++;
|
||||
|
||||
for (e = current; *e; e++) {
|
||||
if (escaped)
|
||||
|
@ -462,11 +441,11 @@ char *split_quoted(const char *c, size_t *l, char **state)
|
|||
break;
|
||||
}
|
||||
|
||||
*l = e - current;
|
||||
*state = (char *)(*e == 0 ? e : e + 1);
|
||||
*l = e-current;
|
||||
*state = (char*) (*e == 0 ? e : e+1);
|
||||
|
||||
} else if (*current == '\"') {
|
||||
current++;
|
||||
current ++;
|
||||
|
||||
for (e = current; *e; e++) {
|
||||
if (escaped)
|
||||
|
@ -477,8 +456,8 @@ char *split_quoted(const char *c, size_t *l, char **state)
|
|||
break;
|
||||
}
|
||||
|
||||
*l = e - current;
|
||||
*state = (char *)(*e == 0 ? e : e + 1);
|
||||
*l = e-current;
|
||||
*state = (char*) (*e == 0 ? e : e+1);
|
||||
|
||||
} else {
|
||||
for (e = current; *e; e++) {
|
||||
|
@ -489,32 +468,30 @@ char *split_quoted(const char *c, size_t *l, char **state)
|
|||
else if (strchr(WHITESPACE, *e))
|
||||
break;
|
||||
}
|
||||
*l = e - current;
|
||||
*state = (char *)e;
|
||||
*l = e-current;
|
||||
*state = (char*) e;
|
||||
}
|
||||
|
||||
return (char *)current;
|
||||
return (char*) current;
|
||||
}
|
||||
|
||||
/* Split a string into words. */
|
||||
char *split(const char *c, size_t *l, const char *separator, char **state)
|
||||
{
|
||||
char *split(const char *c, size_t *l, const char *separator, char **state) {
|
||||
char *current;
|
||||
|
||||
current = *state ? *state : (char *)c;
|
||||
current = *state ? *state : (char*) c;
|
||||
|
||||
if (!*current || *c == 0)
|
||||
return NULL;
|
||||
|
||||
current += strspn(current, separator);
|
||||
*l = strcspn(current, separator);
|
||||
*state = current + *l;
|
||||
*state = current+*l;
|
||||
|
||||
return (char *)current;
|
||||
return (char*) current;
|
||||
}
|
||||
|
||||
int unhexchar(char c)
|
||||
{
|
||||
int unhexchar(char c) {
|
||||
|
||||
if (c >= '0' && c <= '9')
|
||||
return c - '0';
|
||||
|
@ -528,30 +505,10 @@ int unhexchar(char c)
|
|||
return -1;
|
||||
}
|
||||
|
||||
int unoctchar(char c)
|
||||
{
|
||||
int unoctchar(char c) {
|
||||
|
||||
if (c >= '0' && c <= '7')
|
||||
return c - '0';
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int dracut_asprintf(char **restrict strp, const char *restrict fmt, ...)
|
||||
{
|
||||
int ret = -1;
|
||||
va_list args;
|
||||
|
||||
if (!strp || !fmt) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
va_start(args, fmt);
|
||||
ret = vasprintf(strp, fmt, args);
|
||||
if (ret < 0) {
|
||||
*strp = NULL;
|
||||
}
|
||||
va_end(args);
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -86,8 +86,8 @@ typedef struct dual_timestamp {
|
|||
|
||||
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);
|
||||
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)
|
||||
|
||||
|
@ -115,33 +115,28 @@ bool streq_ptr(const char *a, const char *b);
|
|||
|
||||
#define malloc0(n) (calloc((n), 1))
|
||||
|
||||
static inline const char *yes_no(bool b)
|
||||
{
|
||||
static inline const char* yes_no(bool b) {
|
||||
return b ? "yes" : "no";
|
||||
}
|
||||
|
||||
static inline const char *strempty(const char *s)
|
||||
{
|
||||
static inline const char* strempty(const char *s) {
|
||||
return s ? s : "";
|
||||
}
|
||||
|
||||
static inline const char *strnull(const char *s)
|
||||
{
|
||||
static inline const char* strnull(const char *s) {
|
||||
return s ? s : "(null)";
|
||||
}
|
||||
|
||||
static inline const char *strna(const char *s)
|
||||
{
|
||||
static inline const char *strna(const char *s) {
|
||||
return s ? s : "n/a";
|
||||
}
|
||||
|
||||
static inline bool isempty(const char *p)
|
||||
{
|
||||
static inline bool isempty(const char *p) {
|
||||
return !p || !p[0];
|
||||
}
|
||||
|
||||
static inline const char *startswith(const char *s, const char *prefix)
|
||||
{
|
||||
|
||||
static inline const char *startswith(const char *s, const char *prefix) {
|
||||
if (strncmp(s, prefix, strlen(prefix)) == 0)
|
||||
return s + strlen(prefix);
|
||||
return NULL;
|
||||
|
@ -149,76 +144,67 @@ static inline const char *startswith(const char *s, const char *prefix)
|
|||
|
||||
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 int n_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);
|
||||
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 int *ret_u);
|
||||
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 int));
|
||||
return safe_atou(s, (unsigned int *)ret_u);
|
||||
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)
|
||||
{
|
||||
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);
|
||||
return safe_atoi(s, (int*) ret_u);
|
||||
}
|
||||
#else
|
||||
static inline int safe_atolu(const char *s, unsigned long *ret_u)
|
||||
{
|
||||
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);
|
||||
return safe_atollu(s, (unsigned long long*) ret_u);
|
||||
}
|
||||
|
||||
static inline int safe_atoli(const char *s, long int *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);
|
||||
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 int));
|
||||
return safe_atou(s, (unsigned int *)ret_u);
|
||||
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)
|
||||
{
|
||||
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);
|
||||
return safe_atoi(s, (int*) ret_i);
|
||||
}
|
||||
|
||||
static inline int safe_atou64(const char *s, uint64_t *ret_u)
|
||||
{
|
||||
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);
|
||||
return safe_atollu(s, (unsigned long long*) ret_u);
|
||||
}
|
||||
|
||||
static inline int safe_atoi64(const char *s, int64_t *ret_i)
|
||||
{
|
||||
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);
|
||||
return safe_atolli(s, (long long int*) ret_i);
|
||||
}
|
||||
|
||||
char *split(const char *c, size_t *l, const char *separator, char **state);
|
||||
|
@ -312,7 +298,7 @@ unsigned long long random_ull(void);
|
|||
} \
|
||||
scope type name##_from_string(const char *s) { \
|
||||
type i; \
|
||||
unsigned int u = 0; \
|
||||
unsigned u = 0; \
|
||||
assert(s); \
|
||||
for (i = 0; i < (type)ELEMENTSOF(name##_table); i++) \
|
||||
if (name##_table[i] && \
|
||||
|
@ -331,7 +317,7 @@ unsigned long long random_ull(void);
|
|||
int fd_nonblock(int fd, bool nonblock);
|
||||
int fd_cloexec(int fd, bool cloexec);
|
||||
|
||||
int close_all_fds(const int except[], unsigned int n_except);
|
||||
int close_all_fds(const int except[], unsigned n_except);
|
||||
|
||||
bool fstype_is_network(const char *fstype);
|
||||
|
||||
|
@ -367,9 +353,9 @@ void rename_process(const char name[8]);
|
|||
|
||||
void sigset_add_many(sigset_t *ss, ...);
|
||||
|
||||
char *gethostname_malloc(void);
|
||||
char* gethostname_malloc(void);
|
||||
bool hostname_is_set(void);
|
||||
char *getlogname_malloc(void);
|
||||
char* getlogname_malloc(void);
|
||||
|
||||
int getttyname_malloc(int fd, char **r);
|
||||
int getttyname_harder(int fd, char **r);
|
||||
|
@ -385,22 +371,22 @@ 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 int *ncpus);
|
||||
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 int columns(void);
|
||||
unsigned columns(void);
|
||||
|
||||
int fd_lines(int fd);
|
||||
unsigned int lines(void);
|
||||
unsigned lines(void);
|
||||
|
||||
int running_in_chroot(void);
|
||||
|
||||
char *ellipsize(const char *s, size_t length, unsigned int percent);
|
||||
char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigned int percent);
|
||||
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);
|
||||
|
||||
|
@ -432,7 +418,7 @@ 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 nulstr_contains(const char*nulstr, const char *needle);
|
||||
|
||||
bool plymouth_running(void);
|
||||
|
||||
|
@ -441,9 +427,9 @@ 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* hostname_cleanup(char *s);
|
||||
|
||||
char *strshorten(char *s, size_t l);
|
||||
char* strshorten(char *s, size_t l);
|
||||
|
||||
int terminal_vhangup_fd(int fd);
|
||||
int terminal_vhangup(const char *name);
|
||||
|
@ -475,7 +461,7 @@ char *join(const char *x, ...) _sentinel_;
|
|||
|
||||
bool is_main_thread(void);
|
||||
|
||||
bool in_charset(const char *s, const char *charset);
|
||||
bool in_charset(const char *s, const char* charset);
|
||||
|
||||
int block_get_whole_disk(dev_t d, dev_t *ret);
|
||||
|
||||
|
@ -526,41 +512,35 @@ 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);
|
||||
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 freep(void *p) {
|
||||
free(*(void**) p);
|
||||
}
|
||||
|
||||
static inline void fclosep(FILE **f)
|
||||
{
|
||||
static inline void fclosep(FILE **f) {
|
||||
if (*f)
|
||||
fclose(*f);
|
||||
}
|
||||
|
||||
static inline void pclosep(FILE **f)
|
||||
{
|
||||
static inline void pclosep(FILE **f) {
|
||||
if (*f)
|
||||
pclose(*f);
|
||||
}
|
||||
|
||||
static inline void closep(int *fd)
|
||||
{
|
||||
static inline void closep(int *fd) {
|
||||
if (*fd >= 0)
|
||||
close_nointr_nofail(*fd);
|
||||
}
|
||||
|
||||
static inline void closedirp(DIR **d)
|
||||
{
|
||||
static inline void closedirp(DIR **d) {
|
||||
if (*d)
|
||||
closedir(*d);
|
||||
}
|
||||
|
||||
static inline void umaskp(mode_t *u)
|
||||
{
|
||||
static inline void umaskp(mode_t *u) {
|
||||
umask(*u);
|
||||
}
|
||||
|
||||
|
@ -575,7 +555,7 @@ static inline void umaskp(mode_t *u)
|
|||
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 int n_except, const char *path, ...);
|
||||
int fork_agent(pid_t *pid, const int except[], unsigned n_except, const char *path, ...);
|
||||
|
||||
int setrlimit_closest(int resource, const struct rlimit *rlim);
|
||||
|
||||
|
@ -603,6 +583,4 @@ char *cunescape_length(const char *s, size_t length);
|
|||
int unhexchar(char c) _const_;
|
||||
int unoctchar(char c) _const_;
|
||||
|
||||
int dracut_asprintf(char **restrict strp, const char *restrict fmt, ...);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,54 @@
|
|||
#define _GNU_SOURCE
|
||||
#include <fcntl.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;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: %s <file>\n", argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if (fd == -1) {
|
||||
perror("open");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fprintf(stderr, "Logging to %s: ", argv[1]);
|
||||
|
||||
slen = 0;
|
||||
|
||||
do {
|
||||
len = splice(STDIN_FILENO, NULL, fd, NULL,
|
||||
BUFLEN, SPLICE_F_MOVE);
|
||||
|
||||
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);
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# 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 field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local -A OPTS=(
|
||||
[STANDALONE]='-s --size -h --help'
|
||||
|
||||
[ARG]='-f --file -k --kver'
|
||||
)
|
||||
|
||||
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; echo [0-9]*)
|
||||
;;
|
||||
*)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ $cur = -* ]]; then
|
||||
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
comps=$(compgen -f -- "$cur")
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -F _lsinitrd lsinitrd
|
|
@ -3,7 +3,6 @@ LSINITRD(1)
|
|||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
:man version: {version}
|
||||
|
||||
NAME
|
||||
----
|
210
lsinitrd.sh
210
lsinitrd.sh
|
@ -17,7 +17,8 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
usage() {
|
||||
usage()
|
||||
{
|
||||
{
|
||||
echo "Usage: ${0##*/} [options] [<initramfs file> [<filename> [<filename> [...] ]]]"
|
||||
echo "Usage: ${0##*/} [options] -k <kernel version>"
|
||||
|
@ -37,6 +38,7 @@ usage() {
|
|||
} >&2
|
||||
}
|
||||
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
|
||||
sorted=0
|
||||
|
@ -57,8 +59,7 @@ TEMP=$(getopt \
|
|||
--long verbose \
|
||||
-- "$@")
|
||||
|
||||
# shellcheck disable=SC2181
|
||||
if (($? != 0)); then
|
||||
if (( $? != 0 )); then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
@ -67,31 +68,16 @@ 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
|
||||
;;
|
||||
-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
|
||||
|
@ -100,7 +86,7 @@ done
|
|||
|
||||
if [[ $1 ]]; then
|
||||
image="$1"
|
||||
if ! [[ -f $image ]]; then
|
||||
if ! [[ -f "$image" ]]; then
|
||||
{
|
||||
echo "$image does not exist"
|
||||
echo
|
||||
|
@ -109,15 +95,11 @@ if [[ $1 ]]; then
|
|||
exit 1
|
||||
fi
|
||||
else
|
||||
[[ -f /etc/machine-id ]] && read -r MACHINE_ID < /etc/machine-id
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
|
||||
if [[ -d /boot/loader/entries || -L /boot/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
|
||||
&& [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
|
||||
image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
|
||||
else
|
||||
image="/boot/initramfs-${KERNEL_VERSION}.img"
|
||||
|
@ -126,11 +108,11 @@ fi
|
|||
|
||||
shift
|
||||
while (($# > 0)); do
|
||||
filenames[${1#/}]=1
|
||||
filenames[${1#/}]=1;
|
||||
shift
|
||||
done
|
||||
|
||||
if ! [[ -f $image ]]; then
|
||||
if ! [[ -f "$image" ]]; then
|
||||
{
|
||||
echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
|
||||
echo
|
||||
|
@ -139,130 +121,76 @@ if ! [[ -f $image ]]; then
|
|||
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
|
||||
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 += $?))
|
||||
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout "$f" 2>/dev/null
|
||||
((ret+=$?))
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
[[ $nofileinfo ]] || echo
|
||||
done
|
||||
}
|
||||
|
||||
list_modules() {
|
||||
list_modules()
|
||||
{
|
||||
echo "dracut modules:"
|
||||
# shellcheck disable=SC2046
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
|
||||
$(dracutlibdirs modules.txt) 2> /dev/null
|
||||
((ret += $?))
|
||||
$(dracutlibdirs modules.txt) 2>/dev/null
|
||||
((ret+=$?))
|
||||
}
|
||||
|
||||
list_files() {
|
||||
list_files()
|
||||
{
|
||||
echo "========================================================================"
|
||||
if [ "$sorted" -eq 1 ]; then
|
||||
$CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
$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
|
||||
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -k9
|
||||
fi
|
||||
((ret += $?))
|
||||
((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
|
||||
unpack_files()
|
||||
{
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
for f in "${!filenames[@]}"; do
|
||||
$CAT "$image" 2> /dev/null | cpio -id --quiet $verbose $f
|
||||
((ret += $?))
|
||||
$CAT "$image" 2>/dev/null | cpio -id --quiet $verbose $f
|
||||
((ret+=$?))
|
||||
done
|
||||
else
|
||||
$CAT "$image" 2> /dev/null | cpio -id --quiet $verbose
|
||||
((ret += $?))
|
||||
$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
|
||||
|
||||
if (( ${#filenames[@]} <= 0 )) && [[ -z "$unpack" ]] && [[ -z "$unpackearly" ]]; then
|
||||
echo "Image: $image: $(du -h $image | while read a b || [ -n "$a" ]; do echo $a;done)"
|
||||
echo "========================================================================"
|
||||
fi
|
||||
|
||||
read -r -N 6 bin < "$image"
|
||||
read -N 6 bin < "$image"
|
||||
case $bin in
|
||||
$'\x71\xc7'* | 070701)
|
||||
$'\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)
|
||||
is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2>/dev/null)
|
||||
if [[ "$is_early" ]]; then
|
||||
if [[ -n $unpack ]]; then
|
||||
if [[ -n "$unpack" ]]; then
|
||||
# should use --unpackearly for early CPIO
|
||||
:
|
||||
elif [[ -n $unpackearly ]]; then
|
||||
elif [[ -n "$unpackearly" ]]; then
|
||||
unpack_files
|
||||
elif ((${#filenames[@]} > 0)); then
|
||||
elif (( ${#filenames[@]} > 0 )); then
|
||||
extract_files
|
||||
else
|
||||
echo "Early CPIO image"
|
||||
|
@ -283,10 +211,10 @@ case $bin in
|
|||
;;
|
||||
esac
|
||||
|
||||
if [[ $SKIP ]]; then
|
||||
bin="$($SKIP "$image" | { read -r -N 6 bin && echo "$bin"; })"
|
||||
if [[ $SKIP ]] ; then
|
||||
bin="$($SKIP "$image" | { read -N 6 bin && echo "$bin" ; })"
|
||||
else
|
||||
read -r -N 6 bin < "$image"
|
||||
read -N 6 bin < "$image"
|
||||
fi
|
||||
case $bin in
|
||||
$'\x1f\x8b'*)
|
||||
|
@ -295,7 +223,7 @@ case $bin in
|
|||
BZh*)
|
||||
CAT="bzcat --"
|
||||
;;
|
||||
$'\x71\xc7'* | 070701)
|
||||
$'\x71\xc7'*|070701)
|
||||
CAT="cat --"
|
||||
;;
|
||||
$'\x02\x21'*)
|
||||
|
@ -308,7 +236,7 @@ case $bin in
|
|||
CAT="zstd -d -c"
|
||||
;;
|
||||
*)
|
||||
if echo "test" | xz | xzcat --single-stream > /dev/null 2>&1; then
|
||||
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
|
||||
CAT="xzcat --single-stream --"
|
||||
else
|
||||
CAT="xzcat --"
|
||||
|
@ -316,7 +244,8 @@ case $bin in
|
|||
;;
|
||||
esac
|
||||
|
||||
skipcpio() {
|
||||
skipcpio()
|
||||
{
|
||||
$SKIP "$@" | $ORIG_CAT
|
||||
}
|
||||
|
||||
|
@ -325,26 +254,27 @@ if [[ $SKIP ]]; then
|
|||
CAT=skipcpio
|
||||
fi
|
||||
|
||||
if ((${#filenames[@]} > 1)); then
|
||||
TMPFILE="$TMPDIR/initrd.cpio"
|
||||
$CAT "$image" 2> /dev/null > "$TMPFILE"
|
||||
pre_decompress() {
|
||||
cat "$TMPFILE"
|
||||
if (( ${#filenames[@]} > 1 )); then
|
||||
TMPFILE="$(mktemp -t --suffix=.cpio lsinitrd.XXXXXX)"
|
||||
$CAT "$image" 2>/dev/null > $TMPFILE
|
||||
trap "rm -f '$TMPFILE'" EXIT
|
||||
pre_decompress()
|
||||
{
|
||||
cat $TMPFILE
|
||||
}
|
||||
CAT=pre_decompress
|
||||
fi
|
||||
|
||||
ret=0
|
||||
|
||||
if [[ -n $unpack ]]; then
|
||||
if [[ -n "$unpack" ]]; then
|
||||
unpack_files
|
||||
elif ((${#filenames[@]} > 0)); then
|
||||
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 += $?))
|
||||
$(dracutlibdirs 'dracut-*') 2>/dev/null)
|
||||
((ret+=$?))
|
||||
echo "Version: $version"
|
||||
echo
|
||||
if [ "$modules" -eq 1 ]; then
|
||||
|
@ -352,14 +282,12 @@ else
|
|||
echo "========================================================================"
|
||||
else
|
||||
echo -n "Arguments: "
|
||||
# shellcheck disable=SC2046
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
|
||||
$(dracutlibdirs build-parameter.txt) 2> /dev/null
|
||||
$(dracutlibdirs build-parameter.txt) 2>/dev/null
|
||||
echo
|
||||
list_modules
|
||||
list_files
|
||||
list_squash_content
|
||||
fi
|
||||
fi
|
||||
|
||||
exit "$ret"
|
||||
exit $ret
|
||||
|
|
|
@ -0,0 +1,226 @@
|
|||
#!/bin/bash --norc
|
||||
kver=$(uname -r)
|
||||
|
||||
boot_dir="/boot"
|
||||
quiet=0
|
||||
host_only=0
|
||||
force=0
|
||||
|
||||
error() { echo "$@" >&2; }
|
||||
|
||||
usage () {
|
||||
[[ $1 = '-n' ]] && cmd=echo || cmd=error
|
||||
|
||||
$cmd "usage: ${0##*/} [--version] [--help] [-v] [-f] [--preload <module>]"
|
||||
$cmd " [--image-version] [--with=<module>]"
|
||||
$cmd " [--nocompress]"
|
||||
$cmd " <initrd-image> <kernel-version>"
|
||||
$cmd ""
|
||||
$cmd " (ex: ${0##*/} /boot/initramfs-$kver.img $kver)"
|
||||
|
||||
[[ $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
|
||||
}
|
||||
|
||||
# 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 "$(uname -m)" in
|
||||
s390|s390x)
|
||||
regex='image'
|
||||
;;
|
||||
ppc|ppc64)
|
||||
regex='vmlinux'
|
||||
;;
|
||||
i386|x86_64)
|
||||
regex='vmlinuz'
|
||||
;;
|
||||
arm*)
|
||||
regex='[uz]Image'
|
||||
;;
|
||||
aarch64)
|
||||
regex='Image'
|
||||
;;
|
||||
*) regex='vmlinu.'
|
||||
;;
|
||||
esac
|
||||
|
||||
# user mode linux
|
||||
if grep -q UML /proc/cpuinfo; then
|
||||
regex='linux'
|
||||
fi
|
||||
|
||||
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.
|
||||
|
||||
[ -L "$boot_dir/$kernel_image" ] && continue
|
||||
[ "${kernel_image%%.gz}" != "$kernel_image" ] && continue
|
||||
kernel_version=$(/usr/bin/get_kernel_version \
|
||||
$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
|
||||
host_only=1
|
||||
force=1
|
||||
}
|
||||
|
||||
while (($# > 0)); do
|
||||
case ${1%%=*} in
|
||||
--with-usb) read_arg usbmodule "$@" || shift $?
|
||||
basicmodules="$basicmodules ${usbmodule:-usb-storage}"
|
||||
unset usbmodule;;
|
||||
--with-avail) read_arg modname "$@" || shift $?
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--with) read_arg modname "$@" || shift $?
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--version)
|
||||
echo "mkinitrd: dracut compatibility wrapper"
|
||||
exit 0;;
|
||||
-v|--verbose) dracut_args="${dracut_args} -v";;
|
||||
-f|--force) force=1;;
|
||||
--preload) read_arg modname "$@" || shift $?
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--image-version) img_vers=yes;;
|
||||
--rootfs|-d) read_arg rootfs "$@" || shift $?
|
||||
dracut_args="${dracut_args} --filesystems $rootfs";;
|
||||
--nocompress) dracut_args="$dracut_args --no-compress";;
|
||||
--help) usage -n;;
|
||||
--builtin) ;;
|
||||
--without*) ;;
|
||||
--without-usb) ;;
|
||||
--fstab*) ;;
|
||||
--ifneeded) ;;
|
||||
--omit-scsi-modules) ;;
|
||||
--omit-ide-modules) ;;
|
||||
--omit-raid-modules) ;;
|
||||
--omit-lvm-modules) ;;
|
||||
--omit-dmraid) ;;
|
||||
--allow-missing) ;;
|
||||
--net-dev*) ;;
|
||||
--noresume) ;;
|
||||
--rootdev*) ;;
|
||||
--thawdev*) ;;
|
||||
--rootopts*) ;;
|
||||
--root*) ;;
|
||||
--loopdev*) ;;
|
||||
--loopfs*) ;;
|
||||
--loopopts*) ;;
|
||||
--looppath*) ;;
|
||||
--dsdt*) ;;
|
||||
--bootchart) ;;
|
||||
-s) ;;
|
||||
--quiet|-q) quiet=1;;
|
||||
-b) read_arg boot_dir "$@" || shift $?
|
||||
if [ ! -d $boot_dir ];then
|
||||
error "Boot directory $boot_dir does not exist"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-k) # Would be nice to get a list of images here
|
||||
read_arg kernel_images "$@" || shift $?
|
||||
for kernel_image in $kernel_images;do
|
||||
kernels="$kernels ${kernel_image#*-}"
|
||||
done
|
||||
host_only=1
|
||||
force=1
|
||||
;;
|
||||
-i) read_arg initrd_images "$@" || shift $?
|
||||
for initrd_image in $initrd_images;do
|
||||
targets="$targets $boot_dir/$initrd_image"
|
||||
done
|
||||
;;
|
||||
*) if [[ ! $targets ]]; then
|
||||
targets=$1
|
||||
elif [[ ! $kernels ]]; then
|
||||
kernels=$1
|
||||
else
|
||||
usage
|
||||
fi;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
[[ $targets && $kernels ]] || default_kernel_images
|
||||
[[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage)
|
||||
|
||||
# We can have several targets/kernels, transform the list to an array
|
||||
targets=( $targets )
|
||||
[[ $kernels ]] && kernels=( $kernels )
|
||||
|
||||
[[ $host_only == 1 ]] && dracut_args="${dracut_args} -H"
|
||||
[[ $force == 1 ]] && dracut_args="${dracut_args} -f"
|
||||
|
||||
echo "Creating: target|kernel|dracut args|basicmodules "
|
||||
for ((i=0 ; $i<${#targets[@]} ; i++)); do
|
||||
|
||||
if [[ $img_vers ]];then
|
||||
target="${targets[$i]}-${kernels[$i]}"
|
||||
else
|
||||
target="${targets[$i]}"
|
||||
fi
|
||||
kernel="${kernels[$i]}"
|
||||
|
||||
# Duplicate code: No way found how to redirect output based on $quiet
|
||||
if [[ $quiet == 1 ]];then
|
||||
echo "$target|$kernel|$dracut_args|$basicmodules"
|
||||
if [[ $basicmodules ]]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" \
|
||||
"$kernel" &>/dev/null
|
||||
else
|
||||
dracut $dracut_args "$target" "$kernel" &>/dev/null
|
||||
fi
|
||||
else
|
||||
if [[ $basicmodules ]]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" \
|
||||
"$kernel"
|
||||
else
|
||||
dracut $dracut_args "$target" "$kernel"
|
||||
fi
|
||||
fi
|
||||
done
|
|
@ -0,0 +1,106 @@
|
|||
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 _INITRD_MODULES_ variable
|
||||
in */etc/sysconfig/kernel*.
|
||||
|
||||
**-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)
|
|
@ -0,0 +1,393 @@
|
|||
#!/bin/bash --norc
|
||||
#
|
||||
# mkinitrd compability 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 " INITRD_MODULES variable in /etc/sysconfig/kernel"
|
||||
$cmd " -u \"DomU module list\" Modules to include in initrd. Defaults to the"
|
||||
$cmd " DOMU_INITRD_MODULES variable in"
|
||||
$cmd " /etc/sysconfig/kernel."
|
||||
$cmd " -d root_device Root device. Defaults to the device from"
|
||||
$cmd " which / is mounted. Overrides the rootdev"
|
||||
$cmd " enviroment 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_image_gz_from_image() and kernel_version_from_image() are helpers
|
||||
# for arm* kernels which produce zImage files which cannot be read from
|
||||
# get_kernel_version -> get rid of this workaround if possible
|
||||
kernel_image_gz_from_image() {
|
||||
local arch=$(uname -i)
|
||||
local r=${1}.gz
|
||||
|
||||
# uImage kernels can't be extracted directly. Use the vmlinux.gz instead
|
||||
r=${r//uImage/vmlinux}
|
||||
|
||||
# on ARM a zImage can't be extracted directly. Other platforms define it
|
||||
# as a gzipped vmlinux file, but not ARM. So only on ARM, use vmlinux.gz.
|
||||
if [[ $arch =~ arm ]] || [[ $arch =~ aarch ]]; then
|
||||
r=${r//zImage/vmlinux}
|
||||
fi
|
||||
|
||||
echo $r
|
||||
}
|
||||
|
||||
kernel_version_from_image() {
|
||||
local kernel_image="$1" kernel_image_gz=$(kernel_image_gz_from_image "$1")
|
||||
|
||||
if get_kernel_version "$kernel_image" 2>/dev/null; then
|
||||
return
|
||||
fi
|
||||
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 "$(uname -m)" in
|
||||
s390|s390x)
|
||||
regex='image'
|
||||
;;
|
||||
ppc|ppc64)
|
||||
regex='vmlinux'
|
||||
;;
|
||||
i386|x86_64)
|
||||
regex='vmlinuz'
|
||||
;;
|
||||
arm*)
|
||||
regex='[uz]Image'
|
||||
;;
|
||||
aarch64)
|
||||
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.
|
||||
|
||||
[ -L "$boot_dir/$kernel_image" ] && continue
|
||||
[ "${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 $?
|
||||
# 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="${INITRD_MODULES}"
|
||||
[[ $domu_module_list ]] || domu_module_list="${DOMU_INITRD_MODULES}"
|
||||
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
|
|
@ -0,0 +1,65 @@
|
|||
MKINITRD(8)
|
||||
=========
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
|
||||
NAME
|
||||
----
|
||||
mkinitrd - is a compat wrapper, which calls dracut to generate an initramfs
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
*mkinitrd* ['OPTION...'] [<initrd-image>] <kernel-version>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
mkinitrd creates an initramfs image <initrd-image> for the kernel with
|
||||
version <kernel-version> by calling "dracut".
|
||||
|
||||
[IMPORTANT]
|
||||
If a more fine grained control over the resulting image is needed,
|
||||
"dracut" should be called directly.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
**--version**::
|
||||
print info about the version
|
||||
|
||||
**-v, --verbose**::
|
||||
increase verbosity level
|
||||
|
||||
**-f, --force**::
|
||||
overwrite existing initramfs file.
|
||||
|
||||
**--image-version*::
|
||||
append the kernel version to the target image
|
||||
<initrd-image>-<kernel-version>.
|
||||
|
||||
**--with=<module>**::
|
||||
add the kernel module <module> to the initramfs.
|
||||
|
||||
**--preload=<module>**::
|
||||
preload the kernel module <module> in the initramfs before any other kernel
|
||||
modules are loaded. This can be used to ensure a certain device naming,
|
||||
which should in theory be avoided and the use of symbolic links in /dev is
|
||||
encouraged.
|
||||
|
||||
**--nocompress**::
|
||||
do not compress the resulting image.
|
||||
|
||||
**--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
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
*dracut*(8)
|
|
@ -1,32 +1,21 @@
|
|||
#!/bin/bash
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Prerequisite check(s) for module.
|
||||
# called by dracut
|
||||
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
|
||||
|
||||
require_binaries /bin/bash
|
||||
}
|
||||
|
||||
# Module dependency requirements.
|
||||
# called by dracut
|
||||
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.
|
||||
# called by dracut
|
||||
install() {
|
||||
# If another shell is already installed, do not use bash
|
||||
[[ -x $initdir/bin/sh ]] && return
|
||||
|
||||
inst /bin/bash
|
||||
|
||||
# Prefer bash as default shell if no other shell is preferred.
|
||||
[[ -L $initdir/bin/sh ]] || ln -sf bash "${initdir}/bin/sh"
|
||||
|
||||
# Prefer bash as /bin/sh if it is available.
|
||||
inst /bin/bash && ln -sf bash "${initdir}/bin/sh"
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
require_binaries /sbin/bootchartd || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_symlink /init /sbin/init
|
||||
inst_dir /lib/bootchart/tmpfs
|
||||
|
||||
inst_multiple bootchartd bash \
|
||||
/lib/bootchart/bootchart-collector /etc/bootchartd.conf \
|
||||
accton \
|
||||
echo \
|
||||
grep \
|
||||
usleep
|
||||
|
||||
inst /usr/bin/pkill /bin/pkill
|
||||
inst /usr/bin/[ /bin/[
|
||||
}
|
||||
|
|
@ -1,32 +1,21 @@
|
|||
#!/bin/bash
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Prerequisite check(s) for module.
|
||||
# called by dracut
|
||||
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
|
||||
|
||||
require_binaries /bin/dash
|
||||
}
|
||||
|
||||
# Module dependency requirements.
|
||||
# called by dracut
|
||||
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.
|
||||
# called by dracut
|
||||
install() {
|
||||
# If another shell is already installed, do not use dash
|
||||
[[ -x $initdir/bin/sh ]] && return
|
||||
|
||||
inst /bin/dash
|
||||
|
||||
# Prefer dash as default shell if no other shell is preferred.
|
||||
[[ -L $initdir/bin/sh ]] || ln -sf dash "${initdir}/bin/sh"
|
||||
|
||||
# Prefer dash as /bin/sh if it is available.
|
||||
inst /bin/dash && ln -sf dash "${initdir}/bin/sh"
|
||||
}
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
#!/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
|
||||
require_binaries printf || 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
|
||||
inst printf
|
||||
|
||||
# Prefer mksh as default shell if no other shell is preferred.
|
||||
[[ -L $initdir/bin/sh ]] || ln -sf mksh "${initdir}/bin/sh"
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
#!/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
|
||||
|
||||
}
|
|
@ -1,14 +1,15 @@
|
|||
#!/bin/bash
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Prerequisite check(s) for module.
|
||||
# called by dracut
|
||||
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.
|
||||
if require_binaries $systemdutildir/systemd; then
|
||||
SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
|
||||
(( $SYSTEMD_VERSION >= 198 )) && return 0
|
||||
return 255
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
|
@ -25,114 +26,108 @@ installkernel() {
|
|||
install() {
|
||||
local _mods
|
||||
|
||||
if [[ $prefix == /run/* ]]; then
|
||||
dfatal 'systemd does not work with a prefix, which contains "/run"!!'
|
||||
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 \
|
||||
$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/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/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/sys-kernel-config.mount \
|
||||
\
|
||||
"$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/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-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/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/ctrl-alt-del.target \
|
||||
$systemdsystemunitdir/reboot.target \
|
||||
$systemdsystemunitdir/systemd-reboot.service \
|
||||
$systemdsystemunitdir/syslog.socket \
|
||||
\
|
||||
"$systemdsystemunitdir"/slices.target \
|
||||
"$systemdsystemunitdir"/system.slice \
|
||||
"$systemdsystemunitdir"/-.slice \
|
||||
$systemdsystemunitdir/slices.target \
|
||||
$systemdsystemunitdir/system.slice \
|
||||
$systemdsystemunitdir/-.slice \
|
||||
\
|
||||
"$tmpfilesdir"/systemd.conf \
|
||||
$tmpfilesdir/systemd.conf \
|
||||
\
|
||||
journalctl systemctl \
|
||||
echo swapoff \
|
||||
|
@ -140,8 +135,8 @@ install() {
|
|||
mount umount reboot poweroff \
|
||||
systemd-run systemd-escape \
|
||||
systemd-cgls systemd-tmpfiles \
|
||||
systemd-ask-password systemd-tty-ask-password-agent \
|
||||
/etc/udev/udev.hwdb
|
||||
/etc/udev/udev.hwdb \
|
||||
${NULL}
|
||||
|
||||
inst_multiple -o \
|
||||
/usr/lib/modules-load.d/*.conf \
|
||||
|
@ -149,24 +144,23 @@ install() {
|
|||
|
||||
modules_load_get() {
|
||||
local _line i
|
||||
for i in "$dracutsysrootdir$1"/*.conf; do
|
||||
for i in "$1"/*.conf; do
|
||||
[[ -f $i ]] || continue
|
||||
while read -r _line || [ -n "$_line" ]; do
|
||||
while read _line || [ -n "$_line" ]; do
|
||||
case $_line in
|
||||
\#*) ;;
|
||||
|
||||
\;*) ;;
|
||||
|
||||
*)
|
||||
echo "$_line"
|
||||
\#*)
|
||||
;;
|
||||
\;*)
|
||||
;;
|
||||
*)
|
||||
echo $_line
|
||||
esac
|
||||
done < "$i"
|
||||
done
|
||||
}
|
||||
|
||||
mapfile -t _mods < <(modules_load_get /usr/lib/modules-load.d)
|
||||
[[ ${#_mods[@]} -gt 0 ]] && hostonly='' instmods "${_mods[@]}"
|
||||
_mods=$(modules_load_get /usr/lib/modules-load.d)
|
||||
[[ $_mods ]] && hostonly='' instmods $_mods
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
inst_multiple -H -o \
|
||||
|
@ -174,9 +168,7 @@ install() {
|
|||
/etc/systemd/journald.conf.d/*.conf \
|
||||
/etc/systemd/system.conf \
|
||||
/etc/systemd/system.conf.d/*.conf \
|
||||
/etc/hosts \
|
||||
/etc/hostname \
|
||||
/etc/nsswitch.conf \
|
||||
/etc/machine-id \
|
||||
/etc/machine-info \
|
||||
/etc/vconsole.conf \
|
||||
|
@ -184,70 +176,54 @@ install() {
|
|||
/etc/modules-load.d/*.conf \
|
||||
/etc/sysctl.d/*.conf \
|
||||
/etc/sysctl.conf \
|
||||
/etc/udev/udev.conf
|
||||
/etc/udev/udev.conf \
|
||||
${NULL}
|
||||
|
||||
mapfile -t _mods < <(modules_load_get /etc/modules-load.d)
|
||||
[[ ${#_mods[@]} -gt 0 ]] && hostonly='' instmods "${_mods[@]}"
|
||||
_mods=$(modules_load_get /etc/modules-load.d)
|
||||
[[ $_mods ]] && hostonly='' instmods $_mods
|
||||
fi
|
||||
|
||||
if ! [[ -e "$initdir/etc/machine-id" ]]; then
|
||||
: > "$initdir/etc/machine-id"
|
||||
> "$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
|
||||
grep '^systemd-journal:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
grep '^adm:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
grep '^systemd-journal:' /etc/group >> "$initdir/etc/group"
|
||||
grep '^wheel:' /etc/group >> "$initdir/etc/group"
|
||||
grep '^adm:' /etc/group >> "$initdir/etc/group"
|
||||
grep '^utmp:' /etc/group >> "$initdir/etc/group"
|
||||
grep '^root:' /etc/group >> "$initdir/etc/group"
|
||||
|
||||
# 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-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
grep '^systemd-network:' /etc/group >> "$initdir/etc/group"
|
||||
|
||||
{
|
||||
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"
|
||||
|
||||
local _systemdbinary="$systemdutildir"/systemd
|
||||
|
||||
if ldd "$_systemdbinary" | grep -qw libasan; then
|
||||
local _wrapper="$systemdutildir"/systemd-asan-wrapper
|
||||
cat > "$initdir"/"$_wrapper" << EOF
|
||||
#!/bin/sh
|
||||
mount -t proc -o nosuid,nodev,noexec proc /proc
|
||||
exec $_systemdbinary
|
||||
EOF
|
||||
chmod 755 "$initdir"/"$_wrapper"
|
||||
_systemdbinary="$_wrapper"
|
||||
unset _wrapper
|
||||
fi
|
||||
ln_r "$_systemdbinary" "/init"
|
||||
ln_r "$_systemdbinary" "/sbin/init"
|
||||
|
||||
unset _systemdbinary
|
||||
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"
|
||||
ln_r $(type -P true) "/usr/bin/loginctl"
|
||||
ln_r $(type -P true) "/bin/loginctl"
|
||||
inst_rules \
|
||||
70-uaccess.rules \
|
||||
71-seat.rules \
|
||||
73-seat-late.rules \
|
||||
90-vconsole.rules \
|
||||
99-systemd.rules
|
||||
99-systemd.rules \
|
||||
${NULL}
|
||||
|
||||
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
|
||||
systemd-ask-password-plymouth.service \
|
||||
; do
|
||||
mkdir -p "${initdir}${systemdsystemunitdir}/${i}.wants"
|
||||
ln_r "${systemdsystemunitdir}/systemd-vconsole-setup.service" \
|
||||
"${systemdsystemunitdir}/${i}.wants/systemd-vconsole-setup.service"
|
||||
done
|
||||
|
||||
mkdir -p "$initdir/etc/systemd"
|
||||
|
@ -259,11 +235,6 @@ EOF
|
|||
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_*"
|
||||
|
||||
ln_r "${systemdsystemunitdir}/multi-user.target" "${systemdsystemunitdir}/default.target"
|
||||
}
|
||||
|
||||
|
|
|
@ -1,39 +1,29 @@
|
|||
#!/bin/bash
|
||||
# This file is part of dracut.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# Prerequisite check(s) for module.
|
||||
# called by dracut
|
||||
check() {
|
||||
|
||||
# hwclock does not exist on S390(x), bail out silently then
|
||||
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||
local _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
|
||||
[ -e /etc/localtime -a -e /etc/adjtime ] || return 1
|
||||
require_binaries /sbin/hwclock || return 1
|
||||
|
||||
# Return 255 to only include the module, if another module requires it.
|
||||
return 255
|
||||
|
||||
}
|
||||
|
||||
# Module dependency requirements.
|
||||
# called by dracut
|
||||
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.
|
||||
# called by dracut
|
||||
install() {
|
||||
|
||||
inst /usr/share/zoneinfo/UTC
|
||||
inst /etc/localtime
|
||||
inst /etc/adjtime
|
||||
inst_hook pre-trigger 00 "$moddir/warpclock.sh"
|
||||
|
||||
inst_multiple -o \
|
||||
/usr/share/zoneinfo/UTC \
|
||||
/etc/localtime \
|
||||
/etc/adjtime \
|
||||
hwclock
|
||||
|
||||
inst /sbin/hwclock
|
||||
}
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
#!/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
|
||||
if test -e /etc/adjtime ; then
|
||||
while read line ; do
|
||||
if test "$line" = LOCAL ; then
|
||||
hwclock --systz
|
||||
fi
|
||||
done < /etc/adjtime
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
#!/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
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
elif getarg boot= >/dev/null; then
|
||||
. /sbin/fips.sh
|
||||
if mount_boot; then
|
||||
do_fips || die "FIPS integrity test failed"
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
#!/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_load_crypto || die "FIPS integrity test failed"
|
||||
fi
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue