Compare commits
136 Commits
RHEL-8
...
check_conf
Author | SHA1 | Date | |
---|---|---|---|
![]() |
02844ff664 | ||
![]() |
daa49cc221 | ||
![]() |
224175d8bc | ||
![]() |
b4769b332d | ||
![]() |
72ae1c4fe7 | ||
![]() |
8e9b094b21 | ||
![]() |
8a063c50a3 | ||
![]() |
c9b3c89f94 | ||
![]() |
1fcc70fe57 | ||
![]() |
5e7ef0ab3d | ||
![]() |
42d93d3482 | ||
![]() |
22c8a5c73f | ||
![]() |
ce0344d325 | ||
![]() |
920048ff50 | ||
![]() |
31e18286fc | ||
![]() |
4a8ad28808 | ||
![]() |
9dd9329f7a | ||
![]() |
3436067663 | ||
![]() |
f39aa529c5 | ||
![]() |
0a01086456 | ||
![]() |
707d4e79fe | ||
![]() |
7a3d661971 | ||
![]() |
04ff0a1bae | ||
![]() |
4d573e3be0 | ||
![]() |
4e2cc49d75 | ||
![]() |
8084f3f66d | ||
![]() |
cd181d2c4c | ||
![]() |
ead8729b44 | ||
![]() |
b1c5cae63f | ||
![]() |
38b4f4b21c | ||
![]() |
f4e38c0da8 | ||
![]() |
999cfa8458 | ||
![]() |
b91d3f15bf | ||
![]() |
5b2258ea0d | ||
![]() |
44fb598605 | ||
![]() |
6a74c03b4a | ||
![]() |
d1afff43ae | ||
![]() |
23acf15227 | ||
![]() |
b355c7a532 | ||
![]() |
960d8726db | ||
![]() |
ce4d04bf72 | ||
![]() |
b6b1bf9202 | ||
![]() |
b988934a38 | ||
![]() |
b2616b5268 | ||
![]() |
12f023ab03 | ||
![]() |
c30070c8f5 | ||
![]() |
c8b35bf96a | ||
![]() |
305c6f91bb | ||
![]() |
393fb1ac05 | ||
![]() |
9dfd73bcbd | ||
![]() |
2b1b3bcdcb | ||
![]() |
70787ab619 | ||
![]() |
35efada5ec | ||
![]() |
381ab6b7cd | ||
![]() |
4be95b67a7 | ||
![]() |
5e0f8c8a4c | ||
![]() |
e318ba30fb | ||
![]() |
d9721f20d8 | ||
![]() |
3e53195bce | ||
![]() |
11e1f68065 | ||
![]() |
c21c1d459e | ||
![]() |
43c8c4ce04 | ||
![]() |
7b76fa924d | ||
![]() |
7934c6f918 | ||
![]() |
c27ed38bb2 | ||
![]() |
5a962b5939 | ||
![]() |
705eb4eeb2 | ||
![]() |
cbf3200885 | ||
![]() |
adee5b97bc | ||
![]() |
42e004feb9 | ||
![]() |
91c15babdf | ||
![]() |
4996e53ed3 | ||
![]() |
84c862d8f3 | ||
![]() |
3e67623ab5 | ||
![]() |
86f4dd0273 | ||
![]() |
19e5758590 | ||
![]() |
f6bbd024d9 | ||
![]() |
ab703f44b4 | ||
![]() |
a0d9ad6f70 | ||
![]() |
90ac0a2d77 | ||
![]() |
dddcb80945 | ||
![]() |
d10f6f8367 | ||
![]() |
9f561c54c7 | ||
![]() |
4f19427641 | ||
![]() |
8c6ab479ab | ||
![]() |
9cc1b76087 | ||
![]() |
dc86c12c45 | ||
![]() |
9f96bb4c73 | ||
![]() |
62f939b857 | ||
![]() |
8238f41b34 | ||
![]() |
7a2503ab8c | ||
![]() |
8365177644 | ||
![]() |
33cfad0b8f | ||
![]() |
5916d31b24 | ||
![]() |
fc141f2286 | ||
![]() |
0d08f43d71 | ||
![]() |
94eccd15c5 | ||
![]() |
ad906d85ea | ||
![]() |
38ccf7c8e5 | ||
![]() |
53cb081b4c | ||
![]() |
44f2fe5170 | ||
![]() |
58e0d2d5b5 | ||
![]() |
7c6d2ad916 | ||
![]() |
fca93eac19 | ||
![]() |
88820dc781 | ||
![]() |
1ff306a396 | ||
![]() |
32f68c1f9a | ||
![]() |
61afc70454 | ||
![]() |
09d2a1605b | ||
![]() |
7e944c77c0 | ||
![]() |
f9c96cf56f | ||
![]() |
a3ad33daf9 | ||
![]() |
ebe1821635 | ||
![]() |
b8a8d7a64e | ||
![]() |
712f471ebf | ||
![]() |
c38f9e980c | ||
![]() |
f6e3b59e5e | ||
![]() |
fb280834d7 | ||
![]() |
a6bc200c28 | ||
![]() |
79a17b0112 | ||
![]() |
76522d58c3 | ||
![]() |
01ffcf342a | ||
![]() |
05dc158e3c | ||
![]() |
a60af53413 | ||
![]() |
f18d069d46 | ||
![]() |
48c283a296 | ||
![]() |
0eef73ea43 | ||
![]() |
765b20333d | ||
![]() |
b38b7fef36 | ||
![]() |
7117bf6270 | ||
![]() |
e54ab383f7 | ||
![]() |
b9af0fcdfb | ||
![]() |
83cbc06ab9 | ||
![]() |
db4d6bb42c | ||
![]() |
f51ab4a81f | ||
![]() |
6d886bb74d |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,6 +10,7 @@
|
||||
/dracut-install
|
||||
/modules.d/99base/switch_root
|
||||
/test/*/test.log
|
||||
/test/*/.testdir
|
||||
test*.img
|
||||
/.buildpath
|
||||
/.project
|
||||
|
@@ -1,4 +1,5 @@
|
||||
language: generic
|
||||
dist: bionic
|
||||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
|
@@ -25,7 +25,7 @@ case "$COMMAND" in
|
||||
if [[ -f ${INITRD_IMAGE_PREGENERATED} ]]; then
|
||||
# we found an initrd at the same place as the kernel
|
||||
# use this and don't generate a new one
|
||||
cp "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/$INITRD" \
|
||||
cp --reflink=auto "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/$INITRD" \
|
||||
&& chown root:root "$BOOT_DIR_ABS/$INITRD" \
|
||||
&& chmod 0600 "$BOOT_DIR_ABS/$INITRD" \
|
||||
&& exit 0
|
||||
@@ -35,10 +35,14 @@ 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
|
||||
fi
|
||||
else
|
||||
declare -a BOOT_OPTIONS
|
||||
|
||||
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
|
||||
read -r -d '' -a BOOT_OPTIONS < /proc/cmdline
|
||||
read -r -d '' -a line < /proc/cmdline
|
||||
for i in "${line[@]}"; do
|
||||
[[ "${i#initrd=*}" != "$i" ]] && continue
|
||||
BOOT_OPTIONS+=("$i")
|
||||
done
|
||||
fi
|
||||
|
||||
unset noimageifnotneeded
|
||||
|
@@ -57,7 +57,7 @@ if [[ ! -f $INITRDFILE ]]; then
|
||||
fi
|
||||
|
||||
if [[ ! -f $NEW_KERNEL_IMAGE ]]; then
|
||||
cp "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
|
||||
cp --reflink=auto "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
|
||||
((ret+=$?))
|
||||
fi
|
||||
|
||||
|
@@ -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
|
||||
fi
|
||||
else
|
||||
declare -a BOOT_OPTIONS
|
||||
|
||||
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
|
||||
read -r -d '' -a line < /proc/cmdline
|
||||
for i in "${line[@]}"; do
|
||||
[[ "${i#initrd=*}" != "$i" ]] && continue
|
||||
@@ -57,12 +57,6 @@ if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
|
||||
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}
|
||||
@@ -93,7 +87,7 @@ case "$COMMAND" in
|
||||
|
||||
[[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS"
|
||||
|
||||
if ! cp "$KERNEL_IMAGE" "$BOOT_DIR_ABS/$KERNEL"; then
|
||||
if ! cp --reflink=auto "$KERNEL_IMAGE" "$BOOT_DIR_ABS/$KERNEL"; then
|
||||
echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/$KERNEL'!" >&2
|
||||
fi
|
||||
|
||||
|
47
Makefile
47
Makefile
@@ -1,6 +1,7 @@
|
||||
-include dracut-version.sh
|
||||
|
||||
VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags --always 2>/dev/null || echo $(DRACUT_VERSION))
|
||||
DRACUT_MAIN_VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags --always 2>/dev/null || :)
|
||||
DRACUT_MAIN_VERSION ?= $(DRACUT_VERSION)
|
||||
GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags --always 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
|
||||
|
||||
-include Makefile.inc
|
||||
@@ -108,7 +109,7 @@ dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
|
||||
dracut.pc: Makefile.inc Makefile
|
||||
@echo "Name: dracut" > dracut.pc
|
||||
@echo "Description: dracut" >> dracut.pc
|
||||
@echo "Version: $(VERSION)$(GITVERSION)" >> dracut.pc
|
||||
@echo "Version: $(DRACUT_MAIN_VERSION)$(GITVERSION)" >> dracut.pc
|
||||
@echo "dracutdir=$(pkglibdir)" >> dracut.pc
|
||||
@echo "dracutmodulesdir=$(pkglibdir)/modules.d" >> dracut.pc
|
||||
@echo "dracutconfdir=$(pkglibdir)/dracut.conf.d" >> dracut.pc
|
||||
@@ -178,7 +179,7 @@ endif
|
||||
|
||||
dracut-version.sh:
|
||||
@rm -f dracut-version.sh
|
||||
@echo "DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh
|
||||
@echo "DRACUT_VERSION=$(DRACUT_MAIN_VERSION)$(GITVERSION)" > dracut-version.sh
|
||||
|
||||
clean:
|
||||
$(RM) *~
|
||||
@@ -193,33 +194,33 @@ clean:
|
||||
$(RM) $(manpages) dracut.html
|
||||
$(MAKE) -C test clean
|
||||
|
||||
dist: dracut-$(VERSION).tar.xz
|
||||
dist: dracut-$(DRACUT_MAIN_VERSION).tar.xz
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
rpm: dracut-$(VERSION).tar.xz syncheck
|
||||
rpm: dracut-$(DRACUT_MAIN_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; \
|
||||
cp dracut-$(DRACUT_MAIN_VERSION).tar.xz "$$rpmbuild"; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(DRACUT_MAIN_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"/{,$$(arch)/}*.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
|
||||
( mv "$$rpmbuild"/{,$$(uname -m)/}*.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
|
||||
|
||||
srpm: dracut-$(VERSION).tar.xz syncheck
|
||||
srpm: dracut-$(DRACUT_MAIN_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; \
|
||||
cp dracut-$(DRACUT_MAIN_VERSION).tar.xz "$$rpmbuild"; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(DRACUT_MAIN_VERSION) "$$rpmbuild" < 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" \
|
||||
@@ -273,9 +274,9 @@ efi: all
|
||||
AUTHORS:
|
||||
git shortlog --numbered --summary -e |while read a rest || [ -n "$$rest" ]; do echo $$rest;done > AUTHORS
|
||||
|
||||
dracut.html.sign: dracut-$(VERSION).tar.xz dracut.html
|
||||
gpg-sign-all dracut-$(VERSION).tar.xz dracut.html
|
||||
dracut.html.sign: dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut.html
|
||||
gpg-sign-all dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut.html
|
||||
|
||||
upload: dracut.html.sign
|
||||
kup put dracut-$(VERSION).tar.xz dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/
|
||||
kup put dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut-$(DRACUT_MAIN_VERSION).tar.sign /pub/linux/utils/boot/dracut/
|
||||
kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/
|
||||
|
86
README
86
README
@@ -1,86 +0,0 @@
|
||||
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
|
108
README.md
108
README.md
@@ -1,31 +1,89 @@
|
||||
# dracut - master branch
|
||||
dracut
|
||||
====
|
||||
|
||||
dracut is an initramfs infrastructure.
|
||||
|
||||
## Travis
|
||||
dracut is an event driven initramfs infrastructure.
|
||||
|
||||
[](https://travis-ci.org/dracutdevs/dracut)
|
||||
|
||||
## CentOS CI
|
||||
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://ci.centos.org/job/dracut-push-master/)
|
||||
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.
|
||||
|
||||
- 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 60: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=60,label=dracut-ci-slave01/)
|
||||
- Test 70: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=70,label=dracut-ci-slave01/)
|
||||
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
|
||||
|
@@ -174,9 +174,6 @@ convert_abs_rel() {
|
||||
# $ get_fs_env /dev/sda2
|
||||
# ext4
|
||||
get_fs_env() {
|
||||
local evalstr
|
||||
local found
|
||||
|
||||
[[ $1 ]] || return
|
||||
unset ID_FS_TYPE
|
||||
ID_FS_TYPE=$(blkid -u filesystem -o export -- "$1" \
|
||||
@@ -199,7 +196,7 @@ get_fs_env() {
|
||||
# $ get_maj_min /dev/sda2
|
||||
# 8:2
|
||||
get_maj_min() {
|
||||
local _maj _min _majmin
|
||||
local _majmin
|
||||
_majmin="$(stat -L -c '%t:%T' "$1" 2>/dev/null)"
|
||||
printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"
|
||||
}
|
||||
@@ -676,17 +673,6 @@ get_ucode_file ()
|
||||
fi
|
||||
}
|
||||
|
||||
# Get currently loaded modules
|
||||
# sorted, and delimited by newline
|
||||
get_loaded_kernel_modules ()
|
||||
{
|
||||
local modules=( )
|
||||
while read _module _size _used _used_by; do
|
||||
modules+=( "$_module" )
|
||||
done <<< "$(lsmod | sed -n '1!p')"
|
||||
printf '%s\n' "${modules[@]}" | sort
|
||||
}
|
||||
|
||||
# Not every device in /dev/mapper should be examined.
|
||||
# If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
|
||||
lvm_internal_dev() {
|
||||
|
170
dracut-init.sh
170
dracut-init.sh
@@ -541,6 +541,14 @@ inst_libdir_file() {
|
||||
[[ $_files ]] && inst_multiple $_files
|
||||
}
|
||||
|
||||
# get a command to decompress the given file
|
||||
get_decompress_cmd() {
|
||||
case "$1" in
|
||||
*.gz) echo 'gzip -f -d' ;;
|
||||
*.bz2) echo 'bzip2 -d' ;;
|
||||
*.xz) echo 'xz -f -d' ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# install function decompressing the target and handling symlinks
|
||||
# $@ = list of compressed (gz or bz2) files or symlinks pointing to such files
|
||||
@@ -552,11 +560,8 @@ inst_decompress() {
|
||||
|
||||
for _src in $@
|
||||
do
|
||||
case ${_src} in
|
||||
*.gz) _cmd='gzip -f -d' ;;
|
||||
*.bz2) _cmd='bzip2 -d' ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
_cmd=$(get_decompress_cmd ${_src})
|
||||
[[ -z "${_cmd}" ]] && return 1
|
||||
inst_simple ${_src}
|
||||
# Decompress with chosen tool. We assume that tool changes name e.g.
|
||||
# from 'name.gz' to 'name'.
|
||||
@@ -575,15 +580,16 @@ inst_opt_decompress() {
|
||||
done
|
||||
}
|
||||
|
||||
# module_check <dracut module>
|
||||
# module_check <dracut module> [<forced>] [<module path>]
|
||||
# execute the check() function of module-setup.sh of <dracut module>
|
||||
# or the "check" script, if module-setup.sh is not found
|
||||
# "check $hostonly" is called
|
||||
module_check() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _moddir=$3
|
||||
local _ret
|
||||
local _forced=0
|
||||
local _hostonly=$hostonly
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[ $# -eq 2 ] && _forced=$2
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
@@ -606,14 +612,15 @@ module_check() {
|
||||
return $_ret
|
||||
}
|
||||
|
||||
# module_check_mount <dracut module>
|
||||
# module_check_mount <dracut module> [<module path>]
|
||||
# execute the check() function of module-setup.sh of <dracut module>
|
||||
# or the "check" script, if module-setup.sh is not found
|
||||
# "mount_needs=1 check 0" is called
|
||||
module_check_mount() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _moddir=$2
|
||||
local _ret
|
||||
mount_needs=1
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# if we do not have a check script, we are unconditionally included
|
||||
@@ -632,12 +639,13 @@ module_check_mount() {
|
||||
return $_ret
|
||||
}
|
||||
|
||||
# module_depends <dracut module>
|
||||
# module_depends <dracut module> [<module path>]
|
||||
# execute the depends() function of module-setup.sh of <dracut module>
|
||||
# or the "depends" script, if module-setup.sh is not found
|
||||
module_depends() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _moddir=$2
|
||||
local _ret
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# if we do not have a check script, we have no deps
|
||||
@@ -655,12 +663,13 @@ module_depends() {
|
||||
fi
|
||||
}
|
||||
|
||||
# module_cmdline <dracut module>
|
||||
# module_cmdline <dracut module> [<module path>]
|
||||
# execute the cmdline() function of module-setup.sh of <dracut module>
|
||||
# or the "cmdline" script, if module-setup.sh is not found
|
||||
module_cmdline() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _moddir=$2
|
||||
local _ret
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
[[ -x $_moddir/cmdline ]] && . "$_moddir/cmdline"
|
||||
@@ -676,12 +685,13 @@ module_cmdline() {
|
||||
fi
|
||||
}
|
||||
|
||||
# module_install <dracut module>
|
||||
# module_install <dracut module> [<module path>]
|
||||
# execute the install() function of module-setup.sh of <dracut module>
|
||||
# or the "install" script, if module-setup.sh is not found
|
||||
module_install() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _moddir=$2
|
||||
local _ret
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
[[ -x $_moddir/install ]] && . "$_moddir/install"
|
||||
@@ -697,12 +707,13 @@ module_install() {
|
||||
fi
|
||||
}
|
||||
|
||||
# module_installkernel <dracut module>
|
||||
# module_installkernel <dracut module> [<module path>]
|
||||
# execute the installkernel() function of module-setup.sh of <dracut module>
|
||||
# or the "installkernel" script, if module-setup.sh is not found
|
||||
module_installkernel() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _moddir=$2
|
||||
local _ret
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
[[ -x $_moddir/installkernel ]] && . "$_moddir/installkernel"
|
||||
@@ -718,15 +729,16 @@ module_installkernel() {
|
||||
fi
|
||||
}
|
||||
|
||||
# check_mount <dracut module>
|
||||
# check_mount <dracut module> [<use_as_dep>] [<module path>]
|
||||
# check_mount checks, if a dracut module is needed for the given
|
||||
# device and filesystem types in "${host_fs_types[@]}"
|
||||
check_mount() {
|
||||
local _mod=$1
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _moddir=$3
|
||||
local _ret
|
||||
local _moddep
|
||||
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[ "${#host_fs_types[@]}" -le 0 ] && return 1
|
||||
|
||||
# If we are already scheduled to be loaded, no need to check again.
|
||||
@@ -743,7 +755,7 @@ check_mount() {
|
||||
fi
|
||||
|
||||
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
|
||||
module_check_mount $_mod; ret=$?
|
||||
module_check_mount $_mod $_moddir; ret=$?
|
||||
|
||||
# explicit module, so also accept ret=255
|
||||
[[ $ret = 0 || $ret = 255 ]] || return 1
|
||||
@@ -751,14 +763,14 @@ check_mount() {
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check_mount $_mod || return 1
|
||||
module_check_mount $_mod $_moddir || return 1
|
||||
else
|
||||
# skip this module
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
for _moddep in $(module_depends $_mod); do
|
||||
for _moddep in $(module_depends $_mod $_moddir); do
|
||||
# handle deps as if they were manually added
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \
|
||||
@@ -782,15 +794,17 @@ check_mount() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# check_module <dracut module> [<use_as_dep>]
|
||||
# check_module <dracut module> [<use_as_dep>] [<module path>]
|
||||
# check if a dracut module is to be used in the initramfs process
|
||||
# if <use_as_dep> is set, then the process also keeps track
|
||||
# that the modules were checked for the dependency tracking process
|
||||
check_module() {
|
||||
local _mod=$1
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _moddir=$3
|
||||
local _ret
|
||||
local _moddep
|
||||
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
# If we are already scheduled to be loaded, no need to check again.
|
||||
[[ " $mods_to_load " == *\ $_mod\ * ]] && return 0
|
||||
[[ " $mods_checked_as_dep " == *\ $_mod\ * ]] && return 1
|
||||
@@ -807,9 +821,9 @@ check_module() {
|
||||
|
||||
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
|
||||
if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then
|
||||
module_check $_mod 1; ret=$?
|
||||
module_check $_mod 1 $_moddir; ret=$?
|
||||
else
|
||||
module_check $_mod 0; ret=$?
|
||||
module_check $_mod 0 $_moddir; ret=$?
|
||||
fi
|
||||
# explicit module, so also accept ret=255
|
||||
[[ $ret = 0 || $ret = 255 ]] || return 1
|
||||
@@ -817,7 +831,7 @@ check_module() {
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check $_mod; ret=$?
|
||||
module_check $_mod 0 $_moddir; ret=$?
|
||||
if [[ $ret != 0 ]]; then
|
||||
[[ $2 ]] && return 1
|
||||
[[ $ret != 255 ]] && return 1
|
||||
@@ -828,7 +842,7 @@ check_module() {
|
||||
fi
|
||||
fi
|
||||
|
||||
for _moddep in $(module_depends $_mod); do
|
||||
for _moddep in $(module_depends $_mod $_moddir); do
|
||||
# handle deps as if they were manually added
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \
|
||||
@@ -853,7 +867,7 @@ check_module() {
|
||||
}
|
||||
|
||||
# for_each_module_dir <func>
|
||||
# execute "<func> <dracut module> 1"
|
||||
# execute "<func> <dracut module> 1 <module path>"
|
||||
for_each_module_dir() {
|
||||
local _modcheck
|
||||
local _mod
|
||||
@@ -865,7 +879,7 @@ for_each_module_dir() {
|
||||
[[ -e $_moddir/install || -e $_moddir/installkernel || \
|
||||
-e $_moddir/module-setup.sh ]] || continue
|
||||
_mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]}
|
||||
$_func $_mod 1
|
||||
$_func $_mod 1 $_moddir
|
||||
done
|
||||
|
||||
# Report any missing dracut modules, the user has specified
|
||||
@@ -886,80 +900,6 @@ for_each_module_dir() {
|
||||
done
|
||||
}
|
||||
|
||||
# Install a single kernel module along with any firmware it may require.
|
||||
# $1 = full path to kernel module to install
|
||||
install_kmod_with_fw() {
|
||||
# no need to go further if the module is already installed
|
||||
|
||||
[[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \
|
||||
&& return 0
|
||||
|
||||
if [[ $omit_drivers ]]; then
|
||||
local _kmod=${1##*/}
|
||||
_kmod=${_kmod%.ko*}
|
||||
_kmod=${_kmod/-/_}
|
||||
if [[ "$_kmod" =~ $omit_drivers ]]; then
|
||||
dinfo "Omitting driver $_kmod"
|
||||
return 0
|
||||
fi
|
||||
if [[ "${1##*/lib/modules/$kernel/}" =~ $omit_drivers ]]; then
|
||||
dinfo "Omitting driver $_kmod"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $silent_omit_drivers ]]; then
|
||||
local _kmod=${1##*/}
|
||||
_kmod=${_kmod%.ko*}
|
||||
_kmod=${_kmod/-/_}
|
||||
[[ "$_kmod" =~ $silent_omit_drivers ]] && return 0
|
||||
[[ "${1##*/lib/modules/$kernel/}" =~ $silent_omit_drivers ]] && return 0
|
||||
fi
|
||||
|
||||
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}"
|
||||
ret=$?
|
||||
(($ret != 0)) && return $ret
|
||||
|
||||
local _modname=${1##*/} _fwdir _found _fw
|
||||
_modname=${_modname%.ko*}
|
||||
for _fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
|
||||
_found=''
|
||||
for _fwdir in $fw_dir; do
|
||||
[[ -d $_fwdir && -f $_fwdir/$_fw ]] || continue
|
||||
inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw"
|
||||
_found=yes
|
||||
done
|
||||
if [[ $_found != yes ]]; then
|
||||
if ! [[ -d $(echo /sys/module/${_modname//-/_}|{ read a b; echo $a; }) ]]; then
|
||||
dinfo "Possible missing firmware \"${_fw}\" for kernel module" \
|
||||
"\"${_modname}.ko\""
|
||||
else
|
||||
dwarn "Possible missing firmware \"${_fw}\" for kernel module" \
|
||||
"\"${_modname}.ko\""
|
||||
fi
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# Do something with all the dependencies of a kernel module.
|
||||
# Note that kernel modules depend on themselves using the technique we use
|
||||
# $1 = function to call for each dependency we find
|
||||
# It will be passed the full path to the found kernel module
|
||||
# $2 = module to get dependencies for
|
||||
# rest of args = arguments to modprobe
|
||||
# _fderr specifies FD passed from surrounding scope
|
||||
for_each_kmod_dep() {
|
||||
local _func=$1 _kmod=$2 _cmd _modpath _options
|
||||
shift 2
|
||||
modprobe "$@" --ignore-install --show-depends $_kmod 2>&${_fderr} | (
|
||||
while read _cmd _modpath _options || [ -n "$_cmd" ]; do
|
||||
[[ $_cmd = insmod ]] || continue
|
||||
$_func ${_modpath} || exit $?
|
||||
done
|
||||
)
|
||||
}
|
||||
|
||||
dracut_kernel_post() {
|
||||
for _f in modules.builtin.bin modules.builtin modules.order; do
|
||||
[[ -e $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
|
||||
@@ -1045,3 +985,25 @@ else
|
||||
ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}"
|
||||
}
|
||||
fi
|
||||
|
||||
is_qemu_virtualized() {
|
||||
# 0 if a virt environment was detected
|
||||
# 1 if a virt environment could not be detected
|
||||
# 255 if any error was encountered
|
||||
if type -P systemd-detect-virt >/dev/null 2>&1; then
|
||||
vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
|
||||
(($? != 0)) && return 255
|
||||
[[ $vm = "qemu" ]] && return 0
|
||||
[[ $vm = "kvm" ]] && return 0
|
||||
[[ $vm = "bochs" ]] && return 0
|
||||
fi
|
||||
|
||||
for i in /sys/class/dmi/id/*_vendor; do
|
||||
[[ -f $i ]] || continue
|
||||
read vendor < $i
|
||||
[[ "$vendor" == "QEMU" ]] && return 0
|
||||
[[ "$vendor" == "Red Hat" ]] && return 0
|
||||
[[ "$vendor" == "Bochs" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
@@ -40,4 +40,18 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -d squash ]]; then
|
||||
unsquashfs -no-xattrs -f -d . squash/root.img >/dev/null
|
||||
if [ $? -ne 0 ]; 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
|
||||
|
@@ -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 initrams image which contains only whatever is
|
||||
dracut can generate a customized initramfs image which contains only whatever is
|
||||
necessary to boot some particular computer, such as ATA, SCSI and filesystem
|
||||
kernel modules (host-only mode).
|
||||
|
||||
@@ -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 umount every /oldroot mount and calls the various
|
||||
* shutdown will try to unmount every /oldroot mount and calls the various
|
||||
shutdown hooks from the dracut modules
|
||||
|
||||
This ensures, that all devices are disassembled and unmounted cleanly.
|
||||
|
@@ -242,7 +242,7 @@ rd.vconsole.keymap=de-latin1-nodeadkeys
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
rd.vconsole.font=LatArCyrHeb-16
|
||||
rd.vconsole.font=eurlatgr
|
||||
--
|
||||
|
||||
**rd.vconsole.font.map=**__<console map base file name>__::
|
||||
@@ -346,7 +346,7 @@ As you see, you can skip colons in such a case.
|
||||
[NOTE]
|
||||
===============================
|
||||
dracut pipes key to cryptsetup with _-d -_ argument, therefore you need to pipe
|
||||
to crypsetup luksFormat with _-d -_, too!
|
||||
to cryptsetup luksFormat with _-d -_, too!
|
||||
|
||||
Here follows example for key encrypted with GPG:
|
||||
|
||||
@@ -528,7 +528,7 @@ same <interface>.
|
||||
number, encoding the network prefix length.
|
||||
|
||||
**ifname=**__<interface>__:__<MAC>__::
|
||||
Assign network device name <interface> (ie "bootnet") to the NIC with
|
||||
Assign network device name <interface> (i.e. "bootnet") to the NIC with
|
||||
MAC <MAC>.
|
||||
+
|
||||
WARNING: Do **not** use the default kernel naming scheme for the interface name,
|
||||
@@ -765,6 +765,9 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30
|
||||
|
||||
FCoE
|
||||
~~~~
|
||||
**rd.nofcoe=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
|
||||
|
@@ -157,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 alogrithms yet)
|
||||
to access very early (and cannot make use of uncompress algorithms yet)
|
||||
like microcode or ACPI tables (default=no).
|
||||
|
||||
*acpi_table_dir=*"__<dir>__"::
|
||||
@@ -187,7 +187,7 @@ provide a valid _/etc/fstab_.
|
||||
|
||||
*i18n_default_font=*"__<fontname>__"::
|
||||
The font <fontname> to install, if not specified otherwise.
|
||||
Default is "LatArCyrHeb-16".
|
||||
Default is "eurlatgr".
|
||||
|
||||
*i18n_install_all=*"__{yes|no}__"::
|
||||
Install everything regardless of generic or hostonly mode.
|
||||
@@ -204,6 +204,10 @@ provide a valid _/etc/fstab_.
|
||||
_/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
|
||||
or _/usr/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
|
||||
|
||||
*uefi_secureboot_cert=*"_<FILE>_", *uefi_secureboot_key=*"_<FILE>_"::
|
||||
Specifies a certificate and corresponding key, which are used to sign the created UEFI executable.
|
||||
Requires both certificate and key need to be specified and _sbsign_ to be installed.
|
||||
|
||||
*kernel_image=*"_<FILE>_"::
|
||||
Specifies the kernel image, which to include in the UEFI executable. The default is
|
||||
_/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
|
||||
|
@@ -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,6 +1,6 @@
|
||||
# SUSE specifc dracut settings
|
||||
# SUSE specific dracut settings
|
||||
#
|
||||
# SUSE by default always builds a as small as possible initrd for performance
|
||||
# SUSE by default always builds as small as possible initrd for performance
|
||||
# and resource reasons.
|
||||
# If you like to build a generic initrd which works on other platforms than
|
||||
# on the one dracut/mkinitrd got called comment out below setting(s).
|
||||
@@ -10,7 +10,7 @@ hostonly_cmdline="yes"
|
||||
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.
|
||||
|
@@ -103,7 +103,7 @@ half of the rd.retry counter.
|
||||
|
||||
This hook (initqueue/finished) is called after udev has settled and
|
||||
if all scripts herein return 0 the main loop will be ended.
|
||||
Abritary scripts can be added here, to loop in the
|
||||
Arbitrary scripts can be added here, to loop in the
|
||||
initqueue until something happens, which a dracut module wants to wait for.
|
||||
|
||||
=== Hook: pre-mount
|
||||
@@ -266,7 +266,7 @@ installs an executable/script <src> in the dracut hook <hookdir> with priority
|
||||
|
||||
==== inst_rules <udevrule> [ <udevrule> ...]
|
||||
|
||||
installs one ore more udev rules. Non-existant udev rules are reported, but do
|
||||
installs one or more udev rules. Non-existant udev rules are reported, but do
|
||||
not let dracut fail.
|
||||
|
||||
==== instmods <kernelmodule> [ <kernelmodule> ... ]
|
||||
|
132
dracut.sh
132
dracut.sh
@@ -272,6 +272,14 @@ read_arg() {
|
||||
fi
|
||||
}
|
||||
|
||||
check_conf_file()
|
||||
{
|
||||
if grep -H -e '^[^#]*[+]=\("[^ ]\|.*[^ ]"\)' "$@"; then
|
||||
printf '\ndracut: WARNING: <key>+=" <values> ": <values> should have surrounding white spaces!\n' >&2
|
||||
printf 'dracut: WARNING: This will lead to unwanted side effects! Please fix the configuration file.\n\n' >&2
|
||||
fi
|
||||
}
|
||||
|
||||
dropindirs_sort()
|
||||
{
|
||||
local suffix=$1; shift
|
||||
@@ -689,10 +697,14 @@ if [[ ! -d $confdir ]]; then
|
||||
fi
|
||||
|
||||
# source our config file
|
||||
[[ -f $conffile ]] && . "$conffile"
|
||||
if [[ -f $conffile ]]; then
|
||||
check_conf_file "$conffile"
|
||||
. "$conffile"
|
||||
fi
|
||||
|
||||
# source our config dir
|
||||
for f in $(dropindirs_sort ".conf" "$confdir" "$dracutbasedir/dracut.conf.d"); do
|
||||
check_conf_file "$f"
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
|
||||
@@ -772,12 +784,22 @@ if ! [[ $outfile ]]; then
|
||||
fi
|
||||
|
||||
if [[ $uefi == "yes" ]]; then
|
||||
if [[ -n "$uefi_secureboot_key" && -z "$uefi_secureboot_cert" ]] || [[ -z $uefi_secureboot_key && -n $uefi_secureboot_cert ]]; then
|
||||
dfatal "Need 'uefi_secureboot_key' and 'uefi_secureboot_cert' both to be set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "$uefi_secureboot_key" && -n "$uefi_secureboot_cert" ]] && !command -v sbsign &>/dev/null; then
|
||||
dfatal "Need 'sbsign' to create a signed UEFI executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BUILD_ID=$(cat /etc/os-release /usr/lib/os-release \
|
||||
| while read -r line || [[ $line ]]; do \
|
||||
[[ $line =~ BUILD_ID\=* ]] && eval "$line" && echo "$BUILD_ID" && break; \
|
||||
done)
|
||||
if [[ -d /efi ]] && mountpoint -q /efi; then
|
||||
efidir=/efi
|
||||
efidir=/efi/EFI
|
||||
else
|
||||
efidir=/boot/EFI
|
||||
if [[ -d /boot/efi/EFI ]] && mountpoint -q /boot/efi; then
|
||||
@@ -999,6 +1021,16 @@ esac
|
||||
|
||||
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
|
||||
|
||||
|
||||
[[ -d $systemdutildir ]] \
|
||||
|| systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
|
||||
|
||||
if ! [[ -d "$systemdutildir" ]]; then
|
||||
[[ -e /lib/systemd/systemd-udevd ]] && systemdutildir=/lib/systemd
|
||||
[[ -e /usr/lib/systemd/systemd-udevd ]] && systemdutildir=/usr/lib/systemd
|
||||
fi
|
||||
|
||||
|
||||
if [[ $no_kernel != yes ]] && [[ -d $srcmods ]]; then
|
||||
if ! [[ -f $srcmods/modules.dep ]]; then
|
||||
if [[ -n "$(find "$srcmods" -name '*.ko*')" ]]; then
|
||||
@@ -1060,13 +1092,13 @@ if [[ ! $print_cmdline ]]; then
|
||||
exit 1
|
||||
fi
|
||||
unset EFI_MACHINE_TYPE_NAME
|
||||
case $(arch) in
|
||||
case $(uname -m) in
|
||||
x86_64)
|
||||
EFI_MACHINE_TYPE_NAME=x64;;
|
||||
ia32)
|
||||
EFI_MACHINE_TYPE_NAME=ia32;;
|
||||
*)
|
||||
dfatal "Architecture '$(arch)' not supported to create a UEFI executable"
|
||||
dfatal "Architecture '$(uname -m)' not supported to create a UEFI executable"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -1311,16 +1343,8 @@ done
|
||||
[[ -d $udevdir ]] \
|
||||
|| udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
|
||||
if ! [[ -d "$udevdir" ]]; then
|
||||
[[ -e /lib/udev/collect ]] && udevdir=/lib/udev
|
||||
[[ -e /usr/lib/udev/collect ]] && udevdir=/usr/lib/udev
|
||||
fi
|
||||
|
||||
[[ -d $systemdutildir ]] \
|
||||
|| systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
|
||||
|
||||
if ! [[ -d "$systemdutildir" ]]; then
|
||||
[[ -e /lib/systemd/systemd-udevd ]] && systemdutildir=/lib/systemd
|
||||
[[ -e /usr/lib/systemd/systemd-udevd ]] && systemdutildir=/usr/lib/systemd
|
||||
[[ -e /lib/udev/ata_id ]] && udevdir=/lib/udev
|
||||
[[ -e /usr/lib/udev/ata_id ]] && udevdir=/usr/lib/udev
|
||||
fi
|
||||
|
||||
[[ -d $systemdsystemunitdir ]] \
|
||||
@@ -1490,7 +1514,7 @@ dinfo "*** Including modules done ***"
|
||||
## final stuff that has to happen
|
||||
if [[ $no_kernel != yes ]]; then
|
||||
if [[ $hostonly ]]; then
|
||||
echo "$(get_loaded_kernel_modules)" > $initdir/lib/dracut/loaded-kernel-modules.txt
|
||||
cp "$DRACUT_KERNEL_MODALIASES" $initdir/lib/dracut/hostonly-kernel-modules.txt
|
||||
fi
|
||||
|
||||
if [[ $drivers ]]; then
|
||||
@@ -1572,7 +1596,7 @@ if [[ $kernel_only != yes ]]; then
|
||||
dinfo "*** Resolving executable dependencies ***"
|
||||
find "$initdir" -type f -perm /0111 -not -path '*.ko' -print0 \
|
||||
| xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R ${DRACUT_FIPS_MODE:+-f} --
|
||||
dinfo "*** Resolving executable dependencies done***"
|
||||
dinfo "*** Resolving executable dependencies done ***"
|
||||
fi
|
||||
|
||||
# Now we are done with lazy resolving, always install dependencies
|
||||
@@ -1595,7 +1619,7 @@ for ((i=0; i < ${#include_src[@]}; i++)); do
|
||||
if [[ $src && $target ]]; then
|
||||
if [[ -f $src ]]; then
|
||||
inst $src $target
|
||||
else
|
||||
elif [[ -d $src ]]; then
|
||||
ddebug "Including directory: $src"
|
||||
destdir="${initdir}/${target}"
|
||||
mkdir -p "$destdir"
|
||||
@@ -1616,6 +1640,10 @@ for ((i=0; i < ${#include_src[@]}; i++)); do
|
||||
$DRACUT_CP -t "$destdir" "$objectname"
|
||||
fi
|
||||
done
|
||||
elif [[ -e $src ]]; then
|
||||
derror "$src is neither a directory nor a regular file"
|
||||
else
|
||||
derror "$src doesn't exist"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -1659,21 +1687,6 @@ for d in $(ldconfig_paths); do
|
||||
rmdir -p --ignore-fail-on-non-empty "$initdir/$d" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Stripping files ***"
|
||||
find "$initdir" -type f \
|
||||
-executable -not -path '*/lib/modules/*.ko' -print0 \
|
||||
| xargs -r -0 $strip_cmd -g 2>/dev/null
|
||||
|
||||
# strip kernel modules, but do not touch signed modules
|
||||
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
|
||||
| while read -r -d $'\0' f || [ -n "$f" ]; do
|
||||
SIG=$(tail -c 28 "$f" | tr -d '\000')
|
||||
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
|
||||
done | xargs -r -0 $strip_cmd -g
|
||||
|
||||
dinfo "*** Stripping files done ***"
|
||||
fi
|
||||
if [[ $early_microcode = yes ]]; then
|
||||
dinfo "*** Generating early-microcode cpio image ***"
|
||||
ucode_dir=(amd-ucode intel-ucode)
|
||||
@@ -1690,7 +1703,7 @@ if [[ $early_microcode = yes ]]; then
|
||||
for _fwdir in $fw_dir; do
|
||||
if [[ -d $_fwdir && -d $_fwdir/$_fw ]]; then
|
||||
_src="*"
|
||||
dinfo "*** Constructing ${ucode_dest[$idx]} ****"
|
||||
dinfo "*** Constructing ${ucode_dest[$idx]} ***"
|
||||
if [[ $hostonly ]]; then
|
||||
_src=$(get_ucode_file)
|
||||
[[ $_src ]] || break
|
||||
@@ -1745,9 +1758,8 @@ if [[ $hostonly_cmdline == "yes" ]] ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
dinfo "*** Creating image file '$outfile' ***"
|
||||
|
||||
if dracut_module_included "squash"; then
|
||||
dinfo "*** Install squash loader ***"
|
||||
if ! check_kernel_config CONFIG_SQUASHFS; then
|
||||
dfatal "CONFIG_SQUASHFS have to be enabled for dracut squash module to work"
|
||||
exit 1
|
||||
@@ -1761,7 +1773,7 @@ if dracut_module_included "squash"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
readonly squash_dir="${DRACUT_TMPDIR}/squashfs"
|
||||
readonly squash_dir="$initdir/squash/root"
|
||||
readonly squash_img=$initdir/squash/root.img
|
||||
|
||||
# Currently only move "usr" "etc" to squashdir
|
||||
@@ -1774,7 +1786,7 @@ if dracut_module_included "squash"; then
|
||||
|
||||
# Move some files out side of the squash image, including:
|
||||
# - Files required to boot and mount the squashfs image
|
||||
# - Files need to be accessable without mounting the squash image
|
||||
# - Files need to be accessible without mounting the squash image
|
||||
required_in_root() {
|
||||
local file=$1
|
||||
local _sqsh_file=$squash_dir/$file
|
||||
@@ -1829,9 +1841,7 @@ if dracut_module_included "squash"; then
|
||||
done
|
||||
|
||||
mv $initdir/init $initdir/init.stock
|
||||
mv $initdir/shutdown $initdir/shutdown.stock
|
||||
ln -s squash/init.sh $initdir/init
|
||||
ln -s squash/shutdown.sh $initdir/shutdown
|
||||
|
||||
# Reinstall required files for the squash image setup script.
|
||||
# We have moved them inside the squashed image, but they need to be
|
||||
@@ -1854,15 +1864,38 @@ if dracut_module_included "squash"; then
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Stripping files ***"
|
||||
find "$initdir" -type f \
|
||||
-executable -not -path '*/lib/modules/*.ko' -print0 \
|
||||
| xargs -r -0 $strip_cmd -g -p 2>/dev/null
|
||||
|
||||
# strip kernel modules, but do not touch signed modules
|
||||
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
|
||||
| while read -r -d $'\0' f || [ -n "$f" ]; do
|
||||
SIG=$(tail -c 28 "$f" | tr -d '\000')
|
||||
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
|
||||
done | xargs -r -0 $strip_cmd -g -p
|
||||
dinfo "*** Stripping files done ***"
|
||||
fi
|
||||
|
||||
if dracut_module_included "squash"; then
|
||||
dinfo "*** Squashing the files inside the initramfs ***"
|
||||
mksquashfs $squash_dir $squash_img -comp xz -b 64K -Xdict-size 100% &> /dev/null
|
||||
|
||||
if [[ $? != 0 ]]; then
|
||||
dfatal "dracut: Failed making squash image"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf $squash_dir
|
||||
dinfo "*** Squashing the files inside the initramfs done ***"
|
||||
fi
|
||||
|
||||
dinfo "*** Creating image file '$outfile' ***"
|
||||
|
||||
if [[ $uefi = yes ]]; then
|
||||
readonly uefi_outdir="$DRACUT_TMPDIR/uefi"
|
||||
mkdir "$uefi_outdir"
|
||||
@@ -1934,7 +1967,7 @@ if [[ $uefi = yes ]]; then
|
||||
echo -ne "\x00" >> "$uefi_outdir/cmdline.txt"
|
||||
|
||||
dinfo "Using UEFI kernel cmdline:"
|
||||
dinfo $(< "$uefi_outdir/cmdline.txt")
|
||||
dinfo $(tr -d '\000' < "$uefi_outdir/cmdline.txt")
|
||||
|
||||
[[ -s /usr/lib/os-release ]] && uefi_osrelease="/usr/lib/os-release"
|
||||
[[ -s /etc/os-release ]] && uefi_osrelease="/etc/os-release"
|
||||
@@ -1944,9 +1977,22 @@ if [[ $uefi = yes ]]; then
|
||||
--add-section .cmdline="${uefi_outdir}/cmdline.txt" --change-section-vma .cmdline=0x30000 \
|
||||
--add-section .linux="$kernel_image" --change-section-vma .linux=0x40000 \
|
||||
--add-section .initrd="${DRACUT_TMPDIR}/initramfs.img" --change-section-vma .initrd=0x3000000 \
|
||||
"$uefi_stub" "${uefi_outdir}/linux.efi" \
|
||||
&& cp --reflink=auto "${uefi_outdir}/linux.efi" "$outfile"; then
|
||||
dinfo "*** Creating UEFI image file '$outfile' done ***"
|
||||
"$uefi_stub" "${uefi_outdir}/linux.efi"; then
|
||||
if [[ -n "${uefi_secureboot_key}" && -n "${uefi_secureboot_cert}" ]]; then \
|
||||
if sbsign \
|
||||
--key "${uefi_secureboot_key}" \
|
||||
--cert "${uefi_secureboot_cert}" \
|
||||
--output "$outfile" "${uefi_outdir}/linux.efi"; then
|
||||
dinfo "*** Creating signed UEFI image file '$outfile' done ***"
|
||||
else
|
||||
dfatal "*** Creating signed UEFI image file '$outfile' failed ***"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if cp --reflink=auto "${uefi_outdir}/linux.efi" "$outfile"; then
|
||||
dinfo "*** Creating UEFI image file '$outfile' done ***"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
rm -f -- "$outfile"
|
||||
dfatal "*** Creating UEFI image file '$outfile' failed ***"
|
||||
|
26
dracut.spec
26
dracut.spec
@@ -32,7 +32,7 @@ Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
|
||||
|
||||
BuildRequires: bash
|
||||
BuildRequires: git
|
||||
BuildRequires: kmod-devel >= 23
|
||||
BuildRequires: pkgconfig(libkmod) >= 23
|
||||
BuildRequires: gcc
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
@@ -65,13 +65,6 @@ Provides: dracut-fips = %{version}-%{release}
|
||||
Obsoletes: dracut-fips-aesni <= 047
|
||||
Provides: dracut-fips-aesni = %{version}-%{release}
|
||||
|
||||
Obsoletes: dracut-kernel < 005
|
||||
Provides: dracut-kernel = %{version}-%{release}
|
||||
|
||||
Obsoletes: dracut < 030
|
||||
Obsoletes: dracut-norescue < 030
|
||||
Provides: dracut-norescue = %{version}-%{release}
|
||||
|
||||
Requires: bash >= 4
|
||||
Requires: coreutils
|
||||
Requires: cpio
|
||||
@@ -264,21 +257,24 @@ 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}/man8/mkinitrd.8*
|
||||
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
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
# 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
|
||||
@@ -286,7 +282,7 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
|
||||
|
||||
%files
|
||||
%if %{with doc}
|
||||
%doc README HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
|
||||
%doc README.md HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
|
||||
%endif
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%license COPYING lgpl-2.1.txt
|
||||
@@ -323,6 +319,9 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
|
||||
%{_mandir}/man8/mkinitrd.8*
|
||||
%{_mandir}/man1/lsinitrd.1*
|
||||
%endif
|
||||
%if 0%{?suse_version}
|
||||
%{_mandir}/man8/mkinitrd-suse.8*
|
||||
%endif
|
||||
%{_mandir}/man7/dracut.kernel.7*
|
||||
%{_mandir}/man7/dracut.cmdline.7*
|
||||
%{_mandir}/man7/dracut.modules.7*
|
||||
@@ -420,11 +419,8 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
|
||||
%{_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/02systemd-networkd
|
||||
@@ -473,8 +469,8 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
|
||||
|
||||
%files config-rescue
|
||||
%{dracutlibdir}/dracut.conf.d/02-rescue.conf
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
# FIXME: remove after F30
|
||||
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
|
||||
%endif
|
||||
|
@@ -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 vaiable in the _/etc/dracut.conf_
|
||||
on the command line or the drivers variable in the _/etc/dracut.conf_
|
||||
or _/etc/dracut.conf.d/myconf.conf_ configuration file (see *dracut.conf*(5)):
|
||||
----
|
||||
# dracut --add-drivers mymod initramfs-with-mymod.img
|
||||
@@ -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 completly change your root partition (move it inside a md
|
||||
image. So, you could completely change your root partition (move it inside a md
|
||||
raid with encryption and LVM on top), as long as you specify the correct
|
||||
filesystem LABEL or UUID on the kernel command line for your root device, dracut
|
||||
will find it and boot from it.
|
||||
@@ -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 would contain:
|
||||
A typical german kernel command line would contain:
|
||||
----
|
||||
rd.vconsole.font=latarcyrheb-sun16 rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8
|
||||
rd.vconsole.font=eurlatgr rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8
|
||||
----
|
||||
|
||||
Setting these options can override the setting stored on your system, if you use
|
||||
@@ -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 posibility to turn it on on demand.
|
||||
process, but then you would lose the possibility to turn it on on demand.
|
||||
|
||||
|
||||
[[Injecting]]
|
||||
@@ -262,7 +262,7 @@ For example for a NFS image, you would do:
|
||||
|
||||
|
||||
----
|
||||
# dracut -m "nfs network base" initramfs-nfs-only.img
|
||||
# dracut -m "nfs network base" initramfs-nfs-only.img
|
||||
----
|
||||
|
||||
Then you would boot from this image with your target machine and reduce the size
|
||||
@@ -349,7 +349,7 @@ serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
----
|
||||
+
|
||||
. Also in _/boot/grub2/grub.cfg_, add the following boot arguemnts to the ''kernel''
|
||||
. Also in _/boot/grub2/grub.cfg_, add the following boot arguments to the ''kernel''
|
||||
line:
|
||||
+
|
||||
----
|
||||
|
@@ -39,6 +39,7 @@ dnf -y install --best --allowerasing \
|
||||
/usr/bin/qemu-kvm \
|
||||
/usr/bin/qemu-system-$(uname -i) \
|
||||
e2fsprogs \
|
||||
tcpdump \
|
||||
$NULL &>/dev/null
|
||||
|
||||
./configure
|
||||
|
@@ -84,6 +84,11 @@ static bool arg_mod_filter_noname = false;
|
||||
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst);
|
||||
|
||||
|
||||
static inline void kmod_module_unrefp(struct kmod_module **p) {
|
||||
if (*p)
|
||||
kmod_module_unref(*p);
|
||||
}
|
||||
#define _cleanup_kmod_module_unref_ _cleanup_(kmod_module_unrefp)
|
||||
|
||||
static inline void kmod_module_unref_listp(struct kmod_list **p) {
|
||||
if (*p)
|
||||
@@ -479,11 +484,7 @@ static int resolve_deps(const char *src)
|
||||
if (strstr(buf, destrootdir))
|
||||
break;
|
||||
|
||||
p = strstr(buf, "=>");
|
||||
if (!p)
|
||||
p = buf;
|
||||
|
||||
p = strchr(p, '/');
|
||||
p = strchr(buf, '/');
|
||||
if (p) {
|
||||
char *q;
|
||||
|
||||
@@ -1150,6 +1151,8 @@ static int install_firmware(struct kmod_module *mod)
|
||||
ret = -1;
|
||||
STRV_FOREACH(q, firmwaredirs) {
|
||||
_cleanup_free_ char *fwpath = NULL;
|
||||
_cleanup_free_ char *fwpath_xz = NULL;
|
||||
const char *fw;
|
||||
struct stat sb;
|
||||
int r;
|
||||
|
||||
@@ -1159,12 +1162,21 @@ static int install_firmware(struct kmod_module *mod)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fw = fwpath;
|
||||
if (stat(fwpath, &sb) != 0) {
|
||||
log_debug("stat(%s) != 0", fwpath);
|
||||
continue;
|
||||
r = asprintf(&fwpath_xz, "%s.xz", fwpath);
|
||||
if (r < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (stat(fwpath_xz, &sb) != 0) {
|
||||
log_debug("stat(%s) != 0", fwpath);
|
||||
continue;
|
||||
}
|
||||
fw = fwpath_xz;
|
||||
}
|
||||
|
||||
ret = dracut_install(fwpath, fwpath, false, false, true);
|
||||
ret = dracut_install(fw, fw, false, false, true);
|
||||
if (ret == 0)
|
||||
log_debug("dracut_install '%s' OK", fwpath);
|
||||
}
|
||||
@@ -1234,28 +1246,48 @@ static bool check_module_path(const char *path)
|
||||
static int install_dependent_modules(struct kmod_list *modlist)
|
||||
{
|
||||
struct kmod_list *itr;
|
||||
struct kmod_module *mod;
|
||||
const char *path = NULL;
|
||||
const char *name = NULL;
|
||||
int ret = 0;
|
||||
|
||||
kmod_list_foreach(itr, modlist) {
|
||||
_cleanup_kmod_module_unref_ struct kmod_module *mod = NULL;
|
||||
mod = kmod_module_get_module(itr);
|
||||
path = kmod_module_get_path(mod);
|
||||
|
||||
if (path == NULL)
|
||||
continue;
|
||||
|
||||
if (check_hashmap(items_failed, path))
|
||||
return -1;
|
||||
|
||||
if (check_hashmap(items, path)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
name = kmod_module_get_name(mod);
|
||||
if ((path == NULL) || (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0))) {
|
||||
kmod_module_unref(mod);
|
||||
|
||||
if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = dracut_install(path, &path[kerneldirlen], false, false, true);
|
||||
if (ret == 0) {
|
||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
|
||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modpre = NULL;
|
||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modpost = NULL;
|
||||
log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]);
|
||||
install_firmware(mod);
|
||||
modlist = kmod_module_get_dependencies(mod);
|
||||
ret = install_dependent_modules(modlist);
|
||||
if (ret == 0) {
|
||||
ret = kmod_module_get_softdeps(mod, &modpre, &modpost);
|
||||
if (ret == 0)
|
||||
ret = install_dependent_modules(modpre);
|
||||
}
|
||||
} else {
|
||||
log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
|
||||
}
|
||||
kmod_module_unref(mod);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
58
lsinitrd.sh
58
lsinitrd.sh
@@ -121,6 +121,9 @@ if ! [[ -f "$image" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TMPDIR="$(mktemp -d -t lsinitrd.XXXXXX)"
|
||||
trap "rm -rf '$TMPDIR'" EXIT
|
||||
|
||||
dracutlibdirs() {
|
||||
for d in lib64/dracut lib/dracut usr/lib64/dracut usr/lib/dracut; do
|
||||
echo "$d/$1"
|
||||
@@ -160,6 +163,21 @@ list_files()
|
||||
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
|
||||
@@ -173,9 +191,43 @@ unpack_files()
|
||||
fi
|
||||
}
|
||||
|
||||
read -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
|
||||
echo "Image: $image: $(du -h $image | while read a b || [ -n "$a" ]; do echo $a;done)"
|
||||
if [ -n $uefi ]; then
|
||||
echo -n "initrd in UEFI: $uefi: "
|
||||
du -h $image | while read a b || [ -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 a b || [ -n "$a" ]; do echo $a;done
|
||||
fi
|
||||
|
||||
echo "========================================================================"
|
||||
fi
|
||||
|
||||
@@ -255,9 +307,8 @@ if [[ $SKIP ]]; then
|
||||
fi
|
||||
|
||||
if (( ${#filenames[@]} > 1 )); then
|
||||
TMPFILE="$(mktemp -t --suffix=.cpio lsinitrd.XXXXXX)"
|
||||
TMPFILE="$TMPDIR/initrd.cpio"
|
||||
$CAT "$image" 2>/dev/null > $TMPFILE
|
||||
trap "rm -f '$TMPFILE'" EXIT
|
||||
pre_decompress()
|
||||
{
|
||||
cat $TMPFILE
|
||||
@@ -287,6 +338,7 @@ else
|
||||
echo
|
||||
list_modules
|
||||
list_files
|
||||
list_squash_content
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@@ -66,7 +66,7 @@ default_kernel_images() {
|
||||
arm*)
|
||||
regex='[uz]Image'
|
||||
;;
|
||||
aarch64)
|
||||
aarch64|riscv64)
|
||||
regex='Image'
|
||||
;;
|
||||
*) regex='vmlinu.'
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash --norc
|
||||
#
|
||||
# mkinitrd compability wrapper for SUSE.
|
||||
# mkinitrd compatibility wrapper for SUSE.
|
||||
#
|
||||
# Copyright (c) 2013 SUSE Linux Products GmbH. All rights reserved.
|
||||
#
|
||||
@@ -62,7 +62,7 @@ usage () {
|
||||
$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 " environment variable if set."
|
||||
$cmd " -j device Journal device"
|
||||
$cmd " -D interface Run dhcp on the specified interface."
|
||||
$cmd " -I interface Configure the specified interface statically."
|
||||
@@ -145,31 +145,17 @@ is_xen_kernel() {
|
||||
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")
|
||||
local dir="${1%/*}/"
|
||||
[[ "$dir" != "$1" ]] || dir=""
|
||||
local kernel_image="$1" kernel_image_gz="${dir}vmlinux-${1#*-}.gz"
|
||||
echo kernel_image_gz="'$kernel_image_gz'" >&2
|
||||
|
||||
if get_kernel_version "$kernel_image" 2>/dev/null; then
|
||||
return
|
||||
fi
|
||||
|
||||
# As a last resort, try vmlinux-$version.gz, which might be around
|
||||
get_kernel_version "$kernel_image_gz" 2>/dev/null
|
||||
}
|
||||
|
||||
@@ -191,7 +177,7 @@ default_kernel_images() {
|
||||
arm*)
|
||||
regex='[uz]Image'
|
||||
;;
|
||||
aarch64)
|
||||
aarch64|riscv64)
|
||||
regex='Image'
|
||||
;;
|
||||
*) regex='vmlinu.'
|
||||
|
@@ -1,10 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
getSystemdVersion() {
|
||||
SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
|
||||
# Check if the systemd version is a valid number
|
||||
if ! [[ $SYSTEMD_VERSION =~ ^[0-9]+$ ]]; then
|
||||
dfatal "systemd version is not a number ($SYSTEMD_VERSION)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $SYSTEMD_VERSION
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ $mount_needs ]] && return 1
|
||||
if require_binaries $systemdutildir/systemd; then
|
||||
SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
|
||||
SYSTEMD_VERSION=$(getSystemdVersion)
|
||||
(( $SYSTEMD_VERSION >= 198 )) && return 0
|
||||
return 255
|
||||
fi
|
||||
@@ -31,6 +42,12 @@ install() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $(getSystemdVersion) -ge 240 ]; then
|
||||
inst_multiple -o \
|
||||
$systemdutildir/system-generators/systemd-debug-generator \
|
||||
$systemdsystemunitdir/debug-shell.service
|
||||
fi
|
||||
|
||||
inst_multiple -o \
|
||||
$systemdutildir/systemd \
|
||||
$systemdutildir/systemd-coredump \
|
||||
@@ -43,6 +60,7 @@ install() {
|
||||
$systemdutildir/systemd-sysctl \
|
||||
$systemdutildir/systemd-modules-load \
|
||||
$systemdutildir/systemd-vconsole-setup \
|
||||
$systemdutildir/systemd-volatile-root \
|
||||
$systemdutildir/system-generators/systemd-fstab-generator \
|
||||
$systemdutildir/system-generators/systemd-gpt-auto-generator \
|
||||
\
|
||||
@@ -99,6 +117,7 @@ install() {
|
||||
$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 \
|
||||
|
@@ -77,7 +77,7 @@ fips_load_crypto()
|
||||
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
|
||||
for _module in $FIPSMODULES; do
|
||||
if [ "$_module" != "tcrypt" ]; then
|
||||
if ! modprobe "${_module}"; then
|
||||
if ! modprobe "${_module}" 2>/tmp/fips.modprobe_err; then
|
||||
# check if kernel provides generic algo
|
||||
_found=0
|
||||
while read _k _s _v || [ -n "$_k" ]; do
|
||||
@@ -86,7 +86,7 @@ fips_load_crypto()
|
||||
_found=1
|
||||
break
|
||||
done </proc/crypto
|
||||
[ "$_found" = "0" ] && return 1
|
||||
[ "$_found" = "0" ] && cat /tmp/fips.modprobe_err >&2 && return 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -113,16 +113,12 @@ do_fips()
|
||||
do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
|
||||
else
|
||||
BOOT_IMAGE="$(getarg BOOT_IMAGE)"
|
||||
|
||||
# Trim off any leading GRUB boot device (e.g. ($root) )
|
||||
BOOT_IMAGE="$(echo "${BOOT_IMAGE}" | sed 's/^(.*)//')"
|
||||
|
||||
BOOT_IMAGE_NAME="${BOOT_IMAGE##*/}"
|
||||
BOOT_IMAGE_PATH="${BOOT_IMAGE%${BOOT_IMAGE_NAME}}"
|
||||
|
||||
if [ -z "$BOOT_IMAGE_NAME" ]; then
|
||||
BOOT_IMAGE_NAME="vmlinuz-${KERNEL}"
|
||||
elif ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE_NAME}" ]; then
|
||||
elif ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE}" ]; then
|
||||
#if /boot is not a separate partition BOOT_IMAGE might start with /boot
|
||||
BOOT_IMAGE_PATH=${BOOT_IMAGE_PATH#"/boot"}
|
||||
#on some achitectures BOOT_IMAGE does not contain path to kernel
|
||||
@@ -133,13 +129,13 @@ do_fips()
|
||||
fi
|
||||
fi
|
||||
|
||||
BOOT_IMAGE_HMAC="/boot/${BOOT_IMAGE_PATH}/.${BOOT_IMAGE_NAME}.hmac"
|
||||
BOOT_IMAGE_HMAC="/boot/${BOOT_IMAGE_PATH}.${BOOT_IMAGE_NAME}.hmac"
|
||||
if ! [ -e "${BOOT_IMAGE_HMAC}" ]; then
|
||||
warn "${BOOT_IMAGE_HMAC} does not exist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
(cd "${BOOT_IMAGE_HMAC%/*}" && sha512hmac -c "${BOOT_IMAGE_HMAC}") || return 1
|
||||
sha512hmac -c "${BOOT_IMAGE_HMAC}" || return 1
|
||||
fi
|
||||
|
||||
info "All initrd crypto checks done"
|
||||
|
@@ -62,7 +62,7 @@ installkernel() {
|
||||
# called by dracut
|
||||
install() {
|
||||
local _dir
|
||||
inst_hook pre-trigger 01 "$moddir/fips-boot.sh"
|
||||
inst_hook pre-mount 01 "$moddir/fips-boot.sh"
|
||||
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
|
||||
inst_hook pre-udev 01 "$moddir/fips-load-crypto.sh"
|
||||
inst_script "$moddir/fips.sh" /sbin/fips.sh
|
||||
|
@@ -37,32 +37,5 @@ install() {
|
||||
$systemdsystemunitdir/initrd-parse-etc.service
|
||||
|
||||
ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target"
|
||||
|
||||
local VERSION=""
|
||||
local PRETTY_NAME=""
|
||||
if [ -e /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
[[ -n ${VERSION} ]] && VERSION+=" "
|
||||
[[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" "
|
||||
fi
|
||||
NAME=dracut
|
||||
ID=dracut
|
||||
VERSION+="dracut-$DRACUT_VERSION"
|
||||
PRETTY_NAME+="dracut-$DRACUT_VERSION (Initramfs)"
|
||||
VERSION_ID=$DRACUT_VERSION
|
||||
ANSI_COLOR="0;34"
|
||||
|
||||
{
|
||||
echo NAME=\"$NAME\"
|
||||
echo VERSION=\"$VERSION\"
|
||||
echo ID=$ID
|
||||
echo VERSION_ID=$VERSION_ID
|
||||
echo PRETTY_NAME=\"$PRETTY_NAME\"
|
||||
echo ANSI_COLOR=\"$ANSI_COLOR\"
|
||||
} > $initdir/usr/lib/initrd-release
|
||||
echo dracut-$DRACUT_VERSION > $initdir/lib/dracut/dracut-$DRACUT_VERSION
|
||||
ln -sf ../usr/lib/initrd-release $initdir/etc/initrd-release
|
||||
ln -sf initrd-release $initdir/usr/lib/os-release
|
||||
ln -sf initrd-release $initdir/etc/os-release
|
||||
}
|
||||
|
||||
|
@@ -22,9 +22,6 @@ install() {
|
||||
_progs="$_progs $_i"
|
||||
done
|
||||
|
||||
# FIXME: switch_root should be in the above list, but busybox version hangs
|
||||
# (using busybox-1.15.1-7.fc14.i686 at the time of writing)
|
||||
|
||||
for _i in $_progs; do
|
||||
_path=$(find_binary "$_i")
|
||||
[ -z "$_path" ] && continue
|
||||
|
@@ -8,7 +8,7 @@ fi
|
||||
|
||||
[ -e /etc/vconsole.conf ] && . /etc/vconsole.conf
|
||||
|
||||
DEFAULT_FONT=LatArCyrHeb-16
|
||||
DEFAULT_FONT=eurlatgr
|
||||
DEFAULT_KEYMAP=/etc/sysconfig/console/default.kmap
|
||||
|
||||
set_keyboard() {
|
||||
|
@@ -23,7 +23,7 @@ install() {
|
||||
fi
|
||||
|
||||
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
|
||||
DEFAULT_FONT="${i18n_default_font:-LatArCyrHeb-16}"
|
||||
DEFAULT_FONT="${i18n_default_font:-eurlatgr}"
|
||||
I18N_CONF="/etc/locale.conf"
|
||||
VCONFIG_CONF="/etc/vconsole.conf"
|
||||
|
||||
@@ -36,7 +36,7 @@ install() {
|
||||
MAPS=$(find ${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\*)
|
||||
|
||||
for map in $MAPS; do
|
||||
KEYMAPS="$KEYMAPS $map"
|
||||
KEYMAPS="$KEYMAPS $map "
|
||||
case $map in
|
||||
*.gz) cmd=zgrep;;
|
||||
*.bz2) cmd=bzgrep;;
|
||||
@@ -45,7 +45,7 @@ install() {
|
||||
|
||||
for INCL in $($cmd "^include " $map | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
|
||||
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
|
||||
strstr "$KEYMAPS" "$FN" || findkeymap $FN
|
||||
strstr "$KEYMAPS" " $FN " || findkeymap $FN
|
||||
done
|
||||
done
|
||||
done
|
||||
|
@@ -126,9 +126,11 @@ parse_option_121() {
|
||||
elif [ $mask -gt 8 ]; then
|
||||
destination="$1.$2.0.0/$mask"
|
||||
shift; shift
|
||||
else
|
||||
elif [ $mask -gt 0 ]; then
|
||||
destination="$1.0.0.0/$mask"
|
||||
shift
|
||||
else
|
||||
destination="0.0.0.0/$mask"
|
||||
fi
|
||||
|
||||
# Read the gateway
|
||||
@@ -138,7 +140,7 @@ parse_option_121() {
|
||||
# Multicast routing on Linux
|
||||
# - If you set a next-hop address for a multicast group, this breaks with Cisco switches
|
||||
# - If you simply leave it link-local and attach it to an interface, it works fine.
|
||||
if [ $multicast -eq 1 ]; then
|
||||
if [ $multicast -eq 1 -o "$gateway" = "0.0.0.0" ]; then
|
||||
temp_result="$destination dev $interface"
|
||||
else
|
||||
temp_result="$destination via $gateway dev $interface"
|
||||
|
@@ -462,6 +462,11 @@ for p in $(getargs ip=); do
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if command -v wicked >/dev/null && [ -z "$manualup" ]; then
|
||||
/sbin/netroot $netif
|
||||
fi
|
||||
|
||||
exit $ret
|
||||
fi
|
||||
done
|
||||
|
@@ -8,9 +8,9 @@ check() {
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo -n "kernel-network-modules "
|
||||
# RHEL 8.1: Default to network-legacy unless the user chose
|
||||
# network-manager manually
|
||||
if ! dracut_module_included "network-manager" ; then
|
||||
if ! dracut_module_included "network-legacy" && [ -x "/usr/libexec/nm-initrd-generator" ] ; then
|
||||
echo "network-manager"
|
||||
else
|
||||
echo "network-legacy"
|
||||
fi
|
||||
return 0
|
||||
|
@@ -14,20 +14,20 @@ is_ip() {
|
||||
|
||||
get_ip() {
|
||||
local iface="$1" ip=""
|
||||
ip=$(ip -o -f inet addr show $iface)
|
||||
ip=$(ip -f inet addr show $iface)
|
||||
ip=${ip%%/*}
|
||||
ip=${ip##* }
|
||||
echo $ip
|
||||
}
|
||||
|
||||
iface_for_remote_addr() {
|
||||
set -- $(ip -o route get to $1)
|
||||
echo $5
|
||||
set -- $(ip route get to $1 | sed 's/.*\bdev\b//p;q')
|
||||
echo $1
|
||||
}
|
||||
|
||||
iface_for_ip() {
|
||||
set -- $(ip -o addr show to $1)
|
||||
echo $2
|
||||
set -- $(ip addr show to $1)
|
||||
echo ${2%:}
|
||||
}
|
||||
|
||||
iface_for_mac() {
|
||||
@@ -129,7 +129,7 @@ setup_net() {
|
||||
for _p in $(getargs rd.route); do
|
||||
route_to_var "$_p" || continue
|
||||
[ -n "$route_dev" ] && [ "$route_dev" != "$netif" ] && continue
|
||||
ip route add "$route_mask" ${route_gw:+via "$route_gw"} ${route_dev:+dev "$route_dev"}
|
||||
ip route add "$route_mask" ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}
|
||||
if strstr "$route_mask" ":"; then
|
||||
printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
|
||||
> /tmp/net.route6."$netif"
|
||||
@@ -593,7 +593,7 @@ wait_for_if_link() {
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip -o link show dev $1 2>/dev/null)
|
||||
li=$(ip link show dev $1 2>/dev/null)
|
||||
[ -n "$li" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
@@ -609,7 +609,7 @@ wait_for_if_up() {
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip -o link show up dev $1)
|
||||
li=$(ip link show up dev $1)
|
||||
if [ -n "$li" ]; then
|
||||
case "$li" in
|
||||
*\<UP*)
|
||||
@@ -653,7 +653,8 @@ wait_for_ipv6_dad_link() {
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
|
||||
[ -n "$(ip -6 addr show dev "$1" scope link)" ] \
|
||||
&& [ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
|
||||
&& [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
|
||||
&& return 0
|
||||
[ -n "$(ip -6 addr show dev "$1" scope link dadfailed)" ] \
|
||||
@@ -671,7 +672,8 @@ wait_for_ipv6_dad() {
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -z "$(ip -6 addr show dev "$1" tentative)" ] \
|
||||
[ -n "$(ip -6 addr show dev "$1")" ] \
|
||||
&& [ -z "$(ip -6 addr show dev "$1" tentative)" ] \
|
||||
&& [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
|
||||
&& return 0
|
||||
[ -n "$(ip -6 addr show dev "$1" dadfailed)" ] \
|
||||
@@ -721,12 +723,12 @@ iface_has_carrier() {
|
||||
|
||||
linkup "$1"
|
||||
|
||||
li=$(ip -o link show up dev $1)
|
||||
li=$(ip link show up dev $1)
|
||||
strstr "$li" "NO-CARRIER" && _no_carrier_flag=1
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
if [ -n "$_no_carrier_flag" ]; then
|
||||
li=$(ip -o link show up dev $1)
|
||||
li=$(ip link show up dev $1)
|
||||
# NO-CARRIER flag was cleared
|
||||
strstr "$li" "NO-CARRIER" || return 0
|
||||
elif ! [ -e "$interface/carrier" ]; then
|
||||
@@ -747,7 +749,7 @@ iface_has_link() {
|
||||
|
||||
iface_is_enslaved() {
|
||||
local _li
|
||||
_li=$(ip -o link show dev $1)
|
||||
_li=$(ip link show dev $1)
|
||||
strstr "$_li" " master " || return 1
|
||||
return 0
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ depends() {
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_binary sort
|
||||
inst_binary awk
|
||||
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
|
||||
}
|
||||
|
||||
|
@@ -288,7 +288,7 @@ echo "files /var/lib/dhclient" >> /run/initramfs/rwtab
|
||||
cp /tmp/net.* /run/initramfs/
|
||||
for i in /tmp/net.*.resolv.conf; do
|
||||
[ -f "$i" ] && cat "$i"
|
||||
done | sort -u > /run/initramfs/state/etc/resolv.conf
|
||||
done | awk '!($0 in a) { a[$0]; print }' > /run/initramfs/state/etc/resolv.conf
|
||||
[ -s /run/initramfs/state/etc/resolv.conf ] || rm -f /run/initramfs/state/etc/resolv.conf
|
||||
copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network-scripts
|
||||
cp /tmp/ifcfg-leases/* /run/initramfs/state/var/lib/dhclient
|
||||
|
@@ -191,7 +191,7 @@ readkey() {
|
||||
local device="$3"
|
||||
|
||||
# No mounting needed if the keyfile resides inside the initrd
|
||||
if [ "/" == "$keydev" ]; then
|
||||
if [ "/" = "$keydev" ]; then
|
||||
local mntp=/
|
||||
else
|
||||
# This creates a unique single mountpoint for *, or several for explicitly
|
||||
|
@@ -8,6 +8,8 @@ NEWROOT=${NEWROOT:-"/sysroot"}
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
mkdir -m 0700 /run/cryptsetup
|
||||
|
||||
# if device name is /dev/dm-X, convert to /dev/mapper/name
|
||||
if [ "${1##/dev/dm-}" != "$1" ]; then
|
||||
device="/dev/mapper/$(dmsetup info -c --noheadings -o name "$1")"
|
||||
@@ -156,9 +158,9 @@ else
|
||||
|
||||
info "Using '$keypath' on '$keydev'"
|
||||
readkey "$keypath" "$keydev" "$device" \
|
||||
| cryptsetup -d - $cryptsetupopts luksOpen "$device" "$luksname"
|
||||
| cryptsetup -d - $cryptsetupopts luksOpen "$device" "$luksname" \
|
||||
&& ask_passphrase=0
|
||||
unset keypath keydev
|
||||
ask_passphrase=0
|
||||
break
|
||||
done
|
||||
fi
|
||||
|
@@ -25,7 +25,7 @@ depends() {
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
hostonly="" instmods drbg
|
||||
arch=$(arch)
|
||||
arch=$(uname -m)
|
||||
[[ $arch == x86_64 ]] && arch=x86
|
||||
[[ $arch == s390x ]] && arch=s390
|
||||
instmods dm_crypt =crypto =drivers/crypto =arch/$arch/crypto
|
||||
|
@@ -18,7 +18,7 @@ if getargbool 1 rd.luks -n rd_NO_LUKS && \
|
||||
fi
|
||||
|
||||
# A keydev of '/' is treated as the initrd itself
|
||||
if [ "/" == "$keydev" ]; then
|
||||
if [ "/" = "$keydev" ]; then
|
||||
[ -z "$luksdev" ] && luksdev='*'
|
||||
echo "$luksdev:$keydev:$keypath" >> /tmp/luks.keys
|
||||
continue
|
||||
|
@@ -3,21 +3,7 @@
|
||||
# called by dracut
|
||||
check() {
|
||||
if [[ $hostonly ]] || [[ $mount_needs ]]; then
|
||||
if type -P systemd-detect-virt >/dev/null 2>&1; then
|
||||
vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
|
||||
(($? != 0)) && return 255
|
||||
[[ $vm = "qemu" ]] && return 0
|
||||
[[ $vm = "kvm" ]] && return 0
|
||||
[[ $vm = "bochs" ]] && return 0
|
||||
fi
|
||||
|
||||
for i in /sys/class/dmi/id/*_vendor; do
|
||||
[[ -f $i ]] || continue
|
||||
read vendor < $i
|
||||
[[ "$vendor" == "QEMU" ]] && return 0
|
||||
[[ "$vendor" == "Bochs" ]] && return 0
|
||||
done
|
||||
|
||||
is_qemu_virtualized && return 0
|
||||
return 255
|
||||
fi
|
||||
return 0
|
||||
|
@@ -3,22 +3,7 @@
|
||||
# called by dracut
|
||||
check() {
|
||||
if [[ $hostonly ]] || [[ $mount_needs ]]; then
|
||||
if type -P systemd-detect-virt >/dev/null 2>&1; then
|
||||
vm=$(systemd-detect-virt --vm 2>/dev/null)
|
||||
(($? != 0)) && return 255
|
||||
[[ $vm = "qemu" ]] && return 0
|
||||
[[ $vm = "kvm" ]] && return 0
|
||||
[[ $vm = "bochs" ]] && return 0
|
||||
fi
|
||||
|
||||
for i in /sys/class/dmi/id/*_vendor; do
|
||||
[[ -f $i ]] || continue
|
||||
read vendor < $i
|
||||
[[ "$vendor" == "QEMU" ]] && return 0
|
||||
[[ "$vendor" == "Red Hat" ]] && return 0
|
||||
[[ "$vendor" == "Bochs" ]] && return 0
|
||||
done
|
||||
|
||||
is_qemu_virtualized && return 0
|
||||
return 255
|
||||
fi
|
||||
|
||||
|
@@ -53,7 +53,7 @@ gpg_decrypt() {
|
||||
--tries 3 --tty-echo-off
|
||||
|
||||
# Clean up the smartcard gpg-agent
|
||||
if [ "${useSmartcard}" == "1" ]; then
|
||||
if [ "${useSmartcard}" = "1" ]; then
|
||||
GNUPGHOME="$gpghome" gpg-connect-agent 1>/dev/null killagent /bye
|
||||
fi
|
||||
|
||||
|
@@ -22,7 +22,7 @@ depends() {
|
||||
installkernel() {
|
||||
local _boot_zipl
|
||||
|
||||
_boot_zipl=$(sed -n 's/\(.*\)\w*\/boot\/zipl.*/\1/p' /etc/fstab)
|
||||
_boot_zipl=$(sed -n -e '/^[[:space:]]*#/d' -e 's/\(.*\)\w*\/boot\/zipl.*/\1/p' /etc/fstab)
|
||||
if [ -n "$_boot_zipl" ] ; then
|
||||
eval $(blkid -s TYPE -o udev ${_boot_zipl})
|
||||
if [ -n "$ID_FS_TYPE" ] ; then
|
||||
@@ -40,7 +40,7 @@ installkernel() {
|
||||
cmdline() {
|
||||
local _boot_zipl
|
||||
|
||||
_boot_zipl=$(sed -n 's/\(.*\)\w*\/boot\/zipl.*/\1/p' /etc/fstab)
|
||||
_boot_zipl=$(sed -n -e '/^[[:space:]]*#/d' -e 's/\(.*\)\w*\/boot\/zipl.*/\1/p' /etc/fstab)
|
||||
if [ -n "$_boot_zipl" ] ; then
|
||||
echo "rd.zipl=${_boot_zipl}"
|
||||
fi
|
||||
|
@@ -54,6 +54,8 @@ install() {
|
||||
if [[ $hostonly ]] ; then
|
||||
inst_rules_wildcard 51-dasd-*.rules
|
||||
inst_rules_wildcard 41-s390x-dasd-*.rules
|
||||
mark_hostonly /etc/udev/rules.d/51-dasd-*.rules
|
||||
mark_hostonly /etc/udev/rules.d/41-s390x-dasd-*.rules
|
||||
fi
|
||||
inst_rules 59-dasd.rules
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
dcssblk_arg=$(getarg rd.dcssblk=)
|
||||
if [ $? == 0 ];then
|
||||
if [ $? = 0 ];then
|
||||
info "Loading dcssblk segments=$dcssblk_arg"
|
||||
modprobe dcssblk segments=$dcssblk_arg
|
||||
fi
|
||||
|
@@ -13,9 +13,9 @@ depends() {
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple -o cat ls ps grep more cat rm strace free showmount \
|
||||
ping netstat rpcinfo vi scp ping6 ssh find vi \
|
||||
tcpdump cp less hostname mkdir systemd-analyze \
|
||||
inst_multiple -o ls ps grep more cat rm strace free showmount df du lsblk \
|
||||
ping netstat rpcinfo vi scp ping6 ssh find \
|
||||
tcpdump cp dd less hostname mkdir systemd-analyze \
|
||||
fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.f2fs fsck.vfat e2fsck
|
||||
|
||||
grep '^tcpdump:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
|
@@ -1,5 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
if ! getargbool 0 rd.nofcoe ; then
|
||||
info "rd.nofcoe=0: skipping lldpad activation"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Note lldpad will stay running after switchroot, the system initscripts
|
||||
# are to kill it and start a new lldpad to take over. Data is transfered
|
||||
# between the 2 using a shm segment
|
||||
|
@@ -13,6 +13,11 @@
|
||||
# fcoe=eth0:nodcb:vn2vn
|
||||
# fcoe=4a:3f:4c:04:f8:d7:nodcb:fabric
|
||||
|
||||
if ! getargbool 0 rd.nofcoe ; then
|
||||
info "rd.nofcoe=0: skipping fcoe"
|
||||
return 0
|
||||
fi
|
||||
|
||||
[ -z "$fcoe" ] && fcoe=$(getarg fcoe=)
|
||||
|
||||
# If it's not set we don't continue
|
||||
|
@@ -22,8 +22,10 @@ check() {
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
pushd . >/dev/null
|
||||
for_each_host_dev_and_slaves is_iscsi || return 255
|
||||
for_each_host_dev_and_slaves is_iscsi
|
||||
local _is_iscsi=$?
|
||||
popd >/dev/null
|
||||
[[ $_is_iscsi == 0 ]] || return 255
|
||||
}
|
||||
return 0
|
||||
}
|
||||
@@ -72,6 +74,7 @@ install_iscsiroot() {
|
||||
local devpath=$1
|
||||
local scsi_path iscsi_lun session c d conn host flash
|
||||
local iscsi_session iscsi_address iscsi_port iscsi_targetname iscsi_tpgt
|
||||
local bootproto
|
||||
|
||||
scsi_path=${devpath%%/block*}
|
||||
[ "$scsi_path" = "$devpath" ] && return 1
|
||||
@@ -86,6 +89,7 @@ install_iscsiroot() {
|
||||
iscsi_host=${host##*/}
|
||||
|
||||
for flash in ${host}/flashnode_sess-* ; do
|
||||
[ ! -e "$flash/is_boot_target" ] && continue
|
||||
is_boot=$(cat $flash/is_boot_target)
|
||||
if [ $is_boot -eq 1 ] ; then
|
||||
# qla4xxx flashnode session; skip iBFT discovery
|
||||
@@ -118,8 +122,14 @@ install_iscsiroot() {
|
||||
local_address=$(ip -o route get to $iscsi_address | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
|
||||
ifname=$(ip -o route get to $iscsi_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
|
||||
|
||||
#follow ifcfg settings for boot protocol
|
||||
bootproto=$(sed -n "/BOOTPROTO/s/BOOTPROTO='\([[:alpha:]]*6\?\)4\?'/\1/p" /etc/sysconfig/network/ifcfg-$ifname)
|
||||
# follow ifcfg settings for boot protocol
|
||||
for _path in \
|
||||
"/etc/sysconfig/network-scripts/ifcfg-$ifname" \
|
||||
"/etc/sysconfig/network/ifcfg-$ifname" \
|
||||
; do
|
||||
[ -f "$_path" ] && bootproto=$(sed -n "s/BOOTPROTO='\?\([[:alpha:]]*6\?\)4\?/\1/p" "$_path")
|
||||
done
|
||||
|
||||
if [ $bootproto ]; then
|
||||
printf 'ip=%s:%s ' ${ifname} ${bootproto}
|
||||
else
|
||||
|
@@ -2,7 +2,7 @@
|
||||
if [ -z $iscsi_lun ]; then
|
||||
iscsi_lun=0
|
||||
fi
|
||||
NEWROOT=${NEWROOT:-"/sysroot"}
|
||||
NEWROOT=${NEWROOT:-/sysroot}
|
||||
|
||||
for disk in /dev/disk/by-path/*-iscsi-*-$iscsi_lun; do
|
||||
if mount -t ${fstype:-auto} -o "$rflags" $disk $NEWROOT; then
|
||||
|
@@ -65,7 +65,12 @@ cmdline() {
|
||||
printf 'ifname=%s:%s ' ${ifname} ${ifmac}
|
||||
fi
|
||||
|
||||
printf 'ip=%s:static\n' ${ifname}
|
||||
bootproto=$(sed -n "/BOOTPROTO/s/BOOTPROTO='\([[:alpha:]]*6\?\)4\?'/\1/p" /etc/sysconfig/network/ifcfg-$ifname)
|
||||
if [ $bootproto ]; then
|
||||
printf 'ip=%s:%s ' ${ifname} ${bootproto}
|
||||
else
|
||||
printf 'ip=%s:static ' ${ifname}
|
||||
fi
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
|
@@ -74,7 +74,7 @@ mount_root() {
|
||||
|
||||
rootopts=
|
||||
if getargbool 1 rd.fstab -d -n rd_NO_FSTAB \
|
||||
&& ! getarg rootflags \
|
||||
&& ! getarg rootflags >/dev/null \
|
||||
&& [ -f "$NEWROOT/etc/fstab" ] \
|
||||
&& ! [ -L "$NEWROOT/etc/fstab" ]; then
|
||||
# if $NEWROOT/etc/fstab contains special mount options for
|
||||
|
@@ -9,20 +9,8 @@ check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
if type -P systemd-detect-virt >/dev/null 2>&1; then
|
||||
vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
|
||||
(($? != 0)) && return 255
|
||||
[[ $vm = "qemu" ]] && return 0
|
||||
[[ $vm = "kvm" ]] && return 0
|
||||
[[ $vm = "bochs" ]] && return 0
|
||||
fi
|
||||
is_qemu_virtualized && return 0
|
||||
|
||||
for i in /sys/class/dmi/id/*_vendor; do
|
||||
[[ -f $i ]] || continue
|
||||
read vendor < $i
|
||||
[[ "$vendor" == "QEMU" ]] && return 0
|
||||
[[ "$vendor" == "Bochs" ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
|
||||
|
@@ -57,7 +57,7 @@ mount_root() {
|
||||
|
||||
# we want rootflags (rflags) to take precedence so prepend rootopts to
|
||||
# them; rflags is guaranteed to not be empty
|
||||
rflags="${rootopts:+"${rootopts},"}${rflags}"
|
||||
rflags="${rootopts:+${rootopts},}${rflags}"
|
||||
|
||||
umount "$NEWROOT"
|
||||
|
||||
|
@@ -15,21 +15,26 @@ _emergency_action=$(getarg rd.emergency)
|
||||
|
||||
if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
|
||||
FSTXT="/run/dracut/fsck/fsck_help_$fstype.txt"
|
||||
RDSOSREPORT="$(rdsosreport)"
|
||||
source_hook "$hook"
|
||||
echo
|
||||
rdsosreport
|
||||
echo
|
||||
echo
|
||||
echo 'Entering emergency mode. Exit the shell to continue.'
|
||||
echo 'Type "journalctl" to view system logs.'
|
||||
echo 'You might want to save "/run/initramfs/rdsosreport.txt" to a USB stick or /boot'
|
||||
echo 'after mounting them and attach it to a bug report.'
|
||||
echo
|
||||
echo
|
||||
[ -f "$FSTXT" ] && cat "$FSTXT"
|
||||
while read _tty rest; do
|
||||
(
|
||||
echo
|
||||
echo $RDSOSREPORT
|
||||
echo
|
||||
echo
|
||||
echo 'Entering emergency mode. Exit the shell to continue.'
|
||||
echo 'Type "journalctl" to view system logs.'
|
||||
echo 'You might want to save "/run/initramfs/rdsosreport.txt" to a USB stick or /boot'
|
||||
echo 'after mounting them and attach it to a bug report.'
|
||||
echo
|
||||
echo
|
||||
[ -f "$FSTXT" ] && cat "$FSTXT"
|
||||
) > /dev/$_tty
|
||||
done < /proc/consoles
|
||||
[ -f /etc/profile ] && . /etc/profile
|
||||
[ -z "$PS1" ] && export PS1="$_name:\${PWD}# "
|
||||
exec sh -i -l
|
||||
exec sulogin -e
|
||||
else
|
||||
export hook="shutdown-emergency"
|
||||
warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line."
|
||||
|
@@ -15,7 +15,7 @@ dracut-shutdown.service
|
||||
DESCRIPTION
|
||||
-----------
|
||||
This service unpacks the initramfs image to /run/initramfs.
|
||||
systemd pivots into /run/initramfs at shutdown, so the root filesytem
|
||||
systemd pivots into /run/initramfs at shutdown, so the root filesystem
|
||||
can be safely unmounted.
|
||||
|
||||
The following steps are executed during a shutdown:
|
||||
|
@@ -59,5 +59,7 @@ install() {
|
||||
done
|
||||
|
||||
inst_simple "$moddir/dracut-tmpfiles.conf" "$tmpfilesdir/dracut-tmpfiles.conf"
|
||||
|
||||
inst_multiple sulogin
|
||||
}
|
||||
|
||||
|
@@ -10,7 +10,7 @@ $ keyctl add encrypted evm-key "new trusted:kmk-trusted 32" @u
|
||||
782117972
|
||||
|
||||
# Save the encrypted key
|
||||
$ su -c 'keyctl pipe `keyctl search @u encrypted evm_key` > /etc/keys/evm-trusted.blob'
|
||||
$ su -c 'keyctl pipe `keyctl search @u encrypted evm-key` > /etc/keys/evm-trusted.blob'
|
||||
|
||||
# The EVM key path name can be set in one of the following ways (specified in
|
||||
# the order in which the variable is overwritten):
|
||||
|
@@ -11,7 +11,7 @@ Then if syslog is configured it is started and will forward all
|
||||
kernel messages to the given syslog server.
|
||||
|
||||
The syslog implementation is detected automatically by finding the
|
||||
apropriate binary with the following order:
|
||||
appropriate binary with the following order:
|
||||
rsyslogd
|
||||
syslogd
|
||||
syslog-ng
|
||||
|
@@ -38,7 +38,7 @@ rsyslog_config() {
|
||||
[ -f /tmp/syslog.conf ] && read conf < /tmp/syslog.conf
|
||||
[ -z "$conf" ] && conf="/etc/rsyslog.conf" && echo "$conf" > /tmp/syslog.conf
|
||||
|
||||
if [ $type == "rsyslogd" ]; then
|
||||
if [ $type = "rsyslogd" ]; then
|
||||
template=/etc/templates/rsyslog.conf
|
||||
if [ -n "$server" ]; then
|
||||
rsyslog_config "$server" "$template" "$filters" > $conf
|
||||
|
@@ -24,7 +24,7 @@ debug_on() {
|
||||
|
||||
# returns OK if $1 contains literal string $2 (and isn't empty)
|
||||
strstr() {
|
||||
[ "${1##*"$2"*}" != "$1" ]
|
||||
[ "${1##*$2*}" != "$1" ]
|
||||
}
|
||||
|
||||
# returns OK if $1 matches (completely) glob pattern $2
|
||||
@@ -43,18 +43,18 @@ strglobin() {
|
||||
|
||||
# returns OK if $1 contains literal string $2 at the beginning, and isn't empty
|
||||
str_starts() {
|
||||
[ "${1#"$2"*}" != "$1" ]
|
||||
[ "${1#$2*}" != "$1" ]
|
||||
}
|
||||
|
||||
# returns OK if $1 contains literal string $2 at the end, and isn't empty
|
||||
str_ends() {
|
||||
[ "${1%*"$2"}" != "$1" ]
|
||||
[ "${1%*$2}" != "$1" ]
|
||||
}
|
||||
|
||||
trim() {
|
||||
local var="$*"
|
||||
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
|
||||
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
|
||||
var="${var#${var%%[![:space:]]*}}" # remove leading whitespace characters
|
||||
var="${var%${var##*[![:space:]]}}" # remove trailing whitespace characters
|
||||
printf "%s" "$var"
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
check_quiet
|
||||
echo "<30>dracut: $*" > /dev/kmsg
|
||||
[ "$DRACUT_QUIET" != "yes" ] && \
|
||||
echo "dracut: $*" >&2
|
||||
echo "dracut: $*" >&2 || :
|
||||
}
|
||||
|
||||
else
|
||||
@@ -108,9 +108,9 @@ str_replace() {
|
||||
local out=''
|
||||
|
||||
while strstr "${in}" "$s"; do
|
||||
chop="${in%%"$s"*}"
|
||||
chop="${in%%$s*}"
|
||||
out="${out}${chop}$r"
|
||||
in="${in#*"$s"}"
|
||||
in="${in#*$s}"
|
||||
done
|
||||
echo "${out}${in}"
|
||||
}
|
||||
@@ -396,7 +396,7 @@ splitsep() {
|
||||
while [ -n "$str" -a "$#" -gt 1 ]; do
|
||||
tmp="${str%%$sep*}"
|
||||
eval "$1='${tmp}'"
|
||||
str="${str#"$tmp"}"
|
||||
str="${str#$tmp}"
|
||||
str="${str#$sep}"
|
||||
shift
|
||||
done
|
||||
@@ -620,7 +620,7 @@ nfsroot_to_var() {
|
||||
# prints:
|
||||
# ENV{ID_FS_LABEL}="boot"
|
||||
#
|
||||
# TOOD: symlinks
|
||||
# TODO: symlinks
|
||||
udevmatch() {
|
||||
case "$1" in
|
||||
UUID=????????-????-????-????-????????????|LABEL=*|PARTLABEL=*|PARTUUID=????????-????-????-????-????????????)
|
||||
@@ -1327,7 +1327,7 @@ show_memstats()
|
||||
remove_hostonly_files() {
|
||||
rm -fr /etc/cmdline /etc/cmdline.d/*.conf "$hookdir/initqueue/finished"
|
||||
if [ -f /lib/dracut/hostonly-files ]; then
|
||||
while read line || [ -n "$line" ]; do
|
||||
while read -r line || [ -n "$line" ]; do
|
||||
[ -e "$line" ] || [ -h "$line" ] || continue
|
||||
rm -f "$line"
|
||||
done < /lib/dracut/hostonly-files
|
||||
|
@@ -26,10 +26,14 @@ install() {
|
||||
(ln -s bash "${initdir}/bin/sh" || :)
|
||||
fi
|
||||
|
||||
#add common users in /etc/passwd, it will be used by nfs/ssh currently
|
||||
grep '^root:' "$initdir/etc/passwd" 2>/dev/null || echo 'root:x:0:0::/root:/bin/sh' >> "$initdir/etc/passwd"
|
||||
# add common users in /etc/passwd, it will be used by nfs/ssh currently
|
||||
# use password for hostonly images to facilitate secure sulogin in emergency console
|
||||
[[ $hostonly ]] && pwshadow='x'
|
||||
grep '^root:' "$initdir/etc/passwd" 2>/dev/null || echo "root:$pwshadow:0:0::/root:/bin/sh" >> "$initdir/etc/passwd"
|
||||
grep '^nobody:' /etc/passwd >> "$initdir/etc/passwd"
|
||||
|
||||
[[ $hostonly ]] && grep '^root:' /etc/shadow >> "$initdir/etc/shadow"
|
||||
|
||||
# install our scripts and hooks
|
||||
inst_script "$moddir/init.sh" "/init"
|
||||
inst_script "$moddir/initqueue.sh" "/sbin/initqueue"
|
||||
@@ -63,29 +67,36 @@ install() {
|
||||
echo ro >> "${initdir}/etc/cmdline.d/base.conf"
|
||||
fi
|
||||
|
||||
[ -e "${initdir}/usr/lib" ] || mkdir -m 0755 -p ${initdir}/usr/lib
|
||||
|
||||
local VERSION=""
|
||||
local PRETTY_NAME=""
|
||||
# Derive an os-release file from the host, if it exists
|
||||
if [ -e /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
grep -hE -ve '^VERSION=' -ve '^PRETTY_NAME' /etc/os-release >${initdir}/usr/lib/initrd-release
|
||||
[[ -n ${VERSION} ]] && VERSION+=" "
|
||||
[[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" "
|
||||
else
|
||||
# Fall back to synthesizing one, since dracut is presently used
|
||||
# on non-systemd systems as well.
|
||||
{
|
||||
echo NAME=dracut
|
||||
echo ID=dracut
|
||||
echo VERSION_ID=\"$DRACUT_VERSION\"
|
||||
echo ANSI_COLOR='"0;34"'
|
||||
} >${initdir}/usr/lib/initrd-release
|
||||
fi
|
||||
NAME=dracut
|
||||
ID=dracut
|
||||
VERSION+="dracut-$DRACUT_VERSION"
|
||||
PRETTY_NAME+="dracut-$DRACUT_VERSION (Initramfs)"
|
||||
VERSION_ID=$DRACUT_VERSION
|
||||
ANSI_COLOR="0;34"
|
||||
|
||||
[ -e "${initdir}/usr/lib" ] || mkdir -m 0755 -p ${initdir}/usr/lib
|
||||
{
|
||||
echo NAME=\"$NAME\"
|
||||
echo VERSION=\"$VERSION\"
|
||||
echo ID=$ID
|
||||
echo VERSION_ID=$VERSION_ID
|
||||
echo PRETTY_NAME=\"$PRETTY_NAME\"
|
||||
echo ANSI_COLOR=\"$ANSI_COLOR\"
|
||||
} > $initdir/usr/lib/initrd-release
|
||||
# This addition is relatively new, intended to allow software
|
||||
# to easily detect the dracut version if need be without
|
||||
# having it mixed in with the real underlying OS version.
|
||||
echo DRACUT_VERSION=\"${DRACUT_VERSION}\"
|
||||
} >> $initdir/usr/lib/initrd-release
|
||||
echo dracut-$DRACUT_VERSION > $initdir/lib/dracut/dracut-$DRACUT_VERSION
|
||||
ln -sf ../usr/lib/initrd-release $initdir/etc/initrd-release
|
||||
ln -sf initrd-release $initdir/usr/lib/os-release
|
||||
|
@@ -69,7 +69,7 @@ install() {
|
||||
|
||||
if [[ "$fscks" = "${fscks#*[^ ]*}" ]]; then
|
||||
_helpers="\
|
||||
umount mount /sbin/fsck*
|
||||
umount mount /sbin/fsck* /usr/sbin/fsck*
|
||||
xfs_db xfs_check xfs_repair xfs_metadump
|
||||
e2fsck jfs_fsck reiserfsck btrfsck
|
||||
"
|
||||
|
@@ -6,7 +6,13 @@
|
||||
# Harald Hoyer <harald@redhat.com>
|
||||
ACTION="$1"
|
||||
|
||||
[ -w /dev/console ] && exec </dev/console >>/dev/console 2>>/dev/console
|
||||
# Before trying to use /dev/console, verify that it exists,
|
||||
# and that it can actually be used. When console=null is used,
|
||||
# echo will fail. We do the check in a subshell, because otherwise
|
||||
# the process will be killed when when running as PID 1.
|
||||
[ -w /dev/console ] && \
|
||||
( echo </dev/console &>/dev/null ) && \
|
||||
exec </dev/console >>/dev/console 2>>/dev/console
|
||||
|
||||
export TERM=linux
|
||||
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
@@ -112,17 +118,17 @@ getarg 'rd.break=shutdown' && emergency_shell --shutdown shutdown "Break before
|
||||
|
||||
case "$ACTION" in
|
||||
reboot|poweroff|halt)
|
||||
$ACTION -f -d -n
|
||||
$ACTION -f -n
|
||||
warn "$ACTION failed!"
|
||||
;;
|
||||
kexec)
|
||||
kexec -e
|
||||
warn "$ACTION failed!"
|
||||
reboot -f -d -n
|
||||
reboot -f -n
|
||||
;;
|
||||
*)
|
||||
warn "Shutdown called with argument '$ACTION'. Rebooting!"
|
||||
reboot -f -d -n
|
||||
reboot -f -n
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@@ -10,7 +10,7 @@ depends() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
hostonly="" instmods squashfs loop overlay
|
||||
hostonly="" instmods -c squashfs loop overlay
|
||||
}
|
||||
|
||||
install() {
|
||||
|
@@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
/squash/setup-squash.sh
|
||||
|
||||
exec /shutdown.stock
|
||||
|
||||
echo "Something went wrong when trying to start original shutdown executable!"
|
||||
exit 1
|
@@ -173,14 +173,13 @@ EOF
|
||||
inst /usr/lib/systemd/system/dbus.service
|
||||
|
||||
(
|
||||
echo "FONT=latarcyrheb-sun16"
|
||||
echo "FONT=eurlatgr"
|
||||
echo "KEYMAP=us"
|
||||
) >$initrd/etc/vconsole.conf
|
||||
|
||||
# install basic keyboard maps and fonts
|
||||
for i in \
|
||||
/usr/lib/kbd/consolefonts/eurlatgr* \
|
||||
/usr/lib/kbd/consolefonts/latarcyrheb-sun16* \
|
||||
/usr/lib/kbd/keymaps/{legacy/,/}include/* \
|
||||
/usr/lib/kbd/keymaps/{legacy/,/}i386/include/* \
|
||||
/usr/lib/kbd/keymaps/{legacy/,/}i386/qwerty/us.*; do
|
||||
|
@@ -137,7 +137,8 @@ def parse_options(args):
|
||||
def main():
|
||||
try:
|
||||
options = parse_options(sys.argv[1:])
|
||||
except Usage, (msg, no_error):
|
||||
except Usage as e:
|
||||
msg, no_error = e.args
|
||||
if no_error:
|
||||
out = sys.stdout
|
||||
ret = 0
|
||||
@@ -179,12 +180,12 @@ def main():
|
||||
creator.install()
|
||||
creator.configure()
|
||||
if options.give_shell:
|
||||
print "Launching shell. Exit to continue."
|
||||
print "----------------------------------"
|
||||
print("Launching shell. Exit to continue.")
|
||||
print("----------------------------------")
|
||||
creator.launch_shell()
|
||||
creator.unmount()
|
||||
creator.package(os.environ.get("TESTDIR", "."))
|
||||
except imgcreate.CreatorError, e:
|
||||
except imgcreate.CreatorError as e:
|
||||
logging.error(u"Error creating Live CD : %s" % e)
|
||||
return 1
|
||||
finally:
|
||||
|
@@ -7,11 +7,14 @@ KVERSION="${KVERSION-$(uname -r)}"
|
||||
#DEBUGFAIL="rd.shell rd.break rd.debug systemd.log_level=debug systemd.log_target=console"
|
||||
|
||||
test_check() {
|
||||
if ! [ -d "/usr/lib/python2.7/site-packages/imgcreate" ]; then
|
||||
echo "python-imgcreate not installed"
|
||||
for pdir in $(python -c "import site; print(site.getsitepackages())" | sed -e 's/\[\(.*\)\]/\1/' -e "s/', /' /g") ; do
|
||||
pdir1=$(echo $pdir | sed "s/^'\(.*\)'$/\1/")
|
||||
if [[ -d $pdir1/imgcreate ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
echo "python-imgcreate not installed"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
test_run() {
|
||||
|
@@ -1,10 +1 @@
|
||||
all:
|
||||
@$(MAKE) -s --no-print-directory -C ../.. all
|
||||
@V=$(V) basedir=../.. testdir=../ ./test.sh --all
|
||||
setup:
|
||||
@$(MAKE) --no-print-directory -C ../.. all
|
||||
@basedir=../.. testdir=../ ./test.sh --setup
|
||||
clean:
|
||||
@basedir=../.. testdir=../ ./test.sh --clean
|
||||
run:
|
||||
@basedir=../.. testdir=../ ./test.sh --run
|
||||
-include ../Makefile.testdir
|
||||
|
@@ -27,8 +27,8 @@ test_run() {
|
||||
|
||||
mkdir -p "$rootdir/$TESTDIR"
|
||||
cp --reflink=auto -a \
|
||||
"$TESTDIR"/dracut-[0-9]*.$(arch).rpm \
|
||||
"$TESTDIR"/dracut-network-[0-9]*.$(arch).rpm \
|
||||
"$TESTDIR"/dracut-[0-9]*.$(uname -m).rpm \
|
||||
"$TESTDIR"/dracut-network-[0-9]*.$(uname -m).rpm \
|
||||
"$rootdir/$TESTDIR/"
|
||||
. /etc/os-release
|
||||
dnf_or_yum=yum
|
||||
@@ -51,10 +51,10 @@ test_run() {
|
||||
mdadm \
|
||||
bash \
|
||||
iscsi-initiator-utils \
|
||||
"$TESTDIR"/dracut-[0-9]*.$(arch).rpm \
|
||||
"$TESTDIR"/dracut-[0-9]*.$(uname -m).rpm \
|
||||
${NULL} && break
|
||||
#"$TESTDIR"/dracut-config-rescue-[0-9]*.$(arch).rpm \
|
||||
#"$TESTDIR"/dracut-network-[0-9]*.$(arch).rpm \
|
||||
#"$TESTDIR"/dracut-config-rescue-[0-9]*.$(uname -m).rpm \
|
||||
#"$TESTDIR"/dracut-network-[0-9]*.$(uname -m).rpm \
|
||||
# ${NULL}
|
||||
done
|
||||
(( i < 5 ))
|
||||
|
@@ -67,7 +67,7 @@ while (($# > 0)); do
|
||||
ret=$?
|
||||
test_cleanup
|
||||
if ((ret!=0)) && [[ -f "$TESTDIR"/server.log ]]; then
|
||||
mv [[ -f "$TESTDIR"/server.log ]] ./server${TEST_RUN_ID:+-$TEST_RUN_ID}.log
|
||||
mv "$TESTDIR"/server.log ./server${TEST_RUN_ID:+-$TEST_RUN_ID}.log
|
||||
fi
|
||||
rm -fr -- "$TESTDIR"
|
||||
rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
|
||||
|
@@ -1,29 +0,0 @@
|
||||
dash
|
||||
bridge-utils
|
||||
asciidoc
|
||||
mdadm
|
||||
lvm2
|
||||
dmraid
|
||||
cryptsetup
|
||||
nfs-utils
|
||||
nbd
|
||||
dhcp-server
|
||||
dhcp
|
||||
scsi-target-utils
|
||||
iscsi-initiator-utils
|
||||
net-tools
|
||||
strace
|
||||
syslinux
|
||||
python-imgcreate
|
||||
genisoimage
|
||||
btrfs-progs
|
||||
bridge-utils
|
||||
kmod-devel
|
||||
gcc
|
||||
gzip
|
||||
bzip2
|
||||
xz
|
||||
tar
|
||||
wget
|
||||
rpm-build
|
||||
util-linux
|
Reference in New Issue
Block a user