Compare commits

...

169 Commits
047 ... 049

Author SHA1 Message Date
Harald Hoyer
225e4b94cb Fix tests with network-legacy 2018-10-08 15:38:33 +02:00
Harald Hoyer
3e676eb12f AUTHORS: update 2018-10-08 15:31:49 +02:00
Harald Hoyer
2257b800ac NEWS: update 2018-10-08 15:31:08 +02:00
Eugene Syromiatnikov
290df2e1de modules.d: Add a module for handling additional depmod kernel module directories
It parses depmod configuration and scans modules.dep for kernel modules
present in directories supplied in "overrides", "external", and "search"
depmod configuration options.  The resulting list of (absolute) kernel
module paths is then supplied to instmods.

* modules.d/90kernel-modules-extra/module-setup.sh: New file.
* dracut.spec (%files): Add
%{dracutlibdir}/modules.d/90kernel-modules-extra.

Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2018-10-08 10:49:36 +02:00
Harald Hoyer
4be697e5c1 dracut.spec: fixed invalid spec line 2018-09-21 12:41:00 +02:00
Lubomir Rintel
08bdadbf31 network-manager: add module 2018-09-21 11:32:01 +02:00
Lubomir Rintel
734739187b network-legacy: split off from network module 2018-09-21 11:32:01 +02:00
Lubomir Rintel
1c4a51c39c network: fix an error message 2018-09-21 11:32:01 +02:00
Lubomir Rintel
0aa2e5f728 iscsi: start iscsid even w/o systemd 2018-09-21 11:32:01 +02:00
Lubomir Rintel
5e615f4eb4 iscsi: do not install all of /etc/iscsi unless hostonly
/etc/iscsi/initiatorname.iscsi would leak the host initiator name (that
is host configuration) to the initramfs. Perhaps other files too.
2018-09-21 11:32:01 +02:00
Lubomir Rintel
9e82732dd4 iscsi: do not replace the configuration in the host system
ln: failed to create symbolic link '/usr/lib/systemd/system/sockets.target.wants/iscsid.socket': Permission denied
  ln: failed to create symbolic link '/usr/lib/systemd/system/sockets.target.wants/iscsiuio.socket': Permission denied

No way. Just ensure the links are there in the initramfs image. In fact,
that is already the case for iscsiuio.socket. Add iscsid.socket too.
2018-09-21 11:32:01 +02:00
Lubomir Rintel
0454dc247a network: configure NetworkManager to use dhclient
If the network module obtained a lease using dhclient, NetworkManager
must be configured to use it too, otherwise it would obtain a different
lease (and could potentially break a connection to the network volume).
2018-09-21 10:40:55 +02:00
Kairui Song
24f3463bff dracut.spec: Add dracut-squash package
As 99squash module requires extra dependency and it introduces new
files, add a new sub package for this module.
2018-09-21 10:32:04 +02:00
Kairui Song
095e1f37c4 Add support for building a squashed initramfs
With all files stored in ramfs, and most of them are not compressed,
the initramfs will take up a lot of memory. Besides, if the file number
is large, each file will waste some memory due to page fragmetation.
This is due to ramfs' design, at least one page will be allocated for
one file however small the file is. On machine with large page size,
this will become worse and waste too many memory.

One approach to reducing the memory usage is to reduce the number of
files that got directly loaded into the root ramfs, and compress files
by put most files will into a read-only squash image and keep a minimum
set of executable and libraries outside as the loader for the squash
image. After the squash image is mounted, the real 'init' will be
executed and then everything behaves as usual.

This patch will introduce a '99squash' module which will never be
included by default. User can force add it, and if it is included,
dracut will perform some extra steps before creating the final image:

For now, "/etc" and "/usr" will be moved into the squashfs image.
"/init" will be renamed to "/init.stock" and replaced by "/init.squash".
Files and folders need to be accessible before mounting the image will
be still avaliable at their original place. And due to squashfs is
readonly, an overlayfs layer will be created on top of squashfs mount
point, as many dracut module require readwrite access to "/etc" and
"/usr", "init.squash" will ultimately call "/init.stock".

An extra systemd service will be installed. This service will umount all
squashfs related mount points right before switch-root to release
resources properly. This service will not actually do anything if
switch-root is not used.

This is very helpful when mem resource is very limited, like Kdump.
According to my tests, this squash module can help save about 35MB of
memory with 64K page size, or about 15MB with 4K page size on an
ordinary kdump capture routine. This module could also help reduce
memory usage for normal boot up process.

Won't change any behavior if squash module is not enabled.

Signed-off-by: Kairui Song <kasong@redhat.com>
2018-09-21 10:32:04 +02:00
Alexander Tsoy
f4334e9bdf base/dracut-lib.sh: use "command -v" in pidof()
"type -P" doesn't work in dash
2018-09-10 09:45:50 +02:00
Alexander Tsoy
838f22259a install: avoid non-portable __WORDSIZE
Lets not unnecessarily rely on __WORDSIZE, which is not clearly specified
by any spec. Use explicit size comparisons if we're not interested in the
WORDSIZE, anyway.

Patch ported from systemd.
(commit 8507eb20b64010b26f23822cbf442bb0bf96511c)

Original-patch-by: Emil Renner Berthing <systemd@esmil.dk>
Bug: https://bugs.gentoo.org/602122
2018-09-10 09:45:22 +02:00
Alexander Tsoy
b3480d31b0 Prevent environment leaking into initrd-release
On my system the following initrd-release is generated:
...
VERSION="4 dracut-048 dracut-048"
...

VERSION is not defined in /etc/os-release, so the variable is
concatenated with its previous value:

* "4" comes from the kernel build system since dracut is called from the
  kernel install hook ("4" is a major kernel version);
* first "dracut-048" comes from the "systemd-initrd" module;
* second "dracut-048" comes from the "base" module.
2018-09-10 09:42:36 +02:00
Frederick Grose
8dd7bb48fc dmsquash-live/apply-live-updates: Test proper file link.
Update flag link to /dev/root as required by commit
789668deb3.
2018-09-06 11:46:24 +02:00
Frederick Grose
44d1688164 dmsquash-live-root: Manage absent overlayfs module better.
die when required; systemctl reload otherwise.
2018-09-06 11:46:24 +02:00
Frederick Grose
a7d8fc280c dmsquash-live: Avoid grep and sed in this module.
strstr and variable string manipulations suffice.
2018-09-06 11:46:24 +02:00
Daniel Molkentin
e9a84e0a21 98dracut-systemd: Start systemd-vconsole-setup before dracut-cmdline-ask
This is what happened before this patch (edited for brevity):

  dracut-cmdline-ask.service in modules.d/98dracut-systemd, which invokes
  dracut-cmdline-ask.sh. This script and systemd-vconsole-setup are
  started in parallel for the same console (tty1).

  Then dracut-cmdline-ask quits immediately without doing anything (unless
  rd.cmdline=ask is given). As this is a bash script and it gets tty as
  stdin as specified in its *.service, this triggers the hangup of tty1 at
  its exit.

  Meanwhile systemd-vconsole-setup continues and tries some ioctls after
  that, but they fail because of the hung up tty1.

The usual culprit for starting systemd-vconsole-setup early on is
plymouth-start.service, even if plymouth.enable=0 is set.

A popular (and annoying) symptom of this as reported by users was
the inability use their configured keyboard layout in plymouth when
unlocking their crypted block devices.

Reference: boo#1055834
2018-09-05 13:20:36 +02:00
Tobias Klauser
d09218823c Fix misspellings in man pages and usage
Also remove some trailing whitespaces from the same files.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2018-08-30 13:12:00 +02:00
Tony Asleson
ae9bc0d72f stratis: Add additional binaries
Include all binaries that could be called by the daemon.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2018-08-24 08:46:13 +02:00
Kairui Song
09ba1b289f kernel-modules: add nfit
To support pmem devices, nfit module is required
2018-08-21 13:03:36 +02:00
Kairui Song
9f3c31cd8d 99base: enable initqueue if extra devices are added
When extra devices are added, initqueue should be enabled to make sure
those devices are present, so following services and routines could
use those devices.

See PR #442 for more detail.
2018-08-21 13:03:20 +02:00
Frederick Grose
eb18a1fe29 dmsquash-live, livenet: Simplify OverlayFS read-only overlay setup.
Use multiple lower layer directories in a single OverlayFS mount with
  a transient overlay directory.
Tolerate a command line with rd.live.overlay.readonly and NO persistent
  overlay by reconfiguring the OverlayFS mount options.
Use more compatible shell syntax for testing symlinks, and use printf
  instead of echo -e.
2018-08-21 10:52:34 +02:00
Frederick Grose
789668deb3 dmsquash-live: Support a flattened squashfs.img
A simplified root filesystem structure may be provided for OverlayFS
overlays by squashing the root filesystem directly instead of squashing
an embedded image file at /LiveOS/rootfs.img.  Detect and configure
such a squashed root filesystem for live booting.

For OverlayFS boots, avoid the read-only Device-mapper linear device
  at /dev/mapper/live-base.
Create a consistent device link at /dev/live-base for the read-only
  base loop device for all overlayed live root filesystems.
Consistently provide a link at /dev/root for wait_for_dev.

Update documentation.
2018-08-21 10:52:34 +02:00
Frederick Grose
e791d753be livenet: Enable OverlayFS overlay in sysroot.mount generator.
Adjust sysroot.mount configuration for rd.live.overlay.overlayfs option.
Use link at /dev/root as a consistent flag for wait_for_dev.
Adjust documentation.
2018-08-20 10:08:43 +02:00
Harald Hoyer
e0e6d96d69 travis: re-enable test 14
https://bugzilla.redhat.com/show_bug.cgi?id=1615271
2018-08-20 10:05:41 +02:00
Harald Hoyer
ee18dd2b88 ifcfg/write-ifcfg.sh: aggregate resolv.conf
The old code used /tmp/net.$netif.resolv.conf with $netif being randomly
chosen.

As it is not known which nameserver have which priority, just sort them
and deduplicate.
2018-08-17 15:52:36 +02:00
Harald Hoyer
09132c732a test/test-functions: fixed V=1 logic 2018-08-17 15:38:03 +02:00
Harald Hoyer
f19063ac71 travis: one last job reshuffle 2018-08-16 15:34:49 +02:00
Harald Hoyer
a17440713a travis: reshuffle tests
long running tests first
2018-08-16 14:48:21 +02:00
Harald Hoyer
bd03d374b7 travis: modprobe amd nested=1
GREAT!

