Compare commits

..

111 Commits
041 ... 042

Author SHA1 Message Date
Harald Hoyer
04bf862d97 NEWS & AUTHORS update - 042 2015-06-11 17:39:47 +02:00
Harald Hoyer
3f979ee495 TODO: update 2015-06-11 17:39:47 +02:00
Harald Hoyer
3944c4b136 TEST-16-DMSQUASH: add more debug parms 2015-06-11 17:39:47 +02:00
Harald Hoyer
97ff396a97 run-qemu: default kernel to "/lib/modules/${KVERSION}/vmlinuz"
newer Fedora kernel install the kernel to /lib/modules
2015-06-11 17:39:47 +02:00
Harald Hoyer
8ff624df9f dmsquash-live: install a sysroot.mount generator for systemd
otherwise systemd uses its own sysroot.mount line
2015-06-11 17:39:31 +02:00
Harald Hoyer
5711f54312 crypt: check for crypttab before reading 2015-06-09 15:05:32 +02:00
Harald Hoyer
c3cdd9f6e1 udev-rules: add 60-block.rules 2015-06-09 15:05:32 +02:00
Harald Hoyer
1339095dba dracut-functions.sh: only honor the first [0-9]+<module> dir
If multiple directories with different numbers exist, only honor the
first one.
2015-06-09 15:05:32 +02:00
Harald Hoyer
4358ace43c fixup test suite
- qemu wants to have "format=raw"
- "-kernel" is obsolete, because run-qemu picks the right path
2015-06-09 13:36:46 +02:00
Harald Hoyer
8b52e96f09 dracut.conf.5.asc: document "compress" 2015-06-09 12:30:14 +02:00
Harald Hoyer
0ad2471c3a dracut.conf.5.asc: add missing "=" 2015-06-05 12:59:58 +02:00
Christian Rodrigues
b52cfbeaa5 Correct paths for openSUSE
openSUSE has things stored in different places, so fixup the
paths here.

Signed-off-by: Christian Rodrigues <crrodriguez@opensuse.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2015-06-02 12:24:59 +02:00
Hannes Reinecke
6755c20855 95fcoe-uefi: Test for EFI firmware
The fcoe-uefi module should test for EFI firmware when called
in 'hostonly' mode; of no EFI firmware is found then the module
doesn't need to be included.

References: bnc#882412

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2015-06-02 12:24:58 +02:00
Cristian Rodríguez
7c433a0b43 systemd: include systemd-random-seed.service
In current systemd releases there is no random-seed-load service
only systemd-random-seed.service
2015-06-02 12:06:49 +02:00
Jan Synacek
d5e5855b74 doc: fix typo 2015-06-02 12:05:21 +02:00
Harald Hoyer
3b1d78880f Merge pull request #58 from dracut-mailing-devs/20150326044148.10121.15286.stgit@notabene.brown
mdraid fixes
2015-06-02 12:04:51 +02:00
NeilBrown
4d9d767da2 crypt/parse-crypt.sh: hide encrypted devices from systemd timeout warnings.
When systemd's crypttab generator parsed crypttab, it tells
systemd about several devices which may not appear until later
in the boot sequence, and which are not needed while dract is running.

This can particularly happen when an md array is encrypted,
and the array is newly degraded so that it doesn't appear until
dracut runs mdraid_start.sh.

This can result in systemd printing warning messages which are
inappropriate.

So tell systemd that the timeout for each of these is zero.

This is involves splitting some functionality out of wait_for_dev()

That function does two things:
 - creates 'finished' hooks so that dracut will wait for the device,
   and
 - sets the systemd timeout for the device to zero, so systemd doesn't
   wait.

We only want the second of these for most encrypted devices.
So split that out into a new function set_systemd_timeout_for_dev(),
and call it from parse-crypt.sh

Signed-off-by: NeilBrown <neilb@suse.de>

--
This version fixes the missing redirect from /etc/crypttab
NeilBrown
2015-06-02 12:03:43 +02:00
Harald Hoyer
b562bc55a8 Merge pull request #67 from dracut-mailing-devs/1432116434-18050-1-git-send-email-cfan@redhat.com
Change the fs_passno of nfs to 0
2015-06-02 11:57:58 +02:00
Harald Hoyer
dfec3c2d8b Merge pull request #68 from dracut-mailing-devs/1431698021-16626-3-git-send-email-colin@mageia.org
dracut: Make host only mode more resilient to missing swaps.
This patch set allows swap devices to disappear without cocking up a
host-only initramfs boot.
2015-06-02 11:54:07 +02:00
Harald Hoyer
8c5d18c2cb Merge pull request #44 from MrStaticVoid/fix-crypt-loop-info-log-level
crypt-loop: Fix decrypt when running at info log level
2015-06-02 11:49:25 +02:00
Harald Hoyer
d6e23c46c2 Merge pull request #45 from MrStaticVoid/fix-crypt-loop-hostonly-kernel-module
crypt-loop: Always include 'loop' kernel module
2015-06-02 11:47:58 +02:00
Harald Hoyer
4f0c7fc917 dracut-initramfs-restore.sh: try to mount /boot
This is very useful when /boot has the "noauto" option.

Thanks to Igor Filakhtov
2015-06-02 11:47:04 +02:00
Nikoli
c4184b5cf1 Mount /dev, /dev/shm and /run noexec 2015-06-02 11:46:59 +02:00
Harald Hoyer
1a61d85ef2 Merge pull request #51 from dracut-mailing-devs/13711492.8HAMuGhYIN@thunder
Add support for ethernet point-to-point connections configured via DHCP
2015-06-02 11:44:39 +02:00
Harald Hoyer
514aeec5b4 Merge pull request #53 from dracut-mailing-devs/E1YQLG5-00009v-BS@puleglot.ru
base/dracut-lib.sh: remove bashism
2015-06-02 11:20:10 +02:00
xtraeme
6964169368 Portability fixes:
- Use uid_t not __uid_t.
- Define _GNU_SOURCE for cpu_set_t and others.
- Include string.h for strncmp().
- Detect musl's ldd error message.
2015-06-02 11:17:13 +02:00
Harald Hoyer
acf82efd52 Merge pull request #64 from fabiand/lvm-activationskip
Respect LVM activationskip
2015-06-02 11:11:40 +02:00
Harald Hoyer
e409c9e8f8 Merge pull request #65 from scop/comment
Fix stale comment about required bash version
2015-06-02 11:10:59 +02:00
Harald Hoyer
0e5c01f8b8 Merge pull request #66 from scop/lbzip2
Use lbzip2 instead of bzip2 if available
2015-06-02 11:10:29 +02:00
Harald Hoyer
311aee1bff dracut.spec: use the autosetup macro to apply the patches 2015-05-28 19:49:08 +02:00
Harald Hoyer
0b7bfacfea network: setup gateway after setting up resolv.conf
If a daemon listens for route changes and wants to use the interface
afterwards, it should be able to resolve DNS
2015-05-28 19:47:37 +02:00
Harald Hoyer
3ac9cdb1c5 dracut.sh: fall back to /usr/lib/os-release, if /etc/os-release missing 2015-05-28 19:47:37 +02:00
Harald Hoyer
c071990c2c udev-rules: optionally install /etc/udev/udev.conf
udevd runs even without this config file
2015-05-28 19:47:37 +02:00
Ville Skyttä
ee84640963 Use lbzip2 instead of bzip2 if available 2015-05-24 22:29:20 +03:00
Ville Skyttä
f8139a8b28 Fix stale comment about required bash version 2015-05-24 22:26:20 +03:00
Fabian Deutsch
cfa365a32d lvm: Don't activate LVs with activationskip set
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1186854
Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
2015-05-21 12:38:05 +02:00
Fabian Deutsch
a1b4efe6a7 doc: Add a minimal rd.live.overlay documentation
Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
2015-05-21 12:37:38 +02:00
Chao Fan
3586a7aa77 Change the fs_passno of nfs to 0
There is a bug that kdump-initrd contains entry requesting nfs dump
filesystem to get filesystemchecked. And there is an erro message said
that nfs need be checked. But there's no fsck for nfs utility, e.g
fsck.nfs like other file system. Whatever fs_passno 0 or 2 are passed,
no fsck is executed at all for nfs mount.But in dracut, set it to be 2
always, so the erro message appear and it should be set to 0.

In the fstab,the sixth variable fs_passno stands for that the device need
checked or not,and dracut set it to "2".To fix this issue, it should
be "0" when the device is nfs.The third variable stands for the type of
the filesystem and we can use it to judge whether the device is nfs.
So when the third variable of fstab contains "nfs", the sixth variable
fs_passno should be set to "0".

Signed-off-by: Chao Fan <cfan@redhat.com>
2015-05-20 12:07:57 +02:00
Harald Hoyer
81b67232dc 50drm: add hyperv_fb kernel module
https://bugzilla.redhat.com/show_bug.cgi?id=1192035
2015-05-18 13:43:26 +02:00
Harald Hoyer
27c9d1f20f Merge remote-tracking branch 'github/master' 2015-05-18 13:28:00 +02:00
Harald Hoyer
10e59202c7 51-dracut-rescue.install: fix kernel cmdline parsing
filter out any "initrd=" option
2015-05-18 13:27:16 +02:00
Colin Guthrie
7b56b90582 resume: Ensure we actually wait for the /dev/resume 'device'
Although various bits are in place to cancel waiting for the /dev/resume
device (actually a symlink), we don't actually ever wait for it.

Also as the udev rule may create the symlink, silence any errors from
our manual ln -s call from the settled job.
2015-05-15 16:01:41 +02:00
Colin Guthrie
3e3ed34f03 base: Don't wait for swap devices in host-only mode.
The only reason we add swap devices to host-only mode (added in
dd5875499e) is to allow us to process
resume= arguments passed on the kernel command line when the swap
partition lives on something slightly more complex than a normal
partion (e.g. in an LVM or RAID setup).

By adding the device to host_devs, the necessary LVM and RAID hooks
are added and thus the underlying storage will be initialised OK, and
the 95resume module handles the waiting for the device (via udev rules
creating the /dev/resume symlink).

So ultimately, we do not need to hard-code the waiting for the swap
devices into the initramfs at build time as the waiting part can be
dynamic.

This makes things more resiliant to swap partitions disappearing and
being reformatted etc.

Inspired by a patch by Martin Whitaker on Mageia bug:
https://bugs.mageia.org/show_bug.cgi?id=12305
2015-05-15 16:01:41 +02:00
Harald Hoyer
50f8ae457c dmraid/dmraid.sh: call udevsettle after activating all raids
otherwise a uevent loop will happen and the initqueue main loop counter
will not be incremented
2015-05-13 12:31:07 +02:00
Harald Hoyer
a601870064 5?-dracut*.install: better parsing of /proc/cmdline
"read -r -d '' -a" does, what we want.
2015-05-13 12:02:14 +02:00
Harald Hoyer
8cd8820547 use cp --reflink=auto
saves some space, if the destination is on the same filesystem on some
filesystems
2015-05-13 12:02:10 +02:00
Harald Hoyer
471439f564 add dracut.pc pkg-config file 2015-05-13 11:47:23 +02:00
Harald Hoyer
e668f3bc36 .dir-locals.el: correct syntax 2015-05-13 11:44:00 +02:00
Harald Hoyer
351de47882 README.testsuite: add bridge-utils to list of rpms 2015-05-07 18:15:57 +02:00
Harald Hoyer
07d9319d54 network/net-lib.sh:iface_has_link() wait 5s for the carrier to appear
https://bugzilla.redhat.com/show_bug.cgi?id=1088808
2015-05-07 14:49:06 +02:00
Harald Hoyer
7c5ec0f5be network:dhcp:wait_for_ipv6_dad() in PREINIT6 2015-05-07 14:43:26 +02:00
Harald Hoyer
79bc77d2f4 Merge pull request #61 from cmorty/pull/plymouth
Add plymouth-set-default-theme to the plymouth dependencies
2015-04-30 11:28:49 +02:00
Moritz 'Morty' Strübe
874b013573 Add plymouth-set-default-theme to the plymouth dependencies
plymouth-set-default-theme is not shipped with ubuntu and therefore
causes errors.
2015-04-30 11:20:27 +02:00
Harald Hoyer
ffa0ee5d16 Merge pull request #59 from lnykryn/master
dracut-functions: use [[ ]] with -n and no quotes
2015-04-30 09:29:06 +02:00
Harald Hoyer
a742c80778 Merge pull request #60 from rustybird/master
Fix ask_for_password bug breaking bash without plymouth
2015-04-30 09:28:50 +02:00
Rusty Bird
04ba461045 Fix ask_for_password bug breaking bash without plymouth
If crypt-lib.sh is sourced from any #!/bin/sh script, a POSIX shell
quirk is in effect that causes variable assignments to "special
builtins" (such as "shift") to leak to their context. So the buggy
code works even despite the missing semicolons.

But if it is sourced by "bash acting under its own name", i.e. from
any #!/bin/bash script, the quirk is disabled, tty_cmd/tty_prompt are
undefined, and ask_for_password doesn't do anything if plymouth is not
present.
2015-04-30 03:25:14 +00:00
Harald Hoyer
6d58fa27a4 change "while read x" to cope with EOF without newline
while read x || [ -n "$x" ]

should do the trick
2015-04-28 11:39:15 +02:00
Harald Hoyer
822a7ae504 fips: add some s390 kernel modules 2015-04-28 10:46:33 +02:00
Lukas Nykryn
b0b60c8e05 dracut-functions: use [[ ]] with -n and no quotes 2015-04-27 11:40:54 +02:00
Harald Hoyer
4851deca54 dmsquash-live/apply-live-updates.sh: needs 'find'
also add /run/initramfs/live/updates as a directory, where to pull
the updates from

https://bugzilla.redhat.com/show_bug.cgi?id=1213736
2015-04-24 12:18:53 +02:00
Harald Hoyer
437dad70e9 Defer modprobe of HW modules, until udev is running
Also honor blacklisting
2015-04-24 11:59:37 +02:00
Harald Hoyer
a3e464ca43 drm/module-setup.sh: radeon needs amdkfd
AMD's HSA Linux kernel driver (amdkfd) has been merged into the mainline
kernel since kernel 3.19.

However, for the driver to work, it needs to be included in the default
initramfs image, together with the amd_iommu_v2 driver.

