Compare commits

..

164 Commits
028 ... 032

Author SHA1 Message Date
Harald Hoyer
a073aa5a26 dracut-032 2013-08-20 13:08:52 +02:00
Harald Hoyer
575733aa25 add newline to cmdline config files 2013-08-20 13:08:52 +02:00
Harald Hoyer
546d5dacf5 dracut.sh: recognize swap entries in fstab with mountpoint "none" 2013-08-20 12:01:17 +02:00
Harald Hoyer
3411ad661a add persistent_policy configuration option 2013-08-20 10:28:14 +02:00
Harald Hoyer
a2b64e30b8 dracut.conf.5.asc: correct ro_mnt documentation 2013-08-20 10:27:29 +02:00
Harald Hoyer
50411d30d5 dracut-functions.sh:dracut_module_included() check with spaces
check also for surrounding spaces in the module strings
2013-08-20 09:04:20 +02:00
Harald Hoyer
88c86ac7f0 dracut.sh: fixed checking for FIPS mode 2013-08-20 09:02:48 +02:00
WANG Chao
55c912ae40 systemd: pre-pivot hooks runs after /sysroot is mounted
If rootflags=nofail, sysroot.mount won't strictly run "Before"
initrd-root-fs.target. So we need to order dracut-pre-pivot after
sysroot.mount.
2013-08-19 15:50:57 +02:00
Daniel Schaal
b7c770e186 dracut.sh: Fix [no-]early-microcode parameter and add documentation.
[no-]early-microcode was missing from getopt argument list.

Let arguments passed by command line override config files.
2013-08-19 11:13:04 +02:00
Harald Hoyer
324ea606da dracut.sh: add --persistent-policy option
--persistent-policy <policy>:
    Use <policy> to address disks and partitions.
    <policy> can be any directory name found in /dev/disk.
    E.g. "by-uuid", "by-label"
2013-08-16 11:52:07 +02:00
Harald Hoyer
df478eee75 base/dracut-lib.sh: move warn() definition before usage 2013-08-16 11:00:45 +02:00
Harald Hoyer
8f53670cc5 dracut.spec: correct License string 2013-08-16 11:00:21 +02:00
Harald Hoyer
f071d5574c dracut.spec: add bash module 2013-08-15 16:24:13 +02:00
Harald Hoyer
1743473b2b add parameter --print-cmdline
This prints the kernel command line parameters for the current disk
layout.

$ dracut --print-cmdline
rd.luks.uuid=luks-e68c8906-6542-4a26-83c4-91b4dd9f0471
rd.lvm.lv=debian/root rd.lvm.lv=debian/usr root=/dev/mapper/debian-root
rootflags=rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered
rootfstype=ext4
2013-08-15 16:06:37 +02:00
Harald Hoyer
0d6d85b494 resurrect TEST-14-IMSM 2013-08-15 16:05:35 +02:00
Harald Hoyer
bbc9bfe16e dracut-functions.sh: add find_mp_fsopts 2013-08-15 12:23:04 +02:00
Harald Hoyer
466a59984a dracut-functions.sh: no more 'echo' 2013-08-15 12:22:55 +02:00
Harald Hoyer
8df0b654dc rootfs-block: search all host_devs for a journal device 2013-08-15 11:14:47 +02:00
Harald Hoyer
97af51db9d dracut-functions.sh: add find_dev_fsopts() 2013-08-15 11:14:46 +02:00
Harald Hoyer
69f7ed9610 Create initramfs without using udevadm
This enables building a hostonly image, without the udev database
populated.
2013-08-15 10:44:20 +02:00
Harald Hoyer
67b4a9ea17 testsuite: fixed network interface names 2013-08-15 10:25:19 +02:00
Harald Hoyer
dc63e65419 dracut.spec: dracut-network requires dhclient 2013-08-15 08:32:38 +02:00
Harald Hoyer
62cdced342 TEST-12-RAID-DEG: enter UUID in crypttab rather than md0 2013-08-14 15:04:05 +02:00
Harald Hoyer
919a7c4d6e Makefile: do syncheck before creating the archive or rpm 2013-08-14 15:04:05 +02:00
Harald Hoyer
f06c2b5852 dracut-functions.sh: fixed vercmp() 2013-08-14 15:04:05 +02:00
WANG Chao
613ed5cd76 network: also wait for ethernet interfaces to setup
We only wait for master interfaces for bridge/bonding/team/vlan case.
If none of these complex network is configured, we should wait for
ethernet interface (bootdev) instead.
2013-08-14 15:04:05 +02:00
Harald Hoyer
3605b48508 shutdown: fixed killall_proc_mountpoint() 2013-08-14 15:04:05 +02:00
Harald Hoyer
4fe1bdd406 dracut-functions.sh: if no libdirs are set, take the ld.so.cache paths 2013-08-14 15:04:05 +02:00
Harald Hoyer
a13bf117d5 crypt: only manually activate systemd-cryptsetup, if not in crypttab
Only additional rd.luks.UUID have to be manually activated.
2013-08-13 10:26:29 +02:00
Harald Hoyer
730b9b8b77 crypt/crypt-run-generator: also skip if UUID match in crypttab 2013-08-13 01:20:06 +02:00
Harald Hoyer
5e264a5d3e add bash module 2013-08-13 00:39:10 +02:00
Harald Hoyer
4baac4b291 crypt/module-setup.sh: use crypttab in hostonly and don't install cmdline 2013-08-13 00:35:10 +02:00
Harald Hoyer
1f4f8fb9e3 fs-lib/module-setup.sh: install fsck and fsck.ext* 2013-08-13 00:19:05 +02:00
Harald Hoyer
af75a298c1 dracut.sh: always assemble /usr in the initramfs 2013-08-12 23:55:50 +02:00
Harald Hoyer
9fc144451d dracut.sh: always assemble /usr device in initramfs 2013-08-12 23:50:30 +02:00
Harald Hoyer
861d9430c0 lsinitrd.sh: fixed modules.txt path 2013-08-12 23:50:07 +02:00
Harald Hoyer
e8b9702c0a systemd/dracut-initqueue.sh: added missing "then" 2013-08-12 13:08:17 +02:00
Harald Hoyer
109283a883 base: don't install switch_root, if systemd is used 2013-08-12 12:57:41 +02:00
Harald Hoyer
e95b672376 dracut.sh: fixed typo 2013-08-12 12:46:35 +02:00
Harald Hoyer
dadd2b698e dracut.sh: use local lsinitrd.sh for "-l" 2013-08-12 12:46:03 +02:00
Harald Hoyer
3e70a25bcf dracut-logger.sh: saveguard logger with -- 2013-08-12 12:44:10 +02:00
Harald Hoyer
3e6c9011d0 dracut-logger.sh: do not unset logging messages if sysloglvl is set 2013-08-09 15:47:30 +02:00
Harald Hoyer
d93fe0fa35 lsinitrd.sh: fixed case 2013-08-09 15:35:20 +02:00
dyoung@redhat.com
beb26a0847 omit drivers fix
Because omit_drivers list use underline always, so when maching with it
the _mod need to be converted as well or sometimes omit-drivers will fail
silently.

Fix this by replace '-' with '_' in instmods function.

Signed-off-by: Dave Young <dyoung@redhat.com>
2013-08-09 14:13:30 +02:00
Harald Hoyer
e84d115b93 multipath: need_shutdown if multipath devices exist
https://bugzilla.redhat.com/show_bug.cgi?id=994913
2013-08-09 10:44:34 +02:00
Harald Hoyer
7929ec198f iscsi/module-setup.sh: install some modules regardless of hostonly 2013-08-09 10:33:27 +02:00
Harald Hoyer
0b11ea7199 network/net-lib.sh: fix ibft interface configuration
also skip ibft$num names, which have been already given

https://bugzilla.redhat.com/show_bug.cgi?id=989944
2013-08-07 16:05:59 +02:00
James Lee
7deba0428a crypt: Fix typo--/etc/crypttab not /etc/cryptab
1ae8b8a breaks the crypt module for those who use keyfiles due to a
typo leading to the exclusion of /etc/crypttab from the initrd.
2013-08-07 10:33:15 +02:00
Harald Hoyer
aacdba2bdb dracut.sh: check the value of --kver
https://bugzilla.redhat.com/show_bug.cgi?id=993327
2013-08-07 10:33:15 +02:00
Harald Hoyer
5ae33613ab dracut.sh: do not strip in FIPS mode 2013-08-07 10:33:15 +02:00
Harald Hoyer
8652d5493d 51-dracut-rescue.install: fixed rescue image creation 2013-08-07 10:33:15 +02:00
Harald Hoyer
af11946054 dracut-functions.sh: inst_multiple == dracut_install 2013-08-07 10:33:15 +02:00
Harald Hoyer
55a0b3abc7 dracut-functions.sh: removed non dracut-install shell functions 2013-08-07 10:33:15 +02:00
Harald Hoyer
a4f7b50471 dracut.sh/dracut-functions.sh: handle root on non-block device 2013-08-07 10:33:14 +02:00
Harald Hoyer
226e3710b4 systemd/dracut-initqueue.sh: continue to boot if finished failed
but /sysroot/etc/fstab exists.
2013-08-07 10:33:14 +02:00
Harald Hoyer
89f7217954 dracut.asc: small corrections 2013-08-07 10:33:14 +02:00
Harald Hoyer
283c34fc2b dracut.sh: call find with -print0 and cpio with --null 2013-08-07 10:33:14 +02:00
Harald Hoyer
1cb6524918 lsinitrd.sh: add old cpio signature 2013-08-05 11:14:24 +02:00
WANG Chao
ff66b6dad3 95terminfo: install vt102
systemd uses vt102 as default term for tty:

commit acda6a0
Author: Lennart Poettering <lennart@poettering.net>
Date:   Sun Apr 22 02:45:39 2012 +0200

    default to v102 everywhere, instead of vt100, to synchronize with agetty

Signed-off-by: WANG Chao <chaowang@redhat.com>
2013-08-01 12:55:55 +02:00
Harald Hoyer
64a7eace88 cms/cmssetup.sh: correct port for zfcp.conf 2013-07-31 17:29:12 +02:00
Harald Hoyer
051de5aadc lvm: add "--yes" to lvm lvchange 2013-07-31 17:17:37 +02:00
Baoquan He
d2765b5175 Change the implementation of action_on_fail
Currently when action_on_fail is enabled, the emergency_shell won't be called.
In kdump even though user specify the default action as emergency_shell,
dracut skip it. Now change the implementation of action_on_fail to depend
on a file which is created by kdump when making kdump initrd, then remove it
at the beginning of kdump. This can solve the explicit emergency_shell problem.

And action_on_fail won't need paramenters, remove the relevant description in
dracut man page.

Signed-off-by: Baoquan He <bhe@redhat.com>
2013-07-31 16:23:39 +02:00
Harald Hoyer
d27cd4dfdd Revert "base: setup correct system time and time zone in initrd"
This reverts commit 77364fd6bb.

Too many problems with adjtime in the initramfs

https://bugzilla.redhat.com/show_bug.cgi?id=981617
2013-07-31 15:55:22 +02:00
Radek Vykydal
030b00b8a5 Generate correct ifcfg file for vlan= option. 2013-07-31 15:47:33 +02:00
Harald Hoyer
de50e9c002 dracut-031 2013-07-31 14:24:25 +02:00
Harald Hoyer
868f935e23 kernel-modules/module-setup.sh: silently omit some filesystem drivers 2013-07-31 13:56:03 +02:00
Harald Hoyer
4ba662ff90 dracut.conf.d/fedora.conf.example: don't omit drivers 2013-07-31 13:56:03 +02:00
Harald Hoyer
dc7085ceeb systemd: use systemd in the initramfs, if installed on the system
and systemd version is >= 198
2013-07-31 13:56:03 +02:00
Harald Hoyer
9444bf6161 network: add vlan support for iBFT 2013-07-31 13:17:24 +02:00
Harald Hoyer
06ca27cdf5 dracut-logger.sh: do not use systemd-cat, if no /run/systemd/journal 2013-07-31 13:12:41 +02:00
Harald Hoyer
dd82da4e27 network/net-lib.sh: safeguard against incomplete iBFT settings 2013-07-31 12:00:53 +02:00
Harald Hoyer
190047f161 fips: handle checksum checks for RHEV kernels
https://bugzilla.redhat.com/show_bug.cgi?id=947729
2013-07-31 11:31:13 +02:00
Harald Hoyer
748867d177 fips: cope with module aliases, when checking modules
Also do not fail, if module aliases try to load CPU specific modules
like crc32c_intel.
2013-07-31 11:26:46 +02:00
Harald Hoyer
b806625d41 TEST-30-ISCSI: eth0 -> ens3 2013-07-31 11:23:51 +02:00
Harald Hoyer
dba2055979 remove "< <(" syntax
bash seems to want /dev/fd in that case. dracut is sometimes called in
environments, where /proc and /dev are not mounted.
2013-07-31 11:00:29 +02:00
Harald Hoyer
aa23dcd8ae TEST-50-MULTINIC: change interface names to ens* 2013-07-31 10:59:25 +02:00
Harald Hoyer
5bbbfeaf19 TEST-10: double disk space 2013-07-31 09:57:57 +02:00
Harald Hoyer
9b6c5fd7c7 dracut.spec: add bcache and modsign module 2013-07-30 16:21:59 +02:00
Harald Hoyer
904a76376f base/init.sh: create static device nodes with kmod 2013-07-30 16:20:05 +02:00
Harald Hoyer
52814c0ee3 systemd/dracut-pre-trigger.service: run after systemd-tmpfiles-setup-dev 2013-07-30 16:18:51 +02:00
Harald Hoyer
d124904f2b systemd: include systemd-tempfiles 2013-07-30 16:18:03 +02:00
Harald Hoyer
7fd850d58e dracut.sh: check for file existance before trying to read from it 2013-07-30 15:33:10 +02:00
Harald Hoyer
71bb2ecd79 base: hard depend on systemd, if system was started by systemd 2013-07-30 15:28:47 +02:00
James Lee
6e0348f33b crypt: Wait for udev to settle before unlocking disk
To eliminate a race condition that occurs when unlocking one device
depends on the result of unlocking a device before it, the crypt
module must wait for udev to settle between each unlock attempt.

Example

/etc/crypttab:

  keyfile /dev/md1 none luks
  sda4_crypt /dev/sda4 /dev/mapper/keyfile luks
  sdb4_crypt /dev/sdb4 /dev/mapper/keyfile luks

Without this patch, sometimes /dev/sda4 fails to unlock because udev
doesn't have time to create /dev/mapper/keyfile before it's needed.
2013-07-30 15:28:47 +02:00
Harald Hoyer
27458b10ff url-lib/module-setup.sh: fixed grepping libcurl 2013-07-30 15:28:46 +02:00
Harald Hoyer
bf27e473cb mdraid/mdmon-pre-shutdown.sh: removed unneeded code 2013-07-30 15:28:46 +02:00
Harald Hoyer
549442cc2a base/dracut-lib.sh: check for /proc/cmdline existance 2013-07-30 15:28:46 +02:00
Harald Hoyer
98836432c1 dracut.spec: fix typo 2013-07-30 15:28:46 +02:00
Harald Hoyer
d988dc30df systemd: add support for kmod static devnodes 2013-07-30 11:58:33 +02:00
Harald Hoyer
c5f8b69ad7 network:ifup handle bootif style interfaces
e.g. ip=77-77-6f-6f-64-73:dhcp
2013-07-29 16:06:28 +02:00
Amadeusz Żołnowski
2beee35d5e LatArCyrHeb-16 as a default i18n font for Gentoo 2013-07-26 08:03:16 +02:00
Amadeusz Żołnowski
1ae8b8aa02 crypt: Skip /etc/crypttab if not present
Prevents following error message:

I: *** Including module: crypt ***
/usr/lib/dracut/modules.d/90crypt/module-setup.sh: line 31: /etc/crypttab: No such file or directory
2013-07-26 08:03:15 +02:00
Harald Hoyer
8f092d0dda bcache: add support for bcache 2013-07-24 14:35:19 +02:00
Harald Hoyer
d624f60682 dracut.sh: check for /sbin /bin /lib
use readlink to detect, if /usr has to be mounted
2013-07-24 13:43:32 +02:00
Harald Hoyer
5decf6d813 add debian udev rule files 2013-07-24 13:42:17 +02:00
Harald Hoyer
1a1c80febe usrmount: do not install, if /sbin/init does not live in /usr 2013-07-24 13:41:57 +02:00
Harald Hoyer
7b3ff4e055 dracut-functions.sh:get_fs_env() fallback to blkid for ID_FS_TYPE not found 2013-07-24 13:38:57 +02:00
Harald Hoyer
56b58c0a94 modsign: do not install, if no keys present
also fixed inst_hook
2013-07-24 10:34:19 +02:00
Kyle McMartin
ad2565c8ff dracut: 90kernel-modules/module-setup.sh: add ehci-tegra.ko on arm
kernel-tegra is now part of the base kernel package, so bits and pieces
ended up modular, and as a result, if you boot off the internal USB, you
drop to a dracut shell with no way of getting to root.
2013-07-24 10:23:10 +02:00
Peter Jones
9f3d191fce Load kernel module signing keys before we start doing any real work.
This loads kernel module signing keys, so that we can verify signed
modules in secure boot mode.

Signed-off-by: Peter Jones <pjones@redhat.com>
2013-07-24 10:23:09 +02:00
Brandon Philips
f17c5fa573 95rootfs-block: fix PARTUUID parsing
In the kernel comments PARTUUID is shown using uppercase A-F:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/init/do_mounts.c?id=HEAD#n183

However, dracut tries to use the value of PARTUUID directly in
/dev/disks/by-partuuid/ which expects the hex to be lowercase. This will
cause root to never be found, oops!

Fix dracut so it can, like the Kernel, accept either casing.

Untested but I added a hack on my local system that was similar.
2013-07-24 10:23:09 +02:00
Colin Walters
99369bea1c systemd: Replace prefdm.service with display-manager.service
The former is dead, the latter is the new name.  See:

http://cgit.freedesktop.org/systemd/systemd/commit/?id=b2c9cbafb8b1a2742978e1faf37fbb3cf4fb5d44
https://fedoraproject.org/wiki/Features/DisplayManagerRework
2013-07-24 10:23:08 +02:00
Harald Hoyer
45ef8eb723 base: provide pidof() shell function 2013-07-23 12:56:20 +02:00
Harald Hoyer
bc6eae15ab init.sh: don't check for systemd-udevd in lower version branch 2013-07-23 12:26:06 +02:00
Harald Hoyer
475f3a8128 dracut.spec: require procps-ng for ps 2013-07-23 12:25:38 +02:00
Harald Hoyer
6b1e7a6ca4 dracut: use sysloglvl for systemd-cat logging 2013-07-19 09:46:00 +02:00
Harald Hoyer
bbaa0d5917 Use systemd-cat for logging on systemd systems, if logfile is empty 2013-07-19 09:34:45 +02:00
Harald Hoyer
3c4bfd685a dracut-functions.sh: only wait for the last pid spawned 2013-07-19 09:34:04 +02:00
Harald Hoyer
9dde7a66b5 dracut-functions.sh: don't warn twice about omitted modules 2013-07-19 09:33:45 +02:00
Harald Hoyer
34b56de12a resume: do not include in hostonly, if no swap is present 2013-07-18 14:41:31 +02:00
Harald Hoyer
951cedf8cb Revert "systemd: add systemd-fsck-root.service"
This reverts commit 35857f556c.
2013-07-17 15:05:30 +02:00
Harald Hoyer
0baf97618d AUTHORS: update 2013-07-17 14:58:44 +02:00
Harald Hoyer
8642792c3e NEWS: update 2013-07-17 14:58:35 +02:00
Harald Hoyer
5bbfd48475 dracut: do not enable early microcode inclusion by default 2013-07-17 14:36:34 +02:00
Harald Hoyer
c33488feb1 rename sosreport to rdsosreport
Renamed sosreport to rdsosreport to differ from the sosreport tool on
the real root.
2013-07-17 14:31:59 +02:00
Harald Hoyer
18e61d3d41 rename dracut-nohostonly and dracut-norescue rpm subpackages
dracut-nohostonly -> dracut-config-generic
dracut-norescue   -> dracut
                  -> dracut-config-rescue
