Compare commits
158 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7893469fca | ||
![]() |
4765889b2e | ||
![]() |
b038e0aac9 | ||
![]() |
d8bf119dd2 | ||
![]() |
d083dd4c39 | ||
![]() |
b52294d00b | ||
![]() |
802e7e1c2e | ||
![]() |
be1762caff | ||
![]() |
6a2a1ea75f | ||
![]() |
565f6fb675 | ||
![]() |
f2c6909468 | ||
![]() |
0e6a94b329 | ||
![]() |
cae57c60a1 | ||
![]() |
657d68cfff | ||
![]() |
20636ce09f | ||
![]() |
168fa7e571 | ||
![]() |
55468fb9b3 | ||
![]() |
7ed1de2f1d | ||
![]() |
c30c65c1b2 | ||
![]() |
2627d8a345 | ||
![]() |
5fe5c7d0b1 | ||
![]() |
0d8c1d7fa1 | ||
![]() |
0216d1cda3 | ||
![]() |
8b2896f9fa | ||
![]() |
e2c5015713 | ||
![]() |
e639630da4 | ||
![]() |
ce4359ea85 | ||
![]() |
9b30d4793d | ||
![]() |
dd483f4f42 | ||
![]() |
543f39cb52 | ||
![]() |
4826b9b0d5 | ||
![]() |
683db19a7d | ||
![]() |
1021371daf | ||
![]() |
6a0b3ccf4e | ||
![]() |
b938443e2f | ||
![]() |
7db18ccd13 | ||
![]() |
c3b0d83ddf | ||
![]() |
785a6cd21c | ||
![]() |
6f22336784 | ||
![]() |
3da7836035 | ||
![]() |
23b28c0ab5 | ||
![]() |
7573ac58f2 | ||
![]() |
6787b8ccee | ||
![]() |
00dd4db5d2 | ||
![]() |
7417574cdb | ||
![]() |
f7c05c5514 | ||
![]() |
29b10e65b1 | ||
![]() |
982e78234c | ||
![]() |
c09a9932b8 | ||
![]() |
7aa622cd14 | ||
![]() |
37b73a235a | ||
![]() |
beb015706b | ||
![]() |
6e43debe67 | ||
![]() |
09a19bb1ba | ||
![]() |
0279111026 | ||
![]() |
f58c3ccf44 | ||
![]() |
3b403b32fc | ||
![]() |
e2cdb570ae | ||
![]() |
9a5393ac7e | ||
![]() |
da5f8554a4 | ||
![]() |
ba902275d5 | ||
![]() |
3909d7edfc | ||
![]() |
2f95d699dc | ||
![]() |
d04de5fdd0 | ||
![]() |
f584c502a6 | ||
![]() |
3cf14ae1ae | ||
![]() |
7c18802966 | ||
![]() |
424ecce632 | ||
![]() |
6019e1053c | ||
![]() |
aad6898fe4 | ||
![]() |
44110df25a | ||
![]() |
c99014d5ef | ||
![]() |
a7ee1cd7f6 | ||
![]() |
c3f7567a65 | ||
![]() |
ba7457ee00 | ||
![]() |
7b069d5ea7 | ||
![]() |
c34130f705 | ||
![]() |
cc8f077e9f | ||
![]() |
ccacb45c52 | ||
![]() |
1325cddee9 | ||
![]() |
80df37f475 | ||
![]() |
979c4a9304 | ||
![]() |
4257798f8a | ||
![]() |
12b9736228 | ||
![]() |
64fcb3cce7 | ||
![]() |
336eb5b04c | ||
![]() |
f024bf0dcd | ||
![]() |
fd786adcf5 | ||
![]() |
0743486127 | ||
![]() |
bf512ee2e0 | ||
![]() |
b99dc517d6 | ||
![]() |
6a168568a5 | ||
![]() |
dbad9f4661 | ||
![]() |
7eb40c488c | ||
![]() |
2a9b703903 | ||
![]() |
65e0dd452c | ||
![]() |
5d7cdc38d0 | ||
![]() |
e1f68dc6a0 | ||
![]() |
06ae51be51 | ||
![]() |
8a6ecb19b9 | ||
![]() |
1254925f1e | ||
![]() |
a6c34848eb | ||
![]() |
182660d864 | ||
![]() |
3fc621ee45 | ||
![]() |
8234b92d85 | ||
![]() |
6822764f25 | ||
![]() |
0d837ebf2a | ||
![]() |
8f5d36896d | ||
![]() |
e365864bbc | ||
![]() |
df60555037 | ||
![]() |
6730280c5b | ||
![]() |
fb59f4c967 | ||
![]() |
77e2cadd88 | ||
![]() |
a2cb4dbc82 | ||
![]() |
36e30eb096 | ||
![]() |
03f405bc04 | ||
![]() |
4abb498d79 | ||
![]() |
ef85627e93 | ||
![]() |
486ec65745 | ||
![]() |
dd26a551c2 | ||
![]() |
93724aa28f | ||
![]() |
4c2a28c64b | ||
![]() |
2a72df9cf0 | ||
![]() |
6600691ff1 | ||
![]() |
d125a47061 | ||
![]() |
8daaa46478 | ||
![]() |
0a9d5422c6 | ||
![]() |
02c1bd6bb6 | ||
![]() |
1cd1da13da | ||
![]() |
ea8ca78af0 | ||
![]() |
dc4fc03e4b | ||
![]() |
76353076c0 | ||
![]() |
829c258554 | ||
![]() |
5dcd565dab | ||
![]() |
7838d85351 | ||
![]() |
db59288d79 | ||
![]() |
82794b4b90 | ||
![]() |
b4fbdbbe1e | ||
![]() |
9853774351 | ||
![]() |
79471f365e | ||
![]() |
98b108284c | ||
![]() |
8ee30d09a4 | ||
![]() |
01583ae4ad | ||
![]() |
249f8b5bfc | ||
![]() |
561d7f4d7c | ||
![]() |
4ad453445a | ||
![]() |
e620bb01da | ||
![]() |
7931bf0420 | ||
![]() |
c174aea07d | ||
![]() |
85323dcbb9 | ||
![]() |
8bc650d9dc | ||
![]() |
ea216a650e | ||
![]() |
a16ebfd56a | ||
![]() |
2aad23443e | ||
![]() |
8a5354a9a5 | ||
![]() |
dbf381f7fb | ||
![]() |
1080ce600a | ||
![]() |
0dd37f13c5 |
16
.gitignore
vendored
16
.gitignore
vendored
@@ -1,8 +1,10 @@
|
||||
/dracut.8
|
||||
/dracut-catimages.8
|
||||
/dracut.conf.5
|
||||
/dracut.conf.d/*.conf
|
||||
/dracut-gencmdline.8
|
||||
/dracut.html
|
||||
/dracut.kernel.7
|
||||
/modules.d/99base/switch_root
|
||||
/test/*/test.log
|
||||
test*.img
|
||||
modules.d/99base/switch_root
|
||||
*~
|
||||
dracut.kernel.7
|
||||
dracut.conf.5
|
||||
dracut.8
|
||||
dracut-catimages.8
|
||||
dracut-gencmdline.8
|
||||
|
6
HACKING
6
HACKING
@@ -1,11 +1,11 @@
|
||||
Right now, most of the testing is done using a qemu/kvm guest and
|
||||
generating the initramfs on another box but the support is all present
|
||||
to build for the "running" machine. For the former, you can boot the guest
|
||||
using qemu's -kernel and -initrd options.
|
||||
using qemu's -kernel and -initrd options.
|
||||
|
||||
dracut exists and will build an image. It is command-line equivalent
|
||||
to most mkinitrd implementations and should be pretty straight-forward
|
||||
to use.
|
||||
to use.
|
||||
|
||||
To use, just run dracut with an output file name and, optionally, a
|
||||
kernel version (it defaults to using the current). The appropriate
|
||||
@@ -14,7 +14,7 @@ like to customize the list of modules copied in, edit /etc/dracut.conf
|
||||
and set
|
||||
dracutmodules="foo bar baz"
|
||||
|
||||
Note that dracut calls functional components in modules.d "modules"
|
||||
Note that dracut calls functional components in modules.d "modules"
|
||||
while kernel modules are called "drivers".
|
||||
|
||||
Requirements:
|
||||
|
53
Makefile
53
Makefile
@@ -1,4 +1,4 @@
|
||||
VERSION=009
|
||||
VERSION=011
|
||||
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
|
||||
|
||||
prefix ?= /usr
|
||||
@@ -10,15 +10,10 @@ mandir ?= ${prefix}/share/man
|
||||
|
||||
manpages = dracut.8 dracut.kernel.7 dracut.conf.5 dracut-catimages.8 dracut-gencmdline.8
|
||||
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS doc
|
||||
|
||||
ifeq (1,${WITH_SWITCH_ROOT})
|
||||
targets = modules.d/99base/switch_root
|
||||
else
|
||||
targets =
|
||||
endif
|
||||
|
||||
all: $(targets) $(manpages) dracut.html
|
||||
doc: $(manpages) dracut.html
|
||||
all: syncheck
|
||||
|
||||
%: %.xml
|
||||
xsltproc -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
|
||||
@@ -29,10 +24,7 @@ dracut.html: dracut.xml $(manpages)
|
||||
--stringparam html.stylesheet http://docs.redhat.com/docs/en-US/Common_Content/css/default.css \
|
||||
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
|
||||
|
||||
modules.d/99base/switch_root: switch_root.c
|
||||
gcc -D _GNU_SOURCE -D 'PACKAGE_STRING="dracut"' -std=gnu99 -fsigned-char -g -O2 -o modules.d/99base/switch_root switch_root.c
|
||||
|
||||
install:
|
||||
install: doc
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)
|
||||
mkdir -p $(DESTDIR)$(sbindir)
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)
|
||||
@@ -43,9 +35,6 @@ install:
|
||||
install -m 0755 dracut-catimages $(DESTDIR)$(sbindir)/dracut-catimages
|
||||
install -m 0755 mkinitrd-dracut.sh $(DESTDIR)$(sbindir)/mkinitrd
|
||||
install -m 0755 lsinitrd $(DESTDIR)$(sbindir)/lsinitrd
|
||||
ifeq (1,${WITH_SWITCH_ROOT})
|
||||
install -m 0755 modules.d/99base/switch_root $(DESTDIR)$(sbindir)/switch_root
|
||||
endif
|
||||
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
|
||||
install -m 0755 dracut-functions $(DESTDIR)$(pkglibdir)/dracut-functions
|
||||
@@ -56,15 +45,11 @@ endif
|
||||
install -m 0644 dracut-gencmdline.8 $(DESTDIR)$(mandir)/man8
|
||||
install -m 0644 dracut.conf.5 $(DESTDIR)$(mandir)/man5
|
||||
install -m 0644 dracut.kernel.7 $(DESTDIR)$(mandir)/man7
|
||||
ifeq (1,${WITH_SWITCH_ROOT})
|
||||
rm $(DESTDIR)$(pkglibdir)/modules.d/99base/switch_root
|
||||
endif
|
||||
|
||||
clean:
|
||||
$(RM) *~
|
||||
$(RM) */*~
|
||||
$(RM) */*/*~
|
||||
$(RM) modules.d/99base/switch_root
|
||||
$(RM) test-*.img
|
||||
$(RM) dracut-*.rpm dracut-*.tar.bz2
|
||||
$(RM) $(manpages) dracut.html
|
||||
@@ -72,27 +57,23 @@ clean:
|
||||
|
||||
archive: dracut-$(VERSION)-$(GITVERSION).tar.bz2
|
||||
|
||||
dist: dracut-$(VERSION).tar.bz2
|
||||
dist: dracut-$(VERSION).tar.gz
|
||||
|
||||
dracut-$(VERSION).tar.bz2:
|
||||
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ |bzip2 > dracut-$(VERSION).tar.bz2
|
||||
|
||||
dracut-$(VERSION)-$(GITVERSION).tar.bz2:
|
||||
git archive --format=tar HEAD --prefix=dracut-$(VERSION)-$(GITVERSION)/ |bzip2 > dracut-$(VERSION)-$(GITVERSION).tar.bz2
|
||||
dracut-$(VERSION).tar.gz:
|
||||
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ |gzip > dracut-$(VERSION).tar.gz
|
||||
|
||||
|
||||
rpm: clean dracut-$(VERSION).tar.bz2
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" -ba dracut.spec
|
||||
rm -fr BUILD BUILDROOT
|
||||
|
||||
gitrpm: dracut-$(VERSION)-$(GITVERSION).tar.bz2
|
||||
echo "%define gittag $(GITVERSION)" > dracut.spec.git
|
||||
cat dracut.spec >> dracut.spec.git
|
||||
mv dracut.spec dracut.spec.bak
|
||||
mv dracut.spec.git dracut.spec
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" --define "gittag $(GITVERSION)" -ba dracut.spec || :
|
||||
mv dracut.spec.bak dracut.spec
|
||||
rm -fr BUILD BUILDROOT
|
||||
rpm: dracut-$(VERSION).tar.bz2
|
||||
mkdir -p rpmbuild
|
||||
cp dracut-$(VERSION).tar.bz2 rpmbuild
|
||||
cd rpmbuild; ../git2spec.pl $(VERSION) < ../dracut.spec > dracut.spec; \
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
|
||||
--define "_rpmdir $$PWD" -ba dracut.spec || :; \
|
||||
cd ..;
|
||||
mv rpmbuild/noarch/*.rpm .; mv rpmbuild/*.src.rpm .;rm -fr rpmbuild; ls *.rpm
|
||||
|
||||
syncheck:
|
||||
@ret=0;for i in dracut-logger modules.d/99base/init modules.d/*/*.sh; do \
|
||||
|
78
NEWS
78
NEWS
@@ -1,3 +1,17 @@
|
||||
dracut-011
|
||||
==========
|
||||
- use udev-168 features for shutting down udev
|
||||
- introduce "--prefix" to put all initramfs files in e.g "/run/initramfs"
|
||||
- new shutdown script (called by systemd >= 030) to disassemble the root device
|
||||
- lots of bugfixes
|
||||
- new module for gpg-encrypted keys - 91crypt-gpg
|
||||
|
||||
dracut-010
|
||||
==========
|
||||
- lots of bugfixes
|
||||
- plymouth: use /run/plymouth/pid instead of /run/initramfs/plymouth
|
||||
- add "/lib/firmware/updates" to default firmware path
|
||||
|
||||
dracut-009
|
||||
==========
|
||||
- dracut generator
|
||||
@@ -56,7 +70,7 @@ dracut-006
|
||||
- add btrfsctl scan for btrfs multi-devices (raid)
|
||||
- teach dmsquash live-root to use rootflags
|
||||
- trigger udev with action=add
|
||||
- fixed add_drivers handling
|
||||
- fixed add_drivers handling
|
||||
- add sr_mod
|
||||
- use pigz instead of gzip, if available
|
||||
- boot from LVM mirrors and snapshots
|
||||
@@ -69,7 +83,7 @@ dracut-006
|
||||
|
||||
dracut-005
|
||||
==========
|
||||
- dcb support to dracut's FCoE support
|
||||
- dcb support to dracut's FCoE support
|
||||
- add readonly overlay support for dmsquash
|
||||
- add keyboard kernel modules
|
||||
- dracut.conf: added add_dracutmodules
|
||||
@@ -107,7 +121,7 @@ dracut-003
|
||||
- add s390 network support
|
||||
- fixed dracut-gencmdline for root=UUID or LABEL
|
||||
- do not destroy assembled raid arrays if mdadm.conf present
|
||||
- mount /dev/shm
|
||||
- mount /dev/shm
|
||||
- let udevd not resolve group and user names
|
||||
- moved network from udev to initqueue
|
||||
- improved debug output: specifying "rdinitdebug" now logs
|
||||
@@ -115,7 +129,7 @@ dracut-003
|
||||
- strip kernel modules which have no x bit set
|
||||
- redirect stdin, stdout, stderr all RW to /dev/console
|
||||
so the user can use "less" to view /init.log and dmesg
|
||||
- add new device mapper udev rules and dmeventd
|
||||
- add new device mapper udev rules and dmeventd
|
||||
- fixed dracut-gencmdline for root=UUID or LABEL
|
||||
- do not destroy assembled raid arrays if mdadm.conf present
|
||||
- mount /dev/shm
|
||||
@@ -160,17 +174,17 @@ dracut-001
|
||||
Supported cmdline formats:
|
||||
fcoe=<networkdevice>:<dcb|nodcb>
|
||||
fcoe=<macaddress>:<dcb|nodcb>
|
||||
|
||||
|
||||
Note currently only nodcb is supported, the dcb option is reserved for
|
||||
future use.
|
||||
|
||||
|
||||
Note letters in the macaddress must be lowercase!
|
||||
|
||||
|
||||
Examples:
|
||||
fcoe=eth0:nodcb
|
||||
fcoe=4A:3F:4C:04:F8:D7:nodcb
|
||||
|
||||
- Syslog support for dracut
|
||||
- Syslog support for dracut
|
||||
This module provides syslog functionality in the initrd.
|
||||
This is especially interesting when complex configuration being
|
||||
used to provide access to the device the rootfs resides on.
|
||||
@@ -197,20 +211,20 @@ dracut-0.8
|
||||
dracut-0.7
|
||||
==========
|
||||
- dracut: strip binaries in initramfs
|
||||
|
||||
|
||||
--strip
|
||||
strip binaries in the initramfs (default)
|
||||
|
||||
|
||||
--nostrip
|
||||
do not strip binaries in the initramfs
|
||||
- dracut-catimages
|
||||
|
||||
|
||||
Usage: ./dracut-catimages [OPTION]... <initramfs> <base image>
|
||||
[<image>...]
|
||||
Creates initial ramdisk image by concatenating several images from the
|
||||
command
|
||||
line and /boot/dracut/
|
||||
|
||||
|
||||
-f, --force Overwrite existing initramfs file.
|
||||
-i, --imagedir Directory with additional images to add
|
||||
(default: /boot/dracut/)
|
||||
@@ -227,44 +241,44 @@ dracut-0.7
|
||||
dracut-0.6
|
||||
==========
|
||||
- dracut: add --kernel-only and --no-kernel arguments
|
||||
|
||||
|
||||
--kernel-only
|
||||
only install kernel drivers and firmware files
|
||||
|
||||
|
||||
--no-kernel
|
||||
do not install kernel drivers and firmware files
|
||||
|
||||
|
||||
All kernel module related install commands moved from "install"
|
||||
to "installkernel".
|
||||
|
||||
|
||||
For "--kernel-only" all installkernel scripts of the specified
|
||||
modules are used, regardless of any checks, so that all modules
|
||||
which might be needed by any dracut generic image are in.
|
||||
|
||||
|
||||
The basic idea is to create two images. One image with the kernel
|
||||
modules and one without. So if the kernel changes, you only have
|
||||
to replace one image.
|
||||
|
||||
|
||||
Grub and the kernel can handle multiple images, so grub entry can
|
||||
look like this:
|
||||
|
||||
|
||||
title Fedora (2.6.29.5-191.fc11.i586)
|
||||
root (hd0,0)
|
||||
kernel /vmlinuz-2.6.29.5-191.fc11.i586 ro rhgb quiet
|
||||
initrd /initrd-20090722.img /initrd-kernel-2.6.29.5-191.fc11.i586.img /initrd-config.img
|
||||
|
||||
|
||||
initrd-20090722.img
|
||||
the image provided by the initrd rpm
|
||||
one old backup version is kept like with the kernel
|
||||
|
||||
|
||||
initrd-kernel-2.6.29.5-191.fc11.i586.img
|
||||
the image provided by the kernel rpm
|
||||
|
||||
|
||||
initrd-config.img
|
||||
optional image with local configuration files
|
||||
|
||||
- dracut: add --kmoddir directory, where to look for kernel modules
|
||||
|
||||
|
||||
-k, --kmoddir [DIR]
|
||||
specify the directory, where to look for kernel modules
|
||||
|
||||
@@ -284,18 +298,18 @@ dracut-0.4
|
||||
- firmware loading support
|
||||
- new internal queue (initqueue)
|
||||
initqueue now loops until /dev/root exists or root is mounted
|
||||
|
||||
|
||||
init now has the following points to inject scripts:
|
||||
|
||||
|
||||
/cmdline/*.sh
|
||||
scripts for command line parsing
|
||||
|
||||
|
||||
/pre-udev/*.sh
|
||||
scripts to run before udev is started
|
||||
|
||||
|
||||
/pre-trigger/*.sh
|
||||
scripts to run before the main udev trigger is pulled
|
||||
|
||||
|
||||
/initqueue/*.sh
|
||||
runs in parallel to the udev trigger
|
||||
Udev events can add scripts here with /sbin/initqueue.
|
||||
@@ -307,12 +321,12 @@ dracut-0.4
|
||||
filesystem was mounted, the user will be dropped to a shell after
|
||||
a timeout.
|
||||
Scripts can remove themselves from the initqueue by "rm $job".
|
||||
|
||||
|
||||
/pre-mount/*.sh
|
||||
scripts to run before the root filesystem is mounted
|
||||
NFS is an exception, because it has no device node to be created
|
||||
and mounts in the udev events
|
||||
|
||||
|
||||
/mount/*.sh
|
||||
scripts to mount the root filesystem
|
||||
NFS is an exception, because it has no device node to be created
|
||||
@@ -320,12 +334,12 @@ dracut-0.4
|
||||
If the udev queue is empty and no root device is found or no root
|
||||
filesystem was mounted, the user will be dropped to a shell after
|
||||
a timeout.
|
||||
|
||||
|
||||
/pre-pivot/*.sh
|
||||
scripts to run before the real init is executed and the initramfs
|
||||
disappears
|
||||
All processes started before should be killed here.
|
||||
|
||||
|
||||
The behaviour of the dmraid module demonstrates how to use the new
|
||||
mechanism. If it detects a device which is part of a raidmember from a
|
||||
udev rule, it installs a job to scan for dmraid devices, if the udev
|
||||
|
4
PKGBUILD
4
PKGBUILD
@@ -3,7 +3,7 @@ pkgver=$(date +%s)
|
||||
pkgrel=$(git log --pretty=format:%h |head -n 1)
|
||||
pkgdesc="Initramfs generation utility"
|
||||
arch=('i686' 'x86_64')
|
||||
url="http://sourceforge.net/apps/trac/dracut/"
|
||||
url="https://dracut.wiki.kernel.org/"
|
||||
license=('GPL')
|
||||
conflicts=('dracut' 'mkinitcpio')
|
||||
provides=('dracut=9999' 'mkinitcpio=9999')
|
||||
@@ -18,4 +18,4 @@ build() {
|
||||
cd ..
|
||||
make sysconfdir=/etc || return 1
|
||||
make DESTDIR="${pkgdir}" sysconfdir=/etc install || return 1
|
||||
}
|
||||
}
|
||||
|
60
README
60
README
@@ -2,8 +2,8 @@ Dracut
|
||||
------
|
||||
Dracut is a new initramfs infrastructure.
|
||||
|
||||
Information about the initial goals and aims can be found at
|
||||
https://fedoraproject.org/wiki/Initrdrewrite
|
||||
Information about the initial goals and aims can be found at
|
||||
https://fedoraproject.org/wiki/Initrdrewrite
|
||||
|
||||
Unlike existing initramfs's, this is an attempt at having as little as
|
||||
possible hard-coded into the initramfs as possible. The initramfs has
|
||||
@@ -19,19 +19,19 @@ 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 initrd generation functionality in dracut is provided by a bunch
|
||||
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 initrd. They live in the modules.d
|
||||
subdirectory, and use functionality provided by dracut-functions to do their
|
||||
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 initrd. They handle mangling the pathnames and (for binaries,
|
||||
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 initrd should be POSIX compliant. dracut
|
||||
will try to use /bin/dash as /bin/sh for the initrd if it is available,
|
||||
* 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,
|
||||
@@ -44,35 +44,41 @@ Some general rules for writing 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.
|
||||
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 sourceforge.
|
||||
Currently dracut lives on 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 Web:
|
||||
http://git.kernel.org/?p=boot/dracut/dracut.git
|
||||
|
||||
Git Web RSS Feed:
|
||||
http://git.kernel.org/?p=boot/dracut/dracut.git;a=rss
|
||||
|
||||
Project Page:
|
||||
https://sourceforge.net/projects/dracut/
|
||||
http://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html
|
||||
|
||||
Drop Harald Hoyer <harald@redhat.com> a mail, if you want to help with
|
||||
the documentation, git access, etc.
|
||||
Project Wiki:
|
||||
http://dracut.wiki.kernel.org
|
||||
|
||||
Git Repository:
|
||||
http://dracut.git.sourceforge.net/
|
||||
git://dracut.git.sourceforge.net/gitroot/dracut/dracut
|
||||
|
||||
Trac Instance:
|
||||
http://apps.sourceforge.net/trac/dracut/
|
||||
|
||||
The git tree can be found at
|
||||
git://dracut.git.sourceforge.net/gitroot/dracut/dracut for now. 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'
|
||||
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
|
||||
|
@@ -1,7 +1,7 @@
|
||||
To build a generic initramfs, you have to install the following software packages:
|
||||
* device-mapper
|
||||
* cryptsetup-luks
|
||||
* rpcbind nfs-utils
|
||||
* rpcbind nfs-utils
|
||||
* lvm2
|
||||
* iscsi-initiator-utils
|
||||
* nbd
|
||||
|
@@ -4,7 +4,7 @@ structure:
|
||||
|
||||
dracut_install_dir/modules.d/
|
||||
00modname/
|
||||
install
|
||||
module-setup.sh
|
||||
check
|
||||
<other files as needed by the hook>
|
||||
|
||||
@@ -12,45 +12,55 @@ dracut_install_dir/modules.d/
|
||||
The numeric code must be present and in the range of 00 - 99.
|
||||
Modules with lower numbers are installed first. This is important
|
||||
because the dracut install functions (which install files onto
|
||||
the initrd) refuse to overwrite already installed files. This makes
|
||||
it easy for an earlier module to override the functionality of a
|
||||
the initrd) refuse to overwrite already installed files. This makes
|
||||
it easy for an earlier module to override the functionality of a
|
||||
later module, so that you can have a distro or system specific
|
||||
module override or modify the functionality of a generic module
|
||||
without having to patch the more generic module.
|
||||
|
||||
install: dracut sources this script to install the functionality that a
|
||||
module-setup.sh:
|
||||
dracut sources this script to install the functionality that a
|
||||
module implements onto the initrd. For the most part, this amounts
|
||||
to copying files from the host system onto the initrd in a controlled
|
||||
manner. dracut supplies several install functions that are
|
||||
manner.
|
||||
|
||||
install():
|
||||
This function of module-setup.sh is called to install all
|
||||
non-kernel files. dracut supplies several install functions that are
|
||||
specialized for different file types. Browse through dracut-functions
|
||||
fore more details. dracut also provides a $moddir variable if you
|
||||
need to install a file from the module directory, such as an initrd
|
||||
hook, a udev rule, or a specialized executable.
|
||||
|
||||
check: Dracut calls this program to check and see if a module can be installed
|
||||
installkernel():
|
||||
This function of module-setup.sh is called to install all
|
||||
kernel related files.
|
||||
|
||||
|
||||
check():
|
||||
Dracut calls this function to check and see if a module can be installed
|
||||
on the initrd.
|
||||
|
||||
|
||||
When called without options, check should check to make sure that
|
||||
any files it needs to install into the initrd from the host system
|
||||
are present. It should exit with a 0 if they are, and a 1 if they are
|
||||
not.
|
||||
|
||||
When called with -h, it should perform the same check that it would
|
||||
without any options, and it should also check to see if the
|
||||
When called with $hostonly set, it should perform the same check
|
||||
that it would without it set, and it should also check to see if the
|
||||
functionality the module implements is being used on the host system.
|
||||
For example, if this module handles installing support for LUKS
|
||||
encrypted volumes, it should return 0 if all the tools to handle
|
||||
encrpted volumes are available and the host system has the root
|
||||
partition on an encrypted volume, 1 otherwise.
|
||||
|
||||
When called with -d, it should output a list of dracut modules
|
||||
depends():
|
||||
This function should output a list of dracut modules
|
||||
that it relies upon. An example would be the nfs and iscsi modules,
|
||||
which rely on the network module to detect and configure network
|
||||
interfaces.
|
||||
|
||||
Check may take additional options in the future.
|
||||
|
||||
Any other files in the module will not be touched by dracut directly.
|
||||
Any other files in the module will not be touched by dracut directly.
|
||||
|
||||
You are encouraged to provide a README that describes what the module is for.
|
||||
|
||||
@@ -60,39 +70,39 @@ HOOKS
|
||||
|
||||
init has the following hook points to inject scripts:
|
||||
|
||||
/cmdline/*.sh
|
||||
/lib/dracut/hooks/cmdline/*.sh
|
||||
scripts for command line parsing
|
||||
|
||||
/pre-udev/*.sh
|
||||
/lib/dracut/hooks/pre-udev/*.sh
|
||||
scripts to run before udev is started
|
||||
|
||||
/pre-trigger/*.sh
|
||||
/lib/dracut/hooks/pre-trigger/*.sh
|
||||
scripts to run before the main udev trigger is pulled
|
||||
|
||||
/initqueue/*.sh
|
||||
/lib/dracut/hooks/initqueue/*.sh
|
||||
runs in parallel to the udev trigger
|
||||
Udev events can add scripts here with /sbin/initqueue.
|
||||
If /sbin/initqueue is called with the "--onetime" option, the script
|
||||
will be removed after it was run.
|
||||
If /initqueue/work is created and udev >= 143 then this loop can
|
||||
process the jobs in parallel to the udevtrigger.
|
||||
If /lib/dracut/hooks/initqueue/work is created and udev >= 143 then
|
||||
this loop can process the jobs in parallel to the udevtrigger.
|
||||
If the udev queue is empty and no root device is found or no root
|
||||
filesystem was mounted, the user will be dropped to a shell after
|
||||
a timeout.
|
||||
Scripts can remove themselves from the initqueue by "rm $job".
|
||||
|
||||
/pre-mount/*.sh
|
||||
/lib/dracut/hooks/pre-mount/*.sh
|
||||
scripts to run before the root filesystem is mounted
|
||||
Network filesystems like NFS that do not use device files are an
|
||||
Network filesystems like NFS that do not use device files are an
|
||||
exception. Root can be mounted already at this point.
|
||||
|
||||
/mount/*.sh
|
||||
/lib/dracut/hooks/mount/*.sh
|
||||
scripts to mount the root filesystem
|
||||
If the udev queue is empty and no root device is found or no root
|
||||
filesystem was mounted, the user will be dropped to a shell after
|
||||
a timeout.
|
||||
|
||||
/pre-pivot/*.sh
|
||||
/lib/dracut/hooks/pre-pivot/*.sh
|
||||
scripts to run before the real init is executed and the initramfs
|
||||
disappears
|
||||
All processes started before should be killed here.
|
||||
|
23
TODO
23
TODO
@@ -1,2 +1,23 @@
|
||||
See https://sourceforge.net/apps/trac/dracut/wiki/TODO
|
||||
Current TODO list, broken into things which are relevant for the initramfs itself (/init et al) vs the generator. A lot of things are/should be marked with "FIXME" in the code
|
||||
INITRAMFS TODO
|
||||
|
||||
- The hard-coded list of udev rules that we care about is kind of lame.
|
||||
- automatic kexec fallback
|
||||
- panic fallback
|
||||
|
||||
GENERATOR TODO
|
||||
|
||||
- Default module specification could use some work
|
||||
- udev rule copying, as mentioned above, is a bit too hard-coded
|
||||
- pkg-config integration, to make it easy for other packages to use us.
|
||||
- add recovery image creator (mkrecovery)
|
||||
|
||||
CODE TODO
|
||||
- document functions
|
||||
- make function vars local, and prefix with "_"
|
||||
|
||||
Future Enhancement Requests
|
||||
|
||||
- run ssh server to enter crypto password or perform debugging (supported by debian)
|
||||
- Bug 524727 - Dracut + encrypted root + networking
|
||||
|
||||
|
4
debian/control
vendored
4
debian/control
vendored
@@ -4,8 +4,8 @@ Priority: optional
|
||||
Maintainer: Philippe Seewer <philippe.seewer@bfh.ch>
|
||||
Build-Depends: debhelper (>= 5.0), cdbs
|
||||
Standards-Version: 3.8.4
|
||||
Vcs-Browser: http://dracut.git.sourceforge.net/git/gitweb-index.cgi
|
||||
Vcs-Git: git://dracut.git.sourceforge.net/gitroot/dracut/dracut
|
||||
Vcs-Browser: http://git.kernel.org/?p=boot/dracut/dracut.git
|
||||
Vcs-Git: git://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
|
||||
Package: dracut
|
||||
Architecture: all
|
||||
|
2
debian/copyright
vendored
2
debian/copyright
vendored
@@ -3,7 +3,7 @@ Fri Nov 20 15:45:00 +0100
|
||||
|
||||
Sources can be downloaded from:
|
||||
|
||||
https://sourceforge.net/projects/dracut/
|
||||
http://www.kernel.org/pub/linux/utils/boot/dracut/
|
||||
|
||||
Upstream Maintainer:
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
|
170
dracut
170
dracut
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
#
|
||||
# Generator script for a dracut initramfs
|
||||
# Tries to retain some degree of compatibility with the command line
|
||||
# of the various mkinitrd implementations out there
|
||||
@@ -40,19 +40,21 @@ Creates initial ramdisk images for preloading modules
|
||||
-a, --add [LIST] Add a space-separated list of dracut modules.
|
||||
-d, --drivers [LIST] Specify a space-separated list of kernel modules to
|
||||
exclusively include in the initramfs.
|
||||
--add-drivers [LIST] Specify a space-separated list of kernel
|
||||
--add-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules to add to the initramfs.
|
||||
--filesystems [LIST] Specify a space-separated list of kernel filesystem
|
||||
modules to exclusively include in the generic
|
||||
initramfs.
|
||||
-k, --kmoddir [DIR] Specify the directory, where to look for kernel
|
||||
-k, --kmoddir [DIR] Specify the directory, where to look for kernel
|
||||
modules
|
||||
--fwdir [DIR] Specify additional directories, where to look for
|
||||
--fwdir [DIR] Specify additional directories, where to look for
|
||||
firmwares, separated by :
|
||||
--kernel-only Only install kernel drivers and firmware files
|
||||
--no-kernel Do not install kernel drivers and firmware files
|
||||
--strip Strip binaries in the initramfs
|
||||
--nostrip Do not strip binaries in the initramfs (default)
|
||||
--prefix [DIR] Prefix initramfs files with [DIR]
|
||||
--noprefix Do not prefix initramfs files (default)
|
||||
--mdadmconf Include local /etc/mdadm.conf
|
||||
--nomdadmconf Do not include local /etc/mdadm.conf
|
||||
--lvmconf Include local /etc/lvm/lvm.conf
|
||||
@@ -71,7 +73,7 @@ Creates initial ramdisk images for preloading modules
|
||||
-q, --quiet Decrease verbosity level (default is info(4))
|
||||
-c, --conf [FILE] Specify configuration file to use.
|
||||
Default: /etc/dracut.conf
|
||||
--confdir [DIR] Specify configuration directory to use *.conf files
|
||||
--confdir [DIR] Specify configuration directory to use *.conf files
|
||||
from. Default: /etc/dracut.conf.d
|
||||
-l, --local Local mode. Use modules from the current working
|
||||
directory instead of the system-wide installed in
|
||||
@@ -83,7 +85,7 @@ Creates initial ramdisk images for preloading modules
|
||||
-i, --include [SOURCE] [TARGET]
|
||||
Include the files in the SOURCE directory into the
|
||||
Target directory in the final initramfs.
|
||||
If SOURCE is a file, it will be installed to TARGET
|
||||
If SOURCE is a file, it will be installed to TARGET
|
||||
in the final initramfs.
|
||||
-I, --install [LIST] Install the space separated list of files into the
|
||||
initramfs.
|
||||
@@ -94,20 +96,21 @@ Creates initial ramdisk images for preloading modules
|
||||
Make sure your kernel has bzip2 decompression support
|
||||
compiled in, otherwise you will not be able to boot.
|
||||
--lzma Compress the generated initramfs using lzma.
|
||||
Make sure your kernel has lzma support compiled in,
|
||||
Make sure your kernel has lzma support compiled in,
|
||||
otherwise you will not be able to boot.
|
||||
--xz Compress the generated initramfs using xz.
|
||||
Make sure that your kernel has xz support compiled
|
||||
in, otherwise you will not be able to boot.
|
||||
--compress [COMPRESSION] Compress the generated initramfs with the
|
||||
passed compression program. Make sure your kernel
|
||||
knows how to decompress the generated initramfs,
|
||||
knows how to decompress the generated initramfs,
|
||||
otherwise you will not be able to boot.
|
||||
--no-compress Do not compress the generated initramfs. This will
|
||||
override any other compression options.
|
||||
--list-modules List all available dracut modules.
|
||||
-M, --show-modules Print included module's name to standard output during
|
||||
build.
|
||||
--keep Keep the temporary initramfs for debugging purposes
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -135,7 +138,7 @@ push() {
|
||||
# val=$(pop stack)
|
||||
pop() {
|
||||
local __stack=$1; shift
|
||||
local __resultvar=$1
|
||||
local __resultvar=$1
|
||||
local myresult;
|
||||
# check for empty stack
|
||||
eval '[[ ${#'${__stack}'[@]} -eq 0 ]] && return 1'
|
||||
@@ -187,7 +190,6 @@ push_arg() {
|
||||
fi
|
||||
}
|
||||
|
||||
kernel="unset"
|
||||
verbosity_mod_l=0
|
||||
|
||||
while (($# > 0)); do
|
||||
@@ -207,11 +209,13 @@ while (($# > 0)); do
|
||||
-I|--install) read_arg install_items "$@" || shift;;
|
||||
--fwdir) read_arg fw_dir_l "$@" || shift;;
|
||||
--compress) read_arg compress_l "$@" || shift;;
|
||||
--prefix) read_arg prefix_l "$@" || shift;;
|
||||
-f|--force) force=yes;;
|
||||
--kernel-only) kernel_only="yes"; no_kernel="no";;
|
||||
--no-kernel) kernel_only="no"; no_kernel="yes";;
|
||||
--strip) do_strip_l="yes";;
|
||||
--nostrip) do_strip_l="no";;
|
||||
--noprefix) prefix_l="/";;
|
||||
--mdadmconf) mdadmconf_l="yes";;
|
||||
--nomdadmconf) mdadmconf_l="no";;
|
||||
--lvmconf) lvmconf_l="yes";;
|
||||
@@ -223,7 +227,9 @@ while (($# > 0)); do
|
||||
-H|--hostonly) hostonly_l="yes" ;;
|
||||
--fstab) use_fstab_l="yes" ;;
|
||||
-h|--help) usage; exit 1 ;;
|
||||
-i|--include) push include_src "$2"; push include_target "$3"; shift 2;;
|
||||
-i|--include) push include_src "$2"
|
||||
push include_target "$3"
|
||||
shift 2;;
|
||||
--bzip2) compress_l="bzip2";;
|
||||
--lzma) compress_l="lzma";;
|
||||
--xz) compress_l="xz";;
|
||||
@@ -235,11 +241,12 @@ while (($# > 0)); do
|
||||
-M|--show-modules)
|
||||
show_modules_l="yes"
|
||||
;;
|
||||
--keep) keep="yes";;
|
||||
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
|
||||
*)
|
||||
if ! [[ $outfile ]]; then
|
||||
*)
|
||||
if ! [[ ${outfile+x} ]]; then
|
||||
outfile=$1
|
||||
elif [[ $kernel = "unset" ]]; then
|
||||
elif ! [[ ${kernel+x} ]]; then
|
||||
kernel=$1
|
||||
else
|
||||
usage; exit 1;
|
||||
@@ -248,7 +255,7 @@ while (($# > 0)); do
|
||||
esac
|
||||
shift
|
||||
done
|
||||
if ! [[ $kernel ]] || [[ $kernel = "unset" ]]; then
|
||||
if ! [[ $kernel ]]; then
|
||||
kernel=$(uname -r)
|
||||
fi
|
||||
[[ $outfile ]] || outfile="/boot/initramfs-$kernel.img"
|
||||
@@ -256,7 +263,7 @@ fi
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export PATH
|
||||
|
||||
[[ $debug ]] && {
|
||||
[[ $debug ]] && {
|
||||
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
|
||||
set -x
|
||||
}
|
||||
@@ -264,7 +271,7 @@ export PATH
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
|
||||
|
||||
[[ $allowlocal && -f "$(readlink -f ${0%/*})/dracut-functions" ]] && \
|
||||
dracutbasedir="$(readlink -f ${0%/*})"
|
||||
dracutbasedir="$(readlink -f ${0%/*})"
|
||||
|
||||
# if we were not passed a config file, try the default one
|
||||
if [[ ! -f $conffile ]]; then
|
||||
@@ -282,7 +289,7 @@ fi
|
||||
|
||||
# source our config dir
|
||||
if [[ $confdir && -d $confdir ]]; then
|
||||
for f in "$confdir"/*.conf; do
|
||||
for f in "$confdir"/*.conf; do
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
fi
|
||||
@@ -344,12 +351,14 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
|
||||
[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
|
||||
[[ $do_strip_l ]] && do_strip=$do_strip_l
|
||||
[[ $prefix_l ]] && prefix=$prefix_l
|
||||
[[ $prefix = "/" ]] && unset prefix
|
||||
[[ $hostonly_l ]] && hostonly=$hostonly_l
|
||||
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
|
||||
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
|
||||
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
|
||||
[[ $fw_dir ]] || fw_dir=/lib/firmware
|
||||
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware"
|
||||
[[ $do_strip ]] || do_strip=no
|
||||
[[ $compress_l ]] && compress=$compress_l
|
||||
[[ $show_modules_l ]] && show_modules=$show_modules_l
|
||||
@@ -357,11 +366,12 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
fw_dir=${fw_dir//:/ }
|
||||
|
||||
# handle compression options.
|
||||
[[ $compress ]] || compress="gzip"
|
||||
case $compress in
|
||||
bzip2) compress="bzip -9";;
|
||||
bzip2) compress="bzip2 -9";;
|
||||
lzma) compress="lzma -9";;
|
||||
xz) compress="xz --check=crc32 --lzma2=dict=1MiB";;
|
||||
gzip) type pigz > /dev/null 2>&1 && compress="pigz -9" || \
|
||||
gzip) command -v pigz > /dev/null 2>&1 && compress="pigz -9" || \
|
||||
compress="gzip -9";;
|
||||
esac
|
||||
if [[ $_no_compress_l = "cat" ]]; then
|
||||
@@ -370,7 +380,6 @@ fi
|
||||
|
||||
[[ $hostonly = yes ]] && hostonly="-h"
|
||||
[[ $hostonly != "-h" ]] && unset hostonly
|
||||
[[ $compress ]] || compress="gzip -9"
|
||||
|
||||
if [[ -f $dracutbasedir/dracut-functions ]]; then
|
||||
. $dracutbasedir/dracut-functions
|
||||
@@ -444,13 +453,13 @@ elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[[ $TMPDIR && ! -w $TMPDIR ]] && unset TMPDIR
|
||||
readonly initdir=$(mktemp -d -t initramfs.XXXXXX)
|
||||
readonly TMPDIR=/var/tmp
|
||||
readonly initdir=$(mktemp --tmpdir=/var/tmp/ -d -t initramfs.XXXXXX)
|
||||
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'ret=$?;rm -rf "$initdir";exit $ret;' EXIT
|
||||
trap 'ret=$?;[[ $keep ]] && echo "Not removing $initdir." >&2 || rm -rf "$initdir";exit $ret;' EXIT
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'exit 1;' SIGINT
|
||||
trap 'exit 1;' SIGINT
|
||||
|
||||
# Need to be able to have non-root users read stuff (rpcbind etc)
|
||||
chmod 755 "$initdir"
|
||||
@@ -462,37 +471,64 @@ export initdir dracutbasedir dracutmodules drivers \
|
||||
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
|
||||
debug
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
# Create some directory structure first
|
||||
for d in bin sbin usr/bin usr/sbin usr/lib etc \
|
||||
proc sys sysroot tmp dev/pts var/run; do
|
||||
inst_dir "/$d";
|
||||
# Create some directory structure first
|
||||
[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
|
||||
|
||||
[[ -h /lib ]] || mkdir -m 0755 -p "${initdir}${prefix}/lib"
|
||||
[[ $prefix ]] && ln -sfn "${prefix#/}/lib" "$initdir/lib"
|
||||
|
||||
if [[ $prefix ]]; then
|
||||
for d in bin etc lib "$libdir" sbin tmp usr var; do
|
||||
ln -sfn "${prefix#/}/${d#/}" "$initdir/$d"
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
for d in bin etc lib "$libdir" sbin tmp usr var usr/bin usr/sbin; do
|
||||
[[ -e "${initdir}${prefix}/$d" ]] && continue
|
||||
if [ -h "/$d" ]; then
|
||||
inst "/$d" "${prefix}/$d"
|
||||
else
|
||||
mkdir -m 0755 -p "${initdir}${prefix}/$d"
|
||||
fi
|
||||
done
|
||||
|
||||
for d in proc sys sysroot root run run/lock run/initramfs; do
|
||||
if [ -h "/$d" ]; then
|
||||
inst "/$d"
|
||||
else
|
||||
mkdir -m 0755 -p "$initdir/$d"
|
||||
fi
|
||||
done
|
||||
|
||||
ln -sfn /run "$initdir/var/run"
|
||||
ln -sfn /run/lock "$initdir/var/lock"
|
||||
fi
|
||||
|
||||
# check all our modules to see if they should be sourced.
|
||||
# This builds a list of modules that we will install next.
|
||||
check_module_dir
|
||||
|
||||
modules_loaded=" "
|
||||
# source our modules.
|
||||
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
|
||||
if strstr "$mods_to_load" " $mod "; then
|
||||
[[ $show_modules = yes ]] && echo "$mod" || \
|
||||
dinfo "*** Including module: $mod ***"
|
||||
_d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
|
||||
if strstr "$mods_to_load" " $_d_mod "; then
|
||||
[[ $show_modules = yes ]] && echo "$_d_mod" || \
|
||||
dinfo "*** Including module: $_d_mod ***"
|
||||
if [[ $kernel_only = yes ]]; then
|
||||
module_installkernel $mod
|
||||
module_installkernel $_d_mod
|
||||
else
|
||||
module_install $mod
|
||||
module_install $_d_mod
|
||||
if [[ $no_kernel != yes ]]; then
|
||||
module_installkernel $mod
|
||||
module_installkernel $_d_mod
|
||||
fi
|
||||
fi
|
||||
mods_to_load=${mods_to_load// $mod /}
|
||||
mods_to_load=${mods_to_load// $_d_mod /}
|
||||
modules_loaded+="$_d_mod "
|
||||
fi
|
||||
done
|
||||
unset moddir
|
||||
dinfo "*** Including modules' done ***"
|
||||
dinfo "*** Including modules done ***"
|
||||
|
||||
## final stuff that has to happen
|
||||
|
||||
@@ -510,7 +546,21 @@ while pop include_src src && pop include_target tgt; do
|
||||
else
|
||||
ddebug "Including directory: $src"
|
||||
mkdir -p "${initdir}/${tgt}"
|
||||
cp -a -t "${initdir}/${tgt}" "$src"/*
|
||||
# check for preexisting symlinks, so we can cope with the
|
||||
# symlinks to $prefix
|
||||
for i in "$src"/*; do
|
||||
[[ -e "$i" || -h "$i" ]] || continue
|
||||
s=${initdir}/${tgt}/${i#$src/}
|
||||
if [[ -d "$i" ]]; then
|
||||
if ! [[ -e "$s" ]]; then
|
||||
mkdir -m 0755 -p "$s"
|
||||
chmod --reference="$i" "$s"
|
||||
fi
|
||||
cp -a -t "$s" "$i"/*
|
||||
else
|
||||
cp -a -t "$s" "$i"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -522,13 +572,18 @@ while pop install_items items; do
|
||||
done
|
||||
unset item
|
||||
|
||||
# make sure that library links are correct and up to date
|
||||
dracut_install /etc/ld.so.conf /etc/ld.so.conf.d/*
|
||||
if ! ldconfig -r "$initdir"; then
|
||||
if [[ $UID = 0 ]]; then
|
||||
derror "ldconfig exited ungracefully"
|
||||
else
|
||||
derror "ldconfig might need uid=0 (root) for chroot()"
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
# make sure that library links are correct and up to date
|
||||
for f in /etc/ld.so.conf /etc/ld.so.conf.d/*; do
|
||||
[[ -e $f ]] && dracut_install "$f"
|
||||
done
|
||||
if ! ldconfig -r "$initdir"; then
|
||||
if [[ $UID = 0 ]]; then
|
||||
derror "ldconfig exited ungracefully"
|
||||
else
|
||||
derror "ldconfig might need uid=0 (root) for chroot()"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -537,9 +592,9 @@ if (($maxloglvl >= 5)); then
|
||||
du -c "$initdir" | sort -n | ddebug
|
||||
fi
|
||||
|
||||
# strip binaries
|
||||
# strip binaries
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
for p in strip grep find; do
|
||||
for p in strip grep find; do
|
||||
if ! type -P $p >/dev/null; then
|
||||
derror "Could not find '$p'. You should run $0 with '--nostrip'."
|
||||
do_strip=no
|
||||
@@ -560,11 +615,20 @@ type hardlink &>/dev/null && {
|
||||
hardlink "$initdir" 2>&1
|
||||
}
|
||||
|
||||
if strstr "$modules_loaded" " fips " && command -v prelink >/dev/null; then
|
||||
for i in $initdir/bin/* \
|
||||
$initdir/bin/* \
|
||||
$initdir/usr/bin/* \
|
||||
$initdir/usr/sbin/*; do
|
||||
[ -x $i ] && prelink -u $i &>/dev/null
|
||||
done
|
||||
fi
|
||||
|
||||
if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet | \
|
||||
$compress > "$outfile"; ); then
|
||||
$compress > "$outfile"; ); then
|
||||
dfatal "dracut: creation of $outfile failed"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
dinfo "Wrote $outfile:"
|
||||
dinfo "$(ls -l "$outfile")"
|
||||
|
@@ -39,7 +39,7 @@ Creates initial ramdisk image by concatenating several images from the command
|
||||
line and /boot/dracut/
|
||||
|
||||
-f, --force Overwrite existing initramfs file.
|
||||
-i, --imagedir Directory with additional images to add
|
||||
-i, --imagedir Directory with additional images to add
|
||||
(default: /boot/dracut/)
|
||||
-o, --overlaydir Overlay directory, which contains files that
|
||||
will be used to create an additional image
|
||||
@@ -120,7 +120,7 @@ images+=($@)
|
||||
dinfo "Using base image $baseimage"
|
||||
cat "$baseimage" > "$outfile"
|
||||
|
||||
for i in "${images[@]}"; do
|
||||
for i in "${images[@]}"; do
|
||||
dinfo "Appending $i"
|
||||
cat "$i" >> "$outfile"
|
||||
done
|
||||
|
@@ -67,7 +67,7 @@ line and /boot/dracut/*.img</para>
|
||||
<varlistentry>
|
||||
<term><option>-h</option>, <option>--help</option></term>
|
||||
<listitem>
|
||||
<para>display help text and exit.</para>
|
||||
<para>display help text and exit.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -105,7 +105,7 @@ Harald Hoyer <harald@redhat.com>
|
||||
|
||||
<refsect1 id='availability'><title>AVAILABILITY</title>
|
||||
<para>The dracut-catimages command is part of the dracut package and is available from
|
||||
<ulink url='http://sourceforge.net/apps/trac/dracut/wiki'>http://sourceforge.net/apps/trac/dracut/wiki</ulink></para>
|
||||
<ulink url='https://dracut.wiki.kernel.org'>https://dracut.wiki.kernel.org</ulink></para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
|
599
dracut-functions
599
dracut-functions
@@ -32,9 +32,6 @@ if ! type dinfo >/dev/null 2>&1; then
|
||||
dlog_init
|
||||
fi
|
||||
|
||||
IF_RTLD=""
|
||||
IF_dynamic=""
|
||||
|
||||
# Generic substring function. If $2 is in $1, return 0.
|
||||
strstr() { [[ $1 =~ $2 ]]; }
|
||||
|
||||
@@ -47,25 +44,25 @@ mksubdirs() { mkdir -m 0755 -p ${1%/*}; }
|
||||
# $2 = comparision op (gt, ge, eq, le, lt, ne)
|
||||
# $3 = version b
|
||||
vercmp() {
|
||||
local n1=(${1//./ }) op=$2 n2=(${3//./ }) i res
|
||||
local _n1=(${1//./ }) _op=$2 _n2=(${3//./ }) _i _res
|
||||
|
||||
for ((i=0; ; i++))
|
||||
for ((_i=0; ; _i++))
|
||||
do
|
||||
if [[ ! ${n1[i]}${n2[i]} ]]; then res=0
|
||||
elif ((${n1[i]:-0} > ${n2[i]:-0})); then res=1
|
||||
elif ((${n1[i]:-0} < ${n2[i]:-0})); then res=2
|
||||
if [[ ! ${_n1[_i]}${_n2[_i]} ]]; then _res=0
|
||||
elif ((${_n1[_i]:-0} > ${_n2[_i]:-0})); then _res=1
|
||||
elif ((${_n1[_i]:-0} < ${_n2[_i]:-0})); then _res=2
|
||||
else continue
|
||||
fi
|
||||
break
|
||||
done
|
||||
|
||||
case $op in
|
||||
gt) ((res == 1));;
|
||||
ge) ((res != 2));;
|
||||
eq) ((res == 0));;
|
||||
le) ((res != 1));;
|
||||
lt) ((res == 2));;
|
||||
ne) ((res != 0));;
|
||||
case $_op in
|
||||
gt) ((_res == 1));;
|
||||
ge) ((_res != 2));;
|
||||
eq) ((_res == 0));;
|
||||
le) ((_res != 1));;
|
||||
lt) ((_res == 2));;
|
||||
ne) ((_res != 0));;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -76,17 +73,19 @@ is_func() {
|
||||
# Function prints global variables in format name=value line by line.
|
||||
# $@ = list of global variables' name
|
||||
print_vars() {
|
||||
local var value
|
||||
local _var _value
|
||||
|
||||
for var in $@
|
||||
for _var in $@
|
||||
do
|
||||
value=$(eval echo \$$var)
|
||||
[[ ${value} ]] && echo "${var}=\"${value}\""
|
||||
_value=$(eval echo \$$_var)
|
||||
[[ ${_value} ]] && echo "${_var}=\"${_value}\""
|
||||
done
|
||||
}
|
||||
|
||||
get_fs_env() {
|
||||
[[ $1 ]] || return
|
||||
unset ID_FS_TYPE
|
||||
unset ID_FS_UUID
|
||||
eval $(udevadm info --query=env --name=$1|egrep 'ID_FS_(TYPE|UUID)=')
|
||||
[[ $ID_FS_TYPE ]] && return
|
||||
|
||||
@@ -118,38 +117,38 @@ get_fs_uuid() (
|
||||
|
||||
# finds the major:minor of the block device backing the root filesystem.
|
||||
find_block_device() {
|
||||
local x mpt majmin dev fs misc maj min
|
||||
local _x _mpt _majmin _dev _fs _maj _min
|
||||
if [[ $use_fstab != yes ]]; then
|
||||
while read x x majmin x mpt x x fs dev misc; do
|
||||
[[ $fs = nfs ]] && { echo $dev; return 0;}
|
||||
[[ $fs = nfs3 ]] && { echo $dev; return 0;}
|
||||
[[ $fs = nfs4 ]] && { echo $dev; return 0;}
|
||||
[[ $fs = btrfs ]] && {
|
||||
ls -nLl "$dev" | {
|
||||
read x x x x maj min x
|
||||
maj=${maj//,/}
|
||||
echo $maj:$min
|
||||
while read _x _x _majmin _x _mpt _x _x _fs _dev _x; do
|
||||
[[ $_fs = nfs ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs3 ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs4 ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = btrfs ]] && {
|
||||
ls -nLl "$_dev" | {
|
||||
read _x _x _x _x _maj _min _x
|
||||
_maj=${_maj//,/}
|
||||
echo $_maj:$_min
|
||||
} && return 0
|
||||
}
|
||||
if [[ $mpt = $1 ]] && [[ ${majmin#0:} = $majmin ]]; then
|
||||
echo $majmin
|
||||
if [[ $_mpt = $1 ]] && [[ ${_majmin#0:} = $_majmin ]]; then
|
||||
echo $_majmin
|
||||
return 0 # we have a winner!
|
||||
fi
|
||||
done < /proc/self/mountinfo
|
||||
fi
|
||||
# fall back to /etc/fstab
|
||||
while read dev mpt fs misc; do
|
||||
if [[ $mpt = $1 ]]; then
|
||||
[[ $fs = nfs ]] && { echo $dev; return 0;}
|
||||
[[ $fs = nfs3 ]] && { echo $dev; return 0;}
|
||||
[[ $fs = nfs4 ]] && { echo $dev; return 0;}
|
||||
[[ $dev != ${dev#UUID=} ]] && dev=/dev/disk/by-uuid/${dev#UUID=}
|
||||
[[ $dev != ${dev#LABEL=} ]] && dev=/dev/disk/by-label/${dev#LABEL=}
|
||||
[[ -b $dev ]] || return 1 # oops, not a block device.
|
||||
ls -nLl "$dev" | {
|
||||
read x x x x maj min x
|
||||
maj=${maj//,/}
|
||||
echo $maj:$min
|
||||
while read _dev _mpt _fs _x; do
|
||||
if [[ $_mpt = $1 ]]; then
|
||||
[[ $_fs = nfs ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs3 ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs4 ]] && { echo $_dev; return 0;}
|
||||
[[ $_dev != ${_dev#UUID=} ]] && _dev=/dev/disk/by-uuid/${_dev#UUID=}
|
||||
[[ $_dev != ${_dev#LABEL=} ]] && _dev=/dev/disk/by-label/${_dev#LABEL=}
|
||||
[[ -b $_dev ]] || return 1 # oops, not a block device.
|
||||
ls -nLl "$_dev" | {
|
||||
read _x _x _x _x _maj _min _x
|
||||
_maj=${_maj//,/}
|
||||
echo $_maj:$_min
|
||||
} && return 0
|
||||
fi
|
||||
done < /etc/fstab
|
||||
@@ -164,7 +163,7 @@ find_root_block_device() { find_block_device /; }
|
||||
# $1 = function to call on every found block device
|
||||
# $2 = block device in major:minor format
|
||||
check_block_and_slaves() {
|
||||
local x
|
||||
local _x
|
||||
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
|
||||
"$1" $2 && return
|
||||
check_vol_slaves "$@" && return 0
|
||||
@@ -172,15 +171,16 @@ check_block_and_slaves() {
|
||||
check_block_and_slaves $1 $(cat "/sys/dev/block/$2/../dev") && return 0
|
||||
fi
|
||||
[[ -d /sys/dev/block/$2/slaves ]] || return 1
|
||||
for x in /sys/dev/block/$2/slaves/*/dev; do
|
||||
[[ -f $x ]] || continue
|
||||
check_block_and_slaves $1 $(cat "$x") && return 0
|
||||
for _x in /sys/dev/block/$2/slaves/*/dev; do
|
||||
[[ -f $_x ]] || continue
|
||||
check_block_and_slaves $1 $(cat "$_x") && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
get_numeric_dev() {
|
||||
ls -lH "$1" | { read a b c d maj min rest; printf "%d:%d" ${maj%%,} $min; }
|
||||
local _x _maj _min
|
||||
ls -lH "$1" | { read _x _x _x _x _maj _min _x; printf "%d:%d" ${_maj%%,} $_min; }
|
||||
}
|
||||
|
||||
# ugly workaround for the lvm design
|
||||
@@ -190,16 +190,17 @@ get_numeric_dev() {
|
||||
# but you cannot create the logical volume without the volume group.
|
||||
# And the volume group might be bigger than the devices the LV needs.
|
||||
check_vol_slaves() {
|
||||
local _lv _vg _pv
|
||||
for i in /dev/mapper/*; do
|
||||
lv=$(get_numeric_dev $i)
|
||||
if [[ $lv = $2 ]]; then
|
||||
vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
|
||||
_lv=$(get_numeric_dev $i)
|
||||
if [[ $_lv = $2 ]]; then
|
||||
_vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
|
||||
# strip space
|
||||
vg=$(echo $vg)
|
||||
if [[ $vg ]]; then
|
||||
for pv in $(lvm vgs --noheadings -o pv_name "$vg" 2>/dev/null)
|
||||
_vg=$(echo $_vg)
|
||||
if [[ $_vg ]]; then
|
||||
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
|
||||
do
|
||||
check_block_and_slaves $1 $(get_numeric_dev $pv) && return 0
|
||||
check_block_and_slaves $1 $(get_numeric_dev $_pv) && return 0
|
||||
done
|
||||
fi
|
||||
fi
|
||||
@@ -212,27 +213,33 @@ check_vol_slaves() {
|
||||
# will create ${initdir}/lib64, ${initdir}/lib64/file,
|
||||
# and a symlink ${initdir}/lib -> lib64.
|
||||
inst_dir() {
|
||||
local dir="$1"
|
||||
[[ -e ${initdir}$dir ]] && return 0
|
||||
local _dir="$1"
|
||||
local _file=""
|
||||
local IFS="/"
|
||||
local _part
|
||||
[[ -e ${initdir}$_dir ]] && return 0
|
||||
|
||||
# iterate over parent directories
|
||||
local file=""
|
||||
local IFS="/"
|
||||
for part in $dir; do
|
||||
[[ $part ]] || continue
|
||||
file="$file/$part"
|
||||
[[ -e ${initdir}$file ]] && continue
|
||||
for _part in $_dir; do
|
||||
[[ $_part ]] || continue
|
||||
_file="$_file/$_part"
|
||||
[[ -e ${initdir}$_file ]] && continue
|
||||
|
||||
if [[ -L $file ]]; then
|
||||
if [[ -L $_file ]]; then
|
||||
# create link as the original
|
||||
local target=$(readlink "$file")
|
||||
ln -sfn "$target" "${initdir}$file" || return 1
|
||||
local target=$(readlink "$_file")
|
||||
ln -sfn "$target" "${initdir}$_file" || return 1
|
||||
# resolve relative path and recursively install destination
|
||||
[[ $target == ${target#/} ]] && target="$(dirname "$file")/$target"
|
||||
[[ $target == ${target#/} ]] && target="$(dirname "$_file")/$target"
|
||||
inst_dir "$target"
|
||||
else
|
||||
[[ -h ${initdir}$_file ]] && _file=$(readlink "${initdir}$_file")
|
||||
# create directory
|
||||
mkdir -m 0755 -p "${initdir}$file" || return 1
|
||||
mkdir -m 0755 -p "${initdir}$_file" || return 1
|
||||
if [[ -d "$_file" ]]; then
|
||||
chmod --reference="$_file" "${initdir}$_file"
|
||||
chmod u+w "${initdir}$_file"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -242,19 +249,20 @@ inst_dir() {
|
||||
# Location of the image dir is assumed to be $initdir
|
||||
# We never overwrite the target if it exists.
|
||||
inst_simple() {
|
||||
local src target
|
||||
local _src target
|
||||
[[ -f $1 ]] || return 1
|
||||
src=$1 target="${2:-$1}"
|
||||
_src=$1 target="${2:-$1}"
|
||||
if ! [[ -d ${initdir}$target ]]; then
|
||||
[[ -e ${initdir}$target ]] && return 0
|
||||
[[ -h ${initdir}$target ]] && return 0
|
||||
inst_dir "${target%/*}"
|
||||
fi
|
||||
# install checksum files also
|
||||
if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then
|
||||
inst "${src%/*}/.${src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
|
||||
if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
|
||||
inst "${_src%/*}/.${_src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
|
||||
fi
|
||||
ddebug "Installing $src"
|
||||
cp -pfL "$src" "${initdir}$target"
|
||||
ddebug "Installing $_src"
|
||||
cp -pfL "$_src" "${initdir}$target"
|
||||
}
|
||||
|
||||
# find symlinks linked to given library file
|
||||
@@ -286,27 +294,27 @@ rev_lib_symlinks() {
|
||||
# It handles making symlinks according to how the original library
|
||||
# is referenced.
|
||||
inst_library() {
|
||||
local src=$1 dest=${2:-$1} lib reallib symlink
|
||||
[[ -e $initdir$dest ]] && return 0
|
||||
if [[ -L $src ]]; then
|
||||
local _src=$1 _dest=${2:-$1} _lib _reallib _symlink
|
||||
[[ -e $initdir$_dest ]] && return 0
|
||||
if [[ -L $_src ]]; then
|
||||
# install checksum files also
|
||||
if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then
|
||||
inst "${src%/*}/.${src##*/}.hmac" "${dest%/*}/.${dest##*/}.hmac"
|
||||
if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
|
||||
inst "${_src%/*}/.${_src##*/}.hmac" "${_dest%/*}/.${_dest##*/}.hmac"
|
||||
fi
|
||||
reallib=$(readlink -f "$src")
|
||||
lib=${src##*/}
|
||||
inst_simple "$reallib" "$reallib"
|
||||
inst_dir "${dest%/*}"
|
||||
(cd "${initdir}${dest%/*}" && ln -s "$reallib" "$lib")
|
||||
_reallib=$(readlink -f "$_src")
|
||||
_lib=${_src##*/}
|
||||
inst_simple "$_reallib" "$_reallib"
|
||||
inst_dir "${_dest%/*}"
|
||||
(cd "${initdir}${_dest%/*}" && ln -sfn "$_reallib" "$_lib")
|
||||
else
|
||||
inst_simple "$src" "$dest"
|
||||
inst_simple "$_src" "$_dest"
|
||||
fi
|
||||
|
||||
# Create additional symlinks. See rev_symlinks description.
|
||||
for symlink in $(rev_lib_symlinks $src) $(rev_lib_symlinks $reallib); do
|
||||
[[ ! -e $initdir$symlink ]] && {
|
||||
ddebug "Creating extra symlink: $symlink"
|
||||
inst_symlink $symlink
|
||||
for _symlink in $(rev_lib_symlinks $_src) $(rev_lib_symlinks $_reallib); do
|
||||
[[ ! -e $initdir$_symlink ]] && {
|
||||
ddebug "Creating extra symlink: $_symlink"
|
||||
inst_symlink $_symlink
|
||||
}
|
||||
done
|
||||
}
|
||||
@@ -314,15 +322,15 @@ inst_library() {
|
||||
# find a binary. If we were not passed the full path directly,
|
||||
# search in the usual places to find the binary.
|
||||
find_binary() {
|
||||
local binpath="/bin /sbin /usr/bin /usr/sbin" p
|
||||
local _binpath="/usr/sbin /sbin /usr/bin /bin" _p
|
||||
if [[ -z ${1##/*} ]]; then
|
||||
if [[ -x $1 ]] || ldd $1 &>/dev/null; then
|
||||
echo $1
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
for p in $binpath; do
|
||||
[[ -x $p/$1 ]] && { echo "$p/$1"; return 0; }
|
||||
for _p in $_binpath; do
|
||||
[[ -x $_p/$1 ]] && { echo "$_p/$1"; return 0; }
|
||||
done
|
||||
return 1
|
||||
}
|
||||
@@ -330,105 +338,112 @@ find_binary() {
|
||||
# Same as above, but specialized to install binary executables.
|
||||
# Install binary executable, and all shared library dependencies, if any.
|
||||
inst_binary() {
|
||||
local bin target
|
||||
bin=$(find_binary "$1") || return 1
|
||||
target=${2:-$bin}
|
||||
inst_symlink $bin $target && return 0
|
||||
local LDSO NAME IO FILE ADDR I1 n f TLIBDIR
|
||||
[[ -e $initdir$target ]] && return 0
|
||||
local _bin _target _f _self _so_regex _lib_regex _tlibdir _base _file _line
|
||||
|
||||
_bin=$(find_binary "$1") || return 1
|
||||
_target=${2:-$_bin}
|
||||
inst_symlink $_bin $_target && return 0
|
||||
[[ -e $initdir$_target ]] && return 0
|
||||
|
||||
# If the binary being installed is also a library, add it to the loop.
|
||||
_so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
|
||||
[[ $_bin =~ $_so_regex ]] && _self="\t${_bin##*/} => ${_bin} (0x0)\n"
|
||||
|
||||
_lib_regex='^(/lib[^/]*).*'
|
||||
# I love bash!
|
||||
LC_ALL=C ldd $bin 2>/dev/null | while read line; do
|
||||
[[ $line = 'not a dynamic executable' ]] && return 1
|
||||
if [[ $line =~ not\ found ]]; then
|
||||
dfatal "Missing a shared library required by $bin."
|
||||
dfatal "Run \"ldd $bin\" to find out what it is."
|
||||
{ LC_ALL=C ldd $_bin 2>/dev/null; echo -en "$_self"; } | while read _line; do
|
||||
[[ $_line = 'not a dynamic executable' ]] && return 1
|
||||
if [[ $_line =~ not\ found ]]; then
|
||||
dfatal "Missing a shared library required by $_bin."
|
||||
dfatal "Run \"ldd $_bin\" to find out what it is."
|
||||
dfatal "dracut cannot create an initrd."
|
||||
exit 1
|
||||
fi
|
||||
so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
|
||||
[[ $line =~ $so_regex ]] || continue
|
||||
FILE=${BASH_REMATCH[1]}
|
||||
[[ -e ${initdir}$FILE ]] && continue
|
||||
# see if we are loading an optimized version of a shared lib.
|
||||
lib_regex='^(/lib[^/]*).*'
|
||||
if [[ $FILE =~ $lib_regex ]]; then
|
||||
TLIBDIR=${BASH_REMATCH[1]}
|
||||
BASE=${FILE##*/}
|
||||
# prefer nosegneg libs, then unoptimized ones.
|
||||
for f in "$TLIBDIR/i686/nosegneg" "$TLIBDIR"; do
|
||||
[[ -e $f/$BASE ]] || continue
|
||||
FILE=$f/$BASE
|
||||
[[ $_line =~ $_so_regex ]] || continue
|
||||
_file=${BASH_REMATCH[1]}
|
||||
[[ -e ${initdir}$_file ]] && continue
|
||||
|
||||
# See if we are loading an optimized version of a shared lib.
|
||||
if [[ $_file =~ $_lib_regex ]]; then
|
||||
_tlibdir=${BASH_REMATCH[1]}
|
||||
_base=${_file##*/}
|
||||
# Prefer nosegneg libs to unoptimized ones.
|
||||
for _f in "$_tlibdir/i686/nosegneg" "$_tlibdir"; do
|
||||
[[ -e $_f/$_base ]] || continue
|
||||
_file=$_f/$_base
|
||||
break
|
||||
done
|
||||
inst_library "$FILE" "$TLIBDIR/$BASE"
|
||||
IF_dynamic=yes
|
||||
continue
|
||||
fi
|
||||
inst_library "$FILE"
|
||||
inst_library "$_file" "$_tlibdir/$_base"
|
||||
else
|
||||
inst_library "$_file"
|
||||
fi
|
||||
done
|
||||
inst_simple "$bin" "$target"
|
||||
|
||||
# Install the binary if it wasn't handled in the above loop.
|
||||
[[ -z $_self ]] && inst_simple "$_bin" "$_target"
|
||||
}
|
||||
|
||||
# same as above, except for shell scripts.
|
||||
# If your shell script does not start with shebang, it is not a shell script.
|
||||
inst_script() {
|
||||
[[ -f $1 ]] || return 1
|
||||
local line
|
||||
read -r -n 80 line <"$1"
|
||||
local _line _shebang_regex
|
||||
read -r -n 80 _line <"$1"
|
||||
# If debug is set, clean unprintable chars to prevent messing up the term
|
||||
[[ $debug ]] && line=$(echo -n "$line" | tr -c -d '[:print:][:space:]')
|
||||
shebang_regex='(#! *)(/[^ ]+).*'
|
||||
[[ $line =~ $shebang_regex ]] || return 1
|
||||
[[ $debug ]] && _line=$(echo -n "$_line" | tr -c -d '[:print:][:space:]')
|
||||
_shebang_regex='(#! *)(/[^ ]+).*'
|
||||
[[ $_line =~ $_shebang_regex ]] || return 1
|
||||
inst "${BASH_REMATCH[2]}" && inst_simple "$@"
|
||||
}
|
||||
|
||||
# same as above, but specialized for symlinks
|
||||
inst_symlink() {
|
||||
local src=$1 target=$initdir${2:-$1} realsrc
|
||||
local _src=$1 _target=$initdir${2:-$1} _realsrc
|
||||
[[ -L $1 ]] || return 1
|
||||
[[ -L $target ]] && return 0
|
||||
realsrc=$(readlink -f "$src")
|
||||
[[ $realsrc = ${realsrc##*/} ]] && realsrc=${src%/*}/$realsrc
|
||||
inst "$realsrc" && mkdir -m 0755 -p "${target%/*}" && \
|
||||
ln -s "$realsrc" "$target"
|
||||
}
|
||||
|
||||
# find a udev rule in the usual places.
|
||||
find_rule() {
|
||||
[[ -f $1 ]] && { echo "$1"; return 0; }
|
||||
for r in . /lib/udev/rules.d /etc/udev/rules.d $dracutbasedir/rules.d; do
|
||||
[[ -f $r/$1 ]] && { echo "$r/$1"; return 0; }
|
||||
done
|
||||
return 1
|
||||
[[ -L $_target ]] && return 0
|
||||
_realsrc=$(readlink -f "$_src")
|
||||
[[ $_realsrc = ${_realsrc##*/} ]] && _realsrc=${_src%/*}/$_realsrc
|
||||
if [[ -d $_realsrc ]]; then
|
||||
inst_dir "$_realsrc"
|
||||
else
|
||||
inst "$_realsrc" && mkdir -m 0755 -p "${_target%/*}"
|
||||
fi
|
||||
if [[ -e "${_src}" ]]; then
|
||||
cp -aP "${_src}" "$_target"
|
||||
else
|
||||
ln -sfn "$_realsrc" "$_target"
|
||||
fi
|
||||
}
|
||||
|
||||
# udev rules always get installed in the same place, so
|
||||
# create a function to install them to make life simpler.
|
||||
inst_rules() {
|
||||
local target=/etc/udev/rules.d rule found
|
||||
local _target=/etc/udev/rules.d _rule _found
|
||||
|
||||
inst_dir "/lib/udev/rules.d"
|
||||
inst_dir "$target"
|
||||
for rule in "$@"; do
|
||||
inst_dir "$_target"
|
||||
for _rule in "$@"; do
|
||||
for r in /lib/udev/rules.d /etc/udev/rules.d; do
|
||||
if [[ -f $r/$rule ]]; then
|
||||
found="$r/$rule"
|
||||
inst_simple "$found"
|
||||
fi
|
||||
done
|
||||
for r in '' ./ $dracutbasedir/rules.d/; do
|
||||
if [[ -f ${r}$rule ]]; then
|
||||
found="${r}$rule"
|
||||
inst_simple "$found" "$target/${found##*/}"
|
||||
if [[ -f $r/$_rule ]]; then
|
||||
_found="$r/$_rule"
|
||||
inst_simple "$_found"
|
||||
fi
|
||||
done
|
||||
[[ $found ]] || dinfo "Skipping udev rule: $rule"
|
||||
for r in '' ./ $dracutbasedir/rules.d/; do
|
||||
if [[ -f ${r}$_rule ]]; then
|
||||
_found="${r}$_rule"
|
||||
inst_simple "$_found" "$_target/${_found##*/}"
|
||||
fi
|
||||
done
|
||||
[[ $_found ]] || dinfo "Skipping udev rule: $_rule"
|
||||
done
|
||||
}
|
||||
|
||||
# general purpose installation function
|
||||
# Same args as above.
|
||||
inst() {
|
||||
local _x
|
||||
|
||||
case $# in
|
||||
1) ;;
|
||||
2) [[ ! $initdir && -d $2 ]] && export initdir=$2
|
||||
@@ -438,15 +453,15 @@ inst() {
|
||||
*) dfatal "inst only takes 1 or 2 or 3 arguments"
|
||||
exit 1;;
|
||||
esac
|
||||
for x in inst_symlink inst_script inst_binary inst_simple; do
|
||||
$x "$@" && return 0
|
||||
for _x in inst_symlink inst_script inst_binary inst_simple; do
|
||||
$_x "$@" && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
[[ $hookdirs ]] || {
|
||||
hookdirs="cmdline pre-udev pre-trigger netroot initqueue pre-mount"
|
||||
hookdirs+=" pre-pivot mount emergency"
|
||||
hookdirs+=" pre-pivot mount emergency emergency-shutdown shutdown"
|
||||
export hookdirs
|
||||
}
|
||||
|
||||
@@ -459,20 +474,21 @@ inst_hook() {
|
||||
dfatal "Aborting initrd creation."
|
||||
exit 1
|
||||
elif ! strstr "$hookdirs" "$1"; then
|
||||
dfatal "No such hook type $1. Aborting initrd creation."
|
||||
dfatal "No such hook type $1. Aborting initrd creation."
|
||||
exit 1
|
||||
fi
|
||||
inst_simple "$3" "/lib/dracut/hooks/${1}/${2}${3##*/}"
|
||||
}
|
||||
|
||||
dracut_install() {
|
||||
local _optional=no
|
||||
if [[ $1 = '-o' ]]; then
|
||||
local optional=yes
|
||||
_optional=yes
|
||||
shift
|
||||
fi
|
||||
while (($# > 0)); do
|
||||
if ! inst "$1" ; then
|
||||
if [[ $optional = yes ]]; then
|
||||
if [[ $_optional = yes ]]; then
|
||||
dwarn "Skipping program $1 as it cannot be found and is" \
|
||||
"flagged to be optional"
|
||||
else
|
||||
@@ -490,32 +506,32 @@ dracut_install() {
|
||||
# Function install targets in the same paths inside overlay but decompressed
|
||||
# and without extensions (.gz, .bz2).
|
||||
inst_decompress() {
|
||||
local src dst realsrc realdst cmd
|
||||
local _src _dst _realsrc _realdst _cmd
|
||||
|
||||
for src in $@
|
||||
for _src in $@
|
||||
do
|
||||
case ${src} in
|
||||
*.gz) cmd='gzip -d' ;;
|
||||
*.bz2) cmd='bzip2 -d' ;;
|
||||
case ${_src} in
|
||||
*.gz) _cmd='gzip -d' ;;
|
||||
*.bz2) _cmd='bzip2 -d' ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
|
||||
if [[ -L ${src} ]]
|
||||
if [[ -L ${_src} ]]
|
||||
then
|
||||
realsrc="$(readlink -f ${src})" # symlink target with extension
|
||||
dst="${src%.*}" # symlink without extension
|
||||
realdst="${realsrc%.*}" # symlink target without extension
|
||||
mksubdirs "${initdir}/${src}"
|
||||
_realsrc="$(readlink -f ${_src})" # symlink target with extension
|
||||
_dst="${_src%.*}" # symlink without extension
|
||||
_realdst="${_realsrc%.*}" # symlink target without extension
|
||||
mksubdirs "${initdir}/${_src}"
|
||||
# Create symlink without extension to target without extension.
|
||||
ln -s "${realdst}" "${initdir}/${dst}"
|
||||
ln -sfn "${_realdst}" "${initdir}/${_dst}"
|
||||
fi
|
||||
|
||||
# If the source is symlink we operate on its target.
|
||||
[[ ${realsrc} ]] && src=${realsrc}
|
||||
inst ${src}
|
||||
[[ ${_realsrc} ]] && _src=${_realsrc}
|
||||
inst ${_src}
|
||||
# Decompress with chosen tool. We assume that tool changes name e.g.
|
||||
# from 'name.gz' to 'name'.
|
||||
${cmd} "${initdir}${src}"
|
||||
${_cmd} "${initdir}${_src}"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -523,170 +539,181 @@ inst_decompress() {
|
||||
# install.
|
||||
# $@ = list of files
|
||||
inst_opt_decompress() {
|
||||
local src
|
||||
local _src
|
||||
|
||||
for src in $@
|
||||
for _src in $@
|
||||
do
|
||||
inst_decompress "${src}" || inst "${src}"
|
||||
inst_decompress "${_src}" || inst "${_src}"
|
||||
done
|
||||
}
|
||||
|
||||
module_check() {
|
||||
local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
[[ -d $moddir ]] || return 1
|
||||
if [[ ! -f $moddir/module-setup.sh ]]; then
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _ret
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# if we do not have a check script, we are unconditionally included
|
||||
[[ -x $moddir/check ]] || return 0
|
||||
$moddir/check $hostonly
|
||||
[[ -x $_moddir/check ]] || return 0
|
||||
$_moddir/check $hostonly
|
||||
return $?
|
||||
else
|
||||
unset check depends install installkernel
|
||||
. $moddir/module-setup.sh
|
||||
. $_moddir/module-setup.sh
|
||||
is_func check || return 0
|
||||
check
|
||||
ret=$?
|
||||
_ret=$?
|
||||
unset check depends install installkernel
|
||||
return $ret
|
||||
return $_ret
|
||||
fi
|
||||
}
|
||||
|
||||
module_depends() {
|
||||
local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
[[ -d $moddir ]] || return 1
|
||||
if [[ ! -f $moddir/module-setup.sh ]]; then
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _ret
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# if we do not have a check script, we have no deps
|
||||
[[ -x $moddir/check ]] || return 0
|
||||
$moddir/check -d
|
||||
[[ -x $_moddir/check ]] || return 0
|
||||
$_moddir/check -d
|
||||
return $?
|
||||
else
|
||||
unset check depends install installkernel
|
||||
. $moddir/module-setup.sh
|
||||
. $_moddir/module-setup.sh
|
||||
is_func depends || return 0
|
||||
depends
|
||||
ret=$?
|
||||
_ret=$?
|
||||
unset check depends install installkernel
|
||||
return $ret
|
||||
return $_ret
|
||||
fi
|
||||
}
|
||||
|
||||
module_install() {
|
||||
local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
[[ -d $moddir ]] || return 1
|
||||
if [[ ! -f $moddir/module-setup.sh ]]; then
|
||||
[[ -x $moddir/install ]] && . "$moddir/install"
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _ret
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
[[ -x $_moddir/install ]] && . "$_moddir/install"
|
||||
return $?
|
||||
else
|
||||
unset check depends install installkernel
|
||||
. $moddir/module-setup.sh
|
||||
. $_moddir/module-setup.sh
|
||||
is_func install || return 0
|
||||
install
|
||||
ret=$?
|
||||
_ret=$?
|
||||
unset check depends install installkernel
|
||||
return $ret
|
||||
return $_ret
|
||||
fi
|
||||
}
|
||||
|
||||
module_installkernel() {
|
||||
local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
[[ -d $moddir ]] || return 1
|
||||
if [[ ! -f $moddir/module-setup.sh ]]; then
|
||||
[[ -x $moddir/installkernel ]] && . "$moddir/installkernel"
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _ret
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
[[ -x $_moddir/installkernel ]] && . "$_moddir/installkernel"
|
||||
return $?
|
||||
else
|
||||
unset check depends install installkernel
|
||||
. $moddir/module-setup.sh
|
||||
. $_moddir/module-setup.sh
|
||||
is_func installkernel || return 0
|
||||
installkernel
|
||||
ret=$?
|
||||
_ret=$?
|
||||
unset check depends install installkernel
|
||||
return $ret
|
||||
return $_ret
|
||||
fi
|
||||
}
|
||||
|
||||
check_module() {
|
||||
local mod=$1;
|
||||
local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local moddep;
|
||||
local _mod=$1
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _ret
|
||||
local _moddep
|
||||
# If we are already scheduled to be loaded, no need to check again.
|
||||
strstr " $mods_to_load " " $mod " && return 0
|
||||
strstr " $mods_checked_as_dep " " $mod " && return 1
|
||||
strstr " $mods_to_load " " $_mod " && return 0
|
||||
strstr " $mods_checked_as_dep " " $_mod " && return 1
|
||||
|
||||
# This should never happen, but...
|
||||
[[ -d $moddir ]] || return 1
|
||||
[[ -d $_moddir ]] || return 1
|
||||
|
||||
[[ $2 ]] || mods_checked_as_dep+=" $mod "
|
||||
[[ $2 ]] || mods_checked_as_dep+=" $_mod "
|
||||
|
||||
strstr " $omit_dracutmodules " " $mod " && return 1
|
||||
strstr " $omit_dracutmodules " " $_mod " && return 1
|
||||
|
||||
if strstr " $dracutmodules $add_dracutmodules " " $mod "; then
|
||||
module_check $mod; ret=$?
|
||||
if strstr " $dracutmodules $add_dracutmodules " " $_mod "; then
|
||||
module_check $_mod; ret=$?
|
||||
# explicit module, so also accept ret=255
|
||||
[[ $ret = 0 || $ret = 255 ]] || return 1
|
||||
else
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check $mod || return 1
|
||||
module_check $_mod || return 1
|
||||
else
|
||||
# skip this module
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
for moddep in $(module_depends $mod); do
|
||||
for _moddep in $(module_depends $_mod); do
|
||||
# handle deps as if they were manually added
|
||||
strstr " $add_dracutmodules " " $moddep " || \
|
||||
add_dracutmodules+=" $moddep "
|
||||
strstr " $add_dracutmodules " " $_moddep " || \
|
||||
add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
check_module $moddep || return 1
|
||||
check_module $_moddep || return 1
|
||||
done
|
||||
|
||||
strstr " $mods_to_load " " $mod " || \
|
||||
mods_to_load+=" $mod "
|
||||
strstr " $mods_to_load " " $_mod " || \
|
||||
mods_to_load+=" $_mod "
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
check_module_dir() {
|
||||
local modcheck;
|
||||
local mod;
|
||||
local _modcheck
|
||||
local _mod
|
||||
local _moddir
|
||||
mods_to_load=""
|
||||
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
local mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
|
||||
check_module $mod 1
|
||||
for _moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
_mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]}
|
||||
check_module $_mod 1
|
||||
done
|
||||
|
||||
# Report any missing dracut modules, the user has specified
|
||||
modcheck=$add_dracutmodules
|
||||
[[ $dracutmodules != all ]] && modcheck="$m $dracutmodules"
|
||||
for mod in $modcheck; do
|
||||
strstr "$mods_to_load" "$mod" && continue
|
||||
strstr "$omit_dracutmodules" "$mod" && continue
|
||||
derror "Dracut module \"$mod\" cannot be found."
|
||||
_modcheck=$add_dracutmodules
|
||||
[[ $dracutmodules != all ]] && _modcheck="$m $dracutmodules"
|
||||
for _mod in $_modcheck; do
|
||||
strstr "$mods_to_load" "$_mod" && continue
|
||||
strstr "$omit_dracutmodules" "$_mod" && continue
|
||||
derror "Dracut module \"$_mod\" cannot be found."
|
||||
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() {
|
||||
local modname=${1##*/} fwdir found
|
||||
modname=${modname%.ko*}
|
||||
local _modname=${1##*/} _fwdir _found _fw
|
||||
_modname=${_modname%.ko*}
|
||||
# no need to go further if the module is already installed
|
||||
[[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \
|
||||
&& return 0
|
||||
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" \
|
||||
|| return $?
|
||||
for fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
|
||||
found=''
|
||||
for fwdir in $fw_dir; do
|
||||
if [[ -d $fwdir && -f $fwdir/$fw ]]; then
|
||||
inst_simple "$fwdir/$fw" "/lib/firmware/$fw"
|
||||
found=yes
|
||||
for _fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
|
||||
_found=''
|
||||
for _fwdir in $fw_dir; do
|
||||
if [[ -d $_fwdir && -f $_fwdir/$_fw ]]; then
|
||||
inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw"
|
||||
_found=yes
|
||||
fi
|
||||
done
|
||||
if [[ $found != yes ]]; then
|
||||
dwarn "Possible missing firmware \"${fw}\" for kernel module" \
|
||||
"\"${mod}.ko\""
|
||||
if [[ $_found != yes ]]; then
|
||||
if ! grep -qe "\<${_modname//-/_}\>" /proc/modules; 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
|
||||
@@ -699,18 +726,19 @@ install_kmod_with_fw() {
|
||||
# $2 = module to get dependencies for
|
||||
# rest of args = arguments to modprobe
|
||||
for_each_kmod_dep() {
|
||||
local func=$1 kmod=$2 cmd modpapth options
|
||||
local _func=$1 _kmod=$2 _cmd _modpath _options _found=0
|
||||
shift 2
|
||||
modprobe "$@" --ignore-install --show-depends $kmod 2>/dev/null | (
|
||||
local found=0
|
||||
while read cmd modpath options; do
|
||||
[[ $cmd = insmod ]] || continue
|
||||
$func ${modpath} || exit $?
|
||||
found=1
|
||||
modprobe "$@" --ignore-install --show-depends $_kmod 2>"$initdir/modprobe.err" | (
|
||||
while read _cmd _modpath _options; do
|
||||
[[ $_cmd = insmod ]] || continue
|
||||
$_func ${_modpath} || exit $?
|
||||
_found=1
|
||||
done
|
||||
[[ $found -eq 0 ]] && exit 1
|
||||
[[ $_found -eq 0 ]] && exit 1
|
||||
exit 0
|
||||
)
|
||||
egrep -v 'FATAL: Module .* not found.' "$initdir/modprobe.err" | derror
|
||||
rm -f "$initdir/modprobe.err"
|
||||
return $?
|
||||
}
|
||||
|
||||
@@ -723,19 +751,20 @@ for_each_kmod_dep() {
|
||||
# If it is not, we will look at all kernel modules
|
||||
# This function returns the full filenames of modules that match $1
|
||||
filter_kernel_modules () (
|
||||
local _modname _filtercmd
|
||||
if ! [[ $hostonly ]]; then
|
||||
filtercmd='find "$srcmods/kernel/drivers" "$srcmods/extra"'
|
||||
filtercmd+=' "$srcmods/weak-updates" -name "*.ko" -o -name "*.ko.gz"'
|
||||
filtercmd+=' 2>/dev/null'
|
||||
_filtercmd='find "$srcmods/kernel/drivers" "$srcmods/extra"'
|
||||
_filtercmd+=' "$srcmods/weak-updates" -name "*.ko" -o -name "*.ko.gz"'
|
||||
_filtercmd+=' 2>/dev/null'
|
||||
else
|
||||
filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename '
|
||||
filtercmd+='-k $kernel 2>/dev/null'
|
||||
_filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename '
|
||||
_filtercmd+='-k $kernel 2>/dev/null'
|
||||
fi
|
||||
for modname in $(eval $filtercmd); do
|
||||
case $modname in
|
||||
*.ko) "$1" "$modname" && echo "$modname";;
|
||||
*.ko.gz) gzip -dc "$modname" > $initdir/$$.ko
|
||||
$1 $initdir/$$.ko && echo "$modname"
|
||||
for _modname in $(eval $_filtercmd); do
|
||||
case $_modname in
|
||||
*.ko) "$1" "$_modname" && echo "$_modname";;
|
||||
*.ko.gz) gzip -dc "$_modname" > $initdir/$$.ko
|
||||
$1 $initdir/$$.ko && echo "$_modname"
|
||||
rm -f $initdir/$$.ko
|
||||
;;
|
||||
esac
|
||||
@@ -745,52 +774,52 @@ filter_kernel_modules () (
|
||||
# install kernel modules along with all their dependencies.
|
||||
instmods() {
|
||||
[[ $no_kernel = yes ]] && return
|
||||
local mod mpargs modpath modname cmd moddirname
|
||||
local ret=0
|
||||
local _mod _mpargs _moddirname
|
||||
local _ret=0
|
||||
while (($# > 0)); do
|
||||
mod=${1%.ko*}
|
||||
case $mod in
|
||||
_mod=${1%.ko*}
|
||||
case $_mod in
|
||||
=*)
|
||||
# This introduces 2 incompatible meanings for =* arguments
|
||||
# to instmods. We need to decide which one to keep.
|
||||
if [[ $mod = =ata && -f $srcmods/modules.block ]]; then
|
||||
instmods $mpargs \
|
||||
if [[ $_mod = =ata && -f $srcmods/modules.block ]]; then
|
||||
instmods $_mpargs \
|
||||
$(egrep 'ata|ahci' "${srcmods}/modules.block")
|
||||
elif [ -f $srcmods/modules.${mod#=} ]; then
|
||||
instmods $mpargs $(cat ${srcmods}/modules.${mod#=} )
|
||||
elif [ -f $srcmods/modules.${_mod#=} ]; then
|
||||
instmods $_mpargs $(cat ${srcmods}/modules.${_mod#=} )
|
||||
else
|
||||
instmods $mpargs $(find "$srcmods" -path "*/${mod#=}/*")
|
||||
instmods $_mpargs $(find "$srcmods" -path "*/${_mod#=}/*")
|
||||
fi
|
||||
;;
|
||||
--*)
|
||||
mod=${mod##*/}
|
||||
mpargs+=" $mod";;
|
||||
_mod=${_mod##*/}
|
||||
_mpargs+=" $_mod";;
|
||||
i2o_scsi) shift; continue;; # Do not load this diagnostic-only module
|
||||
*) mod=${mod##*/}
|
||||
*) _mod=${_mod##*/}
|
||||
# if we are already installed, skip this module and go on
|
||||
# to the next one.
|
||||
[[ -f $initdir/$1 ]] && { shift; continue; }
|
||||
# If we are building a host-specific initramfs and this
|
||||
# module is not already loaded, move on to the next one.
|
||||
[[ $hostonly ]] && ! grep -qe "\<${mod//-/_}\>" /proc/modules \
|
||||
&& ! echo $add_drivers | grep -qe "\<${mod}\>" && {
|
||||
[[ $hostonly ]] && ! grep -qe "\<${_mod//-/_}\>" /proc/modules \
|
||||
&& ! echo $add_drivers | grep -qe "\<${_mod}\>" && {
|
||||
shift; continue
|
||||
}
|
||||
|
||||
# We use '-d' option in modprobe only if modules prefix path
|
||||
# differs from default '/'. This allows us to use Dracut with
|
||||
# old version of modprobe which doesn't have '-d' option.
|
||||
moddirname=${srcmods%%/lib/modules/*}
|
||||
[[ -n ${moddirname} ]] && moddirname="-d ${moddirname}/"
|
||||
_moddirname=${srcmods%%/lib/modules/*}
|
||||
[[ -n ${_moddirname} ]] && _moddirname="-d ${_moddirname}/"
|
||||
|
||||
# ok, load the module, all its dependencies, and any firmware
|
||||
# it may require
|
||||
for_each_kmod_dep install_kmod_with_fw $mod \
|
||||
--set-version $kernel ${moddirname}
|
||||
ret=$((ret+$?))
|
||||
for_each_kmod_dep install_kmod_with_fw $_mod \
|
||||
--set-version $kernel ${_moddirname}
|
||||
((_ret+=$?))
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
return $ret
|
||||
return $_ret
|
||||
}
|
||||
|
@@ -168,7 +168,7 @@ resolve_device_name() {
|
||||
real=$(freadlink /dev/disk/by-label/${1##LABEL=})
|
||||
[ -b $real ] && { echo $real; return; }
|
||||
fi
|
||||
echo "$1"
|
||||
echo "$1"
|
||||
}
|
||||
|
||||
finddevnoinsys() {
|
||||
@@ -308,7 +308,7 @@ iscsi_set_parameters() {
|
||||
chap=${result}
|
||||
if [ -n "${chap}" -a "${chap}" != "<empty>" ]; then
|
||||
chap="-u ${chap}"
|
||||
iscsi_get_rec_val $tmpfile "node.session.auth.password"
|
||||
iscsi_get_rec_val $tmpfile "node.session.auth.password"
|
||||
chap_pw="-w ${result}"
|
||||
else
|
||||
chap=""
|
||||
@@ -318,7 +318,7 @@ iscsi_set_parameters() {
|
||||
chap_in=${result}
|
||||
if [ -n "${chap_in}" -a "${chap_in}" != "<empty>" ]; then
|
||||
chap_in="-U ${chap_in}"
|
||||
iscsi_get_rec_val $tmpfile "node.session.auth.password_in"
|
||||
iscsi_get_rec_val $tmpfile "node.session.auth.password_in"
|
||||
chap_in_pw="-W ${result}"
|
||||
else
|
||||
chap_in=""
|
||||
@@ -343,7 +343,7 @@ is_iscsi() {
|
||||
path=$1
|
||||
if echo $path | grep -q "/platform/host[0-9]*/session[0-9]*/target[0-9]*:[0-9]*:[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*"; then
|
||||
return 0
|
||||
else
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -399,7 +399,7 @@ handledm() {
|
||||
EOF
|
||||
local name=$(dmsetup info --noheadings -c -j $major -m $minor -o name)
|
||||
local vg=$(lvshow "/dev/mapper/$name")
|
||||
local raids=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no raid disks")
|
||||
local raids=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no raid disks")
|
||||
if [ -n "$vg" ]; then
|
||||
vg=`echo $vg` # strip whitespace
|
||||
case " $vg_list " in
|
||||
@@ -630,7 +630,7 @@ fi
|
||||
|
||||
cemit()
|
||||
{
|
||||
cat
|
||||
cat
|
||||
}
|
||||
|
||||
emit()
|
||||
@@ -640,7 +640,7 @@ emit()
|
||||
NONL="-n"
|
||||
shift
|
||||
fi
|
||||
echo $NONL "$@"
|
||||
echo $NONL "$@"
|
||||
}
|
||||
|
||||
emitdmraids()
|
||||
@@ -678,8 +678,8 @@ else
|
||||
echo -n "rd_NO_MD "
|
||||
fi
|
||||
|
||||
if [ -z "$nolvm" -a -n "$vg_list" ]; then
|
||||
for vg in $vg_list; do
|
||||
if [ -z "$nolvm" -a -n "$vg_list" ]; then
|
||||
for vg in $vg_list; do
|
||||
echo -n "rd_LVM_VG=$vg "
|
||||
done
|
||||
else
|
||||
|
@@ -15,7 +15,7 @@
|
||||
<!-- body begins here -->
|
||||
<refsynopsisdiv id='synopsis'>
|
||||
<cmdsynopsis>
|
||||
<command>dracut-gencmdline</command>
|
||||
<command>dracut-gencmdline</command>
|
||||
<sbr/>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
@@ -35,7 +35,7 @@ Harald Hoyer <harald@redhat.com>
|
||||
|
||||
<refsect1 id='availability'><title>AVAILABILITY</title>
|
||||
<para>The dracut-gencmdline command is part of the dracut package and is available from
|
||||
<ulink url='http://sourceforge.net/apps/trac/dracut/wiki'>http://sourceforge.net/apps/trac/dracut/wiki</ulink></para>
|
||||
<ulink url='https://dracut.wiki.kernel.org'>https://dracut.wiki.kernel.org</ulink></para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
|
44
dracut.8.xml
44
dracut.8.xml
@@ -108,9 +108,9 @@ For a complete list of kernel command line options see
|
||||
<option>--modules <replaceable><list of dracut modules></replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>specify a space-separated list of dracut modules to call
|
||||
when building the initramfs.
|
||||
Modules are located in
|
||||
<para>specify a space-separated list of dracut modules to call
|
||||
when building the initramfs.
|
||||
Modules are located in
|
||||
<filename>/usr/share/dracut/modules.d</filename>. This parameter can be specified multiple times.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -163,7 +163,7 @@ The kernel modules have to be specified without the ".ko" suffix. This
|
||||
<option>--filesystems <replaceable><list of filesystems></replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>specify a space-separated list of kernel filesystem modules to exclusively
|
||||
<para>specify a space-separated list of kernel filesystem modules to exclusively
|
||||
include in the generic initramfs. This parameter can be specified multiple times.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -234,6 +234,22 @@ include in the generic initramfs. This parameter can be specified multiple times
|
||||
<para>do not strip binaries in the initramfs</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--prefix</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>prefix initramfs files with /run/initramfs/</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--noprefix</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>do not prefix initramfs files with /run/initramfs/ (default)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-h</option>
|
||||
@@ -284,7 +300,7 @@ include in the generic initramfs. This parameter can be specified multiple times
|
||||
</term>
|
||||
<listitem>
|
||||
<para>specify configuration file to use.
|
||||
Default:
|
||||
Default:
|
||||
<filename>/etc/dracut.conf</filename></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -294,7 +310,7 @@ Default:
|
||||
</term>
|
||||
<listitem>
|
||||
<para>specify configuration directory to use.
|
||||
Default:
|
||||
Default:
|
||||
<filename>/etc/dracut.conf.d</filename></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -320,8 +336,8 @@ This is useful when running dracut from a git checkout.</para>
|
||||
<option>--hostonly</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Host-Only mode: Install only what is needed for booting
|
||||
the local host instead of a generic host.
|
||||
<para>Host-Only mode: Install only what is needed for booting
|
||||
the local host instead of a generic host.
|
||||
<warning>
|
||||
<para>If chrooted to another root other than the real root device, use "--fstab" and provide a valid <filename>/etc/fstab</filename>.</para>
|
||||
</warning></para>
|
||||
@@ -435,6 +451,14 @@ TARGET directory in the final initramfs. If SOURCE is a file, it will be install
|
||||
<para>Print included module's name to standard output during build.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--keep</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Keep the initramfs temporary directory for debugging purposes.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
@@ -489,7 +513,7 @@ TARGET directory in the final initramfs. If SOURCE is a file, it will be install
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Any files found in <filename>/etc/conf.d/</filename> will be sourced in the initramfs to
|
||||
set initial values. Command line options will override these values
|
||||
set initial values. Command line options will override these values
|
||||
set in the configuration files.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -507,7 +531,7 @@ set in the configuration files.</para>
|
||||
<refsect1>
|
||||
<title>Availability</title>
|
||||
<para>The dracut command is part of the dracut package and is available from
|
||||
<ulink url="http://sourceforge.net/apps/trac/dracut/wiki">http://sourceforge.net/apps/trac/dracut/wiki</ulink></para>
|
||||
<ulink url='https://dracut.wiki.kernel.org'>https://dracut.wiki.kernel.org</ulink></para>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
@@ -3,7 +3,9 @@
|
||||
logfile=/var/log/dracut.log
|
||||
fileloglvl=6
|
||||
|
||||
# Specific list of dracut modules to use
|
||||
# Exact list of dracut modules to use. Modules not listed here are not going
|
||||
# to be included. If you only want to add some optional modules use
|
||||
# add_dracutmodules option instead.
|
||||
#dracutmodules+=""
|
||||
|
||||
# Dracut modules to omit
|
||||
|
@@ -79,7 +79,7 @@ The kernel modules have to be specified without the ".ko" suffix.</par
|
||||
<envar>add_drivers+=" <replaceable><kernel modules></replaceable> "</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Specify a space-separated list of kernel
|
||||
<para>Specify a space-separated list of kernel
|
||||
modules to add to the initramfs.
|
||||
The kernel modules have to be specified without the ".ko" suffix.</para>
|
||||
</listitem>
|
||||
@@ -123,7 +123,7 @@ initramfs.</para>
|
||||
<envar>hostonly="<replaceable>{yes|no}</replaceable>"</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Host-Only mode: Install only what is needed for booting
|
||||
<para>Host-Only mode: Install only what is needed for booting
|
||||
the local host instead of a generic host.
|
||||
<warning><para>If chrooted to another root other than the real root device, use <option>--fstab</option> and provide a valid <filename>/etc/fstab</filename>.</para>
|
||||
</warning>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# /etc/dracut.conf.d/redhat.conf
|
||||
# Dracut config file customized for RedHat/Fedora.
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
|
||||
add_dracutmodules+=" rpmversion "
|
||||
add_dracutmodules+=" rpmversion shutdown "
|
||||
stdloglvl=3
|
||||
prefix=/run/initramfs
|
||||
|
@@ -25,11 +25,11 @@
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para>The root filesystem used by the kernel is specified in the boot configuration
|
||||
file, as always. The traditional <emphasis remap="B">root=/dev/hda1</emphasis> style device
|
||||
file, as always. The traditional <emphasis remap="B">root=/dev/hda1</emphasis> style device
|
||||
specification is allowed. If a label is used, as in <emphasis remap="B">root=LABEL=rootPart</emphasis>
|
||||
the initramfs will search all available devices for an ext2 or ext3 filesystem
|
||||
with the appropriate label, and mount that device as the root filesystem.
|
||||
<emphasis remap="B">root=UUID=uuidnumber</emphasis> will mount the partition with that UUID as the
|
||||
<emphasis remap="B">root=UUID=uuidnumber</emphasis> will mount the partition with that UUID as the
|
||||
root filesystem.</para>
|
||||
<refsect2>
|
||||
<title>Standard</title>
|
||||
@@ -47,7 +47,7 @@ root filesystem.</para>
|
||||
<envar>root=<replaceable><path to blockdevice></replaceable></envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>specify blockdevice to use as root filesystem.
|
||||
<para>specify blockdevice to use as root filesystem.
|
||||
e.g.: <programlisting>root=/dev/sda1
|
||||
root=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1 </programlisting></para>
|
||||
</listitem>
|
||||
@@ -66,14 +66,14 @@ root=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1 </programlisting>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>specify additional mount options for the root filesystem. If not set, <filename>/etc/fstab</filename>
|
||||
of the real root will be parsed for special mount options and mounted
|
||||
of the real root will be parsed for special mount options and mounted
|
||||
accordingly.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><envar>rd.fstab</envar>=0</term>
|
||||
<listitem>
|
||||
<para>do not honor special mount options for the root filesystem found in
|
||||
<para>do not honor special mount options for the root filesystem found in
|
||||
<filename>/etc/fstab</filename> of the real root.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -134,7 +134,7 @@ This parameter can be specified multiple times.</para>
|
||||
<envar>rd.debug</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>set -x for the dracut shell and logs to dmesg, console and <filename>/init.log</filename></para>
|
||||
<para>set -x for the dracut shell and logs to dmesg, console and <filename>/run/initramfs/init.log</filename></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -169,14 +169,6 @@ This parameter can be specified multiple times.</para>
|
||||
<para>set udev to loglevel debug</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>rd.timestamp</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>export RDTIMESTAMP environment variable to init, which is set to the uptime of the dracut start.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect2>
|
||||
<refsect2>
|
||||
@@ -302,7 +294,7 @@ This parameter can be specified multiple times.</para>
|
||||
<listitem>
|
||||
<para>only activate the LUKS partitions with the given UUID
|
||||
Any "luks-" of the LUKS UUID is removed before comparing to <replaceable><luks uuid></replaceable>.
|
||||
The comparisons also matches, if <replaceable><luks uuid></replaceable> is only the beginning of the
|
||||
The comparisons also matches, if <replaceable><luks uuid></replaceable> is only the beginning of the
|
||||
LUKS UUID, so you don't have to specify the full UUID.
|
||||
This parameter can be specified multiple times.</para>
|
||||
</listitem>
|
||||
@@ -325,7 +317,7 @@ This parameter can be specified multiple times.</para>
|
||||
<envar>rd.luks.key=</envar><replaceable><keypath>:<keydev>:<luksdev></replaceable>
|
||||
</term>
|
||||
<listitem>
|
||||
<para><replaceable>keypath</replaceable> is a path to key file to look for. It's REQUIRED.</para>
|
||||
<para><replaceable>keypath</replaceable> is a path to key file to look for. It's REQUIRED. When <replaceable>keypath</replaceable> ends with '.gpg' it's considered to be key encrypted symmetrically with GPG. You will be prompted for password on boot. GPG support comes with 'crypt-gpg' module which needs to be added explicitly.</para>
|
||||
<para><replaceable>keydev</replaceable> is a device on which key file resides. It might be kernel name of devices (should start with "/dev/"), UUID (prefixed with "UUID=") or label (prefix with "LABEL="). You don't have to specify full UUID. Just its beginning will suffice, even if its ambiguous. All matching devices will be probed. This parameter is recommended, but not required. If not present, all block devices will be probed, which may significantly increase boot time.</para>
|
||||
<para>If <replaceable>luksdev</replaceable> is given, the specified key will only be applied for that LUKS device. Possible values are the same as for <replaceable>keydev</replaceable>. Unless you have several LUKS devices, you don't have to specify this parameter.</para>
|
||||
<para>The simplest usage is:</para>
|
||||
@@ -389,6 +381,37 @@ This parameter can be specified multiple times.</para>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect2>
|
||||
<refsect2>
|
||||
<title>FIPS</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><envar>rd.fips</envar></term>
|
||||
<listitem>
|
||||
<para>enable FIPS</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>boot=<replaceable><boot device></replaceable></envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>specify the device, where /boot is located.<programlisting>
|
||||
e.g.
|
||||
boot=/dev/sda1
|
||||
boot=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
|
||||
boot=UUID=<uuid>
|
||||
boot=LABEL=<label></programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><envar>rd.fips.skipkernel</envar></term>
|
||||
<listitem>
|
||||
<para>skip checksum check of the kernel image. Useful, if the kernel image is not in a separate boot partition.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect2>
|
||||
<refsect2>
|
||||
<title>Network</title>
|
||||
<variablelist>
|
||||
@@ -397,8 +420,8 @@ This parameter can be specified multiple times.</para>
|
||||
<envar>ip=</envar><replaceable>{dhcp|on|any|dhcp6|auto6|ibft}</replaceable>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>dhcp|on|any: get ip from dhcp server from all interfaces. If root=dhcp,
|
||||
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
|
||||
<para>dhcp|on|any: get ip from dhcp server from all interfaces. If root=dhcp,
|
||||
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
|
||||
with a valid DHCP root-path.</para>
|
||||
<para><constant>auto6</constant>: IPv6 autoconfiguration</para>
|
||||
<para><constant>dhcp6</constant>: IPv6 DHCP</para>
|
||||
@@ -436,7 +459,7 @@ This parameter can be specified multiple times.</para>
|
||||
<envar>bootdev=</envar><replaceable><interface></replaceable>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>specify network interface to use routing and netroot information from.
|
||||
<para>specify network interface to use routing and netroot information from.
|
||||
Required if multiple ip= lines are used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -478,7 +501,7 @@ NFS options can be appended with the prefix ":" or "," and a
|
||||
<envar>root=</envar><replaceable>{dhcp|dhcp6}</replaceable>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>root=dhcp alone directs initrd to look at the DHCP root-path where NFS
|
||||
<para>root=dhcp alone directs initrd to look at the DHCP root-path where NFS
|
||||
options can be specified.
|
||||
root-path=<server-ip>:<root-dir>[,<nfs-options>]
|
||||
root-path=nfs:<server-ip>:<root-dir>[,<nfs-options>]
|
||||
@@ -491,8 +514,8 @@ options can be specified.
|
||||
<envar> nfsroot=</envar><optional><replaceable><server-ip></replaceable>:</optional><replaceable><root-dir></replaceable><optional>:<replaceable><nfs-options></replaceable></optional>
|
||||
</term>
|
||||
<listitem>
|
||||
<para><emphasis remap="B">Deprecated!</emphasis> kernel Documentation<filename>/filesystems/nfsroot.txt</filename> defines
|
||||
this method.
|
||||
<para><emphasis remap="B">Deprecated!</emphasis> kernel Documentation<filename>/filesystems/nfsroot.txt</filename> defines
|
||||
this method.
|
||||
This is supported by dracut, but not recommended.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -530,7 +553,7 @@ then used in the Discovery Service stage in conjunction with other
|
||||
associated fields.</para>
|
||||
<para>See <ulink url="http://tools.ietf.org/html/rfc4173#section-5">http://tools.ietf.org/html/rfc4173</ulink>.</para>
|
||||
<para>e.g.:<programlisting>root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0 </programlisting></para>
|
||||
<para>If servername is an IPv6 address, it has to be put in brackets. e.g.:
|
||||
<para>If servername is an IPv6 address, it has to be put in brackets. e.g.:
|
||||
<programlisting>root=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0 </programlisting></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -545,7 +568,7 @@ associated fields.</para>
|
||||
<replaceable><LUN></replaceable>
|
||||
</optional>:<replaceable><targetname></replaceable> ...</term>
|
||||
<listitem>
|
||||
<para>multiple netroot options allow setting up multiple iscsi disks. e.g.:
|
||||
<para>multiple netroot options allow setting up multiple iscsi disks. e.g.:
|
||||
<programlisting>root=UUID=12424547
|
||||
netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
|
||||
netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 </programlisting></para>
|
||||
@@ -573,7 +596,7 @@ netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 </programlisting></par
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>root=</envar><replaceable>??? </replaceable><envar>rd.iscsi.firmware=1</envar>
|
||||
<envar>root=</envar><replaceable>??? </replaceable><envar>netroot=iscsi </envar><envar>rd.iscsi.firmware=1</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>will read the iscsi parameter from the BIOS firmware</para>
|
||||
@@ -608,9 +631,9 @@ For the second argument, currently only nodcb is supported. This parameter can b
|
||||
</term>
|
||||
<listitem>
|
||||
<para>with dhcp root-path=nbd:<server>:<port>[:<fstype>][:<mountopts>]
|
||||
root=dhcp alone directs initrd to look at the DHCP root-path where NBD
|
||||
root=dhcp alone directs initrd to look at the DHCP root-path where NBD
|
||||
options can be specified.
|
||||
This syntax is only usable in cases where you are directly mounting the volume
|
||||
This syntax is only usable in cases where you are directly mounting the volume
|
||||
as the rootfs.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -700,14 +723,6 @@ rd.znet=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar</programlisting></para>
|
||||
<para><envar>rd.ccw</envar></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>rdcopystate</envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para><envar>rd.copystate</envar></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>rd_DASD_MOD</envar>
|
||||
@@ -1200,7 +1215,7 @@ rd.znet=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar</programlisting></para>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Any files found in <filename>/etc/conf.d/</filename> will be sourced in the initramfs to
|
||||
set initial values. Command line options will override these values
|
||||
set initial values. Command line options will override these values
|
||||
set in the configuration files.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
62
dracut.spec
62
dracut.spec
@@ -6,32 +6,25 @@
|
||||
%define with_nbd 0
|
||||
%endif
|
||||
|
||||
%if %{defined gittag}
|
||||
%define rdist .git%{gittag}%{?dist}
|
||||
%define dashgittag -%{gittag}
|
||||
%else
|
||||
%define rdist %{?dist}
|
||||
%endif
|
||||
|
||||
Name: dracut
|
||||
Version: 009
|
||||
%define release_prefix 0%{?rdist}
|
||||
Release: %{release_prefix}
|
||||
Version: xxx
|
||||
Release: xxx
|
||||
|
||||
Summary: Initramfs generator using udev
|
||||
%if 0%{?fedora}
|
||||
Group: System Environment/Base
|
||||
Group: System Environment/Base
|
||||
%endif
|
||||
%if 0%{?suse_version}
|
||||
Group: System/Base
|
||||
%endif
|
||||
License: GPLv2+
|
||||
URL: http://apps.sourceforge.net/trac/dracut/wiki
|
||||
# Source can be generated by
|
||||
# http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=snapshot;h=%{?dashgittag};sf=tgz
|
||||
Source0: dracut-%{version}%{?dashgittag}.tar.bz2
|
||||
BuildArch: noarch
|
||||
License: GPLv2+
|
||||
URL: https://dracut.wiki.kernel.org/
|
||||
# Source can be generated by
|
||||
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz
|
||||
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: dash bash
|
||||
%if 0%{?fedora}
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
%endif
|
||||
@@ -92,25 +85,25 @@ Requires: util-linux >= 2.16
|
||||
|
||||
|
||||
%description
|
||||
Dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
|
||||
Unlike existing implementations, dracut does hard-code as little as possible
|
||||
into the initramfs. Dracut contains various modules which are driven by the
|
||||
event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
|
||||
Dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
|
||||
Unlike existing implementations, dracut does hard-code as little as possible
|
||||
into the initramfs. Dracut contains various modules which are driven by the
|
||||
event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
|
||||
NFS, iSCSI, NBD, FCoE with the dracut-network package.
|
||||
|
||||
%package network
|
||||
Summary: Dracut modules to build a dracut initramfs with network support
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: rpcbind
|
||||
Requires: rpcbind
|
||||
%if %{with_nbd}
|
||||
Requires: nbd
|
||||
%endif
|
||||
Requires: net-tools iproute
|
||||
Requires: iproute
|
||||
Requires: bridge-utils
|
||||
|
||||
%if 0%{?fedora}
|
||||
Requires: iscsi-initiator-utils
|
||||
Requires: nfs-utils
|
||||
Requires: nfs-utils
|
||||
Requires: dhclient
|
||||
%endif
|
||||
|
||||
@@ -161,17 +154,17 @@ Requires: %{name} = %{version}-%{release}
|
||||
This package contains tools to assemble the local initrd and host configuration.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}%{?dashgittag}
|
||||
%setup -q -n %{name}-%{version}
|
||||
|
||||
%build
|
||||
make WITH_SWITCH_ROOT=0%{?with_switch_root}
|
||||
make
|
||||
|
||||
%install
|
||||
%if 0%{?fedora}
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%endif
|
||||
make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin \
|
||||
sysconfdir=/etc mandir=%{_mandir} WITH_SWITCH_ROOT=0%{?with_switch_root}
|
||||
sysconfdir=/etc mandir=%{_mandir}
|
||||
|
||||
echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/10rpmversion/dracut-version
|
||||
|
||||
@@ -202,8 +195,8 @@ rm $RPM_BUILD_ROOT/sbin/mkinitrd
|
||||
rm $RPM_BUILD_ROOT/sbin/lsinitrd
|
||||
%endif
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d/dracut
|
||||
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/dracut
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
|
||||
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/dracut_log
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
@@ -212,9 +205,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg
|
||||
/sbin/dracut
|
||||
%if 0%{?with_switch_root}
|
||||
/sbin/switch_root
|
||||
%endif
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
/sbin/mkinitrd
|
||||
/sbin/lsinitrd
|
||||
@@ -228,7 +218,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%config(noreplace) /etc/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
%dir /etc/dracut.conf.d
|
||||
%config(noreplace) /etc/logrotate.d/dracut
|
||||
%{_mandir}/man8/dracut.8*
|
||||
%{_mandir}/man7/dracut.kernel.7*
|
||||
%{_mandir}/man5/dracut.conf.5*
|
||||
@@ -248,6 +237,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/dracut/modules.d/90lvm
|
||||
%{_datadir}/dracut/modules.d/90mdraid
|
||||
%{_datadir}/dracut/modules.d/90multipath
|
||||
%{_datadir}/dracut/modules.d/91crypt-gpg
|
||||
%{_datadir}/dracut/modules.d/95debug
|
||||
%{_datadir}/dracut/modules.d/95resume
|
||||
%{_datadir}/dracut/modules.d/95rootfs-block
|
||||
@@ -261,8 +251,8 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/dracut/modules.d/98selinux
|
||||
%{_datadir}/dracut/modules.d/98syslog
|
||||
%{_datadir}/dracut/modules.d/99base
|
||||
# logfile needs no logrotate, because it gets overwritten
|
||||
# for every dracut run
|
||||
%{_datadir}/dracut/modules.d/99shutdown
|
||||
%config(noreplace) /etc/logrotate.d/dracut_log
|
||||
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
|
||||
%dir %{_sharedstatedir}/initramfs
|
||||
|
||||
@@ -287,7 +277,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%defattr(-,root,root,0755)
|
||||
%{_datadir}/dracut/modules.d/02caps
|
||||
|
||||
%files tools
|
||||
%files tools
|
||||
%defattr(-,root,root,0755)
|
||||
%{_mandir}/man8/dracut-gencmdline.8*
|
||||
%{_mandir}/man8/dracut-catimages.8*
|
||||
|
14
dracut.xml
14
dracut.xml
@@ -74,7 +74,7 @@
|
||||
<para>A <acronym>TFTP</acronym> server (on systems that can boot from Ethernet) </para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>The bootloader will load the kernel and initial root file system image into memory and then start the kernel, passing in the memory address of the image.
|
||||
<para>The bootloader will load the kernel and initial root file system image into memory and then start the kernel, passing in the memory address of the image.
|
||||
</para>
|
||||
<para>Depending on which algorithms were compiled statically into it, the kernel can currently unpack initrd/initramfs images compressed with gzip, bzip2 and <acronym>LZMA</acronym>. </para>
|
||||
</section>
|
||||
@@ -307,7 +307,7 @@ rd.live.overlay/
|
||||
<listitem>
|
||||
<para>With dracut >= 002-11, you can inspect the rd.debug output with:
|
||||
</para>
|
||||
<screen># less /init.log
|
||||
<screen># less /run/initramfs/init.log
|
||||
# dmesg | less</screen>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
@@ -431,7 +431,7 @@ title Fedora (2.6.29.5-191.fc11.x86_64)
|
||||
<para>Remove the boot arguments ''rhgb'' and ''quiet''
|
||||
</para>
|
||||
<para>
|
||||
A sample <filename>/etc/grub.conf</filename> bootloader configuration file is listed below.
|
||||
A sample <filename>/etc/grub.conf</filename> bootloader configuration file is listed below.
|
||||
</para>
|
||||
<para><screen>default=0
|
||||
timeout=5
|
||||
@@ -439,12 +439,12 @@ serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
title Fedora (2.6.29.5-191.fc11.x86_64)
|
||||
root (hd0,0)
|
||||
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
|
||||
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
|
||||
initrd /dracut-2.6.29.5-191.fc11.x86_64.img</screen></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>If system boot fails, you will be dropped into a shell as seen in the example below.
|
||||
<screen>No root device found
|
||||
<screen>No root device found
|
||||
Dropping to debug shell.
|
||||
|
||||
sh: can't access tty; job control turned off
|
||||
@@ -623,7 +623,7 @@ Common used functions are in <filename>dracut-lib.sh</filename>, which can be so
|
||||
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh</programlisting>
|
||||
<para>The <filename>pase-instmodpost.sh</filename> parses the kernel command line for a argument <envar>rd.driver.post</envar>, blacklists the module from being autoloaded and installs the hook <filename>insmodpost.sh</filename> in the <filename>initqueue-settled</filename>.</para>
|
||||
<para><filename>parse-insmodpost.sh</filename>:</para>
|
||||
<programlisting>for p in $(getargs rd.driver.post=); do
|
||||
<programlisting>for p in $(getargs rd.driver.post=); do
|
||||
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
|
||||
_do_insmodpost=1
|
||||
done
|
||||
@@ -635,7 +635,7 @@ unset _do_insmodpost
|
||||
<para><filename>insmodpost.sh</filename>:</para>
|
||||
<programlisting>. /lib/dracut-lib.sh
|
||||
|
||||
for p in $(getargs rd.driver.post=); do
|
||||
for p in $(getargs rd.driver.post=); do
|
||||
modprobe $p
|
||||
done
|
||||
</programlisting>
|
||||
|
66
git2spec.pl
Executable file
66
git2spec.pl
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
sub last_tag {
|
||||
open( GIT, 'git log --pretty=format:%H |');
|
||||
LINE: while( <GIT> ) {
|
||||
open( GIT2, "git tag --contains $_ |");
|
||||
while( <GIT2> ) {
|
||||
chomp;
|
||||
last LINE if /..*/;
|
||||
}
|
||||
close GIT2;
|
||||
}
|
||||
$tag=$_;
|
||||
close GIT2;
|
||||
close GIT; # be done
|
||||
return $tag;
|
||||
};
|
||||
|
||||
sub create_patches {
|
||||
my $tag=shift;
|
||||
my $num=0;
|
||||
open( GIT, 'git format-patch -M -N --no-signature '.$tag.' |');
|
||||
@lines=<GIT>;
|
||||
close GIT; # be done
|
||||
return @lines;
|
||||
};
|
||||
use POSIX qw(strftime);
|
||||
my $datestr = strftime "%Y%m%d", gmtime;
|
||||
|
||||
my $tag=shift;
|
||||
$tag=&last_tag if not defined $tag;
|
||||
my @patches=&create_patches($tag);
|
||||
my $num=$#patches + 2;
|
||||
$tag=~s/[^0-9]+?([0-9]+)/$1/;
|
||||
my $release="$num.git$datestr";
|
||||
$release="1" if $num == 1;
|
||||
|
||||
while(<>) {
|
||||
if (/^Version:/) {
|
||||
print "Version: $tag\n";
|
||||
}
|
||||
elsif (/^Release:/) {
|
||||
print "Release: $release\n";
|
||||
}
|
||||
elsif ((/^Source0:/) || (/^Source:/)) {
|
||||
print $_;
|
||||
$num=1;
|
||||
for(@patches) {
|
||||
print "Patch$num: $_";
|
||||
$num++;
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
elsif (/^%setup/) {
|
||||
print $_;
|
||||
$num=1;
|
||||
for(@patches) {
|
||||
print "%patch$num -p1\n";
|
||||
$num++;
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
else {
|
||||
print $_;
|
||||
}
|
||||
}
|
19
lsinitrd
19
lsinitrd
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
@@ -19,28 +19,31 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
[[ $# -eq 1 || $# -eq 2 ]] || { echo "Usage: $(basename $0) <initramfs file> [<filename>]" ; exit 1 ; }
|
||||
[[ -f $1 ]] || { echo "$1 does not exist" ; exit 1 ; }
|
||||
[[ $# -le 2 ]] || { echo "Usage: $(basename $0) [<initramfs file> [<filename>]]" ; exit 1 ; }
|
||||
image="${1:-/boot/initramfs-$(uname -r).img}"
|
||||
[[ -f "$image" ]] || { echo "$image does not exist" ; exit 1 ; }
|
||||
|
||||
CAT=zcat
|
||||
FILE_T=$(file $1)
|
||||
FILE_T=$(file "$image")
|
||||
|
||||
if [[ "$FILE_T" =~ ": gzip compressed data" ]]; then
|
||||
CAT=zcat
|
||||
elif [[ "$FILE_T" =~ ": xz compressed data" ]]; then
|
||||
CAT=xzcat
|
||||
elif [[ "$FILE_T" =~ ": XZ compressed data" ]]; then
|
||||
CAT=xzcat
|
||||
elif [[ "$FILE_T" =~ ": data" ]]; then
|
||||
CAT=lzcat
|
||||
fi
|
||||
|
||||
if [[ $# -eq 2 ]]; then
|
||||
$CAT $1 | cpio --extract --verbose --quiet --to-stdout ${2#/} 2>/dev/null
|
||||
$CAT $image | cpio --extract --verbose --quiet --to-stdout ${2#/} 2>/dev/null
|
||||
exit $?
|
||||
fi
|
||||
|
||||
echo "$1:"
|
||||
echo "$image:"
|
||||
echo "========================================================================"
|
||||
$CAT $1 | cpio --extract --verbose --quiet --to-stdout 'lib/dracut/dracut-*' 2>/dev/null
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout 'lib/dracut/dracut-*' 2>/dev/null
|
||||
echo "========================================================================"
|
||||
$CAT $1 | cpio --extract --verbose --quiet --list
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list
|
||||
echo "========================================================================"
|
||||
|
@@ -12,16 +12,16 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
inst /sbin/bootchartd
|
||||
inst /bin/bash
|
||||
inst /sbin/bootchartd
|
||||
inst /bin/bash
|
||||
inst_symlink /init /sbin/init
|
||||
inst_dir /lib/bootchart/tmpfs
|
||||
inst /lib/bootchart/bootchart-collector
|
||||
inst /etc/bootchartd.conf
|
||||
inst /sbin/accton
|
||||
inst /lib/bootchart/bootchart-collector
|
||||
inst /etc/bootchartd.conf
|
||||
inst /sbin/accton
|
||||
inst /usr/bin/pkill /bin/pkill
|
||||
inst /bin/echo
|
||||
inst /bin/grep
|
||||
inst /bin/grep
|
||||
inst /bin/usleep
|
||||
inst /usr/bin/[ /bin/[
|
||||
|
||||
|
12
modules.d/01fips/fips-boot.sh
Executable file
12
modules.d/01fips/fips-boot.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
elif getarg boot= >/dev/null; then
|
||||
. /sbin/fips.sh
|
||||
if mount_boot; then
|
||||
do_fips || die "FIPS integrity test failed"
|
||||
fi
|
||||
fi
|
11
modules.d/01fips/fips-noboot.sh
Executable file
11
modules.d/01fips/fips-noboot.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
elif ! [ -f /tmp/fipsdone ]; then
|
||||
. /sbin/fips.sh
|
||||
mount_boot
|
||||
do_fips || die "FIPS integrity test failed"
|
||||
fi
|
@@ -1,55 +1,69 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
do_fips()
|
||||
|
||||
mount_boot()
|
||||
{
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
BOOT=$(getarg boot=)
|
||||
KERNEL=$(uname -r)
|
||||
case "$boot" in
|
||||
block:LABEL=*|LABEL=*)
|
||||
boot="${boot#block:}"
|
||||
boot=$(getarg boot=)
|
||||
|
||||
if [ -n "$boot" ]; then
|
||||
case "$boot" in
|
||||
LABEL=*)
|
||||
boot="$(echo $boot | sed 's,/,\\x2f,g')"
|
||||
boot="/dev/disk/by-label/${boot#LABEL=}"
|
||||
bootok=1 ;;
|
||||
block:UUID=*|UUID=*)
|
||||
boot="${boot#block:}"
|
||||
boot="/dev/disk/by-uuid/${root#UUID=}"
|
||||
bootok=1 ;;
|
||||
;;
|
||||
UUID=*)
|
||||
boot="/dev/disk/by-uuid/${boot#UUID=}"
|
||||
;;
|
||||
/dev/*)
|
||||
bootok=1 ;;
|
||||
;;
|
||||
*)
|
||||
die "You have to specify boot=<boot device> as a boot option for fips=1" ;;
|
||||
esac
|
||||
esac
|
||||
|
||||
if ! [ -e "$boot" ]; then
|
||||
udevadm trigger --action=add >/dev/null 2>&1
|
||||
[ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
|
||||
|
||||
if [ $UDEVVERSION -ge 143 ]; then
|
||||
udevadm settle --exit-if-exists=$boot
|
||||
else
|
||||
udevadm settle --timeout=30
|
||||
if ! [ -e "$boot" ]; then
|
||||
udevadm trigger --action=add >/dev/null 2>&1
|
||||
[ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
|
||||
i=0
|
||||
while ! [ -e $boot ]; do
|
||||
if [ $UDEVVERSION -ge 143 ]; then
|
||||
udevadm settle --exit-if-exists=$boot
|
||||
else
|
||||
udevadm settle --timeout=30
|
||||
fi
|
||||
[ -e $boot ] && break
|
||||
modprobe scsi_wait_scan && rmmod scsi_wait_scan
|
||||
[ -e $boot ] && break
|
||||
sleep 0.5
|
||||
i=$(($i+1))
|
||||
[ $i -gt 40 ] && break
|
||||
done
|
||||
fi
|
||||
|
||||
[ -e "$boot" ] || return 1
|
||||
|
||||
mkdir /boot
|
||||
info "Mounting $boot as /boot"
|
||||
mount -oro "$boot" /boot || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
[ -e "$boot" ]
|
||||
|
||||
mkdir /boot
|
||||
info "Mounting $boot as /boot"
|
||||
mount -oro "$boot" /boot
|
||||
|
||||
do_fips()
|
||||
{
|
||||
info "Checking integrity of kernel"
|
||||
newroot=$NEWROOT
|
||||
KERNEL=$(uname -r)
|
||||
|
||||
if ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
|
||||
warn "/boot/.vmlinuz-${KERNEL}.hmac does not exist"
|
||||
[ -e "$newroot/boot/.vmlinuz-${KERNEL}.hmac" ] || unset newroot
|
||||
|
||||
if ! [ -e "$newroot/boot/.vmlinuz-${KERNEL}.hmac" ]; then
|
||||
warn "$newroot/boot/.vmlinuz-${KERNEL}.hmac does not exist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
sha512hmac -c "$newroot/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
|
||||
info "Umounting /boot"
|
||||
umount /boot
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
|
||||
info "Loading and integrity checking all crypto modules"
|
||||
for module in $FIPSMODULES; do
|
||||
@@ -60,15 +74,11 @@ do_fips()
|
||||
info "Self testing crypto algorithms"
|
||||
modprobe tcrypt || return 1
|
||||
rmmod tcrypt
|
||||
info "All initrd crypto checks done"
|
||||
info "All initrd crypto checks done"
|
||||
|
||||
> /tmp/fipsdone
|
||||
|
||||
umount /boot >/dev/null 2>&1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
else
|
||||
set -e
|
||||
do_fips || die "FIPS integrity test failed"
|
||||
set +e
|
||||
fi
|
||||
|
@@ -11,31 +11,39 @@ depends() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
FIPSMODULES="aead aes_generici aes-xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr"
|
||||
FIPSMODULES="$FIPSMODULES des deflate ecb eseqiv hmac seqiv sha256 sha512"
|
||||
FIPSMODULES="$FIPSMODULES cryptomgr crypto_null tcrypt"
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aead aes_generici aes-xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr"
|
||||
_fipsmodules+=" des deflate ecb eseqiv hmac seqiv sha256 sha512"
|
||||
_fipsmodules+=" cryptomgr crypto_null tcrypt"
|
||||
|
||||
mkdir -p "${initdir}/etc/modprobe.d"
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
for mod in $FIPSMODULES; do
|
||||
if instmods $mod; then
|
||||
echo $mod >> "${initdir}/etc/fipsmodules"
|
||||
echo "blacklist $mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
for _mod in $_fipsmodules; do
|
||||
if instmods $_mod; then
|
||||
echo $_mod >> "${initdir}/etc/fipsmodules"
|
||||
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_hook pre-trigger 01 "$moddir/fips.sh"
|
||||
local _dir
|
||||
inst_hook pre-trigger 01 "$moddir/fips-boot.sh"
|
||||
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
|
||||
inst "$moddir/fips.sh" /sbin/fips.sh
|
||||
|
||||
dracut_install sha512hmac rmmod insmod mount uname umount
|
||||
|
||||
for dir in "$usrlibdir" "$libdir"; do
|
||||
[[ -e $dir/libsoftokn3.so ]] && \
|
||||
dracut_install $dir/libsoftokn3.so $dir/libsoftokn3.chk \
|
||||
$dir/libfreebl3.so $dir/libfreebl3.chk && \
|
||||
for _dir in "$usrlibdir" "$libdir"; do
|
||||
[[ -e $_dir/libsoftokn3.so ]] && \
|
||||
dracut_install $_dir/libsoftokn3.so $_dir/libsoftokn3.chk \
|
||||
$_dir/libfreebl3.so $_dir/libfreebl3.chk && \
|
||||
break
|
||||
done
|
||||
|
||||
dracut_install $usrlibdir/hmaccalc/sha512hmac.hmac
|
||||
if command -v prelink >/dev/null; then
|
||||
dracut_install prelink
|
||||
fi
|
||||
}
|
||||
|
||||
|
@@ -12,7 +12,7 @@ if [ "$capsmode" = "1" ]; then
|
||||
|
||||
info "Loading CAPS_MODULES $CAPS_MODULES"
|
||||
for i in $CAPS_MODULES;do modprobe $i 2>&1 >/dev/null | vinfo; done
|
||||
|
||||
|
||||
if [ "$CAPS_MODULES_DISABLED" = "1" -a -e /proc/sys/kernel/modules_disabled ]; then
|
||||
info "Disabling module loading."
|
||||
echo $CAPS_MODULES_DISABLED > /proc/sys/kernel/modules_disabled
|
||||
@@ -29,7 +29,7 @@ if [ "$capsmode" = "1" ]; then
|
||||
echo $CAPS_USERMODEHELPER_BSET > /proc/sys/kernel/usermodehelper/bset
|
||||
echo $CAPS_USERMODEHELPER_BSET > /proc/sys/kernel/usermodehelper/inheritable
|
||||
fi
|
||||
|
||||
|
||||
echo "CAPS_INIT_DROP=\"$CAPS_INIT_DROP\"" > /etc/capsdrop
|
||||
info "Will drop capabilities $CAPS_INIT_DROP from init."
|
||||
fi
|
||||
|
@@ -13,18 +13,23 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
inst busybox /sbin/busybox
|
||||
local _i _progs _path
|
||||
inst busybox /usr/bin/busybox
|
||||
|
||||
# List of shell programs that we use in other official dracut modules, that
|
||||
# must be supported by the busybox installed on the host system
|
||||
progs="echo grep usleep [ rmmod insmod mount uname umount setfont kbd_mode stty gzip bzip2 chvt readlink blkid dd losetup tr sed seq ps more cat rm free ping netstat vi ping6 fsck ip hostname basename mknod mkdir pidof sleep chroot ls cp mv dmesg mkfifo less ln modprobe"
|
||||
_progs="echo grep usleep [ rmmod insmod mount uname umount setfont kbd_mode stty gzip bzip2 chvt readlink blkid dd losetup tr sed seq ps more cat rm free ping netstat vi ping6 fsck ip hostname basename mknod mkdir pidof sleep chroot ls cp mv dmesg mkfifo less ln modprobe"
|
||||
|
||||
# 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")
|
||||
ln -s /sbin/busybox "$initdir/$path"
|
||||
for _i in $_progs; do
|
||||
_path=$(find_binary "$_i")
|
||||
if [[ $_path != ${_path#/usr} ]]; then
|
||||
ln -s ../../usr/bin/busybox "$initdir/$_path"
|
||||
else
|
||||
ln -s ../usr/bin/busybox "$initdir/$_path"
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ distributions. To deal with it avoiding hardcoding those differences in
|
||||
the installation script we handle it by mappings between variables used
|
||||
by Dracut and the ones in the system. Package maintainer is expected to
|
||||
create those for his/her distribution and it's appreciated to share it
|
||||
with us, so we can include it in source package.
|
||||
with us, so we can include it in source package.
|
||||
|
||||
|
||||
1. Hostonly vs Generic
|
||||
|
@@ -61,7 +61,6 @@ dev_open() {
|
||||
exec 7>>${dev}
|
||||
}
|
||||
|
||||
|
||||
dev=/dev/${1#/dev/}
|
||||
devname=${dev#/dev/}
|
||||
|
||||
@@ -70,8 +69,6 @@ devname=${dev#/dev/}
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -e /tmp/console_init.${devname} ] && exit 0
|
||||
|
||||
dev_open ${dev}
|
||||
|
||||
for fd in 6 7; do
|
||||
@@ -88,4 +85,4 @@ set_font ${dev}
|
||||
set_keymap
|
||||
|
||||
dev_close
|
||||
>/tmp/console_init.${devname}
|
||||
|
||||
|
@@ -11,6 +11,7 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
[ -x /lib/systemd/systemd-vconsole-setup ] && dracut_install /lib/systemd/systemd-vconsole-setup
|
||||
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
|
||||
DEFAULT_FONT=LatArCyrHeb-16
|
||||
I18N_CONF="/etc/locale.conf"
|
||||
@@ -177,12 +178,12 @@ install() {
|
||||
for kbddir in ${kbddir} /usr/lib/kbd /lib/kbd /usr/share /usr/share/kbd
|
||||
do
|
||||
[[ -d "${kbddir}" ]] && \
|
||||
for dir in ${KBDSUBDIRS//,/ }
|
||||
for dir in ${KBDSUBDIRS//,/ }
|
||||
do
|
||||
[[ -d "${kbddir}/${dir}" ]] && continue
|
||||
false
|
||||
done && break
|
||||
kbddir=''
|
||||
kbddir=''
|
||||
done
|
||||
|
||||
[[ ${kbddir} ]] || {
|
||||
|
@@ -20,9 +20,9 @@ inst_key_val() {
|
||||
}
|
||||
|
||||
inst_key_val '' /etc/vconsole.conf KEYMAP vconsole.keymap KEYTABLE
|
||||
inst_key_val '' /etc/vconsole.conf FONT vconsole.font SYSFONT
|
||||
inst_key_val '' /etc/vconsole.conf FONT_MAP vconsole.font.map CONTRANS
|
||||
inst_key_val '' /etc/vconsole.conf FONT_UNIMAP vconsole.font.unimap UNIMAP
|
||||
inst_key_val '' /etc/vconsole.conf FONT vconsole.font SYSFONT
|
||||
inst_key_val '' /etc/vconsole.conf FONT_MAP vconsole.font.map CONTRANS
|
||||
inst_key_val '' /etc/vconsole.conf FONT_UNIMAP vconsole.font.unimap UNIMAP
|
||||
inst_key_val 1 /etc/vconsole.conf UNICODE vconsole.unicode vconsole.font.unicode
|
||||
inst_key_val '' /etc/vconsole.conf EXT_KEYMAP vconsole.keymap.ext
|
||||
|
||||
@@ -35,3 +35,10 @@ if [ -f /etc/locale.conf ]; then
|
||||
export LC_ALL
|
||||
fi
|
||||
|
||||
# FIXME: fix systemd-vconsole-setup
|
||||
#if [ -x /lib/systemd/systemd-vconsole-setup ]; then
|
||||
# /lib/systemd/systemd-vconsole-setup
|
||||
# rm -f /{etc,lib}/udev/rules.d/10-console.rules
|
||||
# rm -f /lib/udev/console_init
|
||||
# ln -s /lib/systemd/systemd-vconsole-setup /lib/udev/console_init
|
||||
#fi
|
||||
|
@@ -11,14 +11,16 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
local _line
|
||||
local _dracut_rpm_version
|
||||
if [ -e "$moddir/dracut-version" ]; then
|
||||
dracut_rpm_version=$(cat "$moddir/dracut-version")
|
||||
inst "$moddir/dracut-version" /lib/dracut/$dracut_rpm_version
|
||||
_dracut_rpm_version=$(cat "$moddir/dracut-version")
|
||||
inst "$moddir/dracut-version" /lib/dracut/$_dracut_rpm_version
|
||||
else
|
||||
if rpm -qf $(type -P $0) &>/dev/null; then
|
||||
dracut_rpm_version=$(rpm -qf --qf '%{name}-%{version}-%{release}\n' $(type -P $0) | { ver="";while read line;do ver=$line;done;echo $ver;} )
|
||||
mkdir -m 0755 -p $initdir/lib $initdir/lib/dracut
|
||||
echo $dracut_rpm_version > $initdir/lib/dracut/$dracut_rpm_version
|
||||
_dracut_rpm_version=$(rpm -qf --qf '%{name}-%{version}-%{release}\n' $(type -P $0) | { ver="";while read _line;do ver=$_line;done;echo $ver;} )
|
||||
mkdir -m 0755 -p $initdir/lib/dracut
|
||||
echo $_dracut_rpm_version > $initdir/lib/dracut/$_dracut_rpm_version
|
||||
fi
|
||||
fi
|
||||
inst_hook cmdline 01 "$moddir/version.sh"
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
@@ -37,17 +37,17 @@ setup_interface() {
|
||||
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
}
|
||||
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
export PS4="dhclient.$interface.$$ + "
|
||||
exec >>/run/initramfs/initlog.pipe 2>>/run/initramfs/initlog.pipe
|
||||
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
# We already need a set netif here
|
||||
@@ -68,13 +68,13 @@ case $reason in
|
||||
warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
|
||||
exit 1
|
||||
fi
|
||||
setup_interface
|
||||
setup_interface
|
||||
set | while read line; do
|
||||
[ "${line#new_}" = "$line" ] && continue
|
||||
echo "$line"
|
||||
echo "$line"
|
||||
done >/tmp/dhclient.$netif.dhcpopts
|
||||
echo online > /sys/class/net/$netif/uevent
|
||||
/sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
|
||||
initqueue --onetime --name netroot-$netif netroot $netif
|
||||
;;
|
||||
*) echo "dhcp: $reason";;
|
||||
esac
|
||||
|
@@ -1,3 +1,3 @@
|
||||
request subnet-mask, broadcast-address, time-offset, routers,
|
||||
domain-name, domain-name-servers, domain-search, host-name,
|
||||
root-path, interface-mtu;
|
||||
root-path, interface-mtu;
|
||||
|
@@ -21,5 +21,5 @@ if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] ; th
|
||||
|
||||
# Shut up init error check
|
||||
[ -z "$root" ] && root="dhcp"
|
||||
echo '[ -d $NEWROOT/proc -o -e /dev/root ]' > $hookdir/initqueue-finished/dhcp.sh
|
||||
echo '[ -d $NEWROOT/proc -o -e /dev/root ]' > $hookdir/initqueue/finished/dhcp.sh
|
||||
fi
|
||||
|
@@ -5,13 +5,13 @@
|
||||
# We don't need to check for ip= errors here, that is handled by the
|
||||
# cmdline parser script
|
||||
#
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
# Run dhclient
|
||||
do_dhcp() {
|
||||
# /sbin/dhclient-script will mark the netif up and generate the online
|
||||
# dhclient-script will mark the netif up and generate the online
|
||||
# event for nfsroot
|
||||
# XXX add -V vendor class and option parsing per kernel
|
||||
echo "Starting dhcp for interface $netif"
|
||||
@@ -32,10 +32,10 @@ load_ipv6() {
|
||||
do_ipv6auto() {
|
||||
load_ipv6
|
||||
{
|
||||
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
|
||||
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
|
||||
echo ip link set $netif up
|
||||
echo ip link set $netif up
|
||||
echo wait_for_if_up $netif
|
||||
} > /tmp/net.$netif.up
|
||||
|
||||
@@ -44,13 +44,13 @@ do_ipv6auto() {
|
||||
namesrv=$(getargs nameserver)
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
|
||||
|
||||
echo online > /sys/class/net/$netif/uevent
|
||||
/sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
|
||||
initqueue --onetime --name netroot-$netif netroot $netif
|
||||
}
|
||||
|
||||
# Handle static ip configuration
|
||||
@@ -58,7 +58,7 @@ do_static() {
|
||||
strstr $ip '*:*:*' && load_ipv6
|
||||
|
||||
{
|
||||
echo ip link set $netif up
|
||||
echo ip link set $netif up
|
||||
echo wait_for_if_up $netif
|
||||
# do not flush addr for ipv6
|
||||
strstr $ip '*:*:*' || \
|
||||
@@ -72,18 +72,16 @@ do_static() {
|
||||
namesrv=$(getargs nameserver)
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
|
||||
echo online > /sys/class/net/$netif/uevent
|
||||
/sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
|
||||
initqueue --onetime --name netroot-$netif netroot $netif
|
||||
}
|
||||
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
|
||||
export PS4="ifup.$1.$$ + "
|
||||
exec >>/run/initramfs/initlog.pipe 2>>/run/initramfs/initlog.pipe
|
||||
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
# Huh? No $1?
|
||||
@@ -181,7 +179,7 @@ fi
|
||||
# start bridge if necessary
|
||||
if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes /sbin/ifup $bondname
|
||||
DO_BOND_SETUP=yes ifup $bondname
|
||||
else
|
||||
ip link set $ethname up
|
||||
fi
|
||||
@@ -225,7 +223,7 @@ for p in $(getargs ip=); do
|
||||
do_dhcp -6 ;;
|
||||
auto6)
|
||||
do_ipv6auto ;;
|
||||
*)
|
||||
*)
|
||||
do_static ;;
|
||||
esac
|
||||
break
|
||||
|
@@ -3,11 +3,12 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
local _program
|
||||
. $dracutfunctions
|
||||
|
||||
for program in ip arping dhclient ; do
|
||||
if ! type -P $program >/dev/null; then
|
||||
derror "Could not find program \"$program\" required by network."
|
||||
for _program in ip arping dhclient ; do
|
||||
if ! type -P $_program >/dev/null; then
|
||||
derror "Could not find program \"$_program\" required by network."
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
@@ -24,11 +25,11 @@ installkernel() {
|
||||
# Include wired net drivers, excluding wireless
|
||||
|
||||
net_module_test() {
|
||||
local net_drivers='eth_type_trans|register_virtio_device'
|
||||
local unwanted_drivers='/(wireless|isdn|uwb)/'
|
||||
egrep -q $net_drivers "$1" && \
|
||||
local _net_drivers='eth_type_trans|register_virtio_device'
|
||||
local _unwanted_drivers='/(wireless|isdn|uwb)/'
|
||||
egrep -q $_net_drivers "$1" && \
|
||||
egrep -qv 'iw_handler_get_spy' "$1" && \
|
||||
[[ ! $1 =~ $unwanted_drivers ]]
|
||||
[[ ! $1 =~ $_unwanted_drivers ]]
|
||||
}
|
||||
|
||||
instmods $(filter_kernel_modules net_module_test)
|
||||
@@ -42,12 +43,13 @@ installkernel() {
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install ip arping tr dhclient
|
||||
local _arch _i _dir
|
||||
dracut_install ip arping tr dhclient
|
||||
dracut_install -o brctl ifenslave
|
||||
inst "$moddir/ifup" "/sbin/ifup"
|
||||
inst "$moddir/netroot" "/sbin/netroot"
|
||||
inst "$moddir/dhclient-script" "/sbin/dhclient-script"
|
||||
inst "$moddir/dhclient.conf" "/etc/dhclient.conf"
|
||||
inst "$moddir/dhclient.conf" "/etc/dhclient.conf"
|
||||
inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
|
||||
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
@@ -57,12 +59,12 @@ install() {
|
||||
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
|
||||
inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
|
||||
|
||||
arch=$(uname -m)
|
||||
_arch=$(uname -m)
|
||||
|
||||
for dir in "$usrlibdir/tls/$arch" "$usrlibdir/tls" "$usrlibdir/$arch" \
|
||||
for _dir in "$usrlibdir/tls/$_arch" "$usrlibdir/tls" "$usrlibdir/$_arch" \
|
||||
"$usrlibdir" "$libdir"; do
|
||||
for i in "$dir"/libnss_dns.so.* "$dir"/libnss_mdns4_minimal.so.*; do
|
||||
[ -e "$i" ] && dracut_install "$i"
|
||||
for _i in "$_dir"/libnss_dns.so.* "$_dir"/libnss_mdns4_minimal.so.*; do
|
||||
[ -e "$_i" ] && dracut_install "$_i"
|
||||
done
|
||||
done
|
||||
|
||||
|
@@ -40,12 +40,12 @@ fix_bootif() {
|
||||
# If we have to handle multiple interfaces, handle only them.
|
||||
elif [ -n "$IFACES" ] ; then
|
||||
for iface in $IFACES ; do
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
|
||||
printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
|
||||
done
|
||||
|
||||
# Default: We don't know the interface to use, handle all
|
||||
else
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", RUN+="/sbin/ifup $env{INTERFACE}"\n'
|
||||
printf 'SUBSYSTEM=="net", RUN+="/sbin/ifup $env{INTERFACE}"\n'
|
||||
fi
|
||||
|
||||
} > /etc/udev/rules.d/60-net.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
|
||||
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
@@ -20,18 +20,18 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
[ -z "$netroot" ] && exit 1
|
||||
|
||||
# Let's see if we have to wait for other interfaces
|
||||
# Note: exit works just fine, since the last interface to be
|
||||
# Note: exit works just fine, since the last interface to be
|
||||
# online'd should see all files
|
||||
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
|
||||
for iface in $IFACES ; do
|
||||
[ -e /tmp/net.$iface.up ] || exit 1
|
||||
done
|
||||
|
||||
# Set or override primary interface
|
||||
# Set or override primary interface
|
||||
netif=$1
|
||||
[ -e "/tmp/net.bootdev" ] && read netif < /tmp/net.bootdev
|
||||
|
||||
# Figure out the handler for root=dhcp by recalling all netroot cmdline
|
||||
# Figure out the handler for root=dhcp by recalling all netroot cmdline
|
||||
# handlers
|
||||
if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
|
||||
# Unset root so we can check later
|
||||
@@ -40,7 +40,7 @@ if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
|
||||
# Load dhcp options
|
||||
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
|
||||
|
||||
# If we have a specific bootdev with no dhcpoptions or empty root-path,
|
||||
# If we have a specific bootdev with no dhcpoptions or empty root-path,
|
||||
# we die. Otherwise we just warn
|
||||
if [ -z "$new_root_path" ] ; then
|
||||
[ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
|
||||
@@ -55,7 +55,7 @@ if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
|
||||
for f in $hookdir/cmdline/90*.sh; do
|
||||
[ -f "$f" ] && . "$f";
|
||||
done
|
||||
else
|
||||
else
|
||||
rootok="1"
|
||||
fi
|
||||
|
||||
@@ -65,7 +65,7 @@ fi
|
||||
|
||||
handler=${netroot%%:*}
|
||||
handler=${handler%%4}
|
||||
handler="/sbin/${handler}root"
|
||||
handler=$(command -v ${handler}root)
|
||||
if [ -z "$netroot" ] || [ ! -e "$handler" ] ; then
|
||||
die "No handler for netroot type '$netroot'"
|
||||
fi
|
||||
@@ -89,7 +89,7 @@ done
|
||||
# Note: This assumes that if no router is present the
|
||||
# root server is on the same subnet.
|
||||
#
|
||||
# TODO There's some netroot variants that don't (yet) have their
|
||||
# TODO There's some netroot variants that don't (yet) have their
|
||||
# server-ip netroot
|
||||
|
||||
# Get router IP if set
|
||||
@@ -136,7 +136,7 @@ if $handler $netif $netroot $NEWROOT; then
|
||||
|
||||
# Save used netif for later use
|
||||
[ ! -f /tmp/net.ifaces ] && echo $netif > /tmp/net.ifaces
|
||||
else
|
||||
else
|
||||
warn "Mounting root via '$netif' failed"
|
||||
# If we're trying with multiple interfaces, put that one down.
|
||||
# ip down/flush ensures that routeing info goes away as well
|
||||
|
@@ -13,7 +13,7 @@
|
||||
# return if bond already parsed
|
||||
[ -n "$bondname" ] && return
|
||||
|
||||
# Check if bond parameter is valid
|
||||
# Check if bond parameter is valid
|
||||
if getarg bond= >/dev/null ; then
|
||||
if [ -z "$netroot" ] ; then
|
||||
die "No netboot configured, bond is invalid"
|
||||
@@ -46,7 +46,7 @@ unset bondname bondslaves bondoptions
|
||||
if getarg bond >/dev/null; then
|
||||
# Read bond= parameters if they exist
|
||||
bond="$(getarg bond=)"
|
||||
if [ ! "$bond" = "bond" ]; then
|
||||
if [ ! "$bond" = "bond" ]; then
|
||||
parsebond "$(getarg bond=)"
|
||||
fi
|
||||
# Simple default bond
|
||||
|
@@ -11,7 +11,7 @@
|
||||
# return if bridge already parsed
|
||||
[ -n "$bridgename" ] && return
|
||||
|
||||
# Check if bridge parameter is valid
|
||||
# Check if bridge parameter is valid
|
||||
if getarg bridge= >/dev/null ; then
|
||||
if [ -z "$netroot" ] ; then
|
||||
die "No netboot configured, bridge is invalid"
|
||||
@@ -49,7 +49,7 @@ fi
|
||||
if getarg bridge >/dev/null; then
|
||||
# Read bridge= parameters if they exist
|
||||
bridge="$(getarg bridge=)"
|
||||
if [ ! "$bridge" = "bridge" ]; then
|
||||
if [ ! "$bridge" = "bridge" ]; then
|
||||
parsebridge "$(getarg bridge=)"
|
||||
fi
|
||||
# Simple default bridge
|
||||
|
@@ -52,17 +52,26 @@ if [ -n "$NEEDBOOTDEV" ] ; then
|
||||
fi
|
||||
|
||||
if [ "ibft" = "$(getarg ip=)" ]; then
|
||||
modprobe ibft
|
||||
modprobe iscsi_ibft
|
||||
num=0
|
||||
(
|
||||
(
|
||||
for iface in /sys/firmware/ibft/ethernet*; do
|
||||
[ -e ${iface}/mac ] || continue
|
||||
ifname_mac=$(read a < ${iface}/mac; echo $a)
|
||||
[ -z "$ifname_mac" ] || continue
|
||||
ifname_if=ibft$num
|
||||
num=$(( $num + 1 ))
|
||||
echo "ifname=$ifname_if:$ifname_mac"
|
||||
dev=$ifname_if
|
||||
[ -z "$ifname_mac" ] && continue
|
||||
unset dev
|
||||
for ifname in $(getargs ifname=); do
|
||||
if strstr "$ifname" "$ifname_mac"; then
|
||||
dev=${ifname%%:*}
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$dev" ]; then
|
||||
ifname_if=ibft$num
|
||||
num=$(( $num + 1 ))
|
||||
echo "ifname=$ifname_if:$ifname_mac"
|
||||
dev=$ifname_if
|
||||
fi
|
||||
|
||||
dhcp=$(read a < ${iface}/dhcp; echo $a)
|
||||
if [ -n "$dhcp" ]; then
|
||||
@@ -147,7 +156,7 @@ for p in $(getargs ip=); do
|
||||
done
|
||||
|
||||
# This ensures that BOOTDEV is always first in IFACES
|
||||
if [ -n "$BOOTDEV" ] && [ -n "$IFACES" ] ; then
|
||||
if [ -n "$BOOTDEV" ] && [ -n "$IFACES" ] ; then
|
||||
IFACES="${IFACES%$BOOTDEV*} ${IFACES#*$BOOTDEV}"
|
||||
IFACES="$BOOTDEV $IFACES"
|
||||
fi
|
||||
@@ -156,5 +165,5 @@ fi
|
||||
[ -n "$BOOTDEV" ] && echo $BOOTDEV > /tmp/net.bootdev
|
||||
[ -n "$IFACES" ] && echo $IFACES > /tmp/net.ifaces
|
||||
|
||||
# We need a ip= line for the configured bootdev=
|
||||
# We need a ip= line for the configured bootdev=
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$BOOTDEVOK" ] && die "Bootdev Argument '$BOOTDEV' not found"
|
||||
|
@@ -17,7 +17,7 @@ if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
fi
|
||||
|
||||
mkdir -p /tmp/ifcfg/
|
||||
mkdir -m 0755 -p /tmp/ifcfg/
|
||||
|
||||
for netif in $IFACES ; do
|
||||
# bridge?
|
||||
@@ -31,18 +31,18 @@ for netif in $IFACES ; do
|
||||
fi
|
||||
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$netif"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
if [ -f /tmp/net.$netif.lease ]; then
|
||||
strstr "$ip" '*:*:*' &&
|
||||
echo "DHCPV6C=yes"
|
||||
echo "BOOTPROTO=dhcp"
|
||||
echo "DHCPV6C=yes"
|
||||
echo "BOOTPROTO=dhcp"
|
||||
else
|
||||
echo "BOOTPROTO=none"
|
||||
echo "BOOTPROTO=none"
|
||||
# If we've booted with static ip= lines, the override file is there
|
||||
. /tmp/net.$netif.override
|
||||
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
echo "IPADDR=$ip"
|
||||
echo "NETMASK=$mask"
|
||||
[ -n "$gw" ] && echo "GATEWAY=$gw"
|
||||
@@ -55,7 +55,7 @@ for netif in $IFACES ; do
|
||||
{
|
||||
echo "HWADDR=$(cat /sys/class/net/$netif/address)"
|
||||
echo "TYPE=Ethernet"
|
||||
echo "NAME=\"Boot Disk\""
|
||||
echo "NAME=\"Boot Disk\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
fi
|
||||
|
||||
@@ -88,7 +88,7 @@ for netif in $IFACES ; do
|
||||
# bridge
|
||||
{
|
||||
echo "TYPE=Bridge"
|
||||
echo "NAME=\"Boot Disk\""
|
||||
echo "NAME=\"Boot Disk\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
{
|
||||
@@ -100,7 +100,7 @@ for netif in $IFACES ; do
|
||||
# This variable is an indicator of a bond interface for initscripts
|
||||
echo "BONDING_OPTS=\"$bondoptions\""
|
||||
echo "BRIDGE=$netif"
|
||||
echo "NAME=\"$bondname\""
|
||||
echo "NAME=\"$bondname\""
|
||||
} >> /tmp/ifcfg/ifcfg-$bondname
|
||||
for slave in $bondslaves ; do
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
@@ -134,9 +134,11 @@ for netif in $IFACES ; do
|
||||
done
|
||||
|
||||
# Pass network opts
|
||||
mkdir -p /run/initramfs
|
||||
[ -d /run/initramfs ] || mkdir -m 0755 -p /run/initramfs
|
||||
cp /tmp/net.* /run/initramfs/ >/dev/null 2>&1
|
||||
mkdir -p /run/initramfs/state/etc/sysconfig/network-scripts/
|
||||
for i in /run/initramfs/state /run/initramfs/state/etc/ /run/initramfs/state/etc/sysconfig /run/initramfs/state/etc/sysconfig/network-scripts; do
|
||||
[ -d $i ] || mkdir -m 0755 -p $i
|
||||
done
|
||||
cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/ >/dev/null 2>&1
|
||||
echo "files /etc/sysconfig/network-scripts" > /run/initramfs/rwtab
|
||||
cp -a /tmp/ifcfg/* /run/initramfs/state/etc/sysconfig/network-scripts/ >/dev/null 2>&1
|
||||
cp -a -t /run/initramfs/state/etc/sysconfig/network-scripts/ /tmp/ifcfg/* >/dev/null 2>&1
|
||||
|
@@ -9,8 +9,9 @@ if getargbool 1 rd.splash -n rd_NO_SPLASH; then
|
||||
|
||||
info "Starting Gentoo Splash"
|
||||
|
||||
/lib/udev/console_init tty0
|
||||
[ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
|
||||
CDROOT=0
|
||||
. /lib/gensplash-lib.sh
|
||||
splash init
|
||||
[ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
|
||||
fi
|
||||
|
@@ -13,55 +13,57 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
local _opts
|
||||
local _splash_theme
|
||||
local _splash_res
|
||||
|
||||
call_splash_geninitramfs() {
|
||||
local out ret
|
||||
local _out _ret
|
||||
|
||||
out=$(splash_geninitramfs -c "$1" ${@:2} 2>&1)
|
||||
ret=$?
|
||||
_out=$(splash_geninitramfs -c "$1" ${@:2} 2>&1)
|
||||
_ret=$?
|
||||
|
||||
if [[ ${out} ]]; then
|
||||
if [[ ${_out} ]]; then
|
||||
local IFS='
|
||||
'
|
||||
for line in ${out}; do
|
||||
for line in ${_out}; do
|
||||
if [[ ${line} =~ ^Warning ]]; then
|
||||
dwarn "${line}"
|
||||
else
|
||||
derror "${line}"
|
||||
(( ret == 0 )) && ret=1
|
||||
(( $_ret == 0 )) && _ret=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
return ${ret}
|
||||
return ${_ret}
|
||||
}
|
||||
|
||||
|
||||
type -P splash_geninitramfs >/dev/null || return 1
|
||||
|
||||
opts=''
|
||||
|
||||
_opts=''
|
||||
if [[ ${DRACUT_GENSPLASH_THEME} ]]; then
|
||||
# Variables from the environment
|
||||
# They're supposed to be set up by e.g. Genkernel in basis of cmdline args.
|
||||
# If user set them he/she would expect to be included only given theme
|
||||
# rather then all even if we're building generic initramfs.
|
||||
SPLASH_THEME=${DRACUT_GENSPLASH_THEME}
|
||||
SPLASH_RES=${DRACUT_GENSPLASH_RES}
|
||||
_splash_theme=${DRACUT_GENSPLASH_THEME}
|
||||
_splash_res=${DRACUT_GENSPLASH_RES}
|
||||
elif [[ ${hostonly} ]]; then
|
||||
# Settings from config only in hostonly
|
||||
[[ -e /etc/conf.d/splash ]] && source /etc/conf.d/splash
|
||||
[[ ! ${SPLASH_THEME} ]] && SPLASH_THEME=default
|
||||
[[ ${SPLASH_RES} ]] && opts+=" -r ${SPLASH_RES}"
|
||||
[[ ! ${_splash_theme} ]] && _splash_theme=default
|
||||
[[ ${_splash_res} ]] && _opts+=" -r ${_splash_res}"
|
||||
else
|
||||
# generic
|
||||
SPLASH_THEME=--all
|
||||
_splash_theme=--all
|
||||
fi
|
||||
|
||||
dinfo "Installing Gentoo Splash (using the ${SPLASH_THEME} theme)"
|
||||
dinfo "Installing Gentoo Splash (using the ${_splash_theme} theme)"
|
||||
|
||||
pushd "${initdir}" >/dev/null
|
||||
mv dev dev.old
|
||||
call_splash_geninitramfs "${initdir}" ${opts} ${SPLASH_THEME} || {
|
||||
call_splash_geninitramfs "${initdir}" ${_opts} ${_splash_theme} || {
|
||||
derror "Could not build splash"
|
||||
return 1
|
||||
}
|
||||
|
@@ -11,9 +11,10 @@ depends() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
local _modname
|
||||
# Include KMS capable drm drivers
|
||||
for modname in $(find "$srcmods/kernel/drivers/gpu/drm" "$srcmods/extra" -name '*.ko' 2>/dev/null); do
|
||||
grep -q drm_crtc_init $modname && instmods $modname
|
||||
for _modname in $(find "$srcmods/kernel/drivers/gpu/drm" "$srcmods/extra" -name '*.ko' 2>/dev/null); do
|
||||
grep -q drm_crtc_init $_modname && instmods $_modname
|
||||
done
|
||||
}
|
||||
|
||||
|
@@ -7,11 +7,11 @@ PLYMOUTH_THEME=$(plymouth-set-default-theme)
|
||||
inst /sbin/plymouthd /bin/plymouthd
|
||||
dracut_install /bin/plymouth \
|
||||
"${PLYMOUTH_LOGO_FILE}" \
|
||||
/etc/system-release
|
||||
/etc/system-release
|
||||
|
||||
mkdir -p "${initdir}/usr/share/plymouth"
|
||||
mkdir -m 0755 -p "${initdir}/usr/share/plymouth"
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
if [[ $hostonly ]]; then
|
||||
dracut_install "${usrlibdir}/plymouth/text.so" \
|
||||
"${usrlibdir}/plymouth/details.so" \
|
||||
"/usr/share/plymouth/themes/details/details.plymouth" \
|
||||
@@ -34,7 +34,7 @@ else
|
||||
for x in /usr/share/plymouth/themes/{text,details}/* ; do
|
||||
[[ -f "$x" ]] || continue
|
||||
THEME_DIR=$(dirname "$x")
|
||||
mkdir -p "${initdir}/$THEME_DIR"
|
||||
mkdir -m 0755 -p "${initdir}/$THEME_DIR"
|
||||
dracut_install "$x"
|
||||
done
|
||||
for x in "${usrlibdir}"/plymouth/{text,details}.so ; do
|
||||
@@ -44,6 +44,6 @@ else
|
||||
done
|
||||
(
|
||||
cd ${initdir}/usr/share/plymouth/themes;
|
||||
ln -s text/text.plymouth default.plymouth 2>&1;
|
||||
ln -s text/text.plymouth default.plymouth 2>&1;
|
||||
)
|
||||
fi
|
||||
|
@@ -17,8 +17,10 @@ if getargbool 1 rd.plymouth -n rd_NO_PLYMOUTH; then
|
||||
[ -e /dev/fb ] || ln -s fb0 /dev/fb
|
||||
|
||||
info "Starting plymouth daemon"
|
||||
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session
|
||||
>/run/initramfs/plymouth
|
||||
/lib/udev/console_init tty0
|
||||
mkdir -m 0755 /run/plymouth
|
||||
[ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
|
||||
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session --pid-file /run/plymouth/pid
|
||||
/bin/plymouth --show-splash 2>&1 | vinfo
|
||||
# reset tty after plymouth messed with it
|
||||
[ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
|
||||
fi
|
||||
|
@@ -23,11 +23,12 @@ depends() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
for i in \
|
||||
local _i
|
||||
for _i in \
|
||||
xenbus_probe_frontend xen-pcifront \
|
||||
xen-fbfront xen-kbdfront xen-blkfront xen-netfront \
|
||||
; do
|
||||
modinfo -k $kernel $i >/dev/null 2>&1 && instmods $i
|
||||
modinfo -k $kernel $_i >/dev/null 2>&1 && instmods $_i
|
||||
done
|
||||
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
local _rootdev
|
||||
# if we don't have btrfs installed on the host system,
|
||||
# no point in trying to support it in the initramfs.
|
||||
type -P btrfs >/dev/null || return 1
|
||||
@@ -13,9 +14,9 @@ check() {
|
||||
is_btrfs() { get_fs_type /dev/block/$1 | grep -q btrfs; }
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
rootdev=$(find_root_block_device)
|
||||
if [[ $rootdev ]]; then
|
||||
is_btrfs "$rootdev" || return 1
|
||||
_rootdev=$(find_root_block_device)
|
||||
if [[ $_rootdev ]]; then
|
||||
is_btrfs "$_rootdev" || return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@@ -2,7 +2,79 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
|
||||
# ask_for_password
|
||||
#
|
||||
# Wraps around plymouth ask-for-password and adds fallback to tty password ask
|
||||
# if plymouth is not present.
|
||||
#
|
||||
# --cmd command
|
||||
# Command to execute. Required.
|
||||
# --prompt prompt
|
||||
# Password prompt. Note that function already adds ':' at the end.
|
||||
# Recommended.
|
||||
# --tries n
|
||||
# How many times repeat command on its failure. Default is 3.
|
||||
# --ply-[cmd|prompt|tries]
|
||||
# Command/prompt/tries specific for plymouth password ask only.
|
||||
# --tty-[cmd|prompt|tries]
|
||||
# Command/prompt/tries specific for tty password ask only.
|
||||
# --tty-echo-off
|
||||
# Turn off input echo before tty command is executed and turn on after.
|
||||
# It's useful when password is read from stdin.
|
||||
ask_for_password() {
|
||||
local cmd; local prompt; local tries=3
|
||||
local ply_cmd; local ply_prompt; local ply_tries=3
|
||||
local tty_cmd; local tty_prompt; local tty_tries=3
|
||||
local ret
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--cmd) ply_cmd="$2"; tty_cmd="$2" shift;;
|
||||
--ply-cmd) ply_cmd="$2"; shift;;
|
||||
--tty-cmd) tty_cmd="$2"; shift;;
|
||||
--prompt) ply_prompt="$2"; tty_prompt="$2" shift;;
|
||||
--ply-prompt) ply_prompt="$2"; shift;;
|
||||
--tty-prompt) tty_prompt="$2"; shift;;
|
||||
--tries) ply_tries="$2"; tty_tries="$2"; shift;;
|
||||
--ply-tries) ply_tries="$2"; shift;;
|
||||
--tty-tries) tty_tries="$2"; shift;;
|
||||
--tty-echo-off) tty_echo_off=yes;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
{ flock -s 9;
|
||||
# Prompt for password with plymouth, if installed and running.
|
||||
if [ -x /bin/plymouth ]; then
|
||||
/bin/plymouth ask-for-password \
|
||||
--prompt "$ply_prompt" --number-of-tries=$ply_tries \
|
||||
--command="$ply_cmd"
|
||||
ret=$?
|
||||
else
|
||||
if [ "$tty_echo_off" = yes ]; then
|
||||
stty_orig="$(stty -g)"
|
||||
stty -echo
|
||||
fi
|
||||
|
||||
local i=1
|
||||
while [ $i -le $tty_tries ]; do
|
||||
[ -n "$tty_prompt" ] && \
|
||||
printf "$tty_prompt [$i/$tty_tries]:" >&2
|
||||
eval "$tty_cmd" && ret=0 && break
|
||||
ret=$?
|
||||
i=$(($i+1))
|
||||
[ -n "$tty_prompt" ] && printf '\n' >&2
|
||||
done
|
||||
|
||||
[ "$tty_echo_off" = yes ] && stty $stty_orig
|
||||
fi
|
||||
} 9>/.console_lock
|
||||
|
||||
[ $ret -ne 0 ] && echo "Wrong password" >&2
|
||||
return $ret
|
||||
}
|
||||
|
||||
# Try to mount specified device (by path, by UUID or by label) and check
|
||||
# the path with 'test'.
|
||||
@@ -118,3 +190,33 @@ getkey() {
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# readkey keypath keydev device
|
||||
#
|
||||
# Mounts <keydev>, reads key from file <keypath>, optionally processes it (e.g.
|
||||
# if encrypted with GPG) and prints to standard output which is supposed to be
|
||||
# read by cryptsetup. <device> is just passed to helper function for
|
||||
# informational purpose.
|
||||
readkey() {
|
||||
local keypath="$1"
|
||||
local keydev="$2"
|
||||
local device="$3"
|
||||
|
||||
local mntp=$(mkuniqdir /mnt keydev)
|
||||
mount -r "$keydev" "$mntp" || die 'Mounting rem. dev. failed!'
|
||||
|
||||
case "${keypath##*.}" in
|
||||
gpg)
|
||||
if [ -f /lib/dracut-crypt-gpg-lib.sh ]; then
|
||||
. /lib/dracut-crypt-gpg-lib.sh
|
||||
gpg_decrypt "$mntp" "$keypath" "$keydev" "$device"
|
||||
else
|
||||
die "No GPG support to decrypt '$keypath' on '$keydev'."
|
||||
fi
|
||||
;;
|
||||
*) cat "$mntp/$keypath" ;;
|
||||
esac
|
||||
|
||||
umount "$mntp"
|
||||
rmdir "$mntp"
|
||||
}
|
||||
|
@@ -2,8 +2,11 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
NEWROOT=${NEWROOT:-"/sysroot"}
|
||||
|
||||
# do not ask, if we already have root
|
||||
[ -f /sysroot/proc ] && exit 0
|
||||
[ -f $NEWROOT/proc ] && exit 0
|
||||
|
||||
# check if destination already exists
|
||||
[ -b /dev/mapper/$2 ] && exit 0
|
||||
@@ -40,7 +43,7 @@ if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -n rd_NO_CRYPTTAB; then
|
||||
luksname="$name"
|
||||
break
|
||||
fi
|
||||
|
||||
|
||||
# path used in crypttab
|
||||
else
|
||||
cdev=$(readlink -f $dev)
|
||||
@@ -66,45 +69,25 @@ if [ -n "$(getarg rd.luks.key)" ]; then
|
||||
keypath="${tmp#*:}"
|
||||
else
|
||||
info "No key found for $device. Will try later."
|
||||
/sbin/initqueue --unique --onetime --settled \
|
||||
initqueue --unique --onetime --settled \
|
||||
--name cryptroot-ask-$luksname \
|
||||
/sbin/cryptroot-ask "$@"
|
||||
$(command -v cryptroot-ask) "$@"
|
||||
exit 0
|
||||
fi
|
||||
unset tmp
|
||||
|
||||
mntp=$(mkuniqdir /mnt keydev)
|
||||
mount -r "$keydev" "$mntp" || die 'Mounting rem. dev. failed!'
|
||||
cryptsetup -d "$mntp/$keypath" luksOpen "$device" "$luksname"
|
||||
umount "$mntp"
|
||||
rmdir "$mntp"
|
||||
unset mntp keypath keydev
|
||||
info "Using '$keypath' on '$keydev'"
|
||||
readkey "$keypath" "$keydev" "$device" \
|
||||
| cryptsetup -d - luksOpen "$device" "$luksname"
|
||||
unset keypath keydev
|
||||
else
|
||||
# Prompt for password with plymouth, if installed and running.
|
||||
if [ -x /bin/plymouth ] && /bin/plymouth --has-active-vt; then
|
||||
prompt="Password [$device ($luksname)]:"
|
||||
if [ ${#luksname} -gt 8 ]; then
|
||||
sluksname=${sluksname##luks-}
|
||||
sluksname=${luksname%%${luksname##????????}}
|
||||
prompt="Password for $device ($sluksname...)"
|
||||
fi
|
||||
|
||||
# flock against other interactive activities
|
||||
{ flock -s 9;
|
||||
/bin/plymouth ask-for-password \
|
||||
--prompt "$prompt" --number-of-tries=5 \
|
||||
--command="/sbin/cryptsetup luksOpen -T1 $device $luksname"
|
||||
} 9>/.console.lock
|
||||
|
||||
unset sluksname prompt
|
||||
|
||||
else
|
||||
# flock against other interactive activities
|
||||
{ flock -s 9;
|
||||
echo "$device ($luksname) is password protected"
|
||||
cryptsetup luksOpen -T5 $device $luksname
|
||||
} 9>/.console.lock
|
||||
fi
|
||||
luks_open="$(command -v cryptsetup) luksOpen"
|
||||
ask_for_password --ply-tries 5 \
|
||||
--ply-cmd "$luks_open -T1 $device $luksname" \
|
||||
--ply-prompt "Password ($device)" \
|
||||
--tty-tries 1 \
|
||||
--tty-cmd "$luks_open -T5 $device $luksname"
|
||||
unset luks_open
|
||||
fi
|
||||
|
||||
unset device luksname
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
local _rootdev
|
||||
# if cryptsetup is not installed, then we cannot support encrypted devices.
|
||||
type -P cryptsetup >/dev/null || return 1
|
||||
|
||||
@@ -11,11 +12,11 @@ check() {
|
||||
is_crypt() { [[ $(get_fs_type /dev/block/$1) = crypto_LUKS ]]; }
|
||||
|
||||
[[ $hostonly ]] && {
|
||||
rootdev=$(find_root_block_device)
|
||||
if [[ $rootdev ]]; then
|
||||
# root lives on a block device, so we can be more precise about
|
||||
_rootdev=$(find_root_block_device)
|
||||
if [[ $_rootdev ]]; then
|
||||
# root lives on a block device, so we can be more precise about
|
||||
# hostonly checking
|
||||
check_block_and_slaves is_crypt "$rootdev" || return 1
|
||||
check_block_and_slaves is_crypt "$_rootdev" || return 1
|
||||
else
|
||||
# root is not on a block device, use the shotgun approach
|
||||
blkid | grep -q crypto\?_LUKS || return 1
|
||||
@@ -35,9 +36,7 @@ installkernel() {
|
||||
}
|
||||
|
||||
install() {
|
||||
inst cryptsetup
|
||||
inst rmdir
|
||||
inst readlink
|
||||
dracut_install cryptsetup rmdir readlink umount
|
||||
inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
|
||||
inst "$moddir"/probe-keydev.sh /sbin/probe-keydev
|
||||
inst_hook cmdline 10 "$moddir/parse-keydev.sh"
|
||||
|
@@ -8,34 +8,36 @@ else
|
||||
{
|
||||
echo 'SUBSYSTEM!="block", GOTO="luks_end"'
|
||||
echo 'ACTION!="add|change", GOTO="luks_end"'
|
||||
} > /etc/udev/rules.d/70-luks.rules
|
||||
} > /etc/udev/rules.d/70-luks.rules.new
|
||||
|
||||
LUKS=$(getargs rd.luks.uuid rd_LUKS_UUID)
|
||||
|
||||
if [ -n "$LUKS" ]; then
|
||||
for luksid in $LUKS; do
|
||||
for luksid in $LUKS; do
|
||||
luksid=${luksid##luks-}
|
||||
{
|
||||
printf 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
||||
printf 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
||||
printf 'RUN+="/sbin/initqueue --unique --onetime '
|
||||
printf -- '--name cryptroot-ask-%%k /sbin/cryptroot-ask '
|
||||
printf '$env{DEVNAME} luks-$env{ID_FS_UUID}"\n'
|
||||
} >> /etc/udev/rules.d/70-luks.rules
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
||||
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
||||
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
|
||||
printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
|
||||
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID}"\n'
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
|
||||
printf '[ -e /dev/disk/by-uuid/*%s* ] || exit 1\n' $luksid \
|
||||
printf -- '[ -e /dev/disk/by-uuid/*%s* ]\n' $luksid \
|
||||
>> $hookdir/initqueue/finished/90-crypt.sh
|
||||
{
|
||||
printf '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid
|
||||
printf 'warn "crypto LUKS UUID "%s" not found"\n' $luksid
|
||||
printf -- '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid
|
||||
printf -- 'warn "crypto LUKS UUID "%s" not found"\n' $luksid
|
||||
} >> $hookdir/emergency/90-crypt.sh
|
||||
done
|
||||
else
|
||||
echo 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue' \
|
||||
'--unique --onetime --name cryptroot-ask-%k' \
|
||||
'/sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"' \
|
||||
>> /etc/udev/rules.d/70-luks.rules
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
|
||||
printf -- '--unique --onetime --name cryptroot-ask-%%k '
|
||||
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $(command -v cryptroot-ask)
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
fi
|
||||
|
||||
echo 'LABEL="luks_end"' >> /etc/udev/rules.d/70-luks.rules
|
||||
echo 'LABEL="luks_end"' >> /etc/udev/rules.d/70-luks.rules.new
|
||||
mv /etc/udev/rules.d/70-luks.rules.new /etc/udev/rules.d/70-luks.rules
|
||||
fi
|
||||
|
@@ -28,10 +28,10 @@ if getargbool 1 rd.luks -n rd_NO_LUKS && \
|
||||
fi
|
||||
|
||||
{
|
||||
printf 'RUN+="/sbin/initqueue --unique --onetime '
|
||||
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
|
||||
printf -- '--name probe-keydev-%%k '
|
||||
printf '/sbin/probe-keydev /dev/%%k %s %s"\n' \
|
||||
"${keypath}" "${luksdev}"
|
||||
printf -- '%s /dev/%%k %s %s"\n' \
|
||||
$(command -v probe-keydev) "${keypath}" "${luksdev}"
|
||||
} >&7
|
||||
done
|
||||
unset arg keypath keydev luksdev
|
||||
|
5
modules.d/90dm/11-dm.rules
Normal file
5
modules.d/90dm/11-dm.rules
Normal file
@@ -0,0 +1,5 @@
|
||||
SUBSYSTEM!="block", GOTO="dm_end"
|
||||
KERNEL!="dm-[0-9]*", GOTO="dm_end"
|
||||
ACTION!="add|change", GOTO="dm_end"
|
||||
OPTIONS+="db_persist"
|
||||
LABEL="dm_end"
|
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
strstr "$(cat /proc/misc)" device-mapper || modprobe dm_mod
|
||||
strstr "$(cat /proc/misc)" device-mapper || modprobe dm_mod
|
||||
|
2
modules.d/90dm/dm-shutdown.sh
Normal file
2
modules.d/90dm/dm-shutdown.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
echo "Disassembling device-mapper devices"
|
||||
dmsetup -v remove_all
|
@@ -25,5 +25,8 @@ install() {
|
||||
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
|
||||
# files, but provides the one below:
|
||||
inst_rules 64-device-mapper.rules
|
||||
inst_rules "$moddir/11-dm.rules"
|
||||
|
||||
inst_hook shutdown 30 "$moddir/dm-shutdown.sh"
|
||||
}
|
||||
|
||||
|
@@ -21,8 +21,8 @@ echo $SETS|vinfo
|
||||
|
||||
if [ -n "$DM_RAIDS" ]; then
|
||||
# only activate specified DM RAIDS
|
||||
for r in $DM_RAIDS; do
|
||||
for s in $SETS; do
|
||||
for r in $DM_RAIDS; do
|
||||
for s in $SETS; do
|
||||
if [ "${s##$r}" != "$s" ]; then
|
||||
info "Activating $s"
|
||||
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
|
||||
@@ -31,7 +31,7 @@ if [ -n "$DM_RAIDS" ]; then
|
||||
fi
|
||||
done
|
||||
done
|
||||
else
|
||||
else
|
||||
# scan and activate all DM RAIDS
|
||||
for s in $SETS; do
|
||||
info "Activating $s"
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
local _rootdev
|
||||
# if we don't have dmraid installed on the host system, no point
|
||||
# in trying to support it in the initramfs.
|
||||
type -P dmraid >/dev/null || return 1
|
||||
@@ -14,11 +15,11 @@ check() {
|
||||
grep -q _raid_member; }
|
||||
|
||||
[[ $hostonly ]] && {
|
||||
rootdev=$(find_root_block_device)
|
||||
if [[ $rootdev ]]; then
|
||||
# root lives on a block device, so we can be more precise about
|
||||
_rootdev=$(find_root_block_device)
|
||||
if [[ $_rootdev ]]; then
|
||||
# root lives on a block device, so we can be more precise about
|
||||
# hostonly checking
|
||||
check_block_and_slaves is_dmraid "$rootdev" || return 1
|
||||
check_block_and_slaves is_dmraid "$_rootdev" || return 1
|
||||
else
|
||||
# root is not on a block device, use the shotgun approach
|
||||
dmraid -r | grep -q ok || return 1
|
||||
@@ -34,15 +35,16 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install dmraid partx kpartx
|
||||
local _i
|
||||
dracut_install dmraid partx kpartx
|
||||
|
||||
inst dmeventd
|
||||
|
||||
for i in {"$libdir","$usrlibdir"}/libdmraid-events*.so; do
|
||||
[ -e "$i" ] && dracut_install "$i"
|
||||
for _i in {"$libdir","$usrlibdir"}/libdmraid-events*.so; do
|
||||
[ -e "$_i" ] && dracut_install "$_i"
|
||||
done
|
||||
|
||||
inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
|
||||
inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
|
||||
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
|
||||
# files, but provides the one below:
|
||||
inst_rules 64-device-mapper.rules
|
||||
|
@@ -7,7 +7,7 @@ if ! getargbool 1 rd.dm -n rd_NO_DM || getarg nodmraid; then
|
||||
udevproperty rd_NO_DM=1
|
||||
fi
|
||||
|
||||
if [ ! -x /sbin/mdadm ] || ! getargbool 1 rd.md.imsm -n rd_NO_MDIMSM || getarg noiswmd; then
|
||||
if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.imsm -n rd_NO_MDIMSM || getarg noiswmd; then
|
||||
info "rd.md.imsm=0: no MD RAID for imsm/isw raids"
|
||||
udevproperty rd_NO_MDIMSM=1
|
||||
fi
|
||||
|
@@ -5,15 +5,15 @@ case "$root" in
|
||||
live:/dev/*)
|
||||
{
|
||||
printf 'KERNEL=="%s", SYMLINK+="live"\n' \
|
||||
${root#live:/dev/}
|
||||
${root#live:/dev/}
|
||||
printf 'SYMLINK=="%s", SYMLINK+="live"\n' \
|
||||
${root#live:/dev/}
|
||||
} >> /dev/.udev/rules.d/99-live-mount.rules
|
||||
${root#live:/dev/}
|
||||
} >> $UDEVRULESD/99-live-mount.rules
|
||||
{
|
||||
printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
|
||||
${root#live:/dev/}
|
||||
${root#live:/dev/}
|
||||
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
|
||||
${root#live:/dev/}
|
||||
${root#live:/dev/}
|
||||
} >> $UDEVRULESD/99-live-squash.rules
|
||||
echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/dmsquash.sh
|
||||
;;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
[ -f /tmp/root.info ] && . /tmp/root.info
|
||||
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
if getargbool 0 rd.live.debug -y rdlivedebug; then
|
||||
exec > /tmp/liveroot.$$.out
|
||||
@@ -25,25 +25,26 @@ getargbool 0 rd.live.overlay.reset -y reset_overlay && reset_overlay="yes"
|
||||
getargbool 0 rd.live.overlay.readonly -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
|
||||
overlay=$(getarg rd.live.overlay overlay)
|
||||
|
||||
# FIXME: we need to be able to hide the plymouth splash for the check really
|
||||
[ -e $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
|
||||
if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
|
||||
check="yes"
|
||||
fi
|
||||
getarg rd.live.check check || check=""
|
||||
if [ -n "$check" ]; then
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --hide-splash
|
||||
checkisomd5 --verbose $livedev || :
|
||||
if [ $? -ne 0 ]; then
|
||||
die "CD check failed!"
|
||||
exit 1
|
||||
fi
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --show-splash
|
||||
fi
|
||||
|
||||
getarg ro && liverw=ro
|
||||
getarg rw && liverw=rw
|
||||
[ -z "$liverw" ] && liverw=ro
|
||||
# mount the backing of the live image first
|
||||
mkdir -p /run/initramfs/live
|
||||
mkdir -m 0755 -p /run/initramfs/live
|
||||
if [ -f $livedev ]; then
|
||||
# no mount needed - we've already got the LiveOS image in initramfs
|
||||
case $livedev in
|
||||
@@ -84,16 +85,16 @@ do_live_overlay() {
|
||||
# need to know where to look for the overlay
|
||||
setup=""
|
||||
if [ -n "$devspec" -a -n "$pathspec" -a -n "$overlay" ]; then
|
||||
mkdir /overlayfs
|
||||
mount -n -t auto $devspec /overlayfs || :
|
||||
if [ -f /overlayfs$pathspec -a -w /overlayfs$pathspec ]; then
|
||||
losetup $OVERLAY_LOOPDEV /overlayfs$pathspec
|
||||
mkdir -m 0755 /run/initramfs/overlayfs
|
||||
mount -n -t auto $devspec /run/initramfs/overlayfs || :
|
||||
if [ -f /run/initramfs/overlayfs$pathspec -a -w /run/initramfs/overlayfs$pathspec ]; then
|
||||
losetup $OVERLAY_LOOPDEV /run/initramfs/overlayfs$pathspec
|
||||
if [ -n "$reset_overlay" ]; then
|
||||
dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k count=1 2>/dev/null
|
||||
fi
|
||||
setup="yes"
|
||||
fi
|
||||
umount -l /overlayfs || :
|
||||
umount -l /run/initramfs/overlayfs || :
|
||||
fi
|
||||
|
||||
if [ -z "$setup" ]; then
|
||||
@@ -125,11 +126,11 @@ if [ -n "$OSMINSQFS" ]; then
|
||||
dd if=$OSMINSQFS of=/osmin.img 2> /dev/null
|
||||
OSMIN_SQUASHED_LOOPDEV=$( losetup -f )
|
||||
losetup -r $OSMIN_SQUASHED_LOOPDEV /osmin.img
|
||||
mkdir -p /squashfs.osmin
|
||||
mount -n -t squashfs -o ro $OSMIN_SQUASHED_LOOPDEV /squashfs.osmin
|
||||
mkdir -m 0755 -p /run/initramfs/squashfs.osmin
|
||||
mount -n -t squashfs -o ro $OSMIN_SQUASHED_LOOPDEV /run/initramfs/squashfs.osmin
|
||||
OSMIN_LOOPDEV=$( losetup -f )
|
||||
losetup -r $OSMIN_LOOPDEV /squashfs.osmin/osmin
|
||||
umount -l /squashfs.osmin
|
||||
losetup -r $OSMIN_LOOPDEV /run/initramfs/squashfs.osmin/osmin
|
||||
umount -l /run/initramfs/squashfs.osmin
|
||||
fi
|
||||
|
||||
# we might have an embedded fs image to use as rootfs (uncompressed live)
|
||||
@@ -164,17 +165,17 @@ if [ -e "$SQUASHED" ] ; then
|
||||
|
||||
SQUASHED_LOOPDEV=$( losetup -f )
|
||||
losetup -r $SQUASHED_LOOPDEV $SQUASHED
|
||||
mkdir -p /squashfs
|
||||
mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /squashfs
|
||||
mkdir -m 0755 -p /run/initramfs/squashfs
|
||||
mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /run/initramfs/squashfs
|
||||
|
||||
BASE_LOOPDEV=$( losetup -f )
|
||||
if [ -f /squashfs/LiveOS/ext3fs.img ]; then
|
||||
losetup -r $BASE_LOOPDEV /squashfs/LiveOS/ext3fs.img
|
||||
elif [ -f /squashfs/LiveOS/rootfs.img ]; then
|
||||
losetup -r $BASE_LOOPDEV /squashfs/LiveOS/rootfs.img
|
||||
if [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
|
||||
losetup -r $BASE_LOOPDEV /run/initramfs/squashfs/LiveOS/ext3fs.img
|
||||
elif [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
|
||||
losetup -r $BASE_LOOPDEV /run/initramfs/squashfs/LiveOS/rootfs.img
|
||||
fi
|
||||
|
||||
umount -l /squashfs
|
||||
umount -l /run/initramfs/squashfs
|
||||
|
||||
do_live_from_base_loop
|
||||
fi
|
||||
|
@@ -9,7 +9,7 @@ check() {
|
||||
}
|
||||
|
||||
depends() {
|
||||
# if dmsetup is not installed, then we cannot support fedora/red hat
|
||||
# if dmsetup is not installed, then we cannot support fedora/red hat
|
||||
# style live images
|
||||
echo dm rootfs-block
|
||||
return 0
|
||||
@@ -27,12 +27,7 @@ install() {
|
||||
inst losetup
|
||||
inst grep
|
||||
|
||||
# eject might be a symlink to consolehelper
|
||||
if [ -L /usr/bin/eject ]; then
|
||||
dracut_install /usr/sbin/eject
|
||||
else
|
||||
inst eject
|
||||
fi
|
||||
dracut_install eject
|
||||
|
||||
inst blockdev
|
||||
type -P checkisomd5 >/dev/null && inst checkisomd5
|
||||
|
@@ -2,11 +2,13 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
for p in $(getargs rd.driver.post rdinsmodpost=); do
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
for modlist in $(getargs rd.driver.post rdinsmodpost=); do
|
||||
(
|
||||
IFS=,
|
||||
for p in $i; do
|
||||
modprobe $p
|
||||
for m in $modlist; do
|
||||
modprobe $m
|
||||
done
|
||||
)
|
||||
done
|
||||
|
@@ -17,7 +17,7 @@ installkernel() {
|
||||
hostonly='' instmods atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech hid-microsoft ehci-hcd ohci-hcd uhci-hcd
|
||||
|
||||
instmods "=drivers/pcmcia" =ide "=drivers/usb/storage"
|
||||
instmods $(filter_kernel_modules block_module_test)
|
||||
instmods $(filter_kernel_modules block_module_test)
|
||||
# if not on hostonly mode, install all known filesystems,
|
||||
# if the required list is not set via the filesystems variable
|
||||
if ! [[ $hostonly ]]; then
|
||||
@@ -42,9 +42,19 @@ installkernel() {
|
||||
}
|
||||
|
||||
install() {
|
||||
local _f
|
||||
[ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf
|
||||
dracut_install $(find /etc/modprobe.d/ -type f -name '*.conf')
|
||||
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
|
||||
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
|
||||
inst "$srcmods/modules.builtin.bin" "/lib/modules/$kernel/modules.builtin.bin"
|
||||
|
||||
local f
|
||||
|
||||
for _f in modules.builtin.bin modules.builtin; do
|
||||
[[ $srcmods/$_f ]] && inst "$srcmods/$_f" "/lib/modules/$kernel/$_f" \
|
||||
&& break
|
||||
done || {
|
||||
dfatal "No modules.builtin.bin and modules.builtin found!"
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
@@ -2,28 +2,28 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
for p in $(getargs rd.driver.pre rdloaddriver=); do
|
||||
(
|
||||
for i in $(getargs rd.driver.pre rdloaddriver=); do
|
||||
(
|
||||
IFS=,
|
||||
for p in $i; do
|
||||
for p in $i; do
|
||||
modprobe $p 2>&1 | vinfo
|
||||
done
|
||||
)
|
||||
done
|
||||
|
||||
for p in $(getargs rd.driver.blacklist rdblacklist=); do
|
||||
for i in $(getargs rd.driver.blacklist rdblacklist=); do
|
||||
(
|
||||
IFS=,
|
||||
for p in $i; do
|
||||
for p in $i; do
|
||||
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
|
||||
done
|
||||
)
|
||||
done
|
||||
|
||||
for p in $(getargs rd.driver.post rdinsmodpost=); do
|
||||
for p in $(getargs rd.driver.post rdinsmodpost=); do
|
||||
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
|
||||
_do_insmodpost=1
|
||||
done
|
||||
|
||||
[ -n "$_do_insmodpost" ] && /sbin/initqueue --settled --unique --onetime /sbin/insmodpost.sh
|
||||
[ -n "$_do_insmodpost" ] && initqueue --settled --unique --onetime insmodpost.sh
|
||||
unset _do_insmodpost
|
||||
|
@@ -11,7 +11,7 @@ LVS=$(getargs rd.lvm.lv rd_LVM_LV=)
|
||||
SNAPSHOT=$(getargs rd.lvm.snapshot rd_LVM_SNAPSHOT=)
|
||||
SNAPSIZE=$(getargs rd.lvm.snapsize rd_LVM_SNAPSIZE=)
|
||||
|
||||
[ -d /etc/lvm ] || mkdir -p /etc/lvm
|
||||
[ -d /etc/lvm ] || mkdir -m 0755 -p /etc/lvm
|
||||
# build a list of devices to scan
|
||||
lvmdevs=$(
|
||||
for f in /tmp/.lvm_scan-*; do
|
||||
@@ -20,7 +20,7 @@ lvmdevs=$(
|
||||
done
|
||||
)
|
||||
|
||||
if [ ! -e /etc/lvm/lvm.conf ]; then
|
||||
if [ ! -e /etc/lvm/lvm.conf ]; then
|
||||
{
|
||||
echo 'devices {';
|
||||
echo -n ' filter = [ '
|
||||
@@ -28,7 +28,7 @@ if [ ! -e /etc/lvm/lvm.conf ]; then
|
||||
printf '"a|^/dev/%s$|", ' $dev;
|
||||
done;
|
||||
echo '"r/.*/" ]';
|
||||
echo '}';
|
||||
echo '}';
|
||||
|
||||
# establish LVM locking
|
||||
if [ -n $SNAPSHOT ]; then
|
||||
@@ -66,7 +66,7 @@ IFS=$OLDIFS
|
||||
maj=${1##*:}
|
||||
min=$2
|
||||
sub=${3%% *}
|
||||
sub=${sub%%\(*};
|
||||
sub=${sub%%\(*};
|
||||
|
||||
check_lvm_ver 2 2 57 $maj $min $sub && \
|
||||
nopoll="--poll n"
|
||||
@@ -120,7 +120,5 @@ fi
|
||||
|
||||
if [ "$lvmwritten" ]; then
|
||||
rm -f /etc/lvm/lvm.conf
|
||||
ln -s /sbin/lvm-cleanup $hookdir/pre-pivot/30-lvm-cleanup.sh 2>/dev/null
|
||||
ln -s /sbin/lvm-cleanup $hookdir/pre-pivot/31-lvm-cleanup.sh 2>/dev/null
|
||||
fi
|
||||
unset lvmwritten
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
local _rootdev
|
||||
# No point trying to support lvm if the binaries are missing
|
||||
type -P lvm >/dev/null || return 1
|
||||
|
||||
@@ -12,11 +13,11 @@ check() {
|
||||
is_lvm() { [[ $(get_fs_type /dev/block/$1) = LVM2_member ]]; }
|
||||
|
||||
[[ $hostonly ]] && {
|
||||
rootdev=$(find_root_block_device)
|
||||
if [[ $rootdev ]]; then
|
||||
# root lives on a block device, so we can be more precise about
|
||||
_rootdev=$(find_root_block_device)
|
||||
if [[ $_rootdev ]]; then
|
||||
# root lives on a block device, so we can be more precise about
|
||||
# hostonly checking
|
||||
check_block_and_slaves is_lvm "$rootdev" || return 1
|
||||
check_block_and_slaves is_lvm "$_rootdev" || return 1
|
||||
else
|
||||
# root is not on a block device, use the shotgun approach
|
||||
blkid | grep -q LVM2_member || return 1
|
||||
@@ -33,11 +34,12 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
local _i
|
||||
inst lvm
|
||||
|
||||
inst_rules "$moddir/64-lvm.rules"
|
||||
inst_rules "$moddir/64-lvm.rules"
|
||||
|
||||
if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
|
||||
if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
|
||||
if [ -f /etc/lvm/lvm.conf ]; then
|
||||
inst /etc/lvm/lvm.conf
|
||||
# FIXME: near-term hack to establish read-only locking;
|
||||
@@ -54,8 +56,8 @@ install() {
|
||||
inst "$moddir/lvm_scan.sh" /sbin/lvm_scan
|
||||
inst_hook cmdline 30 "$moddir/parse-lvm.sh"
|
||||
|
||||
for i in {"$libdir","$usrlibdir"}/libdevmapper-event-lvm*.so; do
|
||||
[ -e "$i" ] && dracut_install "$i"
|
||||
for _i in {"$libdir","$usrlibdir"}/libdevmapper-event-lvm*.so; do
|
||||
[ -e "$_i" ] && dracut_install "$_i"
|
||||
done
|
||||
}
|
||||
|
||||
|
@@ -10,7 +10,7 @@ if ! getargbool 1 rd.lvm -n rd_NO_LVM; then
|
||||
rm -f /etc/udev/rules.d/64-lvm*.rules
|
||||
else
|
||||
for dev in $(getargs rd.lvm.vg rd_LVM_VG=) $(getargs rd.lvm.lv rd_LVM_LV=); do
|
||||
printf '[ -e "/dev/%s" ] || exit 1\n' $dev \
|
||||
printf '[ -e "/dev/%s" ]\n' $dev \
|
||||
>> $hookdir/initqueue/finished/lvm.sh
|
||||
{
|
||||
printf '[ -e "/dev/%s" ] || ' $dev
|
||||
|
@@ -22,10 +22,10 @@ KERNEL!="md*", IMPORT{program}="/sbin/mdadm --examine --export $tempnode"
|
||||
|
||||
LABEL="do_md_inc"
|
||||
|
||||
#
|
||||
#
|
||||
# if rd_MDADMCONF do not assemble incrementally
|
||||
# defer auto assembly until the udev queue is settled
|
||||
#
|
||||
#
|
||||
ENV{rd_MDADMCONF}!="?*", GOTO="md_auto_end"
|
||||
|
||||
RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh $hookdir/initqueue/finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdadm_auto'"
|
||||
|
2
modules.d/90mdraid/md-shutdown.sh
Normal file
2
modules.d/90mdraid/md-shutdown.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
echo "Disassembling mdraid devices."
|
||||
mdadm -v --stop --scan
|
@@ -3,5 +3,5 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
info "Autoassembling MD Raid"
|
||||
/sbin/mdadm -As --auto=yes --run 2>&1 | vinfo
|
||||
info "Autoassembling MD Raid"
|
||||
mdadm -As --auto=yes --run 2>&1 | vinfo
|
||||
|
@@ -7,6 +7,6 @@ md=$1
|
||||
udevadm control --stop-exec-queue
|
||||
# and activate any containers
|
||||
mdadm -IR $md 2>&1 | vinfo
|
||||
ln -s /sbin/mdraid-cleanup $hookdir/pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
|
||||
ln -s /sbin/mdraid-cleanup $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
|
||||
ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
|
||||
ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
|
||||
udevadm control --start-exec-queue
|
||||
|
@@ -2,5 +2,5 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
# save state dir for mdmon/mdadm for the real root
|
||||
mkdir -m 0755 /run/mdadm
|
||||
[ -d /run/mdadm ] || mkdir -m 0755 /run/mdadm
|
||||
# backward compat link
|
||||
|
@@ -7,8 +7,8 @@ for i in /dev/md* /dev/md/*; do
|
||||
[ -b $i ] || continue
|
||||
|
||||
mddetail=$(udevadm info --query=property --name=$i)
|
||||
case "$mddetail" in
|
||||
*MD_LEVEL=container*)
|
||||
case "$mddetail" in
|
||||
*MD_LEVEL=container*)
|
||||
;;
|
||||
*DEVTYPE=partition*)
|
||||
;;
|
||||
|
@@ -11,7 +11,7 @@ mdadm -Is --run 2>&1 | vinfo
|
||||
|
||||
# there could still be some leftover devices
|
||||
# which have had a container added
|
||||
for md in /dev/md[0-9]* /dev/md/*; do
|
||||
for md in /dev/md[0-9]* /dev/md/*; do
|
||||
[ -b "$md" ] || continue
|
||||
udevinfo="$(udevadm info --query=env --name=$md)"
|
||||
strstr "$udevinfo" "MD_UUID=" && continue
|
||||
@@ -21,6 +21,6 @@ for md in /dev/md[0-9]* /dev/md/*; do
|
||||
done
|
||||
unset udevinfo
|
||||
|
||||
ln -s /sbin/mdraid-cleanup $hookdir/pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
|
||||
ln -s /sbin/mdraid-cleanup $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
|
||||
ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
|
||||
ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
|
||||
udevadm control --start-exec-queue
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
local _rootdev
|
||||
# No mdadm? No mdraid support.
|
||||
type -P mdadm >/dev/null || return 1
|
||||
|
||||
@@ -12,11 +13,11 @@ check() {
|
||||
is_mdraid() { [[ -d "/sys/dev/block/$1/md" ]]; }
|
||||
|
||||
[[ $hostonly ]] && {
|
||||
rootdev=$(find_root_block_device)
|
||||
if [[ $rootdev ]]; then
|
||||
# root lives on a block device, so we can be more precise about
|
||||
_rootdev=$(find_root_block_device)
|
||||
if [[ $_rootdev ]]; then
|
||||
# root lives on a block device, so we can be more precise about
|
||||
# hostonly checking
|
||||
check_block_and_slaves is_mdraid "$rootdev" || return 1
|
||||
check_block_and_slaves is_mdraid "$_rootdev" || return 1
|
||||
else
|
||||
# root is not on a block device, use the shotgun approach
|
||||
blkid | egrep -q '(linux|isw)_raid' || return 1
|
||||
@@ -36,12 +37,12 @@ installkernel() {
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install mdadm partx
|
||||
dracut_install mdadm partx
|
||||
|
||||
|
||||
# XXX: mdmon really needs to run as non-root?
|
||||
# If so, write only the user it needs in the initrd's /etc/passwd (and maybe /etc/group)
|
||||
# in a similar fashion to modules.d/95nfs. Do not copy /etc/passwd and /etc/group from
|
||||
# in a similar fashion to modules.d/95nfs. Do not copy /etc/passwd and /etc/group from
|
||||
# the system into the initrd.
|
||||
# dledford has hardware to test this, so he should be able to clean this up.
|
||||
# inst /etc/passwd
|
||||
@@ -53,11 +54,11 @@ install() {
|
||||
|
||||
inst_rules "$moddir/65-md-incremental-imsm.rules"
|
||||
|
||||
if ! mdadm -Q -e imsm /dev/null &> /dev/null; then
|
||||
if ! mdadm -Q -e imsm /dev/null &> /dev/null; then
|
||||
inst_hook pre-trigger 30 "$moddir/md-noimsm.sh"
|
||||
fi
|
||||
|
||||
if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then
|
||||
if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then
|
||||
if [ -f /etc/mdadm.conf ]; then
|
||||
inst /etc/mdadm.conf
|
||||
else
|
||||
@@ -67,7 +68,7 @@ install() {
|
||||
|
||||
if [ -x /sbin/mdmon ] ; then
|
||||
dracut_install mdmon
|
||||
fi
|
||||
fi
|
||||
inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh"
|
||||
|
||||
inst "$moddir/mdraid_start.sh" /sbin/mdraid_start
|
||||
@@ -76,5 +77,6 @@ install() {
|
||||
inst "$moddir/md_finished.sh" /sbin/md_finished.sh
|
||||
inst_hook pre-trigger 30 "$moddir/parse-md.sh"
|
||||
inst "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
|
||||
inst_hook shutdown 30 "$moddir/md-shutdown.sh"
|
||||
}
|
||||
|
||||
|
@@ -11,17 +11,17 @@ else
|
||||
if [ -n "$MD_UUID" ]; then
|
||||
for f in /etc/udev/rules.d/65-md-incremental*.rules; do
|
||||
[ -e "$f" ] || continue
|
||||
while read line; do
|
||||
while read line; do
|
||||
if [ "${line%%UUID CHECK}" != "$line" ]; then
|
||||
for uuid in $MD_UUID; do
|
||||
printf 'ENV{MD_UUID}=="%s", GOTO="do_md_inc"\n' $uuid
|
||||
done;
|
||||
printf 'GOTO="md_inc_end"\n';
|
||||
printf 'GOTO="md_inc_end"\n';
|
||||
else
|
||||
echo $line;
|
||||
echo $line;
|
||||
fi
|
||||
done < "${f}" > "${f}.new"
|
||||
mv "${f}.new" "$f"
|
||||
mv "${f}.new" "$f"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
local _rootdev
|
||||
# if there's no multipath binary, no go.
|
||||
type -P multipath >/dev/null || return 1
|
||||
|
||||
@@ -16,9 +17,9 @@ check() {
|
||||
}
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
rootdev=$(find_root_block_device)
|
||||
if [[ $rootdev ]]; then
|
||||
check_block_and_slaves is_mpath "$rootdev" && return 0
|
||||
_rootdev=$(find_root_block_device)
|
||||
if [[ $_rootdev ]]; then
|
||||
check_block_and_slaves is_mpath "$_rootdev" && return 0
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
@@ -41,7 +42,8 @@ installkernel() {
|
||||
}
|
||||
|
||||
install() {
|
||||
for f in \
|
||||
local _f
|
||||
for _f in \
|
||||
/sbin/dmsetup \
|
||||
/sbin/kpartx \
|
||||
/sbin/mpath_wait \
|
||||
@@ -53,7 +55,7 @@ install() {
|
||||
/etc/multipath.conf \
|
||||
/etc/multipath/* \
|
||||
"$libdir"/libmultipath* "$libdir"/multipath/*; do
|
||||
[ -e "$f" ] && inst "$f"
|
||||
[ -e "$_f" ] && inst "$_f"
|
||||
done
|
||||
|
||||
inst_hook pre-trigger 02 "$moddir/multipathd.sh"
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
if [ -e /etc/multipath.conf ]; then
|
||||
HARD=""
|
||||
while pidof multipathd >/dev/null 2>&1; do
|
||||
while pidof multipathd >/dev/null 2>&1; do
|
||||
for pid in $(pidof multipathd); do
|
||||
kill $HARD $pid >/dev/null 2>&1
|
||||
done
|
||||
|
@@ -6,6 +6,6 @@ if [ -e /etc/multipath.conf ]; then
|
||||
modprobe dm-multipath
|
||||
multipathd -B || multipathd
|
||||
else
|
||||
rm /etc/udev/rules.d/??-multipath.rules 2>/dev/null
|
||||
rm /etc/udev/rules.d/??-multipath.rules 2>/dev/null
|
||||
fi
|
||||
|
||||
|
33
modules.d/91crypt-gpg/crypt-gpg-lib.sh
Normal file
33
modules.d/91crypt-gpg/crypt-gpg-lib.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=4 sw=4 sts=0 et filetype=sh
|
||||
|
||||
command -v ask_for_password >/dev/null || . /lib/dracut-crypt-lib.sh
|
||||
|
||||
# gpg_decrypt mnt_point keypath keydev device
|
||||
#
|
||||
# Decrypts encrypted symmetrically key to standard output.
|
||||
#
|
||||
# mnt_point - mount point where <keydev> is already mounted
|
||||
# keypath - GPG encrypted key path relative to <mnt_point>
|
||||
# keydev - device on which key resides; only to display in prompt
|
||||
# device - device to be opened by cryptsetup; only to display in prompt
|
||||
gpg_decrypt() {
|
||||
local mntp="$1"
|
||||
local keypath="$2"
|
||||
local keydev="$3"
|
||||
local device="$4"
|
||||
|
||||
local gpghome=/tmp/gnupg
|
||||
local opts="--homedir $gpghome --no-mdc-warning --skip-verify --quiet"
|
||||
opts="$opts --logger-file /dev/null --batch --no-tty --passphrase-fd 0"
|
||||
|
||||
mkdir -m 0700 -p "$gpghome"
|
||||
|
||||
ask_for_password \
|
||||
--cmd "gpg $opts --decrypt $mntp/$keypath" \
|
||||
--prompt "Password ($keypath on $keydev for $device)" \
|
||||
--tries 3 --tty-echo-off
|
||||
|
||||
rm -rf -- "$gpghome"
|
||||
}
|
19
modules.d/91crypt-gpg/module-setup.sh
Executable file
19
modules.d/91crypt-gpg/module-setup.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# GPG support is optional
|
||||
check() {
|
||||
type -P gpg >/dev/null || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo crypt
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install gpg
|
||||
inst "$moddir/crypt-gpg-lib.sh" "/lib/dracut-crypt-gpg-lib.sh"
|
||||
}
|
@@ -3,8 +3,8 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
arch=$(uname -m)
|
||||
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
||||
local _arch=$(uname -m)
|
||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
arch=$(uname -m)
|
||||
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
||||
local _arch=$(uname -m)
|
||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
[ -d /etc/modprobe.d ] || mkdir /etc/modprobe.d
|
||||
[ -d /etc/modprobe.d ] || mkdir -m 0755 -p /etc/modprobe.d
|
||||
|
||||
dasd_arg=$(getarg rd.dasd_mod.dasd rd_DASD_MOD=)
|
||||
if [ -n "$dasd_arg" ]; then
|
||||
|
@@ -12,7 +12,7 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install -o ps grep more cat rm strace free showmount
|
||||
dracut_install -o ps grep more cat rm strace free showmount
|
||||
dracut_install -o ping netstat rpcinfo vi scp ping6 ssh
|
||||
dracut_install -o fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck
|
||||
|
||||
|
25
modules.d/95fcoe/fcoe-edd.sh
Executable file
25
modules.d/95fcoe/fcoe-edd.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
dcb=$1
|
||||
|
||||
if ! [ -d /sys/firmware/edd ]; then
|
||||
modprobe edd
|
||||
while ! [ -d /sys/firmware/edd ]; do sleep 0.1; done
|
||||
fi
|
||||
|
||||
for disk in /sys/firmware/edd/int13_*; do
|
||||
[ -d $disk ] || continue
|
||||
for nic in ${disk}/pci_dev/net/*; do
|
||||
[ -d $nic ] || continue
|
||||
if [ -e ${nic}/address ]; then
|
||||
fcoe_interface=${nic##*/}
|
||||
if ! [ -e "/tmp/.fcoe-$fcoe_interface" ]; then
|
||||
/sbin/fcoe-up $fcoe_interface $dcb
|
||||
> "/tmp/.fcoe-$fcoe_interface"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
modprobe -r edd
|
@@ -3,24 +3,24 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# We get called like this:
|
||||
# /sbin/fcoe-up <network-device> <dcb|nodcb>
|
||||
# fcoe-up <network-device> <dcb|nodcb>
|
||||
#
|
||||
# Note currently only nodcb is supported, the dcb option is reserved for
|
||||
# future use.
|
||||
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
# Huh? Missing arguments ??
|
||||
[ -z "$1" -o -z "$2" ] && exit 1
|
||||
|
||||
export PS4="fcoe-up.$1.$$ + "
|
||||
exec >>/run/initramfs/initlog.pipe 2>>/run/initramfs/initlog.pipe
|
||||
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
netif=$1
|
||||
dcb=$2
|
||||
|
||||
/sbin/ip link set "$netif" up
|
||||
ip link set "$netif" up
|
||||
wait_for_if_up "$netif"
|
||||
|
||||
if [ "$dcb" = "dcb" ]; then
|
||||
|
@@ -21,16 +21,16 @@ installkernel() {
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install ip
|
||||
inst dcbtool
|
||||
dracut_install ip
|
||||
inst dcbtool
|
||||
inst fipvlan
|
||||
inst lldpad
|
||||
|
||||
mkdir -p "$initdir/var/lib/lldpad"
|
||||
mkdir -m 0755 -p "$initdir/var/lib/lldpad"
|
||||
|
||||
inst "$moddir/fcoe-up" "/sbin/fcoe-up"
|
||||
inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
|
||||
inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh"
|
||||
inst_hook pre-udev 60 "$moddir/fcoe-genrules.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-fcoe.sh"
|
||||
}
|
||||
|
||||
|
@@ -51,20 +51,7 @@ if [ "$fcoe_interface" = "edd" ]; then
|
||||
if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ] ; then
|
||||
warn "Invalid FCoE DCB option: $fcoe_dcb"
|
||||
fi
|
||||
[ -d /sys/firmware/edd ] || modprobe edd
|
||||
# parse edd interfaces
|
||||
for disk in /sys/firmware/edd/int13_*; do
|
||||
[ -d $disk ] || continue
|
||||
for nic in ${disk}/pci_dev/net/*; do
|
||||
[ -d $nic ] || continue
|
||||
if [ -e ${nic}/address ]; then
|
||||
unset fcoe_mac
|
||||
unset fcoe_interface
|
||||
fcoe_mac=$(cat ${nic}/address)
|
||||
[ -n "$fcoe_mac" ] && source /sbin/fcoe-genrules.sh
|
||||
fi
|
||||
done
|
||||
done
|
||||
/sbin/initqueue --settled --unique /sbin/fcoe-edd $fcoe_dcb
|
||||
else
|
||||
for fcoe in $(getargs fcoe=); do
|
||||
unset fcoe_mac
|
||||
@@ -73,6 +60,6 @@ else
|
||||
if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ] ; then
|
||||
warn "Invalid FCoE DCB option: $fcoe_dcb"
|
||||
fi
|
||||
source /sbin/fcoe-genrules.sh
|
||||
. $(command -v fcoe-genrules.sh)
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
@@ -12,5 +12,7 @@ depends() {
|
||||
|
||||
install() {
|
||||
dracut_install /etc/fstab.sys
|
||||
dracut_install /sbin/fsck*
|
||||
type -P e2fsck >/dev/null && dracut_install e2fsck
|
||||
inst_hook pre-pivot 00 "$moddir/mount-sys.sh"
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user