The radeon driver (AMD's kernel graphic driver) calls amdkfd during its
initialization and probing stages. Because radeon is included in the
initramfs image, it tries to initialize amdkfd during the early boot
stages. However, as amdkfd is not present there, it fails.

That doesn't harm radeon operation. However, it disables the HSA
abilities in the machine.

Because of the current design, if you later try to "modprobe amdkfd",
you won't be able to run HSA applications, even though the driver will
be loaded.

https://bugzilla.redhat.com/show_bug.cgi?id=1205222
2015-04-23 16:11:53 +02:00
Harald Hoyer
be82884d35 Makefile: turn off hostonly excplicitely for testimage target 2015-04-23 16:11:26 +02:00
Harald Hoyer
180e9d7851 kernel-modules: install all HID drivers
Instead of hardcoding a list of useful drivers, which has to be curated
all the time, just include all HID drivers.
2015-04-23 13:46:52 +02:00
Harald Hoyer
d3d52b20e9 dracut-systemd/rootfs-generator.sh: use strstr rather than grep
grep on /proc/cmdline is overkill and would add a requirement for grep
2015-04-21 16:35:34 +02:00
Harald Hoyer
23446ef1e0 ifcfg/write-ifcfg.sh: unset vlan
clear the vlan flag, if a previous interface in the loop
was a vlan interface
2015-04-21 15:10:49 +02:00
Harald Hoyer
ec06c5d3b5 Merge pull request #55 from dracut-mailing-devs/1427202794-18834-1-git-send-email-aidecoe@aidecoe.name
Take into account lib64 dirs when detecting version, modules and params
2015-03-26 18:34:49 +01:00
Amadeusz Żołnowski
d3be9275c7 Take into account lib64 dirs when detecting version, modules and params 2015-03-26 16:38:42 +01:00
Alexander Tsoy
13efce5d1b base/dracut-lib.sh: remove bashism 2015-03-26 16:38:38 +01:00
NeilBrown
f53ede36fb dracut-systemd/rootfs-generator.sh: always create generated files.
When 'systemctl daemon-reload' is run, systemd will clean out
/run/systemd/generator and re-run all the generators.
So it is important that the generators always create the required
files.

rootfs-generator.sh currently does *not* create the desired files
if $hookdir/initqueue/finished/devexists-${_name}.sh
exists.

This is not removed by "systectl daemon-reload" so the first time this
generator is run it will do the right thing.  Subsequent times it
won't.

This results in incorrect timeouts after "daemon-reload" is run.

So let the existence of each file only guard the creation that file.

Signed-off-by: NeilBrown <neilb@suse.de>
2015-03-26 16:38:36 +01:00
NeilBrown
97cb17c792 systemd/dracut-iniqueue - continue waiting if any timeout script makes progress
A number of timeout scripts can be registered.  If any one of them
makes progress - e.g. assembles a degraded md array - then
the main loop should wait a bit longer rather than pressing forward.

This is particularly important is resume-from-hibernate requires a
degraded md array.  Both the script to forcibly assemble the md array
and the script to abort hibernation if the device doesn't appear
are 'timeout' scripts.  There needs to be a reasonable delay between
these running.

So: if any script has indicated that progress was made, break of out
the loop and go back to normal waiting.

Signed-off-by: NeilBrown <neilb@suse.de>
2015-03-26 16:38:36 +01:00
NeilBrown
3b82ac1696 mdraid/mdraid_start.sh: tell mainloop if we make progress.
mdraid_start is a number of scripts which run after a timeout.
If it makes progress, it should tell the main loop so that it
knows that it is worth waiting a bit longer.

So in that case, create the initqueue/work file which the main loop
checks for.

Signed-off-by: NeilBrown <neilb@suse.de>
2015-03-26 16:38:36 +01:00
Gerd von Egidy
99ccbc30df Add support for ethernet point-to-point connections configured via DHCP
When current dracut receives an ip with netmask of 255.255.255.255 via DHCP,
setting the also supplied default gateway fails (because it is obviously not
within the netmask).

The setup with a netmask of /32 is quite common in colocation datacenters
where you don't want the machines of two different customers to directly talk
to each other. At least two of the biggest colocation providers in Germany
(1&1 and Strato) do it that way. NetworkManager supports this kind of setup
and the dhclient-scripts of several distributions too.

In this patch I have implemented a simple approach very similar to what is
found in Debian. The dhclient-script from Fedora uses a more sophisticated
approach, but that relies on the ipcalc utility which would introduce a
dependency on Fedora-initscripts for dracut.

Signed-off-by: Gerd von Egidy <gerd.von.egidy@intra2net.com>
2015-03-26 16:38:33 +01:00
Harald Hoyer
e93d0bea38 test: include kernel-network-modules for network tests 2015-03-26 10:57:58 +01:00
James Lee
833e0f9e83 crypt-loop: Always include 'loop' kernel module
When the 'loop' kernel module isn't loaded in a running system, it gets
excluded from the hostonly initrd.  Given that the crypt-loop dracut
module has to be loaded explicitly anyway, it makes sense to always
include the requisite loop kernel module.
2015-03-26 02:17:34 -04:00
James Lee
c902aba0d4 crypt-loop: Fix decrypt when running at info log level
When booting with 'rd.info', the 'info' statements in the crypt-loop
module's 'loop_decrypt' function are output to stdout along with the key
that gets piped into the 'cryptsetup' command, which causes the crypt
device unlocking to fail.

There are two possible simple solutions to this problem:

1. Redirect the info messages to stderr (just add '>&2' at the end of
the info statements).

or

2. Remove the info statements altogether.

I have tested both and they both work, but this commit implements #2.
The existing info messages are long (they overflow 80 characters
easily) and redundant (the password prompt clearly indicates what is
happening), and just generally not useful.  Given that no one has
reported or fixed this bug in the three years that this module has
existed, no one will miss these info messages.

The commit also changes an error message in the same function to be more
descriptive.
2015-03-25 23:31:24 -04:00
Harald Hoyer
2bc5054a64 Merge pull request #35 from enovance/fix_include_variables_name
dracut: Ajusting variables name for --include
2015-03-24 20:46:06 +01:00
Harald Hoyer
b67d810785 dracut.spec: add new modules 2015-03-24 16:10:45 +01:00
Harald Hoyer
bbbdba2ec3 fcoe/lldpad.sh: add executable flags 2015-03-24 16:03:47 +01:00
Harald Hoyer
863e18b4cd crypt-loop/module-setup.sh: make module-setup.sh executable 2015-03-24 16:03:47 +01:00
Harald Hoyer
a18d5494eb dracut-systemd/module-setup.sh: make module-setup.sh executable 2015-03-24 16:03:47 +01:00
Harald Hoyer
cbb4b50e02 systemd-networkd: add experimental systemd-networkd support 2015-03-24 16:03:47 +01:00
Harald Hoyer
ae43adb70d network: split out kernel-network-modules 2015-03-24 16:03:47 +01:00
Harald Hoyer
ddfefd05fc debug: add more tools to the dracut debug module 2015-03-24 16:03:47 +01:00
Harald Hoyer
25e08a0973 systemd-initrd: add /etc/initrd-release 2015-03-24 16:03:22 +01:00
Harald Hoyer
6f92423c89 dracut.sh: create /var/tmp 2015-03-24 16:03:11 +01:00
Harald Hoyer
5641b0974b systemd: add more targets and tools
also set the multi-user.target as the default target
2015-03-24 16:02:09 +01:00
Harald Hoyer
5c44f43e69 dracut.spec: removed compat /sbin symlink to dracut binary 2015-03-23 12:19:41 +01:00
Harald Hoyer
3c20ac5377 TEST-30-ISCSI/test.sh: add all dracut modules
add all dracut modules to catch netroot conflicts and side effects like

afcc697cb8
2015-03-20 16:13:30 +01:00
Harald Hoyer
afcc697cb8 nfs/parse-nfsroot.sh: don't unset netroot, if not nfs 2015-03-20 15:48:15 +01:00
Harald Hoyer
636d2d46a5 dracut.sh: add support for creating a UEFI boot executable
With an EFI stub, the kernel, the initramfs and a kernel cmdline can be
glued together to a single UEFI executable, which can be booted by a
UEFI BIOS.
2015-03-20 14:31:23 +01:00
Harald Hoyer
21a209735a dracut.sh: only print cmdline from modules, which would be included 2015-03-20 14:31:22 +01:00
Harald Hoyer
bee086532f dracut.sh: simplify module install loop 2015-03-20 14:31:22 +01:00
Harald Hoyer
df1e8127da rootfs-block/module-setup.sh: find root btrfs subvolumes
If root is a btrfs subvolume, find it, if fstab is not used
2015-03-20 14:31:22 +01:00
Harald Hoyer
481ee9e6fc test: ping watchdog in dhcp servers 2015-03-20 14:28:42 +01:00
Harald Hoyer
9f0878540b base/dracut-lib.sh: read /proc/cmdline with multiple lines
also parse cmdline files without an ending newline
2015-03-19 16:40:38 +01:00
Harald Hoyer
9119059723 dracut.sh: factor out do_print_cmdline() 2015-03-19 11:04:02 +01:00
Harald Hoyer
28eae10b70 Split the systemd dracut module up
Basic systemd functionality is in 00systemd now.
Switching root and the initrd.target is in 00systemd-initrd.
Dracut additions to the systemd initrd are in 98dracut-systemd.
2015-03-19 10:07:37 +01:00
Harald Hoyer
363469d757 base/module-setup.sh: merge systemd conditional 2015-03-19 10:00:48 +01:00
Harald Hoyer
dea0634544 lvm: add files needed for LVM system id support
The LVM system id support is recent addition to LVM. See
https://git.fedorahosted.org/cgit/lvm2.git/tree/man/lvmsystemid.7.in for
more information (since lvm v2.02.117, currently the configuration is
ignored, but we will enable it soon in next release).

https://bugzilla.redhat.com/show_bug.cgi?id=1199918
2015-03-16 11:55:13 +01:00
Harald Hoyer
1bcb63f97c systemd: add "adm" and "wheel" to passwd and group 2015-02-26 09:39:32 +01:00
Fabian Deutsch
b0472eac11 dmsquash: Add squashfs support to rd.live.fsimg
Previously rd.live.fsimg only supported filesystems residing in
(compressed) archives.
Now rd.live.fsimg can also be used when a squashfs image is used.
This is achieved by extracting the rootfs image from the squashfs and
then continue with the default routines for rd.live.fsimg.
In addition some code duplication got removed and some documentation
got added.

Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
2015-02-19 10:59:54 +01:00
Fabian Deutsch
d6e34d362a dmsquash: Add rd.live.overlay.thin
This option changes the underlying mechanism for the overlay in the
dmsquash module.
Instead of a plain dm snapshot a dm thin snapshot is used. The advantage
of the thin snapshot is, that the TRIM command is recognized, which
means that at runtime, only the occupied blocks will be claimed from
memory, and freed blocks will really be freed in ram.

Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
2015-02-19 10:59:54 +01:00
Jonas Jonsson
7075a402d7 99base: Properly remove files with rd.hostonly=0
Dracut will generate systemd units for additional devices that should be
brought up during boot, e.g. swap devices. These unit files are broken
symlinks with \ in the filename, e.g.
/etc/systemd/system/initrd.target.wants/dev-disk-by\x2duuid-e6a54f99\x2da4fd\x2d4931\x2da956\x2d1c642bcfee5e.device.

Both the backslash and the broken symlink causes problems for shell
scripts, [ -e "$file" ] isn't enough and read requires the additional -r
argument to not react on the \.
2015-02-19 10:58:18 +01:00
Lukas Wunner
5729ae8029 90dm/dm-shutdown.sh: dmsetup remove_all -> dmsetup remove
The function 99shutdown/shutdown.sh:_check_shutdown() assumes that
shutdown scripts report success or failure via their return value.
However, "dmsetup remove_all" always reports success, even if some
of the device mappings could not be removed.

I submitted a patch for dmsetup but the lvm2 folks rejected it,
asserting that its behaviour is correct, that "remove_all" should
only be used by developers and that the proper solution would be
to invoke "dmsetup remove" on each device. This does report success
or failure via the return value.

Apart from fixing that issue, this commit also adds the dmsetup
option "--noudevsync". Without it, dmsetup would hang after removal
of a device while trying to communicate with systemd-udevd, which
is no longer running at this shutdown stage.

[harald: replaces backticks with $() ]
2015-02-19 10:57:08 +01:00
Dimitri John Ledkov
a7d3ad67c7 Support /usr/lib/kernel/cmdline fallback path for /etc/kernel/cmdline. 2015-02-19 10:50:58 +01:00
Harald Hoyer
7e9341434f fips: add drbg kernel module 2015-02-19 10:45:35 +01:00
Harald Hoyer
6ac2c83570 dracut.sh: call bash with --norc
We don't want any user aliases or functions to be defined in dracut.
2015-02-19 09:55:12 +01:00
Jan Synacek
05b879ed2a doc: fix typo 2015-02-10 12:22:16 +01:00
Harald Hoyer
38e217704a fedora.conf: do not store cmdline in image by default 2015-02-10 12:22:16 +01:00
Erwan Velu
c9364f6ea2 dracut: Ajusting variables name for --include
When reading the --include part of the script, we had the following
issues to make the code easy to read:
- src & tgt were extract for the original options
- i variable was a file or a directory from src
- s variable was the directory name in case $i was a directory

"s" sounds very close to "src" while "s" is on the "tgt" side. Very
confusing.

"s" was defined before the "if it's a directory" statement while it's
only used inside the "if".

"i" was commit from the "src" but wasn't really explicit.

Having some lines mixing "i" and "s" takes a little time to get read
properly.

This patch offer the following changes:
- "i" is renamed to "objectname" as we don't know if its a file or a
  directory

- "s" is renamed to "object_destdir" as the object name becomes a
  directory on the destdir

- "object_destdir" (former "s") is moved inside the "if" statement as it's
  only used here

- tgt is finally renamed to "target" to be more explicit. We are not all
  native english ;o)

My 2 (semantic) cents,
2014-12-19 14:49:00 +01:00
153 changed files with 1196 additions and 643 deletions

View File

@@ -1,2 +1,3 @@
(setq sh-basic-offset: 4)
(setq indent-tabs-mode nil)
((nil . ((setq sh-basic-offset: 4)
(setq indent-tabs-mode nil)
)))

View File