2013-07-17 13:02:58 +02:00
Harald Hoyer
fbf717086e dmraid: let dmraid setup the partitions 2013-07-17 12:07:19 +02:00
Harald Hoyer
5a6a98f875 do not wait_for_dev for the root device
it's specified on the kernel command line
2013-07-17 12:03:01 +02:00
Harald Hoyer
35857f556c systemd: add systemd-fsck-root.service 2013-07-17 12:00:04 +02:00
Harald Hoyer
a6865e6897 rootfs-block: do not touch root-fsck
in systemd environments, we use systemd in the initramfs
2013-07-17 11:58:55 +02:00
Harald Hoyer
55068924f7 i18n: do not moan about missing kbd directory 2013-07-17 11:58:17 +02:00
Harald Hoyer
16addb86fc base: remove RD_TIMESTAMP 2013-07-17 11:26:55 +02:00
Konrad Rzeszutek Wilk
5f2c30d9bc dracut.sh: Support early microcode loading.
On Wed, Jul 10, 2013 at 10:58:15AM -0400, Konrad Rzeszutek Wilk wrote:
> On Wed, Jul 10, 2013 at 09:37:11AM +0200, Harald Hoyer wrote:
> > On 07/10/2013 02:29 AM, Yu, Fenghua wrote:
> > >> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
> > >> Sent: Tuesday, July 09, 2013 12:24 PM
> > >> Implement it per Linux kernel Documentation/x86/early-microcode.txt
> > >> (from v3.11-rc0):
> > [...]
> > > This patch works fine with one microcode blob in binary format. There are situations that the microcode is not delivered in one blob in binary format:
> > >
> > > First, each microcode patch is one file instead all microcode patches are in one big blob. Secondly, old delivered microcode file is in ascii format.
> > >
> > > To handle those formats, additional code needs to convert the formats into one big binary microcode blob. I'm not sure if we should consider the code and if we should put the code in dracut.
> > >
> > > Thanks.
> > >
> > > -Fenghua
> > >
> >
> >
> > $ ls /lib/firmware/amd-ucode
> > microcode_amd.bin  microcode_amd_fam15h.bin  microcode_amd_solaris.bin
>
> Right, so all of those blobs (for AMD) get stuck in AuthenticAMD.bin.
>
> > $ ls /lib/firmware/intel-ucode
> > 06-03-02  06-06-00  06-07-02  06-08-0a  06-0b-04  06-0f-06  06-16-01  06-1c-02
> > 06-25-02  06-2d-07  0f-01-02  0f-02-09  0f-04-03  0f-04-0a
> > 06-05-00  06-06-05  06-07-03  06-09-05  06-0d-06  06-0f-07  06-17-06  06-1c-0a
> > 06-25-05  06-2f-02  0f-02-04  0f-03-02  0f-04-04  0f-06-02
> > 06-05-01  06-06-0a  06-08-01  06-0a-00  06-0e-08  06-0f-0a  06-17-07  06-1d-01
> > 06-26-01  06-3a-09  0f-02-05  0f-03-03  0f-04-07  0f-06-04
> > 06-05-02  06-06-0d  06-08-03  06-0a-01  06-0e-0c  06-0f-0b  06-17-0a  06-1e-04
> > 06-2a-07  0f-00-07  0f-02-06  0f-03-04  0f-04-08  0f-06-05
> > 06-05-03  06-07-01  06-08-06  06-0b-01  06-0f-02  06-0f-0d  06-1a-04  06-1e-05
> > 06-2d-06  0f-00-0a  0f-02-07  0f-04-01  0f-04-09  0f-06-08
>
> And all of those get catted in GenuineIntel.bin.
>
> >
> > Also, for [[ $hostonly ]], we only want to add the current running CPU microcode.
>
> <nods> Will do that. Are you OK with me adding some of this CPU detection logic
> in dracut-functions.sh?

This is still RFC, as I had not done the --no-compress logic (or tested it).
Please see if this is OK:

>From 5f853d2ececd4cadff648e22cb9c9287a01a9783 Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date: Tue, 9 Jul 2013 13:57:01 -0400
Subject: [PATCH] dracut.sh: Support early microcode loading.

Implement it per Linux kernel Documentation/x86/early-microcode.txt
(from v3.11-rc0):

<start>
Early load microcode
====================
By Fenghua Yu <fenghua.yu@intel.com>

Kernel can update microcode in early phase of boot time. Loading microcode early
can fix CPU issues before they are observed during kernel boot time.

Microcode is stored in an initrd file. The microcode is read from the initrd
file and loaded to CPUs during boot time.

The format of the combined initrd image is microcode in cpio format followed by
the initrd image (maybe compressed). Kernel parses the combined initrd image
during boot time. The microcode file in cpio name space is:
on Intel: kernel/x86/microcode/GenuineIntel.bin
on AMD  : kernel/x86/microcode/AuthenticAMD.bin

During BSP boot (before SMP starts), if the kernel finds the microcode file in
the initrd file, it parses the microcode and saves matching microcode in memory.
If matching microcode is found, it will be uploaded in BSP and later on in all
APs.

The cached microcode patch is applied when CPUs resume from a sleep state.

There are two legacy user space interfaces to load microcode, either through
/dev/cpu/microcode or through /sys/devices/system/cpu/microcode/reload file
in sysfs.

In addition to these two legacy methods, the early loading method described
here is the third method with which microcode can be uploaded to a system's
CPUs.

The following example script shows how to generate a new combined initrd file in
/boot/initrd-3.5.0.ucode.img with original microcode microcode.bin and
original initrd image /boot/initrd-3.5.0.img.

mkdir initrd
cd initrd
mkdir -p kernel/x86/microcode
cp ../microcode.bin kernel/x86/microcode/GenuineIntel.bin (or AuthenticAMD.bin)
find . | cpio -o -H newc >../ucode.cpio
cd ..
cat ucode.cpio /boot/initrd-3.5.0.img >/boot/initrd-3.5.0.ucode.img
<end>

That is what we do in the patch. Furthermoere there is also
an off-switch: "no-early-microcode" to disable it.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
[v1: Support --host-only parameter]
2013-07-15 14:06:40 +02:00
Harald Hoyer
c00f8e05a6 dracut.sh: correct dropindirs_sort 2013-07-12 10:35:49 +02:00
Harald Hoyer
85231e1ff3 base/module-setup.sh: do not add devs to initqueue/finished
when need-initqueue is not set in systemd mode
2013-07-12 10:15:10 +02:00
Harald Hoyer
88396c383c base/module-setup.sh: do not include systemd-timestamp
when using systemd in the initramfs
2013-07-12 10:14:15 +02:00
Harald Hoyer
df03141dbc dracut-cmdline.service: remove Before: systemd-vconsole-setup.service 2013-07-12 09:47:24 +02:00
Harald Hoyer
bf9cdc472c systemd/module-setup.sh: create emtpy /etc/machine-id
Even in hostonly mode, if none was found on the system.
2013-07-11 12:15:17 +02:00
Harald Hoyer
02b5c8e3a3 dracut.sh: unset all LC_* and LANG
saves 10% of time :-)
2013-07-05 16:27:34 +02:00
Harald Hoyer
f734347ae7 modules.d/10i18n/module-setup.sh: handle empty vconsole.conf
if /etc/vconsole.conf exists and is empty, then do not install anything.
2013-07-05 15:48:40 +02:00
Harald Hoyer
4aca0017e8 terminfo: only install l/linux v/vt100 and v/vt220 2013-07-05 15:32:58 +02:00
Harald Hoyer
1e057b352a add PARTLABEL and PARTUUID 2013-07-05 15:32:38 +02:00
Harald Hoyer
431b86c8e9 masterkey/module-setup.sh:check() check for $hostonly rather than "-h" 2013-07-04 12:31:31 +02:00
Harald Hoyer
b093aa2dc7 beautified shell code
checked with shellcheck http://www.shellcheck.net/about.html
2013-07-04 12:31:15 +02:00
Harald Hoyer
32bd2fbb4c use "rm --" to guard against filenames beginning with "-" 2013-06-28 10:31:18 +02:00
Harald Hoyer
1d84d6940e TEST-04-FULL-SYSTEMD/test.sh: dlfgjlkdfjgldfj 2013-06-28 10:22:27 +02:00
Harald Hoyer
87ae968810 test/run-qemu: specify the kernel 2013-06-28 10:21:42 +02:00
Harald Hoyer
f13deabd22 systemd/module-setup.sh: add slices.target 2013-06-28 09:58:03 +02:00
Harald Hoyer
0d59a84b53 TEST-04-FULL-SYSTEMD: call xargs with "-r" 2013-06-26 09:16:04 +02:00
Harald Hoyer
68cb510f18 systemd: add system.slice unit 2013-06-26 09:15:34 +02:00
Harald Hoyer
5e60145449 use findmnt with "--source" or "--target"
This avoids hanging on stale NFS mounts, which are not part of the boot
process.

https://bugzilla.redhat.com/show_bug.cgi?id=975401
2013-06-24 12:47:53 +02:00
Harald Hoyer
282e0583b0 udev-rules: add 75-net-description.rules
we need IMPORT{builtin}="net_id" for the persistent network names
2013-06-18 17:54:30 +02:00
WANG Chao
32d115f385 selinux: umount $NEWROOT/dev and its submounts
$NEWROOT/dev and its submounts should be umounted after we use it.
Otherwise it fails other scripts that umount /sysroot only.

Signed-off-by: WANG Chao <chaowang@redhat.com>
2013-06-18 08:56:11 +02:00
Harald Hoyer
416d3d6390 NEWS: update 2013-06-14 15:31:28 +02:00
Baoquan He
8a9a5838f3 90lvm/module-setup.sh: redirect error message of lvs to /dev/null
Signed-off-by: Baoquan He <bhe@redhat.com>
2013-06-13 15:49:20 +02:00
Harald Hoyer
a94cd56d6f test/TEST-50-MULTINIC: fix interface test 2013-06-13 15:15:55 +02:00
Harald Hoyer
b819f519cb network: refix BOOTIF logic 2013-06-13 15:15:19 +02:00
Harald Hoyer
44d832c5ad test/TEST-50-MULTINIC: fixed debug output 2013-06-13 14:44:47 +02:00
Harald Hoyer
4961910fe3 systemd/module-setup.sh: mkdir /etc/systemd 2013-06-13 14:44:13 +02:00
Will Woods
3d0da653f0 net-lib: fix set_ifname()
/sys/class/$name$num isn't ever going to work; /sys/class/net/$name$num
(e.g. /sys/class/net/ibft0) should work right.
2013-06-13 14:07:17 +02:00
Will Woods
4ef0e2d92a net-lib: add configured_ifaces()
configured_ifaces is a function that returns the names of each interface
that the user wanted configured.

Currently, this is accomplished by reading the list from
/tmp/net.ifaces. But if we want to allow the user to specify an
interface by its MAC address or IP or something, we need a function that
will read the cache and convert the MACs etc. to names.

(Obviously this conversion only works once udev starts, so it will warn
you if you try it too early.)
2013-06-13 14:07:17 +02:00
Will Woods
bd0f2c034a net-lib: add find_iface_with_link()
Add a function to look at the system network interfaces and return the
first one it finds with an active link (if any.)
2013-06-13 14:07:17 +02:00
Will Woods
d8a698713e Don't explode when mixing BOOTIF and ip=
Now that we can use a MAC as a device identifier, we can just bring up
the device specified by BOOTIF as a normal interface.

So instead of ignoring everything but BOOTIF, we'll put BOOTIF in the
IFACES list and bring it up as normal, defaulting to DHCP if nothing
else is specified.

We can also handle anaconda-style 'ksdevice=bootif' this way.
2013-06-13 14:07:17 +02:00
Will Woods
57f2579281 net-genrules: accept MAC address for $iface, cleanups
A MAC address is a unique identifier for a particular network interface.

We can use the MAC to generate udev rules to bring up that interface,
like we currently do with BOOTIF.

This patch allows interfaces to be specified as a MAC address, either
in the usual colon-separated form or the PXE-style dash-separated form.

(The latter is more useful on the commandline, since it allows for
arguments like: "ip=77-77-6f-6f-64-73:dhcp")

This is useful since it's common for a user who is booting a new OS for
the first time to know the MAC of the device, but not know what the
kernel name will be.
2013-06-13 14:07:17 +02:00
Will Woods
215ff169db move fix_bootif to net-lib
This might be useful to other parts of dracut; move it to net-lib.sh.
2013-06-13 13:54:16 +02:00
Harald Hoyer
85b458d90d Makefile: source dracut-version.sh and correct dist tarball 2013-06-13 12:55:26 +02:00
Harald Hoyer
268ae2841b Makefile: pipe git describe errors to /dev/null 2013-06-13 12:55:26 +02:00
Harald Hoyer
638cad7c97 add dracut-shutdown.service.8.asc manpage 2013-06-13 12:55:26 +02:00
Harald Hoyer
0fbb79d54f move dracut-shutdown.service to modules.d/98systemd 2013-06-13 11:42:26 +02:00
Harald Hoyer
36c34f4e71 Don't use do syncheck for target all and refine syncheck
instead of "dash -n" we now use "bash --posix -n"
we also check for "[[ " in posix shell files
2013-06-13 11:19:26 +02:00
Harald Hoyer
373efa4427 systemd: make unit files symlinks 2013-06-13 11:08:03 +02:00
Harald Hoyer
cee4599131 systemd/dracut-pre-pivot.service: also execute for cleanup hooks or rd.break 2013-06-13 10:37:45 +02:00
Harald Hoyer
c6011f2add i18n: make the default font configurable
To set the default font for your distribution, add
i18n_default_font="latarcyrheb-sun16"
to your /lib/dracut/dracut.conf.d/01-dist.conf distribution config.
2013-06-13 09:29:17 +02:00
Harald Hoyer
f8b958dc62 network: wait 40 seconds for IPv6 auto configuration
https://bugzilla.redhat.com/show_bug.cgi?id=973719
2013-06-12 17:42:35 +02:00
168 changed files with 2364 additions and 1629 deletions

View File

@@ -26,7 +26,7 @@ case "$1" in
ret=$?
;;
remove)
rm -f "$3"/initrd
rm -f -- "$3"/initrd
ret=$?
;;
esac

View File