$ modinfo kvm-intel kvm-amd| fgrep nested
parm:           nested:bool
parm:           nested:int
2018-08-16 14:28:54 +02:00
Harald Hoyer
06e12e4ba8 travis: rebalance tests 2018-08-16 14:25:23 +02:00
Harald Hoyer
f059ce7682 travis: reshuffle tests 2018-08-16 13:56:19 +02:00
Harald Hoyer
286685cb72 TEST-99-RPM: use releasever of the host system 2018-08-16 13:20:40 +02:00
Harald Hoyer
7c62555bcf TEST-15-BTRFSRAID: use seperate disk image for boot result 2018-08-16 13:20:35 +02:00
Harald Hoyer
2699d8ff7e TEST-99-RPM: removed --releasever 2018-08-16 12:03:40 +02:00
Harald Hoyer
5a8f1aef55 TEST-15-BTRFSRAID: sync in test-init
strange failure
2018-08-16 12:01:40 +02:00
Harald Hoyer
9c034dc326 travis: no rpm check for all matrix tests 2018-08-16 11:57:30 +02:00
Harald Hoyer
f8cad00948 test: for V=2 tail only the last MB of logs 2018-08-16 11:47:21 +02:00
Harald Hoyer
c128b969bb travis: combine more tests 2018-08-16 11:18:33 +02:00
Harald Hoyer
f59664a01f logtee: reduce output 2018-08-16 11:14:11 +02:00
Harald Hoyer
67f43d2124 test: fixed test.log name 2018-08-16 11:13:55 +02:00
Harald Hoyer
0ae5848245 travis: git pull more depth 2018-08-16 10:46:57 +02:00
Harald Hoyer
9f02b291ac travis: git pull --tags 2018-08-16 10:39:49 +02:00
Harald Hoyer
2b77ba0b75 travis: fight with yaml 2018-08-16 10:36:17 +02:00
Harald Hoyer
6f90be2971 travis: fixup 2018-08-16 10:33:06 +02:00
Harald Hoyer
110063c585 travis: git check 2018-08-16 10:29:16 +02:00
Harald Hoyer
51d0a54555 travis: use own logtee.c to reduce log output 2018-08-16 10:17:48 +02:00
Harald Hoyer
c31a80c9ed TEST-01: remove memdebug 2018-08-16 09:50:52 +02:00
Harald Hoyer
79afb279c2 travis: fedora-test.sh send dnf output to dev/null 2018-08-16 09:48:02 +02:00
Harald Hoyer
3c8d3a6565 travis: don't run TEST-40-NBD 2018-08-16 09:35:33 +02:00
Harald Hoyer
01f9d0d9bf travis: combine more tests 2018-08-16 09:26:35 +02:00
Harald Hoyer
3111988680 dracut.sh: remove bogus dir removal for --rebuild 2018-08-16 09:19:52 +02:00
Harald Hoyer
1ebbe2eb7b travis: combine jobs 2018-08-16 09:10:29 +02:00
Harald Hoyer
65d16d1914 travis: extend matrix 2018-08-16 08:50:11 +02:00
Harald Hoyer
da5a44cfb7 .travis.yml: add gitter notifications 2018-08-14 17:06:58 +02:00
Harald Hoyer
75b8b144a1 fedora-test.sh: don't parallelize travis tests 2018-08-14 17:02:43 +02:00
Harald Hoyer
1363167d65 Update README.md 2018-08-14 16:58:52 +02:00
Harald Hoyer
d15c15c8f5 test/test-functions: be verbose for any $V not empty 2018-08-14 16:54:27 +02:00
Harald Hoyer
9288d21b9f TEST-50-MULTINIC: removed bogus qemu compat server call 2018-08-14 16:37:01 +02:00
Harald Hoyer
cafe6675c2 test/run-qemu: move -cpu host to kvm args 2018-08-14 16:31:22 +02:00
Harald Hoyer
fba4d28433 TEST-50-MULTINIC: fixed server.log 2018-08-14 16:30:42 +02:00
Harald Hoyer
b7774da97c might even run without kvm 2018-08-14 16:18:53 +02:00
Harald Hoyer
3c1a083e5c add travis build job 2018-08-14 16:01:39 +02:00
Harald Hoyer
0f294d90b2 TEST-31-ISCSI-MULTI: increase verbose level 2018-08-14 15:54:42 +02:00
Harald Hoyer
a2dbecfcd6 test: add TEST_RUN_ID 2018-08-14 15:54:31 +02:00
Harald Hoyer
604c09b1da TEST-31-ISCSI-MULTI/test.sh: fixed test description 2018-08-14 15:28:56 +02:00
Harald Hoyer
f9c8b3112a TEST-50-MULTINIC/test.sh: fixed server startup 2018-08-14 14:12:54 +02:00
Harald Hoyer
bb75d16521 kernel-network-modules: add vlan kernel modules 2018-08-14 14:07:12 +02:00
Harald Hoyer
ca8f1c1ba3 test: fixed KVERSION and qemu backwards compatiblity 2018-08-14 14:03:55 +02:00
Harald Hoyer
94cc856cb8 TEST-70-BONDBRIDGETEAMVLAN: load vlan kernel modules 2018-08-14 13:57:15 +02:00
Harald Hoyer
827a5b1a80 test: also output server.log on failure 2018-08-14 11:37:57 +02:00
Harald Hoyer
393da0c370 TEST-50-MULTINIC: s/--device/-device 2018-08-14 11:35:26 +02:00
Harald Hoyer
82fe4ea0a5 enable parallel test suite
$ time sudo make -j SKIP=14 V=2 check
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-13-ENC-RAID-LVM'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-40-NBD'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-04-FULL-SYSTEMD'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-12-RAID-DEG'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-15-BTRFSRAID'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-16-DMSQUASH'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-17-LVM-THIN'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-11-LVM'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-31-ISCSI-MULTI'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-20-NFS'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-99-RPM'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-02-SYSTEMD'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-30-ISCSI'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-01-BASIC'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-03-USR-MOUNT'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-70-BONDBRIDGETEAMVLAN'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-50-MULTINIC'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-10-RAID'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-18-LVM-ENC-LV'
TEST: root filesystem on an encrypted LVM PV on a degraded RAID-5 [STARTED]
TEST: root filesystem on NBD [STARTED]
TEST: root filesystem on NBD [SKIPPED]
TEST: Full systemd serialization/deserialization test with /usr mount [STARTED]
TEST: root filesystem on multiple device btrfs [STARTED]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-40-NBD'
TEST: root filesystem on a LiveCD dmsquash filesystem [STARTED]
TEST: root filesystem on a LiveCD dmsquash filesystem [SKIPPED]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-16-DMSQUASH'
TEST: root filesystem on LVM on encrypted partitions of a RAID-5 [STARTED]
TEST: root filesystem on LVM PV [STARTED]
TEST: rpm integrity after dracut and kernel install [STARTED]
TEST: root filesystem on NFS [STARTED]
TEST: root filesystem over iSCSI [STARTED]
TEST: root filesystem on LVM PV with thin pool [STARTED]
TEST: root filesystem over iSCSI [STARTED]
TEST: root filesystem on a ext3 filesystem [STARTED]
TEST: root filesystem on a ext3 filesystem [STARTED]
TEST: root filesystem on a btrfs filesystem with /usr subvolume [STARTED]
TEST: root filesystem on NFS with bridging/bonding/vlan [STARTED]
TEST: root filesystem on NFS with multiple nics [STARTED]
TEST: root filesystem on an encrypted LVM PV on a RAID-5 [STARTED]
TEST: root filesystem on LVM on encrypted partitions of a RAID-5 [STARTED]
TEST: root filesystem on LVM PV [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-11-LVM'
TEST: root filesystem on multiple device btrfs [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-15-BTRFSRAID'
TEST: root filesystem on LVM PV with thin pool [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-17-LVM-THIN'
TEST: root filesystem on a ext3 filesystem [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-02-SYSTEMD'
TEST: root filesystem on a btrfs filesystem with /usr subvolume [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-03-USR-MOUNT'
TEST: root filesystem on LVM on encrypted partitions of a RAID-5 [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-18-LVM-ENC-LV'
TEST: Full systemd serialization/deserialization test with /usr mount [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-04-FULL-SYSTEMD'
TEST: root filesystem on an encrypted LVM PV on a RAID-5 [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-10-RAID'
TEST: root filesystem on LVM on encrypted partitions of a RAID-5 [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-13-ENC-RAID-LVM'
TEST: root filesystem over iSCSI [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-30-ISCSI'
TEST: root filesystem on a ext3 filesystem [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-01-BASIC'
TEST: root filesystem over iSCSI [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-31-ISCSI-MULTI'
TEST: rpm integrity after dracut and kernel install [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-99-RPM'
TEST: root filesystem on NFS [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-20-NFS'
TEST: root filesystem on NFS with bridging/bonding/vlan [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-70-BONDBRIDGETEAMVLAN'
TEST: root filesystem on an encrypted LVM PV on a degraded RAID-5 [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-12-RAID-DEG'
TEST: root filesystem on NFS with multiple nics [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-50-MULTINIC'

real	9m3,969s
user	22m50,323s
sys	5m24,411s
2018-08-14 11:04:50 +02:00
Harald Hoyer
ffbd37d784 TEST-31-ISCSI-MULTI: use different port than TEST-30 2018-08-14 11:03:48 +02:00
Harald Hoyer
ab94a204e0 load modules earlier for iscsi via dhcp root-path 2018-08-14 11:03:11 +02:00
Harald Hoyer
6058b06b86 test/{TEST-50-MULTINIC,TEST-70-BONDBRIDGETEAMVLAN}: use qemu-3.0 syntax
use qemu-3.0 syntax for network devices
2018-08-13 16:30:25 +02:00
Harald Hoyer
26aea0299a multipath-shutdown: fix shell syntax
seems like a misplaced $()
2018-08-13 16:30:25 +02:00
Harald Hoyer
0a80cda0ea dracut.spec: remove warpclock from z-series, not the other way round 2018-08-13 16:30:25 +02:00
Harald Hoyer
6f0500ed4a iscsi: remove $() where it does not fit
also simplify iscsiadm command to one call
2018-08-13 16:30:25 +02:00
Harald Hoyer
746135dd1e mdraid: better handling of various UUID formats 2018-08-13 16:30:25 +02:00
Lukas Nykryn
a762dedb60 dracut-functions: fix the word splitting 2018-08-09 13:13:52 +02:00
Nicolas Chauvet
a0c915b1e4 Add gpio and pinctrl drivers for arm*/aarch64
This is needed since few gpio/pinctrl can be built as modules and are
useful on early boot.

One example is jetson-tx1 where sata and external mmc can work only
after loading pinctrl-max77620 and gpio-max77620 modules.

Having theses kind of drivers bundled into the initramfs will also
avoid some deferred probes.

V2: add pinctrl for all arches

Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
2018-08-06 09:46:08 +02:00
Harald Hoyer
99df3d22be mdraid/parse-md.sh: also accept rd.md.uuid with ":"
convert rd.md.uuid=32ef2172:f056:6fa7:66a8:2f7fc8b1798
to udev rules in the correct UUID format 32ef2172-f056-6fa7-66a8-2f7fcf8b1798
2018-08-02 16:32:41 +02:00
Yu Watanabe
be98291caf spec: sort modules
Also drops remaining %defattr.
2018-07-30 10:43:21 +02:00
Yu Watanabe
33782aebbf spec: warpclock is not available on s390 or s390x 2018-07-30 10:43:21 +02:00
Harald Hoyer
55a12055c5 dracut.spec: Remove needless use of %defattr 2018-07-26 13:04:20 +02:00
Harald Hoyer
25111d717e dracut.spec: add 00warpclock dracut module 2018-07-26 13:01:14 +02:00
Harald Hoyer
819ea38651 Bring back 51-dracut-rescue-postinst.sh
can only be obsoleted after F30
2018-07-26 12:58:21 +02:00
Kairui Song
143420bc05 lsinitrd: update help message and man page
Signed-off-by: Kairui Song <kasong@redhat.com>
2018-07-26 09:57:55 +02:00
Kairui Song
986b12d391 lsinitrd: optimize performance when handling multiple files
Currently, when trying to unpack or print the content of multiple
files, lsinitrd will decompress the image and pipe the decompressed
content to cpio to retrive each file if the image is compressed.
Which mean if we want to extract 10 files the image will be decompressed
10 times, which is a waste of time.

This patch will let lsinitrd decompress the image file to a temp file
first if multiple file names are given, then cpio will read from the
decompressed temp file, which will speed up a lot.

Time consumption test for command:
`lsinitrd initramfs-4.16.15-300.fc28.x86_64.img \
    usr/lib/dracut/build-parameter.txt \
    usr/lib/dracut/modules.txt \
    etc/machine-id \
    etc/hostname \
    usr/lib/udev/rules.d/99-systemd.rules`

Before the patch:
2.37user 0.33system 0:02.12elapsed

After the patch:
0.50user 0.42system 0:00.72elapsed

There would be a more significant time difference if we try to
extract more files.
2018-07-26 09:57:55 +02:00
Kairui Song
f81c864eed lsinitrd: allow to only unpack certain files
Before this patch, "--unpack" will always unpack the whole image.
Make "--unpack" be able to unpack only certain files, it will be
easier to retrieve files from initramfs image.

Signed-off-by: Kairui Song <kasong@redhat.com>
2018-07-26 09:57:55 +02:00
Harald Hoyer
aac3a0652a NEWS: forgot to update the latest version 2018-07-26 09:54:13 +02:00
Hannes Reinecke
a0eadcdc64 00warpclock: Set correct timezone
Add module for setting correct timezone.

References: bnc#830060

For now, this module will not be included automatically due to different
expectations (see e.g.  https://bugzilla.redhat.com/show_bug.cgi?id=981617)

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Daniel Molkentin <daniel.molkentin@suse.com>
2018-07-24 07:08:11 +02:00
Harald Hoyer
e331e06a39 dracut-install: skip modules with empty path
if kmod_module_get_path(module) returns NULL, skip the module
2018-07-18 12:42:02 +02:00
Kairui Song
7047294617 Record loaded kernel modules when hostonly mode is enabled
A hostonly image will not include every possibly required kernel module,
so if any hardware or configuration changed, the image may fail to boot.

One way to know if there are any hardware change or configuration change
that will require an image rebuild or not is to check the loaded kernel
module list. If the loaded kernel module list differs from last build
time, then the image may require to be rebuilt.

This commit will let dracut record the loaded kernel module list when
the image is being built, so other tools or services can compare this
list with currently loaded kernel modules to decide if dracut should be
called to rebuild the image.

To retrieve the loaded kernel modules list when an image is built, use
lsinitrd command:

lsinitrd $image -f */lib/dracut/loaded-kernel-modules.txt
2018-07-18 11:50:18 +02:00
Harald Hoyer
1caaeaae1e modules.d/95fcoe/cleanup-fcoe.sh: chmod +x 2018-07-12 15:19:17 +02:00
Harald Hoyer
d63a4e285e TEST-40-NBD: disable for now
nbd is always broken
2018-07-12 15:18:48 +02:00
Harald Hoyer
9a9c67d61b TEST-30-ISCSI: readd multiple target test 2018-07-06 11:56:23 +02:00
Harald Hoyer
bc01f822de NEWS and AUTHORS update 2018-07-06 10:37:51 +02:00
Harald Hoyer
f265cb67dc mdraid: fix case if rd.md.uuid is in ID_FS_UUID format
if rd.md.uuid is in ID_FS_UUID format with dashes
e40a0234-7e52-5f10-f267-658d8ec463fa
convert it for the /dev/disk/by-id/md-uuid-${uuid} format
e40a0234:7e525f10:f267658d:8ec463fa
2018-07-06 09:25:03 +02:00
Harald Hoyer
f98d3066d9 rdsosreport.sh: best effort to strip out passwords
Modified version of:
https://github.com/dracutdevs/dracut/pull/96

Thanks to Zhiguo Deng <bjzgdeng@linux.vnet.ibm.com>
2018-07-05 14:49:23 +02:00
Mike Gilbert
9d1b81c0d1 dracut.sh: improve udevdir and systemdutildir fallback logic
Check for a common binary in systemdutildir. This resolves an issue on
split-usr systems, where it is common to have both /lib/systemd[/system]
and /usr/lib/systemd[/user] present.

Check for systemd-udevd specifically, since some distros (Gentoo) allow
udev to be installed without the rest of the systemd stack.

Similar logic is applied to udevdir simply for consistency.
2018-07-05 13:57:43 +02:00
Harald Hoyer
e3fb645821 TEST-99-RPM: use Fedora 29 2018-07-05 13:39:46 +02:00
Harald Hoyer
8f77326479 dracut-init.sh: fix instmods with zero input
instmods < /dev/null

should not error
2018-07-05 13:39:46 +02:00
Harald Hoyer
ca77afdeb3 dracut.spec: remove 90multipath-hostonly 2018-07-05 13:39:46 +02:00
Kairui Song
35e86ac117 Merge 90-multipath-hostonly and 90-multipath
This commit basically reverts 5ce7cc73

90-multipath-hostonly module was added in 5ce7cc73, because if hostonly
mode is enabled, multipath module will always hardcode wwids which
causes problems when the initramfs is cloned to another system with same
hardware.

Now with tri-state hostonly mode, the two modules could be merged and only
hardcode wwids when "strict" hostonly mode is enabled.
2018-07-05 13:17:19 +02:00
Harald Hoyer
058ff2f06d dracut.spec: add 95qeth_rules 2018-07-05 12:03:34 +02:00
Harald Hoyer
efecf0a95e network: iface_has_carrier(): fixed logic 2018-07-05 09:37:10 +02:00
Hiroaki Mizuguchi
c574c3f565 ifup.sh: don't wait linkup when set static ip explicitly
iface_has_carrier is skipped when set $dev. Fail curl fetch for root=live:<url>.
2018-07-05 09:37:01 +02:00
Daniel Molkentin
61ac90fefa 95qeth_rules: Add new module to copy qeth rules
Only pick rules for interfaces which have a carrier in the running
system. Those interfaces will be assembled by udev to allow booting
from those devices (i.e. iSCSI).

Reference: FATE#323440
2018-07-05 09:15:08 +02:00
Kairui Song
432647c278 90kernel-modules: Don't install extra modules when hostonly mode is set to strict 2018-07-05 09:14:02 +02:00
Kairui Song
a695250ec7 Introduce tri-state hostonly mode
Add a new option --hostonly-mode which accept an <mode> parameter, so we have a tri-state hostonly mode:

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

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

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

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

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

Signed-off-by: Kairui Song <kasong@redhat.com>
2018-07-05 09:14:02 +02:00
Harald Hoyer
6ccb58a5b6 iscsi: s/rd.iscsilogin.retries/rd.iscsi.login_retry_max 2018-07-05 09:02:55 +02:00
Harald Hoyer
7d0848957c iscsi: do discovery for every network change 2018-07-04 13:05:56 +02:00
Daniel Molkentin
6b7ffedf0d Fix syncheck complaints 2018-07-04 13:05:56 +02:00
Daniel Molkentin
b31f3fe0d1 95iscsi: Replace iscsistart with iscsid
This allows to setup multiple paths to targets, which is
required for iscsi multipath.
2018-07-04 13:05:56 +02:00
Nicolas Porcel
c1688560ad Add timeout option to crypt module 2018-07-04 09:16:50 +02:00
Jeremy Linton
4cdee66c8e dracut-install: Support modules.softdep
Dracut uses the module deps to determine module dependencies
but that only works for modules with hard symbolic dependencies.
Some modules have dependencies created via callback API's or other
methods which aren't reflected in the modules.dep but rather in
modules.softdep through the use of "pre:" and "post:" commands
created in the kernel with MODULE_SOFTDEP().

Since in dracut we are only concerned about early boot, this patch
only looks at the pre: section of modules which are already being
inserted in the initrd under the assumption that the pre: section
lists dependencies required for the functionality of the module being
installed in the initrd.

Signed-off-by: Jeremy Linton <lintonrjeremy@gmail.com>
2018-07-03 13:36:26 +02:00
Sullivan (CTR), Austin
e0ec6f10d4 Fixed issue #420 2018-07-02 12:42:32 +02:00
Javier Martinez Canillas
f4947f8793 51-dracut-rescue.install: Don't install BLS fragment in /boot/efi on EFI
For EFI systems, the BLS fragments were stored in the EFI System Partition
(ESP) while in non-EFI systems it was stored in /boot.

For consistency, it's better to always store the BLS fragments in the same
path regardless of the firmware interface used.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-07-02 12:28:04 +02:00
Adam Williamson
ba26c59523 Include virtio DRM drivers in hostonly initramfs
The code in 50drm which tries to include all DRM drivers for
hardware attached to the system did not look for virtio devices.
So if the system is a VM using the 'virtio' graphics adapter,
the 'virtio-gpu' module which should be included is not. This
extends the code to also look for virtio devices.

https://bugzilla.redhat.com/show_bug.cgi?id=1593028

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-07-02 11:56:15 +02:00
Ondrej Mosnacek
cec0d04112 fips: only install FIPS-compliant crypto modules
Since the kernel doesn't allow using any non-FIPS-compliant crypto
algorithms, it doesn't make sense to install them. Even if they are
installed, tcrypt will not test them anyway.

Tested on Fedora 28 x86_64 by booting with fips=1 (with hand-patched
module-setup.sh).
2018-07-02 11:42:04 +02:00
Ondrej Mosnacek
f4d34357c0 fips: cleanup FIPS crypto module list
This patch cleans up the default list of kernel modules in the 01fips
dracut module. All the algorithms that are tested in tcrypt are listed
by their algorithm name so that all the generic implementations and
drivers are picked up automatically based on the module alias.

This drops several unneeded modules and even a bogus one (rot13 -- this
one was obviously copy-pasted from tcrypt.c where it was listed as an
easter egg :).

The patch adds also some algorithms that weren't included in the
original set. It turns out in FIPS mode we only need those algorithms
that are marked as FIPS-allowed in testmgr.c (failure to find a non-FIPS
algorithm is ignored). The non-FIPS algorithms are further removed in a
subsequent patch.
2018-07-02 11:42:04 +02:00
Ondrej Mosnacek
eed91294f8 fips: add crypto_user module for new hmaccalc
In Fedora 28+, hmaccalc (sha512hmac) is provided by libkcapi-hmaccalc,
which needs the crypto_user module for its functionality.
2018-07-02 11:42:04 +02:00
Hui Wang
a73ba9a8ef dracut: scan and install external kernel modules
since kmod-25 keyword "external" was implemented in order to avoid
additional actions(like weak-modules) when kernel was updated, which
makes it more simple while kernels' kabi were compatible.

but if move some special modules such as megaraid_sas, mpt3sas and
so on, to a external path like /opt/modules, these modules will not
be install to initramfs by default, which make the initramfs can't
be used to boot for disk detection failure.

according to kmod's document, you must specify a absolute path with
"external" keyword, so scan the lines in modules.dep that begin with
"/" and install them, to make sure necessary modules in external path
can be installed to initramfs too.

Signed-off-by: Hui Wang <john.wanghui@huawei.com>
2018-07-02 11:40:42 +02:00
Javier Martinez Canillas
4f55387829 51-dracut-rescue.install: fix exit status code
After the $COMMAND case statement, the exit status of the last executed
command is added to the $ret variable.

But for the "add" pattern, this last executed command is an arithmetic
expression that also adds the exit status $? to the $ret variable. If
both $? and $ret are 0, then the arithmetic expression evaluates to 0
so is considered false and has an exit status of 1.

This makes the script to wrongly exit with an status code of 1 when it
should had been 0.

  case "$COMMAND" in
      add)
      ...
          ((ret+=$?))
	  # $ret is 0 here
          ;;
  ...
  esac

  ((ret+=$?))
  # $ ret is 1 here

  exit $ret

Since $ret is set in the case statement, just exit with that status code
and remove the last arithmetic expression that wrongly sets $ret to 1.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-07-02 11:33:41 +02:00
Ondrej Mosnacek
bca1967c90 fips: Drop obsolete dependencies
Explicitly require libkcapi-hmaccalc and stop installing NSS/prelink
dependencies that are no longer needed.
2018-06-14 13:07:07 +02:00
Daniel Molkentin
d00cfc2a7b Remove obsolete prelinking functionality 2018-06-14 12:58:59 +02:00
Ondrej Mosnacek
e0758c8168 fips: Drop the 02fips-aesni module
The main 01fips module should always load all optimized/driver modules
of all relevant crypto algorithms (based on their aliases), so we can
drop this useless module.
2018-06-14 12:56:51 +02:00
B. Wilson
1b72c97cc5 crypt: Implement cmdline rd.luks.partuuid
Commit bf5c53a implements support for mounting LUKS devices with
detached headers; however, it assumes that the LUKS device sits on an
unpartitioned disk.

Mirroring the `rd.luks.serial` option, this commit implements the
`rd.luks.partuuid` cmdline option, supporting headless LUKS devices on
drive partitions.
2018-06-13 10:59:28 +02:00
Renaud Métrich
c1c78f8a91 Harden dracut against BASH_ENV environment variable
When dracut silently produces a broken initramfs, then the system will
likely not boot and this can be very problematic. Typical use case is
after the kernel has been updated.

It appears that dracut is not protected against the BASH_ENV variable,
causing various scripts called by dracut to possibly fail or provide
wrong output (e.g. "ldd" is one of these).
Having a broken output for "ldd" makes the generated initramfs be not
usable, typically because vital binaries will be missing (e.g.
"awk", "udevadm", ...).

Note: because the shebang line cannot contain more than one argument,
the '--norc' option had to be removed. IMHO, it was useless anyway.

Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
2018-06-08 10:48:45 +02:00
Ondrej Mosnacek
935dd5746a fips: add sha3_generic and sm3_generic modules
SHA-3 and SM3 have been added to the tcrypt module recently, so without
them the 'modprobe tcrypt' step causes a kernel panic.
2018-06-07 17:18:29 +02:00
Pingfan Liu
67354eebbc 40network: introduce ip=either6 option
In kdump, if dump-target is ssh on ipv6, we need to sync until ipv6 addr
is ready. Currently ip=auto6/dhcp6 provides such function. But in 1st kernel,
it is hard to know whether the ipv6 addr is got by dhcpv6 or SLAAC.
E.g ifcfg-eth* contains DHCPV6C=yes direction, but there is no dhcpv6
server in the network, and then after the system is up, the user
echo 1 > /proc/sys/net/ipv6/conf/eth0/autoconf && accept_ra by manual
to obtain a ipv6 addr. Or vice.
So this patch suggests to make dhcpv6 as auto6 fallback

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2018-05-29 10:07:19 +02:00
Harald Hoyer
f6e777ec4b cleanup empty ldconfig_paths directories
https://bugzilla.redhat.com/show_bug.cgi?id=1324746
2018-05-22 09:51:12 +02:00
Harald Hoyer
df6bb5e959 shutdown: sleep a little, if a process was killed
If a process (maybe plymouth) was still pinning /oldroot, then shutdown
would
- kill -9 $pid
- umount_a
- umount_a
in a very short timeframe. A small sleep hopefully lets the scheduler free
up /oldroot in the mean time.
2018-05-15 13:37:53 +02:00
Harald Hoyer
08e11e30e3 dracut.spec: do not recommend grubby 2018-05-07 15:27:22 +02:00
Harald Hoyer
731b37e929 dracut-install.c: untabify 2018-05-07 15:23:04 +02:00
Harald Hoyer
8ad3215590 don't error out, if no modules were installed
dracut-install … -m -s drm_crtc_init =drivers/staging
should not return an error, if no module was found in =drivers/staging

https://bugzilla.redhat.com/show_bug.cgi?id=1575527
2018-05-07 15:21:35 +02:00
Harald Hoyer
b2a024991f 80lvmmerge/README.md: remove executable bits 2018-05-07 10:40:32 +02:00
Harald Hoyer
bfa4e45fa7 s/find_btrfs_devs/btrfs_devs 2018-05-07 10:26:45 +02:00
Daniel Molkentin
c9b5165daa 10i18n: Fix possible infinite recursion 2018-05-03 15:15:16 +02:00
Colin Walters
740e41b843 Suppress sync/fsfreeze if not running on a live system
It's possible for e.g. `kernel` to be installed as an RPM BuildRequires or equivalent,
and there's no reason to sync, and *definitely* no reason to fsfreeze.

Another case where this happens is rpm-ostree, which performs its own sync/fsfreeze
globally.  See e.g. 8642ef5ab3
2018-05-02 17:44:45 +02:00
Michael McCracken
3161dea8e1 Update dracut.modules.7.asc
Update manpage to reflect code behavior for `inst` with >2 args.

Signed-off-by: Michael McCracken <michael.mccracken@gmail.com>
2018-04-30 21:48:34 +02:00
Yu Watanabe
cae0004dbe spec: add stratis module
Follow-up for c4f8329cc2.
2018-04-30 21:48:11 +02:00
Hendrik Brueckner
3c8a69677b crypt: correct s390 arch to include arch-specific crypto modules
Convert the s390x into s390 to also include s390-specific crypto
modules, for example, aes_s390 into the initramfs.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
2018-04-26 13:34:53 +02:00
Tony Asleson
c4f8329cc2 Initial Stratis support
Ref. https://github.com/stratis-storage

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2018-04-26 13:28:36 +02:00
tpgxyz
654484b82b fix zstd magic header 2018-04-19 06:31:23 +02:00
Marcos Mello
ccaf52901f fs-lib: install crc32 in no-hostonly
It is needed by f2fs.
2018-04-17 12:02:00 +02:00
Marcos Mello
384eeedd2d fs-lib: install crc32c for ext4
EXT4 filesystems created with metadata_csum (enabled by default in mke2fs 1.44+) or ea_inode need crc32c.

https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/commit/?id=d0b9e0a6aa7d6805338a43b4e372623352d8df09
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/fs/ext4/super.c?h=v4.15.15#n3491
2018-04-09 08:19:51 +02:00
Marcos Mello
65cfabf7a6 fs-lib: remove redundancy 2018-04-09 08:19:51 +02:00
Enno Boland
2b5192c18d make failing installation of drm modules nonfatal 2018-04-01 16:02:24 +02:00
Alexander Tsoy
fe6c7e0f06 plymouth: fix detection of plymouth directory
Some distros have both /usr/lib/plymouth and /usr/libexec/plymouth
directorirs, so we should check the existance of plymouth-populate-initrd
script.

Fixes: 421b46f8ae
2018-03-23 11:31:43 +01:00
Lukas Nykryn
3c3b2cf093 spec: add missing obsoletes and provides for removed fips subpackages 2018-03-22 16:34:16 +01:00
Lukas Nykryn
1f50d5b86d spec: merge fips subpackages to main package 2018-03-22 10:17:52 +01:00
Lukas Nykryn
0bb9a683d4 spec: drop support for legacy distributions
rhel <= 7 has its own branch and there is no point in supporting the old
fedora
2018-03-22 10:17:52 +01:00
Daniel Molkentin
d23f32dd4b 90kernel-modules: Include Intel Volume Management Device support
Reference: bsc#1079924
2018-03-16 15:37:25 +01:00
Harald Hoyer
ebfd53e1d9 lsinitrd.sh: fixed zstd file signature 2018-03-15 09:56:56 +01:00
Javier Martinez Canillas
f8c24964cd 51-dracut-rescue.install: fix initramfs not generated in /boot case
Commit 5e574046e76e ("5?-dracut*.install: Allow scripts to install
the initramfs in /boot dir") added support to generate initramfs
images in the /boot directory and copy the respective BLS files.

Unfortunately, it broke the rescue initramfs generation when it's
not installed on /boot due not checking for the correct condition.

It checks for the 0-rescue sub-dir to exist, but this is created so
instead if the parent sub-dir exists has to be checked. Also, check
if the destination directory is /boot or not, instead if it exists.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-03-12 09:05:40 +01:00
Harald Hoyer
f8e0c7cc62 kernel-modules: add mmc/core for arm 2018-03-05 09:56:25 +01:00
Lukas Nykryn
3aa37cafde all: fix issues found by shellcheck
Error: SHELLCHECK_WARNING:
/usr/lib/dracut/dracut-init.sh:939:20: error: Argument to implicit -n is always true due to literal strings. [SC2157]
  937|   dracut_kernel_post() {
  938|       for _f in modules.builtin.bin modules.builtin modules.order; do
  939|->         [[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
  940|       done
  941|

Error: SHELLCHECK_WARNING:
/usr/lib/dracut/modules.d/98syslog/parse-syslog-opts.sh:18:12: error: This expression is constant. Did you forget a $ somewhere? [SC2078]
   16|       elif [ -e /sbin/syslogd ]; then
   17|           syslogtype="syslogd"
   18|->     elif [ /sbin/syslog-ng ]; then
   19|           syslogtype="syslog-ng"
   20|       else

Error: SHELLCHECK_WARNING:
/usr/lib/dracut/modules.d/90crypt/crypt-lib.sh:15:29: error: Since you double quoted this, it will not word split, and the loop will only run once. [SC2066]
   13|               strstr "$d" "${luks##luks-}" && return 0
   14|               if [ -n "$dev" ]; then
   15|->                 for _dev in "$(devnames $d)"; do
   16|                       [ "$dev" -ef "$_dev" ] && return 0
   17|                   done
2018-03-02 13:41:43 +01:00
Javier Martinez Canillas
b39b8452d2 5?-dracut*.install: Allow scripts to install the initramfs in /boot dir
The GRUB 2 bootloaders expect the initrd to be installed in /boot instead
of /boot/$MACHINE_ID/$KERNEL_VERSION/{linux,initrd}, so if that directory
doesn't exists, install the initramfs images on the /boot directory.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-03-01 14:50:30 +01:00
Daniel Molkentin
48723f28aa 90kernel-modules: Ensure PCI host modules are included
The includes modules like the Intel Volume Management Device driver,
which is required to boot from disk on some systems.

Reference: boo#1079924
2018-03-01 12:51:49 +01:00
Harald Hoyer
3ed33db54a Update %description a bit 2018-02-26 11:22:55 +01:00
Harald Hoyer
0a68b6a518 dracut.spec: remove BuildRoot 2018-02-19 10:17:36 +01:00
Harald Hoyer
7b3f374a82 dracut.spec: remove clean section 2018-02-19 10:16:30 +01:00
124 changed files with 2306 additions and 913 deletions

47
.travis.yml Normal file
View File

@@ -0,0 +1,47 @@
language: generic
sudo: required
services:
- docker
env:
matrix:
- IMAGE=latest
- IMAGE=latest TESTS=01
- IMAGE=latest TESTS=12
- IMAGE=latest TESTS=20
- IMAGE=latest TESTS=50
- IMAGE=latest TESTS=30
- IMAGE=latest TESTS=31
- IMAGE=latest TESTS=70
- IMAGE=latest TESTS=99
- IMAGE=latest TESTS=02
- IMAGE=latest TESTS=03
- IMAGE=latest TESTS=04
- IMAGE=latest TESTS=10
- IMAGE=latest TESTS=11
- IMAGE=latest TESTS=13
- IMAGE=latest TESTS=14
- IMAGE=latest TESTS=15
- IMAGE=latest TESTS=17
before_script:
- docker pull fedora:$IMAGE
- |
sudo modprobe kvm-intel nested=1 || :
sudo modprobe kvm-amd nested=1 || :
dmesg | tail || :
- git pull --depth=100
- |
git describe --abbrev=0 --tags || :
git describe --tags || :
script:
- docker run --privileged -it -v $(pwd)/:/dracut fedora:$IMAGE /dracut/fedora-test.sh $IMAGE-$$ "$TESTS"
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/effa917ca3e0ed5fd00e
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # options: [always|never|change] default: always

View File

@@ -11,6 +11,13 @@ if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then
exit 0
fi
if [[ -d "$BOOT_DIR_ABS" ]]; then
INITRD="initrd"
else
BOOT_DIR_ABS="/boot"
INITRD="initramfs-${KERNEL_VERSION}.img"
fi
ret=0
case "$COMMAND" in
add)
@@ -18,9 +25,9 @@ case "$COMMAND" in
if [[ -f ${INITRD_IMAGE_PREGENERATED} ]]; then
# we found an initrd at the same place as the kernel
# use this and don't generate a new one
cp --reflink=auto "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/initrd" \
&& chown root:root "$BOOT_DIR_ABS/initrd" \
&& chmod 0600 "$BOOT_DIR_ABS/initrd" \
cp --reflink=auto "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/$INITRD" \
&& chown root:root "$BOOT_DIR_ABS/$INITRD" \
&& chmod 0600 "$BOOT_DIR_ABS/$INITRD" \
&& exit 0
fi
@@ -42,11 +49,11 @@ case "$COMMAND" in
break
fi
done
dracut ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS"/initrd "$KERNEL_VERSION"
dracut ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
ret=$?
;;
remove)
rm -f -- "$BOOT_DIR_ABS"/initrd
rm -f -- "$BOOT_DIR_ABS/$INITRD"
ret=$?
;;
esac

View File

@@ -63,15 +63,26 @@ if ! [[ ${BOOT_OPTIONS[*]} ]]; then
exit 1
fi
BOOT_DIR="/${MACHINE_ID}/0-rescue"
BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}
LOADER_ENTRY="$BOOT_ROOT/loader/entries/${MACHINE_ID}-0-rescue.conf"
if [[ -d "${BOOT_DIR_ABS%/*}" ]]; then
BOOT_DIR="/${MACHINE_ID}/0-rescue"
BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}
LOADER_ENTRY="$BOOT_ROOT/loader/entries/${MACHINE_ID}-0-rescue.conf"
KERNEL="linux"
INITRD="initrd"
else
BLS_DIR="/boot/loader/entries"
BOOT_DIR_ABS="/boot"
LOADER_ENTRY="$BLS_DIR/${MACHINE_ID}-0-rescue.conf"
KERNEL="vmlinuz-0-rescue-${MACHINE_ID}"
INITRD="initramfs-0-rescue-${MACHINE_ID}.img"
fi
ret=0
case "$COMMAND" in
add)
[[ -f "$LOADER_ENTRY" ]] && exit 0
[[ -f "$LOADER_ENTRY" ]] && [[ -f "$BOOT_DIR_ABS/$KERNEL" ]] \
&& [[ -f "$BOOT_DIR_ABS/$INITRD" ]] && exit 0
# source our config dir
for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do
@@ -82,21 +93,29 @@ case "$COMMAND" in
[[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS"
if ! cp --reflink=auto "$KERNEL_IMAGE" "$BOOT_DIR_ABS"/linux; then
echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/linux'!" >&2
if ! cp --reflink=auto "$KERNEL_IMAGE" "$BOOT_DIR_ABS/$KERNEL"; then
echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/$KERNEL'!" >&2
fi
dracut --no-hostonly -a "rescue" "$BOOT_DIR_ABS"/initrd "$KERNEL_VERSION"
((ret+=$?))
if [[ ! -f "$BOOT_DIR_ABS/$INITRD" ]]; then
dracut --no-hostonly -a "rescue" "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
((ret+=$?))
fi
if [[ "${BOOT_DIR_ABS}" != "/boot" ]]; then
{
echo "title $PRETTY_NAME - Rescue Image"
echo "version $KERNEL_VERSION"
echo "machine-id $MACHINE_ID"
echo "options ${BOOT_OPTIONS[@]} rd.auto=1"
echo "linux $BOOT_DIR/linux"
echo "initrd $BOOT_DIR/initrd"
} > $LOADER_ENTRY
else
cp -aT "${KERNEL_IMAGE%/*}/bls.conf" $LOADER_ENTRY
sed -i 's/'$KERNEL_VERSION'/0-rescue-'${MACHINE_ID}'/' $LOADER_ENTRY
fi
{
echo "title $PRETTY_NAME - Rescue Image"
echo "version $KERNEL_VERSION"
echo "machine-id $MACHINE_ID"
echo "options ${BOOT_OPTIONS[@]} rd.auto=1"
echo "linux $BOOT_DIR/linux"
echo "initrd $BOOT_DIR/initrd"
} > $LOADER_ENTRY
((ret+=$?))
;;
@@ -109,6 +128,4 @@ case "$COMMAND" in
ret=1;;
esac
((ret+=$?))
exit $ret

44
AUTHORS
View File

@@ -10,24 +10,26 @@ Jeremy Katz <katzj@redhat.com>
David Dillow <dave@thedillows.org>
Michal Soltys <soltys@ziu.info>
Colin Guthrie <colin@mageia.org>
Daniel Molkentin <dmolkentin@suse.com>
Amerigo Wang <amwang@redhat.com>
Thomas Renninger <trenn@suse.com>
Daniel Molkentin <dmolkentin@suse.com>
WANG Chao <chaowang@redhat.com>
Andrey Borzenkov <arvidjaar@gmail.com>
Alexander Tsoy <alexander@tsoy.me>
Lukas Nykryn <lnykryn@redhat.com>
Alexander Tsoy <alexander@tsoy.me>
Frederick Grose <fgrose@sugarlabs.org>
WANG Chao <chaowang@redhat.com>
Yu Watanabe <watanabe.yu+github@gmail.com>
Andrey Borzenkov <arvidjaar@gmail.com>
Hans de Goede <hdegoede@redhat.com>
Peter Jones <pjones@redhat.com>
Yu Watanabe <watanabe.yu+github@gmail.com>
Andreas Thienemann <andreas@bawue.net>
Frederick Grose <fgrose@sugarlabs.org>
Peter Robinson <pbrobinson@fedoraproject.org>
Fabian Vogt <fvogt@suse.com>
Kairui Song <kasong@redhat.com>
John Reiser <jreiser@bitwagon.com>
Luca Berra <bluca@vodka.it>
Xunlei Pang <xlpang@redhat.com>
Daniel Drake <drake@endlessm.com>
Lubomir Rintel <lkundrak@v3.sk>
Angelo "pallotron" Failla <pallotron@fb.com>
Brian C. Lane <bcl@redhat.com>
Ville Skyttä <ville.skytta@iki.fi>
@@ -35,15 +37,17 @@ Cristian Rodríguez <crrodriguez@opensuse.org>
Dan Horák <dhorak@redhat.com>
Baoquan He <bhe@redhat.com>
Brendan Germain <brendan.germain@nasdaqomx.com>
Colin Walters <walters@verbum.org>
Leho Kraav <leho@kraav.com>
Moritz Maxeiner <moritz@ucworks.org>
Colin Walters <walters@verbum.org>
Nicolas Chauvet <kwizart@gmail.com>
Ondrej Mosnacek <omosnace@redhat.com>
Fabian Deutsch <fabiand@fedoraproject.org>
Javier Martinez Canillas <javierm@redhat.com>
Kamil Rytarowski <n54@gmx.com>
Lidong Zhong <lidong.zhong@suse.com>
Marc Grimme <grimme@atix.de>
NeilBrown <neilb@suse.de>
Nicolas Chauvet <kwizart@gmail.com>
Peter Rajnoha <prajnoha@redhat.com>
Radek Vykydal <rvykydal@redhat.com>
Thorsten Behrens <tbehrens@suse.com>
@@ -52,10 +56,12 @@ Frederic Crozat <fcrozat@suse.com>
James Lee <jlee@thestaticvoid.com>
Jesse Keating <jkeating@redhat.com>
Martin Wilck <mwilck@suse.de>
Mike Gilbert <floppym@gentoo.org>
Milan Broz <mbroz@redhat.com>
Mimi Zohar <zohar@linux.vnet.ibm.com>
Roberto Sassu <roberto.sassu@polito.it>
Stefan Reimer <it@startux.de>
Adam Williamson <awilliam@redhat.com>
Anton Blanchard <anton@samba.org>
Bill Nottingham <notting@redhat.com>
Chapman Flack <g2@anastigmatix.net>
@@ -66,10 +72,10 @@ Jan Synacek <jsynacek@redhat.com>
Jon Ander Hernandez <jonan.h@gmail.com>
Juan RP <xtraeme@gmail.com>
Lance Albertson <lance@osuosl.org>
Marcos Mello <marcosfrm@gmail.com>
Marian Ganisin <mganisin@redhat.com>
Matthias Gerstner <matthias.gerstner@suse.de>
Michael Ploujnikov <plouj@somanetworks.com>
Mike Gilbert <floppym@gentoo.org>
Pratyush Anand <panand@redhat.com>
Silvio Fricke <silvio.fricke@gmail.com>
Steven Brudenell <steven.brudenell@gmail.com>
@@ -77,7 +83,7 @@ Stig Telfer <stelfer@cray.com>
Thomas Backlund <tmb@mageia.org>
Vasiliy Tolstov <v.tolstov@selfip.ru>
Wim Muskee <wimmuskee@gmail.com>
Adam Williamson <awilliam@redhat.com>
tpgxyz <tpgxyz@gmail.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Alan Pevec <apevec@redhat.com>
Alex Harpin <development@landsofshadow.co.uk>
@@ -100,27 +106,28 @@ Julian Wolf <juwolf@suse.com>
Koen Kooi <koen@dominion.thruhere.net>
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Kyle McMartin <kmcmarti@redhat.com>
Lubomir Rintel <lkundrak@v3.sk>
Lukas Wunner <lukas@wunner.de>
Mike Snitzer <snitzer@redhat.com>
Minfei Huang <mhuang@redhat.com>
Nikoli <nikoli@gmx.us>
Pingfan Liu <piliu@redhat.com>
Przemysław Rudy <prudy1@o2.pl>
Robert LeBlanc <robert@leblancnet.us>
Robert Scheck <robert@fedoraproject.org>
Stefan Berger <stefanb@us.ibm.com>
Thomas Lange <lange@informatik.uni-koeln.de>
Till Maas <opensource@till.name>
Tony Asleson <tasleson@redhat.com>
Vivek Goyal <vgoyal@redhat.com>
Vladislav Bogdanov <bubble@hoster-ok.com>
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
tpgxyz <tpgxyz@gmail.com>
Alexander Kurtz <alexander@kurtz.be>
Alexander Todorov <atodorov@redhat.com>
Andreas Stieger <astieger@suse.com>
Andy Lutomirski <luto@mit.edu>
Anssi Hannula <anssi@mageia.org>
Artem Savkov <asavkov@redhat.com>
B. Wilson <x@wilsonb.com>
Brandon Philips <brandon@ifup.co>
Bryn M. Reeves <bmr@redhat.com>
Canek Peláez Valdés <caneko@gmail.com>
@@ -136,18 +143,23 @@ Dennis Schridde <devurandom@gmx.net>
Derek Higgins <derekh@redhat.com>
Duane Griffin <duaneg@dghda.com>
Elan Ruusamäe <glen@delfi.ee>
Enno Boland <g@s01.de>
Eugene Syromiatnikov <esyr@redhat.com>
Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
Florian Gamböck <mail@floga.de>
François Cami <fcami@fedoraproject.org>
Gerd von Egidy <gerd.von.egidy@intra2net.com>
Glen Gray <slaine@slaine.org>
HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Hendrik Brueckner <brueckner@linux.ibm.com>
Hermann Gausterer <git-dracut-2012@mrq1.org>
Hiroaki Mizuguchi <hiroaki-m@iij.ad.jp>
Hui Wang <john.wanghui@huawei.com>
Ignaz Forster <iforster@suse.com>
James Laska <jlaska@redhat.com>
Jan Stodola <jstodola@redhat.com>
Jason Dana <jasondana@quarksecurity.com>
Javier Martinez Canillas <javierm@redhat.com>
Jeremy Linton <lintonrjeremy@gmail.com>
Jiri Pirko <jiri@resnulli.us>
Joe Lawrence <Joe.Lawrence@stratus.com>
Johannes Thumshirn <jthumshirn@suse.com>
@@ -165,23 +177,25 @@ Matt Smith <shadowfax@gmx.com>
Matthew Thode <mthode@mthode.org>
Mei Liu <liumbj@linux.vnet.ibm.com>
Michael Chapman <mike@very.puzzling.org>
Michael McCracken <michael.mccracken@gmail.com>
Michal Koutný <mkoutny@suse.com>
Michal Schmidt <mschmidt@redhat.com>
Michal Sekletar <msekleta@redhat.com>
Mike Gorse <mgorse@suse.com>
Moritz 'Morty' Strübe <morty@gmx.net>
Munehiro Matsuda <haro@kgt.co.jp>
Nicolas Porcel <nicolasporcel06@gmail.com>
Olivier Blin <dev@blino.org>
P J P <ppandit@redhat.com>
Paolo Bonzini <pbonzini@redhat.com>
Pavel Zhukov <pzhukov@redhat.com>
Pawel Wieczorkiewicz <pwieczorkiewicz@suse.de>
Pekka Wallendahl <wyrmiyu@gmail.com>
Pingfan Liu <piliu@redhat.com>
Prarit Bhargava <prarit@redhat.com>
Praveen_Paladugu@Dell.com <Praveen_Paladugu@Dell.com>
Pádraig Brady <P@draigBrady.com>
Quentin Armitage <quentin@armitage.org.uk>
Renaud Métrich <rmetrich@redhat.com>
Robert Buchholz <rbu@goodpoint.de>
Ruben Kerkhof <ruben@rubenkerkhof.com>
Rusty Bird <rustybird@openmailbox.org>
@@ -189,9 +203,11 @@ Sergey Fionov <fionov@gmail.com>
Shawn W Dunn <sfalken@opensuse.org>
Srinivasa T N <seenutn@linux.vnet.ibm.com>
Stijn Hoop <stijn@sandcat.nl>
Sullivan (CTR), Austin <austin.sullivan.ctr@progeny.net>
Thilo Bangert <thilo.bangert@gmx.net>
Thomas Blume <thomas.blume@suse.com>
Tobias Geerinckx <tobias.geerinckx@gmail.com>
Tobias Klauser <tklauser@distanz.ch>
Tom Gundersen <teg@jklm.no>
Tomasz Paweł Gajc <tpgxyz@gmail.com>
Tomasz Torcz <tomek@pipebreaker.pl>

View File

@@ -1,7 +1,7 @@
-include dracut-version.sh
VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags 2>/dev/null || echo $(DRACUT_VERSION))
GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags --always 2>/dev/null || echo $(DRACUT_VERSION))
GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags --always 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
-include Makefile.inc
@@ -63,6 +63,9 @@ install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h ins
install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(KMOD_LIBS)
logtee: logtee.c
$(CC) $(LDFLAGS) -o $@ $<
dracut-install: install/dracut-install
ln -fs $< $@

134
NEWS
View File

@@ -1,3 +1,137 @@
dracut-049
==========
lsinitrd:
- record loaded kernel modules when hostonly mode is enabled
lsinitrd $image -f */lib/dracut/loaded-kernel-modules.txt
- allow to only unpack certain files
kernel-modules:
- add gpio and pinctrl drivers for arm*/aarch64
- add nfit
kernel-network-modules:
- add vlan kernel modules
ifcfg/write-ifcfg.sh:
- aggregate resolv.conf
livenet:
- Enable OverlayFS overlay in sysroot.mount generator.
dmsquash-live:
- Support a flattened squashfs.img
dracut-systemd:
- Start systemd-vconsole-setup before dracut-cmdline-ask
iscsi:
- do not install all of /etc/iscsi unless hostonly
- start iscsid even w/o systemd
multipath:
- fixed shutdown
network:
- configure NetworkManager to use dhclient
mdraid:
- fixed uuid handling ":" versus "-"
stratis:
- Add additional binaries
new modules:
- 00warpclock
- 99squash
Adds support for building a squashed initramfs
- 35network-legacy
the old 40network
- 35network-manager
alternative to 35network-legacy
- 90kernel-modules-extra
adds out-of-tree kernel modules
testsuite:
- now runs on travis
- support new qemu device options
- even runs without kvm now
dracut-048
==========
dracut.sh:
- fixed finding of btrfs devices
- harden dracut against BASH_ENV environment variable
- no more prelinking
- scan and install "external" kernel modules
- fixed instmods with zero input
- rdsosreport: best effort to strip out passwords
- introduce tri-state hostonly mode
Add a new option --hostonly-mode which accept an <mode> parameter, so we have a tri-state hostonly mode:
* generic: by passing "--no-hostonly" or not passing anything.
"--hostonly-mode" has no effect in such case.
* sloppy: by passing "--hostonly --hostonly-mode sloppy". This
is also the default mode when only "--hostonly" is given.
* strict: by passing "--hostonly --hostonly-mode strict".
Sloppy mode is the original hostonly mode, the new introduced strict
mode will allow modules to ignore more drivers or do some extra job to
save memory and disk space, while making the image less portable.
Also introduced a helper function "optional_hostonly" to make it
easier for modules to leverage new hostonly mode.
To force install modules only in sloppy hostonly mode, use the form:
hostonly="$(optional_hostonly)" instmods <modules>
dracut-install:
- don't error out, if no modules were installed
- support modules.softdep
lsinitrd.sh:
- fixed zstd file signature
kernel:
- include all pci/host modules
- add mmc/core for arm
- Include Intel Volume Management Device support
plymouth:
- fix detection of plymouth directory
drm:
- make failing installation of drm modules nonfatal
- include virtio DRM drivers in hostonly initramfs
stratis:
- initial Stratis support
crypt:
- correct s390 arch to include arch-specific crypto modules
- add cmdline rd.luks.partuuid
- add timeout option rd.luks.timeout
shutdown:
- sleep a little, if a process was killed
network:
- introduce ip=either6 option
iscsi:
- replace iscsistart with iscsid
qeth_rules:
- new module to copy qeth rules
multipath-hostonly:
- merged back into multipath
mdraid:
- fixed case if rd.md.uuid is in ID_FS_UUID format
dracut-047
==========
dracut.sh:

View File

@@ -2,6 +2,10 @@
dracut is an initramfs infrastructure.
## Travis
[![Build Status](https://travis-ci.org/dracutdevs/dracut.svg?branch=master)](https://travis-ci.org/dracutdevs/dracut)
## CentOS CI
[![Build Status](https://ci.centos.org/job/dracut-push-master/badge/icon)](https://ci.centos.org/job/dracut-push-master/)

View File

@@ -31,9 +31,7 @@ _dracut() {
--local --hostonly --no-hostonly --fstab --help --bzip2 --lzma
--xz --zstd --no-compress --gzip --list-modules --show-modules --keep
--printsize --regenerate-all --noimageifnotneeded --early-microcode
--no-early-microcode --print-cmdline --prelink --noprelink --reproducible
--uefi
'
--no-early-microcode --print-cmdline --reproducible --uefi'
[ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers
--omit-drivers --modules --omit --drivers --filesystems --install

View File

@@ -676,6 +676,17 @@ get_ucode_file ()
fi
}
# Get currently loaded modules
# sorted, and delimited by newline
get_loaded_kernel_modules ()
{
local modules=( )
while read _module _size _used _used_by; do
modules+=( "$_module" )
done <<< "$(lsmod | sed -n '1!p')"
printf '%s\n' "${modules[@]}" | sort
}
# Not every device in /dev/mapper should be examined.
# If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
lvm_internal_dev() {

View File

@@ -267,6 +267,18 @@ inst_fsck_help() {
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper || :
}
# Use with form hostonly="$(optional_hostonly)" inst_xxxx <args>
# If hosotnly mode is set to "strict", hostonly restrictions will still
# be applied, else will ignore hostonly mode and try to install all
# given modules.
optional_hostonly() {
if [[ $hostonly_mode = "strict" ]]; then
printf -- "$hostonly"
else
printf ""
fi
}
mark_hostonly() {
for i in "$@"; do
echo "$i" >> "$initdir/lib/dracut/hostonly-files"
@@ -942,7 +954,7 @@ for_each_kmod_dep() {
dracut_kernel_post() {
for _f in modules.builtin.bin modules.builtin modules.order; do
[[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
[[ -e $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
done
# generate module dependencies for the initrd
@@ -981,6 +993,10 @@ instmods() {
set -- "${args[@]}"
fi
if (($# == 0)); then
return 0
fi
$DRACUT_INSTALL \
${initdir:+-D "$initdir"} \
${loginstall:+-L "$loginstall"} \

View File

@@ -243,12 +243,6 @@ example:
**--nostrip**::
do not strip binaries in the initramfs
**--prelink**::
prelink binaries in the initramfs (default)
**--noprelink**::
do not prelink binaries in the initramfs
**--hardlink**::
hardlink files in the initramfs (default)

View File

@@ -311,6 +311,11 @@ crypto LUKS
**rd.luks.crypttab=0**::
do not check, if LUKS partition is in _/etc/crypttab_
**rd.luks.timeout=**__<seconds>__::
specify how long dracut should wait when waiting for the user to enter the
password. This avoid blocking the boot if no password is entered. It does
not apply to luks key. The default is '0', which means 'forever'.
crypto LUKS - key on removable device support
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**rd.luks.key=**__<keypath>__:__<keydev>__:__<luksdev>__::
@@ -480,7 +485,7 @@ USB Android phone::
* enp0s29u1u2
=====================
**ip=**__{dhcp|on|any|dhcp6|auto6}__::
**ip=**__{dhcp|on|any|dhcp6|auto6|either6}__::
dhcp|on|any::: get ip from dhcp server from all interfaces. If root=dhcp,
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
with a valid DHCP root-path.
@@ -489,6 +494,8 @@ USB Android phone::
dhcp6::: IPv6 DHCP
either6::: if auto6 fails, then dhcp6
**ip=**__<interface>__:__{dhcp|on|any|dhcp6|auto6}__[:[__<mtu>__][:__<macaddr>__]]::
This parameter can be specified multiple times.
+
@@ -594,7 +601,7 @@ NFS
mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given, use
dhcp next_server. If server-ip is an IPv6 address it has to be put in
brackets, e.g. [2001:DB8::1]. NFS options can be appended with the prefix
":" or "," and are seperated by ",".
":" or "," and are separated by ",".
**root=**nfs:\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__], **root=**nfs4:\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__], **root=**__{dhcp|dhcp6}__::
root=dhcp alone directs initrd to look at the DHCP root-path where NFS
@@ -727,6 +734,9 @@ You may want to use rd.iscsi.firmware.
**root=**_???_ **netroot=**iscsi **rd.iscsi.firmware=1**::
will read the iscsi parameter from the BIOS firmware
**rd.iscsi.login_retry_max=**__<num>__::
maximum number of login retries
**rd.iscsi.param=**__<param>__::
<param> will be passed as "--param <param>" to iscsistart.
This parameter can be specified multiple times.
@@ -828,23 +838,24 @@ Booting live images
Dracut offers multiple options for live booted images:
=====================
SquashFS with read-only filesystem image::: The system will boot with a read
only filesystem from the SquashFS and apply a writable device-mapper snapshot
over the read only filesystem. Using this method ensures a relatively fast
boot and lower RAM usage. Users **must be careful** to avoid writing too many
blocks to the snapshot volume. Once the blocks of the snapshot overlay are
exhausted, the root filesystem becomes read only and may cause application
failures. The overlay file is marked 'Overflow', and a difficult recovery is
required to repair and enlarge the overlay offline. Non-persistent overlays
are sparse files in RAM that only consume content space as required blocks are
allocated. They default to an apparent size of 32 GiB in RAM. The size can be
adjusted with the **rd.live.overlay.size=** kernel command line option.
SquashFS with read-only filesystem image::: The system will boot with a
read-only filesystem from the SquashFS and apply a writable Device-mapper
snapshot or an OverlayFS overlay mount for the read-only base filesystem. This
method ensures a relatively fast boot and lower RAM usage. Users **must be
careful** to avoid writing too many blocks to a snapshot volume. Once the
blocks of the snapshot overlay are exhausted, the root filesystem becomes
read-only and may cause application failures. The snapshot overlay file is
marked 'Overflow', and a difficult recovery is required to repair and enlarge
the overlay offline. Non-persistent overlays are sparse files in RAM that only
consume content space as required blocks are allocated. They default to an
apparent size of 32 GiB in RAM. The size can be adjusted with the
**rd.live.overlay.size=** kernel command line option.
+
The filesystem structure is expected to be:
The filesystem structure is traditionally expected to be:
+
[listing]
--
squashfs.img | Squashfs from LiveCD .iso downloaded via network
squashfs.img | SquashFS from LiveCD .iso
!(mount)
/LiveOS
|- rootfs.img | Filesystem image to mount read-only
@@ -855,21 +866,35 @@ squashfs.img | Squashfs from LiveCD .iso downloaded via network
... |
--
+
Dracut uses this method of live booting by default. No additional command line
options are required other than **root=live:<URL>** to specify the location
of your squashed filesystem.
For OverlayFS mount overlays, the filesystem structure may also be a direct
compression of the root filesystem:
+
[listing]
--
squashfs.img | SquashFS from LiveCD .iso
!(mount)
/bin | Live filesystem
/boot |
/dev |
... |
--
+
Dracut uses one of the overlay methods of live booting by default. No
additional command line options are required other than **root=live:<URL>** to
specify the location of your squashed filesystem.
+
- The compressed SquashFS image can be copied during boot to RAM at
`/run/initramfs/squashed.img` by using the **rd.live.ram=1** option.
- A device with a persistent overlay can be booted read only by using the
- A device with a persistent overlay can be booted read-only by using the
**rd.live.overlay.readonly** option on the kernel command line. This will
cause a temporary, writable overlay to be stacked over a read-only snapshot
of the root filesystem.
either cause a temporary, writable overlay to be stacked over a read-only
snapshot of the root filesystem or the OverlayFS mount will use an additional
lower layer with the root filesystem.
+
Uncompressed live filesystem image:::
When the live system was installed with the '--skipcompress' option of the
__livecd-iso-to-disk__ installation script for Live USB devices, the root
filesystem image, `rootfs.img`, is expanded on installation and no SquashFS
filesystem image, __rootfs.img__, is expanded on installation and no SquashFS
is involved during boot.
+
- If **rd.live.ram=1** is used in this situation, the full, uncompressed
@@ -877,12 +902,12 @@ root filesystem is copied during boot to `/run/initramfs/rootfs.img` in the
`/run` tmpfs.
+
- If **rd.live.overlay=none** is provided as a kernel command line option,
a writable, linear device-mapper target is created on boot with no overlay.
a writable, linear Device-mapper target is created on boot with no overlay.
writable filesystem image:::
Writable filesystem image:::
The system will retrieve a compressed filesystem image, extract it to
`/run/initramfs/fsimg/rootfs.img`, connect it to a loop device, create a
writable, linear device-mapper target at `/dev/mapper/live-rw`, and mount that
writable, linear Device-mapper target at `/dev/mapper/live-rw`, and mount that
as a writable volume at `/`. More RAM is required during boot but the live
filesystem is easier to manage if it becomes full. Users can make a filesystem
image of any size and that size will be maintained when the system boots. There
@@ -892,7 +917,7 @@ The filesystem structure is expected to be:
+
[listing]
--
rootfs.tgz | Compressed tarball containing fileystem image
rootfs.tgz | Compressed tarball containing filesystem image
!(unpack)
/rootfs.img | Filesystem image at /run/initramfs/fsimg/
!(mount)
@@ -920,10 +945,11 @@ NOTE: There must be enough free RAM available to hold the complete image.
This method is very suitable for diskless boots.
**root=**live:__<url>__::
Boots a live image retrieved from __<url>__. Valid handlers: __http, https, ftp, torrent, tftp__.
Boots a live image retrieved from __<url>__. Requires the dracut 'livenet'
module. Valid handlers: __http, https, ftp, torrent, tftp__.
+
[listing]
.Example
.Examples
--
root=live:http://example.com/liveboot.img
root=live:ftp://ftp.example.com/liveboot.img
@@ -935,7 +961,7 @@ Enables debug output from the live boot process.
**rd.live.dir=**__<path>__::
Specifies the directory within the boot device where the squashfs.img or
rootfs.img can be found. By default, this is __LiveOS__.
rootfs.img can be found. By default, this is `/LiveOS`.
**rd.live.squashimg=**__<filename of SquashFS image>__::
Specifies the filename for a SquashFS image of the root filesystem.
@@ -943,35 +969,52 @@ By default, this is __squashfs.img__.
**rd.live.ram=**1::
Copy the complete image to RAM and use this for booting. This is useful
when the image resides on, i.e., a DVD which needs to be ejected later on.
when the image resides on, e.g., a DVD which needs to be ejected later on.
**rd.live.overlay=**__<devspec>__:__(<pathspec>|auto)__|__none__::
Allow the usage of a permanent overlay.
- _<devspec>_ specifies the path to a device with a mountable filesystem.
- _<pathspec>_ is the path to a file within that filesystem, which shall be
**rd.live.overlay={**__<devspec>__[:__{<pathspec>|auto}__]|__none__}::
Manage the usage of a permanent overlay.
+
--
* _<devspec>_ specifies the path to a device with a mountable filesystem.
* _<pathspec>_ is the path to a file within that filesystem, which shall be
used to persist the changes made to the device specified by the
**root=live:__<url>__** option.
- _none_ specifies no overlay when an uncompressed live root filesystem is
available.
If a persistent overlay is detected at the standard LiveOS path, the overlay &
overlay type detected (whether Device-mapper or OverlayFS) will be used.
+
The default _pathspec_, when _auto_ or no _:<pathspec>_ is given, is
`/<+++<b>rd.live.dir</b>+++>/overlay-<label>-<uuid>`, where _<label>_ is the
device LABEL, and _<uuid>_ is the device UUID.
* _none_ (the word itself) specifies that no overlay will be used, such as when
an uncompressed, writable live root filesystem is available.
+
If a persistent overlay __is detected__ at the standard LiveOS path, the
overlay & overlay type detected, whether Device-mapper or OverlayFS, will be
used.
--
+
[listing]
.Example
.Examples
--
rd.live.overlay=/dev/sdb1:persistent-overlay.img
rd.live.overlay=UUID=99440c1f-8daa-41bf-b965-b7240a8996f4
--
**rd.live.overlay.size=**__<size_MiB>__::
Specifies a non-persistent overlay size in MiB. The default is _32768_.
Specifies a non-persistent Device-mapper overlay size in MiB. The default is
_32768_.
**rd.live.overlay.readonly=**1::
Specifies a non-persistent, writable snapshot overlay to be stacked over a
read-only snapshot of the root filesystem, `/dev/mapper/live-ro`, or a read-
only loop device of a writable `rootfs.img`.
This is used to boot with a normally read-write persistent overlay in a
read-only mode. With this option, either an additional, non-persistent,
writable snapshot overlay will be stacked over a read-only snapshot,
`/dev/mapper/livero`, of the base filesystem with the persistent overlay, or a
read-only loop device, in the case of a writable __rootfs.img__, or an OverlayFS
mount will use the persistent overlay directory linked at `/run/overlayfsr` as
an additional lower layer along with the base root filesystem and apply a
transient, writable upper directory overlay, in order to complete the booted
root filesystem.
**rd.live.overlay.reset=**1::
Specifies that a persistent overlay should be reset on boot. All root
Specifies that a persistent overlay should be reset on boot. All previous root
filesystem changes are vacated by this action.
**rd.live.overlay.thin=**1::
@@ -982,25 +1025,25 @@ that memory is given back to the kernel when the filesystem does not claim it
anymore.
**rd.live.overlay.overlayfs=**1::
Enables the use of the **OverlayFS** kernel module, if available, to provide a
Enables the use of the *OverlayFS* kernel module, if available, to provide a
copy-on-write union directory for the root filesystem. OverlayFS overlays are
directories of the files that have changed on the read-only base (lower)
filesystem. The root filesystem is provided through a special overlay type
mount that merges the lower and upper directories. If an OverlayFS upper
directory is not present on the boot device, a tmpfs directory will be created
at /run/overlayfs to provide temporary storage. Persistent storage can be
at `/run/overlayfs` to provide temporary storage. Persistent storage can be
provided on vfat or msdos formatted devices by supplying the OverlayFS upper
directory within an embedded filesystem that supports the creation of trusted.*
extended attributes and provides a valid d_type in readdir responses, such as
with ext4 and xfs. On non-vfat-formatted devices, a persistent OverlayFS
overlay can extend the available root filesystem storage up to the capacity of
the LiveOS device.
the LiveOS disk device.
+
If a persistent overlay is detected at the standard LiveOS path, the overlay &
overlay type detected (whether OverlayFS or Device-mapper) will be used.
overlay type detected, whether OverlayFS or Device-mapper, will be used.
+
The **rd.live.overlay.readonly** option, which allows a persistent overlayfs to
be mounted read only through a higher level transient overlay directory, has
be mounted read-only through a higher level transient overlay directory, has
been implemented through the multiple lower layers feature of OverlayFS.

View File

@@ -89,9 +89,6 @@ Configuration files must have the extension .conf; other extensions are ignored.
*do_strip=*"__{yes|no}__"::
Strip binaries in the initramfs (default=yes)
*do_prelink=*"__{yes|no}__"::
Prelink binaries in the initramfs (default=yes)
*hostonly=*"__{yes|no}__"::
Host-Only mode: Install only what is needed for booting the local host
instead of a generic host and generate host-specific configuration.

View File

@@ -212,7 +212,7 @@ check() should return with:
0:: Include the dracut module in the initramfs.
1:: Do not include the dracut module. The requirements are not fullfilled
1:: Do not include the dracut module. The requirements are not fulfilled
(missing tools, etc.)
255:: Only include the dracut module, if another module requires it or if
@@ -255,7 +255,9 @@ not lead to an error.
==== inst <src> [<dst>]
installs _one_ file <src> either to the same place in the initramfs or to an
optional <dst>.
optional <dst>. inst with more than two arguments is treated the same as
inst_multiple, all arguments are treated as files to install and none as
install destinations.
==== inst_hook <hookdir> <prio> <src>

217
dracut.sh
View File

@@ -1,4 +1,4 @@
#!/bin/bash --norc
#!/bin/bash -p
#
# Generator script for a dracut initramfs
# Tries to retain some degree of compatibility with the command line
@@ -23,6 +23,8 @@
# store for logging
unset BASH_ENV
# Verify bash version, current minimum is 4
if (( BASH_VERSINFO[0] < 4 )); then
printf -- 'You need at least Bash 4 to use dracut, sorry.' >&2
@@ -108,8 +110,6 @@ Creates initial ramdisk images for preloading modules
--kernel-cmdline [PARAMETERS] Specify default kernel command line parameters
--strip Strip binaries in the initramfs
--nostrip Do not strip binaries in the initramfs
--prelink Prelink binaries in the initramfs
--noprelink Do not prelink binaries in the initramfs
--hardlink Hardlink files in the initramfs
--nohardlink Do not hardlink files in the initramfs
--prefix [DIR] Prefix initramfs files with [DIR]
@@ -147,6 +147,21 @@ Creates initial ramdisk images for preloading modules
-H, --hostonly Host-Only mode: Install only what is needed for
booting the local host instead of a generic host.
-N, --no-hostonly Disables Host-Only mode
--hostonly-mode <mode>
Specify the hostonly mode to use. <mode> could be
one of "sloppy" or "strict". "sloppy" mode is used
by default.
In "sloppy" hostonly mode, extra drivers and modules
will be installed, so minor hardware change won't make
the image unbootable (eg. changed keyboard), and the
image is still portable among similar hosts.
With "strict" mode enabled, anything not necessary
for booting the local host in its current state will
not be included, and modules may do some extra job
to save more space. Minor change of hardware or
environment could make the image unbootable.
DO NOT use "strict" mode unless you know what you
are doing.
--hostonly-cmdline Store kernel command line arguments needed
in the initramfs
--no-hostonly-cmdline Do not store kernel command line arguments needed
@@ -334,8 +349,6 @@ rearrange_params()
--long kernel-cmdline: \
--long strip \
--long nostrip \
--long prelink \
--long noprelink \
--long hardlink \
--long nohardlink \
--long noprefix \
@@ -354,6 +367,7 @@ rearrange_params()
--long host-only \
--long no-hostonly \
--long no-host-only \
--long hostonly-mode: \
--long hostonly-cmdline \
--long no-hostonly-cmdline \
--long no-hostonly-default-device \
@@ -460,9 +474,6 @@ if [[ $append_args_l == "yes" ]]; then
eval set -- "$TEMP"
rearrange_params "$@"
fi
# clean the temporarily used scratch-pad directory
rm -rf $scratch_dir
fi
unset PARMS_TO_STORE
@@ -520,8 +531,6 @@ while :; do
early_microcode_l="no";;
--strip) do_strip_l="yes";;
--nostrip) do_strip_l="no";;
--prelink) do_prelink_l="yes";;
--noprelink) do_prelink_l="no";;
--hardlink) do_hardlink_l="yes";;
--nohardlink) do_hardlink_l="no";;
--noprefix) prefix_l="/";;
@@ -544,6 +553,8 @@ while :; do
hostonly_l="yes" ;;
-N|--no-hostonly|--no-host-only)
hostonly_l="no" ;;
--hostonly-mode)
hostonly_mode_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--hostonly-cmdline)
hostonly_cmdline_l="yes" ;;
--hostonly-i18n)
@@ -724,14 +735,13 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
[[ $do_strip_l ]] && do_strip=$do_strip_l
[[ $do_strip ]] || do_strip=yes
[[ $do_prelink_l ]] && do_prelink=$do_prelink_l
[[ $do_prelink ]] || do_prelink=yes
[[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l
[[ $do_hardlink ]] || do_hardlink=yes
[[ $prefix_l ]] && prefix=$prefix_l
[[ $prefix = "/" ]] && unset prefix
[[ $hostonly_l ]] && hostonly=$hostonly_l
[[ $hostonly_cmdline_l ]] && hostonly_cmdline=$hostonly_cmdline_l
[[ $hostonly_mode_l ]] && hostonly_mode=$hostonly_mode_l
[[ "$hostonly" == "yes" ]] && ! [[ $hostonly_cmdline ]] && hostonly_cmdline="yes"
[[ $i18n_install_all_l ]] && i18n_install_all=$i18n_install_all_l
[[ $persistent_policy_l ]] && persistent_policy=$persistent_policy_l
@@ -856,6 +866,19 @@ esac
[[ $hostonly = yes ]] && hostonly="-h"
[[ $hostonly != "-h" ]] && unset hostonly
case $hostonly_mode in
'')
[[ $hostonly ]] && hostonly_mode="sloppy" ;;
sloppy|strict)
if [[ ! $hostonly ]]; then
unset hostonly_mode
fi
;;
*)
printf "%s\n" "dracut: Invalid hostonly mode '$hostonly_mode'." >&2
exit 1
esac
[[ $reproducible == yes ]] && DRACUT_REPRODUCIBLE=1
readonly TMPDIR="$(realpath -e "$tmpdir")"
@@ -1236,7 +1259,7 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
push_host_devs "$_dev"
if [[ "$_t" == btrfs ]]; then
for i in $(find_btrfs_devs "$_m"); do
for i in $(btrfs_devs "$_m"); do
push_host_devs "$i"
done
fi
@@ -1288,16 +1311,16 @@ done
[[ -d $udevdir ]] \
|| udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
if ! [[ -d "$udevdir" ]]; then
[[ ! -h /lib ]] && [[ -d /lib/udev ]] && udevdir=/lib/udev
[[ -d /usr/lib/udev ]] && udevdir=/usr/lib/udev
[[ -e /lib/udev/collect ]] && udevdir=/lib/udev
[[ -e /usr/lib/udev/collect ]] && udevdir=/usr/lib/udev
fi
[[ -d $systemdutildir ]] \
|| systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
if ! [[ -d "$systemdutildir" ]]; then
[[ ! -h /lib ]] && [[ -d /lib/systemd ]] && systemdutildir=/lib/systemd
[[ -d /usr/lib/systemd ]] && systemdutildir=/usr/lib/systemd
[[ -e /lib/systemd/systemd-udevd ]] && systemdutildir=/lib/systemd
[[ -e /usr/lib/systemd/systemd-udevd ]] && systemdutildir=/usr/lib/systemd
fi
[[ -d $systemdsystemunitdir ]] \
@@ -1466,6 +1489,9 @@ dinfo "*** Including modules done ***"
## final stuff that has to happen
if [[ $no_kernel != yes ]]; then
if [[ $hostonly ]]; then
echo "$(get_loaded_kernel_modules)" > $initdir/lib/dracut/loaded-kernel-modules.txt
fi
if [[ $drivers ]]; then
hostonly='' instmods $drivers
@@ -1608,21 +1634,6 @@ if [[ $kernel_only != yes ]]; then
fi
fi
PRELINK_BIN="$(command -v prelink)"
if [[ $EUID = 0 ]] && [[ $PRELINK_BIN ]]; then
if [[ $DRACUT_FIPS_MODE ]]; then
dinfo "*** Installing prelink files ***"
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
elif [[ $do_prelink == yes ]]; then
dinfo "*** Pre-linking files ***"
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
chroot "$initdir" "$PRELINK_BIN" -a
rm -f -- "$initdir/$PRELINK_BIN"
rm -fr -- "$initdir"/etc/prelink.*
dinfo "*** Pre-linking files done ***"
fi
fi
if [[ $do_hardlink = yes ]] && command -v hardlink >/dev/null; then
dinfo "*** Hardlinking files ***"
hardlink "$initdir" 2>&1
@@ -1643,6 +1654,11 @@ if [[ $do_strip = yes ]] ; then
done
fi
# cleanup empty ldconfig_paths directories
for d in $(ldconfig_paths); do
rmdir -p --ignore-fail-on-non-empty "$initdir/$d" >/dev/null 2>&1
done
if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
dinfo "*** Stripping files ***"
find "$initdir" -type f \
@@ -1731,6 +1747,120 @@ fi
dinfo "*** Creating image file '$outfile' ***"
if dracut_module_included "squash"; then
if ! check_kernel_config CONFIG_SQUASHFS; then
dfatal "CONFIG_SQUASHFS have to be enabled for dracut squash module to work"
exit 1
fi
if ! check_kernel_config CONFIG_OVERLAY_FS; then
dfatal "CONFIG_OVERLAY_FS have to be enabled for dracut squash module to work"
exit 1
fi
if ! check_kernel_config CONFIG_DEVTMPFS; then
dfatal "CONFIG_DEVTMPFS have to be enabled for dracut squash module to work"
exit 1
fi
readonly squash_dir="${DRACUT_TMPDIR}/squashfs"
readonly squash_img=$initdir/squash/root.img
# Currently only move "usr" "etc" to squashdir
readonly squash_candidate=( "usr" "etc" )
mkdir -m 0755 -p $squash_dir
for folder in "${squash_candidate[@]}"; do
mv $initdir/$folder $squash_dir/$folder
done
# Reinstall required files, because we have moved some important folders to $squash_dir
inst_multiple "echo" "sh" "mount" "modprobe" "mkdir" \
"systemctl" "udevadm" "$systemdutildir/systemd"
hostonly="" instmods "loop" "squashfs" "overlay"
for folder in "${squash_candidate[@]}"; do
# Remove duplicated files in squashfs image, save some more space
[[ ! -d $initdir/$folder/ ]] && continue
for file in $(find $initdir/$folder/ -not -type d);
do
if [[ -e $squash_dir${file#$initdir} ]]; then
mv $squash_dir${file#$initdir} $file
fi
done
done
# Move some files out side of the squash image, including:
# - Files required to boot and mount the squashfs image
# - Files need to be accessable without mounting the squash image
required_in_root() {
local file=$1
local _sqsh_file=$squash_dir/$file
local _init_file=$initdir/$file
if [[ -e $_init_file ]]; then
return
fi
if [[ ! -e $_sqsh_file ]] && [[ ! -L $_sqsh_file ]]; then
derror "$file is required to boot a squashed initramfs but it's not installed!"
return
fi
if [[ ! -d $(dirname $_init_file) ]]; then
required_in_root $(dirname $file)
fi
if [[ -d $_sqsh_file ]]; then
if [[ -L $_sqsh_file ]]; then
cp --preserve=all -P $_sqsh_file $_init_file
else
mkdir $_init_file
fi
else
if [[ -L $_sqsh_file ]]; then
cp --preserve=all -P $_sqsh_file $_init_file
_sqsh_file=$(realpath $_sqsh_file 2>/dev/null)
if [[ -e $_sqsh_file ]] && [[ "$_sqsh_file" == "$squash_dir"* ]]; then
# Relative symlink
required_in_root ${_sqsh_file#$squash_dir/}
return
fi
if [[ -e $squash_dir$_sqsh_file ]]; then
# Absolute symlink
required_in_root ${_sqsh_file#/}
return
fi
required_in_root ${module_spec#$squash_dir/}
else
mv $_sqsh_file $_init_file
fi
fi
}
required_in_root etc/initrd-release
for module_spec in $squash_dir/usr/lib/modules/*/modules.*;
do
required_in_root ${module_spec#$squash_dir/}
done
for dracut_spec in $squash_dir/usr/lib/dracut/*;
do
required_in_root ${dracut_spec#$squash_dir/}
done
mv $initdir/init $initdir/init.stock
mv $initdir/shutdown $initdir/shutdown.stock
ln -s squash/init.sh $initdir/init
ln -s squash/shutdown.sh $initdir/shutdown
mksquashfs $squash_dir $squash_img -comp xz -b 64K -Xdict-size 100% &> /dev/null
if [[ $? != 0 ]]; then
dfatal "dracut: Failed making squash image"
exit 1
fi
fi
if [[ $uefi = yes ]]; then
readonly uefi_outdir="$DRACUT_TMPDIR/uefi"
mkdir "$uefi_outdir"
@@ -1832,15 +1962,22 @@ fi
command -v restorecon &>/dev/null && restorecon -- "$outfile"
if ! sync "$outfile" 2> /dev/null; then
dinfo "dracut: sync operation on newly created initramfs $outfile failed"
exit 1
fi
# We sync/fsfreeze only if we're operating on a live booted system.
# It's possible for e.g. `kernel` to be installed as an RPM BuildRequires or equivalent,
# and there's no reason to sync, and *definitely* no reason to fsfreeze.
# Another case where this happens is rpm-ostree, which performs its own sync/fsfreeze
# globally. See e.g. https://github.com/ostreedev/ostree/commit/8642ef5ab3fec3ac8eb8f193054852f83a8bc4d0
if test -d /run/systemd/system; then
if ! sync "$outfile" 2> /dev/null; then
dinfo "dracut: sync operation on newly created initramfs $outfile failed"
exit 1
fi
# use fsfreeze only if we're not writing to /
if [[ "$(stat -c %m -- "$outfile")" != "/" && "$(stat -f -c %T -- "$outfile")" != "msdos" ]]; then
if ! $(fsfreeze -f $(dirname "$outfile") 2>/dev/null && fsfreeze -u $(dirname "$outfile") 2>/dev/null); then
dinfo "dracut: warning: could not fsfreeze $(dirname "$outfile")"
# use fsfreeze only if we're not writing to /
if [[ "$(stat -c %m -- "$outfile")" != "/" && "$(stat -f -c %T -- "$outfile")" != "msdos" ]]; then
if ! $(fsfreeze -f $(dirname "$outfile") 2>/dev/null && fsfreeze -u $(dirname "$outfile") 2>/dev/null); then
dinfo "dracut: warning: could not fsfreeze $(dirname "$outfile")"
fi
fi
fi

View File

@@ -5,15 +5,6 @@
# strip the automatically generated dep here and instead co-own the
# directory.
%global __requires_exclude pkg-config
# Variables must be defined
%define with_nbd 1
# nbd in Fedora only
%if 0%{?rhel} >= 6
%define with_nbd 0
%endif
%define dist_free_release xxx
Name: dracut
@@ -45,53 +36,34 @@ BuildRequires: kmod-devel >= 23
BuildRequires: gcc
%if 0%{?fedora} || 0%{?rhel}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: pkgconfig
BuildRequires: systemd
%endif
%if 0%{?fedora}
BuildRequires: bash-completion
%endif
%if 0%{?suse_version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%endif
%if %{with doc}
%if 0%{?fedora} || 0%{?rhel}
BuildRequires: docbook-style-xsl docbook-dtds libxslt
%endif
%if 0%{?suse_version}
-BuildRequires: docbook-xsl-stylesheets libxslt
BuildRequires: docbook-xsl-stylesheets libxslt
%endif
BuildRequires: asciidoc
%endif
%if 0%{?fedora} > 12 || 0%{?rhel}
# no "provides", because dracut does not offer
# all functionality of the obsoleted packages
Obsoletes: mkinitrd < 6.0.94
Obsoletes: mkinitrd-devel < 6.0.94
Obsoletes: nash < 6.0.94
Obsoletes: libbdevid-python < 6.0.94
%endif
%if 0%{?fedora} > 16 || 0%{?rhel} > 6
BuildRequires: systemd-units
%endif
%if 0%{?suse_version} > 9999
Obsoletes: mkinitrd < 2.6.1
Provides: mkinitrd = 2.6.1
%endif
Obsoletes: dracut-kernel < 005
Provides: dracut-kernel = %{version}-%{release}
Obsoletes: dracut < 030
Obsoletes: dracut-norescue < 030
Provides: dracut-norescue = %{version}-%{release}
Obsoletes: dracut-fips <= 047
Provides: dracut-fips = %{version}-%{release}
Obsoletes: dracut-fips-aesni <= 047
Provides: dracut-fips-aesni = %{version}-%{release}
Requires: bash >= 4
Requires: coreutils
@@ -104,39 +76,33 @@ Requires: sed
Requires: xz
Requires: gzip
%if 0%{?fedora} > 22 || 0%{?rhel} > 7
Recommends: grubby
%if 0%{?fedora} || 0%{?rhel}
Recommends: hardlink
Recommends: pigz
Recommends: kpartx
%else
Requires: hardlink
Requires: gzip
Requires: kpartx
%endif
%if 0%{?fedora} || 0%{?rhel} > 6
Requires: util-linux >= 2.21
Requires: systemd >= 219
Requires: systemd-udev >= 219
Requires: procps-ng
Conflicts: grubby < 8.23
Conflicts: initscripts < 8.63-1
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
Conflicts: bcache-tools < 0-0.14.20130909git
%else
Requires: hardlink
Requires: gzip
Requires: kpartx
Requires: udev > 166
Requires: util-linux-ng >= 2.21
%endif
Conflicts: mdadm < 3.2.6-14
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
Requires: libkcapi-hmaccalc
%endif
%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
NFS, iSCSI, NBD, FCoE with the dracut-network package.
dracut contains tools to create bootable initramfses for the Linux
kernel. Unlike previous implementations, dracut hard-codes as little
as possible into the initramfs. dracut contains various modules which
are driven by the event-based udev. Having root on MD, DM, LVM2, LUKS
is supported as well as NFS, iSCSI, NBD, FCoE with the dracut-network
package.
%package network
Summary: dracut modules to build a dracut initramfs with network support
@@ -159,32 +125,6 @@ Provides: dracut-generic = %{version}-%{release}
This package requires everything which is needed to build a generic
all purpose initramfs with network support with dracut.
%if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?suse_version}
%package fips
Summary: dracut modules to build a dracut initramfs with an integrity check
Requires: %{name} = %{version}-%{release}
Requires: hmaccalc
%if 0%{?rhel} > 5
# For Alpha 3, we want nss instead of nss-softokn
Requires: nss
%else
Requires: nss-softokn
%endif
Requires: nss-softokn-freebl
%description fips
This package requires everything which is needed to build an
initramfs with dracut, which does an integrity check.
%endif
%package fips-aesni
Summary: dracut modules to build a dracut initramfs with an integrity check with aesni-intel
Requires: %{name}-fips = %{version}-%{release}
%description fips-aesni
This package requires everything which is needed to build an
initramfs with dracut, which does an integrity check and adds the aesni-intel kernel module.
%package caps
Summary: dracut modules to build a dracut initramfs which drops capabilities
Requires: %{name} = %{version}-%{release}
@@ -238,6 +178,16 @@ Requires: %{name} = %{version}-%{release}
%description tools
This package contains tools to assemble the local initrd and host configuration.
%package squash
Summary: dracut module to build an initramfs with most files in a squashfs image
Requires: %{name} = %{version}-%{release}
Requires: squash-tools
%description squash
This package provides a dracut module to build an initramfs, but store most files
in a squashfs image, result in a smaller initramfs size and reduce runtime memory
usage.
%prep
%autosetup -n %{name}-%{version} -S git_am
cp %{SOURCE1} .
@@ -254,9 +204,6 @@ cp %{SOURCE1} .
make %{?_smp_mflags}
%install
%if 0%{?fedora} || 0%{?rhel}
rm -rf -- $RPM_BUILD_ROOT
%endif
make %{?_smp_mflags} install \
DESTDIR=$RPM_BUILD_ROOT \
libdir=%{_prefix}/lib
@@ -265,7 +212,6 @@ echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dr
%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} == 0
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
%endif
%if %{defined _unitdir}
@@ -295,9 +241,12 @@ rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd_mod
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd_rules
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dcssblk
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95qeth_rules
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95zfcp
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95zfcp_rules
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95znet
%else
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00warpclock
%endif
mkdir -p $RPM_BUILD_ROOT/boot/dracut
@@ -314,33 +263,21 @@ rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse*
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
%endif
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf
%endif
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} <= 9999
rm -f -- $RPM_BUILD_ROOT%{_bindir}/mkinitrd
rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
%endif
%if 0%{?fedora} || 0%{?rhel} > 6
# FIXME: remove after F19
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
%if 0%{?fedora} || 0%{?rhel}
echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf
%endif
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
> $RPM_BUILD_ROOT/etc/system-fips
# FIXME: remove after F30
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
%endif
%clean
rm -rf -- $RPM_BUILD_ROOT
%files
%defattr(-,root,root,0755)
%if %{with doc}
%doc README HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
%endif
@@ -349,7 +286,7 @@ rm -rf -- $RPM_BUILD_ROOT
%{_bindir}/dracut
%{_datadir}/bash-completion/completions/dracut
%{_datadir}/bash-completion/completions/lsinitrd
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999
%{_bindir}/mkinitrd
%{_bindir}/lsinitrd
%endif
@@ -375,7 +312,7 @@ rm -rf -- $RPM_BUILD_ROOT
%if %{with doc}
%{_mandir}/man8/dracut.8*
%{_mandir}/man8/*service.8*
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999
%{_mandir}/man8/mkinitrd.8*
%{_mandir}/man1/lsinitrd.1*
%endif
@@ -391,6 +328,12 @@ rm -rf -- $RPM_BUILD_ROOT
%endif
%{dracutlibdir}/modules.d/00bash
%{dracutlibdir}/modules.d/00systemd
%ifnarch s390 s390x
%{dracutlibdir}/modules.d/00warpclock
%endif
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
%{dracutlibdir}/modules.d/01fips
%endif
%{dracutlibdir}/modules.d/01systemd-initrd
%{dracutlibdir}/modules.d/03modsign
%{dracutlibdir}/modules.d/03rescue
@@ -407,10 +350,11 @@ rm -rf -- $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/90dm
%{dracutlibdir}/modules.d/90dmraid
%{dracutlibdir}/modules.d/90kernel-modules
%{dracutlibdir}/modules.d/90kernel-modules-extra
%{dracutlibdir}/modules.d/90lvm
%{dracutlibdir}/modules.d/90mdraid
%{dracutlibdir}/modules.d/90multipath
%{dracutlibdir}/modules.d/90multipath-hostonly
%{dracutlibdir}/modules.d/90stratis
%{dracutlibdir}/modules.d/90qemu
%{dracutlibdir}/modules.d/91crypt-gpg
%{dracutlibdir}/modules.d/91crypt-loop
@@ -430,6 +374,7 @@ rm -rf -- $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/95dasd_mod
%{dracutlibdir}/modules.d/95dasd_rules
%{dracutlibdir}/modules.d/95dcssblk
%{dracutlibdir}/modules.d/95qeth_rules
%{dracutlibdir}/modules.d/95zfcp
%{dracutlibdir}/modules.d/95zfcp_rules
%endif
@@ -469,13 +414,14 @@ rm -rf -- $RPM_BUILD_ROOT
%{_unitdir}/initrd.target.wants/dracut-pre-udev.service
%endif
%if 0%{?fedora} || 0%{?rhel} > 6
%if 0%{?fedora} || 0%{?rhel}
%{_prefix}/lib/kernel/install.d/50-dracut.install
%endif
%files network
%defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/02systemd-networkd
%{dracutlibdir}/modules.d/35network-manager
%{dracutlibdir}/modules.d/35network-legacy
%{dracutlibdir}/modules.d/40network
%{dracutlibdir}/modules.d/45ifcfg
%{dracutlibdir}/modules.d/90kernel-network-modules
@@ -492,50 +438,36 @@ rm -rf -- $RPM_BUILD_ROOT
%endif
%{dracutlibdir}/modules.d/99uefi-lib
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
%files fips
%defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/01fips
%{dracutlibdir}/dracut.conf.d/40-fips.conf
%config(missingok) /etc/system-fips
%endif
%files fips-aesni
%defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/02fips-aesni
%files caps
%defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/02caps
%files live
%defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/99img-lib
%{dracutlibdir}/modules.d/90dmsquash-live
%{dracutlibdir}/modules.d/90dmsquash-live-ntfs
%{dracutlibdir}/modules.d/90livenet
%files tools
%defattr(-,root,root,0755)
%if %{with doc}
%doc %{_mandir}/man8/dracut-catimages.8*
%endif
%files squash
%{dracutlibdir}/modules.d/99squash
%{_bindir}/dracut-catimages
%dir /boot/dracut
%dir /var/lib/dracut
%dir /var/lib/dracut/overlay
%files config-generic
%defattr(-,root,root,0755)
%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
%files config-rescue
%defattr(-,root,root,0755)
%{dracutlibdir}/dracut.conf.d/02-rescue.conf
%if 0%{?fedora} || 0%{?rhel} > 6
%if 0%{?fedora} || 0%{?rhel}
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
# FIXME: remove after F30
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
%endif

View File

@@ -243,7 +243,7 @@ If your root partition is on a network drive, you have to have the network
dracut modules installed to create a network aware initramfs image.
If you specify ip=dhcp on the kernel command line, then dracut asks a dhcp
server about the ip adress for the machine. The dhcp server can also serve an
server about the ip address for the machine. The dhcp server can also serve an
additional root-path, which will set the root device for dracut. With this
mechanism, you have static configuration on your client machine and a
centralized boot configuration on your TFTP/DHCP server. If you can't pass a
@@ -252,7 +252,7 @@ method described in <<Injecting>>.
==== Reducing the Image Size
To reduce the size of the initramfs, you should create it with by ommitting all
To reduce the size of the initramfs, you should create it with by omitting all
dracut modules, which you know, you don't need to boot the machine.
You can also specify the exact dracut and kernel modules to produce a very tiny

61
fedora-test.sh Executable file
View File

@@ -0,0 +1,61 @@
#!/bin/bash
set -ex
[[ -d ${0%/*} ]] && cd ${0%/*}
RUN_ID="$1"
TESTS=$2
dnf -y update --best --allowerasing &>/dev/null
dnf -y install --best --allowerasing \
dash \
asciidoc \
mdadm \
lvm2 \
dmraid \
cryptsetup \
nfs-utils \
nbd \
dhcp-server \
scsi-target-utils \
iscsi-initiator-utils \
strace \
btrfs-progs \
kmod-devel \
gcc \
bzip2 \
xz \
tar \
wget \
rpm-build \
make \
git \
bash-completion \
sudo \
kernel \
dhcp-client \
/usr/bin/qemu-kvm \
/usr/bin/qemu-system-$(uname -i) \
e2fsprogs \
$NULL &>/dev/null
./configure
NCPU=$(getconf _NPROCESSORS_ONLN)
if ! [[ $TESTS ]]; then
make -j$NCPU all syncheck rpm logtee
else
make -j$NCPU all logtee
cd test
time sudo make \
KVERSION=$(rpm -qa kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -rn | head -1) \
TEST_RUN_ID=$RUN_ID \
${TESTS:+TESTS="$TESTS"} \
-k V=2 \
check
fi

View File

@@ -402,9 +402,9 @@ static int resolve_deps(const char *src)
_cleanup_pclose_ FILE *fptr = NULL;
_cleanup_free_ char *cmd = NULL;
buf = malloc(LINE_MAX);
if (buf == NULL)
return -errno;
buf = malloc(LINE_MAX);
if (buf == NULL)
return -errno;
if (strstr(src, ".so") == 0) {
_cleanup_close_ int fd = -1;
@@ -456,11 +456,11 @@ static int resolve_deps(const char *src)
break;
}
/* musl ldd */
if (strstr(buf, "Not a valid dynamic program"))
break;
/* musl ldd */
if (strstr(buf, "Not a valid dynamic program"))
break;
/* glibc */
/* glibc */
if (strstr(buf, "cannot execute binary file"))
break;
@@ -1061,7 +1061,7 @@ static int install_one(const char *src, const char *dst)
if (strchr(src, '/') == NULL) {
char **p = find_binary(src);
if (p) {
char **q = NULL;
char **q = NULL;
STRV_FOREACH(q, p) {
char *newsrc = *q;
log_debug("dracut_install '%s' '%s'", newsrc, dst);
@@ -1097,7 +1097,7 @@ static int install_all(int argc, char **argv)
if (strchr(argv[i], '/') == NULL) {
char **p = find_binary(argv[i]);
if (p) {
char **q = NULL;
char **q = NULL;
STRV_FOREACH(q, p) {
char *newsrc = *q;
log_debug("dracut_install '%s'", newsrc);
@@ -1231,11 +1231,42 @@ static bool check_module_path(const char *path)
return true;
}
static int install_dependent_modules(struct kmod_list *modlist)
{
struct kmod_list *itr;
struct kmod_module *mod;
const char *path = NULL;
const char *name = NULL;
int ret = 0;
kmod_list_foreach(itr, modlist) {
mod = kmod_module_get_module(itr);
path = kmod_module_get_path(mod);
name = kmod_module_get_name(mod);
if ((path == NULL) || (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0))) {
kmod_module_unref(mod);
continue;
}
ret = dracut_install(path, &path[kerneldirlen], false, false, true);
if (ret == 0) {
log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]);
install_firmware(mod);
} else {
log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
}
kmod_module_unref(mod);
}
return ret;
}
static int install_module(struct kmod_module *mod)
{
int ret = 0;
struct kmod_list *itr;
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
_cleanup_kmod_module_unref_list_ struct kmod_list *modpre = NULL;
_cleanup_kmod_module_unref_list_ struct kmod_list *modpost = NULL;
const char *path = NULL;
const char *name = NULL;
@@ -1278,23 +1309,12 @@ static int install_module(struct kmod_module *mod)
install_firmware(mod);
modlist = kmod_module_get_dependencies(mod);
kmod_list_foreach(itr, modlist) {
mod = kmod_module_get_module(itr);
path = kmod_module_get_path(mod);
ret = install_dependent_modules(modlist);
name = kmod_module_get_name(mod);
if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) {
kmod_module_unref(mod);
continue;
}
ret = dracut_install(path, &path[kerneldirlen], false, false, true);
if (ret == 0) {
log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]);
install_firmware(mod);
} else {
log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
}
kmod_module_unref(mod);
if (ret == 0) {
ret = kmod_module_get_softdeps(mod, &modpre, &modpost);
if (ret == 0)
ret = install_dependent_modules(modpre);
}
return ret;
@@ -1394,6 +1414,7 @@ static int install_modules(int argc, char **argv)
const char *abskpath = NULL;
char *p;
int i;
int modinst = 0;
ctx = kmod_new(kerneldir, NULL);
abskpath = kmod_get_dirname(ctx);
@@ -1439,12 +1460,11 @@ static int install_modules(int argc, char **argv)
for (i = 0; i < argc; i++) {
int r = 0;
int ret = -1;
log_debug("Handle module '%s'", argv[i]);
if (argv[i][0] == '/') {
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
_cleanup_free_ const char *modname = NULL;
_cleanup_free_ const char *modname = NULL;
r = kmod_module_new_from_path(ctx, argv[i], &mod_o);
if (r < 0) {
@@ -1498,6 +1518,7 @@ static int install_modules(int argc, char **argv)
return -ENOENT;
};
ret = ( ret == 0 ? 0 : r );
modinst = 1;
}
} else if (argv[i][0] == '=') {
_cleanup_free_ char *path1 = NULL, *path2 = NULL, *path3 = NULL;
@@ -1530,7 +1551,7 @@ static int install_modules(int argc, char **argv)
for (FTSENT *ftsent = fts_read(fts); ftsent != NULL; ftsent = fts_read(fts)) {
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
_cleanup_free_ const char *modname = NULL;
_cleanup_free_ const char *modname = NULL;
if((ftsent->fts_info == FTS_D) && !check_module_path(ftsent->fts_accpath)) {
fts_set(fts, ftsent, FTS_SKIP);
@@ -1592,6 +1613,7 @@ static int install_modules(int argc, char **argv)
return -ENOENT;
};
ret = ( ret == 0 ? 0 : r );
modinst = 1;
}
}
if (errno) {
@@ -1599,7 +1621,7 @@ static int install_modules(int argc, char **argv)
}
} else {
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
char *modname = argv[i];
char *modname = argv[i];
if (endswith(modname, ".ko")) {
int len = strlen(modname);
@@ -1638,10 +1660,11 @@ static int install_modules(int argc, char **argv)
return -ENOENT;
};
ret = ( ret == 0 ? 0 : r );
modinst = 1;
}
}
if ((ret != 0) && (!arg_optional)) {
if ((modinst != 0) && (ret != 0) && (!arg_optional)) {
if (!arg_silent)
log_error("ERROR: installing '%s'", argv[i]);
return EXIT_FAILURE;

View File

@@ -167,7 +167,7 @@ int safe_atoi(const char *s, int *ret_i);
int safe_atollu(const char *s, unsigned long long *ret_u);
int safe_atolli(const char *s, long long int *ret_i);
#if __WORDSIZE == 32
#if LONG_MAX == INT_MAX
static inline int safe_atolu(const char *s, unsigned long *ret_u) {
assert_cc(sizeof(unsigned long) == sizeof(unsigned));
return safe_atou(s, (unsigned*) ret_u);

54
logtee.c Normal file
View File

@@ -0,0 +1,54 @@
#define _GNU_SOURCE
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <limits.h>
#define BUFLEN 4096
int
main(int argc, char *argv[])
{
int fd;
int len, slen;
if (argc != 2) {
fprintf(stderr, "Usage: %s <file>\n", argv[0]);
exit(EXIT_FAILURE);
}
fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd == -1) {
perror("open");
exit(EXIT_FAILURE);
}
fprintf(stderr, "Logging to %s: ", argv[1]);
slen = 0;
do {
len = splice(STDIN_FILENO, NULL, fd, NULL,
BUFLEN, SPLICE_F_MOVE);
if (len < 0) {
if (errno == EAGAIN)
continue;
perror("tee");
exit(EXIT_FAILURE);
} else
if (len == 0)
break;
slen += len;
if ((slen/BUFLEN) > 0) {
fprintf(stderr, ".");
}
slen = slen % BUFLEN;
} while (1);
close(fd);
fprintf(stderr, "\n");
exit(EXIT_SUCCESS);
}

View File

@@ -34,11 +34,17 @@ OPTIONS
**-k, --kver** _<kernel version>_::
inspect the initramfs of <kernel version>.
**-m, --mod**::
list dracut modules included of the initramfs image.
**--unpack**::
unpack the initramfs to the current directory, instead of displaying the contents.
If optional filenames are given, will only unpack specified files, else the whole image will be unpacked.
Won't unpack anything from early cpio part.
**--unpackearly**::
unpack the early microcode initramfs to the current directory, instead of displaying the contents.
Same as --unpack, but only unpack files from early cpio part.
**-v, --verbose**::
unpack verbosely

View File

@@ -28,7 +28,10 @@ usage()
echo "-m, --mod list modules."
echo "-f, --file <filename> print the contents of <filename>."
echo "--unpack unpack the initramfs, instead of displaying the contents."
echo " If optional filenames are given, will only unpack specified files,"
echo " else the whole image will be unpacked. Won't unpack anything from early cpio part."
echo "--unpackearly unpack the early microcode part of the initramfs."
echo " Same as --unpack, but only unpack files from early cpio part."
echo "-v, --verbose unpack verbosely."
echo "-k, --kver <kernel version> inspect the initramfs of <kernel version>."
echo
@@ -159,8 +162,15 @@ list_files()
unpack_files()
{
$CAT "$image" 2>/dev/null | cpio -id --quiet $verbose
((ret+=$?))
if (( ${#filenames[@]} > 0 )); then
for f in "${!filenames[@]}"; do
$CAT "$image" 2>/dev/null | cpio -id --quiet $verbose $f
((ret+=$?))
done
else
$CAT "$image" 2>/dev/null | cpio -id --quiet $verbose
((ret+=$?))
fi
}
@@ -175,7 +185,10 @@ case $bin in
CAT="cat --"
is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2>/dev/null)
if [[ "$is_early" ]]; then
if [[ -n "$unpackearly" ]]; then
if [[ -n "$unpack" ]]; then
# should use --unpackearly for early CPIO
:
elif [[ -n "$unpackearly" ]]; then
unpack_files
elif (( ${#filenames[@]} > 0 )); then
extract_files
@@ -219,7 +232,7 @@ case $bin in
$'\x89'LZO$'\0'*)
CAT="lzop -d -c"
;;
$'0xFD2FB528'*)
$'\x28\xB5\x2F\xFD'*)
CAT="zstd -d -c"
;;
*)
@@ -241,6 +254,17 @@ if [[ $SKIP ]]; then
CAT=skipcpio
fi
if (( ${#filenames[@]} > 1 )); then
TMPFILE="$(mktemp -t --suffix=.cpio lsinitrd.XXXXXX)"
$CAT "$image" 2>/dev/null > $TMPFILE
trap "rm -f '$TMPFILE'" EXIT
pre_decompress()
{
cat $TMPFILE
}
CAT=pre_decompress
fi
ret=0
if [[ -n "$unpack" ]]; then

View File

@@ -18,7 +18,7 @@ DESCRIPTION
version <kernel-version> by calling *dracut*.
[IMPORTANT]
This version of mkinitrd is provided for compability with older
This version of mkinitrd is provided for compatibility with older
versions of mkinitrd. If a more fine grained control over the
resulting image is needed, *dracut* should be called directly.
@@ -30,7 +30,7 @@ OPTIONS
**-k** _<kernel_list>_::
List of kernel images for which initrd files are created (relative
to _boot_dir_), Image name should begin with the following string,
defaults to _vmlinux_ on ppc/ppc64, _image_ on s390/s390x and _vmlinuz_
defaults to _vmlinux_ on ppc/ppc64, _image_ on s390/s390x and _vmlinuz_
for everything else.
**-i** _<initrd_list>_::
@@ -51,7 +51,7 @@ OPTIONS
**-d** _<root_device>_::
Root device, defaults to the device from which the root_dir is
mounted; overwrites the rootdev enviroment variable if set
mounted; overwrites the rootdev environment variable if set
**-s** _<size>_::
Add splash animation and bootscreen to initrd.

View File

@@ -0,0 +1,29 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
# hwclock does not exist on S390(x), bail out silently then
local _arch=$(uname -m)
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] && return 1
[ -e /etc/localtime -a -e /etc/adjtime ] || return 1
require_binaries /sbin/hwclock || return 1
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
inst /usr/share/zoneinfo/UTC
inst /etc/localtime
inst /etc/adjtime
inst_hook pre-trigger 00 "$moddir/warpclock.sh"
inst /sbin/hwclock
}

View File

@@ -0,0 +1,9 @@
#!/bin/sh
if test -e /etc/adjtime ; then
while read line ; do
if test "$line" = LOCAL ; then
hwclock --systz
fi
done < /etc/adjtime
fi

View File

@@ -16,12 +16,27 @@ installkernel() {
if [[ -f "${srcmods}/modules.fips" ]]; then
_fipsmodules="$(cat "${srcmods}/modules.fips")"
else
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 authenc authencesn blowfish camellia cast6 cbc ccm "
_fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg "
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
_fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib "
_fipsmodules+="aes_s390 des_s390 prng sha256_s390 sha_common des_check_key ghash_s390 sha1_s390 sha512_s390 cmac authenc "
_fipsmodules=""
# Hashes:
_fipsmodules+="sha1 sha224 sha256 sha384 sha512 "
_fipsmodules+="sha3-224 sha3-256 sha3-384 sha3-512 "
_fipsmodules+="crc32c crct10dif ghash "
# Ciphers:
_fipsmodules+="cipher_null des3_ede aes "
# Modes/templates:
_fipsmodules+="ecb cbc ctr xts gcm ccm authenc hmac cmac "
# Compression algs:
_fipsmodules+="deflate lzo zlib "
# PRNG algs:
_fipsmodules+="ansi_cprng "
# Misc:
_fipsmodules+="aead cryptomgr tcrypt crypto_user "
fi
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
@@ -41,14 +56,8 @@ install() {
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
inst_script "$moddir/fips.sh" /sbin/fips.sh
inst_multiple sha512hmac rmmod insmod mount uname umount fipscheck
inst_multiple sha512hmac rmmod insmod mount uname umount
inst_libdir_file libsoftokn3.so libsoftokn3.so \
libsoftokn3.chk libfreebl3.so libfreebl3.chk \
libssl.so 'hmaccalc/sha512hmac.hmac' libssl.so.10 \
libfreeblpriv3.so libfreeblpriv3.chk
inst_multiple -o prelink
inst_simple /etc/system-fips
[ -c ${initdir}/dev/random ] || mknod ${initdir}/dev/random c 1 8 \
|| {

View File

@@ -38,13 +38,12 @@ install() {
ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target"
local VERSION=""
local PRETTY_NAME=""
if [ -e /etc/os-release ]; then
. /etc/os-release
VERSION+=" "
PRETTY_NAME+=" "
else
VERSION=""
PRETTY_NAME=""
[[ -n ${VERSION} ]] && VERSION+=" "
[[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" "
fi
NAME=dracut
ID=dracut

View File

@@ -1,32 +0,0 @@
#!/bin/bash
# called by dracut
check() {
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
installkernel() {
local _fipsmodules _mod
_fipsmodules="aesni-intel ghash_clmulni_intel"
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"
fi
done
}
# called by dracut
install() {
return 0
}

View File

@@ -45,7 +45,7 @@ install() {
for INCL in $($cmd "^include " $map | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
findkeymap $FN
strstr "$KEYMAPS" "$FN" || findkeymap $FN
done
done
done

View File

@@ -41,6 +41,12 @@ do_dhcp() {
return 1
fi
if [ ! -e /run/NetworkManager/conf.d/10-dracut-dhclient.conf ]; then
mkdir -p /run/NetworkManager/conf.d
echo '[main]' > /run/NetworkManager/conf.d/10-dracut-dhclient.conf
echo 'dhcp=dhclient' >>/run/NetworkManager/conf.d/10-dracut-dhclient.conf
fi
while [ $_COUNT -lt $_DHCPRETRY ]; do
info "Starting dhcp for interface $netif"
dhclient "$@" \
@@ -70,23 +76,25 @@ load_ipv6() {
}
do_ipv6auto() {
local ret
load_ipv6
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
linkup $netif
wait_for_ipv6_auto $netif
ret=$?
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
return 0
return $ret
}
# Handle static ip configuration
do_static() {
strglobin $ip '*:*:*' && load_ipv6
if [ -z "$dev" ] && ! iface_has_carrier "$netif"; then
if ! iface_has_carrier "$netif"; then
warn "No carrier detected on interface $netif"
return 1
elif ! linkup "$netif"; then
@@ -416,6 +424,8 @@ for p in $(getargs ip=); do
do_dhcp -6 ;;
auto6)
do_ipv6auto ;;
either6)
do_ipv6auto || do_dhcp -6 ;;
*)
do_static ;;
esac

View File

@@ -0,0 +1,93 @@
#!/bin/bash
# called by dracut
check() {
local _program
require_binaries ip dhclient sed awk grep || return 1
require_any_binary arping arping2 || return 1
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
installkernel() {
return 0
}
# called by dracut
install() {
local _arch _i _dir
inst_multiple ip dhclient sed awk grep
inst_multiple -o arping arping2
strstr "$(arping 2>&1)" "ARPing 2" && mv "$initdir/bin/arping" "$initdir/bin/arping2"
inst_multiple -o ping ping6
inst_multiple -o teamd teamdctl teamnl
inst_simple /etc/libnl/classid
inst_script "$moddir/ifup.sh" "/sbin/ifup"
inst_script "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
inst_simple -H "/etc/dhclient.conf"
cat "$moddir/dhclient.conf" >> "${initdir}/etc/dhclient.conf"
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
inst_hook cmdline 92 "$moddir/parse-ibft.sh"
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
inst_hook cmdline 96 "$moddir/parse-bond.sh"
inst_hook cmdline 96 "$moddir/parse-team.sh"
inst_hook cmdline 97 "$moddir/parse-bridge.sh"
inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
inst_hook cleanup 10 "$moddir/kill-dhclient.sh"
# install all config files for teaming
unset TEAM_MASTER
unset TEAM_CONFIG
unset TEAM_PORT_CONFIG
unset HWADDR
unset SUBCHANNELS
for i in /etc/sysconfig/network-scripts/ifcfg-*; do
[ -e "$i" ] || continue
case "$i" in
*~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
continue
;;
esac
(
. "$i"
if ! [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] \
&& [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
if [ -n "$TEAM_CONFIG" ] && [ -n "$DEVICE" ]; then
mkdir -p $initdir/etc/teamd
printf -- "%s" "$TEAM_CONFIG" > "$initdir/etc/teamd/${DEVICE}.conf"
elif [ -n "$TEAM_PORT_CONFIG" ]; then
inst_simple "$i"
HWADDR="$(echo $HWADDR | sed 'y/ABCDEF/abcdef/')"
if [ -n "$HWADDR" ]; then
ln_r "$i" "/etc/sysconfig/network-scripts/mac-${HWADDR}.conf"
fi
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
if [ -n "$SUBCHANNELS" ]; then
ln_r "$i" "/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf"
fi
fi
fi
)
done
_arch=$(uname -m)
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
dracut_need_initqueue
}

View File

@@ -76,6 +76,7 @@ for p in $(getargs ip=); do
die "Sorry, automatic calculation of netmask is not yet supported"
;;
auto6);;
either6);;
dhcp|dhcp6|on|any) \
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"

View File

@@ -0,0 +1,52 @@
#!/bin/bash
# called by dracut
check() {
local _program
require_binaries sed grep || return 1
# do not add this module by default
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
installkernel() {
return 0
}
# called by dracut
install() {
local _nm_version
_nm_version=$(NetworkManager --version)
inst_multiple sed grep
inst NetworkManager
inst /usr/libexec/nm-initrd-generator
inst_multiple -o teamd dhclient
inst_hook cmdline 99 "$moddir/nm-config.sh"
inst_hook initqueue/settled 99 "$moddir/nm-run.sh"
inst_rules 85-nm-unmanaged.rules
inst_libdir_file "NetworkManager/$_nm_version/libnm-device-plugin-team.so"
if [[ -x "$initdir/usr/sbin/dhclient" ]]; then
inst /usr/libexec/nm-dhcp-helper
elif ! [[ -e "$initdir/etc/machine-id" ]]; then
# The internal DHCP client silently fails if we
# have no machine-id
systemd-machine-id-setup --root="$initdir"
fi
# We don't install the ifcfg files from the host automatically.
# But if the user chooses to include them, we pull in the machinery to read them.
if ! [[ -d "$initdir/etc/sysconfig/network-scripts" ]]; then
inst_libdir_file "NetworkManager/$_nm_version/libnm-settings-plugin-ifcfg-rh.so"
fi
}

View File

@@ -0,0 +1,3 @@
#!/bin/sh
/usr/libexec/nm-initrd-generator -- $(getcmdline)

View File

@@ -0,0 +1,16 @@
#!/bin/sh
if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
/usr/sbin/NetworkManager --configure-and-quit=initrd --debug --log-level=trace
else
/usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
fi
for _i in /sys/class/net/*/
do
state=/run/NetworkManager/devices/$(cat $_i/ifindex)
grep -q managed=true $state 2>/dev/null || continue
ifname=$(basename $_i)
sed -n 's/root-path/new_root_path/p' <$state >/tmp/dhclient.$ifname.dhcpopts
/sbin/netroot $ifname
done

View File

@@ -1,18 +1,13 @@
#!/bin/bash
# called by dracut
check() {
local _program
require_binaries ip dhclient sed awk grep || return 1
require_any_binary arping arping2 || return 1
return 255
}
# called by dracut
depends() {
echo "kernel-network-modules"
echo -n "kernel-network-modules "
if ! dracut_module_included "network-legacy" && [ -x "/usr/libexec/nm-initrd-generator" ] ; then
echo "network-manager"
else
echo "network-legacy"
fi
return 0
}
@@ -24,74 +19,10 @@ installkernel() {
# called by dracut
install() {
local _arch _i _dir
inst_multiple ip dhclient sed awk grep
inst_multiple -o arping arping2
strstr "$(arping 2>&1)" "ARPing 2" && mv "$initdir/bin/arping" "$initdir/bin/arping2"
inst_multiple -o ping ping6
inst_multiple -o teamd teamdctl teamnl
inst_simple /etc/libnl/classid
inst_script "$moddir/ifup.sh" "/sbin/ifup"
inst_script "$moddir/netroot.sh" "/sbin/netroot"
inst_script "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
inst_simple "$moddir/net-lib.sh" "/lib/net-lib.sh"
inst_simple -H "/etc/dhclient.conf"
cat "$moddir/dhclient.conf" >> "${initdir}/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"
inst_hook cmdline 92 "$moddir/parse-ibft.sh"
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
inst_hook cmdline 96 "$moddir/parse-bond.sh"
inst_hook cmdline 96 "$moddir/parse-team.sh"
inst_hook cmdline 97 "$moddir/parse-bridge.sh"
inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
inst_hook cleanup 10 "$moddir/kill-dhclient.sh"
# install all config files for teaming
unset TEAM_MASTER
unset TEAM_CONFIG
unset TEAM_PORT_CONFIG
unset HWADDR
unset SUBCHANNELS
for i in /etc/sysconfig/network-scripts/ifcfg-*; do
[ -e "$i" ] || continue
case "$i" in
*~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
continue
;;
esac
(
. "$i"
if ! [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] \
&& [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
if [ -n "$TEAM_CONFIG" ] && [ -n "$DEVICE" ]; then
mkdir -p $initdir/etc/teamd
printf -- "%s" "$TEAM_CONFIG" > "$initdir/etc/teamd/${DEVICE}.conf"
elif [ -n "$TEAM_PORT_CONFIG" ]; then
inst_simple "$i"
HWADDR="$(echo $HWADDR | sed 'y/ABCDEF/abcdef/')"
if [ -n "$HWADDR" ]; then
ln_r "$i" "/etc/sysconfig/network-scripts/mac-${HWADDR}.conf"
fi
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
if [ -n "$SUBCHANNELS" ]; then
ln_r "$i" "/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf"
fi
fi
fi
)
done
_arch=$(uname -m)
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
dracut_need_initqueue
}

View File

@@ -458,7 +458,7 @@ ip_to_var() {
fi
if [ $# -eq 1 ]; then
# format: ip={dhcp|on|any|dhcp6|auto6}
# format: ip={dhcp|on|any|dhcp6|auto6|either6}
# or
# ip=<ipv4-address> means anaconda-style static config argument cluster
autoconf="$1"
@@ -485,7 +485,7 @@ ip_to_var() {
return 0
fi
if [ "$2" = "dhcp" -o "$2" = "on" -o "$2" = "any" -o "$2" = "dhcp6" -o "$2" = "auto6" ]; then
if [ "$2" = "dhcp" -o "$2" = "on" -o "$2" = "any" -o "$2" = "dhcp6" -o "$2" = "auto6" -o "$2" = "either6" ]; then
# format: ip=<interface>:{dhcp|on|any|dhcp6|auto6}[:[<mtu>][:<macaddr>]]
[ -n "$1" ] && dev="$1"
[ -n "$2" ] && autoconf="$2"
@@ -726,8 +726,12 @@ iface_has_carrier() {
while [ $cnt -lt $timeout ]; do
if [ -n "$_no_carrier_flag" ]; then
li=$(ip -o link show up dev $1)
# NO-CARRIER flag was cleared
strstr "$li" "NO-CARRIER" || return 0
elif ! [ -e "$interface/carrier" ]; then
# sysfs not available and "NO-CARRIER" not displayed
return 0
fi
# double check the syscfs carrier flag
[ -e "$interface/carrier" ] && [ "$(cat $interface/carrier)" = 1 ] && return 0

View File

@@ -46,7 +46,7 @@ if [ -z "$2" ]; then
# we die. Otherwise we just warn
if [ -z "$new_root_path" ] ; then
[ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
warn "No dhcp root-path received for '$BOOTDEV' trying other interfaces if available"
warn "No dhcp root-path received for '$netif' trying other interfaces if available"
exit 1
fi

View File

@@ -14,6 +14,7 @@ depends() {
# called by dracut
install() {
inst_binary sort
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
}

View File

@@ -286,7 +286,10 @@ echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab
echo "files /var/lib/dhclient" >> /run/initramfs/rwtab
{
cp /tmp/net.* /run/initramfs/
cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/resolv.conf
for i in /tmp/net.*.resolv.conf; do
[ -f "$i" ] && cat "$i"
done | sort -u > /run/initramfs/state/etc/resolv.conf
[ -s /run/initramfs/state/etc/resolv.conf ] || rm -f /run/initramfs/state/etc/resolv.conf
copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network-scripts
cp /tmp/ifcfg-leases/* /run/initramfs/state/var/lib/dhclient
} > /dev/null 2>&1

View File

@@ -31,7 +31,7 @@ installkernel() {
# as we could e.g. be in the installer; nokmsboot boot parameter will disable
# loading of the driver if needed
if [[ $hostonly ]]; then
for i in /sys/bus/{pci/devices,soc/devices/soc?}/*/modalias; do
for i in /sys/bus/{pci/devices,virtio/devices,soc/devices/soc?}/*/modalias; do
[[ -e $i ]] || continue
if hostonly="" dracut_instmods --silent -s "drm_crtc_init" -S "iw_handler_get_spy" $(<$i); then
if strstr "$(modinfo -F filename $(<$i) 2>/dev/null)" radeon.ko; then
@@ -40,6 +40,6 @@ installkernel() {
fi
done
else
dracut_instmods -s "drm_crtc_init" "=drivers/gpu/drm" "=drivers/staging"
dracut_instmods -o -s "drm_crtc_init" "=drivers/gpu/drm" "=drivers/staging"
fi
}

View File

@@ -6,7 +6,7 @@ pkglib_dir() {
_dirs+=" /usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth"
fi
for _dir in $_dirs; do
if [ -d $_dir ]; then
if [ -x $_dir/plymouth-populate-initrd ]; then
echo $_dir
return
fi

0
modules.d/80lvmmerge/README.md Executable file → Normal file
View File

View File

@@ -12,7 +12,7 @@ crypttab_contains() {
strstr "${l##luks-}" "${luks##luks-}" && return 0
strstr "$d" "${luks##luks-}" && return 0
if [ -n "$dev" ]; then
for _dev in "$(devnames $d)"; do
for _dev in $(devnames $d); do
[ "$dev" -ef "$_dev" ] && return 0
done
fi

View File

@@ -165,12 +165,15 @@ fi
if [ $ask_passphrase -ne 0 ]; then
luks_open="$(command -v cryptsetup) $cryptsetupopts luksOpen"
_timeout=$(getargs "rd.luks.timeout")
_timeout=${_timeout:-0}
ask_for_password --ply-tries 5 \
--ply-cmd "$luks_open -T1 $device $luksname" \
--ply-prompt "Password ($device)" \
--tty-tries 1 \
--tty-cmd "$luks_open -T5 $device $luksname"
--tty-cmd "$luks_open -T5 -t $_timeout $device $luksname"
unset luks_open
unset _timeout
fi
unset device luksname luksfile

View File

@@ -27,6 +27,7 @@ installkernel() {
hostonly="" instmods drbg
arch=$(arch)
[[ $arch == x86_64 ]] && arch=x86
[[ $arch == s390x ]] && arch=s390
instmods dm_crypt =crypto =drivers/crypto =arch/$arch/crypto
}

View File

@@ -35,6 +35,7 @@ else
echo 'ACTION!="add|change", GOTO="luks_end"'
} > /etc/udev/rules.d/70-luks.rules.new
PARTUUID=$(getargs rd.luks.partuuid -d rd_LUKS_PARTUUID)
SERIAL=$(getargs rd.luks.serial -d rd_LUKS_SERIAL)
LUKS=$(getargs rd.luks.uuid -d rd_LUKS_UUID)
tout=$(getarg rd.luks.key.tout)
@@ -45,7 +46,39 @@ else
done < /etc/crypttab
fi
if [ -n "$SERIAL" ]; then
if [ -n "$PARTUUID" ]; then
for uuid in $PARTUUID; do
uuid=${uuid##luks-}
if luksname=$(_cryptgetargsname "rd.luks.name=$uuid="); then
luksname="${luksname#$uuid=}"
else
luksname="luks-$uuid"
fi
if [ -z "$DRACUT_SYSTEMD" ]; then
{
printf -- 'ENV{ID_PART_ENTRY_UUID}=="*%s*", ' "$uuid"
printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
printf -- '--name cryptroot-ask-%%k %s ' "$(command -v cryptroot-ask)"
printf -- '$env{DEVNAME} %s %s"\n' "$luksname" "$tout"
} >> /etc/udev/rules.d/70-luks.rules.new
else
luksname=$(dev_unit_name "$luksname")
luksname="$(str_replace "$luksname" '\' '\\')"
if ! crypttab_contains "$uuid"; then
{
printf -- 'ENV{ID_PART_ENTRY_UUID}=="*%s*", ' "$uuid"
printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
printf -- '--name systemd-cryptsetup-%%k %s start ' "$(command -v systemctl)"
printf -- 'systemd-cryptsetup@%s.service"\n' "$luksname"
} >> /etc/udev/rules.d/70-luks.rules.new
fi
fi
done
elif [ -n "$SERIAL" ]; then
for serialid in $SERIAL; do
serialid=${serialid##luks-}

View File

@@ -1,6 +1,6 @@
#!/bin/sh
if [ -L /run/rootfsbase ] && [ -d /run/initramfs/live/updates -o -d /updates ]; then
if [ -h /dev/root ] && [ -d /run/initramfs/live/updates -o -d /updates ]; then
info "Applying updates to live image..."
mount -o bind /run $NEWROOT/run
# avoid overwriting symlinks (e.g. /lib -> /usr/lib) with directories

View File

@@ -18,12 +18,12 @@ fi
case "$liveroot" in
live:LABEL=*|LABEL=*) \
root="${root#live:}"
root="$(echo $root | sed 's,/,\\x2f,g')"
root="${root//\//\\x2f}"
root="live:/dev/disk/by-label/${root#LABEL=}"
rootok=1 ;;
live:CDLABEL=*|CDLABEL=*) \
root="${root#live:}"
root="$(echo $root | sed 's,/,\\x2f,g')"
root="${root//\//\\x2f}"
root="live:/dev/disk/by-label/${root#CDLABEL=}"
rootok=1 ;;
live:UUID=*|UUID=*) \
@@ -54,8 +54,10 @@ GENERATOR_DIR="$2"
[ -z "$GENERATOR_DIR" ] && exit 1
[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR"
getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"
[ -e /xor_overlayfs ] && xor_overlayfs="yes"
[ -e /xor_readonly ] && xor_readonly="--readonly"
ROOTFLAGS="$(getarg rootflags)"
{
echo "[Unit]"
@@ -64,7 +66,12 @@ ROOTFLAGS="$(getarg rootflags)"
echo "Where=/sysroot"
if [ "$overlayfs$xor_overlayfs" = "yes" ]; then
echo "What=LiveOS_rootfs"
echo "Options=${ROOTFLAGS},lowerdir=/run/rootfsbase,upperdir=/run/overlayfs,workdir=/run/ovlwork"
if [ "$readonly_overlay$xor_readonly" = "--readonly" ]; then
ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
else
ovlfs=lowerdir=/run/rootfsbase
fi
echo "Options=${ROOTFLAGS},${ovlfs},upperdir=/run/overlayfs,workdir=/run/ovlwork"
echo "Type=overlay"
_dev=LiveOS_rootfs
else

View File

@@ -109,15 +109,15 @@ do_live_overlay() {
if [ -z "$overlay" ]; then
pathspec="/${live_dir}/overlay-$l-$u"
elif ( echo $overlay | grep -q ":" ); then
elif strstr $overlay ":"; then
# pathspec specified, extract
pathspec=$( echo $overlay | sed -e 's/^.*://' )
pathspec=${overlay##*:}
fi
if [ -z "$pathspec" -o "$pathspec" = "auto" ]; then
pathspec="/${live_dir}/overlay-$l-$u"
fi
devspec=$( echo $overlay | sed -e 's/:.*$//' )
devspec=${overlay%%:*}
# need to know where to look for the overlay
if [ -z "$setup" -a -n "$devspec" -a -n "$pathspec" -a -n "$overlay" ]; then
@@ -137,7 +137,7 @@ do_live_overlay() {
fi
if [ -n "$overlayfs" ]; then
unset -v overlayfs
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="yes"
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit=":>/xor_overlayfs;"
fi
setup="yes"
else
@@ -146,10 +146,10 @@ do_live_overlay() {
[ -d /run/initramfs/overlayfs/ovlwork ]; then
ln -s /run/initramfs/overlayfs/overlayfs /run/overlayfs$opt
ln -s /run/initramfs/overlayfs/ovlwork /run/ovlwork$opt
if [ -z "$overlayfs" ]; then
overlayfs="yes"
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="yes"
if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
reloadsysrootmountunit=":>/xor_overlayfs;"
fi
overlayfs="required"
setup="yes"
fi
fi
@@ -157,19 +157,24 @@ do_live_overlay() {
[ -d /run/initramfs/overlayfs$pathspec/../ovlwork ]; then
ln -s /run/initramfs/overlayfs$pathspec /run/overlayfs$opt
ln -s /run/initramfs/overlayfs$pathspec/../ovlwork /run/ovlwork$opt
if [ -z "$overlayfs" ]; then
overlayfs="yes"
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="yes"
if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
reloadsysrootmountunit=":>/xor_overlayfs;"
fi
overlayfs="required"
setup="yes"
fi
fi
if [ -n "$overlayfs" ]; then
modprobe overlay
if [ $? != 0 ]; then
if [ "$overlayfs" = required ]; then
die "OverlayFS is required but not available."
exit 1
fi
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit=":>/xor_overlayfs;"
m='OverlayFS is not available; using temporary Device-mapper overlay.'
info $m
unset -v overlayfs setup
[ -n "$reloadsysrootmountunit" ] && unset -v reloadsysrootmountunit
fi
fi
@@ -181,7 +186,7 @@ do_live_overlay() {
m=' Unable to find a persistent overlay; using a temporary one.'
m="$m"$'\n All root filesystem changes will be lost on shutdown.'
m="$m"$'\n Press [Enter] to continue.'
echo -e "\n\n\n\n${m}\n\n\n" > /dev/kmsg
printf "\n\n\n\n${m}\n\n\n" > /dev/kmsg
if [ -n "$DRACUT_SYSTEMD" ]; then
if type plymouth >/dev/null 2>&1 && plymouth --ping ; then
if getargbool 0 rhgb || getargbool 0 splash ; then
@@ -203,6 +208,11 @@ do_live_overlay() {
if [ -n "$overlayfs" ]; then
mkdir -m 0755 /run/overlayfs
mkdir -m 0755 /run/ovlwork
if [ -n "$readonly_overlay" ] && ! [ -h /run/overlayfs-r ]; then
info "No persistent overlay found."
unset -v readonly_overlay
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="${reloadsysrootmountunit}:>/xor_readonly;"
fi
else
dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((overlay_size*1024)) 2> /dev/null
if [ -n "$setup" -a -n "$readonly_overlay" ]; then
@@ -250,14 +260,13 @@ do_live_overlay() {
echo 0 $sz snapshot $base $over PO 8 | dmsetup create live-rw
fi
# Create a device that always points to a ro base image
if [ -n "$overlayfs" ]; then
BASE_LOOPDUP=$(losetup -f --show -r $BASE_LOOPDEV)
echo 0 $sz linear $BASE_LOOPDUP 0 | dmsetup create --readonly live-base
else
# Create a device for the ro base of overlayed file systems.
if [ -z "$overlayfs" ]; then
echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create --readonly live-base
fi
ln -s $BASE_LOOPDEV /dev/live-base
}
# end do_live_overlay()
# we might have a genMinInstDelta delta file for anaconda to take advantage of
if [ -e /run/initramfs/live/${live_dir}/osmin.img ]; then
@@ -291,10 +300,21 @@ if [ -e "$SQUASHED" ]; then
mkdir -m 0755 -p /run/initramfs/squashfs
mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /run/initramfs/squashfs
if [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
FSIMG="/run/initramfs/squashfs/LiveOS/rootfs.img"
elif [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
FSIMG="/run/initramfs/squashfs/LiveOS/ext3fs.img"
if [ -d /run/initramfs/squashfs/LiveOS ]; then
if [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
FSIMG="/run/initramfs/squashfs/LiveOS/rootfs.img"
elif [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
FSIMG="/run/initramfs/squashfs/LiveOS/ext3fs.img"
fi
elif [ -d /run/initramfs/squashfs/proc ]; then
FSIMG=$SQUASHED
if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
reloadsysrootmountunit=":>/xor_overlayfs;"
fi
overlayfs="required"
else
die "Failed to find a root filesystem in $SQUASHED."
exit 1
fi
else
# we might have an embedded fs image to use as rootfs (uncompressed live)
@@ -312,8 +332,8 @@ else
fi
fi
if [ -n "$FSIMG" ] ; then
if [ -n "$writable_fsimg" ] ; then
if [ -n "$FSIMG" ]; then
if [ -n "$writable_fsimg" ]; then
# mount the provided filesystem read/write
echo "Unpacking live filesystem (may take some time)" > /dev/kmsg
mkdir -m 0755 /run/initramfs/fsimg/
@@ -336,9 +356,13 @@ if [ -n "$FSIMG" ] ; then
setup=yes
fi
fi
BASE_LOOPDEV=$(losetup -f --show $opt $FSIMG)
sz=$(blockdev --getsz $BASE_LOOPDEV)
if [ "$setup" == rw ]; then
if [ "$FSIMG" = "$SQUASHED" ]; then
BASE_LOOPDEV=$SQUASHED_LOOPDEV
else
BASE_LOOPDEV=$(losetup -f --show $opt $FSIMG)
sz=$(blockdev --getsz $BASE_LOOPDEV)
fi
if [ "$setup" = rw ]; then
echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create live-rw
else
# Add a DM snapshot or OverlayFS for writes.
@@ -346,8 +370,6 @@ if [ -n "$FSIMG" ] ; then
fi
fi
[ -e "$SQUASHED" ] && [ -z "$overlayfs" ] && umount -l /run/initramfs/squashfs
if [ -b "$OSMIN_LOOPDEV" ]; then
# set up the devicemapper snapshot device, which will merge
# the normal live fs image, and the delta, into a minimzied fs image
@@ -355,7 +377,7 @@ if [ -b "$OSMIN_LOOPDEV" ]; then
fi
if [ -n "$reloadsysrootmountunit" ]; then
> /xor_overlayfs
eval "$reloadsysrootmountunit"
systemctl daemon-reload
fi
@@ -363,33 +385,33 @@ ROOTFLAGS="$(getarg rootflags)"
if [ -n "$overlayfs" ]; then
mkdir -m 0755 /run/rootfsbase
if [ -n "$reset_overlay" ] && [ -L /run/overlayfs ]; then
if [ -n "$reset_overlay" ] && [ -h /run/overlayfs ]; then
ovlfs=$(readlink /run/overlayfs)
info "Resetting the OverlayFS overlay directory."
rm -r -- ${ovlfs}/* ${ovlfs}/.* >/dev/null 2>&1
fi
if [ -n "$readonly_overlay" ]; then
mkdir -m 0755 /run/rootfsbase-r
mount -r $FSIMG /run/rootfsbase-r
mount -t overlay LiveOS_rootfs-r -oro,lowerdir=/run/overlayfs-r:/run/rootfsbase-r /run/rootfsbase
if [ -n "$readonly_overlay" ] && [ -h /run/overlayfs-r ]; then
ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
else
mount -r $FSIMG /run/rootfsbase
ovlfs=lowerdir=/run/rootfsbase
fi
mount -r $FSIMG /run/rootfsbase
if [ -z "$DRACUT_SYSTEMD" ]; then
#FIXME What to link to /dev/root? Is it even needed?
printf 'mount -t overlay LiveOS_rootfs -o%s,%s %s\n' "$ROOTFLAGS" \
'lowerdir=/run/rootfsbase,upperdir=/run/overlayfs,workdir=/run/ovlwork' \
"$ovlfs",upperdir=/run/overlayfs,workdir=/run/ovlwork \
"$NEWROOT" > $hookdir/mount/01-$$-live.sh
fi
else
ln -s /dev/mapper/live-rw /dev/root
if [ -z "$DRACUT_SYSTEMD" ]; then
[ -n "$ROOTFLAGS" ] && ROOTFLAGS="-o $ROOTFLAGS"
printf 'mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > $hookdir/mount/01-$$-live.sh
fi
ln -s $BASE_LOOPDEV /run/rootfsbase
fi
[ -e "$SQUASHED" ] && umount -l /run/initramfs/squashfs
ln -s null /dev/root
need_shutdown
exit 0

View File

@@ -22,7 +22,7 @@ installkernel() {
# called by dracut
install() {
inst_multiple umount dmsetup blkid dd losetup grep blockdev find
inst_multiple umount dmsetup blkid dd losetup blockdev find
inst_multiple -o checkisomd5
inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
inst_hook cmdline 31 "$moddir/parse-iso-scan.sh"

View File

@@ -20,12 +20,12 @@ modprobe -q loop
case "$liveroot" in
live:LABEL=*|LABEL=*) \
root="${root#live:}"
root="$(echo $root | sed 's,/,\\x2f,g')"
root="${root//\//\\x2f}"
root="live:/dev/disk/by-label/${root#LABEL=}"
rootok=1 ;;
live:CDLABEL=*|CDLABEL=*) \
root="${root#live:}"
root="$(echo $root | sed 's,/,\\x2f,g')"
root="${root//\//\\x2f}"
root="live:/dev/disk/by-label/${root#CDLABEL=}"
rootok=1 ;;
live:UUID=*|UUID=*) \
@@ -57,6 +57,6 @@ info "root was $liveroot, is now $root"
# make sure that init doesn't complain
[ -z "$root" ] && root="live"
wait_for_dev -n /run/rootfsbase
wait_for_dev -n /dev/root
return 0

View File

@@ -0,0 +1,194 @@
#!/bin/bash
# called by dracut
#
# Parses depmod configuration and calls instmods for out-of-tree kernel
# modules found. Specifically, kernel modules inside directories that
# come from the following places are included (if these kernel modules
# are present in modules.dep):
# - "search" configuration option;
# - "override" configuration option (matching an exact file name constructed
# by concatenating the provided directory and the kernel module name);
# - "external" configuration option (if "external" is a part of "search"
# configuration).
# (See depmod.d(5) for details.)
#
# This module has the following variables available for configuration:
# - "depmod_modules_dep" - Path to the modules.dep file
# ("$srcmods/modules.dep" by default);
# - "depmod_module_dir" - Directory containing kernel modules ("$srcmods"
# by default);
# - "depmod_configs" - array of depmod configuration paths to parse
# (as supplied to depmod -C, ("/run/depmod.d/"
# "/etc/depmod.d/" "/lib/depmod.d/") by default).
installkernel()
{
: "${depmod_modules_dep:=$srcmods/modules.dep}"
: "${depmod_module_dir:=$srcmods}"
[[ -f "${depmod_modules_dep}" ]] || return 0
# Message printers with custom prefix
local mod_name="kernel-modules-extra"
prinfo() { dinfo " ${mod_name}: $*"; }
prdebug() { ddebug " ${mod_name}: $*"; }
# Escape a string for usage as a part of extended regular expression.
# $1 - string to escape
re_escape() {
printf "%s" "$1" | sed 's/\([.+?^$\/\\|()\[]\|\]\)/\\\0/'
}
local OLDIFS
local cfg
local cfgs=()
local search_list=""
local overrides=()
local external_dirs=()
local e f
## Gathering and sorting configuration file list
[ -n "${depmod_configs[@]-}" ] \
|| depmod_configs=(/run/depmod.d/ /etc/depmod.d/ /lib/depmod.d/)
for cfg in "${depmod_configs[@]}"; do
[ -e "$cfg" ] || {
prdebug "configuration source \"$cfg\" does not exist"
continue
}
# '/' is used as a separator between configuration name and
# configuration path
if [ -d "$cfg" ]; then
for f in "$cfg/"*; do
[[ -e "$f" && ! -d "$f" ]] || {
prdebug "configuration source" \
"\"$cfg\" is ignored" \
"(directory or doesn't exist)"
continue
}
cfgs+=("$(basename "$f")/$f")
done
else
cfgs+=("$(basename "$cfg")/$cfg")
fi
done
OLDIFS="$IFS"
IFS=$'\n'
LANG=C cfgs=($(printf '%s\n' "${cfgs[@]}" \
| sort -u -k1,1 -t '/' | cut -f 2- -d '/'))
IFS="$OLDIFS"
## Parse configurations
for cfg in "${cfgs[@]}"; do
prdebug "parsing configuration file \"$cfg\""
local k v mod kverpat path
while read -r k v; do
case "$k" in
search)
search_list="$search_list $v"
prdebug "$cfg: added \"$v\" to the list of" \
"search directories"
;;
override) # module_name kver_pattern dir
read -r mod kverpat path <<<"$v"
if [[ ! "$mod" || ! "$kverpat" || ! "$path" ]]
then
prinfo "$cfg: ignoring incorrect" \
"override option: \"$k $v\""
continue
fi
if [[ '*' = "$kverpat" \
|| "$kernel" =~ "$kverpat" ]]
then
overrides+=("${path}/${mod}")
prdebug "$cfg: added override" \
"\"${path}/${mod}\""
else
prdebug "$cfg: override \"$v\" is" \
"ignored since \"$kverpat\"" \
"doesn't match \"$kernel\""
fi
;;
external) # kverpat dir
read -r kverpat path <<<"$v"
if [[ ! "$kverpat" || ! "$path" ]]; then
prinfo "$cfg: ignoring incorrect" \
"external option: \"$k $v\""
continue
fi
if [[ '*' = "$kverpat" \
|| "$kernel" =~ "$kverpat" ]]
then
external_dirs+=("$path")
prdebug "$cfg: added external" \
"directory \"$path\""
else
prdebug "$cfg: external directory" \
"\"$path\" is ignored since" \
"\"$kverpat\" doesn't match " \
"\"$kernel\""
fi
;;
'#'*|'') # comments and empty strings
;;
include|make_map_files) # ignored by depmod
;;
*)
prinfo "$cfg: unknown depmod configuration" \
"option \"$k $v\""
;;
esac
done < "$cfg"
done
# "updates built-in" is the default search list
: "${search_list:=updates}"
## Build a list of regular expressions for grepping modules.dep
local pathlist=()
for f in "${overrides[@]}"; do
pathlist+=("^$(re_escape "$f")")
done
for f in $(printf "%s" "$search_list"); do
# Ignoring builtin modules
[ "built-in" != "$f" ] || continue
if [ "external" = "$f" ]; then
for e in "${external_dirs[@]}"; do
pathlist+=("$(re_escape "${e%/}")/[^:]+")
done
fi
pathlist+=("$(re_escape "${f%/}")/[^:]+")
done
## Filter modules.dep, canonicalise the resulting filenames and supply
## them to instmods.
[ 0 -lt "${#pathlist[@]}" ] || return 0
printf "^%s\.ko(\.gz|\.bz2|\.xz)?:\n" "${pathlist[@]}" \
| (LANG=C grep -E -o -f - -- "$depmod_modules_dep" || exit 0) \
| tr -d ':' \
| (cd "$depmod_module_dir" || exit; xargs -r realpath -e --) \
| instmods || return 1
return 0
}

View File

@@ -2,6 +2,20 @@
# called by dracut
installkernel() {
find_kernel_modules_external () {
local _OLDIFS
local external_pattern="^/"
[[ -f "$srcmods/modules.dep" ]] || return 0
_OLDIFS=$IFS
IFS=:
while read a rest; do
[[ $a =~ $external_pattern ]] || continue
printf "%s\n" "$a"
done < "$srcmods/modules.dep"
IFS=$_OLDIFS
}
local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma'
if [[ -z $drivers ]]; then
@@ -11,30 +25,36 @@ installkernel() {
ohci-hcd ohci-pci \
uhci-hcd \
xhci-hcd xhci-pci xhci-plat-hcd \
pinctrl-cherryview \
"=drivers/pinctrl" \
${NULL}
hostonly=$(optional_hostonly) instmods \
"=drivers/hid" \
"=drivers/tty/serial" \
"=drivers/input/serio" \
"=drivers/input/keyboard" \
"=drivers/usb/storage" \
"=drivers/pci/host" \
${NULL}
instmods \
yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \
virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
"=drivers/pcmcia" =ide nvme
"=drivers/pcmcia" =ide nvme vmd nfit
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
# arm/aarch64 specific modules
_blockfuncs+='|dw_mc_probe|dw_mci_pltfm_register'
instmods \
"=drivers/clk" \
"=drivers/dma" \
"=drivers/extcon" \
"=drivers/gpio" \
"=drivers/hwspinlock" \
"=drivers/i2c/busses" \
"=drivers/mfd" \
"=drivers/mmc/core" \
"=drivers/phy" \
"=drivers/power" \
"=drivers/regulator" \
@@ -48,12 +68,14 @@ installkernel() {
"=drivers/usb/misc" \
"=drivers/usb/musb" \
"=drivers/usb/phy" \
"=drivers/scsi/hisi_sas" \
"=drivers/scsi/hisi_sas" \
${NULL}
fi
dracut_instmods -o -s "${_blockfuncs}" "=drivers"
find_kernel_modules_external | instmods
# if not on hostonly mode, install all known filesystems,
# if the required list is not set via the filesystems variable
if ! [[ $hostonly ]]; then

View File

@@ -28,7 +28,7 @@ installkernel() {
=drivers/net/phy \
=drivers/net/team \
=drivers/net/ethernet \
ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net xennet
ecb arc4 bridge stp llc ipv6 bonding 8021q ipvlan macvlan af_packet virtio_net xennet
hostonly="" instmods iscsi_ibft crc32c iscsi_boot_sysfs
}

View File

@@ -43,19 +43,36 @@ GENERATOR_DIR="$2"
[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR"
getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"
[ -e /xor_overlayfs ] && xor_overlayfs="yes"
[ -e /xor_readonly ] && xor_readonly="--readonly"
ROOTFLAGS="$(getarg rootflags)"
{
echo "[Unit]"
echo "Before=initrd-root-fs.target"
echo "[Mount]"
echo "Where=/sysroot"
echo "What=/dev/mapper/live-rw"
[ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
if [ "$overlayfs$xor_overlayfs" = "yes" ]; then
echo "What=LiveOS_rootfs"
if [ "$readonly_overlay$xor_readonly" = "--readonly" ]; then
ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
else
ovlfs=lowerdir=/run/rootfsbase
fi
echo "Options=${ROOTFLAGS},${ovlfs},upperdir=/run/overlayfs,workdir=/run/ovlwork"
echo "Type=overlay"
_dev=LiveOS_rootfs
else
echo "What=/dev/mapper/live-rw"
[ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
_dev=$'dev-mapper-live\\x2drw'
fi
} > "$GENERATOR_DIR"/sysroot.mount
mkdir -p "$GENERATOR_DIR/dev-mapper-live\x2drw.device.d"
mkdir -p "$GENERATOR_DIR/$_dev.device.d"
{
echo "[Unit]"
echo "JobTimeoutSec=3000"
echo "JobRunningTimeoutSec=3000"
} > "$GENERATOR_DIR/dev-mapper-live\x2drw.device.d/timeout.conf"
} > "$GENERATOR_DIR/$_dev.device.d/timeout.conf"

View File

@@ -39,6 +39,9 @@ _md_force_run() {
_offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
if [ -n "$_MD_UUID" ]; then
_MD_UUID=$(str_replace "$_MD_UUID" "-" "")
_MD_UUID=$(str_replace "$_MD_UUID" ":" "")
for _md in /dev/md[0-9_]*; do
[ -b "$_md" ] || continue
_UUID=$(
@@ -50,6 +53,7 @@ _md_force_run() {
)
[ -z "$_UUID" ] && continue
_UUID=$(str_replace "$_UUID" ":" "")
# check if we should handle this device
strstr " $_MD_UUID " " $_UUID " || continue

View File

@@ -4,7 +4,7 @@
check() {
local _rootdev
# No mdadm? No mdraid support.
require_binaries mdadm || return 1
require_binaries mdadm expr || return 1
[[ $hostonly ]] || [[ $mount_needs ]] && {
for dev in "${!host_fs_types[@]}"; do
@@ -65,7 +65,7 @@ cmdline() {
# called by dracut
install() {
local rule rule_path
inst_multiple cat
inst_multiple cat expr
inst_multiple -o mdmon
inst $(command -v partx) /sbin/partx
inst $(command -v mdadm) /sbin/mdadm

View File

@@ -1,6 +1,9 @@
#!/bin/sh
MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
# normalize the uuid
MD_UUID=$(str_replace "$MD_UUID" "-" "")
MD_UUID=$(str_replace "$MD_UUID" ":" "")
if ( ! [ -n "$MD_UUID" ] && ! getargbool 0 rd.auto ) || ! getargbool 1 rd.md -d -n rd_NO_MD; then
info "rd.md=0: removing MD RAID activation"
@@ -12,10 +15,12 @@ else
[ -e "$f" ] || continue
while read line || [ -n "$line" ]; do
if [ "${line%%UUID CHECK}" != "$line" ]; then
for uuid in $MD_UUID; do
printf 'ENV{ID_FS_UUID}=="%s", GOTO="md_uuid_ok"\n' "$(expr substr $uuid 1 8)-$(expr substr $uuid 9 4)-$(expr substr $uuid 13 4)-$(expr substr $uuid 17 4)-$(expr substr $uuid 21 12)"
done;
printf 'IMPORT{program}="/sbin/mdadm --examine --export $tempnode"\n'
for uuid in $MD_UUID; do
printf 'ENV{MD_UUID}=="%s", GOTO="md_uuid_ok"\n' $uuid
printf 'ENV{ID_FS_UUID}=="%s", GOTO="md_uuid_ok"\n' $uuid
printf 'ENV{MD_UUID}=="%s", GOTO="md_uuid_ok"\n' "$(expr substr $uuid 1 8):$(expr substr $uuid 9 8):$(expr substr $uuid 17 8):$(expr substr $uuid 25 8)"
done;
printf 'GOTO="md_end"\n'
printf 'LABEL="md_uuid_ok"\n'
@@ -26,6 +31,7 @@ else
mv "${f}.new" "$f"
done
for uuid in $MD_UUID; do
uuid="$(expr substr $uuid 1 8):$(expr substr $uuid 9 8):$(expr substr $uuid 17 8):$(expr substr $uuid 25 8)"
wait_for_dev "/dev/disk/by-id/md-uuid-${uuid}"
done
fi

View File

@@ -1,53 +0,0 @@
#!/bin/bash
# called by dracut
check() {
return 255
}
# called by dracut
depends() {
echo multipath
return 0
}
# called by dracut
install() {
local _f _allow
is_mpath() {
local _dev=$1
[ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
[[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
return 1
}
majmin_to_mpath_dev() {
local _dev
for i in /dev/mapper/*; do
[[ $i == /dev/mapper/control ]] && continue
_dev=$(get_maj_min $i)
if [ "$_dev" = "$1" ]; then
echo $i
return
fi
done
}
add_hostonly_mpath_conf() {
is_mpath $1 && {
local _dev
_dev=$(majmin_to_mpath_dev $1)
[ -z "$_dev" ] && return
strstr "$_allow" "$_dev" && return
_allow="$_allow --allow $_dev"
}
}
[[ $hostonly ]] && {
for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
[ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
}
}

View File

@@ -7,6 +7,18 @@ is_mpath() {
return 1
}
majmin_to_mpath_dev() {
local _dev
for i in /dev/mapper/*; do
[[ $i == /dev/mapper/control ]] && continue
_dev=$(get_maj_min $i)
if [ "$_dev" = "$1" ]; then
echo $i
return
fi
done
}
# called by dracut
check() {
local _rootdev
@@ -55,6 +67,17 @@ installkernel() {
install() {
local _f _allow
add_hostonly_mpath_conf() {
is_mpath $1 && {
local _dev
_dev=$(majmin_to_mpath_dev $1)
[ -z "$_dev" ] && return
strstr "$_allow" "$_dev" && return
_allow="$_allow --allow $_dev"
}
}
inst_multiple -o \
dmsetup \
kpartx \
@@ -69,6 +92,11 @@ install() {
/etc/multipath/* \
/etc/multipath/conf.d/*
[[ $hostonly ]] && [[ $hostonly_mode = "strict" ]] && {
for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
[ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
}
inst $(command -v partx) /sbin/partx
inst_libdir_file "libmultipath*" "multipath/*"

View File

@@ -1,7 +1,7 @@
#!/bin/bash
for i in $(multipath -l -v1); do
if ! $(dmsetup table $i | sed -n '/.*queue_if_no_path.*/q1') ; then
if ! dmsetup table $i | sed -n '/.*queue_if_no_path.*/q1' ; then
dmsetup message $i 0 fail_if_no_path
fi
done

View File

@@ -0,0 +1,34 @@
#!/bin/bash
# called by dracut
check() {
require_binaries stratisd-init thin_check thin_repair mkfs.xfs xfs_admin xfs_growfs || return 1
return 255
}
# called by dracut
depends() {
echo dm
return 0
}
# called by dracut
installkernel() {
instmods xfs
}
# called by dracut
install() {
inst_multiple stratisd-init thin_check thin_repair mkfs.xfs xfs_admin xfs_growfs
if dracut_module_included "systemd"; then
inst_simple "${moddir}/stratisd-init.service" "${systemdsystemunitdir}/stratisd-init.service"
mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.wants"
ln -rfs "${initdir}${systemdsystemunitdir}/stratisd-init.service" "${initdir}${systemdsystemunitdir}/sysinit.target.wants/stratisd-init.service"
else
inst_hook cmdline 25 "$moddir/stratisd-start.sh"
inst_hook cleanup 25 "$moddir/stratisd-stop.sh"
fi
}

View File

@@ -0,0 +1,15 @@
[Unit]
Description=A daemon that manages a pool of block devices to create flexible file systems
Documentation=man:stratisd(8)
Before=local-fs-pre.target
DefaultDependencies=no
[Service]
Type=simple
ExecStart=/sbin/stratisd-init --debug
KillSignal=SIGINT
StandardOutput=syslog
StandardError=syslog
[Install]
WantedBy=sysinit.target

View File

@@ -0,0 +1,3 @@
#!/bin/sh
stratisd-init --debug > /dev/kmsg 2>&1 &

View File

@@ -0,0 +1,6 @@
#!/bin/sh
[ -f /lib/dracut-lib.sh ] && . /lib/dracut-lib.sh
pid=$(pidof stratisd-init)
[ -n "$pid" ] && kill ${pid}

0
modules.d/95fcoe/cleanup-fcoe.sh Normal file → Executable file
View File

View File

@@ -1,4 +1,4 @@
#!/bin/sh
[ -e /sys/module/bnx2i ] && killproc iscsiuio
[ -z "${DRACUT_SYSTEMD}" ] && [ -e /sys/module/bnx2i ] && killproc iscsiuio

View File

@@ -36,31 +36,45 @@ iroot=${iroot#:}
# figured out a way how to check whether this is built-in or not
modprobe crc32c 2>/dev/null
if [ -e /sys/module/bnx2i ] && ! [ -e /tmp/iscsiuio-started ]; then
if [ -z "${DRACUT_SYSTEMD}" ] && [ -e /sys/module/bnx2i ] && ! [ -e /tmp/iscsiuio-started ]; then
iscsiuio
> /tmp/iscsiuio-started
fi
handle_firmware()
{
if ! iscsistart-flocked -f; then
warn "iscistart: Could not get list of targets from firmware. Skipping."
echo 'skipped' > "/tmp/iscsistarted-firmware"
return 0
local ifaces retry
# Depending on the 'ql4xdisablesysfsboot' qla4xxx
# will be autostarting sessions without presenting
# them via the firmware interface.
# In these cases 'iscsiadm -m fw' will fail, but
# the iSCSI sessions will still be present.
if ! iscsiadm -m fw; then
warn "iscsiadm: Could not get list of targets from firmware."
else
ifaces=( $(echo /sys/firmware/ibft/ethernet*) )
retry=$(cat /tmp/session-retry)
if [ $retry -lt ${#ifaces[*]} ]; then
let retry++
echo $retry > /tmp/session-retry
return 1
else
rm /tmp/session-retry
fi
if ! iscsiadm -m fw -l; then
warn "iscsiadm: Log-in to iscsi target failed"
else
need_shutdown
fi
fi
for p in $(getargs rd.iscsi.param -d iscsi_param); do
iscsi_param="$iscsi_param --param $p"
done
if ! iscsistart-flocked -b $iscsi_param; then
warn "'iscsistart -b $iscsi_param' failed with return code $?"
fi
[ -d /sys/class/iscsi_session ] || return 1
echo 'started' > "/tmp/iscsistarted-iscsi:"
echo 'started' > "/tmp/iscsistarted-firmware"
need_shutdown
return 0
}
@@ -72,13 +86,13 @@ handle_netroot()
local iscsi_username iscsi_password
local iscsi_in_username iscsi_in_password
local iscsi_iface_name iscsi_netdev_name
local iscsi_param
local iscsi_param param
local p
# override conf settings by command line options
arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=)
[ -n "$arg" ] && iscsi_initiator=$arg
arg=$(getarg rd.iscsi.target.name -d iscsi_target_name=)
arg=$(getargs rd.iscsi.target.name -d iscsi_target_name=)
[ -n "$arg" ] && iscsi_target_name=$arg
arg=$(getarg rd.iscsi.target.ip -d iscsi_target_ip)
[ -n "$arg" ] && iscsi_target_ip=$arg
@@ -95,7 +109,7 @@ handle_netroot()
arg=$(getarg rd.iscsi.in.password -d iscsi_in_password=)
[ -n "$arg" ] && iscsi_in_password=$arg
for p in $(getargs rd.iscsi.param -d iscsi_param); do
iscsi_param="$iscsi_param --param $p"
iscsi_param="$iscsi_param $p"
done
parse_iscsi_root "$1" || return 1
@@ -105,6 +119,17 @@ handle_netroot()
ip route get "$iscsi_target_ip" >/dev/null 2>&1 || return 0
fi
#limit iscsistart login retries
case "$iscsi_param" in
*node.session.initial_login_retry_max*) ;;
*)
retries=$(getargnum 3 0 10000 rd.iscsi.login_retry_max)
if [ $retries -gt 0 ]; then
iscsi_param="${iscsi_param% } node.session.initial_login_retry_max=$retries"
fi
;;
esac
# XXX is this needed?
getarg ro && iscsirw=ro
getarg rw && iscsirw=rw
@@ -117,6 +142,11 @@ handle_netroot()
mkdir -p /etc/iscsi
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
> /tmp/iscsi_set_initiator
if [ -n "$DRACUT_SYSTEMD" ]; then
systemctl try-restart iscsid
# FIXME: iscsid is not yet ready, when the service is :-/
sleep 1
fi
fi
if [ -z "$iscsi_initiator" ]; then
@@ -133,6 +163,11 @@ handle_netroot()
mkdir -p /etc/iscsi
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
> /tmp/iscsi_set_initiator
if [ -n "$DRACUT_SYSTEMD" ]; then
systemctl try-restart iscsid
# FIXME: iscsid is not yet ready, when the service is :-/
sleep 1
fi
fi
@@ -153,7 +188,18 @@ handle_netroot()
if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then
mkdir -p /etc/iscsi
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
if [ -n "$DRACUT_SYSTEMD" ]; then
systemctl try-restart iscsid
# FIXME: iscsid is not yet ready, when the service is :-/
sleep 1
fi
fi
if [ -z "$DRACUT_SYSTEMD" ]; then
iscsid
sleep 2
fi
# FIXME $iscsi_protocol??
if [ "$root" = "dhcp" ] || [ "$netroot" = "dhcp" ]; then
@@ -168,46 +214,40 @@ handle_netroot()
echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
fi
if [ -n "$DRACUT_SYSTEMD" ] && command -v systemd-run >/dev/null 2>&1; then
netroot_enc=$(systemd-escape "iscsistart_${1}")
status=$(systemctl is-active "$netroot_enc" 2>/dev/null)
is_active=$?
if [ $is_active -ne 0 ]; then
if [ "$status" != "activating" ] && ! systemctl is-failed "$netroot_enc" >/dev/null 2>&1; then
systemd-run --no-block --service-type=oneshot --remain-after-exit --quiet \
--description="Login iSCSI Target $iscsi_target_name" \
-p 'DefaultDependencies=no' \
--unit="$netroot_enc" -- \
$(command -v iscsistart-flocked) \
-i "$iscsi_initiator" -t "$iscsi_target_name" \
-g "$iscsi_target_group" -a "$iscsi_target_ip" \
-p "$iscsi_target_port" \
${iscsi_username:+-u "$iscsi_username"} \
${iscsi_password:+-w "$iscsi_password"} \
${iscsi_in_username:+-U "$iscsi_in_username"} \
${iscsi_in_password:+-W "$iscsi_in_password"} \
${iscsi_iface_name:+--param "iface.iscsi_ifacename=$iscsi_iface_name"} \
${iscsi_netdev_name:+--param "iface.net_ifacename=$iscsi_netdev_name"} \
${iscsi_param} >/dev/null 2>&1 \
&& { > $hookdir/initqueue/work ; }
else
systemctl --no-block restart "$netroot_enc" >/dev/null 2>&1 \
&& { > $hookdir/initqueue/work ; }
targets=$(iscsiadm -m discovery -t st -p $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/')
[ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1
for target in $iscsi_target_name; do
case "$targets" in
*$target*)
EXTRA=""
if [ -n "$iscsi_iface_name" ]; then
iscsiadm -m iface -I $iscsi_iface_name --op=new
EXTRA=" ${iscsi_netdev_name:+--name=iface.net_ifacename --value=$iscsi_netdev_name} "
EXTRA="$EXTRA ${iscsi_initiator:+--name=iface.initiatorname --value=$iscsi_initiator} "
fi
fi
else
iscsistart-flocked -i "$iscsi_initiator" -t "$iscsi_target_name" \
-g "$iscsi_target_group" -a "$iscsi_target_ip" \
-p "$iscsi_target_port" \
${iscsi_username:+-u "$iscsi_username"} \
${iscsi_password:+-w "$iscsi_password"} \
${iscsi_in_username:+-U "$iscsi_in_username"} \
${iscsi_in_password:+-W "$iscsi_in_password"} \
${iscsi_iface_name:+--param "iface.iscsi_ifacename=$iscsi_iface_name"} \
${iscsi_netdev_name:+--param "iface.net_ifacename=$iscsi_netdev_name"} \
${iscsi_param} \
&& { > $hookdir/initqueue/work ; }
fi
[ -n "$iscsi_param" ] && for param in $iscsi_param; do EXTRA="$EXTRA --name=${param%=*} --value=${param#*=}"; done
iscsiadm -m node -T $target \
${iscsi_iface_name:+-I $iscsi_iface_name} \
-p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port} \
--op=update \
--name=node.startup --value=onboot \
${iscsi_username:+ --name=node.session.auth.username --value=$iscsi_username} \
${iscsi_password:+ --name=node.session.auth.password --value=$iscsi_password} \
${iscsi_in_username:+--name=node.session.auth.username_in --value=$iscsi_in_username} \
${iscsi_in_password:+--name=node.session.auth.password_in --value=$iscsi_in_password} \
$EXTRA \
$NULL
;;
*)
;;
esac
done
iscsiadm -m node -L onboot || :
> $hookdir/initqueue/work
netroot_enc=$(str_replace "$1" '/' '\2f')
echo 'started' > "/tmp/iscsistarted-iscsi:${netroot_enc}"
return 0
@@ -215,12 +255,21 @@ handle_netroot()
ret=0
if [ "$netif" != "timeout" ] && getargbool 1 rd.iscsi.waitnet; then
if [ "$netif" != "timeout" ] && getargbool 0 rd.iscsi.waitnet; then
all_ifaces_setup || exit 0
fi
if [ "$netif" = "timeout" ] && all_ifaces_setup; then
# s.th. went wrong and the timeout script hits
# restart
systemctl restart iscsid
# damn iscsid is not ready after unit says it's ready
sleep 2
fi
if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
if [ "$netif" = "timeout" ] || [ "$netif" = "online" ]; then
if [ "$netif" = "timeout" ] || [ "$netif" = "online" ] || [ "$netif" = "dummy" ]; then
[ -f /tmp/session-retry ] || echo 1 > /tmp/session-retry
handle_firmware
ret=$?
fi

View File

@@ -1,5 +0,0 @@
#!/bin/sh
{
flock -e 9
iscsistart "$@"
} 9>/tmp/.iscsi_lock

View File

@@ -4,7 +4,7 @@
check() {
local _rootdev
# If our prerequisites are not met, fail anyways.
require_binaries iscsistart hostname iscsi-iname || return 1
require_binaries hostname iscsi-iname iscsiadm iscsid || return 1
# If hostonly was requested, fail the check if we are not actually
# booting from root.
@@ -61,7 +61,7 @@ install_ibft() {
fi
if [ -d ${d}/initiator ] ; then
if [ ${d##*/} = "ibft" ] && [ "$ibft_mod" != "bnx2i" ] ; then
echo -n "ip=ibft "
echo -n "rd.iscsi.ibft=1 "
fi
echo -n "rd.iscsi.firmware=1"
fi
@@ -70,7 +70,7 @@ install_ibft() {
install_iscsiroot() {
local devpath=$1
local scsi_path iscsi_lun session c d conn
local scsi_path iscsi_lun session c d conn host flash
local iscsi_session iscsi_address iscsi_port iscsi_targetname iscsi_tpgt
scsi_path=${devpath%%/block*}
@@ -81,6 +81,19 @@ install_iscsiroot() {
[ "$session" = "$devpath" ] && return 1
iscsi_session=${session##*/}
[ "$iscsi_session" = "$session" ] && return 1
host=${session%%/session*}
[ "$host" = "$session" ] && return 1
iscsi_host=${host##*/}
for flash in ${host}/flashnode_sess-* ; do
is_boot=$(cat $flash/is_boot_target)
if [ $is_boot -eq 1 ] ; then
# qla4xxx flashnode session; skip iBFT discovery
iscsi_initiator=$(cat /sys/class/iscsi_host/${iscsi_host}/initiatorname)
echo "rd.iscsi.initiator=${iscsi_initiator}"
return;
fi
done
for d in ${session}/* ; do
case $d in
@@ -104,7 +117,14 @@ install_iscsiroot() {
[ -z "$iscsi_address" ] && return
local_address=$(ip -o route get to $iscsi_address | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
ifname=$(ip -o route get to $iscsi_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
printf 'ip=%s:static ' ${ifname}
#follow ifcfg settings for boot protocol
bootproto=$(sed -n "/BOOTPROTO/s/BOOTPROTO='\([[:alpha:]]*6\?\)4\?'/\1/p" /etc/sysconfig/network/ifcfg-$ifname)
if [ $bootproto ]; then
printf 'ip=%s:%s ' ${ifname} ${bootproto}
else
printf 'ip=%s:static ' ${ifname}
fi
if [ -e /sys/class/net/$ifname/address ] ; then
ifmac=$(cat /sys/class/net/$ifname/address)
@@ -128,6 +148,7 @@ install_iscsiroot() {
# can sort out rd.iscsi.initiator= duplicates
echo "rd.iscsi.initiator=${iscsi_initiator}"
echo "netroot=iscsi:${iscsi_address}::${iscsi_port}:${iscsi_lun}:${iscsi_targetname}"
echo "rd.neednet=1"
fi
return 0
}
@@ -159,15 +180,14 @@ installkernel() {
local _arch=$(uname -m)
local _funcs='iscsi_register_transport'
instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi
instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi qedi
hostonly="" instmods iscsi_tcp iscsi_ibft crc32c iscsi_boot_sysfs
if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then
_s390drivers="=drivers/s390/scsi"
fi
dracut_instmods -o -s "$_funcs" "=drivers/scsi" ${_s390drivers:+"$_s390drivers"}
dracut_instmods -o -s ${_funcs} =drivers/scsi ${_s390drivers:+"$_s390drivers"}
}
# called by dracut
@@ -184,9 +204,23 @@ cmdline() {
# called by dracut
install() {
inst_multiple umount iscsistart hostname iscsi-iname
inst_multiple -o iscsiuio
inst_libdir_file 'libgcc_s.so*'
inst_multiple umount hostname iscsi-iname iscsiadm iscsid
inst_multiple -o \
$systemdsystemunitdir/iscsid.socket \
$systemdsystemunitdir/iscsid.service \
$systemdsystemunitdir/iscsiuio.service \
$systemdsystemunitdir/iscsiuio.socket \
$systemdsystemunitdir/sockets.target.wants/iscsid.socket \
$systemdsystemunitdir/sockets.target.wants/iscsiuio.socket
if [[ $hostonly ]]; then
inst_dir $(/usr/bin/find /etc/iscsi)
else
inst_simple /etc/iscsi/iscsid.conf
fi
# Detect iBFT and perform mandatory steps
if [[ $hostonly_cmdline == "yes" ]] ; then
@@ -194,12 +228,43 @@ install() {
[[ $_iscsiconf ]] && printf "%s\n" "$_iscsiconf" >> "${initdir}/etc/cmdline.d/95iscsi.conf"
fi
inst "$moddir/iscsistart-flocked.sh" "/bin/iscsistart-flocked"
inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
if ! dracut_module_included "systemd"; then
inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
else
inst_multiple -o \
$systemdsystemunitdir/iscsi.service \
$systemdsystemunitdir/iscsid.service \
$systemdsystemunitdir/iscsid.socket \
$systemdsystemunitdir/iscsiuio.service \
$systemdsystemunitdir/iscsiuio.socket \
iscsiadm iscsid
mkdir -p "${initdir}/$systemdsystemunitdir/sockets.target.wants"
for i in \
iscsid.socket \
iscsiuio.socket \
; do
ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/sockets.target.wants/${i}"
done
mkdir -p "${initdir}/$systemdsystemunitdir/basic.target.wants"
for i in \
iscsid.service \
iscsiuio.service \
; do
ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/basic.target.wants/${i}"
done
# Make sure iscsid is started after dracut-cmdline and ready for the initqueue
mkdir -p "${initdir}/$systemdsystemunitdir/iscsid.service.d"
(
echo "[Unit]"
echo "After=dracut-cmdline.service"
echo "Before=dracut-initqueue.service"
) > "${initdir}/$systemdsystemunitdir/iscsid.service.d/dracut.conf"
fi
inst_dir /var/lib/iscsi
dracut_need_initqueue

View File

@@ -90,19 +90,13 @@ if [ -n "$iscsi_firmware" ]; then
initqueue --unique --onetime --settled /sbin/iscsiroot online "iscsi:" "'$NEWROOT'"
fi
if [ -z "$netroot" ] || ! [ "${netroot%%:*}" = "iscsi" ]; then
return 1
fi
initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT"
initqueue --onetime modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi
# ISCSI actually supported?
if ! [ -e /sys/module/iscsi_tcp ]; then
modprobe -b -q iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi"
fi
modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi
if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
if ! getargbool 1 rd.neednet >/dev/null || ! getarg "ip="; then
initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
@@ -116,6 +110,11 @@ if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ] && ! [
if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then
mkdir -p /etc/iscsi
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
if [ -n "$DRACUT_SYSTEMD" ]; then
systemctl try-restart iscsid
# FIXME: iscsid is not yet ready, when the service is :-/
sleep 1
fi
fi
fi
@@ -128,9 +127,19 @@ if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ]
mkdir -p /etc/iscsi
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
> /tmp/iscsi_set_initiator
if [ -n "$DRACUT_SYSTEMD" ]; then
systemctl try-restart iscsid
# FIXME: iscsid is not yet ready, when the service is :-/
sleep 1
fi
fi
fi
if [ -z "$netroot" ] || ! [ "${netroot%%:*}" = "iscsi" ]; then
return 1
fi
initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT"
for nroot in $(getargs netroot); do
[ "${nroot%%:*}" = "iscsi" ] || continue

View File

@@ -0,0 +1,59 @@
#!/bin/bash
# called by dracut
check() {
local _arch=$(uname -m)
local _online=0
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
require_binaries /usr/lib/udev/collect || return 1
dracut_module_included network || return 1
[[ $hostonly ]] && {
for i in /sys/devices/qeth/*/online; do
read _online < $i
[ $_online -eq 1 ] && return 0
done
}
return 255
}
# called by dracut
installkernel() {
instmods qeth
}
# called by dracut
install() {
ccwid() {
qeth_path=$(readlink -e -q $1/device)
basename "$qeth_path"
}
inst_rules_qeth() {
for rule in /etc/udev/rules.d/{4,5}1-qeth-${1}.rules; do
# prefer chzdev generated 41- rules
if [ -f "$rule" ]; then
inst_rules "$rule"
break
fi
done
}
has_carrier() {
carrier=0
# not readable in qeth interfaces
# that have just been assembled, ignore
# read error and assume no carrier
read carrier 2>/dev/null < "$1/carrier"
[ "$carrier" -eq 1 ] && return 0
return 1;
}
for dev in /sys/class/net/*; do
has_carrier $dev || continue
id=$(ccwid $dev)
[ -n "$id" ] && inst_rules_qeth $id
done
inst_simple /usr/lib/udev/collect
}

View File

@@ -7,6 +7,8 @@ Description=dracut ask for additional cmdline parameters
DefaultDependencies=no
Before=dracut-cmdline.service
After=systemd-journald.socket
After=systemd-vconsole-setup.service
Requires=systemd-vconsole-setup.service
Wants=systemd-journald.socket
ConditionPathExists=/usr/lib/initrd-release
ConditionKernelCommandLine=|rd.cmdline=ask

View File

@@ -76,8 +76,8 @@ load_evm_x509()
return 1
fi
local evm_pubid
local line=$(keyctl describe %keyring:.evm)
local evm_pubid line
line=$(keyctl describe %keyring:.evm)
if [ $? -eq 0 ]; then
# the kernel already setup a trusted .evm keyring so use that one
evm_pubid=${line%%:*}

View File

@@ -15,7 +15,7 @@ detect_syslog() {
syslogtype="rsyslogd"
elif [ -e /sbin/syslogd ]; then
syslogtype="syslogd"
elif [ /sbin/syslog-ng ]; then
elif [ -e /sbin/syslog-ng ]; then
syslogtype="syslog-ng"
else
warn "Could not find any syslog binary although the syslogmodule is selected to be installed. Please check."

View File

@@ -118,6 +118,7 @@ str_replace() {
killall_proc_mountpoint() {
local _pid
local _t
local _killed=0
for _pid in /proc/*; do
_pid=${_pid##/proc/}
case $_pid in
@@ -125,8 +126,12 @@ killall_proc_mountpoint() {
esac
[ -e "/proc/$_pid/exe" ] || continue
[ -e "/proc/$_pid/root" ] || continue
strstr "$(ls -l -- "/proc/$_pid" "/proc/$_pid/fd" 2>/dev/null)" "$1" && kill -9 "$_pid"
if strstr "$(ls -l -- "/proc/$_pid" "/proc/$_pid/fd" 2>/dev/null)" "$1" ; then
kill -9 "$_pid"
_killed=1
fi
done
return $_killed
}
getcmdline() {
@@ -1055,7 +1060,7 @@ if ! command -v pidof >/dev/null 2>/dev/null; then
debug_on
return 1
fi
_exe=$(type -P "$1")
_exe=$(command -v "$1")
for i in /proc/*/exe; do
[ -e "$i" ] || continue
if [ -n "$_exe" ]; then

View File

@@ -63,13 +63,12 @@ install() {
echo ro >> "${initdir}/etc/cmdline.d/base.conf"
fi
local VERSION=""
local PRETTY_NAME=""
if [ -e /etc/os-release ]; then
. /etc/os-release
VERSION+=" "
PRETTY_NAME+=" "
else
VERSION=""
PRETTY_NAME=""
[[ -n ${VERSION} ]] && VERSION+=" "
[[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" "
fi
NAME=dracut
ID=dracut
@@ -94,6 +93,9 @@ install() {
## save host_devs which we need bring up
if [[ $hostonly_cmdline == "yes" ]]; then
if [[ -n $add_device ]]; then
dracut_need_initqueue
fi
if [[ -f "$initdir/lib/dracut/need-initqueue" ]] || ! dracut_module_included "systemd"; then
(
if dracut_module_included "systemd"; then

View File

@@ -6,18 +6,18 @@ echo 'Generating "/run/initramfs/rdsosreport.txt"'
exec >/run/initramfs/rdsosreport.txt 2>&1
PWFILTER='s/\(ftp:\/\/.*\):.*@/\1:*******@/g;s/\(cifs:\/\/.*\):.*@/\1:*******@/g;s/cifspass=[^ ]*/cifspass=*******/g;s/iscsi:.*@/iscsi:******@/g;s/rd.iscsi.password=[^ ]*/rd.iscsi.password=******/g;s/rd.iscsi.in.password=[^ ]*/rd.iscsi.in.password=******/g'
set -x
cat /lib/dracut/dracut-*
cat /proc/cmdline
cat /proc/cmdline | sed -e "$PWFILTER"
[ -f /etc/cmdline ] && cat /etc/cmdline
[ -f /etc/cmdline ] && cat /etc/cmdline | sed -e "$PWFILTER"
for _i in /etc/cmdline.d/*.conf; do
[ -f "$_i" ] || break
echo $_i
cat $_i
cat $_i | sed -e "$PWFILTER"
done
cat /proc/self/mountinfo
@@ -31,7 +31,7 @@ ls -l /dev/disk/by*
for _i in /etc/conf.d/*.conf; do
[ -f "$_i" ] || break
echo $_i
cat $_i
cat $_i | sed -e "$PWFILTER"
done
if command -v lvm >/dev/null 2>/dev/null; then
@@ -47,9 +47,9 @@ cat /proc/mdstat
command -v ip >/dev/null 2>/dev/null && ip addr
if command -v journalctl >/dev/null 2>/dev/null; then
journalctl -ab --no-pager -o short-monotonic
journalctl -ab --no-pager -o short-monotonic | sed -e "$PWFILTER"
else
dmesg
[ -f /run/initramfs/init.log ] && cat /run/initramfs/init.log
dmesg | sed -e "$PWFILTER"
[ -f /run/initramfs/init.log ] && cat /run/initramfs/init.log | sed -e "$PWFILTER"
fi

View File

@@ -15,14 +15,11 @@ echo_fs_helper() {
local dev=$1 fs=$2
case "$fs" in
xfs)
echo -n " xfs_db xfs_repair xfs_check xfs_metadump"
echo -n " xfs_db xfs_repair xfs_check xfs_metadump "
;;
ext?)
echo -n " e2fsck "
;;
f2fs)
echo -n " fsck.f2fs "
;;
jfs)
echo -n " jfs_fsck "
;;
@@ -41,7 +38,7 @@ echo_fs_helper() {
include_fs_helper_modules() {
local dev=$1 fs=$2
case "$fs" in
xfs|btrfs)
xfs|btrfs|ext4)
instmods crc32c
;;
f2fs)
@@ -52,12 +49,12 @@ include_fs_helper_modules() {
# called by dracut
installkernel() {
# xfs and btrfs needs crc32c...
# xfs/btrfs/ext4 need crc32c, f2fs needs crc32
if [[ $hostonly ]]; then
for_each_host_dev_fs include_fs_helper_modules
:
else
instmods crc32c
instmods crc32c crc32
fi
}
@@ -74,7 +71,7 @@ install() {
_helpers="\
umount mount /sbin/fsck*
xfs_db xfs_check xfs_repair xfs_metadump
e2fsck fsck.f2fs jfs_fsck reiserfsck btrfsck
e2fsck jfs_fsck reiserfsck btrfsck
"
if [[ $hostonly ]]; then
_helpers="umount mount "
@@ -84,7 +81,7 @@ install() {
_helpers="$fscks"
fi
if [[ "$_helpers" == *e2fsck* ]] && [ -e /etc/e2fsck.conf ]; then
if [[ "$_helpers" == *e2fsck* ]] && [ -e /etc/e2fsck.conf ]; then
inst_simple /etc/e2fsck.conf
fi

View File

@@ -8,7 +8,7 @@
# works with stdin if $1 is not set.
det_archive() {
# NOTE: echo -e works in ash and bash, but not dash
local bz="BZh" xz="$(echo -e '\xfd7zXZ')" gz="$(echo -e '\x1f\x8b')" zs="$(echo -e '0xFD2FB528')"
local bz="BZh" xz="$(echo -e '\xfd7zXZ')" gz="$(echo -e '\x1f\x8b')" zs="$(echo -e '\x28\xB5\x2F\xFD')"
local headerblock="$(dd ${1:+if=$1} bs=262 count=1 2>/dev/null)"
case "$headerblock" in
$xz*) echo "xz" ;;

View File

@@ -14,7 +14,7 @@ depends() {
# called by dracut
install() {
local _d
inst_multiple umount poweroff reboot halt losetup stat
inst_multiple umount poweroff reboot halt losetup stat sleep
inst_multiple -o kexec
inst "$moddir/shutdown.sh" "$prefix/shutdown"
[ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib

View File

@@ -38,7 +38,7 @@ source_hook pre-shutdown
warn "Killing all remaining processes"
killall_proc_mountpoint /oldroot
killall_proc_mountpoint /oldroot || sleep 0.2
umount_a() {
local _did_umount="n"

View File

@@ -0,0 +1,9 @@
#!/bin/sh
SQUASH_MNT_REC=/squash/mounts
SQUASH_MNTS=( )
while read mnt; do
SQUASH_MNTS+=( "$mnt" )
done <<< "$(cat $SQUASH_MNT_REC)"
umount --lazy -- ${SQUASH_MNTS[@]}

7
modules.d/99squash/init.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
/squash/setup-squash.sh
exec /init.stock
echo "Something went wrong when trying to start original init executable!"
exit 1

View File

@@ -0,0 +1,29 @@
#!/bin/bash
check() {
return 255
}
depends() {
echo "bash systemd systemd-initrd"
return 0
}
installkernel() {
hostonly="" instmods squashfs loop overlay
}
install() {
if ! type -P mksquashfs >/dev/null || ! type -P unsquashfs >/dev/null ; then
derror "squash module requires squashfs-tools to be installed."
return 1
fi
inst_multiple kmod modprobe mount mkdir ln echo
inst $moddir/setup-squash.sh /squash/setup-squash.sh
inst $moddir/clear-squash.sh /squash/clear-squash.sh
inst $moddir/init.sh /squash/init.sh
inst "$moddir/squash-mnt-clear.service" "$systemdsystemunitdir/squash-mnt-clear.service"
ln_r "$systemdsystemunitdir/squash-mnt-clear.service" "$systemdsystemunitdir/initrd.target.wants/squash-mnt-clear.service"
}

View File

@@ -0,0 +1,61 @@
#!/bin/sh
PATH=/bin:/sbin
SQUASH_IMG=/squash/root.img
SQUASH_MNT=/squash/root
SQUASH_MNT_REC=/squash/mounts
SQUASHED_MNT="usr etc"
echo $SQUASH_MNT > $SQUASH_MNT_REC
# Following mount points are neccessary for mounting a squash image
[ ! -d /proc/self ] && \
mount -t proc -o nosuid,noexec,nodev proc /proc
[ ! -d /sys/kernel ] && \
mount -t sysfs -o nosuid,noexec,nodev sysfs /sys
[ ! -e /dev/loop-control ] && \
mount -t devtmpfs -o mode=0755,noexec,nosuid,strictatime devtmpfs /dev
# Need a loop device backend, overlayfs, and squashfs module
modprobe loop
if [ $? != 0 ]; then
echo "Unable to setup loop module"
fi
modprobe squashfs
if [ $? != 0 ]; then
echo "Unable to setup squashfs module"
fi
modprobe overlay
if [ $? != 0 ]; then
echo "Unable to setup overlay module"
fi
[ ! -d "$SQUASH_MNT" ] && \
mkdir -m 0755 -p $SQUASH_MNT
# Mount the squashfs image
mount -t squashfs -o ro,loop $SQUASH_IMG $SQUASH_MNT
if [ $? != 0 ]; then
echo "Unable to mount squashed initramfs image"
fi
for file in $SQUASHED_MNT; do
lowerdir=$SQUASH_MNT/$file
workdir=/squash/overlay-work/$file
upperdir=/$file
mntdir=/$file
mkdir -m 0755 -p $workdir
mkdir -m 0755 -p $mntdir
mount -t overlay overlay -o\
lowerdir=$lowerdir,upperdir=$upperdir,workdir=$workdir $mntdir
echo $mntdir >> $SQUASH_MNT_REC
done

7
modules.d/99squash/shutdown.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
/squash/setup-squash.sh
exec /shutdown.stock
echo "Something went wrong when trying to start original shutdown executable!"
exit 1

Some files were not shown because too many files have changed in this diff Show More