@@ -12,18 +12,20 @@ case "$COMMAND" in
if [[ -f ${INITRD_IMAGE_PREGENERATED} ]]; then
# we found an initrd at the same place as the kernel
# use this and don't generate a new one
cp "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/initrd" \
cp --reflink=auto "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/initrd" \
&& chown root:root "$BOOT_DIR_ABS/initrd" \
&& chmod 0600 "$BOOT_DIR_ABS/initrd" \
&& exit 0
fi
if [[ -f /etc/kernel/cmdline ]]; then
readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
elif [[ -f /usr/lib/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
fi
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
read -ar BOOT_OPTIONS < /proc/cmdline
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
read -r -d '' -a BOOT_OPTIONS < /proc/cmdline
fi
unset noimageifnotneeded

View File

@@ -57,7 +57,7 @@ if [[ ! -f $INITRDFILE ]]; then
fi
if [[ ! -f $NEW_KERNEL_IMAGE ]]; then
cp "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
cp --reflink=auto "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
((ret+=$?))
fi

View File

@@ -40,12 +40,22 @@ fi
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
if [[ -f /etc/kernel/cmdline ]]; then
readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
elif [[ -f /usr/lib/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
fi
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
read -ar BOOT_OPTIONS < /proc/cmdline
read -r -d '' -a line < /proc/cmdline
for i in "${line[@]}"; do
[[ "${i#initrd=*}" != "$i" ]] && continue
BOOT_OPTIONS+=("$i")
done
fi
if ! [[ $BOOT_OPTIONS ]]; then
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
echo "Could not determine the kernel command line parameters." >&2
echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2
exit 1
fi
@@ -69,7 +79,7 @@ case "$COMMAND" in
[[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS"
if ! cp "$KERNEL_IMAGE" "$BOOT_DIR_ABS"/linux; then
if ! cp --reflink=auto "$KERNEL_IMAGE" "$BOOT_DIR_ABS"/linux; then
echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/linux'!" >&2
fi

26
AUTHORS
View File

@@ -9,8 +9,8 @@ Dave Young <dyoung@redhat.com>
David Dillow <dave@thedillows.org>
Hannes Reinecke <hare@suse.de>
Michal Soltys <soltys@ziu.info>
Amerigo Wang <amwang@redhat.com>
Colin Guthrie <colin@mageia.org>
Amerigo Wang <amwang@redhat.com>
Thomas Renninger <trenn@suse.de>
WANG Chao <chaowang@redhat.com>
Andrey Borzenkov <arvidjaar@gmail.com>
@@ -27,12 +27,16 @@ Baoquan He <bhe@redhat.com>
Leho Kraav <leho@kraav.com>
Kamil Rytarowski <n54@gmx.com>
Marc Grimme <grimme@atix.de>
NeilBrown <neilb@suse.de>
Peter Rajnoha <prajnoha@redhat.com>
Radek Vykydal <rvykydal@redhat.com>
Thorsten Behrens <tbehrens@suse.com>
Chao Wang <chaowang@redhat.com>
Colin Walters <walters@verbum.org>
Cristian Rodríguez <crrodriguez@opensuse.org>
Fabian Deutsch <fabiand@fedoraproject.org>
Frederic Crozat <fcrozat@suse.com>
James Lee <jlee@thestaticvoid.com>
Jesse Keating <jkeating@redhat.com>
Milan Broz <mbroz@redhat.com>
Nicolas Chauvet <kwizart@gmail.com>
@@ -40,7 +44,6 @@ Roberto Sassu <roberto.sassu@polito.it>
Anton Blanchard <anton@samba.org>
Bill Nottingham <notting@redhat.com>
Chapman Flack <g2@anastigmatix.net>
Cristian Rodríguez <crrodriguez@opensuse.org>
David Cantrell <dcantrell@redhat.com>
Dennis Gilmore <dennis@ausil.us>
Jon Ander Hernandez <jonan.h@gmail.com>
@@ -52,21 +55,24 @@ Peter Robinson <pbrobinson@gmail.com>
Stefan Reimer <it@startux.de>
Stig Telfer <stelfer@cray.com>
Vasiliy Tolstov <v.tolstov@selfip.ru>
Ville Skyttä <ville.skytta@iki.fi>
Wim Muskee <wimmuskee@gmail.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Alan Pevec <apevec@redhat.com>
Alex Harpin <development@landsofshadow.co.uk>
Daniel Schaal <farbing@web.de>
Erwan Velu <erwan.velu@enovance.com>
Frederick Grose <fgrose@sugarlabs.org>
Hari Bathini <hbathini@linux.vnet.ibm.com>
Ian Dall <ian@beware.dropbear.id.au>
James Buren <ryuo@frugalware.org>
James Lee <jlee@thestaticvoid.com>
Jan Synacek <jsynacek@redhat.com>
Joey Boggs <jboggs@redhat.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>
Przemysław Rudy <prudy1@o2.pl>
@@ -82,25 +88,29 @@ Anssi Hannula <anssi@mageia.org>
Antony Messerli <amesserl@rackspace.com>
Brandon Philips <brandon@ifup.co>
Canek Peláez Valdés <caneko@gmail.com>
Chao Fan <cfan@redhat.com>
Chris Leech <cleech@redhat.com>
Christian Heinz <christian.ch.heinz@gmail.com>
Christian Rodrigues <crrodriguez@opensuse.org>
Cong Wang <amwang@redhat.com>
Daniel Drake <drake@endlessm.com>
Dave Jones <davej@redhat.com>
Dennis Schridde <devurandom@gmx.net>
Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
Duane Griffin <duaneg@dghda.com>
Erwan Velu <erwan.velu@enovance.com>
Gerd von Egidy <gerd.von.egidy@intra2net.com>
Glen Gray <slaine@slaine.org>
Hermann Gausterer <git-dracut-2012@mrq1.org>
James Laska <jlaska@redhat.com>
Jan Stodola <jstodola@redhat.com>
Jiri Pirko <jiri@resnulli.us>
Joe Lawrence <Joe.Lawrence@stratus.com>
Jonas Jonsson <jonas@websystem.se>
Julian Wolf <juwolf@suse.com>
Kevin Yung <Kevin.Yung@myob.com>
Lars R. Damerow <lars@pixar.com>
Lennert Buytenhek <buytenh@wantstofly.org>
Lukas Wunner <lukas@wunner.de>
Lukas Nykryn <lnykryn@redhat.com>
Major Hayden <major@mhtx.net>
Marian Csontos <mcsontos@redhat.com>
Marko Myllynen <myllynen@redhat.com>
@@ -108,8 +118,9 @@ Matt <smoothsailing72@hotmail.com>
Matt Smith <shadowfax@gmx.com>
Michal Schmidt <mschmidt@redhat.com>
Mike Gorse <mgorse@suse.com>
Moritz 'Morty' Strübe <morty@gmx.net>
Munehiro Matsuda <haro@kgt.co.jp>
NeilBrown <neilb@suse.de>
Nikoli <nikoli@gmx.us>
Nikoli <nikoli@lavabit.com>
Olivier Blin <dev@blino.org>
P J P <ppandit@redhat.com>
@@ -119,6 +130,7 @@ Praveen_Paladugu@Dell.com <Praveen_Paladugu@Dell.com>
Pádraig Brady <P@draigBrady.com>
Quentin Armitage <quentin@armitage.org.uk>
Robert Buchholz <rbu@goodpoint.de>
Rusty Bird <rustybird@openmailbox.org>
Sergey Fionov <fionov@gmail.com>
Shawn W Dunn <sfalken@opensuse.org>
Srinivasa T N <seenutn@linux.vnet.ibm.com>
@@ -128,8 +140,8 @@ Tom Gundersen <teg@jklm.no>
Tomasz Torcz <tomek@pipebreaker.pl>
Vadim Kuznetsov <vadimk@gentoo.org>
Vaughan Cao <vaughan.cao@oracle.com>
Ville Skyttä <ville.skytta@iki.fi>
Vratislav Podzimek <vpodzime@redhat.com>
Yanko Kaneti <yaneti@declera.com>
jloeser <jloeser@suse.de>
maximilian attems <max@stro.at>
xtraeme <xtraeme@voidlinux.eu>

View File

@@ -15,6 +15,7 @@ mandir ?= ${prefix}/share/man
CFLAGS ?= -O2 -g -Wall
CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
bashcompletiondir ?= ${datadir}/bash-completion/completions
pkgconfigdatadir ?= $(datadir)/pkgconfig
man1pages = lsinitrd.1
@@ -28,20 +29,20 @@ man8pages = dracut.8 \
dracut-catimages.8 \
mkinitrd.8 \
mkinitrd-suse.8 \
modules.d/98systemd/dracut-cmdline.service.8 \
modules.d/98systemd/dracut-initqueue.service.8 \
modules.d/98systemd/dracut-mount.service.8 \
modules.d/98systemd/dracut-shutdown.service.8 \
modules.d/98systemd/dracut-pre-mount.service.8 \
modules.d/98systemd/dracut-pre-pivot.service.8 \
modules.d/98systemd/dracut-pre-trigger.service.8 \
modules.d/98systemd/dracut-pre-udev.service.8
modules.d/98dracut-systemd/dracut-cmdline.service.8 \
modules.d/98dracut-systemd/dracut-initqueue.service.8 \
modules.d/98dracut-systemd/dracut-mount.service.8 \
modules.d/98dracut-systemd/dracut-shutdown.service.8 \
modules.d/98dracut-systemd/dracut-pre-mount.service.8 \
modules.d/98dracut-systemd/dracut-pre-pivot.service.8 \
modules.d/98dracut-systemd/dracut-pre-trigger.service.8 \
modules.d/98dracut-systemd/dracut-pre-udev.service.8
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
all: dracut-version.sh dracut-install skipcpio/skipcpio
all: dracut-version.sh dracut.pc dracut-install skipcpio/skipcpio
DRACUT_INSTALL_OBJECTS = \
install/dracut-install.o \
@@ -96,7 +97,15 @@ dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
rm -f -- dracut.xml
install: dracut-version.sh
dracut.pc: Makefile.inc Makefile
@echo "Name: dracut" > dracut.pc
@echo "Description: dracut" >> dracut.pc
@echo "Version: $(VERSION)$(GITVERSION)" >> dracut.pc
@echo "dracutdir=$(pkglibdir)" >> dracut.pc
@echo "dracutmodulesdir=$(pkglibdir)/modules.d" >> dracut.pc
@echo "dracutconfdir=$(pkglibdir)/dracut.conf.d" >> dracut.pc
install: all
mkdir -p $(DESTDIR)$(pkglibdir)
mkdir -p $(DESTDIR)$(bindir)
mkdir -p $(DESTDIR)$(sysconfdir)
@@ -124,7 +133,7 @@ ifneq ($(enable_documentation),no)
endif
if [ -n "$(systemdsystemunitdir)" ]; then \
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98systemd/dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown.service; \
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown.service; \
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants; \
ln -s ../dracut-shutdown.service \
$(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants/dracut-shutdown.service; \
@@ -138,7 +147,7 @@ endif
dracut-pre-trigger.service \
dracut-pre-udev.service \
; do \
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98systemd/$$i $(DESTDIR)$(systemdsystemunitdir); \
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/$$i $(DESTDIR)$(systemdsystemunitdir); \
ln -s ../$$i \
$(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants/$$i; \
done \
@@ -155,6 +164,8 @@ endif
mkdir -p $(DESTDIR)${bashcompletiondir}
install -m 0644 dracut-bash-completion.sh $(DESTDIR)${bashcompletiondir}/dracut
install -m 0644 lsinitrd-bash-completion.sh $(DESTDIR)${bashcompletiondir}/lsinitrd
mkdir -p $(DESTDIR)${pkgconfigdatadir}
install -m 0644 dracut.pc $(DESTDIR)${pkgconfigdatadir}/dracut.pc
dracut-version.sh:
@echo "DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh
@@ -212,7 +223,7 @@ check: all syncheck rpm
@$(MAKE) -C test check
testimage: all
./dracut.sh -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
./dracut.sh -N -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
debugtestimage: all
@@ -234,7 +245,7 @@ hostimage: all
@echo wrote test-$(shell uname -r).img
AUTHORS:
git shortlog --numbered --summary -e |while read a rest; do echo $$rest;done > AUTHORS
git shortlog --numbered --summary -e |while read a rest || [ -n "$$rest" ]; do echo $$rest;done > AUTHORS
dracut.html.sign: dracut-$(VERSION).tar.xz dracut.html
gpg-sign-all dracut-$(VERSION).tar.xz dracut.html

31
NEWS
View File

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

View File

@@ -1,5 +1,6 @@
For the testsuite to work, you will have to install at least the following software packages:
dash \
bridge-utils \
asciidoc \
mdadm \
lvm2 \

2
TODO
View File

@@ -6,6 +6,8 @@ Items are ordered in priority.
INITRAMFS TODO
- search domain string
- peerdns=no
- allow dual stack configuration (IPv4, IPv6) for the same interface
- "bind-mount" kernel drivers in real root for the rescue image,
if the real root does not have any kernel modules for this kernel

View File

@@ -32,6 +32,7 @@ _dracut() {
--xz --no-compress --gzip --list-modules --show-modules --keep
--printsize --regenerate-all --noimageifnotneeded --early-microcode
--no-early-microcode --print-cmdline --prelink --noprelink --reproducible
--uefi
'
[ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers
@@ -39,7 +40,7 @@ _dracut() {
--fwdir --libdirs --fscks --add-fstab --mount --device --nofscks
--kmoddir --conf --confdir --tmpdir --stdlog --compress --prefix
--kernel-cmdline --sshkey --persistent-policy --install-optional
--loginstall
--loginstall --uefi-stub --kernel-image
'
)

View File

@@ -309,7 +309,7 @@ get_fs_env() {
[[ $1 ]] || return
unset ID_FS_TYPE
ID_FS_TYPE=$(blkid -u filesystem -o export -- "$1" \
| while read line; do
| while read line || [ -n "$line" ]; do
if [[ "$line" == TYPE\=* ]]; then
printf "%s" "${line#TYPE=}";
exit 0;
@@ -435,7 +435,7 @@ find_block_device() {
if [[ $use_fstab != yes ]]; then
[[ -d $_find_mpt/. ]]
findmnt -e -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | { \
while read _majmin _dev; do
while read _majmin _dev || [ -n "$_dev" ]; do
if [[ -b $_dev ]]; then
if ! [[ $_majmin ]] || [[ $_majmin == 0:* ]]; then
_majmin=$(get_maj_min $_dev)
@@ -456,7 +456,7 @@ find_block_device() {
# fall back to /etc/fstab
findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | { \
while read _majmin _dev; do
while read _majmin _dev || [ -n "$_dev" ]; do
if ! [[ $_dev ]]; then
_dev="$_majmin"
unset _majmin
@@ -492,7 +492,7 @@ find_mp_fstype() {
if [[ $use_fstab != yes ]]; then
findmnt -e -v -n -o 'FSTYPE' --target "$1" | { \
while read _fs; do
while read _fs || [ -n "$_fs" ]; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
printf "%s" "$_fs"
@@ -501,7 +501,7 @@ find_mp_fstype() {
fi
findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1" | { \
while read _fs; do
while read _fs || [ -n "$_fs" ]; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
printf "%s" "$_fs"
@@ -528,7 +528,7 @@ find_dev_fstype() {
if [[ $use_fstab != yes ]]; then
findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
while read _fs; do
while read _fs || [ -n "$_fs" ]; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
printf "%s" "$_fs"
@@ -537,7 +537,7 @@ find_dev_fstype() {
fi
findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
while read _fs; do
while read _fs || [ -n "$_fs" ]; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
printf "%s" "$_fs"
@@ -977,7 +977,7 @@ inst_rules_wildcard() {
_found=$_rule
fi
done
if [ -n ${hostonly} ] ; then
if [[ -n ${hostonly} ]] ; then
for _rule in ${_target}/$1 ; do
if [[ -f $_rule ]]; then
inst_rule_programs "$_rule"
@@ -997,7 +997,7 @@ prepare_udev_rules() {
for f in "$@"; do
f="${initdir}/etc/udev/rules.d/$f"
[ -e "$f" ] || continue
while read line; do
while read line || [ -n "$line" ]; do
if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then
if [ $UDEVVERSION -ge 174 ]; then
printf '%sIMPORT{builtin}="path_id"\n' "${line%%IMPORT PATH_ID}"
@@ -1130,7 +1130,7 @@ inst_opt_decompress() {
# or the "check" script, if module-setup.sh is not found
# "check $hostonly" is called
module_check() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _ret
local _forced=0
local _hostonly=$hostonly
@@ -1161,7 +1161,7 @@ module_check() {
# or the "check" script, if module-setup.sh is not found
# "mount_needs=1 check 0" is called
module_check_mount() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _ret
mount_needs=1
[[ -d $_moddir ]] || return 1
@@ -1186,7 +1186,7 @@ module_check_mount() {
# execute the depends() function of module-setup.sh of <dracut module>
# or the "depends" script, if module-setup.sh is not found
module_depends() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _ret
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
@@ -1209,7 +1209,7 @@ module_depends() {
# execute the cmdline() function of module-setup.sh of <dracut module>
# or the "cmdline" script, if module-setup.sh is not found
module_cmdline() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _ret
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
@@ -1230,7 +1230,7 @@ module_cmdline() {
# execute the install() function of module-setup.sh of <dracut module>
# or the "install" script, if module-setup.sh is not found
module_install() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _ret
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
@@ -1251,7 +1251,7 @@ module_install() {
# execute the installkernel() function of module-setup.sh of <dracut module>
# or the "installkernel" script, if module-setup.sh is not found
module_installkernel() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _ret
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
@@ -1273,7 +1273,7 @@ module_installkernel() {
# device and filesystem types in "${host_fs_types[@]}"
check_mount() {
local _mod=$1
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _ret
local _moddep
@@ -1338,7 +1338,7 @@ check_mount() {
# that the modules were checked for the dependency tracking process
check_module() {
local _mod=$1
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _ret
local _moddep
# If we are already scheduled to be loaded, no need to check again.
@@ -1512,7 +1512,7 @@ for_each_kmod_dep() {
local _func=$1 _kmod=$2 _cmd _modpath _options
shift 2
modprobe "$@" --ignore-install --show-depends $_kmod 2>&${_fderr} | (
while read _cmd _modpath _options; do
while read _cmd _modpath _options || [ -n "$_cmd" ]; do
[[ $_cmd = insmod ]] || continue
$_func ${_modpath} || exit $?
done
@@ -1528,7 +1528,7 @@ dracut_kernel_post() {
--ignore-install --show-depends --set-version $kernel \
< "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" 2>/dev/null \
| sort -u \
| while read _cmd _modpath _options; do
| while read _cmd _modpath _options || [ -n "$_cmd" ]; do
[[ $_cmd = insmod ]] || continue
echo "$_modpath"
done > "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
@@ -1537,7 +1537,7 @@ dracut_kernel_post() {
if [[ $DRACUT_INSTALL ]] && [[ -z $_moddirname ]]; then
xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
else
while read _modpath; do
while read _modpath || [ -n "$_modpath" ]; do
local _destpath=$_modpath
[[ $_moddirname ]] && _destpath=${_destpath##$_moddirname/}
_destpath=${_destpath##*/lib/modules/$kernel/}
@@ -1545,12 +1545,12 @@ dracut_kernel_post() {
done < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
fi
) &
_pid=$(jobs -p | while read a ; do printf ":$a";done)
_pid=$(jobs -p | while read a || [ -n "$a" ]; do printf ":$a";done)
_pid=${_pid##*:}
if [[ $DRACUT_INSTALL ]]; then
xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" \
| while read line; do
| while read line || [ -n "$line" ]; do
for _fwdir in $fw_dir; do
echo $_fwdir/$line;
done;
@@ -1635,7 +1635,7 @@ find_kernel_modules_by_path () {
_OLDIFS=$IFS
IFS=:
while read a rest; do
while read a rest || [ -n "$a" ]; do
[[ $a = */$1/* ]] || [[ $a = updates/* ]] || continue
printf "%s\n" "$srcmods/$a"
done < "$srcmods/modules.dep"
@@ -1730,7 +1730,7 @@ instmods() {
function instmods_1() {
local _mod _mpargs
if (($# == 0)); then # filenames from stdin
while read _mod; do
while read _mod || [ -n "$_mod" ]; do
inst1mod "${_mod%.ko*}" || {
if [[ "$_check" == "yes" ]] && [[ "$_silent" == "no" ]]; then
dfatal "Failed to install module $_mod"
@@ -1753,7 +1753,7 @@ instmods() {
# Capture all stderr from modprobe to _fderr. We could use {var}>...
# redirections, but that would make dracut require bash4 at least.
eval "( instmods_1 \"\$@\" ) ${_fderr}>&1" \
| while read line; do [[ "$line" =~ $_filter_not_found ]] || echo $line;done | derror
| while read line || [ -n "$line" ]; do [[ "$line" =~ $_filter_not_found ]] || echo $line;done | derror
_ret=$?
return $_ret
}

View File

@@ -14,6 +14,8 @@ SKIP="$dracutbasedir/skipcpio"
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
mount -o ro /boot &>/dev/null
if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
fi
@@ -22,6 +24,7 @@ fi
cd /run/initramfs
[ -f .need_shutdown -a -f "$IMG" ] || exit 1
if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
rm -f -- .need_shutdown
elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then

View File

@@ -365,7 +365,7 @@ dlog() {
if (( $# > 1 )); then
_do_dlog "$@"
else
while read line; do
while read line || [ -n "$line" ]; do
_do_dlog "$1" "$line"
done
fi

View File

@@ -31,7 +31,7 @@ early userspace.
For a complete list of kernel command line options see *dracut.cmdline*(7).
If you are dropped to an emergency shell, while booting your initramfs,
the file _/run/initramfs/rdsosreport.txt_ is created, which can be safed to a
the file _/run/initramfs/rdsosreport.txt_ is created, which can be saved to a
(to be mounted by hand) partition (usually /boot) or a USB stick.
Additional debugging info can be produced by adding **rd.debug** to the kernel
command line. _/run/initramfs/rdsosreport.txt_ contains all logs and the output
@@ -465,6 +465,20 @@ will not be able to boot.
**--loginstall _<DIR>_::
Log all files installed from the host to _<DIR>_.
**--uefi::
Instead of creating an initramfs image, dracut will create an UEFI executable,
which can be executed by an UEFI BIOS.
**--uefi-stub _<FILE>_::
Specifies the UEFI stub loader, which will load the attached kernel, initramfs and
kernel command line and boots the kernel. The default is
_/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
or _/usr/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
**--kernel-image _<FILE>_::
Specifies the kernel image, which to include in the UEFI executable. The default is
_/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
FILES
-----
_/var/log/dracut.log_::

View File

@@ -163,7 +163,7 @@ Misc
Debug
~~~~~
If you are dropped to an emergency shell, the file
_/run/initramfs/rdsosreport.txt_ is created, which can be safed to a (to be
_/run/initramfs/rdsosreport.txt_ is created, which can be saved to a (to be
mounted by hand) partition (usually /boot) or a USB stick. Additional debugging
info can be produced by adding **rd.debug** to the kernel command line.
_/run/initramfs/rdsosreport.txt_ contains all logs and the output of some tools.
@@ -834,11 +834,39 @@ Enables debug output from the live boot process.
Specifies the directory within the squashfs where the ext3fs.img or rootfs.img
can be found. By default, this is __LiveOS__.
**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.
**rd.live.overlay=**_<devspec>_:_(<pathspec>|auto)__
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 used to
persist the changes made to the device specified by **root=live:__<url>__** option.
+
[listing]
.Example
--
rd.live.overlay=/dev/sdb1:persistent-overlay.img
--
**rd.live.overlay.thin=**1::
Enables the usage of thin snapshots instead of classic dm snapshots.
The advantage of thin snapshots is, that they support discards, and will free
blocks which are not claimed by the filesystem. In this use case this means,
that memory is given back to the kernel, when the filesystem does not claim it
anymore.
**rd.writable.fsimg=**1::
Enables writable filesystem support. The system will boot with a fully
writable filesystem without snapshots __(see notes above about available live boot options)__.
You can use the **rootflags** option to set mount options for the live
filesystem as well __(see documentation about rootflags in the **Standard** section above)__.
This implies that the whole image is copied to RAM before the boot continues.
+
NOTE: There must be enough free RAM available to hold the complete image.
+
This method is very suitable for diskless boots.
Plymouth Boot Splash

View File

@@ -10,7 +10,8 @@ dracut.conf - configuration file(s) for dracut
SYNOPSIS
--------
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_
_/etc/dracut.conf_
_/etc/dracut.conf.d/\*.conf_
_/usr/lib/dracut/dracut.conf.d/*.conf_
Description
@@ -74,6 +75,13 @@ Configuration files must have the extension .conf; other extensions are ignored.
Specify additional files to include in the initramfs, separated by spaces,
if they exist.
*compress=*"__{bzip2|lzma|xz|gzip|lzo|lz4|<compressor [args ...]>}__"::
Compress the generated initramfs using the passed compression program. If
you pass it just the name of a compression program, it will call that
program with known-working arguments. If you pass arguments, it will be called
with exactly those arguments. Depending on what you pass, this may result in
an initramfs that the kernel cannot decompress.
*do_strip=*"__{yes|no}__"::
Strip binaries in the initramfs (default=yes)
@@ -84,7 +92,7 @@ Configuration files must have the extension .conf; other extensions are ignored.
Host-Only mode: Install only what is needed for booting the local host
instead of a generic host and generate host-specific configuration.
*hostonly_cmdline*"__{yes|no}__"::
*hostonly_cmdline=*"__{yes|no}__"::
If set, store the kernel command line arguments needed in the initramfs
*persistent_policy=*"__<policy>__"::
@@ -189,6 +197,16 @@ provide a valid _/etc/fstab_.
*loginstall=*"__<DIR>__"::
Log all files installed from the host to _<DIR>_.
*uefi_stub=*"_<FILE>_"::
Specifies the UEFI stub loader, which will load the attached kernel, initramfs and
kernel command line and boots the kernel. The default is
_/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
or _/usr/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
*kernel_image=*"_<FILE>_"::
Specifies the kernel image, which to include in the UEFI executable. The default is
_/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
Files
-----
_/etc/dracut.conf_::

View File

@@ -15,4 +15,5 @@ systemdsystemunitdir=/usr/lib/systemd/system
systemdsystemconfdir=/etc/systemd/system
udevdir=/usr/lib/udev
hostonly="yes"
hostonly_cmdline="no"
early_microcode="yes"

View File

@@ -19,7 +19,7 @@ you can replace init with your own version of _99base_, this is not encouraged.
Instead you should use, if possible, the hooks of dracut. All hooks, and the
point of time in which they are executed, are described in <<stages>>.
The main script, which creates the initramfs is dracut itsself. It parses all
The main script, which creates the initramfs is dracut itself. It parses all
arguments and sets up the directory, in which everything is installed. It then
executes all check, install, installkernel scripts found in the modules, which
are to be processed. After everything is installed, the install directory is

221
dracut.sh
View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash --norc
#
# Generator script for a dracut initramfs
# Tries to retain some degree of compatibility with the command line
@@ -195,6 +195,10 @@ Creates initial ramdisk images for preloading modules
--logfile [FILE] Logfile to use (overrides configuration setting)
--reproducible Create reproducible images
--loginstall [DIR] Log all files installed from the host to [DIR]
--uefi Create an UEFI executable with the kernel cmdline and
kernel combined
--uefi-stub [FILE] Use the UEFI stub [FILE] to create an UEFI executable
--kernel-image [FILE] location of the kernel image
If [LIST] has multiple arguments, then you have to put these in quotes.
@@ -389,6 +393,9 @@ rearrange_params()
--long no-early-microcode \
--long reproducible \
--long loginstall: \
--long uefi \
--long uefi-stub: \
--long kernel-image: \
-- "$@")
if (( $? != 0 )); then
@@ -577,6 +584,11 @@ while :; do
--regenerate-all) regenerate_all="yes";;
--noimageifnotneeded) noimageifnotneeded="yes";;
--reproducible) reproducible_l="yes";;
--uefi) uefi="yes";;
--uefi-stub)
uefi_stub_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--kernel-image)
kernel_image_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--) shift; break;;
*) # should not even reach this point
@@ -809,7 +821,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware"
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware /lib/firmware/$kernel"
[[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
[[ $tmpdir ]] || tmpdir=/var/tmp
[[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS
@@ -822,6 +834,8 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $logfile_l ]] && logfile="$logfile_l"
[[ $reproducible_l ]] && reproducible="$reproducible_l"
[[ $loginstall_l ]] && loginstall="$loginstall_l"
[[ $uefi_stub_l ]] && uefi_stub="$uefi_stub_l"
[[ $kernel_image_l ]] && kernel_image="$kernel_image_l"
# eliminate IFS hackery when messing with fw_dir
fw_dir=${fw_dir//:/ }
@@ -839,7 +853,8 @@ fi
# handle compression options.
[[ $compress ]] || compress="gzip"
case $compress in
bzip2) compress="bzip2 -9";;
bzip2) compress="bzip2 -9";
command -v lbzip2 > /dev/null 2>&1 && compress="lbzip2 -9";;
lzma) compress="lzma -9 -T0";;
xz) compress="xz --check=crc32 --lzma2=dict=1MiB -T0";;
gzip) compress="gzip -n -9";
@@ -880,6 +895,7 @@ trap '
ret=$?;
[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf -- "$initdir"; };
[[ $keep ]] && echo "Not removing $early_cpio_dir." >&2 || { [[ $early_cpio_dir ]] && rm -Rf -- "$early_cpio_dir"; };
[[ $keep ]] && echo "Not removing $uefi_outdir." >&2 || { [[ $uefi_outdir ]] && rm -Rf -- "$uefi_outdir"; };
[[ $_dlogdir ]] && rm -Rf -- "$_dlogdir";
exit $ret;
' EXIT
@@ -919,7 +935,7 @@ if ! [[ $print_cmdline ]]; then
rm -fr -- ${initdir}/*
fi
# Verify bash version, current minimum is 3.1
# Verify bash version, current minimum is 4
if (( BASH_VERSINFO[0] < 4 )); then
dfatal 'You need at least Bash 4 to use dracut, sorry.'
exit 1
@@ -1031,6 +1047,48 @@ if [[ ! $print_cmdline ]]; then
fi
loginstall=$(readlink -f "$loginstall")
fi
if [[ $uefi = yes ]]; then
if ! command -v objcopy &>/dev/null; then
dfatal "Need 'objcopy' to create a UEFI executable"
exit 1
fi
unset EFI_MACHINE_TYPE_NAME
case $(arch) in
x86_64)
EFI_MACHINE_TYPE_NAME=x64;;
ia32)
EFI_MACHINE_TYPE_NAME=ia32;;
*)
dfatal "Architecture '$(arch)' not supported to create a UEFI executable"
exit 1
;;
esac
if ! [[ -s $uefi_stub ]]; then
for uefi_stub in \
"/lib/systemd/boot/efi/linux${EFI_MACHINE_TYPE_NAME}.efi.stub" \
"/usr/lib/gummiboot/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"; do
[[ -s $uefi_stub ]] || continue
break
done
fi
if ! [[ -s $uefi_stub ]]; then
dfatal "Can't find a uefi stub '$uefi_stub' to create a UEFI executable"
exit 1
fi
if ! [[ $kernel_image ]]; then
for kernel_image in "/lib/modules/$kernel/vmlinuz" "/boot/vmlinuz-$kernel"; do
[[ -s "$kernel_image" ]] || continue
break
done
fi
if ! [[ -s $kernel_image ]]; then
dfatal "Can't find a kernel image '$kernel_image' to create a UEFI executable"
exit 1
fi
fi
fi
if [[ $acpi_override = yes ]] && ! check_kernel_config CONFIG_ACPI_INITRD_TABLE_OVERRIDE; then
@@ -1094,7 +1152,7 @@ done
for f in $add_fstab; do
[[ -e $f ]] || continue
while read dev rest; do
while read dev rest || [ -n "$dev" ]; do
push_host_devs "$dev"
done < "$f"
done
@@ -1141,11 +1199,11 @@ if [[ $hostonly ]]; then
done
if [[ -f /proc/swaps ]] && [[ -f /etc/fstab ]]; then
while read dev type rest; do
while read dev type rest || [ -n "$dev" ]; do
[[ -b $dev ]] || continue
[[ "$type" == "partition" ]] || continue
while read _d _m _t _o _r; do
while read _d _m _t _o _r || [ -n "$_d" ]; do
[[ "$_d" == \#* ]] && continue
[[ $_d ]] || continue
[[ $_t != "swap" ]] && continue
@@ -1155,7 +1213,7 @@ if [[ $hostonly ]]; then
[[ "$_d" -ef "$dev" ]] || continue
if [[ -f /etc/crypttab ]]; then
while read _mapper _a _p _o; do
while read _mapper _a _p _o || [ -n "$_mapper" ]; do
[[ $_mapper = \#* ]] && continue
[[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
[[ "$_o" ]] || _o="$_p"
@@ -1166,7 +1224,9 @@ if [[ $hostonly ]]; then
done < /etc/crypttab
fi
push_host_devs "$(readlink -f "$dev")"
_dev="$(readlink -f "$dev")"
push_host_devs "$_dev"
push swap_devs "$_dev"
break
done < /etc/fstab
done < /proc/swaps
@@ -1174,8 +1234,8 @@ if [[ $hostonly ]]; then
# record all host modaliases
declare -A host_modalias
find /sys/devices/ -name uevent -print > "$initdir/.modalias"
while read m; do
while read line; do
while read m || [ -n "$m" ]; do
while read line || [ -n "$line" ]; do
[[ "$line" != MODALIAS\=* ]] && continue
modalias="${line##MODALIAS=}" && [[ $modalias ]] && host_modalias["$modalias"]=1
break
@@ -1184,14 +1244,14 @@ if [[ $hostonly ]]; then
rm -f -- "$initdir/.modalias"
while read _k _s _v; do
while read _k _s _v || [ -n "$_k" ]; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
host_modalias["$_v"]=1
done </proc/crypto
# check /proc/modules
declare -A host_modules
while read m rest; do
while read m rest || [ -n "$m" ]; do
host_modules["$m"]=1
done </proc/modules
fi
@@ -1277,7 +1337,7 @@ export initdir dracutbasedir \
omit_drivers mdadmconf lvmconf root_dev \
use_fstab fstab_lines libdirs fscks nofscks ro_mnt \
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
debug host_fs_types host_devs sshkey add_fstab \
debug host_fs_types host_devs swap_devs sshkey add_fstab \
DRACUT_VERSION udevdir prefix filesystems drivers \
systemdutildir systemdsystemunitdir systemdsystemconfdir \
host_modalias host_modules hostonly_cmdline loginstall \
@@ -1291,14 +1351,24 @@ for_each_module_dir check_mount
dracut_module_included "fips" && export DRACUT_FIPS_MODE=1
if [[ $print_cmdline ]]; then
modules_loaded=" "
do_print_cmdline()
{
local -A _mods_to_print
for i in $modules_loaded $mods_to_load; do
_mods_to_print[$i]=1
done
# source our modules.
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
_d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
[[ ${_mods_to_print[$_d_mod]} ]] || continue
module_cmdline "$_d_mod"
done
unset moddir
}
if [[ $print_cmdline ]]; then
do_print_cmdline
printf "\n"
exit 0
fi
@@ -1317,7 +1387,7 @@ if [[ $prefix ]]; then
fi
if [[ $kernel_only != yes ]]; then
for d in usr/bin usr/sbin bin etc lib sbin tmp usr var $libdirs; do
for d in usr/bin usr/sbin bin etc lib sbin tmp usr var var/tmp $libdirs; do
[[ -e "${initdir}${prefix}/$d" ]] && continue
if [ -L "/$d" ]; then
inst_symlink "/$d" "${prefix}/$d"
@@ -1364,36 +1434,35 @@ modules_loaded=" "
# source our modules.
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
_d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
if [[ "$mods_to_load" == *\ $_d_mod\ * ]]; then
if [[ $show_modules = yes ]]; then
printf "%s\n" "$_d_mod"
else
dinfo "*** Including module: $_d_mod ***"
fi
if [[ $kernel_only == yes ]]; then
[[ "$mods_to_load" == *\ $_d_mod\ * ]] || continue
if [[ $show_modules = yes ]]; then
printf "%s\n" "$_d_mod"
else
dinfo "*** Including module: $_d_mod ***"
fi
if [[ $kernel_only == yes ]]; then
module_installkernel "$_d_mod" || {
dfatal "installkernel failed in module $_d_mod"
exit 1
}
else
module_install "$_d_mod"
if [[ $no_kernel != yes ]]; then
module_installkernel "$_d_mod" || {
dfatal "installkernel failed in module $_d_mod"
exit 1
}
else
module_install "$_d_mod"
if [[ $no_kernel != yes ]]; then
module_installkernel "$_d_mod" || {
dfatal "installkernel failed in module $_d_mod"
exit 1
}
fi
fi
mods_to_load=${mods_to_load// $_d_mod /}
modules_loaded+="$_d_mod "
fi
mods_to_load=${mods_to_load// $_d_mod /}
modules_loaded+="$_d_mod "
#print the module install size
if [ -n "$printsize" ]; then
_isize_new=$(du -sk ${initdir}|cut -f1)
_isize_delta=$((_isize_new - _isize))
printf "%s\n" "$_d_mod install size: ${_isize_delta}k"
_isize=$_isize_new
fi
#print the module install size
if [ -n "$printsize" ]; then
_isize_new=$(du -sk ${initdir}|cut -f1)
_isize_delta=$((_isize_new - _isize))
printf "%s\n" "$_d_mod install size: ${_isize_delta}k"
_isize=$_isize_new
fi
done
unset moddir
@@ -1452,6 +1521,7 @@ if [[ $kernel_only != yes ]]; then
[ -z "${line[3]}" ] && line[3]="defaults"
[ -z "${line[4]}" ] && line[4]="0"
[ -z "${line[5]}" ] && line[5]="2"
strstr "${line[2]}" "nfs" && line[5]="0"
echo "${line[@]}" >> "${initdir}/etc/fstab"
done
@@ -1485,27 +1555,29 @@ if [[ $kernel_only != yes ]]; then
done
fi
while pop include_src src && pop include_target tgt; do
if [[ $src && $tgt ]]; then
while pop include_src src && pop include_target target; do
if [[ $src && $target ]]; then
if [[ -f $src ]]; then
inst $src $tgt
inst $src $target
else
ddebug "Including directory: $src"
destdir="${initdir}/${tgt}"
destdir="${initdir}/${target}"
mkdir -p "$destdir"
# check for preexisting symlinks, so we can cope with the
# symlinks to $prefix
for i in "$src"/*; do
[[ -e "$i" || -h "$i" ]] || continue
s=${destdir}/${i#$src/}
if [[ -d "$i" ]]; then
if ! [[ -e "$s" ]]; then
mkdir -m 0755 -p "$s"
chmod --reference="$i" "$s"
# Objectname is a file or a directory
for objectname in "$src"/*; do
[[ -e "$objectname" || -h "$objectname" ]] || continue
if [[ -d "$objectname" ]]; then
# objectname is a directory, let's compute the final directory name
object_destdir=${destdir}/${objectname#$src/}
if ! [[ -e "$object_destdir" ]]; then
mkdir -m 0755 -p "$object_destdir"
chmod --reference="$objectname" "$object_destdir"
fi
cp --reflink=auto --sparse=auto -fa -t "$s" "$i"/*
cp --reflink=auto --sparse=auto -fa -t "$object_destdir" "$objectname"/*
else
cp --reflink=auto --sparse=auto -fa -t "$destdir" "$i"
cp --reflink=auto --sparse=auto -fa -t "$destdir" "$objectname"
fi
done
fi
@@ -1565,7 +1637,7 @@ if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
# strip kernel modules, but do not touch signed modules
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
| while read -r -d $'\0' f; do
| while read -r -d $'\0' f || [ -n "$f" ]; do
SIG=$(tail -c 28 "$f")
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
done | xargs -r -0 strip -g
@@ -1634,7 +1706,14 @@ if [[ $hostonly_cmdline ]] ; then
fi
fi
rm -f -- "$outfile"
dinfo "*** Creating image file ***"
dinfo "*** Creating image file '$outfile' ***"
if [[ $uefi = yes ]]; then
uefi_outfile="$outfile"
readonly uefi_outdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initrd.XXXXXX)"
# redirect initrd output
outfile="$uefi_outdir/initrd"
fi
if [[ $DRACUT_REPRODUCIBLE ]]; then
find "$initdir" -newer "$dracutbasedir/dracut-functions.sh" -print0 \
@@ -1670,7 +1749,7 @@ if ! (
dfatal "dracut: creation of $outfile failed"
exit 1
fi
dinfo "*** Creating image file done ***"
dinfo "*** Creating initrd image file '$outfile' done ***"
if (( maxloglvl >= 5 )); then
if [[ $allowlocal ]]; then
@@ -1680,4 +1759,32 @@ if (( maxloglvl >= 5 )); then
fi
fi
if [[ $uefi = yes ]]; then
if [[ $kernel_cmdline ]]; then
echo -n "$kernel_cmdline" > "$uefi_outdir/cmdline.txt"
elif [[ $hostonly_cmdline = yes ]] && [ -d $initdir/etc/cmdline.d ];then
for conf in $initdir/etc/cmdline.d/*.conf ; do
[ -e "$conf" ] || continue
printf "%s " "$(< $conf)" >> "$uefi_outdir/cmdline.txt"
done
else
do_print_cmdline > "$uefi_outdir/cmdline.txt"
fi
echo -ne "\x00" >> "$uefi_outdir/cmdline.txt"
dinfo "Using UEFI kernel cmdline:"
dinfo $(< "$uefi_outdir/cmdline.txt")
[[ -s /usr/lib/os-release ]] && uefi_osrelease="/usr/lib/os-release"
[[ -s /etc/os-release ]] && uefi_osrelease="/etc/os-release"
objcopy \
${uefi_osrelease:+--add-section .osrel=$uefi_osrelease --change-section-vma .osrel=0x20000} \
--add-section .cmdline="$uefi_outdir/cmdline.txt" --change-section-vma .cmdline=0x30000 \
--add-section .linux="$kernel_image" --change-section-vma .linux=0x40000 \
--add-section .initrd="$outfile" --change-section-vma .initrd=0x3000000 \
"$uefi_stub" "$uefi_outfile"
dinfo "*** Creating UEFI image file '$uefi_outfile' done ***"
fi
exit 0

View File

@@ -195,20 +195,9 @@ Requires: %{name} = %{version}-%{release}
This package contains tools to assemble the local initrd and host configuration.
%prep
%setup -q -n %{name}-%{version}
%autosetup -n %{name}-%{version} -S git_am
cp %{SOURCE1} .
%if %{defined PATCH1}
git init
git config user.email "dracut-maint@redhat.com"
git config user.name "Fedora dracut team"
git add .
git commit -a -q -m "%{version} baseline."
# Apply all the patches.
git am -p1 %{patches}
%endif
%build
%configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib \
%if %{without doc}
@@ -286,10 +275,6 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
> $RPM_BUILD_ROOT/etc/system-fips
%endif
# create compat symlink
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
ln -sr $RPM_BUILD_ROOT%{_bindir}/dracut $RPM_BUILD_ROOT%{_sbindir}/dracut
%clean
rm -rf -- $RPM_BUILD_ROOT
@@ -301,8 +286,6 @@ rm -rf -- $RPM_BUILD_ROOT
%{!?_licensedir:%global license %%doc}
%license COPYING lgpl-2.1.txt
%{_bindir}/dracut
# compat symlink
%{_sbindir}/dracut
%{_datadir}/bash-completion/completions/dracut
%{_datadir}/bash-completion/completions/lsinitrd
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
@@ -324,6 +307,7 @@ rm -rf -- $RPM_BUILD_ROOT
%endif
%dir %{_sysconfdir}/dracut.conf.d
%dir %{dracutlibdir}/dracut.conf.d
%{_datadir}/pkgconfig/dracut.pc
%if %{with doc}
%{_mandir}/man8/dracut.8*
@@ -345,6 +329,8 @@ rm -rf -- $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/00bootchart
%endif
%{dracutlibdir}/modules.d/00bash
%{dracutlibdir}/modules.d/00systemd
%{dracutlibdir}/modules.d/01systemd-initrd
%{dracutlibdir}/modules.d/03modsign
%{dracutlibdir}/modules.d/03rescue
%{dracutlibdir}/modules.d/04watchdog
@@ -389,7 +375,7 @@ rm -rf -- $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/98pollcdrom
%{dracutlibdir}/modules.d/98selinux
%{dracutlibdir}/modules.d/98syslog
%{dracutlibdir}/modules.d/98systemd
%{dracutlibdir}/modules.d/98dracut-systemd
%{dracutlibdir}/modules.d/98usrmount
%{dracutlibdir}/modules.d/99base
%{dracutlibdir}/modules.d/99fs-lib
@@ -422,7 +408,9 @@ rm -rf -- $RPM_BUILD_ROOT
%files network
%defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/02systemd-networkd
%{dracutlibdir}/modules.d/40network
%{dracutlibdir}/modules.d/90kernel-network-modules
%{dracutlibdir}/modules.d/95fcoe
%{dracutlibdir}/modules.d/95iscsi
%{dracutlibdir}/modules.d/90livenet

View File

@@ -222,7 +222,7 @@ static int cp(const char *src, const char *dst)
if (ret == 0) {
struct timeval tv[2];
if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0)
if(fchown(dest_desc, (__uid_t) - 1, sb.st_gid) != 0)
if(fchown(dest_desc, (uid_t) - 1, sb.st_gid) != 0)
log_error("Failed to chown %s: %m", dst);
tv[0].tv_sec = sb.st_atime;
tv[0].tv_usec = 0;
@@ -388,6 +388,11 @@ static int resolve_deps(const char *src)
break;
}
/* musl ldd */
if (strstr(buf, "Not a valid dynamic program"))
break;
/* glibc */
if (strstr(buf, "not a dynamic executable"))
break;

View File

@@ -20,6 +20,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#define _GNU_SOURCE
#include <inttypes.h>
#include <time.h>
#include <sys/time.h>
@@ -27,6 +29,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <sched.h>
#include <limits.h>

View File

@@ -108,6 +108,12 @@ if ! [[ -f "$image" ]]; then
exit 1
fi
dracutlibdirs() {
for d in lib64/dracut lib/dracut usr/lib64/dracut usr/lib/dracut; do
echo "$d/$1"
done
}
extract_files()
{
(( ${#filenames[@]} == 1 )) && nofileinfo=1
@@ -124,7 +130,8 @@ extract_files()
list_modules()
{
echo "dracut modules:"
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/modules.txt' 'usr/lib/dracut/modules.txt' 2>/dev/null
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
$(dracutlibdirs modules.txt) 2>/dev/null
((ret+=$?))
}
@@ -142,7 +149,7 @@ list_files()
if (( ${#filenames[@]} <= 0 )); then
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
echo "Image: $image: $(du -h $image | while read a b || [ -n "$a" ]; do echo $a;done)"
echo "========================================================================"
fi
@@ -217,7 +224,8 @@ ret=0
if (( ${#filenames[@]} > 0 )); then
extract_files
else
version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/dracut-*' 'usr/lib/dracut/dracut-*' 2>/dev/null)
version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
$(dracutlibdirs 'dracut-*') 2>/dev/null)
((ret+=$?))
echo "Version: $version"
echo
@@ -226,7 +234,8 @@ else
echo "========================================================================"
else
echo -n "Arguments: "
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/build-parameter.txt' 'usr/lib/dracut/build-parameter.txt' 2>/dev/null
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
$(dracutlibdirs build-parameter.txt) 2>/dev/null
echo
list_modules
list_files

View File

@@ -51,14 +51,14 @@ install() {
$systemdsystemunitdir/basic.target \
$systemdsystemunitdir/halt.target \
$systemdsystemunitdir/kexec.target \
$systemdsystemunitdir/initrd.target \
$systemdsystemunitdir/initrd-fs.target \
$systemdsystemunitdir/initrd-root-fs.target \
$systemdsystemunitdir/local-fs.target \
$systemdsystemunitdir/local-fs-pre.target \
$systemdsystemunitdir/remote-fs.target \
$systemdsystemunitdir/remote-fs-pre.target \
$systemdsystemunitdir/multi-user.target \
$systemdsystemunitdir/network.target \
$systemdsystemunitdir/network-pre.target \
$systemdsystemunitdir/network-online.target \
$systemdsystemunitdir/nss-lookup.target \
$systemdsystemunitdir/nss-user-lookup.target \
$systemdsystemunitdir/poweroff.target \
@@ -98,6 +98,7 @@ install() {
$systemdsystemunitdir/systemd-journald.service \
$systemdsystemunitdir/systemd-vconsole-setup.service \
$systemdsystemunitdir/systemd-random-seed-load.service \
$systemdsystemunitdir/systemd-random-seed.service \
$systemdsystemunitdir/systemd-sysctl.service \
\
$systemdsystemunitdir/sysinit.target.wants/systemd-modules-load.service \
@@ -115,19 +116,20 @@ install() {
$systemdsystemunitdir/sysinit.target.wants/systemd-sysctl.service \
\
$systemdsystemunitdir/ctrl-alt-del.target \
$systemdsystemunitdir/reboot.target \
$systemdsystemunitdir/systemd-reboot.service \
$systemdsystemunitdir/syslog.socket \
$systemdsystemunitdir/initrd-switch-root.target \
$systemdsystemunitdir/initrd-switch-root.service \
$systemdsystemunitdir/initrd-cleanup.service \
$systemdsystemunitdir/initrd-udevadm-cleanup-db.service \
$systemdsystemunitdir/initrd-parse-etc.service \
\
$systemdsystemunitdir/slices.target \
$systemdsystemunitdir/system.slice \
\
$tmpfilesdir/systemd.conf \
\
journalctl systemctl echo swapoff systemd-cgls systemd-tmpfiles
journalctl systemctl \
echo swapoff \
kmod insmod rmmod modprobe modinfo depmod lsmod \
mount umount reboot poweroff \
systemd-cgls systemd-tmpfiles
inst_multiple -o \
/usr/lib/modules-load.d/*.conf \
@@ -137,7 +139,7 @@ install() {
local _line i
for i in "$1"/*.conf; do
[[ -f $i ]] || continue
while read _line; do
while read _line || [ -n "$_line" ]; do
case $_line in
\#*)
;;
@@ -175,30 +177,15 @@ install() {
# install adm user/group for journald
inst_multiple nologin
egrep '^systemd-journal:' "$initdir/etc/passwd" 2>/dev/null >> "$initdir/etc/passwd"
egrep '^systemd-journal:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
egrep '^adm:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
egrep '^systemd-journal:' /etc/group >> "$initdir/etc/group"
egrep '^wheel:' /etc/group >> "$initdir/etc/group"
egrep '^adm:' /etc/group >> "$initdir/etc/group"
ln_r $systemdutildir/systemd "/init"
ln_r $systemdutildir/systemd "/sbin/init"
inst_script "$moddir/dracut-emergency.sh" /bin/dracut-emergency
inst_simple "$moddir/emergency.service" ${systemdsystemunitdir}/emergency.service
inst_simple "$moddir/dracut-emergency.service" ${systemdsystemunitdir}/dracut-emergency.service
inst_simple "$moddir/emergency.service" ${systemdsystemunitdir}/rescue.service
ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target"
inst_script "$moddir/dracut-cmdline.sh" /bin/dracut-cmdline
inst_script "$moddir/dracut-cmdline-ask.sh" /bin/dracut-cmdline-ask
inst_script "$moddir/dracut-pre-udev.sh" /bin/dracut-pre-udev
inst_script "$moddir/dracut-pre-trigger.sh" /bin/dracut-pre-trigger
inst_script "$moddir/dracut-initqueue.sh" /bin/dracut-initqueue
inst_script "$moddir/dracut-pre-mount.sh" /bin/dracut-pre-mount
inst_script "$moddir/dracut-mount.sh" /bin/dracut-mount
inst_script "$moddir/dracut-pre-pivot.sh" /bin/dracut-pre-pivot
inst_script "$moddir/rootfs-generator.sh" $systemdutildir/system-generators/dracut-rootfs-generator
inst_binary true
ln_r $(type -P true) "/usr/bin/loginctl"
ln_r $(type -P true) "/bin/loginctl"
@@ -211,8 +198,7 @@ install() {
for i in \
emergency.target \
dracut-emergency.service \
rescue.service \
rescue.target \
systemd-ask-password-console.service \
systemd-ask-password-plymouth.service \
; do
@@ -221,24 +207,6 @@ install() {
"${systemdsystemunitdir}/${i}.wants/systemd-vconsole-setup.service"
done
mkdir -p "${initdir}/$systemdsystemunitdir/initrd.target.wants"
for i in \
dracut-cmdline.service \
dracut-cmdline-ask.service \
dracut-initqueue.service \
dracut-mount.service \
dracut-pre-mount.service \
dracut-pre-pivot.service \
dracut-pre-trigger.service \
dracut-pre-udev.service \
; do
inst_simple "$moddir/${i}" "$systemdsystemunitdir/${i}"
ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/initrd.target.wants/${i}"
done
inst_simple "$moddir/dracut-tmpfiles.conf" "$tmpfilesdir/dracut-tmpfiles.conf"
mkdir -p "$initdir/etc/systemd"
# turn off RateLimit for journal
{
@@ -247,5 +215,6 @@ install() {
echo "RateLimitBurst=0"
} >> "$initdir/etc/systemd/journald.conf"
ln_r "${systemdsystemunitdir}/multi-user.target" "${systemdsystemunitdir}/default.target"
}

View File

@@ -59,8 +59,8 @@ do_rhevh_check()
kpath=${1}
# If we're on RHEV-H, the kernel is in /run/initramfs/live/vmlinuz0
HMAC_SUM_ORIG=$(cat $NEWROOT/boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done)
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b; do printf "%s\n" $a; done || return 1)
HMAC_SUM_ORIG=$(cat $NEWROOT/boot/.vmlinuz-${KERNEL}.hmac | while read a b || [ -n "$a" ]; do printf "%s\n" $a; done)
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b || [ -n "$a" ]; do printf "%s\n" $a; done || return 1)
if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
warn "HMAC sum mismatch"
return 1
@@ -92,7 +92,7 @@ do_fips()
if ! modprobe "${_module}"; then
# check if kernel provides generic algo
_found=0
while read _k _s _v; do
while read _k _s _v || [ -n "$_k" ]; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
[ "$_v" != "$_module" ] && continue
_found=1

View File

@@ -14,10 +14,11 @@ depends() {
installkernel() {
local _fipsmodules _mod
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
_fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod "
_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"
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"

View File

@@ -0,0 +1,68 @@
#!/bin/bash
# called by dracut
check() {
[[ $mount_needs ]] && return 1
if ! dracut_module_included "systemd"; then
derror "dracut-systemd needs systemd in the initramfs"
return 1
fi
return 0
}
# called by dracut
depends() {
echo "systemd"
}
installkernel() {
return 0
}
# called by dracut
install() {
local _mods
inst_multiple -o \
$systemdsystemunitdir/initrd.target \
$systemdsystemunitdir/initrd-fs.target \
$systemdsystemunitdir/initrd-root-fs.target \
$systemdsystemunitdir/initrd-switch-root.target \
$systemdsystemunitdir/initrd-switch-root.service \
$systemdsystemunitdir/initrd-cleanup.service \
$systemdsystemunitdir/initrd-udevadm-cleanup-db.service \
$systemdsystemunitdir/initrd-parse-etc.service
ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target"
if [ -e /etc/os-release ]; then
. /etc/os-release
VERSION+=" "
PRETTY_NAME+=" "
else
VERSION=""
PRETTY_NAME=""
fi
NAME=dracut
ID=dracut
VERSION+="dracut-$DRACUT_VERSION"
PRETTY_NAME+="dracut-$DRACUT_VERSION (Initramfs)"
VERSION_ID=$DRACUT_VERSION
ANSI_COLOR="0;34"
{
echo NAME=\"$NAME\"
echo VERSION=\"$VERSION\"
echo ID=$ID
echo VERSION_ID=$VERSION_ID
echo PRETTY_NAME=\"$PRETTY_NAME\"
echo ANSI_COLOR=\"$ANSI_COLOR\"
} > $initdir/usr/lib/initrd-release
echo dracut-$DRACUT_VERSION > $initdir/lib/dracut/dracut-$DRACUT_VERSION
ln -sf ../usr/lib/initrd-release $initdir/etc/initrd-release
ln -sf initrd-release $initdir/usr/lib/os-release
ln -sf initrd-release $initdir/etc/os-release
}

View File

@@ -4,7 +4,7 @@ capsmode=$(getarg rd.caps)
if [ "$capsmode" = "1" ]; then
CAPS_INIT_DROP=$(getarg rd.caps.initdrop=)
CAPS_USERMODEHELPER_BSET=$(capsh --drop="$CAPS_INIT_DROP" -- -c 'while read a b ; do [ "$a" = "CapBnd:" ] && echo $((0x${b:$((${#b}-8)):8})) $((0x${b:$((${#b}-16)):8})) && break; done < /proc/self/status')
CAPS_USERMODEHELPER_BSET=$(capsh --drop="$CAPS_INIT_DROP" -- -c 'while read a b || [ -n "$a" ]; do [ "$a" = "CapBnd:" ] && echo $((0x${b:$((${#b}-8)):8})) $((0x${b:$((${#b}-16)):8})) && break; done < /proc/self/status')
CAPS_MODULES_DISABLED=$(getarg rd.caps.disablemodules=)
CAPS_KEXEC_DISABLED=$(getarg rd.caps.disablekexec=)

View File

@@ -0,0 +1,71 @@
#!/bin/bash
# called by dracut
check() {
[[ $mount_needs ]] && return 1
if ! dracut_module_included "systemd"; then
derror "dracut-systemd needs systemd in the initramfs"
return 1
fi
return 255
}
# called by dracut
depends() {
echo "systemd kernel-network-modules"
}
installkernel() {
return 0
}
# called by dracut
install() {
inst_multiple -o \
$systemdutildir/systemd-networkd \
$systemdutildir/systemd-networkd-wait-online \
$systemdsystemunitdir/systemd-networkd-wait-online.service \
$systemdsystemunitdir/systemd-networkd.service \
$systemdsystemunitdir/systemd-networkd.socket \
$systemdutildir/network/99-default.link \
networkctl ip
#hostnamectl timedatectl
# $systemdutildir/systemd-timesyncd \
# $systemdutildir/systemd-timedated \
# $systemdutildir/systemd-hostnamed \
# $systemdutildir/systemd-resolvd \
# $systemdutildir/systemd-resolve-host \
# $systemdsystemunitdir/systemd-resolved.service \
# $systemdsystemunitdir/systemd-hostnamed.service \
# $systemdsystemunitdir/systemd-timesyncd.service \
# $systemdsystemunitdir/systemd-timedated.service \
# $systemdsystemunitdir/time-sync.target \
# /etc/systemd/resolved.conf \
# inst_dir /var/lib/systemd/clock
egrep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
egrep '^systemd-network:' /etc/group >> "$initdir/etc/group"
# egrep '^systemd-timesync:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
# egrep '^systemd-timesync:' /etc/group >> "$initdir/etc/group"
_arch=$(uname -m)
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*" \
{"tls/$_arch/",tls/,"$_arch/",}"libnss_myhostname.so.*" \
{"tls/$_arch/",tls/,"$_arch/",}"libnss_resolve.so.*"
for i in \
systemd-networkd-wait-online.service \
systemd-networkd.service \
systemd-networkd.socket
# systemd-timesyncd.service
do
systemctl --root "$initdir" enable "$i"
done
}

View File

@@ -40,7 +40,7 @@ install() {
*) cmd=grep ;;
esac
for INCL in $($cmd "^include " $MAP | while read a a b; do echo ${a//\"/}; done); do
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
done
@@ -114,12 +114,12 @@ install() {
rm -f -- "${initdir}${kbddir}/consoletrans/utflist"
find "${initdir}${kbddir}/" -name README\* -delete
find "${initdir}${kbddir}/" -name '*.gz' -print -quit \
| while read line; do
| while read line || [ -n "$line" ]; do
inst_multiple gzip
done
find "${initdir}${kbddir}/" -name '*.bz2' -print -quit \
| while read line; do
| while read line || [ -n "$line" ]; do
inst_multiple bzip2
done
}

View File

@@ -74,7 +74,7 @@ rm -f -- "$testfile"
find_mount() {
local dev mnt etc wanted_dev
wanted_dev="$(readlink -e -q $1)"
while read dev mnt etc; do
while read dev mnt etc || [ -n "$dev" ]; do
[ "$dev" = "$wanted_dev" ] && echo "$dev" && return 0
done < /proc/mounts
return 1
@@ -93,7 +93,7 @@ else
return 1
fi
while read a m a; do
while read a m a || [ -n "$m" ]; do
[ "$m" = "$1" ] && return 0
done < /proc/mounts
return 1

View File

@@ -43,7 +43,13 @@ setup_interface() {
valid_lft ${lease_time} preferred_lft ${lease_time} \
dev $netif
[ -n "$gw" ] && echo ip route replace default via $gw dev $netif > /tmp/net.$netif.gw
if [ -n "$gw" ] ; then
if [ "$mask" == "255.255.255.255" ] ; then
# point-to-point connection => set explicit route to gateway
echo ip route add $gw dev $netif > /tmp/net.$netif.gw
fi
echo ip route replace default via $gw dev $netif >> /tmp/net.$netif.gw
fi
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
if [ -n "$namesrv" ] ; then
@@ -93,8 +99,9 @@ case $reason in
;;
PREINIT6)
echo "dhcp: PREINIT $netif up"
echo "dhcp: PREINIT6 $netif up"
linkup $netif
wait_for_ipv6_dad $netif
;;
BOUND)
@@ -111,7 +118,7 @@ case $reason in
fi
unset layer2
setup_interface
set | while read line; do
set | while read line || [ -n "$line" ]; do
[ "${line#new_}" = "$line" ] && continue
echo "$line"
done >/tmp/dhclient.$netif.dhcpopts
@@ -132,7 +139,7 @@ case $reason in
echo "dhcp: BOND6 setting $netif"
setup_interface6
set | while read line; do
set | while read line || [ -n "$line" ]; do
[ "${line#new_}" = "$line" ] && continue
echo "$line"
done >/tmp/dhclient.$netif.dhcpopts

View File

@@ -11,61 +11,13 @@ check() {
# called by dracut
depends() {
echo "kernel-network-modules"
return 0
}
# called by dracut
installkernel() {
# Include wired net drivers, excluding wireless
local _arch=$(uname -m)
net_module_filter() {
local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open'
local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'
local _ret
# subfunctions inherit following FDs
local _merge=8 _side2=9
function nmf1() {
local _fname _fcont
while read _fname; do
[[ $_fname =~ $_unwanted_drivers ]] && continue
case "$_fname" in
*.ko) _fcont="$(< $_fname)" ;;
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
*.ko.xz) _fcont="$(xz -dc $_fname)" ;;
esac
[[ $_fcont =~ $_net_drivers
&& ! $_fcont =~ iw_handler_get_spy ]] \
&& echo "$_fname"
done
return 0
}
function rotor() {
local _f1 _f2
while read _f1; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}
fi
done | nmf1 1>&${_merge}
return 0
}
# Use two parallel streams to filter alternating modules.
set +x
eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
[[ $debug ]] && set -x
return 0
}
{ find_kernel_modules_by_path drivers/net; if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then find_kernel_modules_by_path drivers/s390/net; fi; } \
| net_module_filter | instmods
#instmods() will take care of hostonly
instmods \
=drivers/net/phy \
=drivers/net/team \
=drivers/net/ethernet \
ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net
return 0
}
# called by dracut

View File

@@ -94,13 +94,13 @@ setup_net() {
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
[ -z "$IFACES" ] && IFACES="$netif"
# run the scripts written by ifup
[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
[ -e /tmp/net.$netif.hostname ] && . /tmp/net.$netif.hostname
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
# set up resolv.conf
[ -e /tmp/net.$netif.resolv.conf ] && \
cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf
[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
# add static route
for _p in $(getargs rd.route); do
@@ -520,7 +520,7 @@ wait_for_ipv6_dad() {
local cnt=0
local li
while [ $cnt -lt 500 ]; do
li=$(ip -6 addr show dev $1)
li=$(ip -6 addr show dev $1 scope link)
strstr "$li" "tentative" || return 0
sleep 0.1
cnt=$(($cnt+1))
@@ -554,13 +554,18 @@ type hostname >/dev/null 2>&1 || \
}
iface_has_link() {
local cnt=0
local interface="$1" flags=""
[ -n "$interface" ] || return 2
interface="/sys/class/net/$interface"
[ -d "$interface" ] || return 2
linkup "$1"
[ "$(cat $interface/carrier)" = 1 ] || return 1
# XXX Do we need to reset the flags here? anaconda never bothered..
while [ $cnt -lt 50 ]; do
[ "$(cat $interface/carrier)" = 1 ] && return 0
sleep 0.1
cnt=$(($cnt+1))
done
return 1
}
find_iface_with_link() {

View File

@@ -22,7 +22,7 @@ get_config_line_by_subchannel()
local line
CHANNELS="$1"
while read line; do
while read line || [ -n "$line" ]; do
if strstr "$line" "$CHANNELS"; then
echo $line
return 0
@@ -137,6 +137,8 @@ for netup in /tmp/net.*.did-setup ; do
unset macaddr
unset slave
unset ethname
unset vlan
[ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info
uuid=$(cat /proc/sys/kernel/random/uuid)

View File

@@ -120,7 +120,7 @@ command -v ctorrent >/dev/null \
nfs_already_mounted() {
local server="$1" path="$2" localdir="" s="" p=""
cat /proc/mounts | while read src mnt rest; do
cat /proc/mounts | while read src mnt rest || [ -n "$src" ]; do
splitsep ":" "$src" s p
if [ "$server" = "$s" ]; then
if [ "$path" = "$p" ]; then

View File

@@ -22,7 +22,7 @@ installkernel() {
local _merge=8 _side2=9
function nmf1() {
local _fname _fcont
while read _fname; do
while read _fname || [ -n "$_fname" ]; do
case "$_fname" in
*.ko) _fcont="$(< $_fname)" ;;
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
@@ -35,7 +35,7 @@ installkernel() {
}
function rotor() {
local _f1 _f2
while read _f1; do
while read _f1 || [ -n "$_f1" ]; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}
@@ -60,6 +60,8 @@ installkernel() {
${NULL}
fi
instmods amdkfd hyperv_fb
for _modname in $(find_kernel_modules_by_path drivers/gpu/drm \
| drm_module_filter) ; do
# if the hardware is present, include module even if it is not currently loaded,
@@ -68,6 +70,10 @@ installkernel() {
if [[ $hostonly ]] && modinfo -F alias $_modname | sed -e 's,\?,\.,g' -e 's,\*,\.\*,g' \
| grep -qxf - /sys/bus/{pci/devices,soc/devices/soc?}/*/modalias 2>/dev/null; then
hostonly='' instmods $_modname
# if radeon.ko is installed, we want amdkfd also
if strstr "$_modname" radeon.ko; then
hostonly='' instmods amdkfd
fi
continue
fi
instmods $_modname

View File

@@ -3,7 +3,7 @@
# called by dracut
check() {
[[ "$mount_needs" ]] && return 1
require_binaries plymouthd plymouth
require_binaries plymouthd plymouth plymouth-set-default-theme
}
# called by dracut

View File

@@ -26,7 +26,7 @@ if [[ $hostonly ]]; then
if [ -L /usr/share/plymouth/themes/default.plymouth ]; then
inst /usr/share/plymouth/themes/default.plymouth
# Install plugin for this theme
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth | while read a b c; do echo $b; done;)
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth | while read a b c || [ -n "$b" ]; do echo $b; done;)
inst_libdir_file "plymouth/${PLYMOUTH_PLUGIN}.so"
fi
else

View File

@@ -42,7 +42,7 @@ function dasd_settle() {
}
function dasd_settle_all() {
for dasdccw in $(while read line; do echo "${line%%(*}"; done < /proc/dasd/devices) ; do
for dasdccw in $(while read line || [ -n "$line" ]; do echo "${line%%(*}"; done < /proc/dasd/devices) ; do
if ! dasd_settle $dasdccw ; then
echo $"Could not access DASD $dasdccw in time"
return 1
@@ -84,7 +84,7 @@ function readcmsfile() # $1=dasdport $2=filename
# dasd_mod must be loaded without setting any DASD online
dev=$(canonicalize_devno $1)
numcpus=$(
while read line; do
while read line || [ -n "$line" ]; do
if strstr "$line" "# processors"; then
echo ${line##*:};
break;
@@ -181,7 +181,7 @@ processcmsfile()
unset _do_zfcp
for i in ${!FCP_*}; do
echo "${!i}" | while read port rest; do
echo "${!i}" | while read port rest || [ -n "$port" ]; do
case $port in
*.*.*)
;;

View File

@@ -7,7 +7,7 @@ crypttab_contains() {
local luks="$1"
local l d rest
if [ -f /etc/crypttab ]; then
while read l d rest; do
while read l d rest || [ -n "$l" ]; do
strstr "${l##luks-}" "${luks##luks-}" && return 0
strstr "$d" "${luks##luks-}" && return 0
done < /etc/crypttab
@@ -42,10 +42,10 @@ ask_for_password() {
while [ $# -gt 0 ]; do
case "$1" in
--cmd) ply_cmd="$2"; tty_cmd="$2" shift;;
--cmd) ply_cmd="$2"; tty_cmd="$2"; shift;;
--ply-cmd) ply_cmd="$2"; shift;;
--tty-cmd) tty_cmd="$2"; shift;;
--prompt) ply_prompt="$2"; tty_prompt="$2" shift;;
--prompt) ply_prompt="$2"; tty_prompt="$2"; shift;;
--ply-prompt) ply_prompt="$2"; shift;;
--tty-prompt) tty_prompt="$2"; shift;;
--tries) ply_tries="$2"; tty_tries="$2"; shift;;
@@ -155,7 +155,7 @@ getkey() {
[ -f "$keys_file" ] || return 1
local IFS=:
while read luks_dev key_dev key_path; do
while read luks_dev key_dev key_path || [ -n "$luks_dev" ]; do
if match_dev "$luks_dev" "$for_dev"; then
echo "${key_dev}:${key_path}"
return 0

View File

@@ -23,7 +23,7 @@ numtries=${3:-10}
# TODO: improve to support what cmdline does
if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -d -n rd_NO_CRYPTTAB; then
while read name dev luksfile luksoptions; do
while read name dev luksfile luksoptions || [ -n "$name" ]; do
# ignore blank lines and comments
if [ -z "$name" -o "${name#\#}" != "$name" ]; then
continue

View File

@@ -35,7 +35,7 @@ cmdline() {
UUID=$(
blkid -u crypto -o export $dev \
| while read line; do
| while read line || [ -n "$line" ]; do
[[ ${line#UUID} = $line ]] && continue
printf "%s" "${line#UUID=}"
break
@@ -65,7 +65,7 @@ install() {
if [[ $hostonly ]] && [[ -f /etc/crypttab ]]; then
# filter /etc/crypttab for the devices we need
while read _mapper _dev _rest; do
while read _mapper _dev _rest || [ -n "$_mapper" ]; do
[[ $_mapper = \#* ]] && continue
[[ $_dev ]] || continue

View File

@@ -14,6 +14,12 @@ else
LUKS=$(getargs rd.luks.uuid -d rd_LUKS_UUID)
tout=$(getarg rd.luks.key.tout)
if [ -e /etc/crypttab ]; then
while read _mapper _dev _rest ; do
set_systemd_timeout_for_dev $_dev
done < /etc/crypttab
fi
if [ -n "$LUKS" ]; then
for luksid in $LUKS; do

View File

@@ -1,11 +1,12 @@
#!/bin/sh
_do_dm_shutdown() {
local ret
local ret=0
local final=$1
info "Disassembling device-mapper devices"
dmsetup -v remove_all
ret=$?
for dev in $(dmsetup info -c --noheadings -o name) ; do
dmsetup -v --noudevsync remove "$dev" || ret=$?
done
if [ "x$final" != "x" ]; then
info "dmsetup ls --tree"
dmsetup ls --tree 2>&1 | vinfo

View File

@@ -37,6 +37,7 @@ if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
info "Activating $s"
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
[ -e "/dev/mapper/$s" ] && kpartx -a "/dev/mapper/$s" 2>&1 | vinfo
udevsettle
done
fi

View File

@@ -1,17 +1,20 @@
#!/bin/sh
if [ -b /dev/mapper/live-rw ] && [ -d /updates ]; then
if [ -b /dev/mapper/live-rw ] && [ -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
(
cd /updates
find . -depth -type d | while read dir; do
mkdir -p "$NEWROOT/$dir"
done
find . -depth \! -type d | while read file; do
cp -a "$file" "$NEWROOT/$file"
done
)
for d in /updates /run/initramfs/live/updates; do
[ -d "$d" ] || continue
(
cd $d
find . -depth -type d | while read dir; do
mkdir -p "$NEWROOT/$dir"
done
find . -depth \! -type d | while read file; do
cp -a "$file" "$NEWROOT/$file"
done
)
done
umount $NEWROOT/run
fi

View File

@@ -30,6 +30,8 @@ getargbool 0 rd.writable.fsimg -d -y writable_fsimg && writable_fsimg="yes"
overlay_size=$(getarg rd.live.overlay.size=)
[ -z "$overlay_size" ] && overlay_size=512
getargbool 0 rd.live.overlay.thin && thin_snapshot="yes"
# CD/DVD media check
[ -b $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
@@ -146,7 +148,31 @@ do_live_overlay() {
base=$BASE_LOOPDEV
over=$OVERLAY_LOOPDEV
fi
echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw
if [ -n "$thin_snapshot" ]; then
modprobe dm_thin_pool
mkdir /run/initramfs/thin-overlay
# In block units (512b)
thin_data_sz=$(( $overlay_size * 1024 * 1024 / 512 ))
thin_meta_sz=$(( $thin_data_sz / 10 ))
# It is important to have the backing file on a tmpfs
# this is needed to let the loopdevice support TRIM
dd if=/dev/null of=/run/initramfs/thin-overlay/meta bs=1b count=1 seek=$((thin_meta_sz)) 2> /dev/null
dd if=/dev/null of=/run/initramfs/thin-overlay/data bs=1b count=1 seek=$((thin_data_sz)) 2> /dev/null
THIN_META_LOOPDEV=$( losetup --show -f /run/initramfs/thin-overlay/meta )
THIN_DATA_LOOPDEV=$( losetup --show -f /run/initramfs/thin-overlay/data )
echo 0 $thin_data_sz thin-pool $THIN_META_LOOPDEV $THIN_DATA_LOOPDEV 1024 1024 | dmsetup create live-overlay-pool
dmsetup message /dev/mapper/live-overlay-pool 0 "create_thin 0"
# Create a snapshot of the base image
echo 0 $sz thin /dev/mapper/live-overlay-pool 0 $base | dmsetup create live-rw
else
echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw
fi
# Create a device that always points to a ro base image
echo 0 $sz linear $base 0 | dmsetup create --readonly live-base
@@ -174,29 +200,6 @@ if [ -n "$OSMINSQFS" ]; then
umount -l /run/initramfs/squashfs.osmin
fi
# we might have an embedded fs image to use as rootfs (uncompressed live)
if [ -e /run/initramfs/live/${live_dir}/ext3fs.img ]; then
FSIMG="/run/initramfs/live/${live_dir}/ext3fs.img"
elif [ -e /run/initramfs/live/${live_dir}/rootfs.img ]; then
FSIMG="/run/initramfs/live/${live_dir}/rootfs.img"
fi
if [ -n "$FSIMG" ] ; then
BASE_LOOPDEV=$( losetup -f )
if [ -n "$writable_fsimg" ] ; then
# mount the provided fileysstem read/write
echo "Unpacking live filesystem (may take some time)"
unpack_archive $FSIMG /run/initramfs/fsimg/
losetup $BASE_LOOPDEV /run/initramfs/fsimg/rootfs.img
echo "0 $( blockdev --getsize $BASE_LOOPDEV ) linear $BASE_LOOPDEV 0" | dmsetup create live-rw
else
# mount the filesystem read-only and add a dm snapshot for writes
losetup -r $BASE_LOOPDEV $FSIMG
do_live_from_base_loop
fi
fi
# we might have an embedded fs image on squashfs (compressed live)
if [ -e /run/initramfs/live/${live_dir}/${squash_image} ]; then
SQUASHED="/run/initramfs/live/${live_dir}/${squash_image}"
@@ -217,18 +220,42 @@ if [ -e "$SQUASHED" ] ; then
mkdir -m 0755 -p /run/initramfs/squashfs
mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /run/initramfs/squashfs
BASE_LOOPDEV=$( losetup -f )
if [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
losetup -r $BASE_LOOPDEV /run/initramfs/squashfs/LiveOS/ext3fs.img
elif [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
losetup -r $BASE_LOOPDEV /run/initramfs/squashfs/LiveOS/rootfs.img
fi
umount -l /run/initramfs/squashfs
do_live_from_base_loop
fi
# we might have an embedded fs image to use as rootfs (uncompressed live)
if [ -e /run/initramfs/live/${live_dir}/ext3fs.img ]; then
FSIMG="/run/initramfs/live/${live_dir}/ext3fs.img"
elif [ -e /run/initramfs/live/${live_dir}/rootfs.img ]; then
FSIMG="/run/initramfs/live/${live_dir}/rootfs.img"
elif [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
FSIMG="/run/initramfs/squashfs/LiveOS/ext3fs.img"
elif [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
FSIMG="/run/initramfs/squashfs/LiveOS/rootfs.img"
fi
if [ -n "$FSIMG" ] ; then
BASE_LOOPDEV=$( losetup -f )
if [ -n "$writable_fsimg" ] ; then
# mount the provided fileysstem read/write
echo "Unpacking live filesystem (may take some time)"
mkdir /run/initramfs/fsimg/
if [ -n "$SQUASHED" ]; then
cp -v $FSIMG /run/initramfs/fsimg/rootfs.img
else
unpack_archive $FSIMG /run/initramfs/fsimg/
fi
losetup $BASE_LOOPDEV /run/initramfs/fsimg/rootfs.img
echo "0 $( blockdev --getsize $BASE_LOOPDEV ) linear $BASE_LOOPDEV 0" | dmsetup create live-rw
else
# mount the filesystem read-only and add a dm snapshot for writes
losetup -r $BASE_LOOPDEV $FSIMG
do_live_from_base_loop
fi
fi
[ -e "$SQUASHED" ] && 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
@@ -241,7 +268,10 @@ if [ -n "$ROOTFLAGS" ]; then
fi
ln -s /dev/mapper/live-rw /dev/root
printf 'mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > $hookdir/mount/01-$$-live.sh
if [ -z "$DRACUT_SYSTEMD" ]; then
printf 'mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > $hookdir/mount/01-$$-live.sh
fi
need_shutdown

View File

@@ -22,7 +22,7 @@ installkernel() {
# called by dracut
install() {
inst_multiple umount dmsetup blkid dd losetup grep blockdev
inst_multiple umount dmsetup blkid dd losetup grep blockdev find
inst_multiple -o checkisomd5
inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
inst_hook cmdline 31 "$moddir/parse-iso-scan.sh"
@@ -31,6 +31,7 @@ install() {
inst_hook pre-pivot 20 "$moddir/apply-live-updates.sh"
inst_script "$moddir/dmsquash-live-root.sh" "/sbin/dmsquash-live-root"
inst_script "$moddir/iso-scan.sh" "/sbin/iso-scan"
inst_script "$moddir/dmsquash-generator.sh" $systemdutildir/system-generators/dracut-dmsquash-generator
# should probably just be generally included
inst_rules 60-cdrom_id.rules
inst_simple "$moddir/checkisomd5@.service" "/etc/systemd/system/checkisomd5@.service"

View File

@@ -13,7 +13,7 @@ if [ "${root%%:*}" = "live" ] ; then
liveroot=$root
fi
[ "${liveroot%%:*}" = "live" ] || return
[ "${liveroot%%:*}" = "live" ] || return 1
modprobe -q loop
@@ -49,9 +49,14 @@ case "$liveroot" in
live:/*.[Ii][Mm][Gg]|/*.[Ii][Mm][Gg])
[ -f "${root#live:}" ] && rootok=1 ;;
esac
[ "$rootok" = "1" ] || return 1
info "root was $liveroot, is now $root"
# make sure that init doesn't complain
[ -z "$root" ] && root="live"
wait_for_dev -n /dev/mapper/live-rw
return 0

View File

@@ -9,7 +9,7 @@ installkernel() {
local _merge=8 _side2=9
function bmf1() {
local _f
while read _f; do case "$_f" in
while read _f || [ -n "$_f" ]; do case "$_f" in
*.ko) [[ $(< $_f) =~ $_blockfuncs ]] && echo "$_f" ;;
*.ko.gz) [[ $(gzip -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
*.ko.xz) [[ $(xz -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
@@ -19,7 +19,7 @@ installkernel() {
}
function rotor() {
local _f1 _f2
while read _f1; do
while read _f1 || [ -n "$_f1" ]; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}
@@ -41,10 +41,13 @@ installkernel() {
uhci-hcd \
xhci-hcd xhci-pci xhci-plat-hcd
instmods \
"=drivers/hid" \
"=drivers/input/serio" \
"=drivers/input/keyboard"
instmods yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech \
hid-logitech-dj hid-microsoft hid-lcpower firewire-ohci \
pcmcia hid-hyperv hv-vmbus hyperv-keyboard
atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus
if [[ "$(uname -p)" == arm* ]]; then
# arm specific modules

View File

@@ -0,0 +1,71 @@
#!/bin/bash
# called by dracut
check() {
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
installkernel() {
# Include wired net drivers, excluding wireless
local _arch=$(uname -m)
net_module_filter() {
local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open'
local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'
local _ret
# subfunctions inherit following FDs
local _merge=8 _side2=9
function nmf1() {
local _fname _fcont
while read _fname; do
[[ $_fname =~ $_unwanted_drivers ]] && continue
case "$_fname" in
*.ko) _fcont="$(< $_fname)" ;;
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
*.ko.xz) _fcont="$(xz -dc $_fname)" ;;
esac
[[ $_fcont =~ $_net_drivers
&& ! $_fcont =~ iw_handler_get_spy ]] \
&& echo "$_fname"
done
return 0
}
function rotor() {
local _f1 _f2
while read _f1; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}
fi
done | nmf1 1>&${_merge}
return 0
}
# Use two parallel streams to filter alternating modules.
set +x
eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
[[ $debug ]] && set -x
return 0
}
{ find_kernel_modules_by_path drivers/net; if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then find_kernel_modules_by_path drivers/s390/net; fi; } \
| net_module_filter | instmods
#instmods() will take care of hostonly
instmods \
=drivers/net/phy \
=drivers/net/team \
=drivers/net/ethernet \
ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net
}
# called by dracut
install() {
return 0
}

View File

@@ -106,6 +106,10 @@ if [ -n "$LVS" ] ; then
info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
lvm lvscan --ignorelockingfailure 2>&1 | vinfo
for LV in $LVS; do
if [ "x$(lvm lvs --noheadings --select "lv_attr =~ k" $LV | wc -l)" = "x0" ]; then
info "Skipping activation of '$LV' because activationskip is set."
continue
fi
if [ -z "$sysinit" ]; then
lvm lvchange --yes -ay --ignorelockingfailure $nopoll --ignoremonitoring $LV 2>&1 | vinfo
else

View File

@@ -67,6 +67,20 @@ install() {
sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' ${initdir}/etc/lvm/lvm.conf
sed -i -e 's/\(^[[:space:]]*\)use_lvmetad[[:space:]]*=[[:space:]]*[[:digit:]]/\1use_lvmetad = 0/' ${initdir}/etc/lvm/lvm.conf
fi
export LVM_SUPPRESS_FD_WARNINGS=1
# Also install any files needed for LVM system id support.
if [ -f /etc/lvm/lvmlocal.conf ]; then
inst_simple -H /etc/lvm/lvmlocal.conf
fi
eval $(lvm dumpconfig global/system_id_source)
if [ "$system_id_source" == "file" ]; then
eval $(lvm dumpconfig global/system_id_file)
if [ -f "$system_id_file" ]; then
inst_simple -H $system_id_file
fi
fi
unset LVM_SUPPRESS_FD_WARNINGS
fi
if ! [[ -e ${initdir}/etc/lvm/lvm.conf ]]; then

View File

@@ -27,6 +27,7 @@ _md_force_run() {
_path_d="${_path_s%/*}/degraded"
[ ! -r "$_path_d" ] && continue
> $hookdir/initqueue/work
done
}

View File

@@ -46,7 +46,7 @@ cmdline() {
UUID=$(
/sbin/mdadm --examine --export $dev \
| while read line; do
| while read line || [ -n "$line" ]; do
[[ ${line#MD_UUID=} = $line ]] && continue
printf "%s" "${line#MD_UUID=} "
done

View File

@@ -10,7 +10,7 @@ else
if [ -n "$MD_UUID" ]; then
for f in /etc/udev/rules.d/65-md-incremental*.rules; do
[ -e "$f" ] || continue
while read line; do
while read line || [ -n "$line" ]; do
if [ "${line%%UUID CHECK}" != "$line" ]; then
printf 'IMPORT{program}="/sbin/mdadm --examine --export $tempnode"\n'
for uuid in $MD_UUID; do

View File

@@ -46,7 +46,7 @@ installkernel() {
local _merge=8 _side2=9
function bmf1() {
local _f
while read _f; do
while read _f || [ -n "$_f" ]; do
case "$_f" in
*.ko) [[ $(< $_f) =~ $_funcs ]] && echo "$_f" ;;
*.ko.gz) [[ $(gzip -dc <$_f) =~ $_funcs ]] && echo "$_f" ;;
@@ -58,7 +58,7 @@ installkernel() {
function rotor() {
local _f1 _f2
while read _f1; do
while read _f1 || [ -n "$_f1" ]; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}

View File

@@ -19,8 +19,6 @@ loop_decrypt() {
local key="/dev/mapper/${mntp##*/}"
if [ ! -b $key ]; then
info "Keyfile has .img suffix, treating it as LUKS-encrypted loop keyfile container to unlock $device"
local loopdev=$(losetup -f "${mntp}/${keypath}" --show)
local opts="-d - luksOpen $loopdev ${key##*/}"
@@ -29,14 +27,12 @@ loop_decrypt() {
--prompt "Password ($keypath on $keydev for $device)" \
--tty-echo-off
[ -b $key ] || die "Tried setting it up, but keyfile block device was still not found!"
[ -b $key ] || die "Failed to unlock $keypath on $keydev for $device."
initqueue --onetime --finished --unique --name "crypt-loop-cleanup-10-${key##*/}" \
$(command -v cryptsetup) "luksClose $key"
initqueue --onetime --finished --unique --name "crypt-loop-cleanup-20-${loopdev##*/}" \
$(command -v losetup) "-d $loopdev"
else
info "Existing keyfile found, re-using it for $device"
fi
cat $key

2
modules.d/91crypt-loop/module-setup.sh Normal file → Executable file
View File

@@ -14,7 +14,7 @@ depends() {
# called by dracut
installkernel() {
instmods loop
hostonly='' instmods loop
}
# called by dracut

View File

@@ -13,8 +13,11 @@ depends() {
# called by dracut
install() {
inst_multiple -o ps grep more cat rm strace free showmount \
ping netstat rpcinfo vi scp ping6 ssh find vi \
fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck
inst_multiple -o cat ls ps grep more cat rm strace free showmount \
ping netstat rpcinfo vi scp ping6 ssh find vi \
tcpdump cp less hostname mkdir \
fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck
egrep '^tcpdump:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
}

View File

@@ -2,6 +2,9 @@
# called by dracut
check() {
[[ $hostonly ]] || [[ $mount_needs ]] && {
[ -d /sys/firmware/efi ] || return 255
}
require_binaries dcbtool fipvlan lldpad ip readlink || return 1
return 0
}

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

View File

@@ -20,9 +20,9 @@
# BRCM: Later, should check whether bnx2x is loaded first before loading bnx2fc so do not load bnx2fc when there are no Broadcom adapters
[ -d /sys/module/fcoe ] || modprobe -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
[ -d /sys/module/fcoe ] || modprobe -b -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
modprobe bnx2fc >/dev/null 2>&1
initqueue --onetime modprobe -b -q bnx2fc
udevadm settle --timeout=30
parse_fcoe_opts() {

View File

@@ -7,7 +7,7 @@ fstab_mount() {
local _dev _mp _fs _opts _dump _pass _rest
test -e "$1" || return 1
info "Mounting from $1"
while read _dev _mp _fs _opts _dump _pass _rest; do
while read _dev _mp _fs _opts _dump _pass _rest || [ -n "$_dev" ]; do
[ -z "${_dev%%#*}" ] && continue # Skip comment lines
ismounted $_mp && continue # Skip mounted filesystem
if [ "$_pass" -gt 0 ] && ! strstr "$_opts" _netdev; then

View File

@@ -123,7 +123,7 @@ handle_netroot()
if [ -z $iscsi_initiator ]; then
if [ -f /sys/firmware/ibft/initiator/initiator-name ]; then
iscsi_initiator=$(while read line; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
fi
fi

View File

@@ -166,7 +166,7 @@ installkernel() {
local _merge=8 _side2=9
function bmf1() {
local _f
while read _f; do
while read _f || [ -n "$_f" ]; do
case "$_f" in
*.ko) [[ $(< $_f) =~ $_funcs ]] && echo "$_f" ;;
*.ko.gz) [[ $(gzip -dc <$_f) =~ $_funcs ]] && echo "$_f" ;;
@@ -178,7 +178,7 @@ installkernel() {
function rotor() {
local _f1 _f2
while read _f1; do
while read _f1 || [ -n "$_f1" ]; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}

View File

@@ -60,19 +60,15 @@ fi
# iscsi_firmware does not need argument checking
if [ -n "$iscsi_firmware" ] ; then
[ -z "$netroot" ] && netroot=iscsi:
modprobe -q iscsi_boot_sysfs 2>/dev/null
modprobe -q iscsi_ibft
modprobe -b -q iscsi_boot_sysfs 2>/dev/null
modprobe -b -q iscsi_ibft
initqueue --onetime --timeout /sbin/iscsiroot dummy "$netroot" "$NEWROOT"
fi
# If it's not iscsi we don't continue
[ "${netroot%%:*}" = "iscsi" ] || return
modprobe -q qla4xxx
modprobe -q cxgb3i
modprobe -q cxgb4i
modprobe -q bnx2i
modprobe -q be2iscsi
initqueue --onetime modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi
if [ -z "$iscsi_firmware" ] ; then
type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
@@ -81,7 +77,7 @@ fi
# ISCSI actually supported?
if ! [ -e /sys/module/iscsi_tcp ]; then
modprobe -q iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi"
modprobe -b -q iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi"
fi
if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then

View File

@@ -57,7 +57,14 @@ fi
case "$netroot" in
/dev/nfs) netroot=nfs;;
/dev/*) unset netroot; return;;
/dev/*)
if [ -n "$oldnetroot" ]; then
netroot="$oldnetroot"
else
unset netroot
fi
return
;;
# LEGACY: root=<server-ip>:/<path
[0-9]*:/*|[0-9]*\.[0-9]*\.[0-9]*[!:]|/*)
netroot=nfs:$netroot;;

View File

@@ -37,6 +37,8 @@ esac
if ! getarg noresume; then
if [ -n "$resume" ]; then
wait_for_dev /dev/resume
{
printf "KERNEL==\"%s\", ACTION==\"add|change\", SYMLINK+=\"resume\"\n" \
${resume#/dev/};
@@ -65,7 +67,7 @@ if ! getarg noresume; then
printf -- '%s\n' ' RUN+="/sbin/initqueue --finished --unique --name 00resume echo %M:%m > /sys/power/resume"'
} >> /etc/udev/rules.d/99-resume.rules
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm -f -- "$job" "%s/initqueue/timeout/resume.sh"; }\n' \
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume 2> /dev/null; rm -f -- "$job" "%s/initqueue/timeout/resume.sh"; }\n' \
"$resume" "$resume" "$hookdir" >> $hookdir/initqueue/settled/resume.sh
{

View File

@@ -30,11 +30,19 @@ cmdline_journal() {
}
cmdline_rootfs() {
local dev=/dev/block/$(find_root_block_device)
if [ -e $dev ]; then
printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
printf " rootflags=%s" "$(find_mp_fsopts /)"
printf " rootfstype=%s" "$(find_mp_fstype /)"
local _dev=/dev/block/$(find_root_block_device)
local _fstype _flags _subvol
if [ -e $_dev ]; then
printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$_dev")")"
_fstype="$(find_mp_fstype /)"
_flags="$(find_mp_fsopts /)"
printf " rootfstype=%s" "$_fstype"
if [[ $use_fstab != yes ]] && [[ $_fstype = btrfs ]]; then
_subvol=$(findmnt -e -v -n -o FSROOT --target /) \
&& _subvol=${_subvol#/}
_flags="$_flags,${_subvol:+subvol=$_subvol}"
fi
printf " rootflags=%s" "${_flags#,}"
fi
}

View File

@@ -81,7 +81,7 @@ mount_root() {
# the root filesystem,
# remount it with the proper options
rootopts="defaults"
while read dev mp fs opts dump fsck; do
while read dev mp fs opts dump fsck || [ -n "$dev" ]; do
# skip comments
[ "${dev%%#*}" != "$dev" ] && continue

View File

@@ -44,7 +44,7 @@ inst_sshenv()
if [[ -f /etc/ssh/ssh_config ]]; then
inst_simple /etc/ssh/ssh_config
sed -i -e 's/\(^[[:space:]]*\)ProxyCommand/\1# ProxyCommand/' ${initdir}/etc/ssh/ssh_config
while read key val; do
while read key val || [ -n "$key" ]; do
[[ $key != "GlobalKnownHostsFile" ]] && continue
inst_simple "$val"
break

View File

@@ -7,8 +7,9 @@ install() {
# Fixme: would be nice if we didn't have to guess, which rules to grab....
# ultimately, /lib/initramfs/rules.d or somesuch which includes links/copies
# of the rules we want so that we just copy those in would be best
inst_multiple udevadm cat uname blkid \
/etc/udev/udev.conf
inst_multiple udevadm cat uname blkid
inst_dir /etc/udev
inst_multiple -o /etc/udev/udev.conf
[ -d ${initdir}/$systemdutildir ] || mkdir -p ${initdir}/$systemdutildir
for _i in ${systemdutildir}/systemd-udevd ${udevdir}/udevd /sbin/udevd; do
@@ -25,16 +26,25 @@ install() {
exit 1
fi
inst_rules 50-udev-default.rules 60-persistent-storage.rules \
61-persistent-storage-edd.rules 80-drivers.rules 95-udev-late.rules \
60-pcmcia.rules \
50-udev.rules 95-late.rules \
inst_rules \
50-firmware.rules \
50-udev.rules \
50-udev-default.rules \
55-scsi-sg3_id.rules \
58-scsi-sg3_symlink.rules \
59-scsi-sg3_utils.rules \
55-scsi-sg3_id.rules 58-scsi-sg3_symlink.rules \
70-uaccess.rules 71-seat.rules 73-seat-late.rules \
60-block.rules \
60-pcmcia.rules \
60-persistent-storage.rules \
61-persistent-storage-edd.rules \
70-uaccess.rules \
71-seat.rules \
73-seat-late.rules \
75-net-description.rules \
80-net-name-slot.rules 80-net-setup-link.rules \
80-drivers.rules 95-udev-late.rules \
80-net-name-slot.rules\
80-net-setup-link.rules \
95-late.rules \
"$moddir/59-persistent-storage.rules" \
"$moddir/61-persistent-storage.rules"

View File

@@ -42,7 +42,7 @@ mount_root() {
# the root filesystem,
# remount it with the proper options
rootopts="defaults"
while read dev mp fs opts rest; do
while read dev mp fs opts rest || [ -n "$dev" ]; do
# skip comments
[ "${dev%%#*}" != "$dev" ] && continue

View File

@@ -10,7 +10,7 @@ echo
echo
echo
echo "Enter additional kernel command line parameter (end with ctrl-d or .)"
while read -e -p "> " line; do
while read -e -p "> " line || [ -n "$line" ]; do
[[ "$line" == "." ]] && break
[[ "$line" ]] && printf -- "%s\n" "$line" >> /etc/cmdline.d/99-cmdline-ask.conf
done

View File

@@ -60,6 +60,7 @@ while :; do
job=$job . $job
udevadm settle --timeout=0 >/dev/null 2>&1 || main_loop=0
[ -f $hookdir/initqueue/work ] && main_loop=0
[ $main_loop -eq 0 ] && break
done
fi

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