@@ -6,6 +6,9 @@ export LANG=C
COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="${3%/*}/0-rescue"
KERNEL_IMAGE="$4"
dropindirs_sort()
{
@@ -50,7 +53,6 @@ fi
LOADER_ENTRY="/boot/loader/entries/${MACHINE_ID}-0-rescue.conf"
BOOT_DIR="/${MACHINE_ID}/0-rescue"
BOOT_DIR_ABS="/boot${BOOT_DIR}"
ret=0

25
AUTHORS
View File

@@ -1,67 +1,74 @@
Harald Hoyer <harald@redhat.com>
Victor Lowther <victor.lowther@gmail.com>
Amadeusz Żołnowski <aidecoe@aidecoe.name>
Will Woods <wwoods@redhat.com>
Philippe Seewer <philippe.seewer@bfh.ch>
Warren Togami <wtogami@redhat.com>
Will Woods <wwoods@redhat.com>
Jeremy Katz <katzj@redhat.com>
David Dillow <dave@thedillows.org>
Dave Young <dyoung@redhat.com>
David Dillow <dave@thedillows.org>
Michal Soltys <soltys@ziu.info>
Amerigo Wang <amwang@redhat.com>
Colin Guthrie <colin@mageia.org>
Andrey Borzenkov <arvidjaar@gmail.com>
Peter Jones <pjones@redhat.com>
Andreas Thienemann <andreas@bawue.net>
Hans de Goede <hdegoede@redhat.com>
Peter Jones <pjones@redhat.com>
John Reiser <jreiser@bitwagon.com>
Luca Berra <bluca@vodka.it>
WANG Chao <chaowang@redhat.com>
Daniel Drake <dsd@laptop.org>
Dan Horák <dhorak@redhat.com>
Baoquan He <bhe@redhat.com>
Leho Kraav <leho@kraav.com>
Brian C. Lane <bcl@redhat.com>
Kamil Rytarowski <n54@gmx.com>
Marc Grimme <grimme@atix.de>
Chao Wang <chaowang@redhat.com>
Frederic Crozat <fcrozat@suse.com>
Jesse Keating <jkeating@redhat.com>
Milan Broz <mbroz@redhat.com>
Radek Vykydal <rvykydal@redhat.com>
Roberto Sassu <roberto.sassu@polito.it>
Anton Blanchard <anton@samba.org>
Bill Nottingham <notting@redhat.com>
Colin Walters <walters@verbum.org>
David Cantrell <dcantrell@redhat.com>
Dennis Gilmore <dennis@ausil.us>
Jon Ander Hernandez <jonan.h@gmail.com>
Juan RP <xtraeme@gmail.com>
Lance Albertson <lance@osuosl.org>
Marian Ganisin <mganisin@redhat.com>
Michael Ploujnikov <plouj@somanetworks.com>
Peter Rajnoha <prajnoha@redhat.com>
Radek Vykydal <rvykydal@redhat.com>
WANG Chao <chaowang@redhat.com>
Wim Muskee <wimmuskee@gmail.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Alan Pevec <apevec@redhat.com>
Baoquan He <bhe@redhat.com>
Colin Walters <walters@verbum.org>
Dennis Gilmore <dennis@ausil.us>
Frederick Grose <fgrose@sugarlabs.org>
Ian Dall <ian@beware.dropbear.id.au>
James Buren <ryuo@frugalware.org>
James Lee <jlee@thestaticvoid.com>
Joey Boggs <jboggs@redhat.com>
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mike Snitzer <snitzer@redhat.com>
Przemysław Rudy <prudy1@o2.pl>
Stefan Reimer <it@startux.de>
Thomas Lange <lange@informatik.uni-koeln.de>
Vivek Goyal <vgoyal@redhat.com>
Vladislav Bogdanov <bubble@hoster-ok.com>
Adam Williamson <awilliam@redhat.com>
Alexander Todorov <atodorov@redhat.com>
Andy Lutomirski <luto@mit.edu>
Anssi Hannula <anssi@mageia.org>
Brandon Philips <brandon@ifup.co>
Canek Peláez Valdés <caneko@gmail.com>
Chris Leech <cleech@redhat.com>
Christian Heinz <christian.ch.heinz@gmail.com>
Cong Wang <amwang@redhat.com>
Daniel Schaal <farbing@web.de>
Dave Jones <davej@redhat.com>
Dave Young <dave@redhat.com>
Dennis Schridde <devurandom@gmx.net>
Duane Griffin <duaneg@dghda.com>
Glen Gray <slaine@slaine.org>
Hermann Gausterer <git-dracut-2012@mrq1.org>
@@ -70,7 +77,7 @@ Jan Stodola <jstodola@redhat.com>
Jiri Pirko <jiri@resnulli.us>
Joe Lawrence <Joe.Lawrence@stratus.com>
Kevin Yung <Kevin.Yung@myob.com>
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Kyle McMartin <kyle@redhat.com>
Lars R. Damerow <lars@pixar.com>
Lennert Buytenhek <buytenh@wantstofly.org>
Lubomir Rintel <lkundrak@v3.sk>

View File

@@ -1,6 +1,7 @@
RELEASEDVERSION = -- will be replaced by "make dist" --
VERSION = $(shell [ -d .git ] && git describe --abbrev=0 --tags || echo $(RELEASEDVERSION))
GITVERSION = $(shell [ -d .git ] && { v=$$(git describe --tags); echo -$${v\#*-}; } )
-include dracut-version.sh
VERSION = $(shell [ -d .git ] && git describe --abbrev=0 --tags 2>/dev/null || echo $(DRACUT_VERSION))
GITVERSION = $(shell [ -d .git ] && { v=$$(git describe --tags 2>/dev/null); [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
-include Makefile.inc
@@ -28,6 +29,7 @@ man8pages = dracut.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 \
@@ -38,7 +40,7 @@ manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
all: syncheck dracut-version.sh dracut-install
all: dracut-version.sh dracut-install
DRACUT_INSTALL_OBJECTS = \
install/dracut-install.o \
@@ -80,7 +82,7 @@ dracut.html: dracut.asc $(manpages)
--stringparam html.stylesheet \
http://docs.fedoraproject.org/en-US/Common_Content/css/default.css \
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
rm dracut.xml
rm -f -- dracut.xml
install: dracut-version.sh
mkdir -p $(DESTDIR)$(pkglibdir)
@@ -110,7 +112,7 @@ ifneq ($(enable_documentation),no)
endif
if [ -n "$(systemdsystemunitdir)" ]; then \
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
install -m 0644 dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir); \
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98systemd/dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown.service; \
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants; \
ln -s ../dracut-shutdown.service \
$(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants/dracut-shutdown.service; \
@@ -124,9 +126,9 @@ endif
dracut-pre-trigger.service \
dracut-pre-udev.service \
; do \
install -m 0644 modules.d/98systemd/$$i $(DESTDIR)$(systemdsystemunitdir); \
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98systemd/$$i $(DESTDIR)$(systemdsystemunitdir); \
ln -s ../$$i \
$(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants/$i; \
$(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants/$$i; \
done \
fi
if [ -f install/dracut-install ]; then \
@@ -156,31 +158,31 @@ clean:
dist: dracut-$(VERSION).tar.bz2
dracut-$(VERSION).tar.bz2: doc
dracut-$(VERSION).tar.bz2: doc syncheck
@echo "DRACUT_VERSION=$(VERSION)" > dracut-version.sh
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ > dracut-$(VERSION).tar
mkdir -p dracut-$(VERSION)
cp $(manpages) dracut.html dracut-$(VERSION)
git show $(VERSION):Makefile | sed 's/^RELEASEDVERSION =.*/RELEASEDVERSION = $(VERSION)/' > dracut-$(VERSION)/Makefile
tar --owner=root --group=root -rf dracut-$(VERSION).tar dracut-$(VERSION)/*.[0-9] dracut-$(VERSION)/dracut.html dracut-$(VERSION)/Makefile
rm -fr dracut-$(VERSION).tar.bz2 dracut-$(VERSION)
for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(VERSION)/$${i%/*}"; cp "$$i" "dracut-$(VERSION)/$$i"; done
tar --owner=root --group=root -rf dracut-$(VERSION).tar $$(find dracut-$(VERSION) -type f)
rm -fr -- dracut-$(VERSION).tar.bz2 dracut-$(VERSION)
bzip2 -9 dracut-$(VERSION).tar
rm -f dracut-$(VERSION).tar
rm -f -- dracut-$(VERSION).tar
rpm: dracut-$(VERSION).tar.bz2
rpm: dracut-$(VERSION).tar.bz2 syncheck
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
cp dracut-$(VERSION).tar.bz2 "$$rpmbuild"; \
LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
(cd "$$rpmbuild"; rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
( mv "$$rpmbuild"/$$(arch)/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr "$$rpmbuild"; ls *.rpm )
( mv "$$rpmbuild"/$$(arch)/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr -- "$$rpmbuild"; ls *.rpm )
syncheck:
@ret=0;for i in dracut-initramfs-restore.sh dracut-logger.sh \
modules.d/99base/init.sh modules.d/*/*.sh; do \
@ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \
[ "$${i##*/}" = "module-setup.sh" ] && continue; \
read line < "$$i"; [ "$${line#*bash*}" != "$$line" ] && continue; \
[ $$V ] && echo "dash syntax check: $$i"; dash -n "$$i" ; ret=$$(($$ret+$$?)); \
[ $$V ] && echo "posix syntax check: $$i"; bash --posix -n "$$i" ; ret=$$(($$ret+$$?)); \
[ $$V ] && echo "checking for [[: $$i"; if grep -Fq '[[ ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains [["; fi \
done;exit $$ret
@ret=0;for i in *.sh mkinitrd-dracut.sh modules.d/*/*.sh \
modules.d/*/module-setup.sh; do \

115
NEWS
View File

@@ -1,3 +1,118 @@
dracut-032
==========
- add parameter --print-cmdline
This prints the kernel command line parameters for the current disk
layout.
$ dracut --print-cmdline
rd.luks.uuid=luks-e68c8906-6542-4a26-83c4-91b4dd9f0471
rd.lvm.lv=debian/root rd.lvm.lv=debian/usr root=/dev/mapper/debian-root
rootflags=rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered
rootfstype=ext4
- dracut.sh: add --persistent-policy option and persistent_policy conf option
--persistent-policy <policy>:
Use <policy> to address disks and partitions.
<policy> can be any directory name found in /dev/disk.
E.g. "by-uuid", "by-label"
- dracut now creates the initramfs without udevadm
that means the udev database does not have to populated
and the initramfs can be built in a chroot with
/sys /dev /proc mounted
- renamed dracut_install() to inst_multiple() for consistent naming
- if $libdirs is unset, fall back to ld.so.cache paths
- always assemble /usr device in initramfs
- bash module added (disable it, if you really want dash)
- continue to boot, if the main loop times out, in systemd mode
- removed inst*() shell pure versions, dracut-install binary is in charge now
- fixed ifcfg file generation for vlan
- do not include adjtime and localtime anymore
- fixed generation of zfcp.conf of CMS setups
- install vt102 terminfo
dracut_install() is still there for backwards compat
- do not strip files in FIPS mode
- fixed iBFT interface configuration
- fs-lib: install fsck and fsck.ext*
- shutdown: fixed killall_proc_mountpoint()
- network: also wait for ethernet interfaces to setup
- fixed checking for FIPS mode
Contributions from:
Harald Hoyer
WANG Chao
Baoquan He
Daniel Schaal
Dave Young
James Lee
Radek Vykydal
dracut-031
==========
- do not include the resume dracut module in hostonly mode,
if no swap is present
- don't warn twice about omitted modules
- use systemd-cat for logging on systemd systems, if logfile is unset
- fixed PARTUUID parsing
- support kernel module signing keys
- do not install the usrmount dracut module in hostonly mode,
if /sbin/init does not live in /usr
- add debian udev rule files
- add support for bcache
- network: handle bootif style interfaces
e.g. ip=77-77-6f-6f-64-73:dhcp
- add support for kmod static devnodes
- add vlan support for iBFT
Contributions from:
Harald Hoyer
Amadeusz Żołnowski
Brandon Philips
Colin Walters
James Lee
Kyle McMartin
Peter Jones
dracut-030
==========
- support new persistent network interface names
- fix findmnt calls, prevents hang on stale NFS mounts
- add systemd.slice and slice.target units
- major shell cleanup
- support root=PARTLABEL= and root=PARTUUID=
- terminfo: only install l/linux v/vt100 and v/vt220
- unset all LC_* and LANG, 10% faster
- fixed dependency loop for dracut-cmdline.service
- do not wait_for_dev for the root devices
- do not wait_for_dev for devices, if dracut-initqueue is not needed
- support early microcode loading with --early-microcode
- dmraid, let dmraid setup its own partitions
- sosreport renamed to rdsosreport
Contributions from:
Harald Hoyer
Konrad Rzeszutek Wilk
WANG Chao
dracut-029
==========
- wait for IPv6 autoconfiguration
- i18n: make the default font configurable
To set the default font for your distribution, add
i18n_default_font="latarcyrheb-sun16"
to your /lib/dracut/dracut.conf.d/01-dist.conf distribution config.
- proper handle "rd.break" in systemd mode before switch-root
- systemd: make unit files symlinks
- build without dash requirement
- add dracut-shutdown.service.8 manpage
- handle MACs for "ip="
"ip=77-77-6f-6f-64-73:dhcp"
- don't explode when mixing BOOTIF and ip=
- 90lvm/module-setup.sh: redirect error message of lvs to /dev/null
Contributions from:
Harald Hoyer
Will Woods
Baoquan He
dracut-028
==========
- full integration of crypto devs in systemd logic

View File

@@ -33,13 +33,14 @@ _dracut() {
--lvmconf --nolvmconf --debug --profile --verbose --quiet
--local --hostonly --no-hostonly --fstab --help --bzip2 --lzma
--xz --no-compress --gzip --list-modules --show-modules --keep
--printsize --regenerate-all --noimageifnotneeded'
--printsize --regenerate-all --noimageifnotneeded --early-microcode
--no-early-microcode --print-cmdline'
[ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers
--omit-drivers --modules --omit --drivers --filesystems --install
--fwdir --libdirs --fscks --add-fstab --mount --device --nofscks
--kmoddir --conf --confdir --tmpdir --stdlog --compress --prefix
--kernel-cmdline --sshkey'
--kernel-cmdline --sshkey --persistent-policy'
)
if __contains_word "$prev" ${OPTS[ARG]}; then
@@ -55,6 +56,9 @@ _dracut() {
-a|-m|-o|--add|--modules|--omit)
comps=$(dracut --list-modules 2>/dev/null)
;;
--persistent-policy)
comps=$(cd /dev/disk/; echo *)
;;
--kver)
comps=$(cd /lib/modules; echo [0-9]*)
;;

View File

@@ -118,11 +118,11 @@ fi
images+=($@)
dinfo "Using base image $baseimage"
cat "$baseimage" > "$outfile"
cat -- "$baseimage" > "$outfile"
for i in "${images[@]}"; do
dinfo "Appending $i"
cat "$i" >> "$outfile"
cat -- "$i" >> "$outfile"
done
dinfo "Created $outfile"

File diff suppressed because it is too large Load Diff

View File

@@ -17,13 +17,13 @@ cd /run/initramfs
[ -f .need_shutdown -a -f "$IMG" ] || exit 1
if zcat "$IMG" | cpio -id --quiet >/dev/null; then
rm .need_shutdown
rm -f -- .need_shutdown
elif xzcat "$IMG" | cpio -id --quiet >/dev/null; then
rm .need_shutdown
rm -f -- .need_shutdown
else
# something failed, so we clean up
echo "Unpacking of $IMG to /run/initramfs failed" >&2
rm -f /run/initramfs/shutdown
rm -f -- /run/initramfs/shutdown
exit 1
fi

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 et filetype=sh
#
@@ -117,30 +117,38 @@ dlog_init() {
if [ -z "$fileloglvl" ]; then
[ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
elif (( $fileloglvl > 0 )); then
__oldumask=$(umask)
umask 0377
! [ -e "$logfile" ] && >"$logfile"
umask $__oldumask
if [ -w "$logfile" -a -f "$logfile" ]; then
if [[ $logfile ]]; then
__oldumask=$(umask)
umask 0377
! [ -e "$logfile" ] && >"$logfile"
umask $__oldumask
if [ -w "$logfile" -a -f "$logfile" ]; then
# Mark new run in the log file
echo >>"$logfile"
if command -v date >/dev/null; then
echo "=== $(date) ===" >>"$logfile"
echo >>"$logfile"
if command -v date >/dev/null; then
echo "=== $(date) ===" >>"$logfile"
else
echo "===============================================" >>"$logfile"
fi
echo >>"$logfile"
else
echo "===============================================" >>"$logfile"
fi
echo >>"$logfile"
else
# We cannot log to file, so turn this facility off.
fileloglvl=0
ret=1
errmsg="'$logfile' is not a writable file"
fileloglvl=0
ret=1
errmsg="'$logfile' is not a writable file"
fi
fi
fi
if (( $sysloglvl > 0 )); then
if ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null
then
if [[ -d /run/systemd/journal ]] && type -P systemd-cat &>/dev/null && (( $UID == 0 )) ; then
readonly _dlogdir="$(mktemp --tmpdir="$TMPDIR/" -d -t dracut-log.XXXXXX)"
readonly _systemdcatfile="$_dlogdir/systemd-cat"
mkfifo "$_systemdcatfile"
readonly _dlogfd=15
systemd-cat -t 'dracut' <"$_systemdcatfile" &
exec 15>"$_systemdcatfile"
elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then
# We cannot log to syslog, so turn this facility off.
sysloglvl=0
ret=1
@@ -165,34 +173,34 @@ dlog_init() {
export maxloglvl
if (($stdloglvl < 6)) && (($kmsgloglvl < 6)) && (($fileloglvl < 6)); then
if (($stdloglvl < 6)) && (($kmsgloglvl < 6)) && (($fileloglvl < 6)) && (($sysloglvl < 6)); then
unset dtrace
dtrace() { :; };
fi
if (($stdloglvl < 5)) && (($kmsgloglvl < 5)) && (($fileloglvl < 5)); then
if (($stdloglvl < 5)) && (($kmsgloglvl < 5)) && (($fileloglvl < 5)) && (($sysloglvl < 5)); then
unset ddebug
ddebug() { :; };
fi
if (($stdloglvl < 4)) && (($kmsgloglvl < 4)) && (($fileloglvl < 4)); then
if (($stdloglvl < 4)) && (($kmsgloglvl < 4)) && (($fileloglvl < 4)) && (($sysloglvl < 4)); then
unset dinfo
dinfo() { :; };
fi
if (($stdloglvl < 3)) && (($kmsgloglvl < 3)) && (($fileloglvl < 3)); then
if (($stdloglvl < 3)) && (($kmsgloglvl < 3)) && (($fileloglvl < 3)) && (($sysloglvl < 3)); then
unset dwarn
dwarn() { :; };
unset dwarning
dwarning() { :; };
fi
if (($stdloglvl < 2)) && (($kmsgloglvl < 2)) && (($fileloglvl < 2)); then
if (($stdloglvl < 2)) && (($kmsgloglvl < 2)) && (($fileloglvl < 2)) && (($sysloglvl < 2)); then
unset derror
derror() { :; };
fi
if (($stdloglvl < 1)) && (($kmsgloglvl < 1)) && (($fileloglvl < 1)); then
if (($stdloglvl < 1)) && (($kmsgloglvl < 1)) && (($fileloglvl < 1)) && (($sysloglvl < 1)); then
unset dfatal
dfatal() { :; };
fi
@@ -306,15 +314,23 @@ _dlvl2syslvl() {
_do_dlog() {
local lvl="$1"; shift
local lvlc=$(_lvl2char "$lvl") || return 0
local msg="$lvlc: $*"
local msg="$*"
local lmsg="$lvlc: $*"
(( $lvl <= $stdloglvl )) && echo "$msg" >&2
if (( $lvl <= $sysloglvl )); then
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) "$msg"
if [[ "$_dlogfd" ]]; then
echo "<$(_dlvl2syslvl $lvl)>$msg" >&$_dlogfd
else
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) -- "$msg"
fi
fi
if (( $lvl <= $fileloglvl )) && [[ -w "$logfile" ]] && [[ -f "$logfile" ]]; then
echo "$msg" >>"$logfile"
echo "$lmsg" >>"$logfile"
fi
(( $lvl <= $kmsgloglvl )) && \
echo "<$(_dlvl2syslvl $lvl)>dracut[$$] $msg" >/dev/kmsg
}

View File

@@ -31,10 +31,10 @@ 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/sosreport.txt_ is created, which can be safed to a
the file _/run/initramfs/rdsosreport.txt_ is created, which can be safed 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/sosreport.txt_ contains all logs and the output of some tools.
_/run/initramfs/rdsosreport.txt_ contains all logs and the output of some tools.
It should be attached to any report about dracut problems.
EXAMPLE
@@ -225,6 +225,15 @@ example:
**--no-kernel**::
do not install kernel drivers and firmware files
**--early-microcode**::
Combine early microcode with ramdisk
**--no-early-microcode**::
Do not combine early microcode with ramdisk
**--print-cmdline**::
print the kernel command line for the current disk layout
**--mdadmconf**::
include local _/etc/mdadm.conf_
@@ -322,6 +331,11 @@ provide a valid _/etc/fstab_.
**-N, --no-hostonly**::
Disable Host-Only mode
**--persistent-policy** _<policy>_::
Use _<policy>_ to address disks and partitions.
_<policy>_ can be any directory name found in /dev/disk.
E.g. "by-uuid", "by-label"
**--fstab**::
Use _/etc/fstab_ instead of _/proc/self/mountinfo_.

View File

@@ -489,7 +489,7 @@ dracut shell commands are printed as they are executed
----
# journalctl -ab
----
. With dracut >= 025 the file /run/initramfs/sosreport.txt is generated, which contains all the logs and the output of all significant tools, which are mentioned later.
. With dracut >= 025 the file /run/initramfs/rdsosreport.txt is generated, which contains all the logs and the output of all significant tools, which are mentioned later.
If you want to save that output, simply mount /boot by hand or insert an USB stick and mount that.
Then you can store the output for later inspection.
@@ -777,25 +777,12 @@ scripts and udev rules.
[[stages]]
== Boot Process Stages
The init script in _99base_ is the main script, which prepares the root file
system for usage, runs udev, mounts the real root device, kills the remaining
processes, and switches to the real root device for further booting. dracut
modules can insert custom script at various points, to control the boot process.
dracut modules can insert custom script at various points, to control the boot
process.
These hooks are plain directories containing shell scripts ending with ".sh",
which are sourced by init.
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
=== Basic Setup
The first thing init does, is to mount _/proc_ and _/sys_ and manually create
the basic device nodes and symbolic links in _/dev_ needed to execute basic
commands. Then logging is setup according to kernel command line arguments.
_/dev/pts_ and _/dev/shm_ are mounted and the first hook is sourced.
=== Hook: cmdline
The _cmdline_ hook is a place to insert scripts to parse the kernel command line
@@ -813,63 +800,49 @@ This hook is executed right after the cmdline hook and a check if root and
rootok were set. Here modules can take action with the final root, and before
udev has been run.
=== Start Udev
Now udev is started and the logging for udev is setup.
=== Hook: pre-trigger
In this hook, you can set udev environment variables with **udevadm control
--property=KEY=_value_** or control the further execution of udev with
udevadm.
=== Trigger Udev
udev is triggered by calling udevadm trigger, which sends add events for all
devices and subsystems.
=== Main Loop
Now the main loop of 99base/init begins. Here we loop until udev has settled and
all scripts in _initqueue/finished_ returned true. In this loop there are three
hooks, where scripts can be inserted by calling /sbin/initqueue.
In the main loop of dracut loops until udev has settled and
all scripts in _initqueue/finished_ returned true.
In this loop there are three hooks, where scripts can be inserted
by calling /sbin/initqueue.
==== Initqueue
This hook gets executed every time a script is inserted here, regardless of the
udev state.
==== Initqueue settled
This hooks gets executed every time udev has settled.
This hooks (initqueue/settled) gets executed every time udev has settled.
==== Initqueue timeout
This hooks gets executed, when the main loop counter becomes half of the
This hooks (initqueue/timeout) gets executed, when the main loop counter becomes half of the
rd.retry counter.
==== Initqueue finished
This hook is called after udev has settled and if all scripts herein return 0
the main loop will be ended.
This hook (initqueue/finished) is called after udev has settled and
if all scripts herein return 0 the main loop will be ended.
Abritary scripts can be added here, to loop in the
initqueue until something happens, which a dracut module wants to wait for.
=== Hook: pre-mount
@@ -877,20 +850,15 @@ Before the root device is mounted all scripts in the hook pre-mount are
executed. In some cases (e.g. NFS) the real root device is already mounted,
though.
=== Hook: mount
This hook is mainly to mount the real root device.
=== Hook: pre-pivot
This hook is called before cleanup hook, This is a good place for
actions other than cleanups which need to be called before pivot.
=== Hook: cleanup
This hook is the last hook and is called before init finally switches root to
@@ -900,21 +868,18 @@ needed anymore.
=== Cleanup and switch_root
Init kills all udev processes, cleans up the environment, sets up the arguments
for the real init process and finally calls switch_root. switch_root removes the
whole filesystem hierarchy of the initramfs, chroot()s to the real root device
and calls /sbin/init with the specified arguments.
Init (or systemd) kills all udev processes, cleans up the environment,
sets up the arguments for the real init process and finally calls switch_root.
switch_root removes the whole filesystem hierarchy of the initramfs,
chroot()s to the real root device and calls /sbin/init with the specified arguments.
To ensure all files in the initramfs hierarchy can be removed, all processes
still running from the initramfs should not have any open file descriptors left.
== Network Infrastructure
FIXME
== Writing a Module
A simple example module is _96insmodpost_, which modprobes a kernel module after
@@ -926,8 +891,6 @@ First we create a check() function, which just exits with 0 indicating that this
module should be included by default.
check():
----
return 0
----
@@ -937,8 +900,6 @@ priority number 20 called _parse-insmodpost.sh_. It also installs the
_insmodpost.sh_ script in _/sbin_.
install():
----
inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
@@ -949,8 +910,6 @@ rd.driver.post, blacklists the module from being autoloaded and installs the
hook _insmodpost.sh_ in the _initqueue/settled_.
_parse-insmodpost.sh_:
----
for p in $(getargs rd.driver.post=); do
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
@@ -967,8 +926,6 @@ modprobe the kernel modules specified in all rd.driver.post kernel command line
parameters. It runs after udev has settled and is only called once (--onetime).
_insmodpost.sh_:
----
. /lib/dracut-lib.sh
@@ -1010,7 +967,7 @@ depends on.
=== install()
dracut_install
inst_multiple
inst

View File

@@ -121,17 +121,13 @@ Misc
specify the controlling terminal for the console.
This is useful, if you have multiple "console=" arguments.
**rd.action_on_fail=**_{shell|continue}_::
Specify the action after failure. By default it's emergency_shell.
'continue' means: ignore the current failure and go ahead.
[[dracutkerneldebug]]
Debug
~~~~~
If you are dropped to an emergency shell, the file _/run/initramfs/sosreport.txt_ is created,
If you are dropped to an emergency shell, the file _/run/initramfs/rdsosreport.txt_ is created,
which can be safed 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/sosreport.txt_ contains all logs and the output of some tools.
_/run/initramfs/rdsosreport.txt_ contains all logs and the output of some tools.
It should be attached to any report about dracut problems.
**rd.info**::

View File

@@ -71,6 +71,11 @@ 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.
*persistent_policy=*"__<policy>__"::
Use _<policy>_ to address disks and partitions.
_<policy>_ can be any directory name found in /dev/disk.
E.g. "by-uuid", "by-label"
*tmpdir=*"__<temporary directory>__"::
Specify temporary directory to use.
@@ -105,7 +110,7 @@ If chrooted to another root other than the real root device, use --fstab and pro
*nofscks=*"__{yes|no}__"::
If specified, inhibit installation of any fsck tools.
*ro_mnt*
*ro_mnt=*"__{yes|no}__"::
Mount _/_ and _/usr_ read-only by default.
*kernel_cmdline=*"__parameters__"::
@@ -117,6 +122,9 @@ If chrooted to another root other than the real root device, use --fstab and pro
*no_kernel=*"{yes|no}"::
Do not install kernel drivers and firmware files (default=no)
*early_microcode=*"{yes|no}"::
Combine early microcode with ramdisk (default=no)
*stdloglvl*="__\{0-6\}__"::
Set logging to standard error level.

View File

@@ -2,16 +2,13 @@
# i18n
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
omit_drivers+=' .*/fs/ocfs/.* i2o_scsi'
i18n_default_font="latarcyrheb-sun16"
stdloglvl=3
logfile=/var/log/dracut.log
fileloglvl=6
sysloglvl=5
install_items+=" vi /etc/virc ps grep cat rm "
prefix="/"
systemdutildir=/usr/lib/systemd
systemdsystemunitdir=/usr/lib/systemd/system
systemdsystemconfdir=/etc/systemd/system
udevdir=/usr/lib/udev
add_dracutmodules+=" systemd "
hostonly="yes"
dracut_rescue_image="yes"

View File

@@ -10,5 +10,6 @@ ro_mnt=yes
# i18n
i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE"
i18n_default_font="LatArCyrHeb-16"
omit_drivers+=" i2o_scsi"

429
dracut.sh
View File

@@ -91,6 +91,9 @@ Creates initial ramdisk images for preloading modules
firmwares, separated by :
--kernel-only Only install kernel drivers and firmware files
--no-kernel Do not install kernel drivers and firmware files
--print-cmdline Print the kernel command line for the given disk layout
--early-microcode Combine early microcode with ramdisk
--no-early-microcode Do not combine early microcode with ramdisk
--kernel-cmdline [PARAMETERS] Specify default kernel command line parameters
--strip Strip binaries in the initramfs
--nostrip Do not strip binaries in the initramfs
@@ -129,8 +132,12 @@ Creates initial ramdisk images for preloading modules
/usr/lib/dracut/modules.d.
Useful when running dracut from a git checkout.
-H, --hostonly Host-Only mode: Install only what is needed for
booting the local host instead of a generic host.
booting the local host instead of a generic host.
-N, --no-hostonly Disables Host-Only mode
--persistent-policy [POLICY]
Use [POLICY] to address disks and partitions.
POLICY can be any directory name found in /dev/disk.
E.g. "by-uuid", "by-label"
--fstab Use /etc/fstab to determine the root device.
--add-fstab [FILE] Add file to the initramfs fstab
--mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
@@ -213,7 +220,7 @@ pop() {
if [[ "$__resultvar" ]]; then
eval $__resultvar="'$_value'"
else
echo "$_value"
printf "%s" "$_value"
fi
eval unset ${__stack}'[${#'${__stack}'[@]}-1]'
return 0
@@ -237,28 +244,30 @@ read_arg() {
fi
}
dropindirs_sort()
{
suffix=$1; shift
args=("$@")
files=$(
while (( $# > 0 )); do
for i in ${1}/*${suffix}; do
[[ -f $i ]] && echo ${i##*/}
done
shift
done | sort -Vu
)
local suffix=$1; shift
local -a files
local f d
for f in $files; do
for d in "${args[@]}"; do
if [[ -f "$d/$f" ]]; then
echo "$d/$f"
continue 2
for d in "$@"; do
for i in "$d/"*"$suffix"; do
if [[ -e "$i" ]]; then
printf "%s\n" "${i##*/}"
fi
done
done
done | sort -Vu | {
readarray -t files
for f in "${files[@]}"; do
for d in "$@"; do
if [[ -e "$d/$f" ]]; then
printf "%s\n" "$d/$f"
continue 2
fi
done
done
}
}
verbosity_mod_l=0
@@ -302,6 +311,7 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
--long force \
--long kernel-only \
--long no-kernel \
--long print-cmdline \
--long kernel-cmdline: \
--long strip \
--long nostrip \
@@ -322,6 +332,7 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
--long host-only \
--long no-hostonly \
--long no-host-only \
--long persistent-policy: \
--long fstab \
--long help \
--long bzip2 \
@@ -335,6 +346,8 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
--long printsize \
--long regenerate-all \
--long noimageifnotneeded \
--long early-microcode \
--long no-early-microcode \
-- "$@")
if (( $? != 0 )); then
@@ -376,6 +389,9 @@ while :; do
-f|--force) force=yes;;
--kernel-only) kernel_only="yes"; no_kernel="no";;
--no-kernel) kernel_only="no"; no_kernel="yes";;
--print-cmdline) print_cmdline="yes"; hostonly_l="yes"; kernel_only="yes"; no_kernel="yes";;
--early-microcode) early_microcode_l="yes";;
--no-early-microcode) early_microcode_l="no";;
--strip) do_strip_l="yes";;
--nostrip) do_strip_l="no";;
--hardlink) do_hardlink_l="yes";;
@@ -392,13 +408,15 @@ while :; do
-q|--quiet) ((verbosity_mod_l--));;
-l|--local)
allowlocal="yes"
[[ -f "$(readlink -f ${0%/*})/dracut-functions.sh" ]] \
&& dracutbasedir="$(readlink -f ${0%/*})"
[[ -f "$(readlink -f "${0%/*}")/dracut-functions.sh" ]] \
&& dracutbasedir="$(readlink -f "${0%/*}")"
;;
-H|--hostonly|--host-only)
hostonly_l="yes" ;;
-N|--no-hostonly|--no-host-only)
hostonly_l="no" ;;
--persistent-policy)
persistent_policy_l="$2"; shift;;
--fstab) use_fstab_l="yes" ;;
-h|--help) long_usage; exit 1 ;;
-i|--include) push include_src "$2"
@@ -450,12 +468,12 @@ done
if [[ $regenerate_all == "yes" ]]; then
ret=0
if [[ $kernel ]]; then
echo "--regenerate-all cannot be called with a kernel version" >&2
printf -- "--regenerate-all cannot be called with a kernel version\n" >&2
exit 1
fi
if [[ $outfile ]]; then
echo "--regenerate-all cannot be called with a image file" >&2
printf -- "--regenerate-all cannot be called with a image file\n" >&2
exit 1
fi
@@ -468,10 +486,15 @@ if [[ $regenerate_all == "yes" ]]; then
cd /lib/modules
for i in *; do
[[ -f $i/modules.builtin ]] || continue
dracut --kver=$i "${dracut_args[@]}"
dracut --kver="$i" "${dracut_args[@]}"
((ret+=$?))
done
exit $ret
elif [[ $kernel ]]; then
if ! [[ -d /lib/modules/$kernel ]] && [[ $no_kernel != yes ]]; then
printf -- "Kernel version $kernel has no modules in /lib/modules/$kernel\n" >&2
exit 1
fi
fi
if ! [[ $kernel ]]; then
@@ -498,6 +521,10 @@ for i in /usr/sbin /sbin /usr/bin /bin; do
fi
done
export PATH="${NPATH#:}"
unset LC_MESSAGES
unset LC_CTYPE
export LC_ALL=C
export LANG=C
unset NPATH
unset LD_LIBRARY_PATH
unset GREP_OPTIONS
@@ -519,13 +546,19 @@ export DRACUT_LOG_LEVEL=warning
# if we were not passed a config file, try the default one
if [[ ! -f $conffile ]]; then
[[ $allowlocal ]] && conffile="$dracutbasedir/dracut.conf" || \
if [[ $allowlocal ]]; then
conffile="$dracutbasedir/dracut.conf"
else
conffile="/etc/dracut.conf"
fi
fi
if [[ ! -d $confdir ]]; then
[[ $allowlocal ]] && confdir="$dracutbasedir/dracut.conf.d" || \
if [[ $allowlocal ]]; then
confdir="$dracutbasedir/dracut.conf.d"
else
confdir="/etc/dracut.conf.d"
fi
fi
# source our config file
@@ -623,6 +656,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $prefix_l ]] && prefix=$prefix_l
[[ $prefix = "/" ]] && unset prefix
[[ $hostonly_l ]] && hostonly=$hostonly_l
[[ $persistent_policy_l ]] && persistent_policy=$persistent_policy_l
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
@@ -634,6 +668,8 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $show_modules_l ]] && show_modules=$show_modules_l
[[ $nofscks_l ]] && nofscks="yes"
[[ $ro_mnt_l ]] && ro_mnt="yes"
[[ $early_microcode_l ]] && early_microcode=$early_microcode_l
[[ $early_microcode ]] || early_microcode=no
# eliminate IFS hackery when messing with fw_dir
fw_dir=${fw_dir//:/ }
@@ -643,8 +679,7 @@ case $compress in
bzip2) compress="bzip2 -9";;
lzma) compress="lzma -9";;
xz) compress="xz --check=crc32 --lzma2=dict=1MiB";;
gzip) command -v pigz > /dev/null 2>&1 && compress="pigz -9" || \
compress="gzip -9";;
gzip) compress="gzip -9"; command -v pigz > /dev/null 2>&1 && compress="pigz -9";;
esac
if [[ $_no_compress_l = "cat" ]]; then
compress="cat"
@@ -654,14 +689,29 @@ fi
[[ $hostonly != "-h" ]] && unset hostonly
readonly TMPDIR="$tmpdir"
readonly initdir=$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)
readonly initdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)"
[ -d "$initdir" ] || {
echo "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t initramfs.XXXXXX failed." >&2
printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t initramfs.XXXXXX failed." >&2
exit 1
}
if [[ $early_microcode = yes ]]; then
readonly microcode_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_microcode.XXXXXX)"
[ -d "$microcode_dir" ] || {
printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t early_microcode.XXXXXX failed." >&2
exit 1
}
fi
# clean up after ourselves no matter how we die.
trap 'ret=$?;[[ $outfile ]] && [[ -f $outfile.$$ ]] && rm -f "$outfile.$$";[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf "$initdir";exit $ret; };' EXIT
trap '
ret=$?;
[[ $outfile ]] && [[ -f $outfile.$$ ]] && rm -f -- "$outfile.$$";
[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf -- "$initdir"; };
[[ $keep ]] && echo "Not removing $microcode_dir." >&2 || { [[ $microcode_dir ]] && rm -Rf -- "$microcode_dir"; };
[[ $_dlogdir ]] && rm -Rf -- "$_dlogdir";
exit $ret;
' EXIT
# clean up after ourselves no matter how we die.
trap 'exit 1;' SIGINT
@@ -671,27 +721,28 @@ export DRACUT_RESOLVE_LAZY="1"
if [[ -f $dracutbasedir/dracut-functions.sh ]]; then
. $dracutbasedir/dracut-functions.sh
else
echo "dracut: Cannot find $dracutbasedir/dracut-functions.sh." >&2
echo "dracut: Are you running from a git checkout?" >&2
echo "dracut: Try passing -l as an argument to $0" >&2
printf "%s\n" "dracut: Cannot find $dracutbasedir/dracut-functions.sh." >&2
printf "%s\n" "dracut: Are you running from a git checkout?" >&2
printf "%s\n" "dracut: Try passing -l as an argument to $0" >&2
exit 1
fi
inst /bin/sh
if ! $DRACUT_INSTALL ${initdir+-D "$initdir"} -R "$initdir/bin/sh" &>/dev/null; then
unset DRACUT_RESOLVE_LAZY
export DRACUT_RESOLVE_DEPS=1
if ! [[ $print_cmdline ]]; then
inst /bin/sh
if ! $DRACUT_INSTALL ${initdir+-D "$initdir"} -R "$initdir/bin/sh" &>/dev/null; then
unset DRACUT_RESOLVE_LAZY
export DRACUT_RESOLVE_DEPS=1
fi
rm -fr -- ${initdir}/*
fi
rm -fr ${initdir}/*
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
. $dracutbasedir/dracut-version.sh
fi
# Verify bash version, current minimum is 3.1
if (( ${BASH_VERSINFO[0]} < 3 ||
( ${BASH_VERSINFO[0]} == 3 && ${BASH_VERSINFO[1]} < 1 ) )); then
dfatal 'You need at least Bash 3.1 to use dracut, sorry.'
if (( BASH_VERSINFO[0] < 4 )); then
dfatal 'You need at least Bash 4 to use dracut, sorry.'
exit 1
fi
@@ -728,7 +779,7 @@ fi
omit_drivers_corrected=""
for d in $omit_drivers; do
strstr " $drivers $add_drivers " " $d " && continue
[[ " $drivers $add_drivers " == *\ $d\ * ]] && continue
omit_drivers_corrected+="$d|"
done
omit_drivers="${omit_drivers_corrected%|}"
@@ -736,18 +787,18 @@ unset omit_drivers_corrected
# prepare args for logging
for ((i=0; i < ${#dracut_args[@]}; i++)); do
strstr "${dracut_args[$i]}" " " && \
[[ "${dracut_args[$i]}" == *\ * ]] && \
dracut_args[$i]="\"${dracut_args[$i]}\""
#" keep vim happy
done
ddebug "Executing: $0 ${dracut_args[@]}"
dinfo "Executing: $0 ${dracut_args[@]}"
[[ $do_list = yes ]] && {
for mod in $dracutbasedir/modules.d/*; do
[[ -d $mod ]] || continue;
[[ -e $mod/install || -e $mod/installkernel || \
-e $mod/module-setup.sh ]] || continue
echo ${mod##*/??}
printf "%s\n" "${mod##*/??}"
done
exit 0
}
@@ -765,7 +816,7 @@ if [[ -d $srcmods ]]; then
}
fi
if [[ -f $outfile && ! $force ]]; then
if [[ -f $outfile && ! $force && ! $print_cmdline ]]; then
dfatal "Will not override existing initramfs ($outfile) without --force"
exit 1
fi
@@ -789,15 +840,11 @@ chmod 755 "$initdir"
if [[ $hostonly ]]; then
for i in /sys /proc /run /dev; do
if ! findmnt "$i" &>/dev/null; then
if ! findmnt --target "$i" &>/dev/null; then
dwarning "Turning off host-only mode: '$i' is not mounted!"
unset hostonly
fi
done
if ! [[ -d /run/udev/data ]]; then
dwarning "Turning off host-only mode: udev database not found!"
unset hostonly
fi
fi
declare -A host_fs_types
@@ -810,22 +857,23 @@ for line in "${fstab_lines[@]}"; do
done
for f in $add_fstab; do
[ -e $f ] || continue
[[ -e $f ]] || continue
while read dev rest; do
push host_devs $dev
done < $f
push host_devs "$dev"
done < "$f"
done
for dev in $add_device; do
push host_devs "$dev"
done
if (( ${#add_device_l[@]} )); then
while pop add_device_l val; do
add_device+=" $val "
push host_devs "$val"
done
fi
for dev in $add_device; do
push host_devs $dev
done
if [[ $hostonly ]]; then
# in hostonly mode, determine all devices, which have to be accessed
# and examine them for filesystem types
@@ -833,6 +881,10 @@ if [[ $hostonly ]]; then
for mp in \
"/" \
"/etc" \
"/bin" \
"/sbin" \
"/lib" \
"/lib64" \
"/usr" \
"/usr/bin" \
"/usr/sbin" \
@@ -840,64 +892,88 @@ if [[ $hostonly ]]; then
"/usr/lib64" \
"/boot";
do
mp=$(readlink -f "$mp")
mountpoint "$mp" >/dev/null 2>&1 || continue
push host_devs $(readlink -f "/dev/block/$(find_block_device "$mp")")
_dev=$(find_block_device "$mp")
_bdev=$(readlink -f "/dev/block/$_dev")
[[ -b $_bdev ]] && _dev=$_bdev
push host_devs $_dev
[[ "$_mp" == "/" ]] && root_dev="$_dev"
push host_devs "$_dev"
done
while read dev type rest; do
[[ -b $dev ]] || continue
[[ "$type" == "partition" ]] || continue
while read _d _m _t _o _r; do
[[ "$_d" == \#* ]] && continue
[[ $_d ]] || continue
[[ $_t != "swap" ]] || [[ $_m != "swap" ]] && continue
[[ "$_o" == *noauto* ]] && continue
[[ "$_d" == UUID\=* ]] && _d="/dev/disk/by-uuid/${_d#UUID=}"
[[ "$_d" == LABEL\=* ]] && _d="/dev/disk/by-label/$_d#LABEL=}"
[[ "$_d" -ef "$dev" ]] || continue
if [[ -f /proc/swaps ]] && [[ -f /etc/fstab ]]; then
while read dev type rest; do
[[ -b $dev ]] || continue
[[ "$type" == "partition" ]] || continue
while read _mapper _a _p _o; do
[[ $_mapper = \#* ]] && continue
[[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
[[ "$_o" ]] || _o="$_p"
# skip mkswap swap
[[ $_o == *swap* ]] && continue 2
done < /etc/crypttab
while read _d _m _t _o _r; do
[[ "$_d" == \#* ]] && continue
[[ $_d ]] || continue
[[ $_t != "swap" ]] && continue
[[ $_m != "swap" ]] && [[ $_m != "none" ]] && continue
[[ "$_o" == *noauto* ]] && continue
[[ "$_d" == UUID\=* ]] && _d="/dev/disk/by-uuid/${_d#UUID=}"
[[ "$_d" == LABEL\=* ]] && _d="/dev/disk/by-label/$_d#LABEL=}"
[[ "$_d" -ef "$dev" ]] || continue
push host_devs $(readlink -f $dev)
break
done < /etc/fstab
done < /proc/swaps
if [[ -f /etc/crypttab ]]; then
while read _mapper _a _p _o; do
[[ $_mapper = \#* ]] && continue
[[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
[[ "$_o" ]] || _o="$_p"
# skip mkswap swap
[[ $_o == *swap* ]] && continue 2
done < /etc/crypttab
fi
push host_devs "$(readlink -f "$dev")"
break
done < /etc/fstab
done < /proc/swaps
fi
fi
_get_fs_type() (
_get_fs_type() {
[[ $1 ]] || return
if [[ -b $1 ]] && get_fs_env $1; then
echo "$(readlink -f $1) $ID_FS_TYPE"
if [[ -b /dev/block/$1 ]] && ID_FS_TYPE=$(get_fs_env "/dev/block/$1"); then
host_fs_types["$(readlink -f "/dev/block/$1")"]="$ID_FS_TYPE"
return 1
fi
if [[ -b /dev/block/$1 ]] && get_fs_env /dev/block/$1; then
echo "$(readlink -f /dev/block/$1) $ID_FS_TYPE"
if [[ -b $1 ]] && ID_FS_TYPE=$(get_fs_env "$1"); then
host_fs_types["$(readlink -f "$1")"]="$ID_FS_TYPE"
return 1
fi
if fstype=$(find_dev_fstype $1); then
echo "$1 $fstype"
if fstype=$(find_dev_fstype "$1"); then
host_fs_types["$1"]="$fstype"
return 1
fi
return 1
)
}
for dev in "${host_devs[@]}"; do
while read key val; do
host_fs_types["$key"]="$val"
done < <(
_get_fs_type $dev
check_block_and_slaves_all _get_fs_type $(get_maj_min $dev)
)
for dev in ${host_devs[@]}; do
_get_fs_type "$dev"
check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
done
for dev in "${!host_fs_types[@]}"; do
[[ ${host_fs_types[$dev]} = "reiserfs" ]] || [[ ${host_fs_types[$dev]} = "xfs" ]] || continue
rootopts=$(find_dev_fsopts "$dev")
if [[ ${host_fs_types[$dev]} = "reiserfs" ]]; then
journaldev=$(fs_get_option $rootopts "jdev")
elif [[ ${host_fs_types[$dev]} = "xfs" ]]; then
journaldev=$(fs_get_option $rootopts "logdev")
fi
if [[ $journaldev ]]; then
dev="$(readlink -f "$dev")"
push host_devs "$dev"
_get_fs_type "$dev"
check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
fi
done
[[ -d $udevdir ]] \
|| udevdir=$(pkg-config udev --variable=udevdir 2>/dev/null)
|| udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
if ! [[ -d "$udevdir" ]]; then
[[ -d /lib/udev ]] && udevdir=/lib/udev
[[ -d /usr/lib/udev ]] && udevdir=/usr/lib/udev
@@ -923,13 +999,33 @@ fi
export initdir dracutbasedir dracutmodules \
fw_dir drivers_dir debug no_kernel kernel_only \
omit_drivers mdadmconf lvmconf \
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 \
DRACUT_VERSION udevdir prefix filesystems drivers \
systemdutildir systemdsystemunitdir systemdsystemconfdir
mods_to_load=""
# check all our modules to see if they should be sourced.
# This builds a list of modules that we will install next.
for_each_module_dir check_module
for_each_module_dir check_mount
dracut_module_included "fips" && export DRACUT_FIPS_MODE=1
if [[ $print_cmdline ]]; then
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]}
module_cmdline "$_d_mod"
done
unset moddir
printf "\n"
exit 0
fi
# Create some directory structure first
[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
@@ -938,7 +1034,7 @@ export initdir dracutbasedir dracutmodules \
if [[ $prefix ]]; then
for d in bin etc lib sbin tmp usr var $libdirs; do
strstr "$d" "/" && continue
[[ "$d" == */* ]] && continue
ln -sfn "${prefix#/}/${d#/}" "$initdir/$d"
done
fi
@@ -987,31 +1083,26 @@ if [[ $kernel_only != yes ]]; then
fi
fi
mods_to_load=""
# check all our modules to see if they should be sourced.
# This builds a list of modules that we will install next.
for_each_module_dir check_module
for_each_module_dir check_mount
strstr "$mods_to_load" "fips" && export DRACUT_FIPS_MODE=1
_isize=0 #initramfs size
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 strstr "$mods_to_load" " $_d_mod "; then
[[ $show_modules = yes ]] && echo "$_d_mod" || \
if [[ "$mods_to_load" == *\ $_d_mod\ * ]]; then
if [[ $show_modules = yes ]]; then
printf "%s\n" "$_d_mod"
else
dinfo "*** Including module: $_d_mod ***"
if [[ $kernel_only = yes ]]; then
module_installkernel $_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
module_install "$_d_mod"
if [[ $no_kernel != yes ]]; then
module_installkernel $_d_mod || {
module_installkernel "$_d_mod" || {
dfatal "installkernel failed in module $_d_mod"
exit 1
}
@@ -1023,8 +1114,8 @@ for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
#print the module install size
if [ -n "$printsize" ]; then
_isize_new=$(du -sk ${initdir}|cut -f1)
_isize_delta=$(($_isize_new - $_isize))
echo "$_d_mod install size: ${_isize_delta}k"
_isize_delta=$((_isize_new - _isize))
printf "%s\n" "$_d_mod install size: ${_isize_delta}k"
_isize=$_isize_new
fi
fi
@@ -1033,7 +1124,7 @@ unset moddir
for i in $modules_loaded; do
mkdir -p $initdir/lib/dracut
echo "$i" >> $initdir/lib/dracut/modules.txt
printf "%s\n" "$i" >> $initdir/lib/dracut/modules.txt
done
dinfo "*** Including modules done ***"
@@ -1068,24 +1159,24 @@ if [[ $no_kernel != yes ]]; then
fi
if [[ $kernel_only != yes ]]; then
(( ${#install_items[@]} > 0 )) && dracut_install ${install_items[@]}
(( ${#install_items[@]} > 0 )) && inst_multiple ${install_items[@]}
[[ $kernel_cmdline ]] && echo "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
[[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
while pop fstab_lines line; do
echo "$line 0 0" >> "${initdir}/etc/fstab"
printf "%s\n" "$line 0 0" >> "${initdir}/etc/fstab"
done
for f in $add_fstab; do
cat $f >> "${initdir}/etc/fstab"
cat "$f" >> "${initdir}/etc/fstab"
done
if [ -d ${initdir}/$systemdutildir ]; then
mkdir -p ${initdir}/etc/conf.d
{
echo "systemdutildir=\"$systemdutildir\""
echo "systemdsystemunitdir=\"$systemdsystemunitdir\""
echo "systemdsystemconfdir=\"$systemdsystemconfdir\""
printf "%s\n" "systemdutildir=\"$systemdutildir\""
printf "%s\n" "systemdsystemunitdir=\"$systemdsystemunitdir\""
printf "%s\n" "systemdsystemconfdir=\"$systemdsystemconfdir\""
} > ${initdir}/etc/conf.d/systemd.conf
fi
@@ -1094,7 +1185,7 @@ if [[ $kernel_only != yes ]]; then
find "$initdir" -type f \
'(' -perm -0100 -or -perm -0010 -or -perm -0001 ')' \
-not -path '*.ko' -print0 \
| xargs -r -0 $DRACUT_INSTALL ${initdir+-D "$initdir"} -R ${DRACUT_FIPS_MODE+-H}
| xargs -r -0 $DRACUT_INSTALL ${initdir+-D "$initdir"} -R ${DRACUT_FIPS_MODE+-H} --
dinfo "*** Resolving executable dependencies done***"
fi
fi
@@ -1139,22 +1230,17 @@ if [[ $kernel_only != yes ]]; then
fi
fi
if (($maxloglvl >= 5)); then
ddebug "Listing sizes of included files:"
du -c "$initdir" | sort -n | ddebug
fi
PRELINK_BIN=$(command -v prelink)
PRELINK_BIN="$(command -v prelink)"
if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
if [[ $DRACUT_FIPS_MODE ]]; then
dinfo "*** Installing prelink files ***"
dracut_install -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
else
dinfo "*** Pre-linking files ***"
dracut_install -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
chroot "$initdir" $PRELINK_BIN -a
rm -f "$initdir"/$PRELINK_BIN
rm -fr "$initdir"/etc/prelink.*
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
chroot "$initdir" "$PRELINK_BIN" -a
rm -f -- "$initdir/$PRELINK_BIN"
rm -fr -- "$initdir"/etc/prelink.*
dinfo "*** Pre-linking files done ***"
fi
fi
@@ -1175,47 +1261,68 @@ if [[ $do_strip = yes ]] ; then
done
fi
if [[ $do_strip = yes ]] ; then
if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
dinfo "*** Stripping files ***"
if [[ $DRACUT_FIPS_MODE ]]; then
find "$initdir" -type f \
-executable -not -path '*/lib/modules/*.ko' -print0 \
| while read -r -d $'\0' f; do
if ! [[ -e "${f%/*}/.${f##*/}.hmac" ]] \
&& ! [[ -e "/lib/hmaccalc/${f##*/}.hmac" ]] \
&& ! [[ -e "/lib64/hmaccalc/${f##*/}.hmac" ]] \
&& ! [[ -e "/lib/fipscheck/${f##*/}.hmac" ]] \
&& ! [[ -e "/lib64/fipscheck/${f##*/}.hmac" ]]; then
echo -n "$f"; echo -n -e "\000"
fi
done | xargs -r -0 strip -g 2>/dev/null
else
find "$initdir" -type f \
-executable -not -path '*/lib/modules/*.ko' -print0 \
| xargs -r -0 strip -g 2>/dev/null
fi
find "$initdir" -type f \
-executable -not -path '*/lib/modules/*.ko' -print0 \
| xargs -r -0 strip -g 2>/dev/null
# strip kernel modules, but do not touch signed modules
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
| while read -r -d $'\0' f; do
SIG=$(tail -c 28 "$f")
[[ $SIG == '~Module signature appended~' ]] || { echo -n "$f"; echo -n -e "\000"; }
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
done | xargs -r -0 strip -g
dinfo "*** Stripping files done ***"
fi
if [[ $early_microcode = yes ]]; then
dinfo "*** Generating early-microcode cpio image ***"
ucode_dir=(amd-ucode intel-ucode)
ucode_dest=(AuthenticAMD.bin GenuineIntel.bin)
_dest_dir="$microcode_dir/d/kernel/x86/microcode"
_dest_idx="0 1"
mkdir -p $_dest_dir
if [[ $hostonly ]]; then
[[ $(get_cpu_vendor) == "AMD" ]] && _dest_idx="0"
[[ $(get_cpu_vendor) == "Intel" ]] && _dest_idx="1"
fi
for idx in $_dest_idx; do
_fw=${ucode_dir[$idx]}
for _fwdir in $fw_dir; do
if [[ -d $_fwdir && -d $_fwdir/$_fw ]]; then
_src="*"
dinfo "*** Constructing ${ucode_dest[$idx]} ****"
if [[ $hostonly ]]; then
_src=$(get_ucode_file)
fi
cat $_fwdir/$_fw/$_src > $_dest_dir/${ucode_dest[$idx]}
fi
done
done
(cd "$microcode_dir/d"; find . -print0 | cpio --null -o -H newc --quiet >../ucode.cpio)
fi
rm -f "$outfile"
rm -f -- "$outfile"
dinfo "*** Creating image file ***"
if ! ( umask 077; cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
$compress > "$outfile.$$"; ); then
if [[ $early_microcode = yes ]]; then
# The microcode blob is _before_ the initramfs blob, not after
mv $microcode_dir/ucode.cpio $outfile.$$
fi
if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null -R 0:0 -H newc -o --quiet| \
$compress >> "$outfile.$$"; ); then
dfatal "dracut: creation of $outfile.$$ failed"
exit 1
fi
mv $outfile.$$ $outfile
mv -- "$outfile.$$" "$outfile"
dinfo "*** Creating image file done ***"
dinfo "Wrote $outfile:"
dinfo "$(ls -l "$outfile")"
if (( maxloglvl >= 5 )); then
if [[ $allowlocal ]]; then
"$dracutbasedir/lsinitrd.sh" "$outfile"| ddebug
else
lsinitrd "$outfile"| ddebug
fi
fi
exit 0

View File

@@ -21,8 +21,8 @@ Group: System/Base
%endif
# The entire source code is GPLv2+
# except install/* which is LGPLv2.1+
License: GPLv2+ and LGPLv2.1+
# except install/* which is LGPLv2+
License: GPLv2+ and LGPLv2+
URL: https://dracut.wiki.kernel.org/
@@ -30,7 +30,7 @@ URL: https://dracut.wiki.kernel.org/
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
BuildRequires: dash bash git
BuildRequires: bash git
%if 0%{?fedora} || 0%{?rhel}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -76,6 +76,10 @@ Provides: mkinitrd = 2.6.1
Obsoletes: dracut-kernel < 005
Provides: dracut-kernel = %{version}-%{release}
Obsoletes: dracut <= 029
Obsoletes: dracut-norescue
Provides: dracut-norescue
Requires: bash >= 4
Requires: coreutils
Requires: cpio
@@ -91,6 +95,7 @@ Requires: kpartx
%if 0%{?fedora} || 0%{?rhel} > 6
Requires: util-linux >= 2.21
Requires: systemd >= 199
Requires: procps-ng
Conflicts: grubby < 8.23
%else
Requires: udev > 166
@@ -116,6 +121,7 @@ Summary: dracut modules to build a dracut initramfs with network support
Requires: %{name} = %{version}-%{release}
Requires: iputils
Requires: iproute
Requires: dhclient
Obsoletes: dracut-generic < 008
Provides: dracut-generic = %{version}-%{release}
@@ -158,20 +164,23 @@ Requires: libcap
This package requires everything which is needed to build an
initramfs with dracut, which drops capabilities.
%package nohostonly
%package config-generic
Summary: dracut configuration to turn off hostonly image generation
Requires: %{name} = %{version}-%{release}
Obsoletes: dracut-nohostonly
Provides: dracut-nohostonly
%description nohostonly
%description config-generic
This package provides the configuration to turn off the host specific initramfs
generation with dracut.
generation with dracut and generates a generic image by default.
%package norescue
Summary: dracut configuration to turn off rescue image generation
%package config-rescue
Summary: dracut configuration to turn on rescue image generation
Requires: %{name} = %{version}-%{release}
Obsoletes: dracut <= 029
%description norescue
This package provides the configuration to turn off the rescue initramfs
%description config-rescue
This package provides the configuration to turn on the rescue initramfs
generation with dracut.
%package tools
@@ -202,7 +211,7 @@ make %{?_smp_mflags}
%install
%if 0%{?fedora} || 0%{?rhel}
rm -rf $RPM_BUILD_ROOT
rm -rf -- $RPM_BUILD_ROOT
%endif
make %{?_smp_mflags} install \
DESTDIR=$RPM_BUILD_ROOT \
@@ -211,26 +220,26 @@ make %{?_smp_mflags} install \
echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh
%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} == 0
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
%endif
%if %{defined _unitdir}
# for systemd, better use systemd-bootchart
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00bootchart
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00bootchart
%endif
# we do not support dash in the initramfs
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
# remove gentoo specific modules
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
%if %{defined _unitdir}
# with systemd IMA and selinux modules do not make sense
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/96securityfs
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/97masterkey
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98integrity
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/96securityfs
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/97masterkey
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98integrity
%endif
mkdir -p $RPM_BUILD_ROOT/boot/dracut
@@ -249,8 +258,8 @@ install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}
%endif
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
rm $RPM_BUILD_ROOT%{_bindir}/mkinitrd
rm $RPM_BUILD_ROOT%{_bindir}/lsinitrd
rm -f -- $RPM_BUILD_ROOT%{_bindir}/mkinitrd
rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
%endif
%if 0%{?fedora} || 0%{?rhel} > 6
@@ -258,19 +267,16 @@ rm $RPM_BUILD_ROOT%{_bindir}/lsinitrd
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-nohostonly.conf
echo 'dracut_rescue_image="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-norescue.conf
echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf
%endif
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/dracut_log
# create compat symlink
mkdir -p $RPM_BUILD_ROOT/sbin
ln -s /usr/bin/dracut $RPM_BUILD_ROOT/sbin/dracut
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf -- $RPM_BUILD_ROOT
%files
%defattr(-,root,root,0755)
@@ -313,6 +319,8 @@ rm -rf $RPM_BUILD_ROOT
%else
%{dracutlibdir}/modules.d/00bootchart
%endif
%{dracutlibdir}/modules.d/00bash
%{dracutlibdir}/modules.d/03modsign
%{dracutlibdir}/modules.d/03rescue
%{dracutlibdir}/modules.d/04watchdog
%{dracutlibdir}/modules.d/05busybox
@@ -322,6 +330,7 @@ rm -rf $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/50drm
%{dracutlibdir}/modules.d/50plymouth
%{dracutlibdir}/modules.d/80cms
%{dracutlibdir}/modules.d/90bcache
%{dracutlibdir}/modules.d/90btrfs
%{dracutlibdir}/modules.d/90crypt
%{dracutlibdir}/modules.d/90dm
@@ -360,7 +369,6 @@ rm -rf $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/99fs-lib
%{dracutlibdir}/modules.d/99img-lib
%{dracutlibdir}/modules.d/99shutdown
%config(noreplace) %{_sysconfdir}/logrotate.d/dracut_log
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
%dir %{_sharedstatedir}/initramfs
%if %{defined _unitdir}
@@ -384,8 +392,6 @@ rm -rf $RPM_BUILD_ROOT
%endif
%if 0%{?fedora} || 0%{?rhel} > 6
%{_prefix}/lib/kernel/install.d/50-dracut.install
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
%endif
%files network
@@ -426,12 +432,16 @@ rm -rf $RPM_BUILD_ROOT
%dir /var/lib/dracut
%dir /var/lib/dracut/overlay
%files nohostonly
%files config-generic
%defattr(-,root,root,0755)
%{dracutlibdir}/dracut.conf.d/02-nohostonly.conf
%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
%files norescue
%files config-rescue
%defattr(-,root,root,0755)
%{dracutlibdir}/dracut.conf.d/02-norescue.conf
%{dracutlibdir}/dracut.conf.d/02-rescue.conf
%if 0%{?fedora} || 0%{?rhel} > 6
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
%endif
%changelog

View File

@@ -109,7 +109,7 @@ case $bin in
CAT="zcat";;
BZh*)
CAT="bzcat";;
070701)
$'\x71\xc7'*|070701)
CAT="cat";;
*)
CAT="xzcat";
@@ -126,7 +126,7 @@ if (( ${#filenames[@]} > 0 )); then
for f in ${!filenames[@]}; do
[[ $nofileinfo ]] || echo "initramfs:/$f"
[[ $nofileinfo ]] || echo "========================================================================"
$CAT $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
$CAT -- $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
((ret+=$?))
[[ $nofileinfo ]] || echo "========================================================================"
[[ $nofileinfo ]] || echo
@@ -134,16 +134,16 @@ if (( ${#filenames[@]} > 0 )); then
else
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
echo "========================================================================"
version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout '*lib/dracut/dracut-*' 2>/dev/null)
version=$($CAT -- "$image" | cpio --extract --verbose --quiet --to-stdout -- '*lib/dracut/dracut-*' 2>/dev/null)
((ret+=$?))
echo "$version with dracut modules:"
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout 'usr/lib/dracut/modules.txt' 2>/dev/null
$CAT -- "$image" | cpio --extract --verbose --quiet --to-stdout -- '*lib/dracut/modules.txt' 2>/dev/null
((ret+=$?))
echo "========================================================================"
if [ "$sorted" -eq 1 ]; then
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
$CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
else
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
$CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -k9
fi
((ret+=$?))
echo "========================================================================"

View File

@@ -0,0 +1,20 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
[ -x /bin/bash ]
}
depends() {
return 0
}
install() {
# If another shell is already installed, do not use bash
[[ -x $initdir/bin/sh ]] && return
# Prefer bash as /bin/sh if it is available.
inst /bin/bash && ln -sf bash "${initdir}/bin/sh"
}

View File

@@ -16,7 +16,7 @@ install() {
inst_symlink /init /sbin/init
inst_dir /lib/bootchart/tmpfs
dracut_install bootchartd bash \
inst_multiple bootchartd bash \
/lib/bootchart/bootchart-collector /etc/bootchartd.conf \
accton \
echo \

View File

@@ -14,5 +14,5 @@ depends() {
install() {
inst_symlink /init /sbin/init
dracut_install $systemdutildir/systemd-bootchart
inst_multiple $systemdutildir/systemd-bootchart
}

View File

@@ -3,7 +3,7 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
elif getarg boot= >/dev/null; then
. /sbin/fips.sh
if mount_boot; then

View File

@@ -3,7 +3,7 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
elif ! [ -f /tmp/fipsdone ]; then
. /sbin/fips.sh
mount_boot

View File

@@ -15,6 +15,12 @@ mount_boot()
UUID=*)
boot="/dev/disk/by-uuid/${boot#UUID=}"
;;
PARTUUID=*)
boot="/dev/disk/by-partuuid/${boot#PARTUUID=}"
;;
PARTLABEL=*)
boot="/dev/disk/by-partlabel/${boot#PARTLABEL=}"
;;
/dev/*)
;;
*)
@@ -44,13 +50,34 @@ mount_boot()
info "Mounting $boot as /boot"
mount -oro "$boot" /boot || return 1
elif [ -d "$NEWROOT/boot" ]; then
rm -fr /boot
rm -fr -- /boot
ln -sf "$NEWROOT/boot" /boot
fi
}
do_rhevh_check()
{
KERNEL=$(uname -r)
kpath=${1}
# If we're on RHEV-H, the kernel is in /dev/.initramfs/live/vmlinuz0
HMAC_SUM_ORIG=$(cat /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)
if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
warn "HMAC sum mismatch"
return 1
fi
info "rhevh_check OK"
return 0
}
do_fips()
{
local _v
local _s
local _v
local _module
KERNEL=$(uname -r)
if ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
@@ -61,17 +88,37 @@ do_fips()
FIPSMODULES=$(cat /etc/fipsmodules)
info "Loading and integrity checking all crypto modules"
for module in $FIPSMODULES; do
if [ "$module" != "tcrypt" ]; then
modprobe ${module}
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
for _module in $FIPSMODULES; do
if [ "$_module" != "tcrypt" ]; then
if ! modprobe "${_module}"; then
# check if kernel provides generic algo
_found=0
while read _k _s _v; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
[ "$_k" = "driver" ] && _v=$(str_replace "$_v" "_" "-")
[ "$_v" != "$_module" ] && continue
_found=1
break
done </proc/crypto
[ "$_found" = "0" ] && return 1
fi
fi
done
mv /etc/modprobe.d/fips.conf.bak /etc/modprobe.d/fips.conf
info "Self testing crypto algorithms"
modprobe tcrypt || return 1
rmmod tcrypt
info "Checking integrity of kernel"
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
if [ -e "$NEWROOT/dev/.initramfs/live/vmlinuz0" ]; then
do_rhevh_check "$NEWROOT/dev/.initramfs/live/vmlinuz0" || return 1
elif [ -e "$NEWROOT/dev/.initramfs/live/isolinux/vmlinuz0" ]; then
do_rhevh_check "$NEWROOT/dev/.initramfs/live/isolinux/vmlinuz0" || return 1
else
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
fi
info "All initrd crypto checks done"

View File

@@ -34,12 +34,12 @@ install() {
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
inst_script "$moddir/fips.sh" /sbin/fips.sh
dracut_install sha512hmac rmmod insmod mount uname umount fipscheck
inst_multiple sha512hmac rmmod insmod mount uname umount fipscheck
inst_libdir_file libsoftokn3.so libsoftokn3.so \
libsoftokn3.chk libfreebl3.so libfreebl3.chk \
libssl.so 'hmaccalc/sha512hmac.hmac' libssl.so.10
dracut_install -o prelink
inst_multiple -o prelink
}

View File

@@ -0,0 +1,13 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Licensed under the GPLv2
#
# Copyright 2013 Red Hat, Inc.
# Peter Jones <pjones@redhat.com>
for x in /lib/modules/keys/* ; do
[ "${x}" = "/lib/modules/keys/*" ] && break
keyctl padd asymmetric "" @s < ${x}
done

View File

@@ -0,0 +1,37 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Licensed under the GPLv2
#
# Copyright 2013 Red Hat, Inc.
# Peter Jones <pjones@redhat.com>
check() {
[[ -x /usr/bin/keyctl ]] || return 1
# do not include module in hostonly mode,
# if no keys are present
if [[ $hostonly ]]; then
x=$(echo /lib/modules/keys/*)
[[ "${x}" = "/lib/modules/keys/*" ]] && return 255
fi
return 0
}
depends() {
return 0
}
install() {
inst_dir /lib/modules/keys
inst_binary /usr/bin/keyctl
inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"
for x in /lib/modules/keys/* ; do
[[ "${x}" = "/lib/modules/keys/*" ]] && break
inst_simple "${x}"
done
}

View File

@@ -12,7 +12,7 @@ depends() {
}
install() {
dracut_install -o ps grep more cat rm strace free showmount \
inst_multiple -o ps grep more cat rm strace free showmount \
ping netstat rpcinfo vi scp ping6 ssh \
fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck
}

View File

@@ -23,6 +23,6 @@ install() {
inst_hook cleanup 00 "$moddir/watchdog.sh"
inst_hook cleanup 99 "$moddir/watchdog.sh"
inst_hook emergency 02 "$moddir/watchdog-stop.sh"
dracut_install -o wdctl
inst_multiple -o wdctl
}

View File

@@ -12,9 +12,18 @@ depends() {
}
install() {
dracut_install -o $systemdutildir/systemd-vconsole-setup
if dracut_module_included "systemd"; then
[[ -f /etc/vconsole.conf ]] || return 0
unset FONT
unset KEYMAP
. /etc/vconsole.conf
# if vconsole.conf has no settings, do not include anything
[[ $FONT ]] || [[ $KEYMAP ]] || return 0
fi
inst_multiple -o $systemdutildir/systemd-vconsole-setup
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
DEFAULT_FONT=latarcyrheb-sun16
DEFAULT_FONT="${i18n_default_font:-LatArCyrHeb-16}"
I18N_CONF="/etc/locale.conf"
VCONFIG_CONF="/etc/vconsole.conf"
@@ -84,7 +93,7 @@ install() {
}
install_base() {
dracut_install setfont loadkeys kbd_mode stty
inst_multiple setfont loadkeys kbd_mode stty
if ! dracut_module_included "systemd"; then
inst ${moddir}/console_init.sh /lib/udev/console_init
@@ -102,16 +111,16 @@ install() {
done
# remove unnecessary files
rm -f "${initdir}${kbddir}/consoletrans/utflist"
rm -f -- "${initdir}${kbddir}/consoletrans/utflist"
find "${initdir}${kbddir}/" -name README\* -delete
find "${initdir}${kbddir}/" -name '*.gz' -print -quit \
| while read line; do
dracut_install gzip
inst_multiple gzip
done
find "${initdir}${kbddir}/" -name '*.bz2' -print -quit \
| while read line; do
dracut_install bzip2
inst_multiple bzip2
done
}
@@ -212,12 +221,6 @@ install() {
kbddir=''
done
[[ ${kbddir} ]] || {
derror "Directories ${KBDSUBDIRS//,/, } not found. Please" \
"inform us about the issue including your OS name and version."
return 1
}
[[ -f $I18N_CONF && -f $VCONFIG_CONF ]] || \
[[ ! ${hostonly} || ${i18n_vars} ]] || {
derror 'i18n_vars not set! Please set up i18n_vars in ' \

View File

@@ -36,7 +36,7 @@ if [ -f /etc/locale.conf ]; then
fi
if [ -n "$DRACUT_SYSTEMD" ]; then
rm -f /etc/udev/rules.d/10-console.rules
rm -f /lib/udev/rules.d/10-console.rules
rm -f /lib/udev/console_init
rm -f -- /etc/udev/rules.d/10-console.rules
rm -f -- /lib/udev/rules.d/10-console.rules
rm -f -- /lib/udev/console_init
fi

View File

@@ -56,22 +56,22 @@ if ! needconvert; then
fi
testfile="$ROOT/.usrmovecheck$$"
rm -f "$testfile"
rm -f -- "$testfile"
> "$testfile"
if [[ ! -e "$testfile" ]]; then
echo "Cannot write to $ROOT/"
exit 1
fi
rm -f "$testfile"
rm -f -- "$testfile"
testfile="$ROOT/usr/.usrmovecheck$$"
rm -f "$testfile"
rm -f -- "$testfile"
> "$testfile"
if [[ ! -e "$testfile" ]]; then
echo "Cannot write to $ROOT/usr/"
exit 1
fi
rm -f "$testfile"
rm -f -- "$testfile"
find_mount() {
local dev mnt etc wanted_dev
@@ -108,11 +108,11 @@ cleanup() {
for dir in "$ROOT/bin" "$ROOT/sbin" "$ROOT/lib" "$ROOT/lib64" \
"$ROOT/usr/bin" "$ROOT/usr/sbin" "$ROOT/usr/lib" \
"$ROOT/usr/lib64"; do
[[ -d "${dir}.usrmove-new" ]] && rm -fr "${dir}.usrmove-new"
[[ -d "${dir}.usrmove-new" ]] && rm -fr -- "${dir}.usrmove-new"
if [[ -d "${dir}.usrmove-old" ]]; then
mv "$dir" "${dir}.del~"
mv "${dir}.usrmove-old" "$dir"
rm -fr "${dir}.del~"
rm -fr -- "${dir}.del~"
fi
done
}
@@ -126,7 +126,7 @@ set -e
# merge / and /usr in new dir in /usr
for dir in bin sbin lib lib64; do
rm -rf "$ROOT/usr/${dir}.usrmove-new"
rm -rf -- "$ROOT/usr/${dir}.usrmove-new"
[[ -L "$ROOT/$dir" ]] && continue
[[ -d "$ROOT/$dir" ]] || continue
echo "Make a copy of \`$ROOT/usr/$dir'."
@@ -150,7 +150,7 @@ done
for dir in bin sbin lib lib64; do
[[ -d "$ROOT/usr/${dir}.usrmove-new" ]] || continue
echo "Switch to new \`$ROOT/usr/$dir'."
rm -fr "$ROOT/usr/${dir}.usrmove-old"
rm -fr -- "$ROOT/usr/${dir}.usrmove-old"
mv "$ROOT/usr/$dir" "$ROOT/usr/${dir}.usrmove-old"
mv "$ROOT/usr/${dir}.usrmove-new" "$ROOT/usr/$dir"
done
@@ -160,7 +160,7 @@ for dir in bin sbin lib lib64; do
[[ -L "$ROOT/$dir" ]] && continue
[[ -d "$ROOT/$dir" ]] || continue
echo "Create \`$ROOT/$dir' symlink."
rm -rf "$ROOT/${dir}.usrmove-old" || :
rm -fr -- "$ROOT/${dir}.usrmove-old" || :
mv "$ROOT/$dir" "$ROOT/${dir}.usrmove-old"
ln -sfn usr/$dir "$ROOT/$dir"
done
@@ -178,9 +178,9 @@ done
for dir in bin sbin lib lib64; do
[[ -d "$ROOT/usr/${dir}.usrmove-old~" ]] \
&& rm -rf "$ROOT/usr/${dir}.usrmove-old~" || :
&& rm -rf -- "$ROOT/usr/${dir}.usrmove-old~" || :
[[ -d "$ROOT/${dir}.usrmove-old~" ]] \
&& rm -rf "$ROOT/${dir}.usrmove-old~" || :
&& rm -rf -- "$ROOT/${dir}.usrmove-old~" || :
done
for dir in lib lib64; do

View File

@@ -12,7 +12,7 @@ depends() {
}
install() {
dracut_install bash find ldconfig mv rm cp ln
inst_multiple bash find ldconfig mv rm cp ln
inst_hook pre-pivot 99 "$moddir/do-convertfs.sh"
inst_script "$moddir/convertfs.sh" /usr/bin/convertfs
}

View File

@@ -9,7 +9,7 @@ setup_interface() {
bcast=$new_broadcast_address
gw=${new_routers%%,*}
domain=$new_domain_name
search=$(printf "$new_domain_search")
search=$(printf -- "$new_domain_search")
namesrv=$new_domain_name_servers
hostname=$new_host_name
@@ -89,7 +89,7 @@ case $reason in
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
echo "> /tmp/setup_net_$netif.ok"
echo "> /tmp/setup_net_\$(cat /sys/class/net/$netif/address).ok"
echo "rm -f $hookdir/initqueue/setup_net_$netif.sh"
echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
} > $hookdir/initqueue/setup_net_$netif.sh
echo "[ -f /tmp/setup_net_$netif.ok ]" > $hookdir/initqueue/finished/dhclient-$netif.sh

View File

@@ -108,6 +108,7 @@ do_ipv6auto() {
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
linkup $netif
wait_for_ipv6_auto $netif
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
@@ -286,6 +287,17 @@ for p in $(getargs ip=); do
# skip ibft
[ "$autoconf" = "ibft" ] && continue
case "$dev" in
??:??:??:??:??:??) # MAC address
_dev=$(iface_for_mac $dev)
[ -n "$_dev" ] && dev="$_dev"
;;
??-??-??-??-??-??) # MAC address in BOOTIF form
_dev=$(iface_for_mac $(fix_bootif $dev))
[ -n "$_dev" ] && dev="$_dev"
;;
esac
# If this option isn't directed at our interface, skip it
[ -n "$dev" ] && [ "$dev" != "$netif" ] && \
[ "$use_bridge" != 'true' ] && \

View File

@@ -70,10 +70,10 @@ installkernel() {
install() {
local _arch _i _dir
dracut_install ip arping dhclient sed
dracut_install -o ping ping6
dracut_install -o brctl
dracut_install -o teamd teamdctl teamnl
inst_multiple ip arping dhclient sed
inst_multiple -o ping ping6
inst_multiple -o brctl
inst_multiple -o teamd teamdctl teamnl
inst_simple /etc/libnl/classid
inst_script "$moddir/ifup.sh" "/sbin/ifup"
inst_script "$moddir/netroot.sh" "/sbin/netroot"

View File

@@ -2,18 +2,6 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# pxelinux provides macaddr '-' separated, but we need ':'
fix_bootif() {
local macaddr=${1}
local IFS='-'
macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
macaddr=${macaddr%:}
# strip hardware type field from pxelinux
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
# return macaddr with lowercase alpha characters expected by udev
echo $macaddr | sed 'y/ABCDEF/abcdef/'
}
getargbool 0 rd.neednet && NEEDNET=1
# Don't continue if we don't need network
@@ -21,6 +9,8 @@ if [ -z "$netroot" ] && [ ! -e "/tmp/net.ifaces" ] && [ "$NEEDNET" != "1" ]; the
return
fi
command -v fix_bootif >/dev/null || . /lib/net-lib.sh
# Write udev rules
{
# bridge: attempt only the defined interface
@@ -64,23 +54,33 @@ fi
ifup='/sbin/ifup $env{INTERFACE}'
[ -z "$netroot" ] && ifup="$ifup -m"
# BOOTIF says everything, use only that one
BOOTIF=$(getarg 'BOOTIF=')
if [ -n "$BOOTIF" ] ; then
BOOTIF=$(fix_bootif "$BOOTIF")
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="%s"\n' "$BOOTIF" "/sbin/initqueue --onetime $ifup"
echo "[ -f /tmp/setup_net_${BOOTIF}.ok ]" >$hookdir/initqueue/finished/wait-${BOOTIF}.sh
runcmd="RUN+=\"/sbin/initqueue --onetime $ifup\""
# If we have to handle multiple interfaces, handle only them.
elif [ -n "$IFACES" ] ; then
for iface in $IFACES ; do
printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="%s"\n' "$iface" "/sbin/initqueue --onetime $ifup"
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh
fi
# We have some specific interfaces to handle
if [ -n "$IFACES" ]; then
echo 'SUBSYSTEM!="net", GOTO="net_end"'
echo 'ACTION=="remove", GOTO="net_end"'
for iface in $IFACES; do
case "$iface" in
??:??:??:??:??:??) # MAC address
cond="ATTR{address}==\"$iface\"" ;;
??-??-??-??-??-??) # MAC address in BOOTIF form
cond="ATTR{address}==\"$(fix_bootif $iface)\"" ;;
*) # an interface name
cond="ENV{INTERFACE}==\"$iface\"" ;;
esac
# The GOTO prevents us from trying to ifup the same device twice
echo "$cond, $runcmd, GOTO=\"net_end\""
done
echo 'LABEL="net_end"'
for iface in $MASTER_IFACES; do
if [ -n "$MASTER_IFACES" ]; then
wait_ifaces=$MASTER_IFACES
else
wait_ifaces=$IFACES
fi
for iface in $wait_ifaces; do
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh
fi
@@ -88,8 +88,9 @@ fi
# Default: We don't know the interface to use, handle all
# Fixme: waiting for the interface as well.
else
cond='ACTION=="add", SUBSYSTEM=="net"'
# if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh
printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup" > /etc/udev/rules.d/91-default-net.rules
echo "$cond, $runcmd" > /etc/udev/rules.d/91-default-net.rules
fi
# if you change the name of "90-net.rules", also change modules.d/80cms/cmssetup.sh

View File

@@ -14,6 +14,11 @@ iface_for_remote_addr() {
echo $5
}
iface_for_ip() {
set -- $(ip -o addr show to $1)
echo $2
}
iface_for_mac() {
local interface="" mac="$(echo $1 | sed 'y/ABCDEF/abcdef/')"
for interface in /sys/class/net/*; do
@@ -34,6 +39,45 @@ iface_has_link() {
# XXX Do we need to reset the flags here? anaconda never bothered..
}
find_iface_with_link() {
local iface_path="" iface=""
for iface_path in /sys/class/net/*; do
iface=${iface_path##*/}
str_starts "$iface" "lo" && continue
if iface_has_link $iface; then
echo "$iface"
return 0
fi
done
return 1
}
# get the iface name for the given identifier - either a MAC, IP, or iface name
iface_name() {
case $1 in
??:??:??:??:??:??|??-??-??-??-??-??) iface_for_mac $1 ;;
*:*:*|*.*.*.*) iface_for_ip $1 ;;
*) echo $1 ;;
esac
}
# list the configured interfaces
configured_ifaces() {
local IFACES="" iface_id="" rv=1
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
if { pidof udevd || pidof systemd-udevd; } > /dev/null; then
for iface_id in $IFACES; do
echo $(iface_name $iface_id)
rv=0
done
else
warn "configured_ifaces called before udev is running"
echo $IFACES
[ -n "$IFACES" ] && rv=0
fi
return $rv
}
all_ifaces_up() {
local iface="" IFACES=""
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
@@ -61,7 +105,7 @@ ifdown() {
ip link set $netif down
ip addr flush dev $netif
echo "#empty" > /etc/resolv.conf
rm -f /tmp/net.$netif.did-setup
rm -f -- /tmp/net.$netif.did-setup
# TODO: send "offline" uevent?
}
@@ -128,17 +172,36 @@ save_netinfo() {
}
set_ifname() {
local name="$1" mac="$2" num=0 n=""
local name="$1" mac="$2" num=-1 n=""
# if it's already set, return the existing name
for n in $(getargs ifname=); do
strstr "$n" "$mac" && echo ${n%%:*} && return
done
# otherwise, pick a new name and use that
while [ -e /sys/class/$name$num ]; do num=$(($num+1)); done
while :; do
num=$(($num+1));
[ -e /sys/class/net/$name$num ] && continue
for n in $(getargs ifname=); do
[ "$name$num" = "${n%%:*}" ] && continue 2
done
break
done
echo "ifname=$name$num:$mac" >> /etc/cmdline.d/45-ifname.conf
echo "$name$num"
}
# pxelinux provides macaddr '-' separated, but we need ':'
fix_bootif() {
local macaddr=${1}
local IFS='-'
macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
macaddr=${macaddr%:}
# strip hardware type field from pxelinux
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
# return macaddr with lowercase alpha characters expected by udev
echo $macaddr | sed 'y/ABCDEF/abcdef/'
}
ibft_to_cmdline() {
local iface="" mac="" dev=""
local dhcp="" ip="" gw="" mask="" hostname=""
@@ -149,16 +212,38 @@ ibft_to_cmdline() {
mac=$(read a < ${iface}/mac; echo $a)
[ -z "$mac" ] && continue
dev=$(set_ifname ibft $mac)
dhcp=$(read a < ${iface}/dhcp; echo $a)
[ -e /tmp/net.${dev}.has_ibft_config ] && continue
[ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
if [ -e ${iface}/vlan ]; then
vlan=$(read a < ${iface}/vlan; echo $a)
echo "vlan=$vlan:$dev"
fi
if [ -n "$dhcp" ]; then
echo "ip=$dev:dhcp"
elif [ -e ${iface}/ip-addr ]; then
[ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a)
# skip not assigned ip adresses
[ "$ip" = "0.0.0.0" ] && continue
[ -e ${iface}/gateway ] && gw=$(read a < ${iface}/gateway; echo $a)
[ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; echo $a)
[ -e ${iface}/hostname ] && hostname=$(read a < ${iface}/hostname; echo $a)
if [ -n "$ip" ] && [ -n "$mask" ]; then
echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
else
warn "${iface} does not contain a valid iBFT configuration"
warn "ip-addr=$ip"
warn "gateway=$gw"
warn "subnet-mask=$mask"
warn "hostname=$hostname"
fi
else
ip=$(read a < ${iface}/ip-addr; echo $a)
gw=$(read a < ${iface}/gateway; echo $a)
mask=$(read a < ${iface}/subnet-mask; echo $a)
hostname=$(read a < ${iface}/hostname; echo $a)
echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
info "${iface} does not contain a valid iBFT configuration"
ls -l ${iface} | vinfo
fi
echo $mac > /tmp/net.${dev}.has_ibft_config
done
) >> /etc/cmdline.d/40-ibft.conf
@@ -282,7 +367,10 @@ ip_to_var() {
fi
;;
esac
# anaconda-style argument cluster
# ip=<ipv4-address> means anaconda-style static config argument cluster:
# ip=<ip> gateway=<gw> netmask=<nm> hostname=<host> mtu=<mtu>
# ksdevice={link|bootif|ibft|<MAC>|<ifname>}
if strstr "$autoconf" "*.*.*.*"; then
ip="$autoconf"
gw=$(getarg gateway=)
@@ -291,9 +379,12 @@ ip_to_var() {
dev=$(getarg ksdevice=)
autoconf="none"
mtu=$(getarg mtu=)
# handle special values for ksdevice
case "$dev" in
# ignore fancy values for ksdevice=XXX
link|bootif|BOOTIF|ibft|*:*:*:*:*:*) dev="" ;;
bootif|BOOTIF) dev=$(fix_bootif $(getarg BOOTIF=)) ;;
link) dev="" ;; # FIXME: do something useful with this
ibft) dev="" ;; # ignore - ibft is handled elsewhere
esac
fi
}
@@ -360,6 +451,18 @@ wait_for_route_ok() {
return 1
}
wait_for_ipv6_auto() {
local cnt=0
local li
while [ $cnt -lt 400 ]; do
li=$(ip -6 addr show dev $1)
strstr "$li" "dynamic" && return 0
sleep 0.1
cnt=$(($cnt+1))
done
return 1
}
linkup() {
wait_for_if_link $1 2>/dev/null\
&& ip link set $1 up 2>/dev/null\

View File

@@ -20,6 +20,18 @@ command -v setup_net >/dev/null || . /lib/net-lib.sh
netif=$1
[ -e "/tmp/net.bootdev" ] && read netif < /tmp/net.bootdev
case "$netif" in
??:??:??:??:??:??) # MAC address
for i in /sys/class/net/*/address; do
mac=$(cat $i)
if [ "$mac" = "$netif" ]; then
i=${i%/address}
netif=${i##*/}
break
fi
done
esac
# Figure out the handler for root=dhcp by recalling all netroot cmdline
# handlers when this is not called from manually network bringing up.
if [ -z "$2" ]; then
@@ -64,7 +76,7 @@ source_hook netroot $netif
# Run the handler; don't store the root, it may change from device to device
# XXX other variables to export?
if $handler $netif $netroot $NEWROOT; then
rm -f $hookdir/initqueue/finished/dhcp.sh
rm -f -- $hookdir/initqueue/finished/dhcp.sh
# Network rootfs mount successful - save interface info for ifcfg etc.
save_netinfo $netif
fi

View File

@@ -17,14 +17,7 @@
command -v getarg >/dev/null || . /lib/dracut-lib.sh
command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh
# Don't mix BOOTIF=macaddr from pxelinux and ip= lines
getarg ip= >/dev/null && getarg BOOTIF= >/dev/null && \
die "Mixing BOOTIF and ip= lines is dangerous"
# No more parsing stuff, BOOTIF says everything
[ -n "$(getarg BOOTIF)" ] && return
if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] ; then
if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] && [ -z "$(getarg BOOTIF=)" ]; then
# No ip= argument(s) for netroot provided, defaulting to DHCP
return;
fi
@@ -118,6 +111,12 @@ for p in $(getargs ip=); do
done
# put BOOTIF in IFACES to make sure it comes up
if BOOTIF="$(getarg BOOTIF=)"; then
BOOTDEV=$(fix_bootif $BOOTIF)
IFACES="$BOOTDEV $IFACES"
fi
# This ensures that BOOTDEV is always first in IFACES
if [ -n "$BOOTDEV" ] && [ -n "$IFACES" ] ; then
IFACES="${IFACES%$BOOTDEV*} ${IFACES#*$BOOTDEV}"

View File

@@ -9,6 +9,10 @@ if [ -e /tmp/bridge.info ]; then
. /tmp/bridge.info
fi
if [ -e /tmp/vlan.info ]; then
. /tmp/vlan.info
fi
mkdir -m 0755 -p /tmp/ifcfg/
mkdir -m 0755 -p /tmp/ifcfg-leases/
@@ -103,6 +107,9 @@ for netup in /tmp/net.*.did-setup ; do
# $netif can't be bridge and bond at the same time
bond=yes
fi
if [ "$netif" = "$vlanname" ]; then
vlan=yes
fi
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
{
echo "# Generated by dracut initrd"
@@ -149,7 +156,7 @@ for netup in /tmp/net.*.did-setup ; do
} > /tmp/ifcfg/ifcfg-$netif
# bridge needs different things written to ifcfg
if [ -z "$bridge" ] && [ -z "$bond" ]; then
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
# standard interface
{
if [ -n "$macaddr" ]; then
@@ -164,6 +171,15 @@ for netup in /tmp/net.*.did-setup ; do
} >> /tmp/ifcfg/ifcfg-$netif
fi
if [ -n "$vlan" ] ; then
{
echo "TYPE=Vlan"
echo "NAME=\"$netif\""
echo "VLAN=yes"
echo "PHYSDEV=\"$phydevice\""
} >> /tmp/ifcfg/ifcfg-$netif
fi
if [ -n "$bond" ] ; then
# bond interface
{

View File

@@ -12,9 +12,9 @@ depends() {
}
install() {
local _dir _crt _found
local _dir _crt _found _lib
inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
dracut_install curl
inst_multiple curl
# also install libs for curl https
inst_libdir_file "libnsspem.so*"
inst_libdir_file "libnsssysinit.so*"
@@ -22,8 +22,10 @@ install() {
inst_libdir_file "libsqlite3.so*"
for _dir in $libdirs; do
[[ -d $_dir ]] || continue
_crt=$(grep -F --binary-files=text -z .crt $_dir/libcurl.so)
[[ -d $_dir ]] || continue
for _lib in $_dir/libcurl.so.*; do
[[ -e $_lib ]] || continue
_crt=$(grep -F --binary-files=text -z .crt $_lib)
[[ $_crt ]] || continue
[[ $_crt == /*/* ]] || continue
if ! inst_simple "$_crt"; then
@@ -31,6 +33,7 @@ install() {
continue
fi
_found=1
done
done
[[ $_found ]] || dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
}

View File

@@ -23,7 +23,7 @@ fetch_url() {
local handler="$(get_url_handler $url)"
[ -n "$handler" ] || return 254
[ -n "$url" ] || return 255
$handler "$url" "$outloc"
"$handler" "$url" "$outloc"
}
# get_url_handler URL
@@ -64,7 +64,7 @@ curl_fetch_url() {
local url="$1" outloc="$2"
echo "$url" > /proc/self/fd/0
if [ -n "$outloc" ]; then
curl $curl_args --output "$outloc" "$url" || return $?
curl $curl_args --output "$outloc" -- "$url" || return $?
else
local outdir="$(mkuniqdir /tmp curl_fetch_url)"
( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
@@ -106,18 +106,18 @@ nfs_fetch_url() {
local filepath="${path%/*}" filename="${path##*/}" mntdir=""
# skip mount if server:/filepath is already mounted
mntdir=$(nfs_already_mounted $server $path)
mntdir=$(nfs_already_mounted "$server" "$path")
if [ -z "$mntdir" ]; then
local mntdir="$(mkuniqdir /run nfs_mnt)"
mount_nfs $nfs:$server:$filepath${options:+:$options} $mntdir
mount_nfs "$nfs:$server:$filepath${options:+:$options}" "$mntdir"
# lazy unmount during pre-pivot hook
inst_hook --hook pre-pivot --name 99url-lib-umount-nfs umount -l $mntdir
inst_hook --hook pre-pivot --name 99url-lib-umount-nfs umount -l -- "$mntdir"
fi
if [ -z "$outloc" ]; then
outloc="$mntdir/$filename"
else
cp -f "$mntdir/$filename" "$outloc" || return $?
cp -f -- "$mntdir/$filename" "$outloc" || return $?
fi
[ -f "$outloc" ] || return 253
if [ -z "$2" ]; then echo "$outloc" ; fi

View File

@@ -71,7 +71,7 @@ install() {
mv dev.old dev
popd >/dev/null
dracut_install chvt
inst_multiple chvt
inst /usr/share/splashutils/initrd.splash /lib/gensplash-lib.sh
inst_hook pre-pivot 90 "${moddir}"/gensplash-newroot.sh
inst_hook pre-trigger 10 "${moddir}"/gensplash-pretrigger.sh

View File

@@ -22,7 +22,7 @@ install() {
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
dracut_install readlink
inst_multiple readlink
if ! dracut_module_included "systemd"; then
inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh

View File

@@ -4,7 +4,7 @@
PLYMOUTH_LOGO_FILE="/usr/share/pixmaps/system-logo-white.png"
PLYMOUTH_THEME=$(plymouth-set-default-theme)
dracut_install plymouthd plymouth \
inst_multiple plymouthd plymouth \
"${PLYMOUTH_LOGO_FILE}" \
/etc/system-release
@@ -13,7 +13,7 @@ mkdir -m 0755 -p "${initdir}/usr/share/plymouth"
inst_libdir_file "plymouth/text.so" "plymouth/details.so"
if [[ $hostonly ]]; then
dracut_install \
inst_multiple \
"/usr/share/plymouth/themes/details/details.plymouth" \
"/usr/share/plymouth/themes/text/text.plymouth" \
@@ -35,7 +35,7 @@ else
[[ -f "$x" ]] || continue
THEME_DIR=$(dirname "$x")
mkdir -m 0755 -p "${initdir}/$THEME_DIR"
dracut_install "$x"
inst_multiple "$x"
done
(
cd ${initdir}/usr/share/plymouth/themes;

View File

@@ -167,7 +167,7 @@ function dasd_settle_all() {
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
# remove the default net rules
rm -f /etc/udev/rules.d/91-default-net.rules
rm -f -- /etc/udev/rules.d/91-default-net.rules
[[ -f /etc/udev/rules.d/90-net.rules ]] \
|| printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
udevadm control --reload
@@ -182,7 +182,19 @@ function dasd_settle_all() {
unset _do_zfcp
for i in ${!FCP_*}; do
echo "${!i}" >> /etc/zfcp.conf
echo "${!i}" | while read port rest; do
case $port in
*.*.*)
;;
*.*)
port="0.$port"
;;
*)
port="0.0.$port"
;;
esac
echo $port $rest >> /etc/zfcp.conf
done
_do_zfcp=1
done
[[ $_do_zfcp ]] && zfcp_cio_free

View File

@@ -23,7 +23,7 @@ install() {
inst_hook pre-trigger 30 "$moddir/cmssetup.sh"
inst_hook pre-pivot 95 "$moddir/cms-write-ifcfg.sh"
inst_script "$moddir/cmsifup.sh" /sbin/cmsifup
dracut_install /etc/cmsfs-fuse/filetypes.conf /etc/udev/rules.d/99-fuse.rules /etc/fuse.conf \
inst_multiple /etc/cmsfs-fuse/filetypes.conf /etc/udev/rules.d/99-fuse.rules /etc/fuse.conf \
cmsfs-fuse fusermount ulockmgr_server bash insmod rmmod cat normalize_dasd_arg sed \
$(rpm -ql s390utils-base)

View File

@@ -0,0 +1,30 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
type -P probe-bcache >/dev/null || return 1
[[ $hostonly ]] || [[ $mount_needs ]] && {
for fs in "${host_fs_types[@]}"; do
[[ $fs = "bcache" ]] && return 0
done
return 255
}
return 0
}
depends() {
return 0
}
installkernel() {
instmods bcache
}
install() {
inst_multiple probe-bcache ${udevdir}/bcache-register
inst_rules 61-bcache.rules
}

View File

@@ -43,7 +43,7 @@ install() {
/usr/lib/dracut/hooks/initqueue/timeout/btrfs_timeout.sh
fi
dracut_install -o btrfsck btrfs-zero-log
inst_multiple -o btrfsck btrfs-zero-log
inst $(command -v btrfs) /sbin/btrfs
}

View File

@@ -2,7 +2,7 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# close everything which is not busy
rm -f /etc/udev/rules.d/70-luks.rules >/dev/null 2>&1
rm -f -- /etc/udev/rules.d/70-luks.rules >/dev/null 2>&1
if ! getarg rd.luks.uuid -d rd_LUKS_UUID >/dev/null 2>&1 && getargbool 1 rd.luks -d -n rd_NO_LUKS >/dev/null 2>&1; then
while true; do

View File

@@ -4,6 +4,19 @@
command -v getarg >/dev/null || . /lib/dracut-lib.sh
# check if the crypttab contains an entry for a LUKS UUID
crypttab_contains() {
local luks="$1"
local l d rest
if [ -f /etc/crypttab ]; then
while read l d rest; do
strstr "${l##luks-}" "${luks##luks-}" && return 0
strstr "$d" "${luks##luks-}" && return 0
done < /etc/crypttab
fi
return 1
}
# ask_for_password
#
# Wraps around plymouth ask-for-password and adds fallback to tty password ask

View File

@@ -3,15 +3,12 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
. /lib/dracut-lib.sh
type crypttab_contains >/dev/null 2>&1 || . /lib/dracut-crypt-lib.sh
dev=$1
luks=$2
if [ -f /etc/crypttab ]; then
while read l rest; do
strstr "${l##luks-}" "${luks##luks-}" && exit 0
done < /etc/crypttab
fi
crypttab_contains "$luks" && exit 0
allowdiscards="-"

View File

@@ -26,29 +26,30 @@ installkernel() {
instmods dm_crypt =crypto
}
cmdline() {
local dev UUID
for dev in "${!host_fs_types[@]}"; do
[[ "${host_fs_types[$dev]}" != "crypto_LUKS" ]] && continue
UUID=$(
blkid -u crypto -o export $dev \
| while read line; do
[[ ${line#UUID} = $line ]] && continue
printf "%s" "${line#UUID=}"
break
done
)
[[ ${UUID} ]] || continue
printf "%s" " rd.luks.uuid=luks-${UUID}"
done
}
install() {
check_crypt() {
local dev=$1 fs=$2
cmdline >> "${initdir}/etc/cmdline.d/90crypt.conf"
echo >> "${initdir}/etc/cmdline.d/90crypt.conf"
[[ $fs = "crypto_LUKS" ]] || return 1
ID_FS_UUID=$(udevadm info --query=property --name=$dev \
| while read line; do
[[ ${line#ID_FS_UUID} = $line ]] && continue
eval "$line"
echo $ID_FS_UUID
break
done)
[[ ${ID_FS_UUID} ]] || return 1
if ! [[ $kernel_only ]]; then
echo " rd.luks.uuid=luks-${ID_FS_UUID} " >> "${initdir}/etc/cmdline.d/90crypt.conf"
fi
return 0
}
for_each_host_dev_fs check_crypt
dracut_install cryptsetup rmdir readlink umount
inst_multiple cryptsetup rmdir readlink umount
inst_script "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
inst_script "$moddir"/probe-keydev.sh /sbin/probe-keydev
inst_hook cmdline 10 "$moddir/parse-keydev.sh"
@@ -57,7 +58,7 @@ install() {
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
fi
if [[ $hostonly ]]; then
if [[ $hostonly ]] && [[ -f /etc/crypttab ]]; then
# filter /etc/crypttab for the devices we need
while read _mapper _dev _rest; do
[[ $_mapper = \#* ]] && continue
@@ -78,8 +79,7 @@ install() {
inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
dracut_install -o \
$systemdutildir/system-generators/systemd-cryptsetup-generator \
inst_multiple -o \
$systemdutildir/system-generators/systemd-cryptsetup-generator \
$systemdutildir/systemd-cryptsetup \
$systemdsystemunitdir/systemd-ask-password-console.path \

View File

@@ -2,9 +2,11 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
type crypttab_contains >/dev/null 2>&1 || . /lib/dracut-crypt-lib.sh
if ! getargbool 1 rd.luks -d -n rd_NO_LUKS; then
info "rd.luks=0: removing cryptoluks activation"
rm -f /etc/udev/rules.d/70-luks.rules
rm -f -- /etc/udev/rules.d/70-luks.rules
else
{
echo 'SUBSYSTEM!="block", GOTO="luks_end"'
@@ -23,18 +25,20 @@ else
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
printf -- 'RUN+="%s --settled --unique --onetime ' $(command -v initqueue)
printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
} >> /etc/udev/rules.d/70-luks.rules.new
else
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
printf -- '--name systemd-cryptsetup-%%k %s start ' $(command -v systemctl)
printf -- 'systemd-cryptsetup@luks$$(dev_unit_name -$env{ID_FS_UUID}).service"\n'
} >> /etc/udev/rules.d/70-luks.rules.new
if ! crypttab_contains "$luksid"; then
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
printf -- 'RUN+="%s --settled --unique --onetime ' $(command -v initqueue)
printf -- '--name systemd-cryptsetup-%%k %s start ' $(command -v systemctl)
printf -- 'systemd-cryptsetup@luks$$(dev_unit_name -$env{ID_FS_UUID}).service"\n'
} >> /etc/udev/rules.d/70-luks.rules.new
fi
fi
uuid=$luksid
@@ -51,13 +55,13 @@ else
if [ -z "$DRACUT_SYSTEMD" ]; then
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
printf -- '--unique --onetime --name cryptroot-ask-%%k '
printf -- '--unique --settled --onetime --name cryptroot-ask-%%k '
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $(command -v cryptroot-ask) $tout
} >> /etc/udev/rules.d/70-luks.rules.new
else
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
printf -- '--unique --onetime --name crypt-run-generator-%%k '
printf -- '--unique --settled --onetime --name crypt-run-generator-%%k '
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $(command -v crypt-run-generator)
} >> /etc/udev/rules.d/70-luks.rules.new
fi

View File

@@ -20,8 +20,8 @@ install() {
modinfo -k $kernel dm_mod >/dev/null 2>&1 && \
inst_hook pre-udev 30 "$moddir/dm-pre-udev.sh"
dracut_install dmsetup
dracut_install -o dmeventd
inst_multiple dmsetup
inst_multiple -o dmeventd
inst_libdir_file "libdevmapper-event.so*"
@@ -29,6 +29,8 @@ install() {
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
# files, but provides the one below:
inst_rules 64-device-mapper.rules
# debian udev rules
inst_rules 60-persistent-storage-dm.rules 55-dm.rules
inst_rules "$moddir/11-dm.rules"

View File

@@ -27,8 +27,7 @@ if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
for s in $SETS; do
if [ "${s##$r}" != "$s" ]; 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
dmraid -ay -i --rm_partitions "$s" 2>&1 | vinfo
udevsettle
fi
done
@@ -37,8 +36,7 @@ if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
# scan and activate all DM RAIDS
for s in $SETS; do
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
dmraid -ay -i --rm_partitions "$s" 2>&1 | vinfo
done
fi

View File

@@ -23,42 +23,49 @@ depends() {
return 0
}
cmdline() {
local _activated
declare -A _activated
for dev in "${!host_fs_types[@]}"; do
local holder DEVPATH DM_NAME majmin
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
majmin=$(get_maj_min $dev)
DEVPATH=$(
for i in /sys/block/*; do
[[ -e "$i/dev" ]] || continue
if [[ $a == $(<"$i/dev") ]]; then
printf "%s" "$i"
break
fi
done
)
for holder in "$DEVPATH"/holders/*; do
[[ -e "$holder" ]] || continue
dev="/dev/${holder##*/}"
DM_NAME="$(dmsetup info -c --noheadings -o name "$dev" 2>/dev/null)"
[[ ${DM_NAME} ]] && break
done
[[ ${DM_NAME} ]] || continue
if ! [[ ${_activated[${DM_NAME}]} ]]; then
printf "%s" " rd.dm.uuid=${DM_NAME}"
_activated["${DM_NAME}"]=1
fi
done
}
install() {
local _i
check_dmraid() {
local dev=$1 fs=$2 holder DEVPATH DM_NAME
[[ "$fs" != *_raid_member ]] && return 1
cmdline >> "${initdir}/etc/cmdline.d/90dmraid.conf"
echo >> "${initdir}/etc/cmdline.d/90dmraid.conf"
DEVPATH=$(udevadm info --query=property --name=$dev \
| while read line; do
[[ ${line#DEVPATH} = $line ]] && continue
eval "$line"
echo $DEVPATH
break
done)
for holder in /sys/$DEVPATH/holders/*; do
[[ -e $holder ]] || continue
DM_NAME=$(udevadm info --query=property --path=$holder \
| while read line; do
[[ ${line#DM_NAME} = $line ]] && continue
eval "$line"
echo $DM_NAME
break
done)
done
[[ ${DM_NAME} ]] || return 1
if ! [[ $kernel_only ]]; then
echo " rd.dm.uuid=${DM_NAME} " >> "${initdir}/etc/cmdline.d/90dmraid.conf"
fi
return 0
}
for_each_host_dev_fs check_dmraid
dracut_install dmraid
dracut_install -o kpartx
inst_multiple dmraid
inst_multiple -o kpartx
inst $(command -v partx) /sbin/partx
inst "$moddir/dmraid.sh" /sbin/dmraid_scan

View File

@@ -24,7 +24,7 @@ do_iso_scan() {
mount -t auto -o ro "$dev" "/run/initramfs/isoscan" || continue
if [ -f "/run/initramfs/isoscan/$isofile" ]; then
losetup -f "/run/initramfs/isoscan/$isofile"
rm -f "$job"
rm -f -- "$job"
exit 0
else
umount "/run/initramfs/isoscan"

View File

@@ -20,8 +20,8 @@ installkernel() {
}
install() {
dracut_install umount dmsetup blkid dd losetup grep blockdev
dracut_install -o checkisomd5
inst_multiple umount dmsetup blkid dd losetup grep blockdev
inst_multiple -o checkisomd5
inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
inst_hook cmdline 31 "$moddir/parse-iso-scan.sh"
inst_hook pre-udev 30 "$moddir/dmsquash-live-genrules.sh"

View File

@@ -34,6 +34,14 @@ case "$liveroot" in
root="${root#live:}"
root="live:/dev/disk/by-uuid/${root#UUID=}"
rootok=1 ;;
live:PARTUUID=*|PARTUUID=*) \
root="${root#live:}"
root="live:/dev/disk/by-partuuid/${root#PARTUUID=}"
rootok=1 ;;
live:PARTLABEL=*|PARTLABEL=*) \
root="${root#live:}"
root="live:/dev/disk/by-partlabel/${root#PARTLABEL=}"
rootok=1 ;;
live:/*.[Ii][Ss][Oo]|/*.[Ii][Ss][Oo])
root="${root#live:}"
root="liveiso:${root}"

View File

@@ -47,7 +47,8 @@ installkernel() {
if [[ "$(uname -p)" == arm* ]]; then
# arm specific modules
hostonly='' instmods sdhci_esdhc_imx mmci sdhci_tegra mvsdio omap omapdrm \
omap_hsmmc panel-tfp410 sdhci_dove ahci_platform pata_imx sata_mv
omap_hsmmc panel-tfp410 sdhci_dove ahci_platform pata_imx sata_mv \
ehci-tegra
fi
# install virtual machine support
@@ -60,8 +61,7 @@ installkernel() {
# if the required list is not set via the filesystems variable
if ! [[ $hostonly ]]; then
if [[ -z $filesystems ]]; then
omit_drivers="${omit_drivers}|kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd" \
omit_drivers="${omit_drivers##|}" \
silent_omit_drivers="kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd" \
instmods '=fs'
fi
else
@@ -74,8 +74,8 @@ installkernel() {
}
install() {
dracut_install -o /lib/modprobe.d/*.conf
[[ $hostonly ]] && dracut_install -o /etc/modprobe.d/*.conf /etc/modprobe.conf
inst_multiple -o /lib/modprobe.d/*.conf
[[ $hostonly ]] && inst_multiple -o /etc/modprobe.d/*.conf /etc/modprobe.conf
if ! dracut_module_included "systemd"; then
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
fi

View File

@@ -108,9 +108,9 @@ if [ -n "$LVS" ] ; then
info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
lvm lvscan --ignorelockingfailure 2>&1 | vinfo
if [ -z "$sysinit" ]; then
lvm lvchange -ay --ignorelockingfailure $nopoll --ignoremonitoring $LVS 2>&1 | vinfo
lvm lvchange --yes -ay --ignorelockingfailure $nopoll --ignoremonitoring $LVS 2>&1 | vinfo
else
lvm lvchange -ay $sysinit $LVS 2>&1 | vinfo
lvm lvchange --yes -ay $sysinit $LVS 2>&1 | vinfo
fi
fi
@@ -125,7 +125,7 @@ if [ -z "$LVS" -o -n "$VGS" ]; then
fi
if [ "$lvmwritten" ]; then
rm -f /etc/lvm/lvm.conf
rm -f -- /etc/lvm/lvm.conf
fi
unset lvmwritten

View File

@@ -22,32 +22,43 @@ depends() {
return 0
}
install() {
local _i
local _needthin
get_host_lvs() {
local _activated
declare -A _activated
for dev in "${!host_fs_types[@]}"; do
[ -e /sys/block/${dev#/dev/}/dm/name ] || continue
[ -e /sys/block/${dev#/dev/}/dm/uuid ] || continue
uuid=$(</sys/block/${dev#/dev/}/dm/uuid)
[[ "${uuid#LVM-}" == "$uuid" ]] && continue
dev=$(</sys/block/${dev#/dev/}/dm/name)
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
if ! [[ ${_activated[${DM_VG_NAME}/${DM_LV_NAME}]} ]]; then
printf "%s\n" "${DM_VG_NAME}/${DM_LV_NAME} "
_activated["${DM_VG_NAME}/${DM_LV_NAME}"]=1
fi
done
}
cmdline() {
get_host_lvs | while read line; do
printf " rd.lvm.lv=$line"
done
}
install() {
local _i _needthin
inst lvm
check_lvm() {
local DM_VG_NAME DM_LV_NAME DM_UDEV_DISABLE_DISK_RULES_FLAG
eval $(udevadm info --query=property --name=$1 | egrep '(DM_VG_NAME|DM_LV_NAME|DM_UDEV_DISABLE_DISK_RULES_FLAG)=')
[[ "$DM_UDEV_DISABLE_DISK_RULES_FLAG" = "1" ]] && return 1
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
if ! strstr " ${_activated[*]} " " ${DM_VG_NAME}/${DM_LV_NAME} "; then
if ! [[ $kernel_only ]]; then
echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf"
fi
push _activated "${DM_VG_NAME}/${DM_LV_NAME}"
fi
get_host_lvs | while read line; do
printf "%s" " rd.lvm.lv=$line"
if ! [[ $_needthin ]]; then
[[ $(lvs --noheadings -o segtype ${DM_VG_NAME}) == *thin* ]] && _needthin=1
[[ "$(lvs --noheadings -o segtype ${line%%/*} 2>/dev/null)" == *thin* ]] && _needthin=1
fi
return 0
}
for_each_host_dev_fs check_lvm
done >> "${initdir}/etc/cmdline.d/90lvm.conf"
echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
inst_rules "$moddir/64-lvm.rules"
@@ -61,10 +72,22 @@ install() {
fi
fi
if ! [[ -e ${initdir}/etc/lvm/lvm.conf ]]; then
mkdir -p "${initdir}/etc/lvm"
{
echo 'global {'
echo 'locking_type = 4'
echo 'use_lvmetad = 0'
echo '}'
} > "${initdir}/etc/lvm/lvm.conf"
fi
inst_rules 11-dm-lvm.rules
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
# files, but provides the one below:
inst_rules 64-device-mapper.rules
# debian udev rules
inst_rules 56-lvm.rules 60-persistent-storage-lvm.rules
inst_script "$moddir/lvm_scan.sh" /sbin/lvm_scan
inst_hook cmdline 30 "$moddir/parse-lvm.sh"
@@ -72,7 +95,7 @@ install() {
inst_libdir_file "libdevmapper-event-lvm*.so"
if [[ $_needthin ]]; then
dracut_install -o thin_dump thin_restore thin_check
inst_multiple -o thin_dump thin_restore thin_check thin_repair
fi
}

View File

@@ -2,7 +2,7 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if [ -e /etc/lvm/lvm.conf ] && ! getargbool 1 rd.lvm.conf -d -n rd_NO_LVMCONF; then
rm -f /etc/lvm/lvm.conf
rm -f -- /etc/lvm/lvm.conf
fi
LV_DEVS="$(getargs rd.lvm.vg -d rd_LVM_VG=) $(getargs rd.lvm.lv -d rd_LVM_LV=)"
@@ -10,7 +10,7 @@ LV_DEVS="$(getargs rd.lvm.vg -d rd_LVM_VG=) $(getargs rd.lvm.lv -d rd_LVM_LV=)"
if ! getargbool 1 rd.lvm -d -n rd_NO_LVM \
|| ( [ -z "$LV_DEVS" ] && ! getargbool 0 rd.auto ); then
info "rd.lvm=0: removing LVM activation"
rm -f /etc/udev/rules.d/64-lvm*.rules
rm -f -- /etc/udev/rules.d/64-lvm*.rules
else
for dev in $LV_DEVS; do
wait_for_dev "/dev/$dev"

View File

@@ -11,6 +11,4 @@ _do_mdmon_takeover() {
if command -v mdmon >/dev/null; then
_do_mdmon_takeover $1
else
:
fi

View File

@@ -26,32 +26,37 @@ installkernel() {
instmods =drivers/md
}
cmdline() {
local _activated dev line UUID
declare -A _activated
for dev in "${!host_fs_types[@]}"; do
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
UUID=$(
/sbin/mdadm --examine --export $dev \
| while read line; do
[[ ${line#MD_UUID=} = $line ]] && continue
printf "%s" "${line#MD_UUID=} "
done
)
if ! [[ ${_activated[${UUID}]} ]]; then
printf "%s" " rd.md.uuid=${UUID}"
_activated["${UUID}"]=1
fi
done
}
install() {
dracut_install cat
dracut_install -o mdmon
inst_multiple cat
inst_multiple -o mdmon
inst $(command -v partx) /sbin/partx
inst $(command -v mdadm) /sbin/mdadm
check_mdraid() {
local dev=$1 fs=$2 holder DEVPATH MD_UUID
[[ "$fs" != *_raid_member ]] && return 1
MD_UUID=$(/sbin/mdadm --examine --export $dev \
| while read line; do
[[ ${line#MD_UUID} = $line ]] && continue
eval "$line"
echo $MD_UUID
break
done)
[[ ${MD_UUID} ]] || return 1
if ! [[ $kernel_only ]]; then
echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf"
fi
return 0
}
for_each_host_dev_fs check_mdraid
cmdline >> "${initdir}/etc/cmdline.d/90mdraid.conf"
echo >> "${initdir}/etc/cmdline.d/90mdraid.conf"
inst_rules 64-md-raid.rules
# remove incremental assembly from stock rules, so they don't shadow

View File

@@ -32,11 +32,11 @@ fi
if [ -e /etc/mdadm.conf ] && getargbool 1 rd.md.conf -d -n rd_NO_MDADMCONF; then
udevproperty rd_MDADMCONF=1
rm -f $hookdir/pre-pivot/*mdraid-cleanup.sh
rm -f -- $hookdir/pre-pivot/*mdraid-cleanup.sh
fi
if ! getargbool 1 rd.md.conf -d -n rd_NO_MDADMCONF; then
rm -f /etc/mdadm/mdadm.conf /etc/mdadm.conf
rm -f -- /etc/mdadm/mdadm.conf /etc/mdadm.conf
ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
fi

View File

@@ -69,7 +69,7 @@ installkernel() {
install() {
local _f
dracut_install -o \
inst_multiple -o \
dmsetup \
kpartx \
mpath_wait \
@@ -87,7 +87,7 @@ install() {
inst_libdir_file "libmultipath*" "multipath/*"
if dracut_module_included "systemd"; then
dracut_install \
inst_multiple \
$systemdsystemunitdir/multipathd.service
mkdir -p "${initdir}${systemdsystemconfdir}/sysinit.target.wants"
ln -rfs "${initdir}${systemdsystemunitdir}/multipathd.service" "${initdir}${systemdsystemconfdir}/sysinit.target.wants/multipathd.service"
@@ -95,6 +95,9 @@ install() {
inst_hook pre-trigger 02 "$moddir/multipathd.sh"
inst_hook cleanup 02 "$moddir/multipathd-stop.sh"
fi
inst_hook cleanup 80 "$moddir/multipathd-needshutdown.sh"
inst_rules 40-multipath.rules 62-multipath.rules 65-multipath.rules 66-kpartx.rules
}

View File

@@ -0,0 +1,9 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
for i in /dev/mapper/mpath*; do
[ -b "$i" ] || continue
need_shutdown
break
done

View File

@@ -7,6 +7,6 @@ if [ -e /etc/multipath.conf ]; then
multipathd -B || multipathd
need_shutdown
else
rm /etc/udev/rules.d/??-multipath.rules 2>/dev/null
rm -- /etc/udev/rules.d/??-multipath.rules 2>/dev/null
fi

View File

@@ -14,6 +14,6 @@ depends() {
}
install() {
dracut_install gpg
inst_multiple gpg
inst "$moddir/crypt-gpg-lib.sh" "/lib/dracut-crypt-gpg-lib.sh"
}

View File

@@ -13,7 +13,7 @@ installkernel() {
}
install() {
dracut_install losetup
inst_multiple losetup
inst "$moddir/crypt-loop-lib.sh" "/lib/dracut-crypt-loop-lib.sh"
dracut_need_initqueue
}

View File

@@ -21,6 +21,6 @@ echo options: $options
mount.cifs //$server/$path $NEWROOT -o $options && { [ -e /dev/root ] || ln -s null /dev/root ; }
# inject new exit_if_exists
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/cifs.sh
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm -f -- "$job"' > $hookdir/initqueue/cifs.sh
# force udevsettle to break
> $hookdir/initqueue/work

View File

@@ -28,8 +28,8 @@ installkernel() {
install() {
local _i
local _nsslibs
dracut_install -o mount.cifs
dracut_install /etc/services /etc/nsswitch.conf /etc/protocols
inst_multiple -o mount.cifs
inst_multiple /etc/services /etc/nsswitch.conf /etc/protocols
inst_libdir_file 'libcap-ng.so*'

View File

@@ -18,7 +18,7 @@ installkernel() {
install() {
inst_hook cmdline 30 "$moddir/parse-dasd.sh"
dracut_install dasdinfo dasdconf.sh normalize_dasd_arg
inst_multiple dasdinfo dasdconf.sh normalize_dasd_arg
if [[ $hostonly ]]; then
inst /etc/dasd.conf
fi

View File

@@ -4,7 +4,7 @@
for dasd_arg in $(getargs rd.dasd= -d rd_DASD= DASD=); do
(
IFS=","
set $dasd_arg
set -- $dasd_arg
echo "$@" | normalize_dasd_arg >> /etc/dasd.conf
)
done

View File

@@ -19,6 +19,6 @@ installkernel() {
install() {
inst_hook cmdline 31 "$moddir/parse-dasd-mod.sh"
dracut_install dasd_cio_free grep sed seq
inst_multiple dasd_cio_free grep sed seq
}

View File

@@ -12,7 +12,7 @@ depends() {
}
install() {
dracut_install -o ps grep more cat rm strace free showmount \
inst_multiple -o ps grep more cat rm strace free showmount \
ping netstat rpcinfo vi scp ping6 ssh \
fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck

View File

@@ -25,7 +25,7 @@ installkernel() {
}
install() {
dracut_install ip dcbtool fipvlan lldpad readlink
inst_multiple ip dcbtool fipvlan lldpad readlink
mkdir -m 0755 -p "$initdir/var/lib/lldpad"

View File

@@ -10,19 +10,21 @@ check() {
# If hostonly was requested, fail the check if we are not actually
# booting from root.
is_iscsi() (
is_iscsi() {
local _dev=$1
[[ -L /sys/dev/block/$_dev ]] || return
cd "$(readlink -f /sys/dev/block/$_dev)"
[[ -L "/sys/dev/block/$_dev" ]] || return
cd "$(readlink -f "/sys/dev/block/$_dev")"
until [[ -d sys || -d iscsi_session ]]; do
cd ..
done
[[ -d iscsi_session ]]
)
}
[[ $hostonly ]] || [[ $mount_needs ]] && {
pushd . >/dev/null
for_each_host_dev_and_slaves is_iscsi || return 1
popd >/dev/null
}
return 0
}
@@ -34,7 +36,8 @@ depends() {
installkernel() {
local _arch=$(uname -m)
instmods iscsi_tcp iscsi_ibft crc32c bnx2i iscsi_boot_sysfs qla4xxx cxgb3i cxgb4i be2iscsi
instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi
hostonly="" instmods iscsi_tcp iscsi_ibft crc32c iscsi_boot_sysfs
iscsi_module_filter() {
local _funcs='iscsi_register_transport'
# subfunctions inherit following FDs
@@ -73,8 +76,8 @@ installkernel() {
}
install() {
dracut_install umount iscsistart hostname iscsi-iname
dracut_install -o iscsiuio
inst_multiple umount iscsistart hostname iscsi-iname
inst_multiple -o iscsiuio
inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"

View File

@@ -31,12 +31,12 @@ installkernel() {
install() {
local _i
local _nsslibs
dracut_install -o portmap rpcbind rpc.statd mount.nfs \
inst_multiple -o portmap rpcbind rpc.statd mount.nfs \
mount.nfs4 umount rpc.idmapd sed /etc/netconfig
dracut_install /etc/services /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/idmapd.conf
inst_multiple /etc/services /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/idmapd.conf
if [ -f /lib/modprobe.d/nfs.conf ]; then
dracut_install /lib/modprobe.d/nfs.conf
inst_multiple /lib/modprobe.d/nfs.conf
else
[ -d $initdir/etc/modprobe.d/ ] || mkdir $initdir/etc/modprobe.d
echo "alias nfs4 nfs" > $initdir/etc/modprobe.d/nfs.conf

View File

@@ -21,7 +21,7 @@ mount_nfs $root $NEWROOT $netif && { [ -e /dev/root ] || ln -s null /dev/root ;
[ -f $NEWROOT/etc/fstab ] && cat $NEWROOT/etc/fstab > /dev/null
# inject new exit_if_exists
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/nfs.sh
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm -- "$job"' > $hookdir/initqueue/nfs.sh
# force udevsettle to break
> $hookdir/initqueue/work

View File

@@ -2,6 +2,18 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
# No point trying to support resume, if no swap partition exist
[[ $hostonly ]] || [[ $mount_needs ]] && {
for fs in "${host_fs_types[@]}"; do
[[ $fs = swap ]] && return 0
done
return 255
}
return 0
}
install() {
local _bin
# Optional uswsusp support

View File

@@ -17,6 +17,8 @@ case "$resume" in
resume="/dev/disk/by-uuid/${resume#UUID=}" ;;
PARTUUID=*) \
resume="/dev/disk/by-partuuid/${resume#PARTUUID=}" ;;
PARTLABEL=*) \
resume="/dev/disk/by-partlabel/${resume#PARTLABEL=}" ;;
esac
if splash=$(getarg splash=); then
@@ -55,10 +57,10 @@ if [ -n "$resume" ]; then
${resume#/dev/};
} >> /etc/udev/rules.d/99-resume.rules
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm "$job" "%s/initqueue/timeout/resume.sh"; }\n' \
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm -f -- "$job" "%s/initqueue/timeout/resume.sh"; }\n' \
"$resume" "$resume" "$hookdir" >> $hookdir/initqueue/settled/resume.sh
printf 'warn "Cancelling resume operation. Device not found."; cancel_wait_for_dev /dev/resume; rm "$job" "%s/initqueue/settled/resume.sh";' \
printf 'warn "Cancelling resume operation. Device not found."; cancel_wait_for_dev /dev/resume; rm -f -- "$job" "%s/initqueue/settled/resume.sh";' \
"$hookdir" >> $hookdir/initqueue/timeout/resume.sh
wait_for_dev "/dev/resume"

View File

@@ -3,25 +3,6 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
rootopts="defaults"
while read dev mp fs opts dump fsck; do
# skip comments
[ "${dev%%#*}" != "$dev" ] && continue
if [ "$mp" = "/" ]; then
# sanity - determine/fix fstype
rootfs=$(find_mp_fstype /)
rootfs=${rootfs:-$fs}
rootopts=$opts
break
fi
done < /etc/fstab
[ "$rootfs" = "reiserfs" ] && journaldev=$(fs_get_option $rootopts "jdev")
[ "$rootfs" = "xfs" ] && journaldev=$(fs_get_option $rootopts "logdev")
if [ -n "$journaldev" ]; then
echo "root.journaldev=$journaldev" >> "${initdir}/etc/cmdline.d/95root-jurnaldev.conf"
fi
return 0
}
@@ -29,8 +10,35 @@ depends() {
echo fs-lib
}
cmdline() {
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 /)"
fi
}
install() {
dracut_install umount
if [[ $hostonly ]]; then
for dev in "${!host_fs_types[@]}"; do
[[ ${host_fs_types[$dev]} = "reiserfs" ]] || [[ ${host_fs_types[$dev]} = "xfs" ]] || continue
rootopts=$(find_dev_fsopts "$dev")
if [[ ${host_fs_types[$dev]} = "reiserfs" ]]; then
journaldev=$(fs_get_option $rootopts "jdev")
elif [[ ${host_fs_types[$dev]} = "xfs" ]]; then
journaldev=$(fs_get_option $rootopts "logdev")
fi
if [ -n "$journaldev" ]; then
printf "%s\n" "root.journaldev=$journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
fi
done
fi
inst_multiple umount
inst_multiple tr
if ! dracut_module_included "systemd"; then
inst_hook cmdline 95 "$moddir/parse-block.sh"
inst_hook pre-udev 30 "$moddir/block-genrules.sh"

View File

@@ -115,7 +115,6 @@ mount_root() {
umount "$NEWROOT"
fsck_single "${root#block:}" "$rootfs" "$rflags" "$fsckoptions"
_ret=$?
[ $_ret -ne 255 ] && echo $_ret >/run/initramfs/root-fsck
ran_fsck=1
fi
@@ -130,8 +129,8 @@ mount_root() {
fi
if ! getargbool 0 rd.skipfsck; then
[ -f "$NEWROOT"/forcefsck ] && rm -f "$NEWROOT"/forcefsck 2>/dev/null
[ -f "$NEWROOT"/.autofsck ] && rm -f "$NEWROOT"/.autofsck 2>/dev/null
[ -f "$NEWROOT"/forcefsck ] && rm -f -- "$NEWROOT"/forcefsck 2>/dev/null
[ -f "$NEWROOT"/.autofsck ] && rm -f -- "$NEWROOT"/.autofsck 2>/dev/null
fi
}

View File

@@ -10,11 +10,19 @@ case "$root" in
rootok=1 ;;
block:UUID=*|UUID=*)
root="${root#block:}"
root="${root#UUID=}"
root="$(echo $root | tr "[:upper:]" "[:lower:]")"
root="block:/dev/disk/by-uuid/${root#UUID=}"
rootok=1 ;;
block:PARTUUID=*|PARTUUID=*)
root="${root#block:}"
root="block:/dev/disk/by-partuuid/${root#PARTUUID=}"
root="${root#PARTUUID=}"
root="$(echo $root | tr "[:upper:]" "[:lower:]")"
root="block:/dev/disk/by-partuuid/${root}"
rootok=1 ;;
block:PARTLABEL=*|PARTLABEL=*)
root="${root#block:}"
root="block:/dev/disk/by-partlabel/${root#PARTLABEL=}"
rootok=1 ;;
/dev/*)
root="block:${root}"

View File

@@ -47,7 +47,7 @@ inst_sshenv()
}
install() {
dracut_install ssh scp
inst_multiple ssh scp
inst_sshenv
}

View File

@@ -10,7 +10,9 @@ install() {
done
if [ -d ${_terminfodir} ]; then
inst_dir "$_terminfodir"
cp --reflink=auto --sparse=auto -prfL -t "${initdir}/${_terminfodir}" "$_terminfodir"/*
for i in "l/linux" "v/vt100" "v/vt102" "v/vt220"; do
inst_dir "$_terminfodir/${i%/*}"
cp --reflink=auto --sparse=auto -prfL -t "${initdir}/${_terminfodir}/${i%/*}" "$_terminfodir/$i"
done
fi
}

View File

@@ -8,7 +8,7 @@ install() {
# Fixme: would be nice if we didn't have to know 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
dracut_install udevadm cat uname blkid \
inst_multiple udevadm cat uname blkid \
/etc/udev/udev.conf
[ -d ${initdir}/$systemdutildir ] || mkdir -p ${initdir}/$systemdutildir
@@ -31,11 +31,13 @@ install() {
60-pcmcia.rules \
50-udev.rules 95-late.rules \
50-firmware.rules \
80-net-name-slot.rules \
75-net-description.rules 80-net-name-slot.rules \
"$moddir/59-persistent-storage.rules" \
"$moddir/61-persistent-storage.rules"
prepare_udev_rules 59-persistent-storage.rules 61-persistent-storage.rules
# debian udev rules
inst_rules 91-permissions.rules
{
for i in cdrom tape dialout floppy; do
@@ -52,7 +54,7 @@ install() {
done
} >> "$initdir/etc/group"
dracut_install -o \
inst_multiple -o \
${udevdir}/ata_id \
${udevdir}/cdrom_id \
${udevdir}/create_floppy_devices \
@@ -70,7 +72,7 @@ install() {
${udevdir}/pcmcia-socket-startup \
${udevdir}/pcmcia-check-broken-cis
dracut_install -o /etc/pcmcia/config.opts
inst_multiple -o /etc/pcmcia/config.opts
[ -f /etc/arch-release ] && \
inst_script "$moddir/load-modules.sh" /lib/udev/load-modules.sh

View File

@@ -66,8 +66,8 @@ mount_root() {
info "Remounting ${root#virtfs:} with -o ${rflags}"
mount -t ${rootfs} -o "$rflags" "${root#virtfs:}" "$NEWROOT" 2>&1 | vinfo
[ -f "$NEWROOT"/forcefsck ] && rm -f "$NEWROOT"/forcefsck 2>/dev/null
[ -f "$NEWROOT"/.autofsck ] && rm -f "$NEWROOT"/.autofsck 2>/dev/null
[ -f "$NEWROOT"/forcefsck ] && rm -f -- "$NEWROOT"/forcefsck 2>/dev/null
[ -f "$NEWROOT"/.autofsck ] && rm -f -- "$NEWROOT"/.autofsck 2>/dev/null
}
if [ -n "$root" -a -z "${root%%virtfs:*}" ]; then

View File

@@ -22,7 +22,7 @@ installkernel() {
install() {
inst_hook cmdline 30 "$moddir/parse-zfcp.sh"
dracut_install zfcp_cio_free grep sed seq
inst_multiple zfcp_cio_free grep sed seq
inst_script /sbin/zfcpconf.sh
inst_rules 56-zfcp.rules

View File

@@ -20,6 +20,6 @@ installkernel() {
install() {
inst_hook cmdline 30 "$moddir/parse-ccw.sh"
inst_rules 81-ccw.rules
dracut_install znet_cio_free grep sed seq readlink /lib/udev/ccw_init
inst_multiple znet_cio_free grep sed seq readlink /lib/udev/ccw_init
}

View File

@@ -5,6 +5,6 @@
SECURITYFSDIR="/sys/kernel/security"
export SECURITYFSDIR
if ! findmnt "${SECURITYFSDIR}" >/dev/null 2>&1; then
if ! findmnt --target "${SECURITYFSDIR}" >/dev/null 2>&1; then
mount -t securityfs -o nosuid,noexec,nodev securityfs ${SECURITYFSDIR} >/dev/null 2>&1
fi

View File

@@ -13,7 +13,7 @@ depends() {
}
install() {
dracut_install biosdevname
inst_multiple biosdevname
inst_rules 71-biosdevname.rules
}

View File

@@ -4,7 +4,7 @@
if ! getargbool 1 biosdevname; then
info "biosdevname=0: removing biosdevname network renaming"
udevproperty UDEV_BIOSDEVNAME=
rm -f /etc/udev/rules.d/71-biosdevname.rules
rm -f -- /etc/udev/rules.d/71-biosdevname.rules
else
info "biosdevname=1: activating biosdevname network renaming"
udevproperty UDEV_BIOSDEVNAME=1

View File

@@ -3,7 +3,7 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
[ "$1" = "-h" ] && {
[[ $hostonly ]] && {
[ -x "/bin/keyctl" ] || return 1
}
@@ -19,6 +19,6 @@ installkernel() {
}
install() {
dracut_install keyctl uname
inst_multiple keyctl uname
inst_hook pre-pivot 60 "$moddir/masterkey.sh"
}

View File

@@ -12,6 +12,6 @@ depends() {
install() {
inst_hook pre-pivot 50 "$moddir/selinux-loadpolicy.sh"
dracut_install setenforce
inst_multiple setenforce
}

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