Compare commits

..

571 Commits
042 ... RHEL-7

Author SHA1 Message Date
Lukas Nykryn
6b82776107 net-lib: check if addr exists before checking for dad state
Before we check if dad is done we should first make sure,
that there is a link local address where we do the check.

Due to this issue, on ipv6 only setups sometimes dhclient started
asking for ip address, before the link local address was present
and failed immediately.
2019-10-29 14:47:26 +01:00
Harald Hoyer
57c3103a69 dracut.sh: quote sync file argument 2019-10-22 12:26:15 +02:00
Ankit Kumar
1126a69746 Sync initramfs after creation
If we trigger crash just after creating initramfs, sometimes it is
observed that initramfs is not written to disk causing the subsequent
boot to fail. A sync should resolve this.

Signed-off-by: Ankit Kumar <ankit@linux.vnet.ibm.com>
2019-10-22 12:24:46 +02:00
Lukas Nykryn
6193b3a6e2 rootfs-generator: don't set JobRunningTimeoutSec
We don't have that in rhel7 systemd
2019-08-29 09:40:09 +02:00
Harald Hoyer
e8a7c2a152 network: skip already enslaved interfaces 2019-06-19 14:42:52 +02:00
Lukas Nykryn
65623826c1 fips: split loading the crypto modules and checking the kernel
In e54ab383 we moved the fips script to a later pahse of boot, since
the /boot might not be available early on.

The problem is that systemd-cryptsetup* services could be run now
started before the do_fips is executed and need the crypto modules
to decrypted the devices.

So let's split the do_fips and load the module before udev does the
trigger.
2019-05-14 10:10:33 +02:00
Lukas Nykryn
e42ab58a70 rootfs-generator: rebase to upstream version
Resolves: #1640866
2019-04-25 10:11:58 +02:00
Lukas Nykryn
937b808a0d 95iscsi/iscsiroot: synchronously wait until iscsistart finishes 2019-04-01 17:25:05 +02:00
Renaud Métrich
2ee1e96e1a fips: removed false-positive 'FATAL: Module xxx not found' error message when kernel provides a generic algo for module
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>

Cherry-picked from: 01ffcf342a
Resolves: #1649743
2019-03-27 17:54:57 +01:00
Kairui Song
c6ccef8827 fips: ensure fs module for /boot is installed
When using dracut with  --hostonly and --no-hostonly-default-device,
/boot will be inaccessible as dracut will most fs modules unless
specified. But FIPS require /boot to be accessible, and it will try
to mount it on boot. It will fail if corresponding fs module is missing.

For most case /boot will be a simple partition, include the fs module
will be enough for FIPS to mount it. For other cases users have to pass
extra parameters by themselves.

Suggested-by: Kenneth Dsouza <kdsouza@redhat.com>
Signed-off-by: Kairui Song <kasong@redhat.com>

Cherry-picked from: 8365177644
Resolves: #1672817
2019-03-27 17:51:07 +01:00
Renaud Métrich
97dd467e8e iscsi: always popd, even if there is no iscsi device
Cherry-picked from: 33cfad0b8f
Resolves: #1684474
2019-03-27 17:47:42 +01:00
Renaud Métrich
fc87cf0e7e Harden dracut against BASH_ENV environment variable
When dracut silently produces a broken initramfs, then the system will
likely not boot and this can be very problematic. Typical use case is
after the kernel has been updated.

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

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

Signed-off-by: Renaud Métrich <rmetrich@redhat.com>

Cherry-picked from: c1c78f8a91
Resolves: #1588483
2019-02-25 10:49:10 +01:00
Renaud Métrich
75d6e4366a fips: check fips integrity just before mounting local filesystems in /sysroot
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>

Cherry-picked from: e54ab383f7
Resolves: #1640981
2019-02-25 10:44:50 +01:00
Ondrej Dubaj
d76ccd07bc added make rpm/srpm options 2019-02-12 13:40:19 +01:00
Kairui Song
e5c337c3b3 kernel-modules: add nfit
To support pmem devices, nfit module is required

Cherry-picked from: 09ba1b289f
Resolves: #1288619
2018-09-27 15:26:09 +02:00
Lukas Nykryn
e4034dcae3 dracut-functions: fix the word splitting
Cherry-picked from: dc4f0a40f8fbea23ccd1e0fcde48d5c6f7996021
Resolves: #1607744
2018-08-09 12:17:50 +02:00
Harald Hoyer
da6411f59c dracut.spec: remove 90multipath-hostonly
Cherry-picked from: ca77afdeb3
Resolves: #1599592
2018-07-30 14:49:39 +02:00
Lukas Nykryn
af97814e42 Revert "add 90multipath-hostonly module"
This reverts commit 6ef3173e86.

Cherry-picked from: 35e86ac117
Resolves: #1599592
2018-07-30 13:55:57 +02:00
Kairui Song
ecd196732f Introduce tri-state hostonly mode
Add a new option --hostonly-mode which accept an <mode> parameter, so we have a tri-state hostonly mode:

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

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

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

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

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

Signed-off-by: Kairui Song <kasong@redhat.com>

Cherry-picked from: a695250ec7
Resolves: #1599592
2018-07-30 13:55:57 +02:00
Christian Rodrigues
5f381a151f Correct paths for openSUSE
openSUSE has things stored in different places, so fixup the
paths here.

Signed-off-by: Christian Rodrigues <crrodriguez@opensuse.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>

Cherry-picked from: b52cfbea
Resolves: #1608491
2018-07-30 13:55:57 +02:00
Kairui Song
8df75b1573 Record loaded kernel modules when hostonly mode is enabled
A hostonly image will not include every possibly required kernel module,
so if any hardware or configuration changed, the image may fail to boot.

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

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

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

lsinitrd $image -f */lib/dracut/loaded-kernel-modules.txt

Cherry-picked from: 7047294617
Resolves: #1607744
2018-07-30 13:55:47 +02:00
Lukas Nykryn
013030d947 40network/dhclient.conf: rename classless-routes to classless-static-routes
We tell dhclient to name 121 option "classless-routes",
but in dhclient-script we parse classless_static_routes.
So either have to change the configuration or the script.

And since dhclient uses by default classless_static_routes,
let's change the configuration

Cherry-picked from: 62b7920ed
Resolves: #1453907
2018-06-21 15:21:50 +02:00
Xunlei Pang
f055e5126f fcoe: handle CNAs with DCB firmware support
Some Combined Network Adapters(CNAs) implement DCB protocol
in firmware, it is recommended that do not run software-based
DCB or LLDP on CNAs that implement DCB, but we have to start
the lldpad service anyway(there might be other software DCB).

If the network interface provides hardware DCB/DCBX capabilities,
the field DCB_REQUIRED in "/etc/fcoe/cfg-xxx" is expected to
be set to "no".

We met an issue on "QLogic BCM57810" with DCB firmware support,
and found dracut still generated "fcoe=<mac>:dcb" which caused
kdump boot failure when using that fcoe dump target.

This patch parses /etc/fcoe/cfg-xxx to detect DCB_REQUIRED="no",
and force "nodcb" if it is the case.

Also improved some coding style in passing.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>

Cherry-picked from: 795256bbb
Resolves: #1442663
2018-06-20 12:04:47 +02:00
Harald Hoyer
c9e0ee2c91 mdraid: wait for rd.md.uuid specified devices to be assembled
This patch uses wait_for_dev "/dev/disk/by-id/md-uuid-${uuid}" for the
specified uuids.

On timeout only md devices are force started which are specified by
uuid, or all, if rd.auto was specified.

Fixes https://github.com/dracutdevs/dracut/issues/227

Cherry-picked from: 3cea0658
Resolves: #1451660
2018-06-20 11:13:33 +02:00
NeilBrown
f421aa0f16 mdraid/mdraid_start.sh: tell mainloop if we make progress.
mdraid_start is a number of scripts which run after a timeout.
If it makes progress, it should tell the main loop so that it
knows that it is worth waiting a bit longer.

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

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

Cherry-picked from: 3b82ac16
Resolves: #1451660
2018-06-20 11:13:24 +02:00
Thomas Renninger
125bb747c3 dracut: Introduce --force-drivers parameter and force_drivers=+ config option
Which will not only add listed drivers, but also enforce that they are
tried to be loaded at early boot time.

This is needed if drivers which are not autoloaded (e.g. loop and a lot
others) shall get loaded via initramfs.

Cherry-picked from: cea907f6bf
Resolves: #1577626
2018-06-20 10:55:59 +02:00
Derek Higgins
903d6fc2fc Skip iscsi attachment if no info
If no iscsi session information can be retrieved from the firmware
then skip the iscsi attachment and allow the boot process to continue.
Ensure the timeout scripts don't hit their timeout waiting for
/tmp/iscsistarted-firmware to be created.
This will allow a common image to be used for servers with both a
local and iscsi root with rd.iscsi.firmware set.

Cherry-picked from: 9408a2ac33
Resolves: #1513397
2018-06-20 10:53:44 +02:00
Fabian Vogt
249dcc61ea Fix loading of modules in modules-load.d
With hostonly enabled, only modules that are currently
loaded are included in the initrd. Modules which are
explicitly listed in modules-load.d do not need to
be filtered that way. Fix for boo#962224.

Cherry-picked from: 9fd3e045d
Resolves: #1547730
2018-06-20 10:23:22 +02:00
Pingfan Liu
26273649dc 40network: introduce ip=either6 option
In kdump, if dump-target is ssh on ipv6, we need to sync until ipv6 addr
is ready. Currently ip=auto6/dhcp6 provides such function. But in 1st kernel,
it is hard to know whether the ipv6 addr is got by dhcpv6 or SLAAC.
E.g ifcfg-eth* contains DHCPV6C=yes direction, but there is no dhcpv6
server in the network, and then after the system is up, the user
echo 1 > /proc/sys/net/ipv6/conf/eth0/autoconf && accept_ra by manual
to obtain a ipv6 addr. Or vice.
So this patch suggests to make dhcpv6 as auto6 fallback

Signed-off-by: Pingfan Liu <piliu@redhat.com>

Cherry-picked from: 67354ee
Resolves: #1582398
2018-06-14 13:41:09 +02:00
Harald Hoyer
15384bcedb dracut-functions.sh:check_vol_slaves() speedup LV -> VG name
Instead of trying all /dev/mapper/* devices to match the maj:min, and
get the VG name with "lvm lvs", use the dm/name from /sys and dmsetup
splitname.

This should speedup execution with lots of LVs.

Cherry-picked from: 9ed6eb741
Resolves: #1531503
2018-06-14 10:29:19 +02:00
Harald Hoyer
dd235965dd dracut-function.sh:check_block_and_slaves() check for block devices
Some nvme have char parents, so check if the "slave" is a block dev.

Fixes https://github.com/dracutdevs/dracut/issues/373

Cherry-picked from: e64dafd1f2
Resolves: #1549498
2018-06-11 12:37:37 +02:00
Lukas Nykryn
388c771a28 net-lib: bump carrier timeout to 15
df95b10 caused that dracut now waits only 5 seconds for carrier.
Let's bump this in downstream to avoid regressions in minor versions.

RHEL-only
Resolves: #1401811
2018-06-11 12:30:07 +02:00
Lukas Nykryn
f264cfbe8a dracut.sh: workaround broken read from /proc/modules
RHEL-only (upstream is using libkmod)
Resolves: #1578222
2018-06-11 12:17:20 +02:00
Lukas Nykryn
de688a407c 90lvm: always add dm-snapshot
Resolves: #1546577
2018-02-19 16:09:53 +01:00
Alexander Tsoy
58a5434f75 base/dracut-lib.sh:dev_unit_name() guard against $dev beginning with "-"
crypt/parse-crypt.sh generate initqueue job which always call
dev_unit_name() with an argument beginning with "-". This results
in the following error:

dracut-initqueue[307]: + systemd-escape -p -cfb4aa43-2f02-4c6b-a313-60ea99288087
dracut-initqueue[307]: systemd-escape: invalid option -- 'c'

Cherry-picked from: c41df7e1
Resolves: #1306640
2018-02-01 14:04:41 +01:00
Alexander Tsoy
9dfcc5f066 base/dracut-lib.sh: remove bashism
Cherry-picked from: 13efce5d
Resolves: #1306640
2018-02-01 14:04:41 +01:00
Thorsten Behrens
014a78261d Align dev_unit_name() with systemd's function.
Add more corner cases from systemd's
unit_name_from_path_instance() C function.

Signed-off-by: Thorsten Behrens <tbehrens@suse.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>

Cherry-picked from: e3eec4b8
Resolves: #1306640
2018-02-01 14:04:41 +01:00
Harald Hoyer
e8ffd4b3d4 dracut-lib.sh:dev_unit_name(): use systemd-escape, if available
Cherry-picked from: 85752f0f
Resolves: #1306640
2018-02-01 14:04:41 +01:00
Lukas Nykryn
19da2dda22 90dmsquash-live-ntfs: fix depends()
Dependencies should not include module number.

Cherry-picked from: f3e09bf1cb
Resolves: #1449410
2018-02-01 12:48:55 +01:00
Lukas Nykryn
5aadb10791 90dmsquash-live: we don't have find_binary inside initramdisk
Cherry-picked from: c42c387cca
Resolves: #1449410
2018-02-01 12:48:05 +01:00
Erwan Velu
7812b7a7b0 dracut: Ajusting variables name for --include
When reading the --include part of the script, we had the following
issues to make the code easy to read:
- src & tgt were extract for the original options
- i variable was a file or a directory from src
- s variable was the directory name in case $i was a directory

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

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

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

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

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

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

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

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

My 2 (semantic) cents,

Cherry-picked from: c9364f6ea2
Resolves: #1489882
2018-01-11 16:11:08 +01:00
Lukas Nykryn
69a889ee67 01fips: Properly fix creating path to .hmac of kernel based on BOOT_IMAGE
8f5c5 broke the case where BOOT_IMAGE is not set at all.
This code should handle following:
1) BOOT_IMAGE not set
2) BOOT_IMAGE set to something unrelated (s390)
3) BOOT_IMAGE=vmlinuz-4.14.7-300.fc27.x86_64
4) BOOT_IMAGE=/vmlinuz-4.14.7-300.fc27.x86_64
5) BOOT_IMAGE=/boot/vmlinuz-4.14.7-300.fc27.x86_64
6) BOOT_IMAGE=subdir/vmlinuz-4.14.7-300.fc27.x86_64
7) BOOT_IMAGE=/subdir/vmlinuz-4.14.7-300.fc27.x86_64
8) BOOT_IMAGE=/boot/subdir/vmlinuz-4.14.7-300.fc27.x86_64

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

Cherry-picked from: d818986db4
Resolves: #1415032
2018-01-03 10:57:10 +01:00
Lukas Nykryn
9b1d79993d 01fips: Fix creating path to .hmac of kernel based on BOOT_IMAGE
Old code did not work for two most common use-cases.
On most machines BOOT_IMAGE is set to something like
/vmlinuz-4.11.3-202.fc25.x86_64. So if we just add prefix "/boot/."
it won't work. Also on machines without /boot on separate partition
BOOT_IMAGE already has the /boot/ prefix (/boot/vmlinuz-3.10.0-799.el7.x86_64).
So let's strip it in such case.

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

Cherry-picked from: 8f5c564cb3
Resolves: #1415032
2017-12-18 16:13:37 +01:00
Daniel Molkentin
a0e7bc11c8 Simplify microcode lookup for for AMD CPUs
Suggested by Tom Lendacky <thomas.lendacky@amd.com>

Cherry-picked from: 19453dc874
Resolves: #1476039
2017-12-18 09:52:39 +01:00
Daniel Molkentin
f93c34935f Support Microcode Updates for AMD CPU Family 0x17
Original-Patch-By: Tom Lendacky <thomas.lendacky@amd.com>

Cherry-picked from: 215fe58324
Resolves: #1476039
2017-12-18 09:52:34 +01:00
Harald Hoyer
e076279d38 dracut.sh: remove quotes from install_items and install_optional_items
Unfortunately these are lists with whitespaces.

Cherry-picked from: 3c00189988
Resolves: #1520721
2017-12-13 16:41:45 +01:00
Pingfan Liu
43d6b9d008 dracut.sh: for_each_host_xx() function should indicate the empty case
The caller of "for_each_host_xx func" needs to tell three cases:
func success/ fail / not be called.
E.g, in kdump case, host_devs can be empty, and we want to know it.

Signed-off-by: Pingfan Liu <piliu@redhat.com>

Cherry-picked from: e6199960d9
Resolves: #1520721
2017-12-08 14:54:15 +01:00
Harald Hoyer
69b5de6251 guard ${arrays[@]} with ""
Cherry-picked from: 3721635b2c
Resolves: #1520721
2017-12-08 14:54:02 +01:00
Harald Hoyer
0259f1c246 network/ifup: don't arping for point-to-point connections
https://bugzilla.redhat.com/show_bug.cgi?id=1477339

Cherry-picked from: 5abd692fe4
Resolves: #1477339
2017-11-03 14:10:54 +01:00
Javier Martinez Canillas
240c2fea10 network: Only bring up wired network interfaces
The dracut network module is only supposed to be used for wired interfaces
but if driver modules for wireless devices are wrongly copied, these will
be loaded and the available interfaces brought up.

If the rd.neednet=1 command line parameter is used, dhclient will attempt
to request an IP address for the interfaces and these requests will fail.

But other dracut modules that depend on the network to be settled, will
have to wait for the DHCP requests to timeout. Which can be a lot of time
since the dhclient default timeout value is 60 seconds.

Instead of trying to blacklist all possible kernel modules for wireless
devices, only bring up network interfaces if these are for wired devices.

Suggested-by: Harald Hoyer <harald@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>

Cherry-picked from: 1792759721
Resolves: #1480246
2017-11-03 14:03:43 +01:00
Harald Hoyer
75bf5df420 dracut.sh: source dracut-version.sh earlier than dracut-functions.sh
Otherwise dracut-logger.sh outputs an empty version on journal testing.

Aug 20 10:15:49 lenovo dracut[11144]: dracut-
Aug 20 10:15:49 lenovo dracut[11148]: Executing: /sbin/dracut

Cherry-picked from: e27ecc9ae8
Resolves: #1490777
2017-11-03 14:01:42 +01:00
Robert LeBlanc
50c3405ce0 Fix MTU on bond interface.
The MTU is only being set on the slave devices and the MTU of the
bonding master is not being updated. This updates the bonding master and
also changes the MTU on the slaves as expected.

Signed-Off-By: Robert LeBlanc <robert@leblancnet.us>

Cherry-picked from: d0eabcab43
Resolves: #1494265
2017-11-03 13:39:32 +01:00
Imran Haider
50d75a50fb add 'mtu' parameter for bond options
Signed-off-by: Imran Haider <imran1008@gmail.com>

Cherry-picked from: 292548be6e
Resolves: #1494265
2017-11-03 13:39:28 +01:00
Chad Dupuis
3d1c9a76e7 fcoe: Allow more time for the bnx2x link negotiation before brining up fcoe interfaces.
bnx2x can take no longer than 3 seconds to initialize the link in some setups
which can cause fipvlan to fail and thus the fcoe interface(s) won't be
created.

Add another 10 seconds to give the link enough time to initialize.

Signed-off-by: Chad Dupuis <chad.dupuis@cavium.com>

Cherry-picked from: 3966a1e1ee
Resolves: #1378910
2017-11-03 13:30:53 +01:00
Bryn M. Reeves
0fe8ed5ccb lvm_scan.sh: use -K when calling lvchange
The --ignoreactivationskip/-K switch was added to LVM2 in 2.02.99
(July 2013) and is used to control the activation of volumes with
the activation skip flag set: without -K these volumes will be
ignored when 'lvchange -ay $LV' is issued.

This prevents an LVM2 thin-privisioned snapshot from being used
as the root device when booting with rd.lvm.lv=vg/lv since the
activation skip flag is set for these snapshots by default (the
legacy non-thinp snapshots do not set this flag and can already
be activated and used as a root device by specifying appropriate
values for rd.lvm.lv).

This is only used in the rd.lvm.lv case since in that situation
we are activating one or more named LVs specified by the user:
the flag is not given when calling 'vgchange' since this may
cause many unwanted volumes to be activated during early user
space. Users wishing to use a specific snapshot volume should
specify it with 'rd.lvm.lv'.

Cherry-picked from: cc4e507322
Resolves: #1489841
2017-11-03 13:16:57 +01:00
Yu Watanabe
fe89c8f9df spec: add missing modules
Cherry-picked from: ad3b209d40
Resolves: #1457311
2017-11-02 13:10:13 +01:00
Harald Hoyer
6ef3173e86 add 90multipath-hostonly module
hardcoding the wwid of the drives in the initramfs causes problems
when the drives are cloned to a system with the same hardware, but
different disk wwid's

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

Cherry-picked from: 5ce7cc7337
Resolves: #1457311
2017-11-02 13:07:43 +01:00
Robert Scheck
015d5aee92 Add NTFS support to 90dmsquash-live module
Support booting from USB media with NTFS filesystem (optionally),
which removes the FAT32 related 4 GB file size limit for LiveOS/
squashfs.img (and any other file on the same USB media).

Backports 37437cac8a from dracut 046
2017-11-02 13:06:22 +01:00
Lukas Nykryn
0489607bf6 dracut.sh: gather host_modalias when "--no-hostonly-default-device" is set
rhel-only
Related: #1483838
2017-10-27 14:36:26 +02:00
Lukas Nykryn
e2afcc958b rootfs-block/module-setup.sh: check root_dev in cmdline_rootfs()
In case of "--no-hostonly-default-device", we do not need
the root device, thus add this check.

Reimplementation of upstream commit 5634a31156

Resolves: #1483838
2017-10-26 13:50:17 +02:00
Xunlei Pang
0e842c4b8b dracut.sh: introduce "--no-hostonly-default-device" argument
Kdump doesn't need default host devices like root, swap, fstab, etc,
we only care about the dump target which can be added via "--mount"
or "--add-device". We met several issues that kdump kernel failed
due to one of those host devices added by dracut, additionally, the
needless devices(e.g. LVM) consume some appreciable amount of memory
which is more likely to cause OOM under memory-limited kdump.

So this patch introduced "--no-hostonly-default-device" to avoid
adding those default devices as host_devs.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>

Cherry-picked from: 37f2fe55d
Resolves: #1483838
2017-10-26 12:25:37 +02:00
Harald Hoyer
063d6acb7b 10i18n/parse-i18n.sh: parse rd.vconsole and rd.locale
and removed systemd part, because parse-i18n.sh is not even installed in
systemd driven initramfs images.

Cherry-picked from: 6c8fc6e377
Resolves: #1479325
2017-09-20 14:56:41 +02:00
Harald Hoyer
8131fd3c11 dracut.cmdline: remove extra ":" from ip= doc
Cherry-picked from: 0a7d7f6310
Resolves: #1469997
2017-09-20 14:44:26 +02:00
Harald Hoyer
744afe7531 Try BOOT_IMAGE and fallback to vmlinuz-${KERNEL}
On s390 BOOT_IMAGE only denotes the number of the boot record that
was selected in the bootloader and not the path to the kernel image.

Also only bail out, if the kernel hmac checking relies on that path.

Cherry-picked from: 3d875f77f3
Resolves: #1415032
2017-09-20 10:34:17 +02:00
Harald Hoyer
17092b128c fips: honor $BOOT_IMAGE variable for HMAC check of the kernel
https://bugzilla.redhat.com/show_bug.cgi?id=1415032

Cherry-picked from: 4693daa5fa
Resolves: #1415032
2017-09-20 10:34:07 +02:00
Lukas Nykryn
7b9bbc2a82 01fips: add authenec module
Resolves: #1465946
2017-06-28 16:10:48 +02:00
Lukas Nykryn
994a6cdd88 95iscsi: run iscsistart with DefaultDependencies=no
In upstream part of 7e51a94f5b

Resolves: #1461234
2017-06-15 14:01:13 +02:00
Lukas Nykryn
3674e2e16f fips: add cmac kernel module
cmac is now marked as fips_allowed

Resolves: rhbz#1460865
2017-06-13 16:40:47 +02:00
Peter Robinson
436052a84b Add check for aarch64 to the arm kernel module list
This adds the same list of drivers we use for arm platforms for
aarch64 too, also add the DMA drivers there too as they can add
sigficant performance for some storage/usb and often need to be
present when the storage drivers load.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>

Cherry-picked from: 917e1b6b5b
Resolves: #1459277
2017-06-12 16:09:01 +02:00
Prarit Bhargava
784c92876b module-setup.sh: Add ARM specific driver to initramfs image
If a hisi_sas storage device is used as / during system install, the
resulting installation will not boot because the hisi_sas driver is not
included in the initramfs.

The Hisilicon storage driver needs to be added to the initramfs image for
aarch64 kernels.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: dzickus@redhat.com
Cc: dmarlin@redhat.com
Cc: wefu@redhat.com
Cc: harald@redhat.com

Resolves: #1459277
2017-06-12 16:09:01 +02:00
Lukas Nykryn
fb008ce665 Revert "systemd/dracut-initqueue.sh: don't go into emergency"
This reverts commit 4c5f1b3b4a.

Resolves: #1396865
2017-06-12 16:09:01 +02:00
Michal Sekletar
02d0d0a208 udev-rules: pull in 40-redhat-cpu-hotplug.rules
Cpu hotplug policy was split off to separate file. Let's pull in the new
rules file by default.

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

Resolves: #1460707
2017-06-12 15:55:30 +02:00
Tong Li
5ae8333947 95ssh-client: attempt to copy UserKnownHostsFile to kdump's initramfs
Bug related to this issue: https://bugzilla.redhat.com/show_bug.cgi?id=1360131
Now dracut only attempts to copy GlobalKnownHostsFile while generating kdump's
initramfs. This method will cause kdump's failure if users set customized
UserKnownHostsFile in /etc/ssh/ssh_config. This patch simply attempts to copy
those files too while going through /etc/ssh/ssh_config. Note that we need to
make sure ~/foo will be copied as /root/foo in kdump's initramfs.

Cherry-picked from: 32f5af2f5e
Resolves: #1360131
2017-04-20 10:08:06 +02:00
Lukas Nykryn
ea8bef9893 ifup: don't ifup team master indefinitely
https://bugzilla.redhat.com/show_bug.cgi?id=1416958
Thanks to martin.moore@hpe.com for the patch
2017-04-06 16:27:01 +02:00
Lukas Nykryn
3186abd76e write-ifcfg: do't write MTU twice for regular eth devices
If MTU is specified, we write it for every type of device in the
beginning. There is not point writing it again for Type=ethernet
devices.
2017-04-06 16:27:01 +02:00
Lukas Nykryn
a603e1f3a6 network/ifup: write override file before dhcp_do
Commit cf376023e6 moved writing .resolv.conf and .override
after dhcp_do, because dhcp_do was overwriting .resolv.conf. But .override does not have
such problem and on the contrary dhcp_do reads .override file if it is present. So let\'s
move it back.

https://bugzilla.redhat.com/show_bug.cgi?id=1415004
2017-03-24 10:34:27 +01:00
Lidong Zhong
2877acadc0 dracut-functions.sh: remove duplicate declaratio of local variable 2017-03-16 12:22:13 +01:00
Xunlei Pang
414834306b testsuite: add "rd.memdebug=4" in TEST-01-BASIC to test rd.memdebug
"rd.memdebug=4" includes all the test level, so add it to test
rd.memdebug function.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
2017-03-14 12:36:16 +01:00
Xunlei Pang
01e66d43d8 dracut.cmdline.7.asc: update document for rd.memdebug=4
"rd.memdebug=4" is for kernel module memory consumption debugging.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
2017-03-14 12:33:18 +01:00
Xunlei Pang
e186d99780 99base: apply kernel module memory debug support
Extend "rd.memdebug" to "4", and "make_trace_mem" to "4+:komem".
Add new "cleanup_trace_mem" to cleanup the trace if active.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
2017-03-14 12:33:13 +01:00
Xunlei Pang
3ce2235abb 99base: add memtrace-ko.sh to debug kernel module large memory consumption
The current method for memory debug is to use "rd.memdebug=[0-3]",
it is not enough for debugging kernel modules. For example, when we
want to find out which kernel module consumes a large amount of memory,
"rd.memdebug=[0-3]" won't help too much.

A better way is needed to achieve this requirement, this is useful for
kdump OOM debugging.

The principle of this patch is to use kernel trace to track slab and
buddy allocation calls during kernel module loading(module_init), thus
we can analyze all the trace data and get the total memory consumption.
As for large slab allocation, it will probably fall into buddy allocation,
thus tracing "mm_page_alloc" alone should be enough for the purpose(this
saves quite some trace buffer memory, also large free is quite unlikey
during module loading, we neglect those memory free events).

The trace events include memory calls under "tracing/events/":
  kmem/mm_page_alloc

We also inpect the following events to detect the module loading:
  module/module_load
  module/module_put

Since we use filters to trace events, the final trace data size won't
be too big. Users can adjust the trace buffer size via "trace_buf_size"
kernel boot command line as needed.

We can get the module name and task pid from "module_load" event which
also mark the beginning of the loading, and module_put called by the
same task pid implies the end of the loading. So the memory events
recorded in between by the same task pid are consumed by this module
during loading(i.e. modprobe or module_init()).

With these information, we can record the rough total memory(the larger,
the more precise the result will be) consumption involved by each kernel
module loading.

Thus we introduce this shell script to find out which kernel module
consumes a large amount of memory during loading. Use "rd.memdebug=4"
as the tigger.

After applying this patch and specifying "rd.memdebug=4", during booting
it will print out something extra like below:
0 pages consumed by "pata_acpi"
0 pages consumed by "ata_generic"
1 pages consumed by "drm"
0 pages consumed by "ttm"
0 pages consumed by "drm_kms_helper"
835 pages consumed by "qxl"
0 pages consumed by "mii"
6 pages consumed by "8139cp"
0 pages consumed by "virtio"
0 pages consumed by "virtio_ring"
9 pages consumed by "virtio_pci"
1 pages consumed by "8139too"
0 pages consumed by "serio_raw"
0 pages consumed by "crc32c_intel"
199 pages consumed by "virtio_console"
0 pages consumed by "libcrc32c"
9 pages consumed by "xfs"

From the print, we see clearly that "qxl" consumed the most memory.

This file will be installed as a separate executable named "tracekomem"
in the following patch.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
2017-03-14 12:33:07 +01:00
Harald Hoyer
9301650e17 dracut.sh: fail hard, if we find modules and modules.dep is missing
If modules are present in /lib/modules/<kernelversion> and modules.dep
is empty, depmod was not run most likely.
2017-03-10 15:39:36 +01:00
Harald Hoyer
d971a570d0 add dracut.pc pkg-config file 2017-03-10 15:39:36 +01:00
Harald Hoyer
72ae0fd418 systemd/dracut-cmdline.sh: unset "UNSET" $root
https://bugzilla.redhat.com/show_bug.cgi?id=1365667
caused by commit 9aa224cc
2017-01-18 13:13:44 +01:00
Harald Hoyer
fa861e2cbf dracut.conf.5.asc: add Warning about leading and trailing spaces in lists 2017-01-11 13:47:24 +01:00
Harald Hoyer
b120b0c116 dracut.sh: skip empty lines in /proc/modules
https://bugzilla.redhat.com/show_bug.cgi?id=1405025
2017-01-11 13:40:13 +01:00
Harald Hoyer
1bb76cea72 fips/module-setup.sh: make tcrypt non-optional 2016-11-30 15:02:16 +01:00
Harald Hoyer
5fd8d27383 README.md: correct CentOS build job link 2016-11-30 14:15:37 +01:00
Harald Hoyer
d381343caa README.md: correct CentOS build job link 2016-11-30 14:06:58 +01:00
Harald Hoyer
11366030aa README.md: correct CentOS build job link 2016-11-30 14:01:03 +01:00
Harald Hoyer
455f87f41f fips/fips.sh: also check for crypto-$mod in /proc/crypto
if the module name is the alias crypto-<algo>, check if <algo> is in
/proc/crypto as "name : <algo>" or "driver: <algo>"
2016-11-30 13:56:23 +01:00
Harald Hoyer
73cf135d80 fips/module-setup.sh: also blacklist the alias resolved modules 2016-11-30 13:54:20 +01:00
Harald Hoyer
0ee8c37f39 Merge pull request #172 from haraldh/RHEL-7
RHEL-7: prepare testsuite for jenkins
2016-11-11 15:27:30 +01:00
Harald Hoyer
968eb46fce TEST-99-RPM: speedup test 2016-11-11 15:10:08 +01:00
Harald Hoyer
904c466cdb testsuite: guard against kernel panic
call qemu with --no-reboot and append "panic=1" to the kernel cmdline
2016-11-11 13:45:24 +01:00
Harald Hoyer
ba5efdcffa TEST-70-BONDBRIDGETEAMVLAN: fix server ip setup 2016-11-11 13:45:00 +01:00
Harald Hoyer
afeb39aa85 TEST-30-ISCSI/test.sh: set device timeout 2016-11-11 13:11:36 +01:00
Harald Hoyer
a081e072d8 test-rpms.txt: add dhcp 2016-11-11 12:34:00 +01:00
Harald Hoyer
aa40b82145 test/Makefile: proper return code for "make check" 2016-11-11 12:18:06 +01:00
Harald Hoyer
81bb61b525 TEST-99-RPM: ignore openldap leftovers 2016-11-11 11:42:54 +01:00
Harald Hoyer
7b4173d698 test/test-rpms.txt: add gzip 2016-11-11 11:40:58 +01:00
Harald Hoyer
13a61f82ba TEST-ISCSI: fix command check 2016-11-11 11:34:33 +01:00
Harald Hoyer
d2fd423a8d test: remove sudo calls
rather run:

$ sudo make check
2016-11-10 14:57:05 +01:00
Harald Hoyer
f432d367fc test/test-rpms.txt: add list of rpms to install 2016-11-10 14:42:01 +01:00
Harald Hoyer
6dcb4867ae README.md: update 2016-10-20 15:27:53 +02:00
Harald Hoyer
05a38caaf2 add README.md 2016-10-20 14:59:26 +02:00
Lukas Nykryn
443d167a95 network: do not check "firmware boot selected flag"
Apparently it is not set correctly on some setups
https://bugzilla.redhat.com/show_bug.cgi?id=1380581
2016-10-05 17:46:36 +02:00
Harald Hoyer
33710dfbfc network: fix dhcp classless_static_routes
removed copy&paste artifact "modify_routes add"

there is no modify_routes() function, and we simply want the output
of the parse function.
2016-09-07 10:20:20 +02:00
Harald Hoyer
c87d489ca6 network/parse-ip-opts: be more liberal to multiple ip= options
Do not bail out early.

https://bugzilla.redhat.com/show_bug.cgi?id=1304069
2016-09-07 10:20:20 +02:00
Harald Hoyer
99e72a4b1c fcoe: only install /etc/hba.conf, it it exists
https://bugzilla.redhat.com/show_bug.cgi?id=1369342
2016-09-07 10:17:43 +02:00
Harald Hoyer
39c4892772 TEST-16-DMSQUASH: add sr_mod
otherwise no cdrom can be accessed on RHEL-7
2016-08-26 11:24:42 +02:00
Harald Hoyer
8c67fb9123 nfs: install more kernel modules
adds support for rpcrdma to support NFSROOT over NFSoRDMA

https://bugzilla.redhat.com/show_bug.cgi?id=1367374
2016-08-19 15:56:47 +02:00
Harald Hoyer
1d267fb82c dracut.cmdline.7.asc: document rd.shell=0 for rd.emergency 2016-08-17 16:49:00 +02:00
Harald Hoyer
91896ab68e dracut.sh: document --hostonly-i18n and --no-hostonly-i18n
show description in --help

https://bugzilla.redhat.com/show_bug.cgi?id=1266448
2016-08-17 16:48:07 +02:00
Harald Hoyer
1b23c6c65c url-lib: ca-bundle.crt changed to a symlink
use inst() instead of inst_simple()

/etc/pki/tls/certs/ca-bundle.crt is a symlink to
../../ca-trust/extracted/pem/tls-ca-bundle.pem

with inst() we install the original file also.

https://bugzilla.redhat.com/show_bug.cgi?id=1341280
2016-08-17 16:41:21 +02:00
Harald Hoyer
b8e6c051c6 network:ibft put IPv6 IP in brackets
ip=2620:0052:0000:2220:0226:b9ff:fe81:cde4::[2620:0052:0000:2220:0000:0000:0000:03fe]:64::ibft0:none

should be

ip=[2620:0052:0000:2220:0226:b9ff:fe81:cde4]::[2620:0052:0000:2220:0000:0000:0000:03fe]:64::ibft0:none

https://bugzilla.redhat.com/show_bug.cgi?id=1322592#c19
2016-08-17 16:26:13 +02:00
Harald Hoyer
fc77aca7dd systemd/dracut-cmdline.sh: unset "UNSET" $root
https://bugzilla.redhat.com/show_bug.cgi?id=1365667
caused by commit 9aa224cc
2016-08-12 13:29:31 +02:00
Harald Hoyer
7a7b8c1740 dracut-functions.sh: catch all lvm slaves
add check_vol_slaves_all to be used in check_block_and_slaves_all

otherwise only the first lvm VG member would be processed
2016-08-12 12:33:10 +02:00
Harald Hoyer
8dd6ff8d6a fips: remove sha1-mb
This module should be loaded automatically, if the HW supports it.
2016-08-12 12:33:10 +02:00
Lukas Nykryn
10e6bf0e43 fips-module: add missing spaces
https://bugzilla.redhat.com/show_bug.cgi?id=1359677
2016-07-28 12:27:10 +02:00
Harald Hoyer
cd6679c716 add rd.emergency=[reboot|poweroff|halt]
specifies what action to execute in case of a critical failure

(cherry picked from commit c45e856a65)

https://bugzilla.redhat.com/show_bug.cgi?id=1359144
2016-07-22 15:26:32 +02:00
Harald Hoyer
20171c7519 lvm: include /etc/lvm/lvm_<host_tag>.conf
https://bugzilla.redhat.com/show_bug.cgi?id=1328778
2016-07-22 13:26:10 +02:00
Harald Hoyer
b7c7b16d4e dracut.sh: extend host_fs_types with $filesystems
Additional filesystems specified on the kernel command line or in the
configuration files, should trigger the inclusion of the corresponding
dracut modules, therefore host_fs_types is extended with these
filesystems.
2016-07-22 08:39:38 +02:00
Harald Hoyer
b077d18963 nfs: install all nfs modules non-hostonly
If nfs is used, we should include all nfs modules, in the case, where
$host_fs_types contains nfs.
2016-07-22 08:30:36 +02:00
Harald Hoyer
2f42cfcbeb fips: add "sha1-mb" to fips modules
https://bugzilla.redhat.com/show_bug.cgi?id=1357080
2016-07-21 15:08:59 +02:00
Harald Hoyer
0eb1afa9ea fips: use /lib/modules/$(uname -r)/modules.fips
if /lib/modules/$(uname -r)/modules.fips exists, use that list instead
of the dracut module list.
2016-07-21 15:07:52 +02:00
Harald Hoyer
2c9f267268 Merge pull request #141 from pratyushanand/for-RHEL-7
RHEL7: Install module for active watchdog
2016-07-21 11:12:01 +02:00
Harald Hoyer
038f142ef9 dracut.spec: remove trailing space 2016-07-06 09:17:36 +02:00
Harald Hoyer
1492490070 watchdog: start traversing the device tree from the right directory
start with the device subtree, not with the parent of it
2016-07-05 12:52:16 +05:30
Harald Hoyer
0eb1ee3db2 watchdog: clean return of installkernel()
return 0, otherwise if _alldrivers is empty, the return code is fail
2016-07-05 12:52:16 +05:30
Harald Hoyer
4c83fd10ab watchdog/module-setup.sh: rewrite
- use local variables with _
- use associative array for the kernel modules
- install emergency hook even in the systemd case
- follow device path until /sys is reached
- set kernel version for modprobe checking
2016-07-05 12:52:16 +05:30
Pratyush Anand
f69cd051ab watchdog: ensure that module is loaded as early as possible
It is expected that a watchdog module will disable an active watchdog when
its probe is called ie, when it is loaded. So an early load of the module
will help to disable it earlier.
This can be helpful in some corner cases where kdump and watchdog daemon
both are active.

Testing:
    -- When watchdog kernel modules were added
	# dracut --no-hostonly initramfs-test.img -a watchdog
	# lsinitrd initramfs-test.img -f etc/cmdline.d/00-watchdog.conf
 	rd.driver.pre=iTCO_wdt,lpc_ich,

Signed-off-by: Pratyush Anand <panand@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Harald Hoyer <harald@redhat.com>
2016-07-05 12:52:16 +05:30
Pratyush Anand
0be17528e5 watchdog: install module for active watchdog
Recently following patches have been added in upstream Linux kernel, which
(1) fixes parent of watchdog_device so that
/sys/class/watchdog/watchdogn/device is populated. (2) adds some sysfs
device attributes so that different watchdog status can be read.

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=6551881c86c791237a3bebf11eb3bd70b60ea782
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=906d7a5cfeda508e7361f021605579a00cd82815
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=33b711269ade3f6bc9d9d15e4343e6fa922d999b

With the above support, now we can find out whether a watchdog is active or
not. We can also find out the driver/module responsible for that watchdog
device.

Proposed patch uses above support and then adds module of active watchdog
in initramfs generated by dracut for hostonly mode. Kernel module for
inactive watchdog will be added as well for none hostonly mode.

When an user does not want to add kernel module, then one should exclude
complete dracut watchdog module with --omit.

Testing:
-- When watchdog is active watchdog modules were added
	# cat /sys/class/watchdog/watchdog0/identity
	iTCO_wdt
	# cat /sys/class/watchdog/watchdog0/state
	active
	# dracut --hostonly initramfs-test.img -a watchdog
	# lsinitrd initramfs-test.img | grep iTCO
	-rw-r--r--   1 root     root         9100 Feb 24 09:19 usr/lib/modules/.../kernel/drivers/watchdog/iTCO_vendor_support.ko
	-rw-r--r--   1 root     root        19252 Feb 24 09:19 usr/lib/modules/.../kernel/drivers/watchdog/iTCO_wdt.ko

-- When watchdog is inactive then watchdog modules were not added
	# cat /sys/class/watchdog/watchdog0/state
	inactive
	# dracut --hostonly initramfs-test.img -a watchdog
	# lsinitrd initramfs-test.img | grep iTCO

-- When watchdog is inactive, but no hostonly mode, watchdog modules were added
	# cat /sys/class/watchdog/watchdog0/state
	inactive
	# dracut --no-hostonly initramfs-test.img -a watchdog
	# lsinitrd initramfs-test.img | grep iTCO
	-rw-r--r--   1 root     root         9100 Feb 24 09:19 usr/lib/modules/.../kernel/drivers/watchdog/iTCO_vendor_support.ko
	-rw-r--r--   1 root     root        19252 Feb 24 09:19 usr/lib/modules/.../kernel/drivers/watchdog/iTCO_wdt.ko

Signed-off-by: Pratyush Anand <panand@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Harald Hoyer <harald@redhat.com>
2016-07-05 12:52:16 +05:30
Pratyush Anand
e5439c9b37 watchdog: Do not add hooks if systemd module is included
When systemd is present, let it manage watchdog feed.

Signed-off-by: Pratyush Anand <panand@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Harald Hoyer <harald@redhat.com>
2016-07-05 12:52:16 +05:30
Harald Hoyer
573e508554 dracut.spec: remove dd
dd is part of coreutils
2016-07-04 16:30:47 +02:00
Harald Hoyer
7b0ce59233 TEST-70-BONDBRIDGETEAMVLAN: add testcase for testsuite
multiple bonds
multiple bridges
multiple vlans
2016-07-04 16:28:08 +02:00
Harald Hoyer
7a90c8b343 network: support multiple vlan, team, bridge and bond 2016-07-04 16:28:08 +02:00
HATAYAMA Daisuke
84d845fc7d lsinitrd: Suppress "cat: write error: Broken pipe"
On systemd, SIGPIPE is ignored by default; see man 5 systemd.exec for
IgnoreSIGPIPE=. As a result, lsinitrd.sh under a systemd service
outputs "cat: write error: Broken pipe" in the processing of
determining a compression format of a given initramfs file using cat
command in the write part of a pipeline processing.

For example, this is a log message of kdump.service in RHEL7.1,

    -- Logs begin at Wed 2015-11-04 09:57:33 JST, end at Wed 2015-11-04 09:58:28 JST. --
    Nov 04 09:57:33 localhost systemd[1]: Stopping Crash recovery kernel arming...
    Nov 04 09:57:33 localhost kdumpctl[22545]: kexec: unloaded kdump kernel
    Nov 04 09:57:33 localhost kdumpctl[22545]: Stopping kdump: [OK]
    Nov 04 09:57:33 localhost systemd[1]: Starting Crash recovery kernel arming...
    Nov 04 09:57:36 localhost kdumpctl[22553]: Detected change(s) in the following file(s):
    Nov 04 09:57:36 localhost kdumpctl[22553]: /etc/kdump.conf
    Nov 04 09:57:36 localhost kdumpctl[22553]: Rebuilding /boot/initramfs-3.10.0-229.el7.x86_64kdump.img
    Nov 04 09:57:40 localhost dracut[24914]: Executing: /usr/sbin/dracut --hostonly --hostonly-cmdline -o "plymouth dash resume" -f /boot/initramfs-3.10.0-229.el7.x86_64kdump.img 3.10.0-229.el7.x86_64
    ...<cut>...
    Nov 04 09:58:12 localhost dracut[24914]: *** Creating image file done ***
    Nov 04 09:58:12 localhost dracut[24914]: Image: /boot/initramfs-3.10.0-229.el7.x86_64kdump.img: 18M
    Nov 04 09:58:12 localhost kdumpctl[22553]: cat: write error: Broken pipe
    Nov 04 09:58:12 localhost dracut[24914]: ========================================================================
    Nov 04 09:58:12 localhost dracut[24914]: Version: dracut-033-240.el7
    Nov 04 09:58:12 localhost dracut[24914]:
    Nov 04 09:58:12 localhost dracut[24914]: Arguments: --hostonly --hostonly-cmdline -o 'plymouth dash resume' -f
    Nov 04 09:58:13 localhost dracut[24914]:
    Nov 04 09:58:13 localhost dracut[24914]: dracut modules:
    Nov 04 09:58:13 localhost dracut[24914]: bash

kdump.service builds and loads an initramfs for kdump kernel using
kdumpctl command which uses dracut command and so lsinitrd command,
too.

Although there's no actual harm except for the error message, there
has been several inquiries from customers about this message so
far. We should suppress this message to reduce needless
communications.

To suppress the message, this commit cleans up the processing of
reading the first 6 bytes of a given initramfs file without cat
command.

(cherry picked from commit 3ce142861d)

Conflicts:
	lsinitrd.sh
2016-07-01 13:17:18 +02:00
Harald Hoyer
aea64fe178 TEST-14-IMSM: add rd.device.timeout 2016-07-01 13:17:18 +02:00
Harald Hoyer
271a64bfd1 TEST-13-ENC-RAID-LVM: add rd.device.timeout=40 2016-07-01 12:29:16 +02:00
Harald Hoyer
fd8506b5da systemd: let booting work after exiting emergency
If the user managed to mount /sysroot, let it work
2016-07-01 12:29:16 +02:00
Harald Hoyer
4c5f1b3b4a systemd/dracut-initqueue.sh: don't go into emergency
let systemd go into emergency.target later on
2016-07-01 12:29:15 +02:00
Harald Hoyer
a95fe14581 99base/init.sh: break the initqueue, if emergency shell was successful 2016-07-01 12:29:15 +02:00
Harald Hoyer
6efee60f93 test/TEST-12-RAID-DEG: add rd.device.timeout 2016-07-01 12:29:15 +02:00
Harald Hoyer
22a907b383 test/TEST-04-systemd: fixup test
- fix find -perm
- add failme test cases
- remove journal output
2016-07-01 12:29:15 +02:00
Harald Hoyer
ca46c751d1 add rd.device.timeout=<seconds> parameter 2016-07-01 12:29:15 +02:00
Harald Hoyer
ca64eeec79 virtfs: use systemd generator
use a systemd generator, instead of a dracut hook to mount
2016-07-01 12:29:15 +02:00
Alexander Kurtz
9aa224cc19 dracut-systemd/dracut-cmdline.sh: Don't error out if there is no root= argument.
Thanks to systemd's gpt-auto-generator [0] (which implements the Discoverable
Partitions Specification [1]), it is no longer necessary to always specify the
root= argument.

However, dracut would still refuse to boot if there was no root= argument (or
if it was set to the special value "gpt-auto" [2]). This commit stops dracut
from aborting the boot process in these cases and simply lets systemd do its
magic.

[0] https://github.com/systemd/systemd/blob/v229/src/gpt-auto-generator
[1] https://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/
[2] https://github.com/systemd/systemd/blob/v229/src/gpt-auto-generator/gpt-auto-generator.c#L928

(cherry picked from commit 016613c774)
2016-07-01 12:29:15 +02:00
Harald Hoyer
13264563a9 network:wait_for_ipv6_auto() wait for all tentative addresses 2016-07-01 12:29:15 +02:00
Harald Hoyer
cc3f588071 network: flush only IPv4 addresses on configuration
also flush on dhcp
2016-07-01 12:29:15 +02:00
Harald Hoyer
42dd8928a8 network: differ between ipv6 local and global tentative
For dhcpv6, only a non-tentative scope local address is needed.
2016-06-30 11:10:35 +02:00
Harald Hoyer
6d22a6860e network/net-lib.sh: auto6 wait for route ra
Wait for a router advertised route
2016-06-30 08:52:09 +02:00
Hannes Reinecke
bac74f05e3 40network: Update iBFT scanning code to handle IPv6
IPv6 addresses should be specified in brackets so that the
ip= scanning code doesn't get confused.

References: bnc#887542

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.com>
(cherry picked from commit c98d1756f7)
2016-06-29 18:26:58 +02:00
Xunlei Pang
a320422588 network/net-lib.sh: delete duplicated DNS items from "/etc/resolv.conf"
Users can pass the DNS information throught "nameserver=" cmdline,
there maybe duplicated inputs.

"/etc/resolv.conf" have some restrictions on the number of DNS items
effective, so make sure that this file contains no duplicated items.

We achieve this by simply making the file have no duplicated lines.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
(cherry picked from commit 4fa5c235a7)
2016-06-29 17:27:36 +02:00
Harald Hoyer
5bc318633f network: dhcp before parsing specified dns through cmdline
I met a problem when passing kdump dns to dracut via "nameserver=x.x.x.x",
the dns I provided didn't appear in the "/etc/resolv.conf".

After some debugging, found that when setup dhcp DNS, in setup_interface()
and setup_interface6(), it has:
    echo "search $search $domain" > /tmp/net.$netif.resolv.conf

So if "$search $domain" isn't NULL(this is ture in my kdump environment),
the dns contents(that is, dns1, dns2, nameserver) in "ifup" before dhcp
will be discarded.

This patch addresses it by handling dhcp first. In fact this is also the
way the NetworkManager in 1st kernel works.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>

cherry-pick of commit cf376023e6
2016-06-29 17:26:17 +02:00
Michael Chapman
53310e44c9 systemd: ensure journal is volatile
If journald.conf already contains Storage=persistent, journald will
write to /var/log/journal/, which ends up at /run/initramfs/log/journal/
after switching root. We want to make sure early boot logs are written
to /run/log/journal/ so they can be flushed to /var/log/journal/ after
switching root.

(cherry picked from commit 5dea430e08)
2016-06-29 17:21:56 +02:00
Harald Hoyer
a7805d1297 network/net-lib.sh(wait_for_ipv6_dad): simplify ip call
taken from initscripts
2016-06-29 17:19:06 +02:00
Harald Hoyer
435af39a00 network/net-lib.sh(parse_ifname_opts): support 21 byte MAC addrs
infiniband MAC addrs are 20 bytes long not 6

https://bugzilla.redhat.com/show_bug.cgi?id=1319270
2016-06-29 16:37:40 +02:00
Harald Hoyer
323093b621 test: add TEST-60-MTUMAC
test MTU and MACADDR setting
2016-06-29 15:51:42 +02:00
Harald Hoyer
61b5ee6d1d network: set MTU and MACADDR for dhcp and auto6 2016-06-29 15:13:35 +02:00
Harald Hoyer
55712f46c0 test: don't call ldconfig with -- path separator 2016-06-29 15:11:39 +02:00
Harald Hoyer
53e4ab7174 network: support macaddr in brackets []
ip=ens3:dhcp:1000
ip=ens3:dhcp::54:52:00:ab💿ef
ip=ens3:dhcp::[54:52:00🆎cd:ef]
ip=ens3:dhcp:1000:54:52:00:ab💿ef
ip=ens3:dhcp:1000:[54:52:00🆎cd:ef]

ip=192.168.122.20::192.168.122.1:24:test:ens3:none:1000
ip=192.168.122.20::192.168.122.1:24:test:ens3:none::54:52:00:ab💿ef
ip=192.168.122.20::192.168.122.1:24:test:ens3:none::[54:52:00🆎cd:ef]
ip=192.168.122.20::192.168.122.1:24:test:ens3:none:1000:54:52:00🆎cd:ef
ip=192.168.122.20::192.168.122.1:24:test:ens3:none:1000:[54:52:00🆎cd:ef]

ip=::::test:ens3:dhcp:1000
ip=::::test:ens3:dhcp::54:52:00:ab💿ef
ip=::::test:ens3:dhcp::[54:52:00🆎cd:ef]
ip=::::test:ens3:dhcp:1000:54:52:00:ab💿ef
ip=::::test:ens3:dhcp:1000:[54:52:00🆎cd:ef]
2016-06-29 12:44:49 +02:00
Harald Hoyer
b7f5e42c57 network/net-lib.sh: correctly set mac address for ip=...:<mtu>:<mac>
if ip=...:<mtu>:<mac> was specified, macadress was not set

(cherry picked from commit efbc47b8e4)
2016-06-29 12:15:12 +02:00
Harald Hoyer
603a0fe0a3 fcoe-up: remove initlog logic
(cherry picked from commit f60b7d8655)
2016-06-29 12:06:20 +02:00
Hannes Reinecke
f105eaebb8 95fcoe: update fcoe interface check 2016-06-29 11:57:56 +02:00
Hannes Reinecke
f501c955e8 95fcoe: Store current configuration in dracut cmdline
When running with --hostonly-cmdline we should be storing
the current configuration in /etc/cmdline.d so that dracut
will be configure the system automatically.

References: bnc#877288

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
(cherry picked from commit 8b257fcc86)
2016-06-29 11:54:19 +02:00
Hannes Reinecke
b9668f8f00 95fcoe: skip VLAN devices in fcoe-up
DCB & fipvlan can only be called on real devices, not VLAN
ones. So skip any VLAN devices which might been added to the
list of network interfaces.

References: bnc#878583

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
(cherry picked from commit 0a68a26cff)
2016-06-29 11:51:05 +02:00
Hannes Reinecke
a4cbfd719b 95fcoe: start lldpad separately
lldpad is a system-wide process, which must be started only once.
So we should be separate it from fcoe-up, as it might be called
several times.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
(cherry picked from commit 22e837b645)
2016-06-29 11:50:56 +02:00
Harald Hoyer
7335bd1e23 Defer modprobe of HW modules, until udev is running
Also honor blacklisting

(cherry picked from commit 437dad70e9)
2016-06-29 11:50:13 +02:00
Hannes Reinecke
26eeb4af8d Reset IFS variable
Setting and unsetting the IFS variable is tricky. To be on the
safe side we should always reset the IFS variable to its original
value after parsing.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
(cherry picked from commit b8efaa0017)
2016-06-29 11:41:21 +02:00
Mike Gilbert
d6b9aac6d0 Replace echo -n with printf in code with a /bin/sh shebang
POSIX does not mandate that echo support the -n parameter.
printf has more well-defined behavior.

(cherry picked from commit 5899f2f516)
2016-06-29 11:40:14 +02:00
Thomas Renninger
3186a0aa15 dracut: nbd: Only complain of missing binary in hostonly mode if
rootfs is on nbd

In not hostonly mode, require_binaries will still complain.
If in hostonly mode and the module is explicitly added via -a nbd, then
install() section will still complain later:
dracut-install: ERROR: installing 'nbd-client'

Signed-off-by: Thomas Renninger <trenn@suse.de>
(cherry picked from commit e683985d10)
2016-06-29 11:34:26 +02:00
Harald Hoyer
cc7d2eeb36 add "--install-optional" and install_optional_items
(cherry picked from commit 54b68829b6)
2016-06-29 11:28:23 +02:00
Harald Hoyer
b4ad021d34 dracut: only use one tmpdir
also remove any partial written initramfs images
2016-06-29 11:25:12 +02:00
Harald Hoyer
f45726652f fcoe: check if needed for hostonly 2016-06-29 10:50:58 +02:00
Harald Hoyer
ced0638e2c Disable early microcode for non-x86 architecures 2016-06-29 10:45:58 +02:00
Harald Hoyer
8175f5eb82 test/TEST-02-systemd: use marker disk for successfull boot marker 2016-06-27 10:28:09 +02:00
Harald Hoyer
017c16b97a systemd: add -.slice and make reboot work
-.slice and conflicting with emergency.target and shutdown.target
makes reboot work
2016-06-27 10:27:05 +02:00
Harald Hoyer
320b8d5c0c network/dhclient.conf: add missing commata
options need to be seperated by ,

(cherry picked from commit 7e51abc81f)
2016-06-24 11:10:19 +02:00
Harald Hoyer
0b7c2400c3 TEST-50-MULTINIC: add multiple bond tests 2016-06-22 14:03:12 +02:00
Harald Hoyer
fefb96f43f network/parse-bond.sh: handle multiple bond interfaces 2016-06-22 13:32:11 +02:00
Harald Hoyer
1472b5486b ifup: setup bridge, bonding and teaming only once
if those assembled interfaces use dhcp "$iface.up" is created too late
2016-06-10 16:24:24 +02:00
Harald Hoyer
e6ae0c6128 network/net-genrules.sh: generate rules for all interfaces
previously, if "rd.neednet" and bond was specified, only the bond
interface was configured.

https://bugzilla.redhat.com/show_bug.cgi?id=1282680
2016-06-10 16:24:24 +02:00
Harald Hoyer
ac422d577c base/dracut-lib.sh: add trim()
trim() to remove leading and trailing whitespace
2016-06-10 16:24:24 +02:00
Harald Hoyer
484aba4298 network: add 73-idrac.rules udev rules
idrac USB devices want a special network name
2016-06-08 16:19:12 +02:00
Harald Hoyer
b14e0fb826 more dash removal 2016-05-27 11:22:38 +02:00
Harald Hoyer
863105bce1 dracut.spec: add a tag with the current version 2016-05-27 11:22:38 +02:00
Harald Hoyer
15ec719501 test/NBD: add checks for needed binaries 2016-05-27 11:22:38 +02:00
Harald Hoyer
249a94ab04 test: remove dash module, as it is not available in RHEL 2016-05-27 11:22:38 +02:00
Harald Hoyer
6656e1547f dracut-functions.sh: add str_starts() and str_ends() 2016-05-25 14:49:34 +02:00
Daniel Drake
688afe0fc3 kernel-modules: increase SDHCI driver inclusion
The sdhci-pci module is currently not being included in the initramfs,
even though other sdhci modules are. This breaks boot on systems that
rely on this driver to access the root filesystem.

Instead of looking for modules that use sdhci_pltfm_init, look for
sdhci_add_host. I checked 3.18 kernel sources, and this change
does not remove any of the previously-matched SDHCI drivers.
It should result in the addition of sdhci-pci, sdhci-s3c, sdhci-spear
and sdhci-acpi.

(cherry picked from commit 6dcc5e1158)
2016-05-25 14:40:40 +02:00
Harald Hoyer
8fb06a0562 shutdown: guard against read-only /run
remount the switch rooted /run writeable again.

(cherry picked from commit 54e09dfb72)
2016-05-23 12:49:32 +02:00
Hannes Reinecke
68021e85c9 95iscsi: parse output from iscsiadm correctly
Due to some obsure reason the IFS parameter is not set correctly
when evaluating get_ibft_mod(). So change the parsing to not rely
on IFS altogether.

References: bnc#886199

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2016-05-18 14:44:16 +02:00
Hannes Reinecke
12aa314819 95iscsi: More empty cmdline fixes
This fixes up some 95iscsi/module-setup.sh which might print out empty
commandline files.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2016-05-18 14:44:16 +02:00
Hannes Reinecke
bff5416520 95iscsi: Fixup bnx2i offload booting
bnx2i is using a separate iSCSI offload engine with a separate
MAC address. As a result, the iBFT information is displaying
a MAC address which does not relate to any MAC address from
the network interfaces.
In addition, the iSCSI offload engine works independently on
the NIC, so we do not need to enable the NIC for iSCSI offload
to work.
This patch modifies the automatic iBFT detection to not set
the 'ip=ibft' flag when bnx2i offload is detected.

References: bnc#855747

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2016-05-18 14:44:16 +02:00
Hannes Reinecke
9eab750787 95iscsi: Install libgcc_s library
iscsiuio is using pthread, which requires libgcc_s for
pthread_cancel to work.
Without this library iscsiuio will crash with SIGABRT.

References: bnc#881692

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2016-05-18 14:44:16 +02:00
Hannes Reinecke
f31220ec88 95iscsi: Autodetect iSCSI firmware
Some iSCSI initiator present firmware information in
/sys/firmware/ibft or /sys/firmware/iscsi_bootX

Whenever we detect one of those directories we should assume
that the iSCSI devices should be activated.

Also incorporates SUSE patches:
0049:
95iscsi: Use 'ip=ibft' for ibft autoconfiguration

For iBFT autoconfiguration we should be setting 'ip=ibft'
instead of rd.neednet. This should instruct dracut to only
enable the iBFT interfaces and leave the rest alone.

References: bnc#879038

0054:
95iscsi: update commandline printing

dracut has a separate callout 'cmdline' which should be used
for printing out the generated commandline.

Signed-off-by: Pavel Wieczorkiewicz <pwieczorkiewicz@suse.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2016-05-18 14:44:16 +02:00
Harald Hoyer
043d61b542 url-lib/url-lib.sh:nfs_fetch_url(): pass file directory to query if nfs is already mounted
Otherwise the returned mount path includes the file with the directory

https://bugzilla.redhat.com/show_bug.cgi?id=1302764
2016-03-14 15:55:03 +01:00
Harald Hoyer
0d7b00a230 network: if rd.neednet=0 we don't need a bootdev
otherwise dracut would wait for the bootdev interface to appear and be
setup

(cherry picked from commit f4f8fb5c10)
2016-02-29 15:07:59 +01:00
Harald Hoyer
a48ea27deb network/dhclient-script.sh: add classless-static-routes support
https://bugzilla.redhat.com/show_bug.cgi?id=1260955
2016-02-29 15:00:46 +01:00
Harald Hoyer
9d030e4ef1 documentation: "--hostonly-i18n" "--no-hostonly-i18n" "i18n_install_all"
(cherry picked from commit fe6455a6e8)
2016-02-29 13:13:02 +01:00
Harald Hoyer
3a39dd027f dracut.sh: for microcode generation, skip gpg files
skip all ".asc" files for the AMD microcode generation

(cherry picked from commit c44d2252bb)
2016-02-29 11:56:05 +01:00
Harald Hoyer
de8cc25d70 dracut: add "tar" and "dd" requirement
https://bugzilla.redhat.com/show_bug.cgi?id=1285810
2016-02-29 11:55:25 +01:00
Harald Hoyer
ba977abe63 systemd: add "wheel" and "adm" to passwd and group
# LANG=C journalctl -b -u systemd-tmpfiles-setup-dev.service | grep
     # ACL
     Dec 01 13:56:59 localhost.localdomain systemd-tmpfiles[112]: Failed
to parse ACL "d:group:adm:r-x,d:group:wheel:r-x": Invalid argument.
Ignoring
     Dec 01 13:56:59 localhost.localdomain systemd-tmpfiles[112]: Failed
to parse ACL "group:adm:r-x,group🛞r-x": Invalid argument. Ignoring
     Dec 01 13:56:59 localhost.localdomain systemd-tmpfiles[112]: Failed
to parse ACL "d:group:adm:r-x,d:group:wheel:r-x": Invalid argument.
Ignoring
     Dec 01 13:56:59 localhost.localdomain systemd-tmpfiles[112]: Failed
to parse ACL "group:adm:r-x,group🛞r-x": Invalid argument. Ignoring

     # grep ^[aA] /usr/lib/tmpfiles.d/systemd.conf
     a+ /run/log/journal/%m - - - - d:group:adm:r-x,d:group:wheel:r-x
     A+ /run/log/journal/%m - - - - group:adm:r-x,group🛞r-x
     a+ /var/log/journal/%m - - - - d:group:adm:r-x,d:group:wheel:r-x
     A+ /var/log/journal/%m - - - - group:adm:r-x,group🛞r-x

https://bugzilla.redhat.com/show_bug.cgi?id=1287537
2016-02-29 11:52:37 +01:00
Thomas Renninger
69762959ae 90lvm: Install dm-snapshot module
bnc#888530

Signed-off-by: Thomas Renninger <trenn@suse.de>
(cherry picked from commit 5c84d51b3f)
2016-02-29 11:47:43 +01:00
Pekka Wallendahl
851946468a multipath: fix majmin_to_mpath_dev()
* Multipath device names only start with the mpath-prefix if the option
  use_userfriendly_names is set true in /etc/multipath.conf and if user
  has not set any aliases in the said file. Thus the for-loop should go
  through all files in /dev/mapper/, not just ones starting with 'mpath'

* Bash is perfectly capable to extend `/dev/mapper/*` notation without a
  need to pass it to an external ls

* Changed the function to use a local variable $_dev instead of the
  global $dev, which seemed to be the original intention as the local
  _dev was defined but not used

(cherry picked from commit 28058a2e37)
2016-02-29 11:43:18 +01:00
Harald Hoyer
28665b4fa5 dracut-functions.sh:fix check_vol_slaves() volume group name stripping
commit 466a59984a removed whitespace
stripping from lvm volume group names.

(cherry picked from commit 2fd8588da5)
2016-02-29 11:41:42 +01:00
Harald Hoyer
17985b2575 network: fix carrier detection
rename iface_has_link() to iface_has_carrier() to clarify usage

Only assign static "wildcard interface" settings, if the interface has a
carrier.

If the interface name was specified with a name, do not do carrier
checking for static configurations.

(cherry picked from commit df95b1003c)
2015-12-14 16:16:00 +01:00
Harald Hoyer
2f20797a40 iscsi/iscsiroot.sh: better put variables in quotes
first rule for a bash programmer
2015-11-26 10:10:40 +01:00
Harald Hoyer
d2380720db Don't call udevadm control --exit in systemd mode
This partly reverts commit a43f97c4e3.

(cherry picked from commit 765d8408e9)

https://bugzilla.redhat.com/show_bug.cgi?id=1276983
2015-11-26 10:10:40 +01:00
Harald Hoyer
19912dd3c5 Merge pull request #98 from lnykryn/RHEL-7-vlan
write-ifcfg: fix creating configuration for VLAN
2015-11-11 11:44:48 +01:00
Harald Hoyer
3dd6a30ec8 Merge pull request #99 from lnykryn/RHEL-7-ibmvscsi
90qemu: also add ibmvscsi on qemu
2015-11-11 11:44:23 +01:00
Lukas Nykryn
50a0070773 90qemu: also add ibmvscsi on qemu
Without this module following scenario does not work:
1. Install the guest with virtio-scsi-pci as system disk and no other
data disk.
2. Change the system disk from virtio-scsi to spapr-vscsi.
2015-10-20 15:30:12 +02:00
Fedora dracut team
32398e1525 write-ifcfg: fix creating configuration for VLAN
Currently the physdev is unset before it is somehow applied.
Also there is no DEVICE in the output.
2015-10-19 18:32:01 +02:00
Harald Hoyer
e658251173 network/ifup.sh: skip empty nameserver values 2015-10-09 11:35:43 +02:00
Harald Hoyer
3bce34dfd7 ifcfg/write-ifcfg.sh: don't bind interface, if physical device is set
If a physical device is defined, we don't need to bind the interface to
the MAC address or something else.
2015-10-09 11:31:28 +02:00
Harald Hoyer
d1f7f2ac04 base/dracut-lib.sh:getargs() don't return 1 for empty values
getargs() is only used with real values and not booleans.

So, return the values only.
2015-10-09 11:30:03 +02:00
Harald Hoyer
7de064b57c ifcfg/write-ifcfg.sh: unset vlan
clear the vlan flag, if a previous interface in the loop
was a vlan interface

(cherry picked from commit 23446ef1e0)
2015-10-09 11:10:07 +02:00
Harald Hoyer
5f24e43401 90qemu: fixed systemd-detect-virt output parsing
redirecting systemd-detect-virt to /dev/null doesn't help with parsing
the output :-/

Also, add "Red Hat" as a vendor.

(cherry picked from commit 4135eea634)
2015-10-09 11:06:50 +02:00
Harald Hoyer
a594b4e357 dracut.sh: fixed typo in microcode generation 2015-09-25 14:10:20 -04:00
Lubomir Rintel
5263556ff3 dracut-functions.sh: avoid tokenizing ldconfig output with 'read'
The space does not separate the elements reliably, spaces can be
embedded in parenthesized expressions too:

  libgmpxx.so.4 (libc6, hwcap: 0x0000000004000000) => /lib/sse2/libgmpxx.so.4
  libgmp.so.10 (libc6, hwcap: 0x0000000004000000) => /lib/sse2/libgmp.so.10

This results in dracut creating '0x0000000004000000' and '=>'
directories in the initramfs image.

(cherry picked from commit c59779cf93)
2015-09-25 12:48:55 -04:00
Harald Hoyer
fe74a7069b base/dracut-lib.sh:info() be more quiet 2015-09-25 12:42:15 -04:00
Harald Hoyer
f059985b14 network:wait_for_ifup() handle "NO-CARRIER" output
if "NO-CARRIER" is one of the flags, we surely have no link yet.
2015-09-25 12:42:15 -04:00
Harald Hoyer
327d765512 dracut.sh: no microcode, if get_ucode_file returns empty file
check, if get_ucode_file() returned an empty string.
2015-09-17 20:07:26 +02:00
Harald Hoyer
7fd112f20e iscsi/parse-iscsiroot.sh: correct handling if netroot isn't set
corrects bfe65f913a
2015-09-17 15:41:12 +02:00
Harald Hoyer
bcc2132dab scsi/parse-iscsiroot.sh: call modprobe with "-b"
honor, if a module is blacklisted
2015-09-17 12:32:07 +02:00
Harald Hoyer
13b5c1d09e dracut.sh: do not create microcode, if no firmware is available 2015-09-15 16:10:00 +02:00
Harald Hoyer
34b551a1c4 dracut.sh: add command line option for install_i18_all
--no-hostonly-i18n -> install_i18n_all=yes
--hostonly-i18n -> install_i18n_all=no
2015-09-15 16:06:50 +02:00
Harald Hoyer
7c0b1d864d i18n: check for $i18n_install_all == "yes" rather than being set
i18n_install_all="no" does not have the expected effect without this
patch

(cherry picked from commit ae488efa5e)
2015-09-14 15:16:18 +02:00
Harald Hoyer
fd3eddf069 iscsi/iscsiroot.sh: handle iscsi_firmware in online and timeout queue
The return code of iscsi_firmware is broken, so set the marker
unconditionally.
2015-09-10 13:27:02 +02:00
Harald Hoyer
17cee31b11 network/netroot.sh: better handling of $netroot and dhcp
if $netroot is emtpy, get it from cmdline

check cmdline directly for root=dhcp(6) and netroot=dhcp(6)
2015-09-10 13:23:32 +02:00
Harald Hoyer
7cddfbbadb iscsi/iscsiroot.sh: use all_ifaces_setup()
we want the route and gateway setup
2015-09-10 13:21:53 +02:00
Harald Hoyer
63e75dc4cd network: add all_ifaces_setup()
all_ifaces_up() is true, if all interfaces are up.

all_ifaces_setup() is true, if all interfaces are up and the gateways
and nameserver are setup.
2015-09-10 13:20:18 +02:00
Harald Hoyer
52845b168d network/dhclient-script.sh: fix RENEW
Remove check, if interface is already up. It is for RENEW.

new_prefix is apparently new_subnet_mask
2015-09-08 11:44:13 +02:00
Harald Hoyer
c850879b86 dracut.usage.asc: update man page
- clarify grub2 config for debugging
- clarify hostonly mode
2015-09-03 16:25:23 +02:00
Harald Hoyer
b334c83e4a network: move "ip=ibft" handling to network module 2015-09-03 12:41:44 +02:00
Harald Hoyer
eb87dc91d0 iscsi/parse-iscsiroot.sh: only set initiator-name, if not empty 2015-09-03 12:41:06 +02:00
Harald Hoyer
b813b1b306 livenet/livenetroot.sh: fixed error condition
copy&paste error
2015-09-02 09:47:35 +02:00
Harald Hoyer
2182945a9e qemu: add spapr-vscsi kernel module 2015-09-01 20:27:13 +02:00
Harald Hoyer
7316d68353 network/ifup: do DHCP for BOOTDEV 2015-09-01 19:05:37 +02:00
Harald Hoyer
a4c47ce0dd network/net-lib.sh: fix IPv6 route parsing 2015-09-01 17:25:34 +02:00
Harald Hoyer
d8572e0bf4 network/net-lib.sh: fix wait_for_if_up()
wait for <*UP*> and not "state UP"

state can be UNKNOWN
2015-09-01 17:23:33 +02:00
Harald Hoyer
70f3c07846 network/ifup: fix warning about not bringing interface up 2015-09-01 17:22:37 +02:00
Harald Hoyer
0852c38b7a cms/cmsifup.sh: do not use ifup -m
we don't want to bring the interface up several times
2015-09-01 17:21:53 +02:00
Harald Hoyer
3d1bd59eb0 multipath: add hostonly multipath.conf
Resolves: rhbz#994702
2015-08-25 13:49:10 +02:00
Harald Hoyer
7c24815034 network/ifup.sh: only use dhcp on unknown interfaces for ip=dhcp 2015-08-25 11:37:16 +02:00
Harald Hoyer
53537f4d23 network: also mark interfaces up with their MAC 2015-08-25 11:30:00 +02:00
Harald Hoyer
b4006781e8 network/ifup.sh: save return value of ifup 2015-08-25 11:20:30 +02:00
Harald Hoyer
a6befb52eb iscsi/parse-iscsiroot.sh: restart iscsid with try-restart 2015-08-25 11:16:46 +02:00
Harald Hoyer
7f59cbd318 iscsi/parse-iscsiroot.sh: handle firmware in online queue 2015-08-25 11:16:29 +02:00
Harald Hoyer
197e4c90b9 iscsi/parse-iscsiroot.sh: do not modify netroot 2015-08-25 11:15:59 +02:00
Harald Hoyer
3bd3bbec31 iscsi/iscsiroot.sh: handle firmware in online queue
otherwise it does not get called, if no netroot is set
2015-08-25 11:14:38 +02:00
Harald Hoyer
35f40b75e4 dracut.spec: raise systemd requirement to >= 219
needs systemd-escape
2015-08-25 11:13:38 +02:00
Harald Hoyer
d3f61fb5cd initqueue: add online queue 2015-08-25 11:13:23 +02:00
Harald Hoyer
310574f7ea TEST-30-ISCSI: add rd.scsi.firmware 2015-08-25 11:12:59 +02:00
Harald Hoyer
b70b81f1c4 crypt/module-setup.sh: fixed parsing crypttab with no ending newline 2015-08-19 16:19:31 +02:00
Harald Hoyer
32770ca79a network/ifup.sh:do_static(): error out, if IP is already assigned 2015-08-19 14:00:28 +02:00
Harald Hoyer
77f46adf5e network/ifup.sh:do_static(): error out, if interface could not be brought up 2015-08-19 13:59:40 +02:00
Harald Hoyer
d9b5a98532 TEST-15-BTRFS: load btrfs module 2015-08-18 15:26:37 +02:00
Harald Hoyer
65977ef1d1 test/TEST-04-FULL-SYSTEMD/create-root.sh: modprobe btrfs
why so ever... it used to load automatically
2015-08-18 15:05:11 +02:00
Harald Hoyer
80153acc0f dmraid: only scan once because of one device 2015-08-18 15:04:31 +02:00
Harald Hoyer
d6bfa7052a network/dhclient: exit arping immediatly, if we get an answer 2015-08-18 12:41:12 +02:00
Harald Hoyer
942d60d8af network/net-lib.sh:ibft unset gateway or dns, if set to 0.0.0.0 2015-08-18 12:40:01 +02:00
Harald Hoyer
69c437dd1c fcoe: cleanup lldpad
Resolves: rhbz#1246217
2015-08-18 12:27:32 +02:00
Harald Hoyer
0c0abf97cc udev-rules: install 40-redhat.rules 2015-08-18 12:25:53 +02:00
Harald Hoyer
2eb3b00133 network/parse-ip-opts.sh: bind enx* interface to the MAC
do it automatically for the persistent naming scheme
2015-08-18 12:13:55 +02:00
Harald Hoyer
38180271c5 network/ifup.sh: arping for static IPv4 addresses 2015-08-18 12:07:41 +02:00
Harald Hoyer
fb2d643a38 network/ifup.sh: let dhcp client run in the background
we need to renew the lease
2015-08-18 11:55:05 +02:00
Harald Hoyer
93a5a3d3ca systemd/dracut-cmdline.sh: print out cmdline in one line 2015-08-18 11:55:05 +02:00
Harald Hoyer
ad565584a3 base/dracut-lib.sh:vinfo/vwarn handle lines without newline 2015-08-18 11:55:05 +02:00
Harald Hoyer
bfe65f913a iscsi: handle timeout case better 2015-08-18 11:55:05 +02:00
Harald Hoyer
415d0c68ab dracut-logger.sh: log also rest of line without return 2015-08-18 11:55:05 +02:00
Harald Hoyer
836ca3f47e TEST-30-ISCSI: fix test to run with new iscsi 2015-08-18 11:55:00 +02:00
Harald Hoyer
f74b0a9f38 iscsi/module-setup.sh: iscsid need /var/lib/iscsi 2015-08-15 13:22:07 +02:00
Harald Hoyer
88329f6b4f iscsi/iscsiroot.sh: systemd-run does not understand --no-block
not yet on RHEL-7
2015-08-15 13:21:29 +02:00
Harald Hoyer
1a2c9bbd2d TEST-30-ISCSI: switch to scsi-target-utils
netbsd-iscsi is not available on RHEL

Beef up the testsuite to use the two targets over different
interfaces.

Test the new iSCSI parameters rd.iscsi.waitnet and rd.iscsi.testroute.

(cherry picked from commit c22c43f81a)
2015-08-13 15:31:59 +02:00
Harald Hoyer
99b9b4896e TEST-30-ISCSI/dhcpd.conf: set the LUN
set the LUN, so the udev rule to mount the disk matches

(cherry picked from commit 52b91b6698)
2015-08-13 15:29:11 +02:00
Harald Hoyer
543a6d5cab iscsi/iscsiroot.sh: handle timeout with all interfaces up
restart iscsid, because it may disbehaved

(cherry picked from commit 6802cf2349)
2015-08-13 15:29:03 +02:00
Harald Hoyer
d9b00731c8 iscsi/parse-iscsiroot.sh: use iBFT initiator name
(cherry picked from commit feb8dc685d)
2015-08-13 15:28:54 +02:00
Harald Hoyer
a9a38f9f60 dracut.cmdline.7.asc: document rd.iscsi.waitnet and rd.iscsi.testroute
(cherry picked from commit 69171aa8fa)
2015-08-13 15:28:48 +02:00
Harald Hoyer
e25c3dbb6f iscsi: integrate with systemd and improve robustness
parse-cmdline sets up an initial initiator-name to let iscsid start.

iscsid is started before doing any iscsistart business.

iscsistart is done with systemd-run asynchrone to do things in
paralllel. Also restarted for every new interface which shows up.

If rd.iscsi.waitnet (default) is set, iscsistart is done only
after all interfaces are up.

If not all interfaces are up and rd.iscsi.testroute (default) is set,
the route to a iscsi target IP is checked and skipped, if there is none.

If all things fail, we issue a "dummy" interface iscsiroot to retry
everything in the initqueue/timeout.

(cherry picked from commit d94050ddae)
2015-08-13 15:28:16 +02:00
Harald Hoyer
d544733084 network/net-lib.sh: add is_ip()
add function to test if string is a valid IP

(cherry picked from commit 01b23b6900)
2015-08-13 15:25:24 +02:00
Harald Hoyer
fc0ead21c9 systemd: add systemd-run and systemd-escape 2015-08-13 15:24:53 +02:00
Harald Hoyer
53ecce179b network/parse-ip-opts.sh: assume rd.neednet for multiple ip options
set rd.neednet on the kernel cmdline to disable this behaviour

(cherry picked from commit 4e9ba952bf)
2015-08-13 15:23:28 +02:00
Harald Hoyer
2bb564073b nfs/parse-nfsroot.sh: silence useless warning if netroot is not nfs
(cherry picked from commit 50e86bf02b)
2015-08-13 15:23:23 +02:00
Harald Hoyer
c643f4e8ab dracut-systemd/dracut-initqueue.sh: be verbose about timeout
Issue a warning, if timeout scripts are executed

(cherry picked from commit 8ba684be1c)
2015-08-13 15:23:17 +02:00
Harald Hoyer
1db0d1f78b dracut-functions.sh:require_binaries() clarify message
The info message written by require_binaries() was a bit frighten to
users. So just be a little bit more verbose.

If you have ideas on how to improve the message for these "soft"
dependency modules, please submit patches.

(cherry picked from commit 0fa5dbedc5)
2015-07-16 09:43:05 +02:00
Harald Hoyer
a6470f332f dracut-functions.sh: degrade info about missing binaries to info
(cherry picked from commit 83a3cba777)
2015-07-16 09:42:50 +02:00
Harald Hoyer
89948e58fd crypt: install drbg unconditionally in hostonly mode
older kernels had the drbg kernel module and didn't need it
2015-07-09 16:14:50 +02:00
Harald Hoyer
77ffc465b9 lvm: add cache tools for dm-cache usage
(cherry picked from commit 70598ac292)
2015-07-03 14:40:08 +02:00
Gerd von Egidy
28be8992c3 Add support for ethernet point-to-point connections configured via DHCP
When current dracut receives an ip with netmask of 255.255.255.255 via DHCP,
setting the also supplied default gateway fails (because it is obviously not
within the netmask).

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

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

Signed-off-by: Gerd von Egidy <gerd.von.egidy@intra2net.com>
(cherry picked from commit 99ccbc30df)
2015-07-03 14:37:37 +02:00
Harald Hoyer
968c66b609 network: setup gateway after setting up resolv.conf
If a daemon listens for route changes and wants to use the interface
afterwards, it should be able to resolve DNS

(cherry picked from commit 0b7bfacfea)
2015-07-03 14:36:12 +02:00
Harald Hoyer
3cf4ec08e5 lsinitrd.sh: ignore "cat: write error: Broken pipe" 2015-07-03 14:35:25 +02:00
Harald Hoyer
77c0b30825 man page: changed grub.conf to grub2.cfg 2015-07-03 14:28:55 +02:00
Harald Hoyer
f11d7a81e2 multipath: install all multipath path selector kernel modules
By default, dracut only builds in dm-service-time into the initramfs as
that is the default multipath.conf path selector. If the user changes
the path selector to "round robin" on the fly and runs dracut, multipath
does not find any paths on boot and the user will be dropped into a
shell.

Apparently, in RHEL7 dracut defaults to "hostonly" mode, i.e. modules
not currently in use at the time dracut runs do not get built into
initramfs. This is definitely one case where this doesn't work. A change
to reconfigure multipath probably should not render the system
unbootable.

https://bugzilla.redhat.com/show_bug.cgi?id=1195392
2015-07-03 14:25:40 +02:00
Harald Hoyer
34b49be882 base/dracut-lib.sh: read /proc/cmdline with multiple lines
also parse cmdline files without an ending newline

(cherry picked from commit 9f0878540b)
2015-07-03 14:17:51 +02:00
Radek Vykydal
ccebb4c045 Add rd.live.overlay.size option
(cherry picked from commit 18423f7951)
2015-07-03 14:16:48 +02:00
Harald Hoyer
2af6708641 dmsquash-live: do not abort, if user pressed ESC on checkisomd5
If the user pressed ESC while checkisomd5 runs the media check, it will
exit with "2". Previously that would mean, that the media check was not
successful.

(cherry picked from commit 370035d561)
2015-07-03 14:08:35 +02:00
Harald Hoyer
900550c4e0 dracut-functions.sh: check if dinfo is a function
If "dinfo" is an executable, dracut-logger.sh would never be sourced.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1167082
(cherry picked from commit 26d14fb3d3)
2015-07-03 14:08:07 +02:00
Colin Guthrie
589b4e61e2 base: Don't wait for swap devices in host-only mode.
The only reason we add swap devices to host-only mode (added in
dd5875499e) is to allow us to process
resume= arguments passed on the kernel command line when the swap
partition lives on something slightly more complex than a normal
partion (e.g. in an LVM or RAID setup).

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

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

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

Inspired by a patch by Martin Whitaker on Mageia bug:
https://bugs.mageia.org/show_bug.cgi?id=12305

(cherry picked from commit 3e3ed34f03)
2015-07-03 14:06:29 +02:00
Hannes Reinecke
7b3178d9ad 95fcoe-uefi: Test for EFI firmware
The fcoe-uefi module should test for EFI firmware when called
in 'hostonly' mode; of no EFI firmware is found then the module
doesn't need to be included.

References: bnc#882412

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
(cherry picked from commit 6755c20855)
2015-07-03 14:04:19 +02:00
Harald Hoyer
e5f4bbd804 livenet: don't attempt to download the image for every interface
https://bugzilla.redhat.com/show_bug.cgi?id=1152485
2015-07-03 14:01:01 +02:00
Harald Hoyer
34203d03c0 fcoe/fcoe-edd.sh: cleanup the script
- check if modprobe was successful
- add a timeout for /sys/firmware/edd
- only remove the module, if it was loaded by the script
2015-07-03 13:53:44 +02:00
Chris Leech
4031a2fa64 fcoe: EDD parsing patch for i40e 2015-07-03 13:44:16 +02:00
Chris Leech
d02f522089 fcoe: start with fcoemon instead of fipvlan 2015-07-03 13:40:34 +02:00
Harald Hoyer
d8ad687e1a network: add options to tweak timeouts
rd.net.dhcp.retry=<cnt>
     If this option is set, dracut will try to connect via dhcp
     <cnt> times before failing. Default is 1.

 rd.net.timeout.dhcp=<arg>
     If this option is set, dhclient is called with "-timeout <arg>".

 rd.net.timeout.iflink=<seconds>
     Wait <seconds> until link shows up. Default is 60 seconds.

 rd.net.timeout.ifup=<seconds>
     Wait <seconds> until link has state "UP". Default is 20 seconds.

 rd.net.timeout.route=<seconds>
     Wait <seconds> until route shows up. Default is 20 seconds.

 rd.net.timeout.ipv6dad=<seconds>
     Wait <seconds> until IPv6 DAD is finished. Default is 50 seconds.

 rd.net.timeout.ipv6auto=<seconds>
     Wait <seconds> until IPv6 automatic addresses are assigned.
     Default is 40 seconds.

 rd.net.timeout.carrier=<seconds>
     Wait <seconds> until carrier is recognized. Default is 5 seconds.
2015-07-03 13:33:27 +02:00
Harald Hoyer
b34bd60c3b kernel-modules: install all HID drivers
Instead of hardcoding a list of useful drivers, which has to be curated
all the time, just include all HID drivers.

(cherry picked from commit 180e9d7851)
2015-07-02 19:47:46 +02:00
Harald Hoyer
afbff20e51 50drm: add hyperv_fb kernel module
https://bugzilla.redhat.com/show_bug.cgi?id=1192035
(cherry picked from commit 81b67232dc)
2015-07-02 19:47:46 +02:00
Fabian Deutsch
55473e86b6 doc: Add a minimal rd.live.overlay documentation
Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
(cherry picked from commit a1b4efe6a7)
2015-07-02 19:47:46 +02:00
Fabian Deutsch
70b7ec9492 dmsquash: Add squashfs support to rd.live.fsimg
Previously rd.live.fsimg only supported filesystems residing in
(compressed) archives.
Now rd.live.fsimg can also be used when a squashfs image is used.
This is achieved by extracting the rootfs image from the squashfs and
then continue with the default routines for rd.live.fsimg.
In addition some code duplication got removed and some documentation
got added.

Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
(cherry picked from commit b0472eac11)
2015-07-02 19:47:46 +02:00
Harald Hoyer
23e3c7f95f dmsquash-live: setup the images in /run/initramfs
We want to cleanup / after switch_root. Placing the loop files in /
works, but it is more sane to put them in /run/initramfs

(cherry picked from commit 1f8abe81a9)
2015-07-02 19:47:46 +02:00
Fabian Deutsch
db1e692c13 dmsquash: Add rd.live.overlay.thin
This option changes the underlying mechanism for the overlay in the
dmsquash module.
Instead of a plain dm snapshot a dm thin snapshot is used. The advantage
of the thin snapshot is, that the TRIM command is recognized, which
means that at runtime, only the occupied blocks will be claimed from
memory, and freed blocks will really be freed in ram.

Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
(cherry picked from commit d6e34d362a)
2015-07-02 19:47:46 +02:00
Major Hayden
b9c6d2b2af Adding support for read/write filesystem images
A user can provide a filesystem image (rootfs.img) inside a compressed
tarball and that filesystem image will be mounted read/write.  This provides
some benefits over a device mapper snapshot overlay, especially when the
live system becomes full.  The boot command line simple needs
"rd.writable.fsimg" added to utilize this feature.

Additional documentation for this option as well as other live boot
options is included.

Signed-off-by: Major Hayden <major@mhtx.net>
(cherry picked from commit 504c0a8fec)
2015-07-02 19:47:46 +02:00
Harald Hoyer
1211a10b95 splitup dracut-init.sh from dracut-functions.sh
other tools want to source dracut-functions.sh without any mkdir side
effects.

(cherry picked from commit 777f2db037)
2015-07-02 19:47:46 +02:00
Harald Hoyer
4350c73199 nfs/nfs-lib.sh: add anaconda_nfsv6_to_var()
add "nfs:[[2001:0db8:85a3:08d3:1319:8a2e:0370:7344]]/path" style parsing

https://bugzilla.redhat.com/show_bug.cgi?id=1190098
(cherry picked from commit ba665de454)
2015-07-02 19:47:46 +02:00
Chao Fan
a218f3253c Change the fs_passno of nfs to 0
There is a bug that kdump-initrd contains entry requesting nfs dump
filesystem to get filesystemchecked. And there is an erro message said
that nfs need be checked. But there's no fsck for nfs utility, e.g
fsck.nfs like other file system. Whatever fs_passno 0 or 2 are passed,
no fsck is executed at all for nfs mount.But in dracut, set it to be 2
always, so the erro message appear and it should be set to 0.

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

Signed-off-by: Chao Fan <cfan@redhat.com>
(cherry picked from commit 3586a7aa77)
2015-07-02 19:47:46 +02:00
Harald Hoyer
fe15c6b6cb nfs/parse-nfsroot.sh: don't unset netroot, if not nfs
(cherry picked from commit afcc697cb8)
2015-07-02 19:47:46 +02:00
Harald Hoyer
00c118a93a network: don't use "ifup -m"
"ifup -m" was thought to be used by humans in the emergency shell.
Using it programatically shows some other flaw in the execution logic.

Also, "ifup -m" was configuring the interface multiple times on "add"
and "change" uevent, because the "$netif.did-setup" test was not
executed.

(cherry picked from commit 7cca5efdce)
2015-07-02 19:47:46 +02:00
Harald Hoyer
4ec362ce0b network/dhclient-script.sh: make IPv4 DHCP lease time optionally
If bootp is used, no lease time is provided in the packet from the bootp
server.

(cherry picked from commit 0f89ec314b)
2015-07-02 19:47:46 +02:00
Harald Hoyer
efe5301ab9 network/dhclient-script.sh: add RENEW/REBIND
(cherry picked from commit cf627b20d0)
2015-07-02 15:16:06 +02:00
Harald Hoyer
da3dacfa5e Factor out all the "type -V" commands
Add new functions require_binaries() and require_any_binary() to be used
in the check() section of module-setup.sh.

These functions print a warning line telling the user, which binary is
missing for the specific dracut module.

This unifies the way of checking for binaries and makes the life of an
initramfs creator easier, if he wants to find out why a specific dracut
module is not included in the initramfs.

(cherry picked from commit 30e6e809ed)
2015-07-02 15:16:06 +02:00
Harald Hoyer
e2b5b450e7 dracut-lib.sh:info() output info to stderr
otherwise it might collide with stdout redirection

(cherry picked from commit 57fb6e67de)
2015-07-02 15:16:06 +02:00
Harald Hoyer
bd98c4def1 crypt: add drbg kernel module 2015-07-02 15:16:06 +02:00
Harald Hoyer
90b5b48734 dracut.sh: add devices with x-initrd.mount in /etc/fstab to host_devs
otherwise dracut might not even be able to mount those.

(cherry picked from commit 916559e073)
2015-07-02 15:16:06 +02:00
Harald Hoyer
1ad2884d82 dracut-pre-pivot: call udevadm settle one last time
Some Hardware needs initialization and killing modprobe or modprobe
scripts would harm the process.
2015-06-16 13:58:05 +02:00
Harald Hoyer
e863891c15 network/net-lib.sh:iface_has_link() wait 5s for the carrier to appear
https://bugzilla.redhat.com/show_bug.cgi?id=1088808
2015-05-07 14:47:58 +02:00
Harald Hoyer
10e5b14705 network:dhcp:wait_for_ipv6_dad() in PREINIT6 2015-05-07 14:42:49 +02:00
Harald Hoyer
a503d1dda9 rearrange fips module ordering due to zlib
[    1.220106] alg: pcomp: Failed to load transform for zlib: -2
[    1.221346] alg: pcomp: Failed to load transform for zlib: -2
2015-05-07 14:29:22 +02:00
Harald Hoyer
8f1febc874 fips: add some s390 kernel modules
(cherry picked from commit 822a7ae504)
2015-05-05 18:16:47 +02:00
Harald Hoyer
cf3098064c dracut.sh: add $tmpfilesdir to install files to /usr/lib/tmpfiles.d
(cherry picked from commit 3a04bddeed)
2015-04-02 16:13:24 +02:00
Harald Hoyer
9eb6db5b9a do not symlink /var/log to /run/log
some programs e.g. systemd-journald expect a directory in /var/log as
the marker to do some actions. Here journald tries to flush
/run/log/journal to /var/log/journal, if the directory is seen.

/var/log is now a symlink to /run/initramfs/log.

(cherry picked from commit 99d4fd6bb7)
2015-04-02 16:11:31 +02:00
Harald Hoyer
3f7d943141 network: do not destroy the team interface on teamd shutdown
when doing switch-root teamd gets killed, which tears down the team
interface, if teamd is not started with "-N".

(cherry picked from commit 2a12e97475)
2015-02-19 12:33:33 +01:00
Harald Hoyer
f2558ddcc1 fips: add drbg kernel module
(cherry picked from commit 7e9341434f)
2015-02-19 11:05:59 +01:00
Harald Hoyer
b9372137fd network:ifup source team info if present 2015-01-21 13:39:28 +01:00
Harald Hoyer
4f992675ae network/net-lib.sh:parse_iscsi_root(): fix c&p bug
fix iscsi_target_name for eui.* and naa.* target names

(cherry picked from commit 7cddd7b838)
2015-01-15 10:37:56 +01:00
Harald Hoyer
6914b67545 dracut: fixed module dependency handling
Fail for "--modules" and "--force-add" dracut modules, if they or their
dependencies cannot be included.

(cherry picked from commit ab2f95e45e)
2015-01-14 11:46:39 +01:00
Harald Hoyer
4c88c2859e network: enhance team support
Install ifcfg-* files with team configuration in the initramfs.

Improve the slave configuration of the team interface, by looking up
ifcfg files in the initramfs.

Create a default loadbalance team config, if none present in the
initramfs.
2015-01-14 11:41:21 +01:00
Harald Hoyer
c984ddda6a test: add "fs-lib" to dracut module list
(cherry picked from commit eda73c0ad2)
2015-01-14 11:41:21 +01:00
Harald Hoyer
368f08cb7e network: add support for comma separated autoconf options
ip=eth0:auto6,dhcp

might work now
2015-01-14 11:41:21 +01:00
Harald Hoyer
7bbee6ac49 systemd: add 90-vconsole.rules
run systemd-vconsole-setup if fbcon device shows up

(cherry picked from commit 027565d023)
2015-01-13 15:10:35 +01:00
Minfei Huang
0b7fad2837 40network: Fix the syntax to correct the judgment sentence
In the judgment sentence, it will print the following warning message,
becasuse of lacking the blank on the left of ']'.

/lib/net-lib.sh: line 110: [: missing `]'

Signed-off-by: Minfei Huang <mhuang@redhat.com>
(cherry picked from commit c440d302f1)
2015-01-13 12:49:32 +01:00
Harald Hoyer
b96ce4a6fd cms/cms-write-ifcfg.sh: turn SUBCHANNELS into lowercase
(cherry picked from commit 3ae03005b8)
2015-01-13 12:48:23 +01:00
Harald Hoyer
509a3b2c33 ssh-client: s/key/$key
GlobalKnownHostsFile was not installed, because key was not $key

Thanks Jan Stodola!

(cherry picked from commit 4ba44e899c)
2015-01-12 14:22:41 +01:00
Harald Hoyer
20700e3dea net-lib.sh:parse_iscsi_root() fix target parsing
For targets with colons in the iSCSI target name:
  "iqn.2000-09.com.foo:storage-system.e2000:00000001cm1p1"

the parser was confused with the optional iscsi_iface_name and
iscsi_netdev_name.

This patch reintroduces the old IQN, EUI and NAA parsing and enhances
the fallback parser by checking the LUN for a numerical value.

(cherry picked from commit 36e8ce4fb0)
2015-01-12 14:11:23 +01:00
Harald Hoyer
8964abbd40 fips: remove c&p "and"
(cherry picked from commit 4089949033)
2015-01-09 14:55:32 +01:00
Harald Hoyer
eeb68f0a16 fips: add libfreeblpriv3.so and libfreeblpriv3.chk
(cherry picked from commit 3659d64df3)
2014-11-28 15:42:56 +01:00
Harald Hoyer
c4c24171bf ifcfg/write-ifcfg: only write DEVICE for non-kernel names
Rename an interface to the kernel namespace is not allowed, so don't add
DEVICE="<iface>", if HWADDR is given.

(cherry picked from commit 3947f07d93)
2014-10-29 14:07:39 +01:00
Harald Hoyer
0630273048 network/net-lib.sh:is_persistent_ethernet_name() eth* is not
eth* is _not_ a persistent ethernet name... tsk, tsk, tsk

(cherry picked from commit 05065741f0)
2014-10-23 14:38:25 +02:00
Will Woods
aa5313ca0e do 'ip route replace default' instead of 'add'
When you define the gateway for an interface, dracut sets it up with:

  ip route add default via $gw dev $netif

If a default route is already set (e.g. if you have multiple NICs), this
will fail with the message "RTNETLINK answers: File exists".

So, if your first NIC isn't usable as a default route

Using "ip route replace default" instead allows ifup/dhclient-script to
correctly change the default route to the new interface.
2014-09-12 10:22:13 +02:00
Harald Hoyer
815ab93fe9 dracut-functions.sh: exit for missing --force-add or --add dracut modules
Better exit with fail early, so there is no surprise on reboot.

(cherry picked from commit a49cac2e65)
2014-09-12 10:20:45 +02:00
Harald Hoyer
c5c57f3f19 qemu: install virtio_console kernel module
https://bugzilla.redhat.com/show_bug.cgi?id=1097999
(cherry picked from commit 5058ae2d29)
2014-09-12 10:04:30 +02:00
Harald Hoyer
b44b3ed036 cms/cmssetup.sh: understand DASD="none"
Treat DASD="none" as unset.

https://bugzilla.redhat.com/show_bug.cgi?id=1096979
(cherry picked from commit 2f954621cc)
2014-09-12 10:00:23 +02:00
Harald Hoyer
49a23aa426 cms/cmssetup.sh: fixed indention
(cherry picked from commit d681635512)
2014-09-12 10:00:19 +02:00
Harald Hoyer
efaa5b05df ifcfg/write-ifcfg.sh: bind bond and bridge interfaces to HW
either by s390 SUBCHANNELS or HWADDR, if the interface name is not
persistent.

Previously, this was bound unconditionally with HWADDR.

(cherry picked from commit 80043e21c1)
2014-09-12 09:53:20 +02:00
Alex Harpin
4fa660ba8f bridging: update the ifcfg files generated for bridge slaves
Update the ifcfg files generated for bridge slaves so they reference
the bridge they are part of.  Related to early patch submitted as a
fix for Bug #1123552.

Bug #1123552 https://bugzilla.redhat.com/show_bug.cgi?id=1123552

(cherry picked from commit 32125a976b)
2014-09-12 09:53:13 +02:00
Harald Hoyer
19bb8937ed fixed bridge setup
renamed "ethnames" in bridge.info to "bridgeslaves"

fixed ifcfg generation

(cherry picked from commit 2db6d71118)
2014-09-12 09:53:04 +02:00
Brian C. Lane
17c1f640fa Support spaces in mount_nfs (#1109933)
nfs paths may contain spaces, make sure they are preserved when passed
to nfs_to_var and mount.

Related: rhbz#1109933
(cherry picked from commit 7e692cfd43)
2014-09-10 11:09:07 +02:00
Harald Hoyer
e03b09212a replaced ip=auto with ip=dhcp in the documentation
https://bugzilla.redhat.com/show_bug.cgi?id=1086931
2014-09-09 13:35:13 +02:00
Harald Hoyer
f86fa29cda network/net-lib.sh:parse_iscsi_root() do not enforce target name
https://bugzilla.redhat.com/show_bug.cgi?id=1078867

cherry-picked from 29763cb72d
2014-09-09 13:33:16 +02:00
Hari Bathini
f2c5c5c961 Dracut: Add a new argument "--rebuild"
Add "rebuild" option to dracut to  append the current  arguments
to those with  which the input initramfs image was  built.  This
option helps in incrementally building initramfs for testing.

    Usage: dracut [output_file] --rebuild input_file

If optional output file  is not provided, input file provided to
rebuild will be used as output file.

This patch alters  the creation of the initramfs image by adding
the file "/tmp/params.txt" to the image. Command line parameters
excluding "--rebuild",  input  &  output image names and "kernel
version" are stored in this file.  In case "--rebuild" parameter
is specified, "/tmp/params.txt" file, if present in input image,
is read and its contents "prepend"ed to the current command line
parameters, that is if such a file is already present. Also,  it
stores the  cumulative parameters to the file "/tmp/params.txt",
in the  new image. This patch  has been tested successfully on a
PowerBox with f19. It does not alter the behaviour of any of the
existing  options.

Signed-off-by: Manik Bajpai <manibajp@linux.vnet.ibm.com>
Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>

[Edited-by: Harald Hoyer]
Simplified the cpio extraction process by using 'lsinitrd'.

(cherry picked from commit 659dc319d9)
2014-09-04 12:57:43 +02:00
Hannes Reinecke
81a6e87f0f Make logfile configurable
Add '--logfile' option to make the log file configurable during
runtime.

Signed-off-by: Hannes Reinecke <hare@suse.de>
(cherry picked from commit ee54b8404c)
2014-09-04 12:47:36 +02:00
Harald Hoyer
52923f5f2a dracut-functions.sh: do not force require modules.builtin*
(cherry picked from commit b29cb51654)
2014-09-04 12:47:31 +02:00
Harald Hoyer
c46be83492 dracut.sh: no need to make subdirs in run
(cherry picked from commit 8d89fc6bb1)
2014-09-04 12:47:27 +02:00
Harald Hoyer
c2ce987e38 dracut.sh: also mkdir /run/lock, which is copied to
(cherry picked from commit 68b736b50f)
2014-09-04 12:47:23 +02:00
Hari Bathini
564c0c4577 lsinird: Adding option "-m|--mod" to list dracut modules in the image
This patch adds option "-m|--mod" to lsinitrd to list dracut
modules in the image  because sometimes  having an option to
only list the dracut modules in the image could be handy.

Sample output:
--------------

[hbathini@localhost dracut]$ sudo ./lsinitrd.sh initramfs-3.11.10-100.fc18.x86_64.img -m
Image: initramfs-3.11.10-100.fc18.x86_64.img: 33M
========================================================================
Version: dracut-029-1.fc18.2

dracut modules:
i18n
network
ifcfg
drm
plymouth
btrfs
crypt
dm
dmraid
kernel-modules
lvm
mdraid
cifs
iscsi
nfs
resume
rootfs-block
terminfo
udev-rules
biosdevname
systemd
usrmount
base
fs-lib
shutdown
========================================================================

Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
(cherry picked from commit 05d2a14526)
2014-09-04 12:26:35 +02:00
Harald Hoyer
5648ff27e2 Do not reload systemd with wait_for_dev 2014-08-29 14:15:18 +02:00
Harald Hoyer
8715aa00a9 dracut-lib.sh:cancel_wait_for_dev() fixed double escape 2014-08-29 14:14:59 +02:00
Harald Hoyer
828fd83bc1 ssh-client: handle /etc/ssh/ssh_config
- disable ProxyCommand
- install the GlobalKnownHostsFile

https://bugzilla.redhat.com/show_bug.cgi?id=1086778
2014-08-29 14:14:10 +02:00
Harald Hoyer
4de30f02c8 add kate and emacs per directory config files 2014-08-29 13:51:39 +02:00
Harald Hoyer
1e03d8eb64 testsuite mods for kvm nested in kvm 2014-07-29 16:27:35 +02:00
Harald Hoyer
2a1bdab6e8 udev-rules: add uaccess and seat rules
plymouth needs the seat rules, also without systemd
2014-07-29 14:39:38 +02:00
Harald Hoyer
c504204de5 network: add rd.route parameter
(cherry picked from commit 7b46244bb9)
2014-07-29 12:06:48 +02:00
Harald Hoyer
e502fd3099 base/dracut-lib:pidof() turn off debugging
(cherry picked from commit ad8638e04e)
2014-07-29 12:06:46 +02:00
Peter Robinson
1e9926c12d ARM: update modules for ARM host only options
(cherry picked from commit 611c895772)
2014-07-29 12:06:42 +02:00
Praveen_Paladugu@Dell.com
7b8f2e7a7b Installing an OS with VLAN enabled to an ISCSI LUN (from ibft)
When installing OS to a VLAN enabled iscsi LUN (extracted from iBFT), "/tmp/net.{xyz}.has_ibft_config" is not being set properly.

Then anaconda installer requires 'BOOTPROTO="ibft"' populated in ifcfg of the vlan interface (ex: ibft0.20), for it to properly populate the kernel parameters post installation. The setting 'BOOTPROTO="ibft"' is populated by write-ifcfg.sh script only if the corresponding interface has a file /tmp/net.{xyz}.has_inft_config

To get around this issue, in ibft_to_cmdline() function in net-lib.sh file, I made the following changes to populate the has_ibft_config file for the vlan interface(ex: ibft0.20):

(cherry picked from commit f4eb0d9804)
2014-07-29 12:06:32 +02:00
Harald Hoyer
8bf70609de dracut-functions.sh: speed up ldconfig_paths()
(cherry picked from commit 5ea0be0a8c)
2014-07-29 12:06:19 +02:00
Harald Hoyer
bb232c88fa dracut.sh: always copy prelink files in FIPS mode
regardless of the the prelink={yes|no} switch

(cherry picked from commit 6cd7001b35)
2014-07-29 12:06:13 +02:00
Harald Hoyer
0c81abbe79 lvm:module-setup.sh: check for existance of 69-dm-lvm-metad.rules
fixup for 12819a5799

(cherry picked from commit fecc1d69e5)
2014-07-29 12:06:09 +02:00
Harald Hoyer
17e74416c8 TEST-15-BTRFSRAID: install /etc/os-release
makes systemd switch-root happy

(cherry picked from commit 44537b7bf8)
2014-07-29 12:06:01 +02:00
Harald Hoyer
932169bc34 test: add udev settle after sfdisk
(cherry picked from commit e54d961160)
2014-07-29 12:05:58 +02:00
Harald Hoyer
b201a3f405 ifcfg: depends on network
(cherry picked from commit f1a38e5294)
2014-07-29 12:05:42 +02:00
Harald Hoyer
ef6665ec41 base/init.sh: use loop counter with unique varname
$i can be polluted too easily

(cherry picked from commit 6525182bfc)
2014-07-29 12:05:38 +02:00
Harald Hoyer
9c2daa5d3a Add "rd.cmdline=ask" kernel command line parameter
prompts the user for additional kernel command line parameters

(cherry picked from commit f232f6623d)

Conflicts:
	dracut.cmdline.7.asc
	modules.d/98systemd/dracut-cmdline.sh
	modules.d/99base/init.sh
2014-07-29 12:04:22 +02:00
Harald Hoyer
f679f53b2a kernel-modules: add tegra arm modules
(cherry picked from commit 54483dd773)
2014-07-29 12:02:25 +02:00
Harald Hoyer
6a9d47ce27 print out, what kernel command line parameters are used
(cherry picked from commit fbc4620f05)

Conflicts:
	modules.d/98systemd/dracut-cmdline.sh
2014-07-29 12:02:06 +02:00
Harald Hoyer
49fe9bc014 usable_root(): only check for ld-*.so
current systemd allows booting with only /usr on the root partition

see, if we can find an elf loader

(cherry picked from commit 7e59d55042)
2014-07-29 12:01:33 +02:00
Tobias Geerinckx
491dbfe072 lsinitrd.sh: don't choke on LZO-compressed images
lsinitrd (and hence dracut) currently fail to list the contents of any
LZO-compressed image, and merely spit out misleading xzcat errors.

I guess no-one actually uses them.

(cherry picked from commit 773d6a7ded)
2014-07-29 12:01:08 +02:00
Daniel Schaal
8c1807bc97 98systemd: also install systemd-journald-dev-log.socket
The /dev/log socket was moved to /run on systemd 214, install the
newly added socket unit.

(cherry picked from commit 7eb0bc7bc4)
2014-07-29 12:01:04 +02:00
Cristian Rodríguez
7cab5fbf59 systemd: Optionally, include efivarsfs module
It is, however not an error if this module can't be found.

(cherry picked from commit f46c2fff71)
2014-07-29 12:00:58 +02:00
Harald Hoyer
6db59a1630 deprecate "ip=ibft" kernel command line parameter
rd.iscsi.ibft[=1] should be used instead.

Thing is, 'ip=ibft' is not really an ip setting, but rather a marker
that iBFT should be evaluated.

Also removed the trigger of the warning:
"Warning: Please supply bootdev argument for multiple ip= lines"

(cherry picked from commit 5580e4c176)
2014-07-29 12:00:51 +02:00
Harald Hoyer
98b104e887 iscsi: correctly install the settled iscsiroot dummy call
initqueue parses $1 as the executable command

(cherry picked from commit bb8c16d121)
2014-07-29 12:00:45 +02:00
Harald Hoyer
b66bfd5b98 iscsi: correctly install the timeout iscsiroot dummy call
initqueue parses $1 as the executable command

(cherry picked from commit 486a8f33e2)
2014-07-29 12:00:42 +02:00
Vasiliy Tolstov
962bb11663 network/ifup.sh: Don't try to modprobe ipv6, if already available
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>

[Edited-by: Harald Hoyer]
Simplified logic.

(cherry picked from commit 28f3f537c4)
2014-07-29 12:00:37 +02:00
Alex Harpin
5f5c07eca2 bonding: use hwaddr of the slave rather than the master
When a bonded interface is brought up, any slaves included in the bond
have their hardware address set to that of the bond master.  Although
this allows an interface to be brought up on start up, when the
configuration file is imported into the booted system it prevents
the bonded interface being successfully restarted.

The fix involves obtaining the hardware address of the slaves before
they are added to the bond and then using this value in the
configuration file.

(cherry picked from commit 83c9ff7dbb)
2014-07-29 12:00:33 +02:00
Peter Robinson
9c45cb9c11 kernel-modules: Fix storage module selection for sdhci/mmc/ahci
Currently the block driver detection for generic initrd doesn't include
the SD/MMC drivers so we fail to boot generic images on any device using
those platforms as boot devices when using a generic initrd. Add logic
to detect those modules. This primarily fixes embedded ARM devices but
also likely intel tablets/dev boards and enterprise hypervisors that
have the ability to boot from SD.

Also the ahci_init_controller misses a number of drivers that use the
libahci_platform module for the init so this fixes some missing achi
moduless too.

Finally it cleans up the ARM storage module hacks that the above now
deals with in a more generic manner.

Signed-off-by: <pbrobinson@gmail.com>
(cherry picked from commit 827ec27a9c)
2014-07-29 12:00:29 +02:00
WANG Chao
2fed6038bb dracut-pre-pivot pulls in remote-fs.target
It turns out that commit f30b74e (dracut-initqueue service runs before
remote-fs-pre.target) is partial fix for remote fs mounts. Because no
one pulls in remote-fs.target, we can never start remote fs mounts.
Now pull in remote-fs.target in dracut-pre-pivot.

Signed-off-by: WANG Chao <chaowang@redhat.com>
(cherry picked from commit ce7f408dfd)
2014-07-29 12:00:25 +02:00
Hannes Reinecke
e23057d537 98systemd: fixup rootfs-generator installation path
The rootfs-generator was installed in the wrong path
in the initrd, cause it never to be run.

References: bnc#878714

Signed-off-by: Hannes Reinecke <hare@suse.de>
(cherry picked from commit ed2005fa5b)
2014-07-29 12:00:06 +02:00
Harald Hoyer
40a5d2c029 dracut-functions.sh:print_vars() fix for values with spaces
for a variable with spaces, e.g.:
EXT_KEYMAPS='backspace keypad euro2'

The following would occur:
print_vars: eval printf -v _value %s '$EXT_KEYMAPS'
print_vars: printf -v _value %s backspace keypad euro2
print_vars: [[ -n backspacekeypadeuro2 ]]
print_vars: printf '%s=\"%s\"\n' EXT_KEYMAPS backspacekeypadeuro2

Thanks to Sebastian Köln for the fix!

(cherry picked from commit 7a94a4326f)
2014-07-29 12:00:03 +02:00
Harald Hoyer
e92a7a2532 fcoe-uefi/parse-uefifcoe.sh: fixed parameter generation from UEFI
"fcoe=" was missing for the parameter specifying the interface

(cherry picked from commit 1427102692)
2014-07-29 11:59:56 +02:00
Harald Hoyer
1175816c30 nbd/nbdroot.sh: call nbd-client with "--systemd-mark"
otherwise nbd-client will get killed by systemd

(cherry picked from commit 056a3f2427)
2014-07-29 11:59:52 +02:00
Harald Hoyer
2a20064e44 ifcfg/write-ifcfg.sh: include net-lib.sh
otherwise is_persistent_ethernet_name() is missing

(cherry picked from commit 8fa1afb65c)
2014-07-29 11:59:49 +02:00
Harald Hoyer
ec158d758b mdraid/module-setup.sh: fixed print-cmdline for empty UUID
fixes

/usr/lib/dracut/modules.d/90mdraid/module-setup.sh: line 60:
_activated["${UUID}"]: bad array subscript

Thanks to Jan ONDREJ for spotting this!

(cherry picked from commit 19bb14c346)
2014-07-29 11:59:46 +02:00
Harald Hoyer
705c84321d cms/cmssetup.sh: convert SUBCHANNELS to lowercase
In udev rules, the channels need to be expressed in lower case.

(cherry picked from commit 56d57a70ec)
2014-07-29 11:59:40 +02:00
Harald Hoyer
d38488e8d5 ifcfg/write-ifcfg.sh: "IPV6INIT=yes" check also for non-dhcp
(cherry picked from commit 1230f3bcff)
2014-07-29 11:59:36 +02:00
Harald Hoyer
a2a9a17cc6 Do not log to kmsg/syslog and files for "--print-cmdline"
(cherry picked from commit 535f61ca4a)
2014-07-29 11:59:33 +02:00
Harald Hoyer
e5f6899a55 dracut-lib.sh: fixed return value of pidof()
pidof always returned with 0, so any "while pidof" loop would not
terminate.

Thanks "Consus" for the hint!

(cherry picked from commit 4e58a1ffc7)
2014-07-29 11:59:29 +02:00
Harald Hoyer
0506080aee ifcfg: only bind to HWADDR, if addr_assign_type == 0
/sys/class/net/$netif/addr_assign_type is != 0 for random MAC address
interfaces

(cherry picked from commit 2e094b20a6)
2014-07-29 11:58:25 +02:00
Harald Hoyer
b990775b6f ifcfg: do not bind persistent interface names to HWADDR
(cherry picked from commit fb0e5184a6)
2014-07-29 11:58:19 +02:00
WANG Chao
251d5b65e3 dracut-initqueue service runs before remote-fs-pre.target
With the following commit, dracut doesn't mount anything from /etc/fstab

commit e920bfb
Author: WANG Chao <chaowang@redhat.com>
Date:   Tue Apr 1 15:20:49 2014 +0800

    fstab: do not mount and fsck from fstab if using systemd

But systemd doesn't mount nfs at all, because no unit is pulling in
remote-fs.target.

dracut must pull in these remote fs mount and all these remote mounts
should start only after network is up (ie. after dracut-initqueue).

Signed-off-by: WANG Chao <chaowang@redhat.com>
(cherry picked from commit b31250e7e6)
2014-07-29 11:58:13 +02:00
Harald Hoyer
915618bc4f lvm:module-setup.sh: check for existance of 69-dm-lvm-metad.rules
Before modifying 69-dm-lvm-metad.rules, we should check for the
existance first. Otherwise this results in error messages on
distributions (debian), which do not ship these rules.

(cherry picked from commit 12819a5799)
2014-07-29 11:57:48 +02:00
WANG Chao
f077a20056 fstab: do not mount and fsck from fstab if using systemd
If using systemd in initramfs, we could run into a race condition when
dracut and systemd both are trying to mount and run fsck for the same
filesystem, and mount or fsck could be a failure.

To fix such failure, we should use systemd to mount/fsck from /etc/fstab
only.

v2: check $DRACUT_SYSTEMD suggested by Alexander Tsoy

Signed-off-by: WANG Chao <chaowang@redhat.com>
(cherry picked from commit e920bfb1e8)
2014-07-29 11:54:47 +02:00
Harald Hoyer
e1021bd2c1 dracut-functions.sh: add /lib/modules/*/{extras|weak-updates} for kernel modules
https://bugzilla.redhat.com/show_bug.cgi?id=1086291
2014-07-29 11:52:07 +02:00
Harald Hoyer
f1ea5376ed ifcfg/write-ifcfg.sh: turn on IPV6INIT, if any inet6 address is found
If "ip -6 addr" finds any inet6 address, assume IPV6INIT=yes for the
ifcfg file.
2014-07-29 11:52:07 +02:00
Harald Hoyer
4b07c26d33 fs-lib: always install fsck.$fs, if present 2014-07-29 11:52:07 +02:00
Alexander Tsoy
07c4a2fce5 Add legacy flag (-l) to lz4 and update magic number
Linux kernel does not support the new default lz4 format.

https://bugs.gentoo.org/show_bug.cgi?id=502102
2014-07-29 11:52:07 +02:00
Harald Hoyer
4c2d48d5c4 fcoe: workaround fcoe timing issues 2014-07-29 11:52:07 +02:00
Harald Hoyer
db1b5a38e9 dm: add dm-cache modules
https://bugzilla.redhat.com/show_bug.cgi?id=1081435
2014-07-29 11:52:07 +02:00
Harald Hoyer
69acbc4735 network: DCHPv6: set valid_lft and preferred_lft
https://bugzilla.redhat.com/show_bug.cgi?id=1064365
2014-07-29 11:52:07 +02:00
Harald Hoyer
7031115695 lsinitrd.sh: prevent < <$() construct
Running dracut in a chroot environment, which has /dev not correctly
setup will result in errors like:

/usr/bin/lsinitrd: line 164: /dev/fd/62: No such file or directory
cpio: Malformed number �5�OK��
cpio: Malformed number 5�OK��
cpio: Malformed number �OK��

This is because bash wants /dev/fd/<num> for constructs like:
foo < <$(bar)
2014-07-29 11:52:07 +02:00
Harald Hoyer
42896820ba network: handle "ip=dhcp6" for all interfaces
https://bugzilla.redhat.com/show_bug.cgi?id=1064365
2014-07-29 11:52:07 +02:00
Harald Hoyer
bdb6683d6f fcoe: wait for lldpad to be ready
https://bugzilla.redhat.com/show_bug.cgi?id=1080353
2014-07-29 11:52:07 +02:00
Harald Hoyer
c2196a25b7 dracut-initramfs-restore: fix unpacking with early microcode
(cherry picked from commit 0626cbe923)
2014-07-29 11:52:07 +02:00
Harald Hoyer
9d75fd3b62 shutdown: if kexec failed, do a simple reboot 2014-07-29 11:52:07 +02:00
Harald Hoyer
89f2586ae9 network:dhclient-script do PREINIT6 for DHCP6 2014-07-29 11:52:07 +02:00
Harald Hoyer
af1154fdce systemd/dracut-shutdown.service: make failure non-fatal 2014-07-29 11:52:07 +02:00
Harald Hoyer
84c66ac857 Do not wait_for_dev if hostonly_cmdline not set 2014-07-29 11:52:07 +02:00
Harald Hoyer
711030d61d dracut: don't let devices timeout
https://bugzilla.redhat.com/show_bug.cgi?id=949697
2014-07-29 11:52:06 +02:00
WANG Chao
e2e32cd02f Add -[-no]-hostonly-cmdline option handling for getopt
commit ab9457e introduce such new options but it missed to add these
options to getopt arguments.

Signed-off-by: WANG Chao <chaowang@redhat.com>
2014-07-29 11:52:06 +02:00
Harald Hoyer
dccf47fd55 test/TEST-50-MULTINIC/client-init.sh: skip MAC marker files 2014-07-29 11:52:06 +02:00
Harald Hoyer
e96c010011 test/Makefile: add SKIP env to skip certain tests 2014-07-29 11:52:06 +02:00
Harald Hoyer
8482be832c test: add missing Makefile.testdir 2014-07-29 11:52:06 +02:00
Dave Young
d52c4a761a add default values in fstab_lines
It's useful for passing a full fstab line including like fs_passno so fsck
can take effect.

Previously it's assumed that there's no fs_freq and fs_passno in fstab lines
so original code just append "0 0" at the end of each fstab lines.

Improve this issue by assign default value in case they are not passed in.
Three field are handled here:
fs_mntops: default to "defaults"
fs_freq: default to "0"
fs_passno: default to "2"

Signed-off-by: Dave Young <dyoung@redhat.com>
2014-07-29 11:52:06 +02:00
Harald Hoyer
61bad12d44 systemd: add systemd-sysctl service
https://bugzilla.redhat.com/show_bug.cgi?id=1070086
2014-07-29 11:52:06 +02:00
Harald Hoyer
853897808a network: merge setup_net_$netif.ok and net.$netif.did-setup
one marker per interface is enough
2014-07-29 11:52:06 +02:00
Harald Hoyer
30e2074447 network: IPv6 status, wait for tentative flag to be cleared
also do not arping the IPv6 address.
2014-07-29 11:52:06 +02:00
Harald Hoyer
54c9094e2e network/dhclient-script.sh:DHCP IPv6 interface setup
configure IPv6 interface for DHCP6

https://bugzilla.redhat.com/show_bug.cgi?id=1064365
2014-07-29 11:52:06 +02:00
Harald Hoyer
61fe003168 network/net-lib.sh:wait_for_ipv6_auto() also wait for the tentative flag
Wait until the tentative flag is cleared.

https://bugzilla.redhat.com/show_bug.cgi?id=1069263
2014-07-29 11:52:06 +02:00
Harald Hoyer
ea6bc75ccb ifcfg/write-ifcfg.sh: do not bind s390 to MAC if SUBCHANNELS set
If SUBCHANNELS are set, do not specify HWADDR, because the SUBCHANNELS
are the identifier for the interface.

https://bugzilla.redhat.com/show_bug.cgi?id=1056438
2014-07-29 11:52:06 +02:00
Harald Hoyer
5a3b267d06 systemd/rootfs-generator.sh: generate units in /run/systemd/generator
Generate the units in /run/systemd/generator, so they are picked up by
systemd.

https://bugzilla.redhat.com/show_bug.cgi?id=1069133
https://bugzilla.redhat.com/show_bug.cgi?id=949697
2014-07-29 11:52:06 +02:00
Harald Hoyer
c2c437edba default conf: set hostonly_cmdline == "no" 2014-07-29 11:52:06 +02:00
Harald Hoyer
81c9e22482 Add flag to toggle hostonly cmdline storing in the initramfs
--hostonly-cmdline:
    Store kernel command line arguments needed in the initramfs

--no-hostonly-cmdline:
    Do not store kernel command line arguments needed in the initramfs
2014-07-29 11:52:06 +02:00
Harald Hoyer
da41507de9 systemd: add 70-uaccess.rules 2014-07-29 11:52:06 +02:00
Harald Hoyer
a367bed836 systemd: add sys-kernel-config.mount 2014-07-29 11:52:06 +02:00
Harald Hoyer
6381b94459 dracut.sh: write directly to the output file
Because we already remove the output file before writing to it, we don't
have to play games and write to a temporary file first.
2014-07-29 11:52:06 +02:00
Harald Hoyer
346fab9500 fcoe-uefi: try all FcoeBootDevice-* variables for a DevicePath
try to read the DevicePath from all FcoeBootDevice-* UEFI variables
until one has a MAC.
2014-07-29 11:52:06 +02:00
Harald Hoyer
84dfea4d2a iscsi: for iBFT read the initiator-name from the correct file
/sys/firmware/ibft/initiator-name should be
/sys/firmware/ibft/initiator/initiator-name

https://github.com/haraldh/dracut/issues/12
2014-07-29 11:52:06 +02:00
Harald Hoyer
64c88c2f1d dracut-functions.sh:find_kernel_modules_by_path() fixed updates search
"updates/*" path does not start with "/"
2014-07-29 11:52:06 +02:00
Harald Hoyer
9bbea8caf8 kernel-modules: add sdhci_acpi to the static list of kernel modules
Thanks Adam Williamson!

https://bugzilla.redhat.com/show_bug.cgi?id=1063556
2014-07-29 11:52:06 +02:00
Colin Guthrie
361eaeaf07 dracut.sh: Fix variable name typo.
This caused the root_dev variable not to be set which in turn meant that
the root device was not whitelisted in 99base/module-setup.sh when injecting
compile-time devexists hooks in hostonly initrds. This ties the generated
initrd to the root fs device (typically the UUID) rather than relying solely
only the root= kernel command line.

While it is hostonly, not hardcoding e.g. UUIDs is still desirable. Any
swap partition on the host device is still added however.
2014-07-29 11:52:06 +02:00
Brian C. Lane
99ed45c218 new_dhcp_next_server is really new_next_server
The variable that dhclient sets doesn't have dhcp in the name. This
could cause problems with setups where the server is not the same as the
dhcp server.
2014-07-29 11:52:06 +02:00
Harald Hoyer
80f75fed99 systemd/dracut-pre-pivot: run for /dev/{nfs,root} and cleanup /dev/nfs
dracut-pre-pivot was not cleaning up /dev/nfs and did not run to clean
up /dev/root.
2014-07-29 11:52:06 +02:00
Harald Hoyer
37a09c9cb6 nfs/nfsroot: symlink /dev/null to /dev/nfs, as a marker for root=/dev/nfs 2014-07-29 11:52:06 +02:00
Harald Hoyer
054447fa23 network/ifup: do not run dhclient twice on the same interface 2014-07-29 11:52:06 +02:00
Harald Hoyer
0c0ca2d9bc network/ifup: do not ifup an already setup network interface 2014-07-29 11:52:06 +02:00
Harald Hoyer
226004e007 skipcpio: fixed signatured check 2014-07-29 11:52:06 +02:00
Cristian Rodríguez
dc662386dc skipcpio: return something at end of program
Otherwise the compiler emits a warning and the return vale is
in theory undefined.
2014-07-29 11:52:06 +02:00
Harald Hoyer
36d3274050 network:fix dns parsing in ip= parameter 2014-07-29 11:52:05 +02:00
Harald Hoyer
d802e985ae fcoe-uefi: do not include, if fcoe utils not installed 2014-07-29 11:52:05 +02:00
Harald Hoyer
3bb36e4512 dracut.spec: add 95fcoe-uefi and 99uefi-lib 2014-07-29 11:52:05 +02:00
Harald Hoyer
c26eb3eb3a move uefi-lib to a seperate module 2014-07-29 11:52:05 +02:00
Harald Hoyer
8bde20bc65 fcoe: move uefi parsing to fcoe-uefi module 2014-07-29 11:52:05 +02:00
Harald Hoyer
c127eb8021 base/rdsosreport.sh: add dracut version to rdsosreport 2014-07-29 11:52:05 +02:00
Harald Hoyer
5676a6d877 dmsquash-live/dmsquash-liveiso-genrules.sh: s/loop0/loop-control/
If loop is a kernel module, /dev/loop0 will never show up as a udev
event, if the loop module is not manually loaded somewhere.
2014-07-29 11:52:05 +02:00
Harald Hoyer
3d47b5124c network/net-lib.sh: parse ibft nameserver settings 2014-07-29 11:52:05 +02:00
Harald Hoyer
b397bb7c19 network/ifup.sh: handle $dns1 and $dns2 from "ip=" settings 2014-07-29 11:52:05 +02:00
Harald Hoyer
b4b60da8dc network: understand ip=.....:<dns1>:<dns2> 2014-07-29 11:52:05 +02:00
Harald Hoyer
c6fe81559e dracut.conf.d/fedora.conf.example: turn on early_microcode by default 2014-07-29 11:52:05 +02:00
Harald Hoyer
286fbebdaf dracut.sh: only set the owner of files to 0:0, if generated as non-root
If the root user generates the initramfs image, preserve the ownership
of the files. This of course cannot be done for non-root users
generating an initramfs image.
2014-07-29 11:52:05 +02:00
Harald Hoyer
27acb483e8 dracut-functions.sh: also search in the updates directory 2014-07-29 11:52:05 +02:00
Cristian Rodríguez
657e832da0 systemd: ensure autofs4 and ipv6 are included
Systemd tries to load this modules very early.
Even though they are not strictly required it it is a good
thing to have them around.

[Edited-by: Harald Hoyer: moved to installkernel() ]
2014-07-29 11:52:05 +02:00
Harald Hoyer
40cf35ef4e dracut.spec: add skipcpio 2014-07-29 11:52:05 +02:00
Harald Hoyer
f812e271cb iscsi/iscsiroot.sh: beautify warning 2014-07-29 11:52:05 +02:00
Stig Telfer
2f117f4db3 dracut-lib.sh: bugfix for pidof function
In follow-up, the patch requires a second mod: kernel tasks have a /proc/.../exe that links to nothing and derails the for loop:
2014-07-29 11:52:05 +02:00
Stig Telfer
37a18fda11 dracut-lib.sh: bugfix for pidof function
It appears there is a simple substitution error in the pidof shell function which causes it to fail to find processes.  In my case, processes started by 95nfs are not terminated in the cleanup hook.  This causes knock-on effects disturbing the root filesystem service dependencies.

Enjoy,
Stig Telfer
2014-07-29 11:52:05 +02:00
Harald Hoyer
ade113d75b network/dhclient-script.sh: set lease time
The dracut dhclient-script.sh should set address lifetimes to the DHCP
lease time, so that other stuff (like NetworkManager!) knows that the
address is temporary and was created by DHCP.

https://bugzilla.redhat.com/show_bug.cgi?id=1058519
2014-07-29 11:52:05 +02:00
Harald Hoyer
815b9c16a4 lsinitrd.sh: make use of the skipcpio utility
With the skipcpio utility, the whole contents of an initramfs with an
early cpio image can be displayed.
2014-07-29 11:52:05 +02:00
Harald Hoyer
eb7c58eced dracut.sh: add early_cpio marker file to the early cpio 2014-07-29 11:52:05 +02:00
Harald Hoyer
a3dc6a7218 add skipcpio utility
skipcpio skips a cpio archive at the beginning of a file.

It is used for skipping an early cpio archive for lsinitrd.
2014-07-29 11:52:05 +02:00
Harald Hoyer
87862728da dracut.sh: set file owners of early cpio files to 0:0 2014-07-29 11:52:05 +02:00
Harald Hoyer
0d4bb7ce89 dracut.sh: create early cpio dir for acpi tables 2014-07-29 11:52:05 +02:00
Harald Hoyer
b1cdf7c5d4 Revert "dmraid: let dmraid setup the partitions"
This reverts commit fbf717086e.

dmraid seems to use "p" as a seperator by default.

Reverting to kpartx, until this is fixed.
2014-07-29 11:52:05 +02:00
Koen Kooi
a0b85db18e dracut-initramfs-restore,lsinitrd: add LZ4 support
Dracut claims to have LZ4 support, but trying to use it will result in an xzcat failure at the end due to missing CAT support.

The lz4 command chokes on '--', so abstract that out into the CAT select.

Something similar will need to be done for LZO.

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
2014-07-29 11:52:05 +02:00
Koen Kooi
dfaeee7341 Use builtin xz/lzma option to use all cores for multihreaded compression
This removes the dependency on 'getconf' as well, which is not installed by default on my embedded systems.

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
2014-07-29 11:52:05 +02:00
Harald Hoyer
74c9df58f2 dracut-logger.sh: systemd-cat only understands prio 0-7 2014-07-29 11:52:05 +02:00
Harald Hoyer
3c4e663251 lvm:lvm_scan.sh handle one LV at a time with lvchange 2014-07-29 11:52:05 +02:00
Harald Hoyer
56a5975f91 iscsiroot: touch the right marker file 2014-07-29 11:52:04 +02:00
Harald Hoyer
6c7c8d8a07 iscsi: more iscsiroot fixes
handle iscsiroot with firmware more gracefully
2014-07-29 11:52:04 +02:00
Harald Hoyer
d110129695 dracut-lib.sh: fixed shebang 2014-07-29 11:52:04 +02:00
Harald Hoyer
0ab5e8adc8 systemd/rootfs-generator.sh: ignore legacy root=/dev/nfs 2014-07-29 11:52:04 +02:00
Harald Hoyer
9d47a90b12 systemd/rootfs-generator.sh: exit 0 2014-07-29 11:52:04 +02:00
Harald Hoyer
779f980658 base/dracut-lib.sh: "halt" the machine in systemd mode for die()
and only go in emergency shell if "rd.debug" is specified

https://bugzilla.redhat.com/show_bug.cgi?id=1053655
2014-07-29 11:52:04 +02:00
Harald Hoyer
9bdbbe90ef iscsi: call "iscsistart -b" until it succeeds 2014-07-29 11:52:04 +02:00
Harald Hoyer
5183c9a588 network: add rd.bootif=0 to ignore BOOTIF
https://bugzilla.redhat.com/show_bug.cgi?id=1044623
2014-07-29 11:52:04 +02:00
Harald Hoyer
834f33440f systemd/module-setup.sh: make use of "ln_r" 2014-07-29 11:52:04 +02:00
Harald Hoyer
254f437848 systemd: add seat udev rules and mask loginctl 2014-07-29 11:52:04 +02:00
Harald Hoyer
aa6ab27471 systemd: add 71-seat.rules 73-seat-late.rules
otherwise plymouth does not work
2014-07-29 11:52:04 +02:00
Harald Hoyer
cb97abc7bb dracut-install,dracut: fix ldd output parsing
dracut-install could not handle output like:
	/lib/$LIB/liblsp.so => /lib/lib64/liblsp.so (0x00007faf00727000)

also unset LD_PRELOAD, so we get a clean environment
2014-07-29 11:52:04 +02:00
Harald Hoyer
d1e9a5e384 network: include all ethernet drivers 2014-07-29 11:52:04 +02:00
Harald Hoyer
81564fcefc documentation: line wrap 2014-07-29 11:52:04 +02:00
Harald Hoyer
82286609c9 dracut.sh: add /boot/efi to device paths
Add /boot/efi to device paths, so the filesystem driver is included
and it can be repaired in the initramfs.
2014-07-29 11:52:04 +02:00
Harald Hoyer
ea9b961e8c dracut.sh: add missing piece for option --add-device 2014-07-29 11:52:04 +02:00
Harald Hoyer
7faae1264d iscsi/iscsiroot.sh: do not trust iscsistart return value 2014-07-29 11:52:04 +02:00
Harald Hoyer
866e663fbd systemd/dracut-initqueue.sh: fstab is not a directory 2014-07-29 11:52:04 +02:00
Harald Hoyer
9a177f8d51 network: include usbnet drivers 2014-07-29 11:52:04 +02:00
Harald Hoyer
04220f9aff kernel-modules: add more block driver
e.g. nvme
2014-07-29 11:52:04 +02:00
Harald Hoyer
db110a036a dracut-lib/wait_for_dev(): prevent systemd daemon-reload
prevent a systemd daemon-reload, if it is not necessary to do.
2014-07-29 11:52:04 +02:00
Harald Hoyer
937456c65b iscsi: do iscsi_firmware regardless of network
Do the iscsi_firmware iscsistart at least once, even if the network is
not up, to activate offload HBA iSCSI.

https://bugzilla.redhat.com/show_bug.cgi?id=1031160
2014-07-29 11:52:04 +02:00
Harald Hoyer
998f4bb720 test/TEST-17-LVM-THIN: remove .testdir 2014-07-29 11:52:04 +02:00
Harald Hoyer
a34d3dcaa8 test/TEST-17-LVM-THIN: add test case for lvm thin pools 2014-07-29 11:52:04 +02:00
Harald Hoyer
793beab60c lvm: fixed lvm thin check 2014-07-29 11:52:04 +02:00
Harald Hoyer
be10aecb17 base/rdsosreport.sh: add "ip a" output 2014-07-29 11:52:04 +02:00
Harald Hoyer
a1e9e9364a systemd/dracut-initqueue.sh: fixed waiting in the loop if PW asked
continue the main loop instead of the for loop, if a password is
currently asked
2014-07-29 11:52:04 +02:00
Harald Hoyer
53b20afabb lvm: install thin tools, only when needed in hostonly 2014-07-29 11:52:04 +02:00
Harald Hoyer
5a36d29f8a dracut.modules.7.asc: removed empty section 2014-07-29 11:52:04 +02:00
Harald Hoyer
8d7bd6af19 dracut.sh: fixed PATH shortener 2014-07-29 11:52:03 +02:00
Harald Hoyer
d014032c62 iscsi,nbd: do not fail in hostonly mode 2014-07-29 11:52:03 +02:00
Vratislav Podzimek
90441c4476 Run 'xz' and 'lzma' with multiple threads
This speeds up compression a lot on multicore systems.

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

[Edited-by: Harald Hoyer: use getconf for cpu_count]
2014-07-29 11:52:03 +02:00
Harald Hoyer
dac45f997e i18n: introduce i18n_install_all, to install everything
if i18n_install_all is set to "yes", then install all keyboard layouts
and fonts regardless of the hostonly setting.

This way, people can switch keyboard layouts, without having to recreate
the initramfs.
2014-07-29 11:52:03 +02:00
Hannes Reinecke
ff3d291a68 Remove shebang from shell-completion files
Shell-completion files are meant to be sourced, not executed.
So they shouldn't have a shebang at the start.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2014-07-29 11:52:03 +02:00
Hannes Reinecke
411d2aedd6 Fixup script permissions
Scripts with a shebang should be marked as executable.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2014-07-29 11:52:03 +02:00
Harald Hoyer
7f61e2c895 dracut.sh: skip crypt swaps with password files 2014-07-29 11:52:03 +02:00
Harald Hoyer
32c431bb48 base/dracut-lib.sh:wait_for_dev() relax requirement
Do not "require" the devices, but "want" them. This might boot more
systems, where:
- the UUID changed
- swap devices do not show up
2014-07-29 11:52:03 +02:00
Harald Hoyer
7aa989a4fd network/ifup.sh: before doing dhcp, check, if the link has a carrier 2014-07-29 11:52:03 +02:00
Harald Hoyer
34397fe702 network/net-lib.sh:iface_has_link() fixup
Just echo'ing the flags IFF_UP|IFF_RUNNING does _not_ reflect the
carrier state immediately. So wait for it to really show up.
2014-07-29 11:52:03 +02:00
Harald Hoyer
243b8e14a2 network/net-lib.sh:wait_for_if_up() wait for "state UP"
really wait for "state UP", otherwise it returns earlier than we want
2014-07-29 11:52:03 +02:00
Harald Hoyer
fb67162559 dracut.sh:_get_fs_type() if block device exists return early
even, if no ID_FS_TYPE was found, return if the block device exists
2014-07-29 11:52:03 +02:00
Harald Hoyer
15962471fe dracut.cmdline.7.asc: document "server-ip" of "ip=" parameter 2014-07-29 11:52:03 +02:00
Harald Hoyer
e590f5beec fips: fix RHEV vmlinuz check 2014-07-29 11:52:03 +02:00
Peter Rajnoha
05b79aaa9d lvm: do not run pvscan for lvmetad update
The lvmetad daemon is not yet running in initramfs so there's no
need to run pvscan (or instantiate any lvm2-pvscan systemd service).
If pvscan was called in this case (either directly or via systemd
instantiated service), it would fail because there's no lvmetad
daemon to update. This could cause confusion, especially in systemd
instantiated service which is run only once!
2014-07-29 11:52:03 +02:00
Harald Hoyer
1dd604efb1 kernel-modules: add ohci-pci to the list of forced module installs 2014-07-29 11:52:03 +02:00
Harald Hoyer
52592ce022 systemd: do not exit the initqueue, if systemd asks a password
this prevents bailing out the initqueue, while passwords are still to be
asked
2014-07-29 11:52:03 +02:00
Colin Guthrie
03bf7758aa dracut-functions.sh: Avoid loading unnecessary 32-bit libraries for 64-bit initrds
Due to the 'inst_libdir_file "libnss_files*"' in the udev-rules module
this caues the /usr/lib/libnss_files-2.18.so* to be included. This is a
32-bit library and pulls in a 32-bit version of glibc also even on a
64-bit system.

This is due to the fact that ldconfig -pN will print [/usr]/lib paths
from the cache as well as [/usr]/lib64. As we handle these paths
specifically we should ignore these results from the cache.

Also there was a missing space when appending the ldconfig paths
onto our list meaning the last builtin and first ldconfig path
were unusable.
2014-07-29 11:52:03 +02:00
Harald Hoyer
20ff2d37cc fips: also install /etc/system-fips in the initramfs 2014-07-29 11:52:03 +02:00
Harald Hoyer
65ba6c44d8 iscsi/nbd: do not try to mount the whole disk, if root= is missing
only mount the whole disk for root=dhcp
2014-07-29 11:52:03 +02:00
Alexander Tsoy
c35826c0e7 resume: remove resume-genrules.sh
parse-resume.sh already contains all the code from resume-genrules.sh.
Also parse-resume.sh is executed before resume-genrules.sh, so there is
no point to keep the latter.

This fixes the following error messages:
dracut-initqueue: ln: failed to create symbolic link '/dev/resume': File exists
dracut-initqueue: rm: cannot remove '/lib/dracut/hooks/initqueue/settled/resume.sh': No such file or directory
dracut-initqueue: rm: cannot remove '/lib/dracut/hooks/initqueue/timeout/resume.sh': No such file or directory
2014-07-29 11:52:03 +02:00
Alexander Tsoy
ccad388c25 resume: fix swap detection in hostonly
Check for other possible fs types. This fixes swap detection when using
TuxOnIce kernel.

Note that parse-resume.sh generate udev rules with support for
ID_FS_TYPE=suspend, but we do not include it here, because it is
libvolume_id thing and host_fs_types is populated using blkid.
2014-07-29 11:52:03 +02:00
Kyle McMartin
eb27e4cc31 fips: include crct10dif_generic
Resolves: rhbz#1024455
2014-07-29 11:52:03 +02:00
Harald Hoyer
ee916b72cc Handle crypto modules with and without modaliases
If new kernels have modules split out, handle the case, where modules
have to modalias and just install them.

Also add the crypto drivers and names to host_modalias.
2014-07-29 11:52:03 +02:00
Alexander Tsoy
352a49a21d usrmount/module-setup.sh: fixed typo 2014-07-29 11:52:03 +02:00
Harald Hoyer
8eee542b40 dracut.spec: move /sbin/dracut to /usr/sbin/dracut 2014-07-29 11:52:03 +02:00
Harald Hoyer
37e899aad1 lvm: always install thin utils for lvm 2014-07-29 11:52:03 +02:00
Harald Hoyer
88fc0b8750 kernel-modules(ARM): add mmc_block usb_storage to statis list of kernel mods 2014-07-29 11:52:03 +02:00
Harald Hoyer
9bd3573ddb git2spec.pl: remove ".git$(date)" from release string 2014-07-29 11:52:03 +02:00
P J P
123feea1fa Add lzo, lz4 compression and read INITRD_COMPRESS
This patch adds support for lzop(1) & lz4(1) compression
algorithms to compress iniramfs image file. Both are supported
by the Linux kernel.

Linux kernel exports user's choice of initramfs compression
algorithm as a shell environment variable: INITRD_COMPRESS.
This patch adds support to read this variable and duly compress
the initramfs image file.

Environment variable INITRD_COMPRESS has less precedence than the
command line options --gzip, etc. Ie. command line options could
override the compression algorithm defined by $INITRD_COMPRESS.

Signed-off-by: P J P <ppandit@redhat.com>

[Edited-by: Harald Hoyer: add documentation about lzo and lz4]
2014-07-29 11:52:02 +02:00
Marian Csontos
8e3620568c dracut-functions.sh:check_block_and_slaves*() skip LVM internal devs
Not every device in /dev/mapper should be examined.
If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
2014-07-29 11:52:02 +02:00
Harald Hoyer
1a21ed8d1d lvm: fix thin recognition
The global var setting was happening in a pipe and did not have an
effect.

Use <<<$() instead.

< <() cannot be used, because dracut is called in chroot's environments,
where /dev/fd does not point to /proc/self/fd, but bash wants
/dev/fd/<num> for this construct.
2014-07-29 11:52:02 +02:00
Harald Hoyer
84fe197fac Doc: cleanup, extend and split and reuse 2014-07-29 11:52:02 +02:00
Brian C. Lane
86fff83927 dmsquash-live: add /dev/mapper/live-base
This is similar to the reason for adding the
/run/initramfs/live-baseloop symlink -- access to the original live
image without overlays.

livemedia-creator does not create a osmin.img, so there is no mountable
device for it to use when rsyncing the live image to the target. It
needs a device that points to the original live image without overlays.

Note that lmc won't be creating osmin.img, since really isn't needed any
longer. Its purpose was to provide a minimal image that could be dd'd to
the target. Now that we use rsync this is no longer necessary.

The included patch adds a /dev/mapper/live-base device that Anaconda can
use whether or not there is an osmin present.
2014-07-29 11:52:02 +02:00
Harald Hoyer
f0df0f3fcd dracut.sh: do not bail out, if kernel modules dir is missing
and only print a warning message
2014-07-29 11:52:02 +02:00
Harald Hoyer
52d3c1b726 lvm: install thin utils for non-hostonly 2014-07-29 11:52:02 +02:00
Harald Hoyer
6ea78f9f4e btrfs: use inst_hook to install the timeout hook 2014-07-29 11:52:02 +02:00
Harald Hoyer
4584826e9a rootfs-block: add support for the rootfallback= kernel cmdline option 2014-07-29 11:52:02 +02:00
Harald Hoyer
1b827040f8 fcoe: add FCoE UEFI boot device support 2014-07-29 11:52:02 +02:00
Alexander Tsoy
4fde4d0647 mdraid/module-setup.sh: fixes for mdadm-3.2.6+
mdadm-3.2.6+:
Incremental assembly rule contains "--offroot" arg. Update
regexp to catch this variant.

mdadm-3.3+:
Rules was splitted into two files: 63-md-raid-arrays.rules
and 64-md-raid-assembly.rules. Install them both and edit
the latter.
2014-07-29 11:52:02 +02:00
Alexander Tsoy
fdaa69db20 mdraid/module-setup.sh: install configs from /etc/mdadm.conf.d
/etc/mdadm.conf.d directory is supported since mdadm-3.3
2014-07-29 11:52:02 +02:00
Harald Hoyer
31b89c8c2b dracut-functions.sh:inst_rules() do not install rules in CWD 2014-07-29 11:52:02 +02:00
Harald Hoyer
a5659901e8 bcache: optionally install the tools and rules 2014-07-29 11:52:02 +02:00
Peter Rajnoha
32b970339f lvm/mdraid: Fix LVM on MD activation
The 69-dm-lvm-metad.rules set some udev env. variables that makes it
possible to detect the right time to activate LVM on MD. The MD is very
similar to DM during activation - it's usable only after proper device
activation - the CHANGE event. We need to make a difference between a
CHANGE event that comes from this activation and CHANGE event that is
the outcome of the WATCH udev rule (otherwise we'd end up with LVM
activation done on each CHANGE event - which is wrong).

So we need the udev databse to be persistent during pivot to root fs
even for MD devices.
2014-07-29 11:52:02 +02:00
Harald Hoyer
d87da4c777 dracut-logger.sh: do not log to syslog/kmsg/journal for UID != 0
Don't clutter the system log with user actions.

Also check, if systemd-cat works, before using it.
2014-07-29 11:52:02 +02:00
Harald Hoyer
cf9f56be9c dracut.sh: bail out early, if destination dir is not writeable 2014-07-29 11:52:02 +02:00
Harald Hoyer
eaa4d30d5a dracut-bash-completion.sh: add --prelink --noprelink 2014-07-29 11:52:02 +02:00
Thomas Renninger
54011e3591 dracut.conf.5.asc: Add ACPI table override and uncompressed cpio doc
Signed-off-by: Thomas Renninger <trenn@suse.de>
2014-07-29 11:52:02 +02:00
Thomas Renninger
ebc7f823c0 dracut: Implement ACPI table overriding
An example config file for this feature could be:

/etc/dracut.conf.d/03-acpi-override.conf

with this content:
acpi_override="yes"
acpi_table_dir="/etc/dracut.conf.d/acpi_tables"

Then all files ending with *.aml will be put into the early cpio
(kernel/firmware/acpi) and will be used to replace the BIOS provided tables
if the kernel supports this feature.

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2014-07-29 11:52:02 +02:00
Thomas Renninger
ff33b57676 dracut: Do not create early_cpio if no suitable microcode exist in hostonly case
Intel microcodes only exist for very specific family/model/stepping CPUs.
If no microcode gets added, there is no need to create an empty
(only directories) cpio later that gets glued to the initrd.

This also fixes:

*** Constructing GenuineIntel.bin ****
cat: /lib/firmware/intel-ucode/06-3c-03: No such file or directory

in hostonly mode if there is no suitable microcode for the CPU.

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2014-07-29 11:52:02 +02:00
Thomas Renninger
4b1aa19fa0 dracut: Generlize microcode early cpio usage
ACPI early table override also may need to place files into an early cpio.
Reflect this in variable and file names.
This change is renaming only and does not introduce any real change.

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2014-07-29 11:52:02 +02:00
Harald Hoyer
764b520994 add /etc/system-fips for dracut-fips subpackage 2014-07-29 11:52:02 +02:00
Harald Hoyer
96f48da50c Add option to turn on/off prelinking
--prelink, --noprelink

do_prelink=[yes|no]
2014-07-29 11:52:02 +02:00
Harald Hoyer
72ce014bc7 dracut.sh: we don't need to read the modalias files
udev does only parse the uevent MODALIAS line, so whatever is in the
modalias files would not trigger any module load.
2014-07-29 11:52:02 +02:00
Harald Hoyer
af34b26047 dracut.sh: also search uevent's for MODALIAS 2014-07-29 11:52:02 +02:00
WANG Chao
da63c0de56 ifup: do not dhcp on network interface of secondary stack
Configure cmdline to:
 ip=br0:dhcp bridge=br0:bond0 bond=bond0:eth0

By default ifup bond0 will run dhcp on bond0, which is wrong. bond0
isn't the top interface. we should really run dhcp on br0.

So if we ifup an network interface on secondary stack, we should not
dhcp. Fix this issue with this patch.
2014-07-29 11:52:02 +02:00
Harald Hoyer
ffecc45232 dracut.sh: harden host_modalias reading
Some weird PPC driver make their modulias unreadable

$ cat /sys/devices/vio/4000/modalias
cat: /sys/devices/vio/4000/modalias: No such device
2014-07-29 11:52:02 +02:00
388 changed files with 5469 additions and 5704 deletions

View File

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

View File

@@ -10,9 +10,6 @@ Andrey Borzenkov <arvidjaar@gmail.com> <arvidjaar@mail.ru>
Dan Horák <dhorak@redhat.com> <dan@danny.cz>
John Reiser <jreiser@bitwagon.com> <jreiser@BitWagon.com>
Luca Berra <bluca@vodka.it> <bluca@comedia.it>
Dave Young <dyoung@redhat.com> <dyoung@redhat.com>
Dave Young <dyoung@redhat.com> <dave@redhat.com>
Dave Young <dyoung@redhat.com> dyoung@redhat.com
Frederick Grose <fgrose@sugarlabs.org> <fgrose@gmail.com>
Frederic Crozat <fcrozat@suse.com> <fcrozat@mandriva.com>
Shawn W Dunn <sfalken@opensuse.org> <sfalken@opensuse.org>
Kyle McMartin <kmcmarti@redhat.com> <kyle@redhat.com>

View File

@@ -1,46 +1,32 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4"
if [[ -f /etc/kernel/cmdline ]]; then
readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
fi
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
readarray -t BOOT_OPTIONS < /proc/cmdline
fi
unset noimageifnotneeded
for ((i=0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
noimageifnotneeded="yes"
break
fi
done
ret=0
case "$COMMAND" in
case "$1" in
add)
INITRD_IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/initrd
if [[ -f ${INITRD_IMAGE_PREGENERATED} ]]; then
# we found an initrd at the same place as the kernel
# use this and don't generate a new one
cp --reflink=auto "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/initrd" \
&& chown root:root "$BOOT_DIR_ABS/initrd" \
&& chmod 0600 "$BOOT_DIR_ABS/initrd" \
&& exit 0
fi
if [[ -f /etc/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
elif [[ -f /usr/lib/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
fi
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
read -r -d '' -a BOOT_OPTIONS < /proc/cmdline
fi
unset noimageifnotneeded
for ((i=0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
noimageifnotneeded="yes"
break
fi
done
dracut ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS"/initrd "$KERNEL_VERSION"
dracut ${noimageifnotneeded:+--noimageifnotneeded} "$3"/initrd "$2"
ret=$?
;;
remove)
rm -f -- "$BOOT_DIR_ABS"/initrd
rm -f -- "$3"/initrd
ret=$?
;;
esac

View File

@@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
export LANG=C
@@ -57,7 +59,7 @@ if [[ ! -f $INITRDFILE ]]; then
fi
if [[ ! -f $NEW_KERNEL_IMAGE ]]; then
cp --reflink=auto "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
cp "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
((ret+=$?))
fi

View File

@@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
export LANG=C
@@ -40,22 +42,12 @@ fi
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
if [[ -f /etc/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
elif [[ -f /usr/lib/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
fi
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
read -r -d '' -a line < /proc/cmdline
for i in "${line[@]}"; do
[[ "${i#initrd=*}" != "$i" ]] && continue
BOOT_OPTIONS+=("$i")
done
readarray -t BOOT_OPTIONS < /proc/cmdline
fi
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
echo "Could not determine the kernel command line parameters." >&2
echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2
if ! [[ $BOOT_OPTIONS ]]; then
exit 1
fi
@@ -79,11 +71,11 @@ case "$COMMAND" in
[[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS"
if ! cp --reflink=auto "$KERNEL_IMAGE" "$BOOT_DIR_ABS"/linux; then
if ! cp "$KERNEL_IMAGE" "$BOOT_DIR_ABS"/linux; then
echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/linux'!" >&2
fi
dracut --no-hostonly -a "rescue" "$BOOT_DIR_ABS"/initrd "$KERNEL_VERSION"
dracut --no-hostonly -a "rescue" "$BOOT_DIR_ABS"/initrd "$2"
((ret+=$?))
{

72
AUTHORS
View File

@@ -7,43 +7,32 @@ Warren Togami <wtogami@redhat.com>
Jeremy Katz <katzj@redhat.com>
Dave Young <dyoung@redhat.com>
David Dillow <dave@thedillows.org>
Hannes Reinecke <hare@suse.de>
Michal Soltys <soltys@ziu.info>
Colin Guthrie <colin@mageia.org>
Amerigo Wang <amwang@redhat.com>
Thomas Renninger <trenn@suse.de>
WANG Chao <chaowang@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>
Alexander Tsoy <alexander@tsoy.me>
John Reiser <jreiser@bitwagon.com>
Luca Berra <bluca@vodka.it>
Brian C. Lane <bcl@redhat.com>
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>
NeilBrown <neilb@suse.de>
Peter Rajnoha <prajnoha@redhat.com>
Radek Vykydal <rvykydal@redhat.com>
Thorsten Behrens <tbehrens@suse.com>
Chao Wang <chaowang@redhat.com>
Colin Walters <walters@verbum.org>
Cristian Rodríguez <crrodriguez@opensuse.org>
Fabian Deutsch <fabiand@fedoraproject.org>
Frederic Crozat <fcrozat@suse.com>
James Lee <jlee@thestaticvoid.com>
Jesse Keating <jkeating@redhat.com>
Milan Broz <mbroz@redhat.com>
Nicolas Chauvet <kwizart@gmail.com>
Radek Vykydal <rvykydal@redhat.com>
Roberto Sassu <roberto.sassu@polito.it>
Anton Blanchard <anton@samba.org>
Bill Nottingham <notting@redhat.com>
Chapman Flack <g2@anastigmatix.net>
Colin Walters <walters@verbum.org>
David Cantrell <dcantrell@redhat.com>
Dennis Gilmore <dennis@ausil.us>
Jon Ander Hernandez <jonan.h@gmail.com>
@@ -51,97 +40,66 @@ Juan RP <xtraeme@gmail.com>
Lance Albertson <lance@osuosl.org>
Marian Ganisin <mganisin@redhat.com>
Michael Ploujnikov <plouj@somanetworks.com>
Peter Robinson <pbrobinson@gmail.com>
Stefan Reimer <it@startux.de>
Stig Telfer <stelfer@cray.com>
Vasiliy Tolstov <v.tolstov@selfip.ru>
Ville Skyttä <ville.skytta@iki.fi>
Peter Rajnoha <prajnoha@redhat.com>
Wim Muskee <wimmuskee@gmail.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Alan Pevec <apevec@redhat.com>
Alex Harpin <development@landsofshadow.co.uk>
Daniel Schaal <farbing@web.de>
Erwan Velu <erwan.velu@enovance.com>
Frederick Grose <fgrose@sugarlabs.org>
Hari Bathini <hbathini@linux.vnet.ibm.com>
Ian Dall <ian@beware.dropbear.id.au>
James Buren <ryuo@frugalware.org>
Jan Synacek <jsynacek@redhat.com>
James Lee <jlee@thestaticvoid.com>
Joey Boggs <jboggs@redhat.com>
Koen Kooi <koen@dominion.thruhere.net>
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Kyle McMartin <kmcmarti@redhat.com>
Lubomir Rintel <lkundrak@v3.sk>
Lukas Wunner <lukas@wunner.de>
Mike Snitzer <snitzer@redhat.com>
Minfei Huang <mhuang@redhat.com>
Przemysław Rudy <prudy1@o2.pl>
Thomas Backlund <tmb@mageia.org>
Stefan Reimer <it@startux.de>
Thomas Lange <lange@informatik.uni-koeln.de>
Till Maas <opensource@till.name>
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>
Antony Messerli <amesserl@rackspace.com>
Brandon Philips <brandon@ifup.co>
Canek Peláez Valdés <caneko@gmail.com>
Chao Fan <cfan@redhat.com>
Chris Leech <cleech@redhat.com>
Christian Heinz <christian.ch.heinz@gmail.com>
Christian Rodrigues <crrodriguez@opensuse.org>
Cong Wang <amwang@redhat.com>
Daniel Drake <drake@endlessm.com>
Daniel Schaal <farbing@web.de>
Dave Jones <davej@redhat.com>
Dave Young <dave@redhat.com>
Dennis Schridde <devurandom@gmx.net>
Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
Duane Griffin <duaneg@dghda.com>
Gerd von Egidy <gerd.von.egidy@intra2net.com>
Glen Gray <slaine@slaine.org>
Hermann Gausterer <git-dracut-2012@mrq1.org>
James Laska <jlaska@redhat.com>
Jan Stodola <jstodola@redhat.com>
Jiri Pirko <jiri@resnulli.us>
Joe Lawrence <Joe.Lawrence@stratus.com>
Jonas Jonsson <jonas@websystem.se>
Julian Wolf <juwolf@suse.com>
Kevin Yung <Kevin.Yung@myob.com>
Kyle McMartin <kyle@redhat.com>
Lars R. Damerow <lars@pixar.com>
Lennert Buytenhek <buytenh@wantstofly.org>
Lukas Nykryn <lnykryn@redhat.com>
Major Hayden <major@mhtx.net>
Marian Csontos <mcsontos@redhat.com>
Marko Myllynen <myllynen@redhat.com>
Lubomir Rintel <lkundrak@v3.sk>
Matt <smoothsailing72@hotmail.com>
Matt Smith <shadowfax@gmx.com>
Michal Schmidt <mschmidt@redhat.com>
Mike Gorse <mgorse@suse.com>
Moritz 'Morty' Strübe <morty@gmx.net>
Munehiro Matsuda <haro@kgt.co.jp>
Nikoli <nikoli@gmx.us>
Nicolas Chauvet <kwizart@gmail.com>
Nikoli <nikoli@lavabit.com>
Olivier Blin <dev@blino.org>
P J P <ppandit@redhat.com>
Paolo Bonzini <pbonzini@redhat.com>
Peter Robinson <pbrobinson@fedoraproject.org>
Praveen_Paladugu@Dell.com <Praveen_Paladugu@Dell.com>
Pádraig Brady <P@draigBrady.com>
Quentin Armitage <quentin@armitage.org.uk>
Robert Buchholz <rbu@goodpoint.de>
Rusty Bird <rustybird@openmailbox.org>
Sergey Fionov <fionov@gmail.com>
Shawn W Dunn <sfalken@opensuse.org>
Srinivasa T N <seenutn@linux.vnet.ibm.com>
Thilo Bangert <thilo.bangert@gmx.net>
Tobias Geerinckx <tobias.geerinckx@gmail.com>
Tom Gundersen <teg@jklm.no>
Thomas Backlund <tmb@mageia.org>
Tomasz Torcz <tomek@pipebreaker.pl>
Vadim Kuznetsov <vadimk@gentoo.org>
Vaughan Cao <vaughan.cao@oracle.com>
Vratislav Podzimek <vpodzime@redhat.com>
Ville Skyttä <ville.skytta@iki.fi>
Yanko Kaneti <yaneti@declera.com>
jloeser <jloeser@suse.de>
maximilian attems <max@stro.at>
xtraeme <xtraeme@voidlinux.eu>

View File

@@ -1,6 +1,6 @@
-include dracut-version.sh
VERSION = $(shell [ -d .git ] && git describe --abbrev=0 --tags 2>/dev/null || echo $(DRACUT_VERSION))
VERSION = $(shell [ -d .git ] && git describe --abbrev=0 2>/dev/null || echo $(DRACUT_VERSION))
GITVERSION = $(shell [ -d .git ] && { v=$$(git describe --tags 2>/dev/null); [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
-include Makefile.inc
@@ -13,7 +13,7 @@ sysconfdir ?= ${prefix}/etc
bindir ?= ${prefix}/bin
mandir ?= ${prefix}/share/man
CFLAGS ?= -O2 -g -Wall
CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64
bashcompletiondir ?= ${datadir}/bash-completion/completions
pkgconfigdatadir ?= $(datadir)/pkgconfig
@@ -28,19 +28,18 @@ man7pages = dracut.cmdline.7 \
man8pages = dracut.8 \
dracut-catimages.8 \
mkinitrd.8 \
mkinitrd-suse.8 \
modules.d/98dracut-systemd/dracut-cmdline.service.8 \
modules.d/98dracut-systemd/dracut-initqueue.service.8 \
modules.d/98dracut-systemd/dracut-mount.service.8 \
modules.d/98dracut-systemd/dracut-shutdown.service.8 \
modules.d/98dracut-systemd/dracut-pre-mount.service.8 \
modules.d/98dracut-systemd/dracut-pre-pivot.service.8 \
modules.d/98dracut-systemd/dracut-pre-trigger.service.8 \
modules.d/98dracut-systemd/dracut-pre-udev.service.8
modules.d/98systemd/dracut-cmdline.service.8 \
modules.d/98systemd/dracut-initqueue.service.8 \
modules.d/98systemd/dracut-mount.service.8 \
modules.d/98systemd/dracut-shutdown.service.8 \
modules.d/98systemd/dracut-pre-mount.service.8 \
modules.d/98systemd/dracut-pre-pivot.service.8 \
modules.d/98systemd/dracut-pre-trigger.service.8 \
modules.d/98systemd/dracut-pre-udev.service.8
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
.PHONY: install clean archive rpm srpm testimage test all check AUTHORS doc dracut-version.sh
all: dracut-version.sh dracut.pc dracut-install skipcpio/skipcpio
@@ -48,7 +47,6 @@ DRACUT_INSTALL_OBJECTS = \
install/dracut-install.o \
install/hashmap.o\
install/log.o \
install/strv.o \
install/util.o
# deps generated with gcc -MM
@@ -58,7 +56,6 @@ install/hashmap.o: install/hashmap.c install/util.h install/macro.h install/log.
install/hashmap.h
install/log.o: install/log.c install/log.h install/macro.h install/util.h
install/util.o: install/util.c install/util.h install/macro.h install/log.h
install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h install/log.h
install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
@@ -118,6 +115,7 @@ install: all
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
mkdir -p $(DESTDIR)$(pkglibdir)/dracut.conf.d
install -m 0755 dracut-init.sh $(DESTDIR)$(pkglibdir)/dracut-init.sh
install -m 0755 dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions.sh
install -m 0755 dracut-version.sh $(DESTDIR)$(pkglibdir)/dracut-version.sh
ln -fs dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
@@ -133,10 +131,10 @@ ifneq ($(enable_documentation),no)
endif
if [ -n "$(systemdsystemunitdir)" ]; then \
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown.service; \
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants; \
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)/sysinit.target.wants/dracut-shutdown.service; \
$(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants/dracut-shutdown.service; \
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants; \
for i in \
dracut-cmdline.service \
@@ -147,7 +145,7 @@ endif
dracut-pre-trigger.service \
dracut-pre-udev.service \
; do \
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/$$i $(DESTDIR)$(systemdsystemunitdir); \
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98systemd/$$i $(DESTDIR)$(systemdsystemunitdir); \
ln -s ../$$i \
$(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants/$$i; \
done \
@@ -176,35 +174,43 @@ clean:
$(RM) */*/*~
$(RM) $(manpages:%=%.xml) dracut.xml
$(RM) test-*.img
$(RM) dracut-*.rpm dracut-*.tar.bz2 dracut-*.tar.xz
$(RM) dracut-*.rpm dracut-*.tar.bz2
$(RM) dracut-version.sh
$(RM) dracut-install install/dracut-install $(DRACUT_INSTALL_OBJECTS)
$(RM) skipcpio/skipcpio $(SKIPCPIO_OBJECTS)
$(RM) $(manpages) dracut.html
$(MAKE) -C test clean
dist: dracut-$(VERSION).tar.xz
dist: dracut-$(VERSION).tar.bz2
dracut-$(VERSION).tar.xz: doc syncheck
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)
for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(VERSION)/$${i%/*}"; cp "$$i" "dracut-$(VERSION)/$$i"; done
tar --owner=root --group=root -rf dracut-$(VERSION).tar $$(find dracut-$(VERSION) -type f)
rm -fr -- dracut-$(VERSION).tar.xz dracut-$(VERSION)
xz -9 dracut-$(VERSION).tar
rm -fr -- dracut-$(VERSION).tar.bz2 dracut-$(VERSION)
bzip2 -9 dracut-$(VERSION).tar
rm -f -- dracut-$(VERSION).tar
rpm: dracut-$(VERSION).tar.xz syncheck
rpm: dracut-$(VERSION).tar.bz2 syncheck
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
cp dracut-$(VERSION).tar.xz "$$rpmbuild"; \
cp dracut-$(VERSION).tar.bz2 "$$rpmbuild"; \
LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
(cd "$$rpmbuild"; \
wget https://www.gnu.org/licenses/lgpl-2.1.txt; \
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
(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 $(DESTDIR).; mv "$$rpmbuild"/*.src.rpm $(DESTDIR).;rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
srpm: 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" -bs dracut.spec; ) && \
( mv "$$rpmbuild"/*.src.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
syncheck:
@ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \
@@ -223,11 +229,7 @@ check: all syncheck rpm
@$(MAKE) -C test check
testimage: all
./dracut.sh -N -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
debugtestimage: all
./dracut.sh --debug -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
./dracut.sh -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
testimages: all
@@ -236,20 +238,16 @@ testimages: all
./dracut.sh -l -a debug --no-kernel -f test-dracut.img $(shell uname -r)
@echo wrote test-dracut.img
debughostimage: all
./dracut.sh --debug -H -l -f test-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
hostimage: all
./dracut.sh -H -l -f test-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
AUTHORS:
git shortlog --numbered --summary -e |while read a rest || [ -n "$$rest" ]; do echo $$rest;done > AUTHORS
git shortlog --numbered --summary -e |while read a rest; do echo $$rest;done > AUTHORS
dracut.html.sign: dracut-$(VERSION).tar.xz dracut.html
gpg-sign-all dracut-$(VERSION).tar.xz dracut.html
dracut.html.sign: dracut-$(VERSION).tar.bz2
gpg-sign-all dracut-$(VERSION).tar.bz2 dracut.html
upload: dracut.html.sign
kup put dracut-$(VERSION).tar.xz dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/
kup put dracut-$(VERSION).tar.bz2 dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/
kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/

215
NEWS
View File

@@ -1,212 +1,3 @@
dracut-042
==========
- fixed dmsetup shutdown
- new kernel command line option "rd.live.overlay.thin"
This option changes the underlying mechanism for the overlay in the
dmsquash module.
Instead of a plain dm snapshot a dm thin snapshot is used. The advantage
of the thin snapshot is, that the TRIM command is recognized, which
means that at runtime, only the occupied blocks will be claimed from
memory, and freed blocks will really be freed in ram.
- dmsquash: Add squashfs support to rd.live.fsimg
Previously rd.live.fsimg only supported filesystems residing in
(compressed) archives.
Now rd.live.fsimg can also be used when a squashfs image is used.
This is achieved by extracting the rootfs image from the squashfs and
then continue with the default routines for rd.live.fsimg.
- lvm: add support for LVM system id
- split up the systemd dracut module
Basic systemd functionality is in 00systemd now.
Switching root and the initrd.target is in 00systemd-initrd.
Dracut additions to the systemd initrd are in 98dracut-systemd.
- support for creating a UEFI boot executable via argument "--uefi"
With an EFI stub, the kernel, the initramfs and a kernel cmdline can be
glued together to a single UEFI executable, which can be booted by a
UEFI BIOS.
- network: split out kernel-network-modules, now in 90kernel-network-modules
- support for ethernet point-to-point connections configured via DHCP
- kernel-modules: install all HID drivers
- dracut.pc pkg-config file
- mount /dev, /dev/shm and /run noexec
dracut-041
==========
- fixed the shutdown loop
- fixed gzip compression for versions, which do not have --rsyncable
- fixed ifcfg generation for persistent interface names
- multipath:
* new option to turn off multipath "rd.multipath=0" completly
* preload scsi dh modules
* start multipathd via systemd service
- do not fail, if user pressed ESC during media check
- fixed systemd-journal by symlinking /var/log to /run/initramfs/log
- initrd-release moved to /usr/lib
- lots of iSCSI fixes
- new "rd.timeout" to specify the systemd JobTimeoutSec for devices
- if $initrd/etc/cmdline.d/* has a "root=" and the kernel cmdline does not,
generate a mount unit for it
- increased the initqueue timeout for non systemd initramfs to 180s
- $initrd/etc/cmdline.d/ hostonly files are now generated for NFS
- make use of systemd-hibernate-resume, if available
- fixed ldconfig parsing for hwcap output
- network: add support for comma separated autoconf options like ip=eth0:auto6,dhcp
- new parameter "rd.live.overlay.size" to specify the overlay for live images
- changed the test suite for the new sfdisk syntax
- added cache tools for dm-cache setups
dracut-040
==========
- fixed dracut module dependency checks
- fixed test suite
dracut-039
==========
- DRACUT_PATH can now be used to specify the PATH used by dracut
to search for binaries instead of the default
/usr/sbin:/sbin:/usr/bin:/bin
This should be set in the distribution config file
/usr/lib/dracut/dracut.conf.d/01-dist.conf
- add "--loginstall <DIR>" and loginstall="<DIR>" options
to record all files, which are installed from the host fs
- "rd.writable.fsimg" - support for read/write filesystem images
- "rd.route" kernel command line parameter added
- "--install-optional" and install_optional_items added
- find plymouth pkglibdir on debian
- torrent support for live images
root=live:torrent://example.com/liveboot.img.torrent
and generally added as a download handler
- disable microcode, if the kernel does not support it
- speed up ldconfig_paths()
- more ARM modules
- fixed inst*() functions and "-H" handling
- fixed bridge setup
- added --force-drivers parameter and force_drivers=+ config option
to enforce driver loading at early boot time
- documented "iso-scan/filename" usage in grub
- various bugfixes
dracut-038
==========
- "rd.cmdline=ask" will ask the user on the console to enter additional
kernel command line parameters
- "rd.hostonly=0" removes all "hostonly" added custom files,
which is useful in combination with "rd.auto" or other specific parameters,
if you want to boot on the same hardware, but the compiled in configuration
does not match your setup anymore
- inst* functions and dracut-install now accept the "-H" flag, which logs all
installed files to /lib/dracut/hostonly-files. This is used to remove those
files, if rd.hostonly is given on the kernel command line
- strstr now only does literal string match,
please use strglob and strglobin for globs
- fixed unpacking of the microcode image on shutdown
- added systemd-gpt-auto-generator
- fcoe: wait for lldpad to be ready
- network: handle "ip=dhcp6"
- network: DCHPv6: set valid_lft and preferred_lft
- dm: support dm-cache
- fstab: do not mount and fsck from fstab if using systemd
- break at switch_root only for bare rd.break and not for any rd.break=...
- nbd: make use of "--systemd-mark", otherwise it gets killed on switch_root
- fcoe-uefi: fixed cmdline parameter generation
- iscsi: deprecate "ip=ibft", use "rd.iscsi.ibft[=1]" from now on
- "lsinitrd -m" now only lists the dracut modules of the image
- a lot of small bugfixes
dracut-037
==========
- dracut: hostonly_cmdline variable and command line switch
Toggle hostonly cmdline storing in the initramfs
--hostonly-cmdline:
Store kernel command line arguments needed in the initramfs
--no-hostonly-cmdline:
Do not store kernel command line arguments needed in the initramfs
- dracut: --mount now understands full fstab lines
- dracut now also includes drivers from the /lib/modules/<version>/updates directory
- dracut: only set the owner of files to 0:0, if generated as non-root
- dracut now directly writes to the initramfs file
- dracut: call lz4 with the legacy flag (linux kernel does not support the new format)
- systemd: rootfs-generator generates JobTimeout=0 units for the root device
- systemd: added the systemd-sysctl service
- systemd: add 80-net-setup-link.rules and .link files for persistent interface renaming
- systemd: make dracut-shutdown.service failure non-fatal
- network: various IPv6 fixes
- network: DCHCP for IPv6
- network: understand ip=.....:<dns1>:<dns2>
- network: parse ibft nameserver settings
- shutdown: if kexec fails, just reboot
- lvm: handle one LV at a time with lvchange
- module-setup.sh:
New functions require_binaries() and require_any_binary() to be used
in the check() section of module-setup.sh.
- a lot of small bugfixes
Contributions from:
Harald Hoyer
Alexander Tsoy
Till Maas
Amadeusz Żołnowski
Brian C. Lane
Colin Guthrie
Dave Young
WANG Chao
Shawn W Dunn
dracut-036
==========
- fixed skipcpio signature checking
dracut-035
==========
- changed dracut tarball compression to xz
- new argument "--rebuild"
- add lzo, lz4 compression
- install: install all binaries with <name> found in PATH
- lsinitrd can now handle initramfs images with an early cpio prepended
(microcode, ACPI tables)
- mkinitrd-suse added as a compat stub for dracut
- lvm: install thin utils for non-hostonly
- resume: fix swap detection in hostonly
- avoid loading unnecessary 32-bit libraries for 64-bit initrds
- crypt: wait for systemd password agents
- crypt: skip crypt swaps with password files
- network: before doing dhcp, dracut now checks, if the link has a carrier
- network: dhclient-script.sh now sets the lease time
- network: include usbnet drivers
- network: include all ethernet drivers
- network: add rd.bootif=0 to ignore BOOTIF
- i18n: introduce i18n_install_all, to install everything i18n related
- support SuSE DASD configurations
- support SuSE zfcp configurations
- support SuSE compressed KEYMAP= setting
- usrmount: always install the module,
so always mount /usr from within the initramfs
- test/TEST-17-LVM-THIN: new test case for lvm thin pools
- "halt" the machine in systemd mode for die()
dracut-034
==========
- do not run dhcp on parts of assembled network interfaces (bond, bridge)
- add option to turn on/off prelinking
--prelink, --noprelink
do_prelink=[yes|no]
- add ACPI table overriding
- do not log to syslog/kmsg/journal for UID != 0
- lvm/mdraid: Fix LVM on MD activation
- bcache module removed (now in bcache-tools upstream)
- mdadm: also install configs from /etc/mdadm.conf.d
- fixes for mdadm-3.2.6+
- mkinitrd: better compat support for SUSE
- fcoe: add FCoE UEFI boot device support
- rootfs-block: add support for the rootfallback= kernel cmdline option
Contributions from:
Thomas Renninger
Alexander Tsoy
Peter Rajnoha
WANG Chao
Harald Hoyer
dracut-033
==========
- improved hostonly device recognition
@@ -225,12 +16,6 @@ dracut-033
- fixed ifup udev rules
- ifup with dhcp, if no "ip=" specified for the interface
Contributions from:
WANG Chao
Colin Walters
Harald Hoyer
dracut-032
==========
- add parameter --print-cmdline

5
README.md Normal file
View File

@@ -0,0 +1,5 @@
# dracut RHEL-7 branch
dracut is an initramfs infrastructure.
CentOS CI Status: [![Build Status](https://ci.centos.org/buildStatus/icon?job=dracut-push-rhel-7)](https://ci.centos.org/job/dracut-push-rhel-7/)

View File

@@ -6,12 +6,11 @@ mdadm \
lvm2 \
cryptsetup \
nfs-utils \
netbsd-iscsi \
nbd \
dhcp-server \
scsi-target-utils \
iscsi-initiator-utils
TEST-04-FULL-SYSTEMD: systemd >= 187
How to run the testsuite:

11
TODO
View File

@@ -6,12 +6,6 @@ Items are ordered in priority.
INITRAMFS TODO
- search domain string
- peerdns=no
- allow dual stack configuration (IPv4, IPv6) for the same interface
- "bind-mount" kernel drivers in real root for the rescue image,
if the real root does not have any kernel modules for this kernel
https://bugzilla.redhat.com/show_bug.cgi?id=1046510
- use info and warn prefix
- generate systemd unit dracut-initramfs-restore in /run/systemd dynamically
- put "root=" parsing hooks in separate hook dir
@@ -28,9 +22,7 @@ INITRAMFS TODO
GENERATOR TODO
- report errors on missing files in check()
- remove wait for swap devs, if no "resume=" is given on the kernel command line
- remove wait for swap devs, if the "resume" dracut module is not included (omitted)
- add presets (predefined set of modules)
- add interpreter/plugin-scripts to be sourced at the beginning or end (can use dracut-functions)
- add mechanism for module specific command line options
@@ -50,6 +42,3 @@ Future Enhancement Requests
- run ssh server to enter crypto password or perform debugging (supported by debian)
- https://bugzilla.redhat.com/show_bug.cgi?id=524727 - dracut + encrypted root + networking
- lsinitrd --print-cmdline
- dracut --print-cmdline error if additional arguments
- library for cmdline

2
configure vendored
View File

@@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# We don't support srcdir != builddir
echo \#buildapi-variable-no-builddir >/dev/null

View File

@@ -1,4 +1,7 @@
#
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Copyright 2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
@@ -31,17 +34,13 @@ _dracut() {
--local --hostonly --no-hostonly --fstab --help --bzip2 --lzma
--xz --no-compress --gzip --list-modules --show-modules --keep
--printsize --regenerate-all --noimageifnotneeded --early-microcode
--no-early-microcode --print-cmdline --prelink --noprelink --reproducible
--uefi
'
--no-early-microcode --print-cmdline --prelink --noprelink'
[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 --persistent-policy --install-optional
--loginstall --uefi-stub --kernel-image
'
--kernel-cmdline --sshkey --persistent-policy --install-optional'
)
if __contains_word "$prev" ${OPTS[ARG]}; then

View File

@@ -1,4 +1,6 @@
#!/bin/bash --norc
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Copyright 2009 Red Hat, Inc. All rights reserved.
#

View File

@@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# functions used by dracut and other tools.
#
@@ -20,22 +22,17 @@
export LC_MESSAGES=C
if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
if ! [[ -d "$initdir/.kernelmodseen" ]]; then
mkdir -p "$initdir/.kernelmodseen"
if [[ -d "$initdir/.kernelmodseen" ]]; then
DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
fi
DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
fi
if [[ $initdir ]] && ! [[ -d $initdir ]]; then
mkdir -p "$initdir"
fi
# Generic substring function. If $2 is in $1, return 0.
strstr() { [[ $1 = *"$2"* ]]; }
# Generic glob matching function. If glob pattern $2 matches anywhere in $1, OK
strglobin() { [[ $1 = *$2* ]]; }
# Generic glob matching function. If glob pattern $2 matches all of $1, OK
strglob() { [[ $1 = $2 ]]; }
strstr() { [[ $1 = *$2* ]]; }
# returns OK if $1 contains literal string $2 at the beginning, and isn't empty
str_starts() { [ "${1#"$2"*}" != "$1" ]; }
# returns OK if $1 contains literal string $2 at the end, and isn't empty
str_ends() { [ "${1%*"$2"}" != "$1" ]; }
# helper function for check() in module-setup.sh
# to check for required installed binaries
@@ -309,7 +306,7 @@ get_fs_env() {
[[ $1 ]] || return
unset ID_FS_TYPE
ID_FS_TYPE=$(blkid -u filesystem -o export -- "$1" \
| while read line || [ -n "$line" ]; do
| while read line; do
if [[ "$line" == TYPE\=* ]]; then
printf "%s" "${line#TYPE=}";
exit 0;
@@ -376,7 +373,6 @@ get_persistent_dev() {
return
fi
done
printf -- "%s" "$1"
}
expand_persistent_dev() {
@@ -430,12 +426,12 @@ shorten_persistent_dev() {
# $ find_block_device /usr
# 8:4
find_block_device() {
local _majmin _dev _majmin _find_mpt
local _dev _majmin _find_mpt
_find_mpt="$1"
if [[ $use_fstab != yes ]]; then
[[ -d $_find_mpt/. ]]
findmnt -e -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | { \
while read _majmin _dev || [ -n "$_dev" ]; do
while read _majmin _dev; do
if [[ -b $_dev ]]; then
if ! [[ $_majmin ]] || [[ $_majmin == 0:* ]]; then
_majmin=$(get_maj_min $_dev)
@@ -456,7 +452,7 @@ find_block_device() {
# fall back to /etc/fstab
findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | { \
while read _majmin _dev || [ -n "$_dev" ]; do
while read _majmin _dev; do
if ! [[ $_dev ]]; then
_dev="$_majmin"
unset _majmin
@@ -492,7 +488,7 @@ find_mp_fstype() {
if [[ $use_fstab != yes ]]; then
findmnt -e -v -n -o 'FSTYPE' --target "$1" | { \
while read _fs || [ -n "$_fs" ]; do
while read _fs; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
printf "%s" "$_fs"
@@ -501,7 +497,7 @@ find_mp_fstype() {
fi
findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1" | { \
while read _fs || [ -n "$_fs" ]; do
while read _fs; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
printf "%s" "$_fs"
@@ -528,7 +524,7 @@ find_dev_fstype() {
if [[ $use_fstab != yes ]]; then
findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
while read _fs || [ -n "$_fs" ]; do
while read _fs; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
printf "%s" "$_fs"
@@ -537,7 +533,7 @@ find_dev_fstype() {
fi
findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
while read _fs || [ -n "$_fs" ]; do
while read _fs; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
printf "%s" "$_fs"
@@ -597,7 +593,8 @@ for_each_host_dev_fs()
local _dev
local _ret=1
[[ "${!host_fs_types[@]}" ]] || return 0
[[ "${#host_fs_types[@]}" ]] || return 2
for _dev in "${!host_fs_types[@]}"; do
$_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
@@ -619,13 +616,14 @@ check_block_and_slaves() {
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
if ! lvm_internal_dev $2; then "$1" $2 && return; fi
check_vol_slaves "$@" && return 0
if [[ -f /sys/dev/block/$2/../dev ]]; then
if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
check_block_and_slaves $1 $(<"/sys/dev/block/$2/../dev") && return 0
fi
[[ -d /sys/dev/block/$2/slaves ]] || return 1
for _x in /sys/dev/block/$2/slaves/*/dev; do
[[ -f $_x ]] || continue
check_block_and_slaves $1 $(<"$_x") && return 0
for _x in /sys/dev/block/$2/slaves/*; do
[[ -f $_x/dev ]] || continue
[[ $_x/subsystem -ef /sys/class/block ]] || continue
check_block_and_slaves $1 $(<"$_x/dev") && return 0
done
return 1
}
@@ -636,14 +634,15 @@ check_block_and_slaves_all() {
if ! lvm_internal_dev $2 && "$1" $2; then
_ret=0
fi
check_vol_slaves "$@" && return 0
if [[ -f /sys/dev/block/$2/../dev ]]; then
check_vol_slaves_all "$@" && return 0
if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
check_block_and_slaves_all $1 $(<"/sys/dev/block/$2/../dev") && _ret=0
fi
[[ -d /sys/dev/block/$2/slaves ]] || return 1
for _x in /sys/dev/block/$2/slaves/*/dev; do
[[ -f $_x ]] || continue
check_block_and_slaves_all $1 $(<"$_x") && _ret=0
for _x in /sys/dev/block/$2/slaves/*; do
[[ -f $_x/dev ]] || continue
[[ $_x/subsystem -ef /sys/class/block ]] || continue
check_block_and_slaves_all $1 $(<"$_x/dev") && _ret=0
done
return $_ret
}
@@ -656,9 +655,9 @@ for_each_host_dev_and_slaves_all()
local _dev
local _ret=1
[[ "${host_devs[@]}" ]] || return 0
[[ "${host_devs[@]}" ]] || return 2
for _dev in ${host_devs[@]}; do
for _dev in "${host_devs[@]}"; do
[[ -b "$_dev" ]] || continue
if check_block_and_slaves_all $_func $(get_maj_min $_dev); then
_ret=0
@@ -672,9 +671,9 @@ for_each_host_dev_and_slaves()
local _func="$1"
local _dev
[[ "${host_devs[@]}" ]] || return 0
[[ "${host_devs[@]}" ]] || return 2
for _dev in ${host_devs[@]}; do
for _dev in "${host_devs[@]}"; do
[[ -b "$_dev" ]] || continue
check_block_and_slaves $_func $(get_maj_min $_dev) && return 0
done
@@ -688,27 +687,44 @@ for_each_host_dev_and_slaves()
# but you cannot create the logical volume without the volume group.
# And the volume group might be bigger than the devices the LV needs.
check_vol_slaves() {
local _lv _vg _pv _dm
for i in /dev/mapper/*; do
[[ $i == /dev/mapper/control ]] && continue
_lv=$(get_maj_min $i)
_dm=/sys/dev/block/$_lv/dm
[[ -f $_dm/uuid && $(<$_dm/uuid) =~ LVM-* ]] || continue
if [[ $_lv = $2 ]]; then
_vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
# strip space
_vg=$(printf "%s\n" "$_vg")
if [[ $_vg ]]; then
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
do
check_block_and_slaves $1 $(get_maj_min $_pv) && return 0
done
fi
fi
done
local _lv _vg _pv _dm _majmin
_majmin="$2"
_lv="/dev/block/$_majmin"
_dm=/sys/dev/block/$_majmin/dm
[[ -f $_dm/uuid && $(<$_dm/uuid) =~ LVM-* ]] || return 1
_vg=$(dmsetup splitname --noheadings -o vg_name $(<"$_dm/name") )
# strip space
_vg="${_vg//[[:space:]]/}"
if [[ $_vg ]]; then
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
do
check_block_and_slaves $1 $(get_maj_min $_pv) && return 0
done
fi
return 1
}
check_vol_slaves_all() {
local _lv _vg _pv _majmin
_majmin="$2"
_lv="/dev/block/$_majmin"
_dm="/sys/dev/block/$_majmin/dm"
[[ -f $_dm/uuid && $(<$_dm/uuid) =~ LVM-* ]] || return 1
_vg=$(dmsetup splitname --noheadings -o vg_name $(<"$_dm/name") )
# strip space
_vg="${_vg//[[:space:]]/}"
if [[ $_vg ]]; then
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
do
check_block_and_slaves_all $1 $(get_maj_min $_pv)
done
return 0
fi
return 1
}
# fs_get_option <filesystem options> <search for option>
# search for a specific option in a bunch of filesystem options
# and return the value
@@ -729,14 +745,13 @@ fs_get_option() {
done
}
if ! [[ $DRACUT_INSTALL ]]; then
DRACUT_INSTALL=$(find_binary dracut-install)
fi
if ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/dracut-install ]]; then
DRACUT_INSTALL=$dracutbasedir/dracut-install
elif ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/install/dracut-install ]]; then
DRACUT_INSTALL=$dracutbasedir/install/dracut-install
fi
if ! [[ -x $DRACUT_INSTALL ]]; then
@@ -752,46 +767,33 @@ inst_dir() {
}
inst() {
local _hostonly_install
if [[ "$1" == "-H" ]]; then
_hostonly_install="-H"
shift
fi
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
#dinfo "$DRACUT_INSTALL -l $@"
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
}
inst_simple() {
local _hostonly_install
if [[ "$1" == "-H" ]]; then
_hostonly_install="-H"
shift
fi
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
[[ -e $1 ]] || return 1 # no source
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || :
$DRACUT_INSTALL ${initdir:+-D "$initdir"} "$@"
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} "$@" || :
}
inst_symlink() {
local _hostonly_install
if [[ "$1" == "-H" ]]; then
_hostonly_install="-H"
shift
fi
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
[[ -L $1 ]] || return 1
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
}
inst_multiple() {
local _ret
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
_ret=$?
(($_ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
return $_ret
local ret
#dinfo "initdir=$initdir $DRACUT_INSTALL -l $@"
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
ret=$?
(($ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
return $ret
}
dracut_install() {
@@ -799,31 +801,20 @@ dracut_install() {
}
inst_library() {
local _hostonly_install
if [[ "$1" == "-H" ]]; then
_hostonly_install="-H"
shift
fi
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
[[ -e $1 ]] || return 1 # no source
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
}
inst_binary() {
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
}
inst_script() {
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
}
mark_hostonly() {
for i in "$@"; do
echo "$i" >> "$initdir/lib/dracut/hostonly-files"
done
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
}
# find symlinks linked to given library file
@@ -963,41 +954,13 @@ inst_rules() {
done
}
inst_rules_wildcard() {
local _target=/etc/udev/rules.d _rule _found
inst_dir "${udevdir}/rules.d"
inst_dir "$_target"
for _rule in ${udevdir}/rules.d/$1 ${dracutbasedir}/rules.d/$1 ; do
if [[ -e $_rule ]]; then
inst_rule_programs "$_rule"
inst_rule_group_owner "$_rule"
inst_rule_initqueue "$_rule"
inst_simple "$_rule"
_found=$_rule
fi
done
if [[ -n ${hostonly} ]] ; then
for _rule in ${_target}/$1 ; do
if [[ -f $_rule ]]; then
inst_rule_programs "$_rule"
inst_rule_group_owner "$_rule"
inst_rule_initqueue "$_rule"
inst_simple "$_rule"
_found=$_rule
fi
done
fi
[[ $_found ]] || dinfo "Skipping udev rule: $_rule"
}
prepare_udev_rules() {
[ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
for f in "$@"; do
f="${initdir}/etc/udev/rules.d/$f"
[ -e "$f" ] || continue
while read line || [ -n "$line" ]; do
while read line; do
if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then
if [ $UDEVVERSION -ge 174 ]; then
printf '%sIMPORT{builtin}="path_id"\n' "${line%%IMPORT PATH_ID}"
@@ -1130,7 +1093,7 @@ inst_opt_decompress() {
# or the "check" script, if module-setup.sh is not found
# "check $hostonly" is called
module_check() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _ret
local _forced=0
local _hostonly=$hostonly
@@ -1161,7 +1124,7 @@ module_check() {
# or the "check" script, if module-setup.sh is not found
# "mount_needs=1 check 0" is called
module_check_mount() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _ret
mount_needs=1
[[ -d $_moddir ]] || return 1
@@ -1186,7 +1149,7 @@ module_check_mount() {
# execute the depends() function of module-setup.sh of <dracut module>
# or the "depends" script, if module-setup.sh is not found
module_depends() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _ret
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
@@ -1209,7 +1172,7 @@ module_depends() {
# execute the cmdline() function of module-setup.sh of <dracut module>
# or the "cmdline" script, if module-setup.sh is not found
module_cmdline() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _ret
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
@@ -1230,7 +1193,7 @@ module_cmdline() {
# execute the install() function of module-setup.sh of <dracut module>
# or the "install" script, if module-setup.sh is not found
module_install() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _ret
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
@@ -1251,7 +1214,7 @@ module_install() {
# execute the installkernel() function of module-setup.sh of <dracut module>
# or the "installkernel" script, if module-setup.sh is not found
module_installkernel() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _ret
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
@@ -1273,11 +1236,11 @@ module_installkernel() {
# device and filesystem types in "${host_fs_types[@]}"
check_mount() {
local _mod=$1
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _ret
local _moddep
[ "${#host_fs_types[*]}" -le 0 ] && return 1
[ "${#host_fs_types[@]}" -le 0 ] && return 1
# If we are already scheduled to be loaded, no need to check again.
[[ " $mods_to_load " == *\ $_mod\ * ]] && return 0
@@ -1338,7 +1301,7 @@ check_mount() {
# that the modules were checked for the dependency tracking process
check_module() {
local _mod=$1
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _ret
local _moddep
# If we are already scheduled to be loaded, no need to check again.
@@ -1451,7 +1414,7 @@ install_kmod_with_fw() {
if [[ $omit_drivers ]]; then
local _kmod=${1##*/}
_kmod=${_kmod%.ko*}
_kmod=${_kmod%.ko}
_kmod=${_kmod/-/_}
if [[ "$_kmod" =~ $omit_drivers ]]; then
dinfo "Omitting driver $_kmod"
@@ -1465,7 +1428,7 @@ install_kmod_with_fw() {
if [[ $silent_omit_drivers ]]; then
local _kmod=${1##*/}
_kmod=${_kmod%.ko*}
_kmod=${_kmod%.ko}
_kmod=${_kmod/-/_}
[[ "$_kmod" =~ $silent_omit_drivers ]] && return 0
[[ "${1##*/lib/modules/$kernel/}" =~ $silent_omit_drivers ]] && return 0
@@ -1512,7 +1475,7 @@ for_each_kmod_dep() {
local _func=$1 _kmod=$2 _cmd _modpath _options
shift 2
modprobe "$@" --ignore-install --show-depends $_kmod 2>&${_fderr} | (
while read _cmd _modpath _options || [ -n "$_cmd" ]; do
while read _cmd _modpath _options; do
[[ $_cmd = insmod ]] || continue
$_func ${_modpath} || exit $?
done
@@ -1528,16 +1491,16 @@ dracut_kernel_post() {
--ignore-install --show-depends --set-version $kernel \
< "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" 2>/dev/null \
| sort -u \
| while read _cmd _modpath _options || [ -n "$_cmd" ]; do
| while read _cmd _modpath _options; do
[[ $_cmd = insmod ]] || continue
echo "$_modpath"
done > "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
(
if [[ $DRACUT_INSTALL ]] && [[ -z $_moddirname ]]; then
xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
else
while read _modpath || [ -n "$_modpath" ]; do
while read _modpath; do
local _destpath=$_modpath
[[ $_moddirname ]] && _destpath=${_destpath##$_moddirname/}
_destpath=${_destpath##*/lib/modules/$kernel/}
@@ -1545,16 +1508,16 @@ dracut_kernel_post() {
done < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
fi
) &
_pid=$(jobs -p | while read a || [ -n "$a" ]; do printf ":$a";done)
_pid=$(jobs -p | while read a ; do printf ":$a";done)
_pid=${_pid##*:}
if [[ $DRACUT_INSTALL ]]; then
xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" \
| while read line || [ -n "$line" ]; do
| while read line; do
for _fwdir in $fw_dir; do
echo $_fwdir/$line;
done;
done | xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} -a -o
done | xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a -o
else
for _fw in $(xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"); do
for _fwdir in $fw_dir; do
@@ -1589,7 +1552,7 @@ module_is_host_only() {
local _mod=$1
local _modenc a i _k _s _v _aliases
_mod=${_mod##*/}
_mod=${_mod%.ko*}
_mod=${_mod%.ko}
_modenc=${_mod//-/_}
[[ " $add_drivers " == *\ ${_mod}\ * ]] && return 0
@@ -1635,8 +1598,8 @@ find_kernel_modules_by_path () {
_OLDIFS=$IFS
IFS=:
while read a rest || [ -n "$a" ]; do
[[ $a = */$1/* ]] || [[ $a = updates/* ]] || continue
while read a rest; do
[[ $a = */$1/* ]] || [[ $a = updates/* ]] || [[ $a = extra/* ]] || [[ $a = weak-updates/* ]] ||continue
printf "%s\n" "$srcmods/$a"
done < "$srcmods/modules.dep"
IFS=$_OLDIFS
@@ -1679,18 +1642,11 @@ instmods() {
--*) _mpargs+=" $_mod" ;;
*)
_mod=${_mod##*/}
# Check for aliased modules
_modalias=$(modinfo -k $kernel -F filename $_mod 2> /dev/null)
_modalias=${_modalias%.ko*}
if [[ $_modalias ]] && [ "${_modalias##*/}" != "${_mod%.ko*}" ] ; then
_mod=${_modalias##*/}
fi
# if we are already installed, skip this module and go on
# to the next one.
if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \
[[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko*}" ]]; then
read _ret <"$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko*}"
[[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko}.ko" ]]; then
read _ret <"$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko}.ko"
return $_ret
fi
@@ -1720,7 +1676,7 @@ instmods() {
((_ret+=$?))
else
[[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \
echo ${_mod%.ko*} >> "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist"
echo $_mod >> "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist"
fi
;;
esac
@@ -1730,18 +1686,20 @@ instmods() {
function instmods_1() {
local _mod _mpargs
if (($# == 0)); then # filenames from stdin
while read _mod || [ -n "$_mod" ]; do
while read _mod; do
inst1mod "${_mod%.ko*}" || {
if [[ "$_check" == "yes" ]] && [[ "$_silent" == "no" ]]; then
dfatal "Failed to install module $_mod"
if [[ "$_check" == "yes" ]]; then
[[ "$_silent" == "no" ]] && dfatal "Failed to install module $_mod"
return 1
fi
}
done
fi
while (($# > 0)); do # filenames as arguments
inst1mod ${1%.ko*} || {
if [[ "$_check" == "yes" ]] && [[ "$_silent" == "no" ]]; then
dfatal "Failed to install module $1"
if [[ "$_check" == "yes" ]]; then
[[ "$_silent" == "no" ]] && dfatal "Failed to install module $1"
return 1
fi
}
shift
@@ -1753,28 +1711,10 @@ instmods() {
# Capture all stderr from modprobe to _fderr. We could use {var}>...
# redirections, but that would make dracut require bash4 at least.
eval "( instmods_1 \"\$@\" ) ${_fderr}>&1" \
| while read line || [ -n "$line" ]; do [[ "$line" =~ $_filter_not_found ]] || echo $line;done | derror
| while read line; do [[ "$line" =~ $_filter_not_found ]] || echo $line;done | derror
_ret=$?
return $_ret
}
check_kernel_config()
{
local _config_opt="$1"
local _config_file
[[ -f /boot/config-$kernel ]] \
&& _config_file="/boot/config-$kernel"
[[ -f /lib/modules/$kernel/config ]] \
&& _config_file="/lib/modules/$kernel/config"
# no kernel config file, so return true
[[ $_config_file ]] || return 0
grep -q -F "${_config_opt}=" "$_config_file" && return 0
return 1
}
# get_cpu_vendor
# Only two values are returned: AMD or Intel
get_cpu_vendor ()
@@ -1796,9 +1736,8 @@ get_ucode_file ()
local stepping=`grep -E "stepping" /proc/cpuinfo | head -1 | sed s/.*:\ //`
if [[ "$(get_cpu_vendor)" == "AMD" ]]; then
# If family greater or equal than 0x15
if [[ $family -ge 21 ]]; then
printf "microcode_amd_fam15h.bin"
printf "microcode_amd_fam%xh.bin" $family
else
printf "microcode_amd.bin"
fi
@@ -1809,6 +1748,17 @@ get_ucode_file ()
fi
}
# Get currently loaded modules
# sorted, and delimited by newline
get_loaded_kernel_modules ()
{
local modules=( )
while read _module _size _used _used_by; do
modules+=( "$_module" )
done <<< "$(lsmod | sed -n '1!p')"
printf '%s\n' "${modules[@]}" | sort
}
# Not every device in /dev/mapper should be examined.
# If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
lvm_internal_dev() {
@@ -1820,3 +1770,14 @@ lvm_internal_dev() {
[[ ${DM_LV_LAYER} ]] || [[ ! -L /dev/${DM_VG_NAME}/${DM_LV_NAME} ]]
}
# Use with form hostonly="$(optional_hostonly)" inst_xxxx <args>
# If hosotnly mode is set to "strict", hostonly restrictions will still
# be applied, else will ignore hostonly mode and try to install all
# given modules.
optional_hostonly() {
if [[ $hostonly_mode = "strict" ]]; then
printf -- "$hostonly"
else
printf ""
fi
}

34
dracut-init.sh Normal file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
#
# functions used by dracut and other tools.
#
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
export LC_MESSAGES=C
if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
if ! [[ -d "$initdir/.kernelmodseen" ]]; then
mkdir -p "$initdir/.kernelmodseen"
fi
DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
fi
if [[ $initdir ]] && ! [[ -d $initdir ]]; then
mkdir -p "$initdir"
fi
[[ $dracutbasedir ]] || export dracutbasedir=${BASH_SOURCE%/*}
. $dracutbasedir/dracut-functions.sh

View File

@@ -1,11 +1,9 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
set -e
# do some sanity checks first
[ -e /run/initramfs/bin/sh ] && exit 0
[ -e /run/initramfs/.need_shutdown ] || exit 0
KERNEL_VERSION="$(uname -r)"
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
@@ -14,8 +12,6 @@ SKIP="$dracutbasedir/skipcpio"
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
mount -o ro /boot &>/dev/null
if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
fi
@@ -24,7 +20,6 @@ fi
cd /run/initramfs
[ -f .need_shutdown -a -f "$IMG" ] || exit 1
if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
rm -f -- .need_shutdown
elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then

View File

@@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 et filetype=sh
#
# logging faciality module for dracut both at build- and boot-time
#
@@ -148,8 +150,7 @@ dlog_init() {
&& type -P systemd-cat &>/dev/null \
&& systemctl --quiet is-active systemd-journald.socket &>/dev/null \
&& { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &>/dev/null; } ; then
readonly _dlogdir="$(mktemp --tmpdir="$TMPDIR/" -d -t dracut-log.XXXXXX)"
readonly _systemdcatfile="$_dlogdir/systemd-cat"
readonly _systemdcatfile="$DRACUT_TMPDIR/systemd-cat"
mkfifo "$_systemdcatfile"
readonly _dlogfd=15
systemd-cat -t 'dracut' --level-prefix=true <"$_systemdcatfile" &

View File

@@ -31,7 +31,7 @@ early userspace.
For a complete list of kernel command line options see *dracut.cmdline*(7).
If you are dropped to an emergency shell, while booting your initramfs,
the file _/run/initramfs/rdsosreport.txt_ is created, which can be saved 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/rdsosreport.txt_ contains all logs and the output
@@ -319,6 +319,16 @@ provide a valid _/etc/fstab_.
**--no-hostonly-cmdline**:
Do not store kernel command line arguments needed in the initramfs
**--no-hostonly-default-device**:
Do not generate implicit host devices like root, swap, fstab, etc.
Use "--mount" or "--add-device" to explicitly add devices as needed.
**--hostonly-i18n**:
Install only needed keyboard and font files according to the host configuration (default).
**--no-hostonly-i18n**:
Install all keyboard and font files available.
**--persistent-policy** _<policy>_::
Use _<policy>_ to address disks and partitions.
_<policy>_ can be any directory name found in /dev/disk.
@@ -425,9 +435,6 @@ will not be able to boot.
Do not compress the generated initramfs. This will override any other
compression options.
**--reproducible**::
Create reproducible images.
**--list-modules**::
List all available dracut modules.
@@ -462,23 +469,6 @@ will not be able to boot.
Regenerate all initramfs images at the default location with the kernel
versions found on the system. Additional parameters are passed through.
**--loginstall _<DIR>_::
Log all files installed from the host to _<DIR>_.
**--uefi::
Instead of creating an initramfs image, dracut will create an UEFI executable,
which can be executed by an UEFI BIOS.
**--uefi-stub _<FILE>_::
Specifies the UEFI stub loader, which will load the attached kernel, initramfs and
kernel command line and boots the kernel. The default is
_/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
or _/usr/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
**--kernel-image _<FILE>_::
Specifies the kernel image, which to include in the UEFI executable. The default is
_/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
FILES
-----
_/var/log/dracut.log_::

View File

@@ -81,10 +81,6 @@ rootfstype=ext3
enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or
lvm. Default is off as of dracut version >= 024.
**rd.hostonly=0**::
removes all compiled in configuration of the host system the initramfs image
was built on. This helps booting, if any disk layout changed, especially in
combination with rd.auto or other parameters specifying the layout.
**rd.cmdline=ask**::
prompts the user for additional kernel command line parameters
@@ -109,26 +105,13 @@ resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
the init system performs fsck before remount, you might want to use this
option to avoid duplication.
iso-scan/filename
~~~~~~~~~~~~~~~~~
Using iso-scan/filename with a Fedora/Red Hat/CentOS Live iso should just work
by copying the original kernel cmdline parameters.
[listing]
.Example
--
menuentry 'Live Fedora 20' --class fedora --class gnu-linux --class gnu --class os {
set isolabel=Fedora-Live-LXDE-x86_64-20-1
set isofile="/boot/iso/Fedora-Live-LXDE-x86_64-20-1.iso"
loopback loop $isofile
linux (loop)/isolinux/vmlinuz0 boot=isolinux iso-scan/filename=$isofile root=live:LABEL=$isolabel ro rd.live.image quiet rhgb
initrd (loop)/isolinux/initrd0.img
}
--
Misc
~~~~
**rd.emergency=**__[reboot|poweroff|halt]__::
specify, what action to execute in case of a critical failure. rd.shell=0 also
be specified.
**rd.driver.blacklist=**__<drivername>__[,__<drivername>__,...]::
do not load kernel module <drivername>. This parameter can be specified
multiple times.
@@ -142,16 +125,11 @@ Misc
have been loaded. This parameter can be specified multiple times.
**rd.retry=**__<seconds>__::
specify how long dracut should retry the initqueue to configure devices.
specify how long dracut should wait for devices to appear.
The default is 30 seconds. After 2/3 of the time, degraded raids are force
started. If you have hardware, which takes a very long time to announce its
drives, you might want to extend this value.
**rd.timeout=**__<seconds>__::
specify how long dracut should wait for devices to appear. The
default is '0', which means 'forever'. Note that this timeout
should be longer than rd.retry to allow for proper configuration.
**rd.noverifyssl**::
accept self-signed certificates for ssl downloads.
@@ -163,7 +141,7 @@ Misc
Debug
~~~~~
If you are dropped to an emergency shell, the file
_/run/initramfs/rdsosreport.txt_ is created, which can be saved to a (to be
_/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/rdsosreport.txt_ contains all logs and the output of some tools.
@@ -183,8 +161,8 @@ It should be attached to any report about dracut problems.
_/run/initramfs/init.log_.
If "quiet" is set, it also logs to the console.
**rd.memdebug=[0-3]**::
Print memory usage info at various points, set the verbose level from 0 to 3.
**rd.memdebug=[0-4]**::
Print memory usage info at various points, set the verbose level from 0 to 4.
+
Higher level means more debugging output:
+
@@ -193,6 +171,10 @@ It should be attached to any report about dracut problems.
1 - partial /proc/meminfo
2 - /proc/meminfo
3 - /proc/meminfo + /proc/slabinfo
4 - /proc/meminfo + /proc/slabinfo + tracekomem
NOTE: tracekomem is a shell script utilizing kernel trace to track
the rough total memory consumption of kernel modules during
loading. It may override other trace configurations.
----
**rd.break**::
@@ -384,11 +366,6 @@ DM RAID
only activate the raid sets with the given UUID. This parameter can be
specified multiple times.
MULTIPATH
~~~~~~~~~
**rd.multipath=0**::
disable multipath detection
FIPS
~~~~
**rd.fips**::
@@ -472,7 +449,7 @@ USB Android phone::
* enp0s29u1u2
=====================
**ip=**__{dhcp|on|any|dhcp6|auto6}__::
**ip=**__{dhcp|on|any|dhcp6|auto6|either6}__::
dhcp|on|any::: get ip from dhcp server from all interfaces. If root=dhcp,
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
with a valid DHCP root-path.
@@ -481,6 +458,8 @@ USB Android phone::
dhcp6::: IPv6 DHCP
either6::: if auto6 fails, then dhcp6
**ip=**__<interface>__:__{dhcp|on|any|dhcp6|auto6}__[:[__<mtu>__][:__<macaddr>__]]::
This parameter can be specified multiple times.
+
@@ -492,7 +471,7 @@ cannot be used in conjunction with the **ifname** argument for the
same <interface>.
=====================
**ip=**__<client-IP>__:[__<peer>__]:__<gateway-IP>__:__<netmask>__:__<client_hostname>__:__<interface>__:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__:[:[__<mtu>__][:__<macaddr>__]]::
**ip=**__<client-IP>__:[__<peer>__]:__<gateway-IP>__:__<netmask>__:__<client_hostname>__:__<interface>__:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__[:[__<mtu>__][:__<macaddr>__]]::
explicit network configuration. If you want do define a IPv6 address, put it
in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple
times. __<peer>__ is optional and is the address of the remote endpoint
@@ -603,6 +582,31 @@ NFS
**rd.nfs.domain=**__<NFSv4 domain name>__::
Set the NFSv4 domain name. Will overwrite the settings in _/etc/idmap.conf_.
**rd.net.dhcp.retry=**__<cnt>__::
If this option is set, dracut will try to connect via dhcp <cnt> times before failing.
Default is 1.
**rd.net.timeout.dhcp=**__<arg>__::
If this option is set, dhclient is called with "-timeout <arg>".
**rd.net.timeout.iflink=**__<seconds>__::
Wait <seconds> until link shows up. Default is 60 seconds.
**rd.net.timeout.ifup=**__<seconds>__::
Wait <seconds> until link has state "UP". Default is 20 seconds.
**rd.net.timeout.route=**__<seconds>__::
Wait <seconds> until route shows up. Default is 20 seconds.
**rd.net.timeout.ipv6dad=**__<seconds>__::
Wait <seconds> until IPv6 DAD is finished. Default is 50 seconds.
**rd.net.timeout.ipv6auto=**__<seconds>__::
Wait <seconds> until IPv6 automatic addresses are assigned. Default is 40 seconds.
**rd.net.timeout.carrier=**__<seconds>__::
Wait <seconds> until carrier is recognized. Default is 5 seconds.
CIFS
~~~
**root=**cifs://[__<username>__[:__<password>__]@]__<server-ip>__:__<root-dir>__::
@@ -710,6 +714,12 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30
**rd.iscsi.ibft** **rd.iscsi.ibft=1**:
Turn on iBFT autoconfiguration for the interfaces
**rd.iscsi.waitnet=0**:
Turn off waiting for all interfaces to be up before trying to login to the iSCSI targets.
**rd.iscsi.testroute=0**:
Turn off checking, if the route to the iSCSI target IP is possible before trying to login.
FCoE
~~~~
**fcoe=**__<edd|interface|MAC>__:__{dcb|nodcb}__::
@@ -817,14 +827,13 @@ of your compressed filesystem image tarball.
=====================
**root=**live:__<url>__::
Boots a live image retrieved from __<url>__. Valid handlers: __http, https, ftp, torrent, tftp__.
Boots a live image retrieved from __<url>__. Valid handlers: __http, httpd, ftp, tftp__.
+
[listing]
.Example
--
root=live:http://example.com/liveboot.img
root=live:ftp://ftp.example.com/liveboot.img
root=live:torrent://example.com/liveboot.img.torrent
--
**rd.live.debug=**1::
@@ -990,8 +999,6 @@ rd_NO_MD:: rd.md=0
rd_MD_UUID:: rd.md.uuid
rd_NO_MULTIPATH: rd.multipath=0
rd_NFS_DOMAIN:: rd.nfs.domain
iscsi_initiator:: rd.iscsi.initiator

View File

@@ -10,8 +10,7 @@ dracut.conf - configuration file(s) for dracut
SYNOPSIS
--------
_/etc/dracut.conf_
_/etc/dracut.conf.d/\*.conf_
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_
_/usr/lib/dracut/dracut.conf.d/*.conf_
Description
@@ -31,6 +30,11 @@ dracut command line options will overwrite any values set here.
Configuration files must have the extension .conf; other extensions are ignored.
[WARNING]
====
Space-separated lists have to have a leading and trailing space!
====
*dracutmodules+=*" __<dracut modules>__ "::
Specify a space-separated list of dracut modules to call when building the
initramfs. Modules are located in _/usr/lib/dracut/modules.d_.
@@ -75,13 +79,6 @@ Configuration files must have the extension .conf; other extensions are ignored.
Specify additional files to include in the initramfs, separated by spaces,
if they exist.
*compress=*"__{bzip2|lzma|xz|gzip|lzo|lz4|<compressor [args ...]>}__"::
Compress the generated initramfs using the passed compression program. If
you pass it just the name of a compression program, it will call that
program with known-working arguments. If you pass arguments, it will be called
with exactly those arguments. Depending on what you pass, this may result in
an initramfs that the kernel cannot decompress.
*do_strip=*"__{yes|no}__"::
Strip binaries in the initramfs (default=yes)
@@ -92,9 +89,12 @@ Configuration files must have the extension .conf; other extensions are ignored.
Host-Only mode: Install only what is needed for booting the local host
instead of a generic host and generate host-specific configuration.
*hostonly_cmdline=*"__{yes|no}__"::
*hostonly_cmdline*"__{yes|no}__"::
If set, store the kernel command line arguments needed in the initramfs
*i18n_install_all=*"__{yes|no}__"::
If set to yes, install all available fonts and keyboard files.
*persistent_policy=*"__<policy>__"::
Use _<policy>_ to address disks and partitions.
_<policy>_ can be any directory name found in /dev/disk.
@@ -191,22 +191,6 @@ provide a valid _/etc/fstab_.
*i18n_install_all=*"__{yes|no}__"::
Install everything regardless of generic or hostonly mode.
*reproducible=*"__{yes|no}__"::
Create reproducible images.
*loginstall=*"__<DIR>__"::
Log all files installed from the host to _<DIR>_.
*uefi_stub=*"_<FILE>_"::
Specifies the UEFI stub loader, which will load the attached kernel, initramfs and
kernel command line and boots the kernel. The default is
_/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
or _/usr/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
*kernel_image=*"_<FILE>_"::
Specifies the kernel image, which to include in the UEFI executable. The default is
_/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
Files
-----
_/etc/dracut.conf_::

View File

@@ -2,10 +2,8 @@
# i18n
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
i18n_default_font="eurlatgr"
i18n_default_font="latarcyrheb-sun16"
i18n_install_all="yes"
stdloglvl=3
sysloglvl=5
install_optional_items+=" vi /etc/virc ps grep cat rm "

View File

@@ -1,24 +1,3 @@
# SUSE specifc dracut settings
#
# SUSE by default always builds a as small as possible initrd for performance
# and resource reasons.
# If you like to build a generic initrd which works on other platforms than
# on the one dracut/mkinitrd got called comment out below setting(s).
hostonly="yes"
hostonly_cmdline="yes"
compress="xz -0 --check=crc32 --memlimit-compress=50%"
i18n_vars="/etc/sysconfig/language:RC_LANG-LANG,RC_LC_ALL-LC_ALL /etc/sysconfig/console:CONSOLE_UNICODEMAP-FONT_UNIMAP,CONSOLE_FONT-FONT,CONSOLE_SCREENMAP-FONT_MAP /etc/sysconfig/keyboard:KEYTABLE-KEYMAP"
omit_drivers+=" i2o_scsi"
# Below adds additional tools to the initrd which are not urgently necessary to
# bring up the system, but help to debug problems.
# See /usr/lib/dracut/modules.d/95debug/module-setup.sh which additional tools
# are installed and add more if you need them. This specifically helps if you
# use:
# rd.break=[cmdline|pre-udev|pre-trigger|initqueue|pre-mount|
# mount|pre-pivot|cleanup]
# boot parameter or if you are forced to enter the dracut emergency shell.
# add_dracutmodules+=debug

View File

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

575
dracut.sh
View File

@@ -1,4 +1,6 @@
#!/bin/bash --norc
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Generator script for a dracut initramfs
# Tries to retain some degree of compatibility with the command line
@@ -21,6 +23,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
unset BASH_ENV
# store for logging
dracut_args=( "$@" )
@@ -139,10 +143,32 @@ Creates initial ramdisk images for preloading modules
-H, --hostonly Host-Only mode: Install only what is needed for
booting the local host instead of a generic host.
-N, --no-hostonly Disables Host-Only mode
--hostonly-mode <mode>
Specify the hostonly mode to use. <mode> could be
one of "sloppy" or "strict". "sloppy" mode is used
by default.
In "sloppy" hostonly mode, extra drivers and modules
will be installed, so minor hardware change won't make
the image unbootable (eg. changed keyboard), and the
image is still portable among similar hosts.
With "strict" mode enabled, anything not necessary
for booting the local host in its current state will
not be included, and modules may do some extra job
to save more space. Minor change of hardware or
environment could make the image unbootable.
DO NOT use "strict" mode unless you know what you
are doing.
--hostonly-cmdline Store kernel command line arguments needed
in the initramfs
--no-hostonly-cmdline Do not store kernel command line arguments needed
in the initramfs
--no-hostonly-default-device
Do not generate implicit host devices like root,
swap, fstab, etc. Use "--mount" or "--add-device"
to explicitly add devices as needed.
--hostonly-i18n Install only needed keyboard and font files according
to the host configuration (default).
--no-hostonly-i18n Install all keyboard and font files available.
--persistent-policy [POLICY]
Use [POLICY] to address disks and partitions.
POLICY can be any directory name found in /dev/disk.
@@ -174,10 +200,10 @@ Creates initial ramdisk images for preloading modules
--xz Compress the generated initramfs using xz.
Make sure that your kernel has xz support compiled
in, otherwise you will not be able to boot.
--lzo Compress the generated initramfs using lzop.
--lzo Compress the generated initramfs using lzop.
Make sure that your kernel has lzo support compiled
in, otherwise you will not be able to boot.
--lz4 Compress the generated initramfs using lz4.
--lz4 Compress the generated initramfs using lz4.
Make sure that your kernel has lz4 support compiled
in, otherwise you will not be able to boot.
--compress [COMPRESSION] Compress the generated initramfs with the
@@ -193,12 +219,6 @@ Creates initial ramdisk images for preloading modules
--printsize Print out the module install size
--sshkey [SSHKEY] Add ssh key to initramfs (use with ssh-client module)
--logfile [FILE] Logfile to use (overrides configuration setting)
--reproducible Create reproducible images
--loginstall [DIR] Log all files installed from the host to [DIR]
--uefi Create an UEFI executable with the kernel cmdline and
kernel combined
--uefi-stub [FILE] Use the UEFI stub [FILE] to create an UEFI executable
--kernel-image [FILE] location of the kernel image
If [LIST] has multiple arguments, then you have to put these in quotes.
@@ -223,16 +243,6 @@ push() {
done
}
# Fills up host_devs stack variable and makes sure there are no duplicates
push_host_devs() {
local _dev
for _dev in ${host_devs[@]}; do
[ "$_dev" = "$1" ] && return
done
push host_devs "$1"
}
# function pop()
# pops the last value from a stack
# assigns value to second argument variable
@@ -371,8 +381,10 @@ rearrange_params()
--long host-only \
--long no-hostonly \
--long no-host-only \
--long hostonly-mode: \
--long hostonly-cmdline \
--long no-hostonly-cmdline \
--long no-hostonly-default-device \
--long persistent-policy: \
--long fstab \
--long help \
@@ -391,11 +403,8 @@ rearrange_params()
--long noimageifnotneeded \
--long early-microcode \
--long no-early-microcode \
--long reproducible \
--long loginstall: \
--long uefi \
--long uefi-stub: \
--long kernel-image: \
--long no-hostonly-i18n \
--long hostonly-i18n \
-- "$@")
if (( $? != 0 )); then
@@ -517,7 +526,6 @@ while :; do
-L|--stdlog) stdloglvl_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--compress) compress_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--prefix) prefix_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--loginstall) loginstall_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--rebuild) if [ $rebuild_file == $outfile ]; then
force=yes
fi
@@ -551,17 +559,25 @@ while :; do
-q|--quiet) ((verbosity_mod_l--));;
-l|--local)
allowlocal="yes"
[[ -f "$(readlink -f "${0%/*}")/dracut-functions.sh" ]] \
[[ -f "$(readlink -f "${0%/*}")/dracut-init.sh" ]] \
&& dracutbasedir="$(readlink -f "${0%/*}")"
;;
-H|--hostonly|--host-only)
hostonly_l="yes" ;;
-N|--no-hostonly|--no-host-only)
hostonly_l="no" ;;
--hostonly-mode)
hostonly_mode_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--hostonly-cmdline)
hostonly_cmdline_l="yes" ;;
--hostonly-i18n)
i18n_install_all_l="no" ;;
--no-hostonly-i18n)
i18n_install_all_l="yes" ;;
--no-hostonly-cmdline)
hostonly_cmdline_l="no" ;;
--no-hostonly-default-device)
hostonly_default_device="no" ;;
--persistent-policy)
persistent_policy_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--fstab) use_fstab_l="yes" ;;
@@ -583,12 +599,7 @@ while :; do
--printsize) printsize="yes";;
--regenerate-all) regenerate_all="yes";;
--noimageifnotneeded) noimageifnotneeded="yes";;
--reproducible) reproducible_l="yes";;
--uefi) uefi="yes";;
--uefi-stub)
uefi_stub_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--kernel-image)
kernel_image_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--) shift; break;;
*) # should not even reach this point
@@ -601,7 +612,7 @@ done
# the old fashioned way
while (($# > 0)); do
if [ "${1%%=*}" == "++include" ]; then
if [ ${1%%=*} == "++include" ]; then
push include_src "$2"
push include_target "$3"
PARMS_TO_STORE+=" --include '$2' '$3'"
@@ -657,10 +668,21 @@ if ! [[ $outfile ]]; then
fi
fi
for i in /usr/sbin /sbin /usr/bin /bin; do
rl=$i
if [ -L "$i" ]; then
rl=$(readlink -f $i)
fi
if [[ "$NPATH" != *:$rl* ]] ; then
NPATH+=":$rl"
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 LD_PRELOAD
unset GREP_OPTIONS
@@ -705,20 +727,6 @@ for f in $(dropindirs_sort ".conf" "$confdir" "$dracutbasedir/dracut.conf.d"); d
[[ -e $f ]] && . "$f"
done
DRACUT_PATH=${DRACUT_PATH:-/sbin /bin /usr/sbin /usr/bin}
for i in $DRACUT_PATH; do
rl=$i
if [ -L "$i" ]; then
rl=$(readlink -f $i)
fi
if [[ "$NPATH" != *:$rl* ]] ; then
NPATH+=":$rl"
fi
done
export PATH="${NPATH#:}"
unset NPATH
# these optins add to the stuff in the config file
if (( ${#add_dracutmodules_l[@]} )); then
while pop add_dracutmodules_l val; do
@@ -815,7 +823,8 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $prefix = "/" ]] && unset prefix
[[ $hostonly_l ]] && hostonly=$hostonly_l
[[ $hostonly_cmdline_l ]] && hostonly_cmdline=$hostonly_cmdline_l
[[ "$hostonly" == "yes" ]] && ! [[ $hostonly_cmdline ]] && hostonly_cmdline="yes"
[[ $hostonly_mode_l ]] && hostonly_mode=$hostonly_mode_l
[[ $i18n_install_all_l ]] && i18n_install_all=$i18n_install_all_l
[[ $persistent_policy_l ]] && persistent_policy=$persistent_policy_l
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
@@ -832,38 +841,16 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $early_microcode_l ]] && early_microcode=$early_microcode_l
[[ $early_microcode ]] || early_microcode=no
[[ $logfile_l ]] && logfile="$logfile_l"
[[ $reproducible_l ]] && reproducible="$reproducible_l"
[[ $loginstall_l ]] && loginstall="$loginstall_l"
[[ $uefi_stub_l ]] && uefi_stub="$uefi_stub_l"
[[ $kernel_image_l ]] && kernel_image="$kernel_image_l"
# eliminate IFS hackery when messing with fw_dir
fw_dir=${fw_dir//:/ }
# check for logfile and try to create one if it doesn't exist
if [[ -n "$logfile" ]];then
if [[ ! -f "$logfile" ]];then
touch "$logfile"
if [ ! $? -eq 0 ] ;then
printf "%s\n" "dracut: touch $logfile failed." >&2
fi
fi
fi
# handle compression options.
[[ $compress ]] || compress="gzip"
case $compress in
bzip2) compress="bzip2 -9";
command -v lbzip2 > /dev/null 2>&1 && compress="lbzip2 -9";;
bzip2) compress="bzip2 -9";;
lzma) compress="lzma -9 -T0";;
xz) compress="xz --check=crc32 --lzma2=dict=1MiB -T0";;
gzip) compress="gzip -n -9";
if command -v pigz > /dev/null 2>&1; then
compress="pigz -9 -n -T -R"
elif command -v gzip --help 2>&1 | grep -q rsyncable; then
compress="gzip -n -9 --rsyncable"
fi
;;
gzip) compress="gzip -9"; command -v pigz > /dev/null 2>&1 && compress="pigz -9";;
lzo) compress="lzop -9";;
lz4) compress="lz4 -l -9";;
esac
@@ -874,35 +861,41 @@ fi
[[ $hostonly = yes ]] && hostonly="-h"
[[ $hostonly != "-h" ]] && unset hostonly
[[ $reproducible == yes ]] && DRACUT_REPRODUCIBLE=1
case $hostonly_mode in
'')
[[ $hostonly ]] && hostonly_mode="sloppy" ;;
sloppy|strict)
if [[ ! $hostonly ]]; then
unset hostonly_mode
fi
;;
*)
printf "%s\n" "dracut: Invalid hostonly mode '$hostonly_mode'." >&2
exit 1
esac
readonly TMPDIR="$tmpdir"
readonly initdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)"
[ -d "$initdir" ] || {
printf "%s\n" "dracut: mktemp --tmpdir='$TMPDIR/' -d -t initramfs.XXXXXX failed." >&2
readonly DRACUT_TMPDIR="$(mktemp -p "$TMPDIR/" -d -t dracut.XXXXXX)"
[ -d "$DRACUT_TMPDIR" ] || {
printf "%s\n" "dracut: mktemp -p '$TMPDIR/' -d -t dracut.XXXXXX failed." >&2
exit 1
}
if [[ $early_microcode = yes ]] || ( [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]] ); then
readonly early_cpio_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_cpio.XXXXXX)"
[ -d "$early_cpio_dir" ] || {
printf "%s\n" "dracut: mktemp --tmpdir='$TMPDIR/' -d -t early_cpio.XXXXXX failed." >&2
exit 1
}
fi
# clean up after ourselves no matter how we die.
trap '
ret=$?;
[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf -- "$initdir"; };
[[ $keep ]] && echo "Not removing $early_cpio_dir." >&2 || { [[ $early_cpio_dir ]] && rm -Rf -- "$early_cpio_dir"; };
[[ $keep ]] && echo "Not removing $uefi_outdir." >&2 || { [[ $uefi_outdir ]] && rm -Rf -- "$uefi_outdir"; };
[[ $_dlogdir ]] && rm -Rf -- "$_dlogdir";
[[ $keep ]] && echo "Not removing $DRACUT_TMPDIR." >&2 || { [[ $DRACUT_TMPDIR ]] && rm -rf -- "$DRACUT_TMPDIR"; };
exit $ret;
' EXIT
# clean up after ourselves no matter how we die.
trap 'exit 1;' SIGINT
readonly initdir="${DRACUT_TMPDIR}/initramfs"
mkdir "$initdir"
export DRACUT_KERNEL_LAZY="1"
export DRACUT_RESOLVE_LAZY="1"
@@ -917,10 +910,10 @@ if [[ -f $dracutbasedir/dracut-version.sh ]]; then
. $dracutbasedir/dracut-version.sh
fi
if [[ -f $dracutbasedir/dracut-functions.sh ]]; then
. $dracutbasedir/dracut-functions.sh
if [[ -f $dracutbasedir/dracut-init.sh ]]; then
. $dracutbasedir/dracut-init.sh
else
printf "%s\n" "dracut: Cannot find $dracutbasedir/dracut-functions.sh." >&2
printf "%s\n" "dracut: Cannot find $dracutbasedir/dracut-init.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
@@ -935,7 +928,7 @@ if ! [[ $print_cmdline ]]; then
rm -fr -- ${initdir}/*
fi
# Verify bash version, current minimum is 4
# Verify bash version, current minimum is 3.1
if (( BASH_VERSINFO[0] < 4 )); then
dfatal 'You need at least Bash 4 to use dracut, sorry.'
exit 1
@@ -944,6 +937,24 @@ fi
dracutfunctions=$dracutbasedir/dracut-functions.sh
export dracutfunctions
case "$(arch)" in
i686|x86_64)
;;
*)
if [[ $early_microcode = yes ]]; then
early_microcode=no
dinfo "Disabling early microcode for $(arch)"
fi
;;
esac
if [[ $early_microcode = yes ]] || ( [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]] ); then
readonly early_cpio_dir="${DRACUT_TMPDIR}/earlycpio"
mkdir "$early_cpio_dir"
fi
if (( ${#drivers_l[@]} )); then
drivers=''
while pop drivers_l val; do
@@ -1015,9 +1026,14 @@ esac
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
if [[ -d $srcmods ]]; then
[[ -f $srcmods/modules.dep ]] || {
dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
}
if ! [[ -f $srcmods/modules.dep ]]; then
if [[ -n "$(find "$srcmods" -name '*.ko*')" ]]; then
dfatal "$srcmods/modules.dep is missing. Did you run depmod?"
exit 1
else
dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
fi
fi
fi
if [[ ! $print_cmdline ]]; then
@@ -1039,78 +1055,6 @@ if [[ ! $print_cmdline ]]; then
dfatal "No permission to write $outfile."
exit 1
fi
if [[ $loginstall ]]; then
if ! mkdir -p "$loginstall"; then
dfatal "Could not create directory to log installed files to '$loginstall'."
exit 1
fi
loginstall=$(readlink -f "$loginstall")
fi
if [[ $uefi = yes ]]; then
if ! command -v objcopy &>/dev/null; then
dfatal "Need 'objcopy' to create a UEFI executable"
exit 1
fi
unset EFI_MACHINE_TYPE_NAME
case $(arch) in
x86_64)
EFI_MACHINE_TYPE_NAME=x64;;
ia32)
EFI_MACHINE_TYPE_NAME=ia32;;
*)
dfatal "Architecture '$(arch)' not supported to create a UEFI executable"
exit 1
;;
esac
if ! [[ -s $uefi_stub ]]; then
for uefi_stub in \
"/lib/systemd/boot/efi/linux${EFI_MACHINE_TYPE_NAME}.efi.stub" \
"/usr/lib/gummiboot/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"; do
[[ -s $uefi_stub ]] || continue
break
done
fi
if ! [[ -s $uefi_stub ]]; then
dfatal "Can't find a uefi stub '$uefi_stub' to create a UEFI executable"
exit 1
fi
if ! [[ $kernel_image ]]; then
for kernel_image in "/lib/modules/$kernel/vmlinuz" "/boot/vmlinuz-$kernel"; do
[[ -s "$kernel_image" ]] || continue
break
done
fi
if ! [[ -s $kernel_image ]]; then
dfatal "Can't find a kernel image '$kernel_image' to create a UEFI executable"
exit 1
fi
fi
fi
if [[ $acpi_override = yes ]] && ! check_kernel_config CONFIG_ACPI_INITRD_TABLE_OVERRIDE; then
dwarn "Disabling ACPI override, because kernel does not support it. CONFIG_ACPI_INITRD_TABLE_OVERRIDE!=y"
unset acpi_override
fi
if [[ $early_microcode = yes ]]; then
if [[ $hostonly ]]; then
[[ $(get_cpu_vendor) == "AMD" ]] \
&& ! check_kernel_config CONFIG_MICROCODE_AMD_EARLY \
&& unset early_microcode
[[ $(get_cpu_vendor) == "Intel" ]] \
&& ! check_kernel_config CONFIG_MICROCODE_INTEL_EARLY \
&& unset early_microcode
else
! check_kernel_config CONFIG_MICROCODE_AMD_EARLY \
&& ! check_kernel_config CONFIG_MICROCODE_INTEL_EARLY \
&& unset early_microcode
fi
[[ $early_microcode != yes ]] \
&& dwarn "Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]_EARLY!=y"
fi
# Need to be able to have non-root users read stuff (rpcbind etc)
@@ -1129,46 +1073,30 @@ declare -A host_fs_types
for line in "${fstab_lines[@]}"; do
set -- $line
dev="$1"
#dev mp fs fsopts
case "$dev" in
UUID=*)
dev=$(blkid -l -t UUID=${dev#UUID=} -o device)
;;
LABEL=*)
dev=$(blkid -l -t LABEL=${dev#LABEL=} -o device)
;;
PARTUUID=*)
dev=$(blkid -l -t PARTUUID=${dev#PARTUUID=} -o device)
;;
PARTLABEL=*)
dev=$(blkid -l -t PARTLABEL=${dev#PARTLABEL=} -o device)
;;
esac
[ -z "$dev" ] && dwarn "Bad fstab entry $@" && continue
push_host_devs "$dev"
host_fs_types["$dev"]="$3"
push host_devs "$1"
host_fs_types["$1"]="$3"
done
for f in $add_fstab; do
[[ -e $f ]] || continue
while read dev rest || [ -n "$dev" ]; do
push_host_devs "$dev"
while read dev rest; do
push host_devs "$dev"
done < "$f"
done
for dev in $add_device; do
push_host_devs "$dev"
push host_devs "$dev"
done
if (( ${#add_device_l[@]} )); then
while pop add_device_l val; do
add_device+=" $val "
push_host_devs "$val"
push host_devs "$val"
done
fi
if [[ $hostonly ]]; then
if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
# in hostonly mode, determine all devices, which have to be accessed
# and examine them for filesystem types
@@ -1193,17 +1121,17 @@ if [[ $hostonly ]]; then
_dev=$(find_block_device "$mp")
_bdev=$(readlink -f "/dev/block/$_dev")
[[ -b $_bdev ]] && _dev=$_bdev
push_host_devs $_dev
push host_devs $_dev
[[ "$mp" == "/" ]] && root_dev="$_dev"
push_host_devs "$_dev"
push host_devs "$_dev"
done
if [[ -f /proc/swaps ]] && [[ -f /etc/fstab ]]; then
while read dev type rest || [ -n "$dev" ]; do
while read dev type rest; do
[[ -b $dev ]] || continue
[[ "$type" == "partition" ]] || continue
while read _d _m _t _o _r || [ -n "$_d" ]; do
while read _d _m _t _o _r; do
[[ "$_d" == \#* ]] && continue
[[ $_d ]] || continue
[[ $_t != "swap" ]] && continue
@@ -1225,17 +1153,33 @@ if [[ $hostonly ]]; then
fi
_dev="$(readlink -f "$dev")"
push_host_devs "$_dev"
push host_devs "$_dev"
push swap_devs "$_dev"
break
done < /etc/fstab
done < /proc/swaps
fi
# collect all "x-initrd.mount" entries from /etc/fstab
if [[ -f /etc/fstab ]]; then
while read _d _m _t _o _r || [ -n "$_d" ]; do
[[ "$_d" == \#* ]] && continue
[[ $_d ]] || continue
[[ "$_o" != *x-initrd.mount* ]] && continue
_dev=$(expand_persistent_dev "$_d")
_dev="$(readlink -f "$_dev")"
[[ -b $_dev ]] && push host_devs "$_dev"
done < /etc/fstab
fi
fi
if [[ $hostonly ]]; then
# record all host modaliases
declare -A host_modalias
find /sys/devices/ -name uevent -print > "$initdir/.modalias"
while read m || [ -n "$m" ]; do
while read line || [ -n "$line" ]; do
while read m; do
while read line; do
[[ "$line" != MODALIAS\=* ]] && continue
modalias="${line##MODALIAS=}" && [[ $modalias ]] && host_modalias["$modalias"]=1
break
@@ -1244,16 +1188,30 @@ if [[ $hostonly ]]; then
rm -f -- "$initdir/.modalias"
while read _k _s _v || [ -n "$_k" ]; do
while read _k _s _v; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
host_modalias["$_v"]=1
done </proc/crypto
# check /proc/modules
declare -A host_modules
while read m rest || [ -n "$m" ]; do
host_modules["$m"]=1
done </proc/modules
declare new_module_found=1
declare tmpmodules=$(mktemp --tmpdir="$TMPDIR/" -t proc_modules.XXXXXX)
while [[ $new_module_found ]]; do
new_module_found=
sleep 0.1
#reading from procfs can be broken, so copy the file elsewhere
cp -f /proc/modules "$tmpmodules"
while read m rest; do
[ -z "$m" ] && continue
[[ ${host_modules["$m"]} ]] && continue
host_modules["$m"]=1
new_module_found=1
done < "$tmpmodules"
done
rm "$tmpmodules"
unset new_module_found
unset tmpmodules
fi
unset m
@@ -1276,7 +1234,7 @@ _get_fs_type() {
return 1
}
for dev in ${host_devs[@]}; do
for dev in "${host_devs[@]}"; do
_get_fs_type "$dev"
check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
done
@@ -1291,12 +1249,18 @@ for dev in "${!host_fs_types[@]}"; do
fi
if [[ $journaldev ]]; then
dev="$(readlink -f "$dev")"
push_host_devs "$dev"
push host_devs "$dev"
_get_fs_type "$dev"
check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
fi
done
# also put the additional filesystems in host_fs_types
# so that the according modules are installed.
for fs in $filesystems; do
host_fs_types[$fs]="$fs"
done
[[ -d $udevdir ]] \
|| udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
if ! [[ -d "$udevdir" ]]; then
@@ -1351,24 +1315,14 @@ for_each_module_dir check_mount
dracut_module_included "fips" && export DRACUT_FIPS_MODE=1
do_print_cmdline()
{
local -A _mods_to_print
for i in $modules_loaded $mods_to_load; do
_mods_to_print[$i]=1
done
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]}
[[ ${_mods_to_print[$_d_mod]} ]] || continue
module_cmdline "$_d_mod"
done
unset moddir
}
if [[ $print_cmdline ]]; then
do_print_cmdline
printf "\n"
exit 0
fi
@@ -1387,7 +1341,7 @@ if [[ $prefix ]]; then
fi
if [[ $kernel_only != yes ]]; then
for d in usr/bin usr/sbin bin etc lib sbin tmp usr var var/tmp $libdirs; do
for d in usr/bin usr/sbin bin etc lib sbin tmp usr var $libdirs; do
[[ -e "${initdir}${prefix}/$d" ]] && continue
if [ -L "/$d" ]; then
inst_symlink "/$d" "${prefix}/$d"
@@ -1434,35 +1388,36 @@ 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]}
[[ "$mods_to_load" == *\ $_d_mod\ * ]] || continue
if [[ $show_modules = yes ]]; then
printf "%s\n" "$_d_mod"
else
dinfo "*** Including module: $_d_mod ***"
fi
if [[ $kernel_only == yes ]]; then
module_installkernel "$_d_mod" || {
dfatal "installkernel failed in module $_d_mod"
exit 1
}
else
module_install "$_d_mod"
if [[ $no_kernel != yes ]]; then
if [[ "$mods_to_load" == *\ $_d_mod\ * ]]; then
if [[ $show_modules = yes ]]; then
printf "%s\n" "$_d_mod"
else
dinfo "*** Including module: $_d_mod ***"
fi
if [[ $kernel_only == yes ]]; then
module_installkernel "$_d_mod" || {
dfatal "installkernel failed in module $_d_mod"
exit 1
}
else
module_install "$_d_mod"
if [[ $no_kernel != yes ]]; then
module_installkernel "$_d_mod" || {
dfatal "installkernel failed in module $_d_mod"
exit 1
}
fi
fi
fi
mods_to_load=${mods_to_load// $_d_mod /}
modules_loaded+="$_d_mod "
mods_to_load=${mods_to_load// $_d_mod /}
modules_loaded+="$_d_mod "
#print the module install size
if [ -n "$printsize" ]; then
_isize_new=$(du -sk ${initdir}|cut -f1)
_isize_delta=$((_isize_new - _isize))
printf "%s\n" "$_d_mod install size: ${_isize_delta}k"
_isize=$_isize_new
#print the module install size
if [ -n "$printsize" ]; then
_isize_new=$(du -sk ${initdir}|cut -f1)
_isize_delta=$((_isize_new - _isize))
printf "%s\n" "$_d_mod install size: ${_isize_delta}k"
_isize=$_isize_new
fi
fi
done
unset moddir
@@ -1476,6 +1431,9 @@ dinfo "*** Including modules done ***"
## final stuff that has to happen
if [[ $no_kernel != yes ]]; then
if [[ $hostonly ]]; then
echo "$(get_loaded_kernel_modules)" > $initdir/lib/dracut/loaded-kernel-modules.txt
fi
if [[ $drivers ]]; then
hostonly='' instmods $drivers
@@ -1540,19 +1498,12 @@ if [[ $kernel_only != yes ]]; then
if [[ $DRACUT_RESOLVE_LAZY ]] && [[ $DRACUT_INSTALL ]]; then
dinfo "*** Resolving executable dependencies ***"
find "$initdir" -type f -perm /0111 -not -path '*.ko' -print0 \
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} --
dinfo "*** Resolving executable dependencies done***"
fi
# libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
for _dir in $libdirs; do
for _f in "$_dir/libpthread.so"*; do
[[ -e "$_f" ]] || continue
inst_libdir_file "libgcc_s.so*"
break 2
done
done
fi
while pop include_src src && pop include_target target; do
@@ -1637,15 +1588,16 @@ if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
# strip kernel modules, but do not touch signed modules
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
| while read -r -d $'\0' f || [ -n "$f" ]; do
| while read -r -d $'\0' f; do
SIG=$(tail -c 28 "$f")
[[ $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 ***"
dinfo "*** Generating early-microcode cpio image contents ***"
ucode_dir=(amd-ucode intel-ucode)
ucode_dest=(AuthenticAMD.bin GenuineIntel.bin)
_dest_dir="$early_cpio_dir/d/kernel/x86/microcode"
@@ -1663,15 +1615,27 @@ if [[ $early_microcode = yes ]]; then
dinfo "*** Constructing ${ucode_dest[$idx]} ****"
if [[ $hostonly ]]; then
_src=$(get_ucode_file)
if ! [[ -r $_fwdir/$_fw/$_src ]];then
break;
fi
[[ $_src ]] || break
[[ -r $_fwdir/$_fw/$_src ]] || break
fi
cat $_fwdir/$_fw/$_src > $_dest_dir/${ucode_dest[$idx]}
for i in $_fwdir/$_fw/$_src; do
[ -e "$i" ] && break
break 2
done
for i in $_fwdir/$_fw/$_src; do
[[ -e "$i" ]] || continue
# skip gpg files
str_ends "$i" ".asc" && continue
cat "$i" >> $_dest_dir/${ucode_dest[$idx]}
done
create_early_cpio="yes"
fi
done
done
if ! [[ $create_early_cpio = yes ]]; then
dinfo "*** No early-microcode cpio image needed ***"
fi
fi
if [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; then
@@ -1680,7 +1644,7 @@ if [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; then
mkdir -p $_dest_dir
for table in $acpi_table_dir/*.aml; do
dinfo " Adding ACPI table: $table"
cp -a $table $_dest_dir
cp $table $_dest_dir
create_early_cpio="yes"
done
fi
@@ -1691,100 +1655,59 @@ if ! ( echo $PARMS_TO_STORE > $initdir/lib/dracut/build-parameter.txt ); then
exit 1
fi
if [[ $hostonly_cmdline ]] ; then
unset _stored_cmdline
if [ -d $initdir/etc/cmdline.d ];then
dinfo "Stored kernel commandline:"
for conf in $initdir/etc/cmdline.d/*.conf ; do
[ -e "$conf" ] || continue
dinfo "$(< $conf)"
_stored_cmdline=1
done
fi
if ! [[ $_stored_cmdline ]]; then
dinfo "No dracut internal kernel commandline stored in initrd"
fi
fi
rm -f -- "$outfile"
dinfo "*** Creating image file '$outfile' ***"
if [[ $uefi = yes ]]; then
uefi_outfile="$outfile"
readonly uefi_outdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initrd.XXXXXX)"
# redirect initrd output
outfile="$uefi_outdir/initrd"
fi
if [[ $DRACUT_REPRODUCIBLE ]]; then
find "$initdir" -newer "$dracutbasedir/dracut-functions.sh" -print0 \
| xargs -r -0 touch -h -m -c -r "$dracutbasedir/dracut-functions.sh"
[[ "$(cpio --help)" == *--reproducible* ]] && CPIO_REPRODUCIBLE=1
fi
dinfo "*** Creating image file ***"
[[ "$UID" != 0 ]] && cpio_owner_root="-R 0:0"
if [[ $create_early_cpio = yes ]]; then
dinfo "*** Creating microcode section ***"
echo 1 > "$early_cpio_dir/d/early_cpio"
if [[ $DRACUT_REPRODUCIBLE ]]; then
find "$early_cpio_dir/d" -newer "$dracutbasedir/dracut-functions.sh" -print0 \
| xargs -r -0 touch -h -m -c -r "$dracutbasedir/dracut-functions.sh"
fi
# The microcode blob is _before_ the initramfs blob, not after
(
cd "$early_cpio_dir/d"
find . -print0 | sort -z \
| cpio ${CPIO_REPRODUCIBLE:+--reproducible} --null $cpio_owner_root -H newc -o --quiet > $outfile
)
if ! (
umask 077
cd "$early_cpio_dir/d"
find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet > "${DRACUT_TMPDIR}/initramfs.img"
); then
dfatal "dracut: creation of $outfile failed"
exit 1
else
dinfo "*** Created microcode section ***"
fi
fi
if ! (
umask 077; cd "$initdir"
find . -print0 | sort -z \
| cpio ${CPIO_REPRODUCIBLE:+--reproducible} --null $cpio_owner_root -H newc -o --quiet \
| $compress >> "$outfile"
umask 077
cd "$initdir"
find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet | \
$compress >> "${DRACUT_TMPDIR}/initramfs.img";
); then
dfatal "dracut: creation of $outfile failed"
exit 1
fi
dinfo "*** Creating initrd image file '$outfile' done ***"
dinfo "*** Creating image file done ***"
if (( maxloglvl >= 5 )); then
if [[ $allowlocal ]]; then
"$dracutbasedir/lsinitrd.sh" "$outfile"| ddebug
"$dracutbasedir/lsinitrd.sh" "${DRACUT_TMPDIR}/initramfs.img" | ddebug
else
lsinitrd "$outfile"| ddebug
lsinitrd "${DRACUT_TMPDIR}/initramfs.img" | ddebug
fi
fi
if [[ $uefi = yes ]]; then
if [[ $kernel_cmdline ]]; then
echo -n "$kernel_cmdline" > "$uefi_outdir/cmdline.txt"
elif [[ $hostonly_cmdline = yes ]] && [ -d $initdir/etc/cmdline.d ];then
for conf in $initdir/etc/cmdline.d/*.conf ; do
[ -e "$conf" ] || continue
printf "%s " "$(< $conf)" >> "$uefi_outdir/cmdline.txt"
done
else
do_print_cmdline > "$uefi_outdir/cmdline.txt"
fi
echo -ne "\x00" >> "$uefi_outdir/cmdline.txt"
if cp --reflink=auto "${DRACUT_TMPDIR}/initramfs.img" "$outfile" |& derror ; then
dinfo "*** Creating initramfs image file '$outfile' done ***"
else
rm -f -- "$outfile"
dfatal "dracut: creation of $outfile failed"
exit 1
fi
dinfo "Using UEFI kernel cmdline:"
dinfo $(< "$uefi_outdir/cmdline.txt")
[[ -s /usr/lib/os-release ]] && uefi_osrelease="/usr/lib/os-release"
[[ -s /etc/os-release ]] && uefi_osrelease="/etc/os-release"
objcopy \
${uefi_osrelease:+--add-section .osrel=$uefi_osrelease --change-section-vma .osrel=0x20000} \
--add-section .cmdline="$uefi_outdir/cmdline.txt" --change-section-vma .cmdline=0x30000 \
--add-section .linux="$kernel_image" --change-section-vma .linux=0x40000 \
--add-section .initrd="$outfile" --change-section-vma .initrd=0x3000000 \
"$uefi_stub" "$uefi_outfile"
dinfo "*** Creating UEFI image file '$uefi_outfile' done ***"
if ! sync "$outfile" 2> /dev/null; then
dinfo "dracut: sync operartion on newly created initramfs $outfile failed"
exit 1
fi
exit 0

View File

@@ -1,5 +1,4 @@
%define dracutlibdir %{_prefix}/lib/dracut
%bcond_without doc
# Variables must be defined
%define with_nbd 1
@@ -29,9 +28,7 @@ URL: https://dracut.wiki.kernel.org/
# Source can be generated by
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.xz
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
BuildRequires: bash git
@@ -48,7 +45,6 @@ BuildRequires: pkgconfig
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%endif
%if %{with doc}
%if 0%{?fedora} || 0%{?rhel}
BuildRequires: docbook-style-xsl docbook-dtds libxslt
%endif
@@ -58,8 +54,6 @@ BuildRequires: docbook-style-xsl docbook-dtds libxslt
%endif
BuildRequires: asciidoc
%endif
%if 0%{?fedora} > 12 || 0%{?rhel}
# no "provides", because dracut does not offer
@@ -97,20 +91,23 @@ Requires: gzip xz
Requires: kmod
Requires: sed
Requires: kpartx
Requires: tar
%if 0%{?fedora} || 0%{?rhel} > 6
Requires: util-linux >= 2.21
Requires: systemd >= 199
Requires: systemd >= 219
Requires: procps-ng
Conflicts: grubby < 8.23
Conflicts: initscripts < 8.63-1
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
Conflicts: bcache-tools < 0-0.14.20130909git
%else
Requires: udev > 166
Requires: util-linux-ng >= 2.21
%endif
%if 0%{?fedora} || 0%{?rhel} > 6
Conflicts: initscripts < 8.63-1
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
%endif
Conflicts: mdadm < 3.2.6-14
%description
@@ -195,14 +192,22 @@ Requires: %{name} = %{version}-%{release}
This package contains tools to assemble the local initrd and host configuration.
%prep
%autosetup -n %{name}-%{version} -S git_am
cp %{SOURCE1} .
%setup -q -n %{name}-%{version}
%if %{defined PATCH1}
git init
git config user.email "dracut-maint@redhat.com"
git config user.name "Fedora dracut team"
git add .
git commit -a -q -m "%{version} baseline."
# Apply all the patches.
git am -p1 %{patches}
git tag %{version}
%endif
%build
%configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib \
%if %{without doc}
--disable-documentation
%endif
%configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib
make %{?_smp_mflags}
@@ -245,16 +250,13 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log
touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
%if 0%{?fedora} || 0%{?rhel}
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse*
%endif
%if 0%{?suse_version}
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf
%endif
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf
%if 0%{?suse_version}
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
%endif
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
@@ -275,17 +277,19 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
> $RPM_BUILD_ROOT/etc/system-fips
%endif
# create compat symlink
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
ln -sr $RPM_BUILD_ROOT%{_bindir}/dracut $RPM_BUILD_ROOT%{_sbindir}/dracut
%clean
rm -rf -- $RPM_BUILD_ROOT
%files
%defattr(-,root,root,0755)
%if %{with doc}
%doc README HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
%endif
%{!?_licensedir:%global license %%doc}
%license COPYING lgpl-2.1.txt
%doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg
%{_bindir}/dracut
# compat symlink
%{_sbindir}/dracut
%{_datadir}/bash-completion/completions/dracut
%{_datadir}/bash-completion/completions/lsinitrd
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
@@ -294,6 +298,7 @@ rm -rf -- $RPM_BUILD_ROOT
%endif
%dir %{dracutlibdir}
%dir %{dracutlibdir}/modules.d
%{dracutlibdir}/dracut-init.sh
%{dracutlibdir}/dracut-functions.sh
%{dracutlibdir}/dracut-functions
%{dracutlibdir}/dracut-version.sh
@@ -308,8 +313,6 @@ rm -rf -- $RPM_BUILD_ROOT
%dir %{_sysconfdir}/dracut.conf.d
%dir %{dracutlibdir}/dracut.conf.d
%{_datadir}/pkgconfig/dracut.pc
%if %{with doc}
%{_mandir}/man8/dracut.8*
%{_mandir}/man8/*service.8*
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
@@ -321,16 +324,12 @@ rm -rf -- $RPM_BUILD_ROOT
%{_mandir}/man7/dracut.modules.7*
%{_mandir}/man7/dracut.bootup.7*
%{_mandir}/man5/dracut.conf.5*
%endif
%if %{defined _unitdir}
%{dracutlibdir}/modules.d/00systemd-bootchart
%else
%{dracutlibdir}/modules.d/00bootchart
%endif
%{dracutlibdir}/modules.d/00bash
%{dracutlibdir}/modules.d/00systemd
%{dracutlibdir}/modules.d/01systemd-initrd
%{dracutlibdir}/modules.d/03modsign
%{dracutlibdir}/modules.d/03rescue
%{dracutlibdir}/modules.d/04watchdog
@@ -341,11 +340,13 @@ 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
%{dracutlibdir}/modules.d/90dmraid
%{dracutlibdir}/modules.d/90dmsquash-live
%{dracutlibdir}/modules.d/90dmsquash-live-ntfs
%{dracutlibdir}/modules.d/90kernel-modules
%{dracutlibdir}/modules.d/90lvm
%{dracutlibdir}/modules.d/90mdraid
@@ -358,10 +359,8 @@ rm -rf -- $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/95rootfs-block
%{dracutlibdir}/modules.d/95dasd
%{dracutlibdir}/modules.d/95dasd_mod
%{dracutlibdir}/modules.d/95dasd_rules
%{dracutlibdir}/modules.d/95fstab-sys
%{dracutlibdir}/modules.d/95zfcp
%{dracutlibdir}/modules.d/95zfcp_rules
%{dracutlibdir}/modules.d/95terminfo
%{dracutlibdir}/modules.d/95udev-rules
%{dracutlibdir}/modules.d/95virtfs
@@ -375,7 +374,7 @@ rm -rf -- $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/98pollcdrom
%{dracutlibdir}/modules.d/98selinux
%{dracutlibdir}/modules.d/98syslog
%{dracutlibdir}/modules.d/98dracut-systemd
%{dracutlibdir}/modules.d/98systemd
%{dracutlibdir}/modules.d/98usrmount
%{dracutlibdir}/modules.d/99base
%{dracutlibdir}/modules.d/99fs-lib
@@ -385,7 +384,7 @@ rm -rf -- $RPM_BUILD_ROOT
%dir %{_sharedstatedir}/initramfs
%if %{defined _unitdir}
%{_unitdir}/dracut-shutdown.service
%{_unitdir}/sysinit.target.wants/dracut-shutdown.service
%{_unitdir}/shutdown.target.wants/dracut-shutdown.service
%{_unitdir}/dracut-cmdline.service
%{_unitdir}/dracut-initqueue.service
%{_unitdir}/dracut-mount.service
@@ -408,9 +407,7 @@ rm -rf -- $RPM_BUILD_ROOT
%files network
%defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/02systemd-networkd
%{dracutlibdir}/modules.d/40network
%{dracutlibdir}/modules.d/90kernel-network-modules
%{dracutlibdir}/modules.d/95fcoe
%{dracutlibdir}/modules.d/95iscsi
%{dracutlibdir}/modules.d/90livenet
@@ -434,6 +431,7 @@ rm -rf -- $RPM_BUILD_ROOT
%files fips-aesni
%defattr(-,root,root,0755)
%doc COPYING
%{dracutlibdir}/modules.d/02fips-aesni
%files caps
@@ -442,11 +440,7 @@ rm -rf -- $RPM_BUILD_ROOT
%files tools
%defattr(-,root,root,0755)
%if %{with doc}
%doc %{_mandir}/man8/dracut-catimages.8*
%endif
%{_mandir}/man8/dracut-catimages.8*
%{_bindir}/dracut-catimages
%dir /boot/dracut
%dir /var/lib/dracut

View File

@@ -37,10 +37,14 @@ the --hostonly or -H option. Using this option, the resulting image will
contain only those dracut modules, kernel modules and filesystems, which are
needed to boot this specific machine. This has the drawback, that you can't put
the disk on another controller or machine, and that you can't switch to another
root filesystem, without recreating the initramfs image. The usage of the
--hostonly option is only for experts and you will have to keep the broken
pieces. At least keep a copy of a general purpose image (and corresponding
kernel) as a fallback to rescue your system.
root filesystem, without recreating the initramfs image.
[NOTE]
===============================
On RHEL-7 the hostonly mode is the default mode. Generic "non-hostonly" images
are created, if the dracut-config-generic rpm is installed. The rescue kernel
entry in the bootloader menu is also a generic image.
===============================
=== Inspecting the Contents
To see the contents of the image created by dracut, you can use the lsinitrd
@@ -99,9 +103,10 @@ raid with encryption and LVM on top), as long as you specify the correct
filesystem LABEL or UUID on the kernel command line for your root device, dracut
will find it and boot from it.
The kernel command line usually can be configured in _/boot/grub/grub.conf_ or
_/boot/grub2/grub.cfg_, if grub is your bootloader and it also can be edited in
the real boot process in the grub menu.
The kernel command line usually can be configured in _/boot/grub2/grub.cfg_
(or _/boot/efi/EFI/redhat/grub.cfg_ for EFI systems), if
grub2 is your bootloader and it also can be edited in the real boot process in
the grub menu.
The kernel command line can also be provided by the dhcp server with the
root-path option. See <<NetworkBoot>>.
@@ -246,6 +251,21 @@ specified multiple times.
If your root partition is on a network drive, you have to have the network
dracut modules installed to create a network aware initramfs image.
On a Red Hat Enterprise Linux or Fedora system, this means, you have to install
the _dracut-network_ rpm package:
----
# yum install dracut-network
----
The resulting initramfs image can be served by a boot manager residing on your
local hard drive or it can be served by a PXE/TFTP server.
How to setup your PXE/TFTP server can be found in the
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/[Red
Hat Enterprise Linux Storage Administration Guide].
If you specify ip=dhcp on the kernel command line, then dracut asks a dhcp
server about the ip adress for the machine. The dhcp server can also serve an
additional root-path, which will set the root device for dracut. With this
@@ -285,7 +305,7 @@ This will reduce the size of the initramfs image significantly.
If the boot process does not succeed, you have several options to debug the
situation. Some of the basic operations are covered here. For more information
you should also visit:
https://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html
http://fedoraproject.org/wiki/How_to_debug_Dracut_problems
[[identifying-your-problem-area]]
@@ -310,7 +330,8 @@ stick and mount that. Then you can store the output for later inspection.
In all cases, the following should be mentioned and attached to your bug report:
* The exact kernel command-line used. Typically from the bootloader
configuration file (e.g. _/etc/grub.conf_) or from _/proc/cmdline_.
configuration file (e.g. _/boot/grub2/grub.cfg_ (or _/boot/efi/EFI/redhat/grub.cfg_ for EFI systems))
or from _/proc/cmdline_.
* A copy of your disk partition information from _/etc/fstab_, which might be
obtained booting an old working initramfs or a rescue medium.
* Turn on dracut debugging (see _the 'debugging dracut' section_), and attach
@@ -344,49 +365,17 @@ Successfully debugging dracut will require some form of console
logging during the system boot. This section documents configuring a
serial console connection to record boot messages.
. First, enable serial console output for both the kernel and the bootloader.
. Open the file _/etc/grub.conf_ for editing. Below the line ''timeout=5'', add
the following:
+
----
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
----
+
. Also in _/etc/grub.conf_, add the following boot arguemnts to the ''kernel''
. In _/boot/grub2/grub.cfg_ (or _/boot/efi/EFI/redhat/grub.cfg_ for EFI systems),
add the following boot arguments to the ''linux16''
line:
+
----
console=tty0 console=ttyS0,9600
----
+
. When finished, the _/etc/grub.conf_ file should look similar to the example
below.
+
----
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title Fedora (2.6.29.5-191.fc11.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 console=ttyS0,9600
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
----
+
. More detailed information on how to configure the kernel for console output
can be found at
http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL.
. Redirecting non-interactive output
+
--
NOTE: You can redirect all non-interactive output to _/dev/kmsg_ and the kernel
will put it out on the console when it reaches the kernel buffer by doing
----
# exec >/dev/kmsg 2>&1 </dev/console
----
--
[[using-the-dracut-shell]]
==== Using the dracut shell
@@ -395,20 +384,18 @@ dracut offers a shell for interactive debugging in the event dracut fails to
locate your root filesystem. To enable the shell:
. Add the boot parameter ''rd.shell'' to your bootloader configuration file
(e.g. _/etc/grub.conf_)
(e.g. _/boot/grub2/grub.cfg_ (or _/boot/efi/EFI/redhat/grub.cfg_ for EFI systems))
. Remove the boot arguments ''rhgb'' and ''quiet''
+
A sample _/etc/grub.conf_ bootloader configuration file is listed below.
A sample _grub.cfg_ bootloader configuration file snippet is listed below.
+
----
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title Fedora (2.6.29.5-191.fc11.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
menuentry 'Red Hat Enterprise Linux Server (3.10.0-308.el7.x86_64) 7.0 (Maipo)' […] {
[…]
linux16 /vmlinuz-3.10.0-308.el7.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
initrd16 /initramfs-3.10.0-308.el7.x86_64.img
[…]
}
----
+
. If system boot fails, you will be dropped into a shell as seen in the example
@@ -513,7 +500,7 @@ on _pre-shutdown_ or _shutdown_.
To do this from an already booted system:
----
# mkdir -p /run/initramfs/etc/cmdline.d
# echo "rd.debug rd.break=pre-shutdown rd.break=shutdown" > /run/initramfs/etc/cmdline.d/debug.conf
# echo "rd.break=pre-shutdown" > /run/initramfs/etc/cmdline.d/debug.conf
# touch /run/initramfs/.need_shutdown
----

View File

@@ -20,8 +20,7 @@ chomp($tag);
my @patches=&create_patches($tag, $pdir);
my $num=$#patches + 2;
$tag=~s/[^0-9]+?([0-9]+)/$1/;
my $release="$num.git$datestr";
$release="1" if $num == 1;
my $release="$num";
while(<>) {
if (/^Version:/) {

View File

@@ -1,3 +1,5 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/* dracut-install.c -- install files and executables
Copyright (C) 2012 Harald Hoyer
@@ -42,7 +44,6 @@
#include "log.h"
#include "hashmap.h"
#include "util.h"
#include "strv.h"
static bool arg_hmac = false;
static bool arg_createdir = false;
@@ -51,11 +52,8 @@ static bool arg_optional = false;
static bool arg_all = false;
static bool arg_resolvelazy = false;
static bool arg_resolvedeps = false;
static bool arg_hostonly = false;
static char *destrootdir = NULL;
static char *logdir = NULL;
static char *logfile = NULL;
FILE *logfile_f = NULL;
static Hashmap *items = NULL;
static Hashmap *items_failed = NULL;
@@ -65,12 +63,12 @@ static size_t dir_len(char const *file)
{
size_t length;
if (!file)
if(!file)
return 0;
/* Strip the basename and any redundant slashes before it. */
for (length = strlen(file) - 1; 0 < length; length--)
if (file[length] == '/' && file[length - 1] != '/')
for (length = strlen(file)-1; 0 < length; length--)
if (file[length] == '/' && file[length-1] != '/')
break;
return length;
}
@@ -103,9 +101,9 @@ static char *convert_abs_rel(const char *from, const char *target)
/* dir_len() skips double /'s e.g. //lib64, so we can't skip just one
* character - need to skip all leading /'s */
rl = strlen(target);
for (i = dirlen + 1; i < rl; ++i)
if (target_dir_p[i] != '/')
break;
for (i = dirlen+1; i < rl; ++i)
if (target_dir_p[i] != '/')
break;
ret = asprintf(&realtarget, "%s/%s", realpath_p, &target_dir_p[i]);
if (ret < 0) {
log_error("Out of memory!");
@@ -222,8 +220,7 @@ static int cp(const char *src, const char *dst)
if (ret == 0) {
struct timeval tv[2];
if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0)
if(fchown(dest_desc, (uid_t) - 1, sb.st_gid) != 0)
log_error("Failed to chown %s: %m", dst);
fchown(dest_desc, (__uid_t)-1, sb.st_gid);
tv[0].tv_sec = sb.st_atime;
tv[0].tv_usec = 0;
tv[1].tv_sec = sb.st_mtime;
@@ -242,16 +239,14 @@ static int cp(const char *src, const char *dst)
normal_copy:
pid = fork();
if (pid == 0) {
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,timestamps", "-fL", src, dst,
NULL);
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,timestamps", "-fL", src, dst, NULL);
_exit(EXIT_FAILURE);
}
while (waitpid(pid, &ret, 0) < 0) {
if (errno != EINTR) {
ret = -1;
log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,timestamps -fL %s %s", src,
dst);
log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,timestamps -fL %s %s", src, dst);
break;
}
}
@@ -291,7 +286,7 @@ static int library_install(const char *src, const char *lib)
libc.so.6 (libc6,64bit, hwcap: 0x0000001000000000, OS ABI: Linux 2.6.32) => /lib64/power6/libc.so.6
libc.so.6 (libc6,64bit, hwcap: 0x0000000000000200, OS ABI: Linux 2.6.32) => /lib64/power6x/libc.so.6
libc.so.6 (libc6,64bit, OS ABI: Linux 2.6.32) => /lib64/libc.so.6
*/
*/
free(p);
p = strdup(lib);
@@ -329,25 +324,18 @@ static int resolve_deps(const char *src)
{
int ret = 0;
_cleanup_free_ char *buf = NULL;
_cleanup_free_ char *buf = malloc(LINE_MAX);
size_t linesize = LINE_MAX;
_cleanup_pclose_ FILE *fptr = NULL;
_cleanup_free_ char *cmd = NULL;
buf = malloc(LINE_MAX);
if (buf == NULL)
return -errno;
if (strstr(src, ".so") == 0) {
_cleanup_close_ int fd = -1;
fd = open(src, O_RDONLY | O_CLOEXEC);
if (fd < 0)
return -errno;
ret = read(fd, buf, LINE_MAX);
if (ret == -1)
return -errno;
read(fd, buf, LINE_MAX);
buf[LINE_MAX - 1] = '\0';
if (buf[0] == '#' && buf[1] == '!') {
/* we have a shebang */
@@ -375,7 +363,7 @@ static int resolve_deps(const char *src)
fptr = popen(cmd, "r");
while (!feof(fptr)) {
char *p;
char *p, *q;
if (getline(&buf, &linesize, fptr) <= 0)
continue;
@@ -384,15 +372,10 @@ static int resolve_deps(const char *src)
if (strstr(buf, "you do not have execution permission")) {
log_error("%s", buf);
ret += 1;
ret+=1;
break;
}
/* musl ldd */
if (strstr(buf, "Not a valid dynamic program"))
break;
/* glibc */
if (strstr(buf, "not a dynamic executable"))
break;
@@ -414,8 +397,6 @@ static int resolve_deps(const char *src)
p = strchr(p, '/');
if (p) {
char *q;
for (q = p; *q && *q != ' ' && *q != '\n'; q++) ;
*q = '\0';
@@ -444,7 +425,7 @@ static int hmac_install(const char *src, const char *dst, const char *hmacpath)
if (endswith(src, ".hmac"))
return 0;
if (!hmacpath) {
if (!hmacpath) {
hmac_install(src, dst, "/lib/fipscheck");
hmac_install(src, dst, "/lib64/fipscheck");
hmac_install(src, dst, "/lib/hmaccalc");
@@ -483,36 +464,6 @@ static int hmac_install(const char *src, const char *dst, const char *hmacpath)
return 0;
}
void mark_hostonly(const char *path)
{
_cleanup_free_ char *fulldstpath = NULL;
_cleanup_fclose_ FILE *f = NULL;
int ret;
ret = asprintf(&fulldstpath, "%s/lib/dracut/hostonly-files", destrootdir);
if (ret < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
f = fopen(fulldstpath, "a");
if (f == NULL) {
log_error("Could not open '%s' for writing.", fulldstpath);
return;
}
fprintf(f, "%s\n", path);
}
void dracut_log_cp(const char *path)
{
int ret;
ret = fprintf(logfile_f, "%s\n", path);
if (ret < 0)
log_error("Could not append '%s' to logfile '%s': %m", path, logfile);
}
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst)
{
struct stat sb, db;
@@ -674,13 +625,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
log_debug("dracut_install ret = %d", ret);
log_info("cp '%s' '%s'", src, fulldstpath);
if (arg_hostonly)
mark_hostonly(dst);
ret += cp(src, fulldstpath);
if (ret == 0 && logfile_f)
dracut_log_cp(src);
log_debug("dracut_install ret = %d", ret);
@@ -694,8 +639,8 @@ static void item_free(char *i)
}
static void usage(int status)
{
/* */
{
/* */
printf("Usage: %s -D DESTROOTDIR [OPTION]... -a SOURCE...\n"
"or: %s -D DESTROOTDIR [OPTION]... SOURCE DEST\n"
"\n"
@@ -706,7 +651,6 @@ static void usage(int status)
" -o --optional If SOURCE does not exist, do not fail\n"
" -d --dir SOURCE is a directory\n"
" -l --ldd Also install shebang executables and libraries\n"
" -L --logdir <DIR> Log files, which were installed from the host to <DIR>\n"
" -R --resolvelazy Only install shebang executables and libraries\n"
" for all SOURCE files\n"
" -H --fips Also install all '.SOURCE.hmac' files\n"
@@ -736,8 +680,8 @@ static void usage(int status)
" |-- libdl.so -> libdl-2.15.90.so\n"
" |-- libdl.so.2 -> libdl-2.15.90.so\n"
" |-- libtinfo.so.5 -> libtinfo.so.5.9\n"
" `-- libtinfo.so.5.9\n", program_invocation_short_name, program_invocation_short_name,
program_invocation_short_name);
" `-- libtinfo.so.5.9\n"
, program_invocation_short_name, program_invocation_short_name, program_invocation_short_name);
exit(status);
}
@@ -759,15 +703,13 @@ static int parse_argv(int argc, char *argv[])
{"ldd", no_argument, NULL, 'l'},
{"resolvelazy", no_argument, NULL, 'R'},
{"optional", no_argument, NULL, 'o'},
{"hostonly", no_argument, NULL, 'H'},
{"all", no_argument, NULL, 'a'},
{"fips", no_argument, NULL, 'f'},
{"fips", no_argument, NULL, 'H'},
{"destrootdir", required_argument, NULL, 'D'},
{"logdir", required_argument, NULL, 'L'},
{NULL, 0, NULL, 0}
};
while ((c = getopt_long(argc, argv, "adfhlL:oD:HR", options, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "adhloD:HR", options, NULL)) != -1) {
switch (c) {
case ARG_VERSION:
puts(PROGRAM_VERSION_STRING);
@@ -796,14 +738,8 @@ static int parse_argv(int argc, char *argv[])
case 'D':
destrootdir = strdup(optarg);
break;
case 'L':
logdir = strdup(optarg);
break;
case 'f':
arg_hmac = true;
break;
case 'H':
arg_hostonly = true;
arg_hmac = true;
break;
case 'h':
usage(EXIT_SUCCESS);
@@ -852,13 +788,13 @@ static int resolve_lazy(int argc, char **argv)
return ret;
}
static char **find_binary(const char *src)
static char *find_binary(const char *src)
{
char *path = NULL;
_cleanup_strv_free_ char **p = NULL;
char **ret = NULL;
char **q;
_cleanup_free_ char *path = NULL;
char *p, *q;
bool end = false;
char *newsrc = NULL;
int ret;
path = getenv("PATH");
@@ -866,21 +802,34 @@ static char **find_binary(const char *src)
log_error("PATH is not set");
exit(EXIT_FAILURE);
}
path = strdup(path);
p = path;
if (path == NULL) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
log_debug("PATH=%s", path);
p = strv_split(path, ":");
STRV_FOREACH(q, p) {
do {
struct stat sb;
int r;
r = asprintf(&newsrc, "%s/%s", *q, src);
if (r < 0) {
for (q = p; *q && *q != ':'; q++) ;
if (*q == '\0')
end = true;
else
*q = '\0';
ret = asprintf(&newsrc, "%s/%s", p, src);
if (ret < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
p = q + 1;
if (stat(newsrc, &sb) != 0) {
log_debug("stat(%s) != 0", newsrc);
free(newsrc);
@@ -888,37 +837,30 @@ static char **find_binary(const char *src)
continue;
}
strv_push(&ret, newsrc);
end = true;
};
} while (!end);
if (ret) {
STRV_FOREACH(q, ret) {
log_debug("find_binary(%s) == %s", src, *q);
}
}
if (newsrc)
log_debug("find_binary(%s) == %s", src, newsrc);
return ret;
return newsrc;
}
static int install_one(const char *src, const char *dst)
{
int r = EXIT_SUCCESS;
int ret = 0;
int ret;
if (strchr(src, '/') == NULL) {
char **p = find_binary(src);
if (p) {
char **q = NULL;
STRV_FOREACH(q, p) {
char *newsrc = *q;
log_debug("dracut_install '%s' '%s'", newsrc, dst);
ret = dracut_install(newsrc, dst, arg_createdir, arg_resolvedeps, true);
if (ret == 0) {
log_debug("dracut_install '%s' '%s' OK", newsrc, dst);
}
char *newsrc = find_binary(src);
if (newsrc) {
log_debug("dracut_install '%s' '%s'", newsrc, dst);
ret = dracut_install(newsrc, dst, arg_createdir, arg_resolvedeps, true);
if (ret == 0) {
log_debug("dracut_install '%s' '%s' OK", newsrc, dst);
}
strv_free(p);
free(newsrc);
} else {
ret = -1;
}
@@ -939,22 +881,17 @@ static int install_all(int argc, char **argv)
int r = EXIT_SUCCESS;
int i;
for (i = 0; i < argc; i++) {
int ret = 0;
int ret;
log_debug("Handle '%s'", argv[i]);
if (strchr(argv[i], '/') == NULL) {
char **p = find_binary(argv[i]);
if (p) {
char **q = NULL;
STRV_FOREACH(q, p) {
char *newsrc = *q;
log_debug("dracut_install '%s'", newsrc);
ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true);
if (ret == 0) {
log_debug("dracut_install '%s' OK", newsrc);
}
_cleanup_free_ char *newsrc = find_binary(argv[i]);
if (newsrc) {
log_debug("dracut_install '%s'", newsrc);
ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true);
if (ret == 0) {
log_debug("dracut_install '%s' OK", newsrc);
}
strv_free(p);
} else {
ret = -1;
}
@@ -1023,23 +960,6 @@ int main(int argc, char **argv)
goto finish;
}
if (logdir) {
int ret;
ret = asprintf(&logfile, "%s/%d.log", logdir, getpid());
if (ret < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
logfile_f = fopen(logfile, "a");
if (logfile_f == NULL) {
log_error("Could not open %s for logging: %m", logfile);
r = EXIT_FAILURE;
goto finish;
}
}
r = EXIT_SUCCESS;
if (((optind + 1) < argc) && (strcmp(argv[optind + 1], destrootdir) == 0)) {
@@ -1068,8 +988,6 @@ int main(int argc, char **argv)
r = EXIT_SUCCESS;
finish:
if (logfile_f)
fclose(logfile_f);
while ((i = hashmap_steal_first(items)))
item_free(i);

View File

@@ -1,3 +1,5 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.

View File

@@ -1,3 +1,5 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#ifndef foohashmaphfoo
#define foohashmaphfoo

View File

@@ -1,3 +1,5 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
@@ -101,10 +103,11 @@ void log_set_facility(int facility) {
static int write_to_console(
int level,
const char*file,
unsigned int line,
int line,
const char *func,
const char *buffer) {
char location[64];
struct iovec iovec[5];
unsigned n = 0;
@@ -116,9 +119,7 @@ static int write_to_console(
IOVEC_SET_STRING(iovec[n++], "dracut-install: ");
if (show_location) {
char location[64];
if (snprintf(location, sizeof(location), "(%s:%u) ", file, line) <= 0)
return -errno;
snprintf(location, sizeof(location), "(%s:%u) ", file, line);
IOVEC_SET_STRING(iovec[n++], location);
}

View File

@@ -1,3 +1,5 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#ifndef foologhfoo
#define foologhfoo

View File

@@ -1,3 +1,5 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#pragma once
/***
@@ -205,7 +207,7 @@ static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) {
for (j = 0; j < n; j++) {
size_t sub;
if (_unlikely_(k == 0))
if (_unlikely_(k <= 0))
break;
sub = MIN(i[j].iov_len, k);

View File

@@ -1,585 +0,0 @@
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <assert.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include "util.h"
#include "strv.h"
char *strv_find(char **l, const char *name) {
char **i;
assert(name);
STRV_FOREACH(i, l)
if (streq(*i, name))
return *i;
return NULL;
}
char *strv_find_prefix(char **l, const char *name) {
char **i;
assert(name);
STRV_FOREACH(i, l)
if (startswith(*i, name))
return *i;
return NULL;
}
void strv_free(char **l) {
char **k;
if (!l)
return;
for (k = l; *k; k++)
free(*k);
free(l);
}
char **strv_copy(char * const *l) {
char **r, **k;
k = r = new(char*, strv_length(l) + 1);
if (!r)
return NULL;
if (l)
for (; *l; k++, l++) {
*k = strdup(*l);
if (!*k) {
strv_free(r);
return NULL;
}
}
*k = NULL;
return r;
}
unsigned int strv_length(char * const *l) {
unsigned n = 0;
if (!l)
return 0;
for (; *l; l++)
n++;
return n;
}
char **strv_new_ap(const char *x, va_list ap) {
const char *s;
char **a;
unsigned n = 0, i = 0;
va_list aq;
/* As a special trick we ignore all listed strings that equal
* (const char*) -1. This is supposed to be used with the
* STRV_IFNOTNULL() macro to include possibly NULL strings in
* the string list. */
if (x) {
n = x == (const char*) -1 ? 0 : 1;
va_copy(aq, ap);
while ((s = va_arg(aq, const char*))) {
if (s == (const char*) -1)
continue;
n++;
}
va_end(aq);
}
a = new(char*, n+1);
if (!a)
return NULL;
if (x) {
if (x != (const char*) -1) {
a[i] = strdup(x);
if (!a[i])
goto fail;
i++;
}
while ((s = va_arg(ap, const char*))) {
if (s == (const char*) -1)
continue;
a[i] = strdup(s);
if (!a[i])
goto fail;
i++;
}
}
a[i] = NULL;
return a;
fail:
strv_free(a);
return NULL;
}
char **strv_new(const char *x, ...) {
char **r;
va_list ap;
va_start(ap, x);
r = strv_new_ap(x, ap);
va_end(ap);
return r;
}
char **strv_merge(char **a, char **b) {
char **r, **k;
if (!a)
return strv_copy(b);
if (!b)
return strv_copy(a);
r = new(char*, strv_length(a) + strv_length(b) + 1);
if (!r)
return NULL;
for (k = r; *a; k++, a++) {
*k = strdup(*a);
if (!*k)
goto fail;
}
for (; *b; k++, b++) {
*k = strdup(*b);
if (!*k)
goto fail;
}
*k = NULL;
return r;
fail:
strv_free(r);
return NULL;
}
char **strv_merge_concat(char **a, char **b, const char *suffix) {
char **r, **k;
/* Like strv_merge(), but appends suffix to all strings in b, before adding */
if (!b)
return strv_copy(a);
r = new(char*, strv_length(a) + strv_length(b) + 1);
if (!r)
return NULL;
k = r;
if (a)
for (; *a; k++, a++) {
*k = strdup(*a);
if (!*k)
goto fail;
}
for (; *b; k++, b++) {
*k = strappend(*b, suffix);
if (!*k)
goto fail;
}
*k = NULL;
return r;
fail:
strv_free(r);
return NULL;
}
char **strv_split(const char *s, const char *separator) {
char *state;
char *w;
size_t l;
unsigned n, i;
char **r;
assert(s);
n = 0;
FOREACH_WORD_SEPARATOR(w, l, s, separator, state)
n++;
r = new(char*, n+1);
if (!r)
return NULL;
i = 0;
FOREACH_WORD_SEPARATOR(w, l, s, separator, state) {
r[i] = strndup(w, l);
if (!r[i]) {
strv_free(r);
return NULL;
}
i++;
}
r[i] = NULL;
return r;
}
char **strv_split_quoted(const char *s) {
char *state;
char *w;
size_t l;
unsigned n, i;
char **r;
assert(s);
n = 0;
FOREACH_WORD_QUOTED(w, l, s, state)
n++;
r = new(char*, n+1);
if (!r)
return NULL;
i = 0;
FOREACH_WORD_QUOTED(w, l, s, state) {
r[i] = cunescape_length(w, l);
if (!r[i]) {
strv_free(r);
return NULL;
}
i++;
}
r[i] = NULL;
return r;
}
char **strv_split_newlines(const char *s) {
char **l;
unsigned int n;
assert(s);
/* Special version of strv_split() that splits on newlines and
* suppresses an empty string at the end */
l = strv_split(s, NEWLINE);
if (!l)
return NULL;
n = strv_length(l);
if (n == 0)
return l;
if (isempty(l[n-1])) {
free(l[n-1]);
l[n-1] = NULL;
}
return l;
}
char *strv_join(char **l, const char *separator) {
char *r, *e;
char **s;
size_t n, k;
if (!separator)
separator = " ";
k = strlen(separator);
n = 0;
STRV_FOREACH(s, l) {
if (n != 0)
n += k;
n += strlen(*s);
}
r = new(char, n+1);
if (!r)
return NULL;
e = r;
STRV_FOREACH(s, l) {
if (e != r)
e = stpcpy(e, separator);
e = stpcpy(e, *s);
}
*e = 0;
return r;
}
char **strv_append(char **l, const char *s) {
char **r, **k;
if (!l)
return strv_new(s, NULL);
if (!s)
return strv_copy(l);
r = new(char*, strv_length(l)+2);
if (!r)
return NULL;
for (k = r; *l; k++, l++) {
*k = strdup(*l);
if (!*k)
goto fail;
}
k[0] = strdup(s);
if (!k[0])
goto fail;
k[1] = NULL;
return r;
fail:
strv_free(r);
return NULL;
}
int strv_push(char ***l, char *value) {
char **c;
unsigned n;
if (!value)
return 0;
n = strv_length(*l);
c = realloc(*l, sizeof(char*) * (n + 2));
if (!c)
return -ENOMEM;
c[n] = value;
c[n+1] = NULL;
*l = c;
return 0;
}
int strv_extend(char ***l, const char *value) {
char *v;
int r;
if (!value)
return 0;
v = strdup(value);
if (!v)
return -ENOMEM;
r = strv_push(l, v);
if (r < 0)
free(v);
return r;
}
char **strv_uniq(char **l) {
char **i;
/* Drops duplicate entries. The first identical string will be
* kept, the others dropped */
STRV_FOREACH(i, l)
strv_remove(i+1, *i);
return l;
}
char **strv_remove(char **l, const char *s) {
char **f, **t;
if (!l)
return NULL;
assert(s);
/* Drops every occurrence of s in the string list, edits
* in-place. */
for (f = t = l; *f; f++) {
if (streq(*f, s)) {
free(*f);
continue;
}
*(t++) = *f;
}
*t = NULL;
return l;
}
char **strv_remove_prefix(char **l, const char *s) {
char **f, **t;
if (!l)
return NULL;
assert(s);
/* Drops every occurrence of a string prefixed with s in the
* string list, edits in-place. */
for (f = t = l; *f; f++) {
if (startswith(*f, s)) {
free(*f);
continue;
}
*(t++) = *f;
}
*t = NULL;
return l;
}
char **strv_parse_nulstr(const char *s, size_t l) {
const char *p;
unsigned c = 0, i = 0;
char **v;
assert(s || l == 0);
if (l == 0)
return new0(char*, 1);
for (p = s; p < s + l; p++)
if (*p == 0)
c++;
if (s[l-1] != 0)
c++;
v = new0(char*, c+1);
if (!v)
return NULL;
p = s;
while (p < s + l) {
const char *e;
e = memchr(p, 0, s + l - p);
v[i] = strndup(p, e ? e - p : s + l - p);
if (!v[i]) {
strv_free(v);
return NULL;
}
i++;
if (!e)
break;
p = e + 1;
}
assert(i == c);
return v;
}
char **strv_split_nulstr(const char *s) {
const char *i;
char **r = NULL;
NULSTR_FOREACH(i, s)
if (strv_extend(&r, i) < 0) {
strv_free(r);
return NULL;
}
if (!r)
return strv_new(NULL, NULL);
return r;
}
bool strv_overlap(char **a, char **b) {
char **i, **j;
STRV_FOREACH(i, a) {
STRV_FOREACH(j, b) {
if (streq(*i, *j))
return true;
}
}
return false;
}
static int str_compare(const void *_a, const void *_b) {
const char **a = (const char**) _a, **b = (const char**) _b;
return strcmp(*a, *b);
}
char **strv_sort(char **l) {
if (strv_isempty(l))
return l;
qsort(l, strv_length(l), sizeof(char*), str_compare);
return l;
}
void strv_print(char **l) {
char **s;
if (!l)
return;
STRV_FOREACH(s, l)
puts(*s);
}

View File

@@ -1,116 +0,0 @@
#pragma once
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdarg.h>
#include <stdbool.h>
#include "util.h"
char *strv_find(char **l, const char *name) _pure_;
char *strv_find_prefix(char **l, const char *name) _pure_;
void strv_free(char **l);
DEFINE_TRIVIAL_CLEANUP_FUNC(char**, strv_free);
#define _cleanup_strv_free_ _cleanup_(strv_freep)
char **strv_copy(char * const *l);
unsigned int strv_length(char * const *l) _pure_;
char **strv_merge(char **a, char **b);
char **strv_merge_concat(char **a, char **b, const char *suffix);
char **strv_append(char **l, const char *s);
int strv_extend(char ***l, const char *value);
int strv_push(char ***l, char *value);
char **strv_remove(char **l, const char *s);
char **strv_remove_prefix(char **l, const char *s);
char **strv_uniq(char **l);
#define strv_contains(l, s) (!!strv_find((l), (s)))
char **strv_new(const char *x, ...) _sentinel_;
char **strv_new_ap(const char *x, va_list ap);
static inline const char* STRV_IFNOTNULL(const char *x) {
return x ? x : (const char *) -1;
}
static inline bool strv_isempty(char * const *l) {
return !l || !*l;
}
char **strv_split(const char *s, const char *separator);
char **strv_split_quoted(const char *s);
char **strv_split_newlines(const char *s);
char *strv_join(char **l, const char *separator);
char **strv_parse_nulstr(const char *s, size_t l);
char **strv_split_nulstr(const char *s);
bool strv_overlap(char **a, char **b) _pure_;
#define STRV_FOREACH(s, l) \
for ((s) = (l); (s) && *(s); (s)++)
#define STRV_FOREACH_BACKWARDS(s, l) \
STRV_FOREACH(s, l) \
; \
for ((s)--; (l) && ((s) >= (l)); (s)--)
#define STRV_FOREACH_PAIR(x, y, l) \
for ((x) = (l), (y) = (x+1); (x) && *(x) && *(y); (x) += 2, (y) = (x + 1))
char **strv_sort(char **l);
void strv_print(char **l);
#define STRV_MAKE(...) ((char**) ((const char*[]) { __VA_ARGS__, NULL }))
#define STRV_MAKE_EMPTY ((char*[1]) { NULL })
#define strv_from_stdarg_alloca(first) \
({ \
char **_l; \
\
if (!first) \
_l = (char**) &first; \
else { \
unsigned _n; \
va_list _ap; \
\
_n = 1; \
va_start(_ap, first); \
while (va_arg(_ap, char*)) \
_n++; \
va_end(_ap); \
\
_l = newa(char*, _n+1); \
_l[_n = 0] = (char*) first; \
va_start(_ap, first); \
for (;;) { \
_l[++_n] = va_arg(_ap, char*); \
if (!_l[_n]) \
break; \
} \
va_end(_ap); \
} \
_l; \
})

View File

@@ -1,3 +1,5 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
@@ -222,7 +224,7 @@ char *strappend(const char *s, const char *suffix) {
char *strjoin(const char *x, ...) {
va_list ap;
size_t l;
char *r;
char *r, *p;
va_start(ap, x);
@@ -255,8 +257,6 @@ char *strjoin(const char *x, ...) {
return NULL;
if (x) {
char *p;
p = stpcpy(r, x);
va_start(ap, x);
@@ -277,238 +277,3 @@ char *strjoin(const char *x, ...) {
return r;
}
char *cunescape_length_with_prefix(const char *s, size_t length, const char *prefix) {
char *r, *t;
const char *f;
size_t pl;
assert(s);
/* Undoes C style string escaping, and optionally prefixes it. */
pl = prefix ? strlen(prefix) : 0;
r = new(char, pl+length+1);
if (!r)
return r;
if (prefix)
memcpy(r, prefix, pl);
for (f = s, t = r + pl; f < s + length; f++) {
if (*f != '\\') {
*(t++) = *f;
continue;
}
f++;
switch (*f) {
case 'a':
*(t++) = '\a';
break;
case 'b':
*(t++) = '\b';
break;
case 'f':
*(t++) = '\f';
break;
case 'n':
*(t++) = '\n';
break;
case 'r':
*(t++) = '\r';
break;
case 't':
*(t++) = '\t';
break;
case 'v':
*(t++) = '\v';
break;
case '\\':
*(t++) = '\\';
break;
case '"':
*(t++) = '"';
break;
case '\'':
*(t++) = '\'';
break;
case 's':
/* This is an extension of the XDG syntax files */
*(t++) = ' ';
break;
case 'x': {
/* hexadecimal encoding */
int a, b;
a = unhexchar(f[1]);
b = unhexchar(f[2]);
if (a < 0 || b < 0) {
/* Invalid escape code, let's take it literal then */
*(t++) = '\\';
*(t++) = 'x';
} else {
*(t++) = (char) ((a << 4) | b);
f += 2;
}
break;
}
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7': {
/* octal encoding */
int a, b, c;
a = unoctchar(f[0]);
b = unoctchar(f[1]);
c = unoctchar(f[2]);
if (a < 0 || b < 0 || c < 0) {
/* Invalid escape code, let's take it literal then */
*(t++) = '\\';
*(t++) = f[0];
} else {
*(t++) = (char) ((a << 6) | (b << 3) | c);
f += 2;
}
break;
}
case 0:
/* premature end of string.*/
*(t++) = '\\';
goto finish;
default:
/* Invalid escape code, let's take it literal then */
*(t++) = '\\';
*(t++) = *f;
break;
}
}
finish:
*t = 0;
return r;
}
char *cunescape_length(const char *s, size_t length) {
return cunescape_length_with_prefix(s, length, NULL);
}
/* Split a string into words, but consider strings enclosed in '' and
* "" as words even if they include spaces. */
char *split_quoted(const char *c, size_t *l, char **state) {
const char *current, *e;
bool escaped = false;
assert(c);
assert(l);
assert(state);
current = *state ? *state : c;
current += strspn(current, WHITESPACE);
if (*current == 0)
return NULL;
else if (*current == '\'') {
current ++;
for (e = current; *e; e++) {
if (escaped)
escaped = false;
else if (*e == '\\')
escaped = true;
else if (*e == '\'')
break;
}
*l = e-current;
*state = (char*) (*e == 0 ? e : e+1);
} else if (*current == '\"') {
current ++;
for (e = current; *e; e++) {
if (escaped)
escaped = false;
else if (*e == '\\')
escaped = true;
else if (*e == '\"')
break;
}
*l = e-current;
*state = (char*) (*e == 0 ? e : e+1);
} else {
for (e = current; *e; e++) {
if (escaped)
escaped = false;
else if (*e == '\\')
escaped = true;
else if (strchr(WHITESPACE, *e))
break;
}
*l = e-current;
*state = (char*) e;
}
return (char*) current;
}
/* Split a string into words. */
char *split(const char *c, size_t *l, const char *separator, char **state) {
char *current;
current = *state ? *state : (char*) c;
if (!*current || *c == 0)
return NULL;
current += strspn(current, separator);
*l = strcspn(current, separator);
*state = current+*l;
return (char*) current;
}
int unhexchar(char c) {
if (c >= '0' && c <= '9')
return c - '0';
if (c >= 'a' && c <= 'f')
return c - 'a' + 10;
if (c >= 'A' && c <= 'F')
return c - 'A' + 10;
return -1;
}
int unoctchar(char c) {
if (c >= '0' && c <= '7')
return c - '0';
return -1;
}

View File

@@ -1,3 +1,5 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#ifndef fooutilhfoo
#define fooutilhfoo
@@ -20,8 +22,6 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#define _GNU_SOURCE
#include <inttypes.h>
#include <time.h>
#include <sys/time.h>
@@ -29,7 +29,6 @@
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <sched.h>
#include <limits.h>
@@ -135,16 +134,8 @@ static inline bool isempty(const char *p) {
return !p || !p[0];
}
static inline const char *startswith(const char *s, const char *prefix) {
if (strncmp(s, prefix, strlen(prefix)) == 0)
return s + strlen(prefix);
return NULL;
}
bool endswith(const char *s, const char *postfix);
bool startswith(const char *s, const char *prefix);
bool startswith_no_case(const char *s, const char *prefix);
bool first_word(const char *s, const char *word);
@@ -571,16 +562,4 @@ void warn_melody(void);
char *strjoin(const char *x, ...) _sentinel_;
#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \
static inline void func##p(type *p) { \
if (*p) \
func(*p); \
} \
struct __useless_struct_to_allow_trailing_semicolon__
char *split_quoted(const char *c, size_t *l, char **state);
char *cunescape_length(const char *s, size_t length);
int unhexchar(char c) _const_;
int unoctchar(char c) _const_;
#endif

View File

@@ -1,4 +1,7 @@
#
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Copyright 2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify

View File

@@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Copyright 2005-2010 Harald Hoyer <harald@redhat.com>
# Copyright 2005-2010 Red Hat, Inc. All rights reserved.
@@ -108,19 +110,13 @@ if ! [[ -f "$image" ]]; then
exit 1
fi
dracutlibdirs() {
for d in lib64/dracut lib/dracut usr/lib64/dracut usr/lib/dracut; do
echo "$d/$1"
done
}
extract_files()
{
(( ${#filenames[@]} == 1 )) && nofileinfo=1
for f in ${!filenames[@]}; do
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 2>/dev/null | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
((ret+=$?))
[[ $nofileinfo ]] || echo "========================================================================"
[[ $nofileinfo ]] || echo
@@ -130,8 +126,7 @@ extract_files()
list_modules()
{
echo "dracut modules:"
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
$(dracutlibdirs modules.txt) 2>/dev/null
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/modules.txt' 'usr/lib/dracut/modules.txt' 2>/dev/null
((ret+=$?))
}
@@ -139,9 +134,9 @@ list_files()
{
echo "========================================================================"
if [ "$sorted" -eq 1 ]; then
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
else
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -k9
fi
((ret+=$?))
echo "========================================================================"
@@ -149,7 +144,7 @@ list_files()
if (( ${#filenames[@]} <= 0 )); then
echo "Image: $image: $(du -h $image | while read a b || [ -n "$a" ]; do echo $a;done)"
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
echo "========================================================================"
fi
@@ -176,38 +171,35 @@ case $bin in
;;
esac
CAT=$({
if [[ $SKIP ]]; then
$SKIP "$image"
if [[ $SKIP ]] ; then
bin="$($SKIP "$image" | { read -N 6 bin && echo "$bin" ; })"
else
read -N 6 bin < "$image"
fi
case $bin in
$'\x1f\x8b'*)
CAT="zcat --"
;;
BZh*)
CAT="bzcat --"
;;
$'\x71\xc7'*|070701)
CAT="cat --"
;;
$'\x02\x21'*)
CAT="lz4 -d -c"
;;
$'\x89'LZO$'\0'*)
CAT="lzop -d -c"
;;
*)
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
CAT="xzcat --single-stream --"
else
cat "$image"
fi } | {
read -N 6 bin
case $bin in
$'\x1f\x8b'*)
echo "zcat --"
;;
BZh*)
echo "bzcat --"
;;
$'\x71\xc7'*|070701)
echo "cat --"
;;
$'\x02\x21'*)
echo "lz4 -d -c"
;;
$'\x89'LZO$'\0'*)
echo "lzop -d -c"
;;
*)
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
echo "xzcat --single-stream --"
else
echo "xzcat --"
fi
;;
esac
})
CAT="xzcat --"
fi
;;
esac
skipcpio()
{
@@ -224,8 +216,7 @@ ret=0
if (( ${#filenames[@]} > 0 )); then
extract_files
else
version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
$(dracutlibdirs 'dracut-*') 2>/dev/null)
version=$($CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/dracut-*' 'usr/lib/dracut/dracut-*' 2>/dev/null)
((ret+=$?))
echo "Version: $version"
echo
@@ -234,8 +225,7 @@ else
echo "========================================================================"
else
echo -n "Arguments: "
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
$(dracutlibdirs build-parameter.txt) 2>/dev/null
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/build-parameter.txt' 'usr/lib/dracut/build-parameter.txt' 2>/dev/null
echo
list_modules
list_files

175
mkinitrd-dracut.sh Executable file → Normal file
View File

@@ -1,11 +1,6 @@
#!/bin/bash --norc
kver=$(uname -r)
boot_dir="/boot"
quiet=0
host_only=0
force=0
error() { echo "$@" >&2; }
usage () {
@@ -29,105 +24,36 @@ read_arg() {
# $1 = arg name
# $2 = arg value
# $3 = arg parameter
param="$1"
local rematch='^[^=]*=(.*)$' result
local rematch='^[^=]*=(.*)$'
if [[ $2 =~ $rematch ]]; then
read "$param" <<< "${BASH_REMATCH[1]}"
else
for ((i=3; $i <= $#; i++)); do
# Only read next arg if it not an arg itself.
if [[ ${@:$i:1} = -* ]];then
break
fi
result="$result ${@:$i:1}"
# There is no way to shift our callers args, so
# return "no of args" to indicate they should do it instead.
done
read "$1" <<< "$result"
return $(($i - 3))
read "$1" <<< "${BASH_REMATCH[1]}"
elif [[ $3 != -* ]]; then
# Only read next arg if it not an arg itself.
read "$1" <<< "$3"
# There is no way to shift our callers args, so
# return 1 to indicate they should do it instead.
return 1
fi
}
# Taken over from SUSE mkinitrd
default_kernel_images() {
local regex kernel_image kernel_version version_version initrd_image
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
case "$(uname -m)" in
s390|s390x)
regex='image'
;;
ppc|ppc64)
regex='vmlinux'
;;
i386|x86_64)
regex='vmlinuz'
;;
arm*)
regex='[uz]Image'
;;
aarch64)
regex='Image'
;;
*) regex='vmlinu.'
;;
esac
# user mode linux
if grep -q UML /proc/cpuinfo; then
regex='linux'
fi
kernel_images=""
initrd_images=""
for kernel_image in $(ls $boot_dir \
| sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
| grep -v kdump$ ) ; do
# Note that we cannot check the RPM database here -- this
# script is itself called from within the binary kernel
# packages, and rpm does not allow recursive calls.
[ -L "$boot_dir/$kernel_image" ] && continue
[ "${kernel_image%%.gz}" != "$kernel_image" ] && continue
kernel_version=$(/usr/bin/get_kernel_version \
$boot_dir/$kernel_image 2> /dev/null)
initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
if [ "$kernel_image" != "$initrd_image" -a \
-n "$kernel_version" -a \
-d "/lib/modules/$kernel_version" ]; then
kernel_images="$kernel_images $boot_dir/$kernel_image"
initrd_images="$initrd_images $boot_dir/$initrd_image"
fi
done
for kernel_image in $kernel_images;do
kernels="$kernels ${kernel_image#*-}"
done
for initrd_image in $initrd_images;do
targets="$targets $initrd_image"
done
host_only=1
force=1
}
while (($# > 0)); do
case ${1%%=*} in
--with-usb) read_arg usbmodule "$@" || shift $?
--with-usb) read_arg usbmodule "$@" || shift
basicmodules="$basicmodules ${usbmodule:-usb-storage}"
unset usbmodule;;
--with-avail) read_arg modname "$@" || shift $?
--with-avail) read_arg modname "$@" || shift
basicmodules="$basicmodules $modname";;
--with) read_arg modname "$@" || shift $?
--with) read_arg modname "$@" || shift
basicmodules="$basicmodules $modname";;
--version)
echo "mkinitrd: dracut compatibility wrapper"
exit 0;;
-v|--verbose) dracut_args="${dracut_args} -v";;
-f|--force) force=1;;
--preload) read_arg modname "$@" || shift $?
-f|--force) dracut_args="${dracut_args} -f";;
--preload) read_arg modname "$@" || shift
basicmodules="$basicmodules $modname";;
--image-version) img_vers=yes;;
--rootfs|-d) read_arg rootfs "$@" || shift $?
--rootfs) read_arg rootfs "$@" || shift
dracut_args="${dracut_args} --filesystems $rootfs";;
--nocompress) dracut_args="$dracut_args --no-compress";;
--help) usage -n;;
@@ -154,31 +80,10 @@ while (($# > 0)); do
--looppath*) ;;
--dsdt*) ;;
--bootchart) ;;
-s) ;;
--quiet|-q) quiet=1;;
-b) read_arg boot_dir "$@" || shift $?
if [ ! -d $boot_dir ];then
error "Boot directory $boot_dir does not exist"
exit 1
fi
;;
-k) # Would be nice to get a list of images here
read_arg kernel_images "$@" || shift $?
for kernel_image in $kernel_images;do
kernels="$kernels ${kernel_image#*-}"
done
host_only=1
force=1
;;
-i) read_arg initrd_images "$@" || shift $?
for initrd_image in $initrd_images;do
targets="$targets $boot_dir/$initrd_image"
done
;;
*) if [[ ! $targets ]]; then
targets=$1
elif [[ ! $kernels ]]; then
kernels=$1
*) if [[ ! $target ]]; then
target=$1
elif [[ ! $kernel ]]; then
kernel=$1
else
usage
fi;;
@@ -186,41 +91,11 @@ while (($# > 0)); do
shift
done
[[ $targets && $kernels ]] || default_kernel_images
[[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage)
[[ $target && $kernel ]] || usage
[[ $img_vers ]] && target="$target-$kernel"
# We can have several targets/kernels, transform the list to an array
targets=( $targets )
[[ $kernels ]] && kernels=( $kernels )
[[ $host_only == 1 ]] && dracut_args="${dracut_args} -H"
[[ $force == 1 ]] && dracut_args="${dracut_args} -f"
echo "Creating: target|kernel|dracut args|basicmodules "
for ((i=0 ; $i<${#targets[@]} ; i++)); do
if [[ $img_vers ]];then
target="${targets[$i]}-${kernels[$i]}"
else
target="${targets[$i]}"
fi
kernel="${kernels[$i]}"
# Duplicate code: No way found how to redirect output based on $quiet
if [[ $quiet == 1 ]];then
echo "$target|$kernel|$dracut_args|$basicmodules"
if [[ $basicmodules ]]; then
dracut $dracut_args --add-drivers "$basicmodules" "$target" \
"$kernel" &>/dev/null
else
dracut $dracut_args "$target" "$kernel" &>/dev/null
fi
else
if [[ $basicmodules ]]; then
dracut $dracut_args --add-drivers "$basicmodules" "$target" \
"$kernel"
else
dracut $dracut_args "$target" "$kernel"
fi
fi
done
if [[ $basicmodules ]]; then
dracut $dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
else
dracut $dracut_args "$target" "$kernel"
fi

View File

@@ -1,105 +0,0 @@
MKINITRD(8)
===========
:doctype: manpage
:man source: dracut
:man manual: dracut
NAME
----
mkinitrd-suse - is a compat wrapper, which calls dracut to generate an initramfs
SYNOPSIS
--------
*mkinitrd* ['OPTION...']
DESCRIPTION
-----------
*mkinitrd* creates an initramfs image <initrd-image> for the kernel with
version <kernel-version> by calling *dracut*.
[IMPORTANT]
This version of mkinitrd is provided for compability with older
versions of mkinitrd. If a more fine grained control over the
resulting image is needed, *dracut* should be called directly.
OPTIONS
-------
**-R, --version**::
print info about the version
**-k** _<kernel_list>_::
List of kernel images for which initrd files are created (relative
to _boot_dir_), defaults to _vmlinux_ on ppc/ppc64, _image_ on s390/s390x
and _vmlinuz_ for everything else.
**-i** _<initrd_list>_::
List of file names (relative to _boot_dir_) for the initrd; positions
have to match the _kernel_list_. Defaults to _initrd_.
**-m** _<module_list>_::
Modules to include in initrd, defaults to _INITRD_MODULES_ variable
in */etc/sysconfig/kernel*.
**-f** _<feature_list>_::
Features to be enabled for the initrd. In general mkinitrd
configures the initrd for the root device it is started from. With
this option additional feature can be enabled.
**-b** _<bootdir>_::
Boot directory, defaults to */boot*, where the initrd is created.
**-d** _<root_device>_::
Root device, defaults to the device from which the root_dir is
mounted; overwrites the rootdev enviroment variable if set
**-s** _<size>_::
Add splash animation and bootscreen to initrd.
**-D** _<interface>::
Run dhcp on the specified interface (for example "eth0").
**-I** _<interface>::
Configure the specified interface statically.
**-a** _<acpi_dsdt>::
Attach compiled ACPI DSDT (Differentiated System Description Table)
to initrd. This replaces the DSDT of the BIOS. Defaults to the
_ACPI_DSDT_ variable in */etc/sysconfig/kernel*.
**-M** _<map>::
System.map file to use.
**-B**::
Dont run the *update-bootloader(8)* script after the initrd(s) have
been created. This is useful if you call mkinitrd(8) for anything
else than the running system.
**-A**::
Create a so called "monster initrd" which includes all available
features and modules. This calls dracut with --no-hostonly and
--no-hostonly-cmdline parameters internally, instead of the default
--hostonly and --hostonly-cmdline.
**-v, --verbose**::
increase verbosity level
**-L**::
Disable logging to _/var/log/YaST2/mkinitrd.log_. This is useful for
testing if you dont want to clutter the system log.
**--help**::
print a help message and exit.
AVAILABILITY
------------
The mkinitrd command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
AUTHORS
-------
Harald Hoyer, Hannes Reinecke
SEE ALSO
--------
*dracut*(8)
*update-bootloader*(8)

View File

@@ -1,348 +0,0 @@
#!/bin/bash --norc
#
# mkinitrd compability wrapper for SUSE.
#
# Copyright (c) 2013 SUSE Linux Products GmbH. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
boot_dir="/boot"
quiet=0
logfile=/var/log/YaST2/mkinitrd.log
dracut_cmd=dracut
error() { echo "$@" >&2; }
usage () {
[[ $1 = '-n' ]] && cmd=echo || cmd=error
$cmd "usage: ${0##*/} [options]"
$cmd ""
$cmd " Create initial ramdisk images that contain all kernel modules needed"
$cmd " in the early boot process, before the root file system becomes"
$cmd " available."
$cmd " This usually includes SCSI and/or RAID modules, a file system module"
$cmd " for the root file system, or a network interface driver module for dhcp."
$cmd ""
$cmd " options:"
$cmd " -f \"feature list\" Features to be enabled when generating initrd."
$cmd " Available features are:"
$cmd " iscsi, md, multipath, lvm, lvm2,"
$cmd " ifup, fcoe, dcbd"
$cmd " -k \"kernel list\" List of kernel images for which initrd files are"
$cmd " created. Defaults to all kernels found in /boot."
$cmd " -i \"initrd list\" List of file names for the initrd; position have"
$cmd " match to \"kernel list\". Defaults to all kernels"
$cmd " found in /boot."
$cmd " -b boot_dir Boot directory. Defaults to /boot."
$cmd " -t tmp_dir Temporary directory. Defaults to /var/tmp."
$cmd " -M map System.map file to use."
$cmd " -A Create a so called \"monster initrd\" which"
$cmd " includes all features and modules possible."
$cmd " -B Do not update bootloader configuration."
$cmd " -v Verbose mode."
$cmd " -L Disable logging."
$cmd " -h This help screen."
$cmd " -m \"module list\" Modules to include in initrd. Defaults to the"
$cmd " INITRD_MODULES variable in /etc/sysconfig/kernel"
$cmd " -u \"DomU module list\" Modules to include in initrd. Defaults to the"
$cmd " DOMU_INITRD_MODULES variable in"
$cmd " /etc/sysconfig/kernel."
$cmd " -d root_device Root device. Defaults to the device from"
$cmd " which / is mounted. Overrides the rootdev"
$cmd " enviroment variable if set."
$cmd " -j device Journal device"
$cmd " -D interface Run dhcp on the specified interface."
$cmd " -I interface Configure the specified interface statically."
$cmd " -a acpi_dsdt Obsolete, do not use."
$cmd " -s size Add splash animation and bootscreen to initrd."
[[ $1 = '-n' ]] && exit 0
exit 1
}
# Little helper function for reading args from the commandline.
# it automatically handles -a b and -a=b variants, and returns 1 if
# we need to shift $3.
read_arg() {
# $1 = arg name
# $2 = arg value
# $3 = arg parameter
param="$1"
local rematch='^[^=]*=(.*)$' result
if [[ $2 =~ $rematch ]]; then
read "$param" <<< "${BASH_REMATCH[1]}"
else
for ((i=3; $i <= $#; i++)); do
# Only read next arg if it not an arg itself.
if [[ ${@:$i:1} = -* ]];then
break
fi
result="$result ${@:$i:1}"
# There is no way to shift our callers args, so
# return "no of args" to indicate they should do it instead.
done
read "$1" <<< "$result"
return $(($i - 3))
fi
}
# Helper functions to calculate ipconfig command line
calc_netmask() {
local prefix=$1
[ -z "$prefix" ] && return
mask=$(echo "(2 ^ 32) - (2 ^ $prefix)" | bc -l)
byte1=$(( mask >> 24 ))
byte2=$(( mask >> 16 ))
byte3=$(( mask >> 8 ))
byte4=$(( mask & 0xff ))
netmask=$(printf "%d.%d.%d.%d" $(( byte1 & 0xff )) $(( byte2 & 0xff )) $(( byte3 & 0xff )) $byte4);
echo $netmask
}
ipconfig() {
local interface=$1
local iplink macaddr broadcast gateway ipaddr prefix netmask
iplink=$(ip addr show dev $interface | sed -n 's/ *inet \(.*\) brd.*/\1/p')
macaddr=$(ip addr show dev $interface | sed -n 's/.*ether \(.*\) brd.*/\1/p')
broadcast=$(ip addr show dev $interface | sed -n 's/.*brd \(.*\) scope.*/\1/p')
gateway=$(ip route show dev $interface | sed -n 's/default via \([0-9\.]*\).*/\1/p')
ipaddr=${iplink%%/*}
prefix=${iplink##*/}
netmask=$(calc_netmask $prefix)
echo "${ipaddr}:${serveraddr}:${gateway}:${netmask}:${hostname}:${interface}:none::${macaddr}"
}
is_xen_kernel() {
local kversion=$1
local root_dir=$2
local cfg
for cfg in ${root_dir}/boot/config-$kversion $root_dir/lib/modules/$kversion/build/.config
do
test -r $cfg || continue
grep -q "^CONFIG_XEN=y\$" $cfg
return
done
test $kversion != "${kversion%-xen*}"
return
}
# Taken over from SUSE mkinitrd
default_kernel_images() {
local regex kernel_image kernel_version version_version initrd_image
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
case "$(uname -m)" in
s390|s390x)
regex='image'
;;
ppc|ppc64)
regex='vmlinux'
;;
i386|x86_64)
regex='vmlinuz'
;;
arm*)
regex='[uz]Image'
;;
aarch64)
regex='Image'
;;
*) regex='vmlinu.'
;;
esac
kernel_images=""
initrd_images=""
for kernel_image in $(ls $boot_dir \
| sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
| grep -v kdump$ ) ; do
# Note that we cannot check the RPM database here -- this
# script is itself called from within the binary kernel
# packages, and rpm does not allow recursive calls.
[ -L "$boot_dir/$kernel_image" ] && continue
[ "${kernel_image%%.gz}" != "$kernel_image" ] && continue
kernel_version=$(/usr/bin/get_kernel_version \
$boot_dir/$kernel_image 2> /dev/null)
initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
if [ "$kernel_image" != "$initrd_image" -a \
-n "$kernel_version" -a \
-d "/lib/modules/$kernel_version" ]; then
kernel_images="$kernel_images $boot_dir/$kernel_image"
initrd_images="$initrd_images $boot_dir/$initrd_image"
fi
done
for kernel_image in $kernel_images;do
kernels="$kernels ${kernel_image#*-}"
done
for initrd_image in $initrd_images;do
targets="$targets $initrd_image"
done
}
while (($# > 0)); do
case ${1%%=*} in
-f) read_arg feature_list "$@" || shift $?
# Could be several features
;;
-k) # Would be nice to get a list of images here
read_arg kernel_images "$@" || shift $?
for kernel_image in $kernel_images;do
kernels="$kernels ${kernel_image#*-}"
done
;;
-i) read_arg initrd_images "$@" || shift $?
for initrd_image in $initrd_images;do
# Check if the initrd_image contains a path.
# if not, then add the default boot_dir
dname=`dirname $initrd_image`
if [ "$dname" == "." ]; then
targets="$targets $boot_dir/$initrd_image";
else
targets="$targets $initrd_image";
fi
done
;;
-b) read_arg boot_dir "$@" || shift $?
if [ ! -d $boot_dir ];then
error "Boot directory $boot_dir does not exist"
exit 1
fi
;;
-t) read_arg tmp_dir "$@" || shift $?
dracut_args="${dracut_args} --tmpdir $tmp_dir"
;;
-M) read_arg map_file "$@" || shift $?
;;
-A) host_only=0;;
-B) skip_update_bootloader=1;;
-v|--verbose) dracut_args="${dracut_args} -v";;
-L) logfile=;;
-h|--help) usage -n;;
-m) read_arg module_list "$@" || shift $? ;;
-u) read_arg domu_module_list "$@" || shift $?
echo "mkinitrd: DomU modules not yet supported" ;;
-d) read_arg rootfs "$@" || shift $?
dracut_args="${dracut_args} --filesystems $rootfs" ;;
-D) read_arg dhcp_if "$@" || shift $?
dracut_cmdline="${dracut_cmdline} ip=${dhcp_if}:dhcp"
;;
-I) read_arg static_if "$@" || shift $?
dracut_cmdline="${dracut_cmdline} ip=$(ipconfig $static_if)":
;;
-a) read_arg acpi_dsdt "$@" || shift $?
echo "Obsolete -a param, use acpi_table_dir= and acpi_override= variables in /etc/dracut.conf.d/"
exit 1
;;
-s) read_arg boot_splash "$@" || shift $?
echo "mkinitrd: boot splash not yet supported"
exit 1
;;
-V) echo "mkinitrd: vendor scipts are no longer supported"
exit 1;;
--dracut)
read_arg dracut_cmd "$@" || shift $? ;;
--version|-R)
echo "mkinitrd: dracut compatibility wrapper"
exit 0;;
--quiet|-q) quiet=1;;
*) if [[ ! $targets ]]; then
targets=$1
elif [[ ! $kernels ]]; then
kernels=$1
else
usage
fi;;
esac
shift
done
[[ $targets && $kernels ]] || default_kernel_images
if [[ ! $targets || ! $kernels ]];then
error "No kernel found in $boot_dir"
fi
# We can have several targets/kernels, transform the list to an array
targets=( $targets )
[[ $kernels ]] && kernels=( $kernels )
[[ $logfile ]] && dracut_args="${dracut_args} --logfile $logfile"
dracut_args="${dracut_args} --force"
[[ $dracut_cmdline ]] && dracut_args="${dracut_args} --kernel-cmdline ${dracut_cmdline}"
[ -z "$(type -p update-bootloader)" ] && skip_update_bootloader=1
# Update defaults from /etc/sysconfig/kernel
if [ -f /etc/sysconfig/kernel ] ; then
. /etc/sysconfig/kernel
fi
[[ $module_list ]] || module_list="${INITRD_MODULES}"
[[ $domu_module_list ]] || domu_module_list="${DOMU_INITRD_MODULES}"
shopt -s extglob
for ((i=0 ; $i<${#targets[@]} ; i++)); do
if [[ $img_vers ]];then
target="${targets[$i]}-${kernels[$i]}"
else
target="${targets[$i]}"
fi
kernel="${kernels[$i]}"
if is_xen_kernel $kernel $rootfs ; then
modules_all="${module_list} ${domu_module_list}"
else
modules_all="${module_list}"
fi
# Remove leading and trailing spaces needs (set above): shopt -s extglob
modules_all=${modules_all%%+([[:space:]])}
modules_all=${modules_all##+([[:space:]])}
echo "Creating initrd: $target"
# Duplicate code: No way found how to redirect output based on $quiet
if [[ $quiet == 1 ]];then
# Duplicate code: --force-drivers must not be called with empty string
# -> dracut bug workarounded ugly, because of complex whitespace
# expansion magics
if [ -n "${modules_all}" ];then
$dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel" &>/dev/null
else
$dracut_cmd $dracut_args "$target" "$kernel" &>/dev/null
fi
else
if [ -n "${modules_all}" ];then
$dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel"
else
$dracut_cmd $dracut_args "$target" "$kernel"
fi
fi
done
if [ "$skip_update_bootloader" ] ; then
echo 2>&1 "Did not refresh the bootloader. You might need to refresh it manually."
else
update-bootloader --refresh
fi

View File

@@ -1,16 +1,15 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
require_binaries /bin/bash
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
# If another shell is already installed, do not use bash
[[ -x $initdir/bin/sh ]] && return

View File

@@ -1,18 +1,17 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
[[ "$mount_needs" ]] && return 1
require_binaries /sbin/bootchartd || return 1
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
inst_symlink /init /sbin/init
inst_dir /lib/bootchart/tmpfs

View File

@@ -1,16 +1,15 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
require_binaries /bin/dash
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
# If another shell is already installed, do not use dash
[[ -x $initdir/bin/sh ]] && return

View File

@@ -1,18 +1,17 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
[[ "$mount_needs" ]] && return 1
require_binaries $systemdutildir/systemd-bootchart || return 1
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
inst_symlink /init /sbin/init
inst_multiple $systemdutildir/systemd-bootchart

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1

View File

@@ -0,0 +1,8 @@
#!/bin/sh
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
else
. /sbin/fips.sh
fips_load_crypto || die "FIPS integrity test failed"
fi

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
mount_boot()
{
@@ -59,8 +61,8 @@ do_rhevh_check()
kpath=${1}
# If we're on RHEV-H, the kernel is in /run/initramfs/live/vmlinuz0
HMAC_SUM_ORIG=$(cat $NEWROOT/boot/.vmlinuz-${KERNEL}.hmac | while read a b || [ -n "$a" ]; do printf "%s\n" $a; done)
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b || [ -n "$a" ]; do printf "%s\n" $a; done || return 1)
HMAC_SUM_ORIG=$(cat $NEWROOT/boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done)
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b; do printf "%s\n" $a; done || return 1)
if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
warn "HMAC sum mismatch"
return 1
@@ -69,6 +71,34 @@ do_rhevh_check()
return 0
}
fips_load_crypto()
{
FIPSMODULES=$(cat /etc/fipsmodules)
info "Loading and integrity checking all crypto modules"
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
for _module in $FIPSMODULES; do
if [ "$_module" != "tcrypt" ]; then
if ! modprobe "${_module}" 2>/tmp/fips.modprobe_err; then
# check if kernel provides generic algo
_found=0
while read _k _s _v; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
[ "$_v" != "$_module" ] && [ "crypto-$_v" != "$_module" ] && continue
_found=1
break
done </proc/crypto
[ "$_found" = "0" ] && cat /tmp/fips.modprobe_err >&2 && 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
}
do_fips()
{
local _v
@@ -78,43 +108,36 @@ do_fips()
KERNEL=$(uname -r)
if ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
warn "/boot/.vmlinuz-${KERNEL}.hmac does not exist"
return 1
fi
FIPSMODULES=$(cat /etc/fipsmodules)
info "Loading and integrity checking all crypto modules"
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 || [ -n "$_k" ]; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
[ "$_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"
if [ -e "/run/initramfs/live/vmlinuz0" ]; then
do_rhevh_check /run/initramfs/live/vmlinuz0 || return 1
elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then
do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
else
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
BOOT_IMAGE="$(getarg BOOT_IMAGE)"
BOOT_IMAGE_NAME="${BOOT_IMAGE##*/}"
BOOT_IMAGE_PATH="${BOOT_IMAGE%${BOOT_IMAGE_NAME}}"
if [ -z "$BOOT_IMAGE_NAME" ]; then
BOOT_IMAGE_NAME="vmlinuz-${KERNEL}"
elif ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE}" ]; then
#if /boot is not a separate partition BOOT_IMAGE might start with /boot
BOOT_IMAGE_PATH=${BOOT_IMAGE_PATH#"/boot"}
#on some achitectures BOOT_IMAGE does not contain path to kernel
#so if we can't find anything, let's treat it in the same way as if it was empty
if ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE_NAME}" ]; then
BOOT_IMAGE_NAME="vmlinuz-${KERNEL}"
BOOT_IMAGE_PATH=""
fi
fi
BOOT_IMAGE_HMAC="/boot/${BOOT_IMAGE_PATH}.${BOOT_IMAGE_NAME}.hmac"
if ! [ -e "${BOOT_IMAGE_HMAC}" ]; then
warn "${BOOT_IMAGE_HMAC} does not exist"
return 1
fi
sha512hmac -c "${BOOT_IMAGE_HMAC}" || return 1
fi
info "All initrd crypto checks done"

View File

@@ -1,40 +1,58 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
installkernel() {
local _fipsmodules _mod
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
_fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg "
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
_fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib"
_fipsmodules+="aes_s390 des_s390 prng sha256_s390 sha_common des_check_key ghash_s390 sha1_s390 sha512_s390"
local _fipsmodules _mod i _bootfstype
if [[ -f "${srcmods}/modules.fips" ]]; then
_fipsmodules="$(cat "${srcmods}/modules.fips")"
else
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
_fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg "
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
_fipsmodules+="aes_s390 des_s390 prng sha256_s390 sha_common des_check_key sha1_s390 sha512_s390 "
_fipsmodules+="sha384 sha512 sha512_generic tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib cmac authenc "
fi
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
for _mod in $_fipsmodules; do
for _mod in $_fipsmodules tcrypt; do
if hostonly='' instmods -c -s $_mod; then
echo $_mod >> "${initdir}/etc/fipsmodules"
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
for i in $(modprobe --resolve-alias $_mod 2>/dev/null); do
[[ $i == $_mod ]] && continue
echo "blacklist $i" >> "${initdir}/etc/modprobe.d/fips.conf"
done
fi
done
# with hostonly_default_device fs module for /boot is not installed by default
if [[ $hostonly ]] && [[ "$hostonly_default_device" == "no" ]]; then
_bootfstype=$(find_mp_fstype /boot)
if [[ -n "$_bootfstype" ]]; then
hostonly='' instmods $_bootfstype
else
dwarning "Can't determine fs type for /boot, FIPS check may fail."
fi
fi
}
# called by dracut
install() {
local _dir
inst_hook pre-trigger 01 "$moddir/fips-boot.sh"
inst_hook pre-mount 01 "$moddir/fips-boot.sh"
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
inst_hook pre-udev 01 "$moddir/fips-load-crypto.sh"
inst_script "$moddir/fips.sh" /sbin/fips.sh
inst_multiple sha512hmac rmmod insmod mount uname umount fipscheck

View File

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

View File

@@ -1,10 +1,12 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
capsmode=$(getarg rd.caps)
if [ "$capsmode" = "1" ]; then
CAPS_INIT_DROP=$(getarg rd.caps.initdrop=)
CAPS_USERMODEHELPER_BSET=$(capsh --drop="$CAPS_INIT_DROP" -- -c 'while read a b || [ -n "$a" ]; do [ "$a" = "CapBnd:" ] && echo $((0x${b:$((${#b}-8)):8})) $((0x${b:$((${#b}-16)):8})) && break; done < /proc/self/status')
CAPS_USERMODEHELPER_BSET=$(capsh --drop="$CAPS_INIT_DROP" -- -c 'while read a b ; do [ "$a" = "CapBnd:" ] && echo $((0x${b:$((${#b}-8)):8})) $((0x${b:$((${#b}-16)):8})) && break; done < /proc/self/status')
CAPS_MODULES_DISABLED=$(getarg rd.caps.disablemodules=)
CAPS_KEXEC_DISABLED=$(getarg rd.caps.disablekexec=)

View File

@@ -1,16 +1,15 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
require_binaries capsh
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
if ! dracut_module_included "systemd"; then
inst_hook pre-pivot 00 "$moddir/caps.sh"

View File

@@ -1,16 +1,15 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
installkernel() {
local _fipsmodules _mod
_fipsmodules="aesni-intel ghash_clmulni_intel"
@@ -25,7 +24,6 @@ installkernel() {
done
}
# called by dracut
install() {
return 0
}

View File

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

View File

@@ -1,4 +1,6 @@
#!/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
#

View File

@@ -1,11 +1,12 @@
#!/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>
# called by dracut
check() {
require_binaries keyctl || return 1
@@ -19,15 +20,13 @@ check() {
return 0
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
inst_dir /lib/modules/keys
inst_binary keyctl
inst_binary /usr/bin/keyctl
inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"

View File

@@ -1,17 +1,16 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
# do not add this module by default
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
inst_multiple -o ps grep more cat rm strace free showmount \
ping netstat rpcinfo vi scp ping6 ssh \

View File

@@ -1,29 +1,78 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
inst_hook cmdline 00 "$moddir/watchdog.sh"
inst_hook cmdline 50 "$moddir/watchdog.sh"
inst_hook pre-trigger 00 "$moddir/watchdog.sh"
inst_hook initqueue 00 "$moddir/watchdog.sh"
inst_hook mount 00 "$moddir/watchdog.sh"
inst_hook mount 50 "$moddir/watchdog.sh"
inst_hook mount 99 "$moddir/watchdog.sh"
inst_hook pre-pivot 00 "$moddir/watchdog.sh"
inst_hook pre-pivot 99 "$moddir/watchdog.sh"
inst_hook cleanup 00 "$moddir/watchdog.sh"
inst_hook cleanup 99 "$moddir/watchdog.sh"
# Do not add watchdog hooks if systemd module is included
# In that case, systemd will manage watchdog kick
if ! dracut_module_included "systemd"; then
inst_hook cmdline 00 "$moddir/watchdog.sh"
inst_hook cmdline 50 "$moddir/watchdog.sh"
inst_hook pre-trigger 00 "$moddir/watchdog.sh"
inst_hook initqueue 00 "$moddir/watchdog.sh"
inst_hook mount 00 "$moddir/watchdog.sh"
inst_hook mount 50 "$moddir/watchdog.sh"
inst_hook mount 99 "$moddir/watchdog.sh"
inst_hook pre-pivot 00 "$moddir/watchdog.sh"
inst_hook pre-pivot 99 "$moddir/watchdog.sh"
inst_hook cleanup 00 "$moddir/watchdog.sh"
inst_hook cleanup 99 "$moddir/watchdog.sh"
fi
inst_hook emergency 02 "$moddir/watchdog-stop.sh"
inst_multiple -o wdctl
}
installkernel() {
local -A _drivers
local _alldrivers _active _wdtdrv _wdtppath _dir
[[ -d /sys/class/watchdog/ ]] || return
for _dir in /sys/class/watchdog/*; do
[[ -d "$_dir" ]] || continue
[[ -f "$_dir/state" ]] || continue
_active=$(< "$_dir/state")
! [[ $hostonly ]] || [[ "$_active" = "active" ]] || continue
# device/modalias will return driver of this device
_wdtdrv=$(< "$_dir/device/modalias")
# There can be more than one module represented by same
# modalias. Currently load all of them.
# TODO: Need to find a way to avoid any unwanted module
# represented by modalias
_wdtdrv=$(modprobe --set-version "$kernel" -R $_wdtdrv 2>/dev/null)
if [[ $_wdtdrv ]]; then
instmods $_wdtdrv
for i in $_wdtdrv; do
_drivers[$i]=1
done
fi
# however in some cases, we also need to check that if there is
# a specific driver for the parent bus/device. In such cases
# we also need to enable driver for parent bus/device.
_wdtppath=$(readlink -f "$_dir/device")
while [[ -d "$_wdtppath" ]] && [[ "$_wdtppath" != "/sys" ]]; do
_wdtppath=$(readlink -f "$_wdtppath/..")
[[ -f "$_wdtppath/modalias" ]] || continue
_wdtdrv=$(< "$_wdtppath/modalias")
_wdtdrv=$(modprobe --set-version "$kernel" -R $_wdtdrv 2>/dev/null)
if [[ $_wdtdrv ]]; then
instmods $_wdtdrv
for i in $_wdtdrv; do
_drivers[$i]=1
done
fi
done
done
# ensure that watchdog module is loaded as early as possible
_alldrivers="${!_drivers[*]}"
[[ $_alldrivers ]] && echo "rd.driver.pre=${_alldrivers// /,}" > ${initdir}/etc/cmdline.d/00-watchdog.conf
return 0
}

View File

@@ -1,2 +1,2 @@
#!/bin/sh
[ -c /dev/watchdog ] && echo -n 'V' > /dev/watchdog
[ -c /dev/watchdog ] && printf 'V' > /dev/watchdog

View File

@@ -1,18 +1,17 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
require_binaries busybox || return 1
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
local _i _progs _path _busybox
_busybox=$(type -P busybox)

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
[ -n "$DRACUT_SYSTEMD" ] && exit 0

View File

@@ -1,6 +1,7 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
[[ "$mount_needs" ]] && return 1
@@ -9,12 +10,10 @@ check() {
return 0
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
if dracut_module_included "systemd"; then
unset FONT
@@ -40,7 +39,7 @@ install() {
*) cmd=grep ;;
esac
for INCL in $($cmd "^include " $MAP | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
for INCL in $($cmd "^include " $MAP | while read a a b; do echo ${a//\"/}; done); do
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
findkeymap $FN
done
@@ -114,12 +113,12 @@ install() {
rm -f -- "${initdir}${kbddir}/consoletrans/utflist"
find "${initdir}${kbddir}/" -name README\* -delete
find "${initdir}${kbddir}/" -name '*.gz' -print -quit \
| while read line || [ -n "$line" ]; do
| while read line; do
inst_multiple gzip
done
find "${initdir}${kbddir}/" -name '*.bz2' -print -quit \
| while read line || [ -n "$line" ]; do
| while read line; do
inst_multiple bzip2
done
}
@@ -153,9 +152,6 @@ install() {
# Gentoo user may have KEYMAP set to something like "-u pl2",
KEYMAP=${KEYMAP#-* }
# openSUSE user may have KEYMAP set to something like ".gz"
KEYMAP=${KEYMAP/.gz/}
# KEYTABLE is a bit special - it defines base keymap name and UNICODE
# determines whether non-UNICODE or UNICODE version is used

View File

@@ -1,30 +1,33 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
inst_key_val() {
local _value
local _file
local _default
_file="$1"; shift
_key="$1"; shift
_default="$1"; shift
_value="$(getarg $@)"
_default=$1
shift
_file=$1
shift
_value=$(getarg $@)
[ -z "${_value}" ] && _value=$_default
if [ -n "${_value}" ]; then
printf '%s="%s"\n' ${_key} ${_value} >> $_file
printf '%s="%s"\n' $2 ${_value} >> $_file
fi
unset _file
unset _value
}
inst_key_val /etc/vconsole.conf KEYMAP '' rd.vconsole.keymap KEYMAP -d KEYTABLE
inst_key_val /etc/vconsole.conf FONT '' rd.vconsole.font FONT -d SYSFONT
inst_key_val /etc/vconsole.conf FONT_MAP '' rd.vconsole.font.map FONT_MAP -d CONTRANS
inst_key_val /etc/vconsole.conf FONT_UNIMAP '' rd.vconsole.font.unimap FONT_UNIMAP -d UNIMAP
inst_key_val /etc/vconsole.conf UNICODE 1 rd.vconsole.font.unicode UNICODE vconsole.unicode
inst_key_val /etc/vconsole.conf EXT_KEYMAP '' rd.vconsole.keymap.ext EXT_KEYMAP
inst_key_val '' /etc/vconsole.conf rd.vconsole.keymap vconsole.keymap KEYMAP -d KEYTABLE
inst_key_val '' /etc/vconsole.conf rd.vconsole.font vconsole.font FONT -d SYSFONT
inst_key_val '' /etc/vconsole.conf rd.vconsole.font.map vconsole.font.map FONT_MAP -d CONTRANS
inst_key_val '' /etc/vconsole.conf rd.vconsole.font.unimap vconsole.font.unimap FONT_UNIMAP -d UNIMAP
inst_key_val 1 /etc/vconsole.conf rd.vconsole.font.unicode vconsole.font.unicode UNICODE vconsole.unicode
inst_key_val '' /etc/vconsole.conf rd.vconsole.keymap.ext vconsole.keymap.ext EXT_KEYMAP
inst_key_val /etc/locale.conf LANG '' rd.locale.LANG LANG
inst_key_val /etc/locale.conf LC_ALL '' rd.locale.LC_ALL LC_ALL
inst_key_val '' /etc/locale.conf rd.locale.LANG locale.LANG LANG
inst_key_val '' /etc/locale.conf rd.locale.LC_ALL locale.LC_ALL LC_ALL
if [ -f /etc/locale.conf ]; then
. /etc/locale.conf

View File

@@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
ROOT="$1"
@@ -74,7 +76,7 @@ rm -f -- "$testfile"
find_mount() {
local dev mnt etc wanted_dev
wanted_dev="$(readlink -e -q $1)"
while read dev mnt etc || [ -n "$dev" ]; do
while read dev mnt etc; do
[ "$dev" = "$wanted_dev" ] && echo "$dev" && return 0
done < /proc/mounts
return 1
@@ -93,7 +95,7 @@ else
return 1
fi
while read a m a || [ -n "$m" ]; do
while read a m a; do
[ "$m" = "$1" ] && return 0
done < /proc/mounts
return 1

View File

@@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if getargbool 0 rd.convertfs; then
if getargbool 0 rd.debug; then

View File

@@ -1,17 +1,16 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
[[ $mount_needs ]] && return 1
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
inst_multiple bash find ldconfig mv rm cp ln
inst_hook pre-pivot 99 "$moddir/do-convertfs.sh"

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
PATH=/usr/sbin:/usr/bin:/sbin:/bin
@@ -8,9 +10,6 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
# We already need a set netif here
netif=$interface
# Huh? Interface configured?
[ -f "/tmp/net.$netif.up" ] && exit 0
setup_interface() {
ip=$new_ip_address
mtu=$new_interface_mtu
@@ -21,7 +20,11 @@ setup_interface() {
search=$(printf -- "$new_domain_search")
namesrv=$new_domain_name_servers
hostname=$new_host_name
lease_time=$new_dhcp_lease_time
[ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
[ -n "$new_max_life" ] && lease_time=$new_max_life
preferred_lft=$lease_time
[ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
[ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
@@ -39,9 +42,9 @@ setup_interface() {
fi
fi
ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} \
valid_lft ${lease_time} preferred_lft ${lease_time} \
dev $netif
ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif \
${lease_time:+valid_lft $lease_time} \
${preferred_lft:+preferred_lft ${preferred_lft}}
if [ -n "$gw" ] ; then
if [ "$mask" == "255.255.255.255" ] ; then
@@ -92,6 +95,51 @@ setup_interface6() {
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
}
function parse_option_121() {
while [ $# -ne 0 ]; do
mask="$1"
shift
# Is the destination a multicast group?
if [ $1 -ge 224 -a $1 -lt 240 ]; then
multicast=1
else
multicast=0
fi
# Parse the arguments into a CIDR net/mask string
if [ $mask -gt 24 ]; then
destination="$1.$2.$3.$4/$mask"
shift; shift; shift; shift
elif [ $mask -gt 16 ]; then
destination="$1.$2.$3.0/$mask"
shift; shift; shift
elif [ $mask -gt 8 ]; then
destination="$1.$2.0.0/$mask"
shift; shift
else
destination="$1.0.0.0/$mask"
shift
fi
# Read the gateway
gateway="$1.$2.$3.$4"
shift; shift; shift; shift
# Multicast routing on Linux
# - If you set a next-hop address for a multicast group, this breaks with Cisco switches
# - If you simply leave it link-local and attach it to an interface, it works fine.
if [ $multicast -eq 1 ]; then
temp_result="$destination dev $interface"
else
temp_result="$destination via $gateway dev $interface"
fi
echo "/sbin/ip route add $temp_result"
done
}
case $reason in
PREINIT)
echo "dhcp: PREINIT $netif up"
@@ -101,7 +149,7 @@ case $reason in
PREINIT6)
echo "dhcp: PREINIT6 $netif up"
linkup $netif
wait_for_ipv6_dad $netif
wait_for_ipv6_dad_link $netif
;;
BOUND)
@@ -111,14 +159,14 @@ case $reason in
read layer2 < /sys/class/net/$netif/device/layer2
fi
if [ "$layer2" != "0" ]; then
if ! arping -q -D -c 2 -I $netif $new_ip_address ; then
if ! arping -f -q -D -c 2 -I $netif $new_ip_address ; then
warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
exit 1
fi
fi
unset layer2
setup_interface
set | while read line || [ -n "$line" ]; do
set | while read line; do
[ "${line#new_}" = "$line" ] && continue
echo "$line"
done >/tmp/dhclient.$netif.dhcpopts
@@ -126,6 +174,9 @@ case $reason in
{
echo '. /lib/net-lib.sh'
echo "setup_net $netif"
if [ -n "$new_classless_static_routes" ]; then
parse_option_121 $new_classless_static_routes
fi
echo "source_hook initqueue/online $netif"
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
@@ -133,13 +184,28 @@ case $reason in
echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
>/tmp/net.$netif.up
if [ -e /sys/class/net/${netif}/address ]; then
> /tmp/net.$(cat /sys/class/net/${netif}/address).up
fi
;;
RENEW|REBIND)
unset lease_time
[ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
[ -n "$new_max_life" ] && lease_time=$new_max_life
preferred_lft=$lease_time
[ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
ip -4 addr change ${new_ip_address}/${new_subnet_mask} broadcast ${new_broadcast_address} dev ${interface} \
${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \
>/dev/null 2>&1
;;
BOUND6)
echo "dhcp: BOND6 setting $netif"
setup_interface6
set | while read line || [ -n "$line" ]; do
set | while read line; do
[ "${line#new_}" = "$line" ] && continue
echo "$line"
done >/tmp/dhclient.$netif.dhcpopts
@@ -154,7 +220,22 @@ case $reason in
echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
>/tmp/net.$netif.up
if [ -e /sys/class/net/${netif}/address ]; then
> /tmp/net.$(cat /sys/class/net/${netif}/address).up
fi
;;
RENEW6|REBIND6)
unset lease_time
[ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
[ -n "$new_max_life" ] && lease_time=$new_max_life
preferred_lft=$lease_time
[ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
ip -6 addr change ${new_ip6_address}/${new_ip6_prefixlen} dev ${interface} scope global \
${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \
>/dev/null 2>&1
;;
*) echo "dhcp: $reason";;
esac

View File

@@ -1,3 +1,6 @@
option classless-static-routes code 121 = array of unsigned integer 8;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
root-path, interface-mtu;
root-path, interface-mtu, classless-static-routes;

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# This script is sourced, so root should be set. But let's be paranoid
[ -z "$root" ] && root=$(getarg root=)

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# if there are no ifname parameters, just use NAME=KERNEL
if ! getarg ifname= >/dev/null ; then

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# We don't need to check for ip= errors here, that is handled by the
# cmdline parser script
@@ -15,75 +17,12 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
# $netif reads easier than $1
netif=$1
use_bridge='false'
use_vlan='false'
# enslave this interface to bond?
for i in /tmp/bond.*.info; do
[ -e "$i" ] || continue
unset bondslaves
unset bondname
. "$i"
for slave in $bondslaves ; do
if [ "$netif" = "$slave" ] ; then
netif=$bondname
break 2
fi
done
done
if [ -e /tmp/team.info ]; then
. /tmp/team.info
for slave in $teamslaves ; do
if [ "$netif" = "$slave" ] ; then
netif=$teammaster
fi
done
fi
if [ -e /tmp/vlan.info ]; then
. /tmp/vlan.info
if [ "$netif" = "$phydevice" ]; then
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
: # We need to really setup bond (recursive call)
elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
: # We need to really setup team (recursive call)
else
netif="$vlanname"
use_vlan='true'
fi
fi
fi
# bridge this interface?
if [ -e /tmp/bridge.info ]; then
. /tmp/bridge.info
for ethname in $bridgeslaves ; do
if [ "$netif" = "$ethname" ]; then
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
: # We need to really setup bond (recursive call)
elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
: # We need to really setup team (recursive call)
elif [ "$netif" = "$vlanname" ] && [ -n "$DO_VLAN_SETUP" ]; then
: # We need to really setup vlan (recursive call)
else
netif="$bridgename"
use_bridge='true'
fi
fi
done
fi
# disable manual ifup while netroot is set for simplifying our logic
# in netroot case we prefer netroot to bringup $netif automaticlly
[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
[ -z "$netroot" ] && [ -z "$manualup" ] && exit 0
if [ -n "$manualup" ]; then
>/tmp/net.$netif.manualup
else
[ -e /tmp/net.${netif}.did-setup ] && exit 0
[ -e /sys/class/net/$netif/address ] && \
[ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0
# loopback is always handled the same way
if [ "$netif" = "lo" ] ; then
ip link set lo up
ip addr add 127.0.0.1/8 dev lo
exit 0
fi
# Run dhclient
@@ -92,15 +31,37 @@ do_dhcp() {
# event for nfsroot
# XXX add -V vendor class and option parsing per kernel
local _COUNT=0
local _timeout=$(getargs rd.net.timeout.dhcp=)
local _DHCPRETRY=$(getargs rd.net.dhcp.retry=)
_DHCPRETRY=${_DHCPRETRY:-1}
[ -e /tmp/dhclient.$netif.pid ] && return 0
if ! iface_has_link $netif; then
echo "No carrier detected"
if ! iface_has_carrier $netif; then
warn "No carrier detected on interface $netif"
return 1
fi
echo "Starting dhcp for interface $netif"
dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif \
|| echo "dhcp failed"
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
ip -4 addr flush dev $netif
while [ $_COUNT -lt $_DHCPRETRY ]; do
info "Starting dhcp for interface $netif"
dhclient "$@" \
${_timeout:+-timeout $_timeout} \
-q \
-cf /etc/dhclient.conf \
-pf /tmp/dhclient.$netif.pid \
-lf /tmp/dhclient.$netif.lease \
$netif \
&& return 0
_COUNT=$(($_COUNT+1))
[ $_COUNT -lt $_DHCPRETRY ] && sleep 1
done
warn "dhcp for interface $netif failed"
return 1
}
load_ipv6() {
@@ -115,31 +76,57 @@ load_ipv6() {
}
do_ipv6auto() {
local ret
load_ipv6
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
linkup $netif
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
wait_for_ipv6_auto $netif
ret=$?
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
return 0
return $ret
}
# Handle static ip configuration
do_static() {
strglobin $ip '*:*:*' && load_ipv6
strstr $ip '*:*:*' && load_ipv6
if [ -z "$dev" ] && ! iface_has_carrier "$netif"; then
warn "No carrier detected on interface $netif"
return 1
elif ! linkup "$netif"; then
warn "Could not bring interface $netif up!"
return 1
fi
ip route get "$ip" | {
read a rest
if [ "$a" = "local" ]; then
warn "Not assigning $ip to interface $netif, cause it is already assigned!"
return 1
fi
return 0
} || return 1
linkup $netif
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
if strglobin $ip '*:*:*'; then
if strstr $ip '*:*:*'; then
# note no ip addr flush for ipv6
ip addr add $ip/$mask ${srv:+peer $srv} dev $netif
wait_for_ipv6_dad $netif
else
ip addr flush dev $netif
if [ -z "$srv" ]; then
if ! arping -f -q -D -c 2 -I $netif $ip; then
warn "Duplicate address detected for $ip for interface $netif."
return 1
fi
fi
ip -4 addr flush dev $netif
ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif
fi
@@ -149,106 +136,6 @@ do_static() {
return 0
}
# loopback is always handled the same way
if [ "$netif" = "lo" ] ; then
ip link set lo up
ip addr add 127.0.0.1/8 dev lo
exit 0
fi
# start bond if needed
if [ -e /tmp/bond.${netif}.info ]; then
. /tmp/bond.${netif}.info
if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.up ] ; then # We are master bond device
modprobe bonding
echo "+$netif" > /sys/class/net/bonding_masters
ip link set $netif down
# Stolen from ifup-eth
# add the bits to setup driver parameters here
for arg in $bondoptions ; do
key=${arg%%=*};
value=${arg##*=};
# %{value:0:1} is replaced with non-bash specific construct
if [ "${key}" = "arp_ip_target" -a "${#value}" != "0" -a "+${value%%+*}" != "+" ]; then
OLDIFS=$IFS;
IFS=',';
for arp_ip in $value; do
echo +$arp_ip > /sys/class/net/${netif}/bonding/$key
done
IFS=$OLDIFS;
else
echo $value > /sys/class/net/${netif}/bonding/$key
fi
done
linkup $netif
for slave in $bondslaves ; do
ip link set $slave down
cat /sys/class/net/$slave/address > /tmp/net.${netif}.${slave}.hwaddr
echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
linkup $slave
done
# add the bits to setup the needed post enslavement parameters
for arg in $BONDING_OPTS ; do
key=${arg%%=*};
value=${arg##*=};
if [ "${key}" = "primary" ]; then
echo $value > /sys/class/net/${netif}/bonding/$key
fi
done
fi
fi
if [ -e /tmp/team.info ]; then
. /tmp/team.info
if [ "$netif" = "$teammaster" ] && [ ! -e /tmp/net.$teammaster.up ] ; then
# We shall only bring up those _can_ come up
# in case of some slave is gone in active-backup mode
working_slaves=""
for slave in $teamslaves ; do
ip link set $slave up 2>/dev/null
if wait_for_if_up $slave; then
working_slaves+="$slave "
fi
done
# Do not add slaves now
teamd -d -U -n -N -t $teammaster -f /etc/teamd/$teammaster.conf
for slave in $working_slaves; do
# team requires the slaves to be down before joining team
ip link set $slave down
teamdctl $teammaster port add $slave
done
ip link set $teammaster up
fi
fi
# XXX need error handling like dhclient-script
if [ -e /tmp/bridge.info ]; then
. /tmp/bridge.info
# start bridge if necessary
if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
brctl addbr $bridgename
brctl setfd $bridgename 0
for ethname in $bridgeslaves ; do
if [ "$ethname" = "$bondname" ] ; then
DO_BOND_SETUP=yes ifup $bondname -m
elif [ "$ethname" = "$teammaster" ] ; then
DO_TEAM_SETUP=yes ifup $teammaster -m
elif [ "$ethname" = "$vlanname" ]; then
DO_VLAN_SETUP=yes ifup $vlanname -m
else
linkup $ethname
fi
brctl addif $bridgename $ethname
done
fi
fi
get_vid() {
case "$1" in
vlan*)
@@ -260,33 +147,214 @@ get_vid() {
esac
}
if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
modprobe 8021q
if [ "$phydevice" = "$bondname" ] ; then
DO_BOND_SETUP=yes ifup $phydevice -m
elif [ "$phydevice" = "$teammaster" ] ; then
DO_TEAM_SETUP=yes ifup $phydevice -m
else
linkup "$phydevice"
fi
ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname)"
ip link set "$vlanname" up
# check, if we need VLAN's for this interface
if [ -z "$DO_VLAN_PHY" ] && [ -e /tmp/vlan.${netif}.phy ]; then
unset DO_VLAN
NO_AUTO_DHCP=yes DO_VLAN_PHY=yes ifup "$netif"
modprobe -b -q 8021q
for i in /tmp/vlan.*.${netif}; do
[ -e "$i" ] || continue
read vlanname < "$i"
if [ -n "$vlanname" ]; then
linkup "$netif"
ip link add dev "$vlanname" link "$netif" type vlan id "$(get_vid $vlanname)"
ifup "$vlanname"
fi
done
exit 0
fi
# Check, if interface is VLAN interface
if ! [ -e /tmp/vlan.${netif}.phy ]; then
for i in /tmp/vlan.${netif}.*; do
[ -e "$i" ] || continue
export DO_VLAN=yes
break
done
fi
# bridge this interface?
if [ -z "$NO_BRIDGE_MASTER" ]; then
for i in /tmp/bridge.*.info; do
[ -e "$i" ] || continue
unset bridgeslaves
unset bridgename
. "$i"
for ethname in $bridgeslaves ; do
[ "$netif" != "$ethname" ] && continue
NO_BRIDGE_MASTER=yes NO_AUTO_DHCP=yes ifup $ethname
linkup $ethname
if [ ! -e /tmp/bridge.$bridgename.up ]; then
brctl addbr $bridgename
brctl setfd $bridgename 0
> /tmp/bridge.$bridgename.up
fi
brctl addif $bridgename $ethname
ifup $bridgename
exit 0
done
done
fi
# enslave this interface to bond?
if [ -z "$NO_BOND_MASTER" ]; then
for i in /tmp/bond.*.info; do
[ -e "$i" ] || continue
unset bondslaves
unset bondname
. "$i"
for slave in $bondslaves ; do
[ "$netif" != "$slave" ] && continue
# already setup
[ -e /tmp/bond.$bondname.up ] && exit 0
# wait for all slaves to show up
for slave in $bondslaves ; do
# try to create the slave (maybe vlan or bridge)
NO_BOND_MASTER=yes NO_AUTO_DHCP=yes ifup $slave
if ! ip link show dev $slave >/dev/null 2>&1; then
# wait for the last slave to show up
exit 0
fi
done
modprobe -q -b bonding
echo "+$bondname" > /sys/class/net/bonding_masters 2>/dev/null
ip link set $bondname down
# Stolen from ifup-eth
# add the bits to setup driver parameters here
for arg in $bondoptions ; do
key=${arg%%=*};
value=${arg##*=};
# %{value:0:1} is replaced with non-bash specific construct
if [ "${key}" = "arp_ip_target" -a "${#value}" != "0" -a "+${value%%+*}" != "+" ]; then
OLDIFS=$IFS;
IFS=',';
for arp_ip in $value; do
echo +$arp_ip > /sys/class/net/${bondname}/bonding/$key
done
IFS=$OLDIFS;
else
echo $value > /sys/class/net/${bondname}/bonding/$key
fi
done
linkup $bondname
for slave in $bondslaves ; do
cat /sys/class/net/$slave/address > /tmp/net.${bondname}.${slave}.hwaddr
ip link set $slave down
echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
linkup $slave
done
# Set mtu on bond master
[ -n "$bondmtu" ] && ip link set mtu $bondmtu dev $bondname
# add the bits to setup the needed post enslavement parameters
for arg in $bondoptions ; do
key=${arg%%=*};
value=${arg##*=};
if [ "${key}" = "primary" ]; then
echo $value > /sys/class/net/${bondname}/bonding/$key
fi
done
> /tmp/bond.$bondname.up
NO_BOND_MASTER=yes ifup $bondname
exit $?
done
done
fi
if [ -z "$NO_TEAM_MASTER" ]; then
for i in /tmp/team.*.info; do
[ -e "$i" ] || continue
unset teammaster
unset teamslaves
. "$i"
for slave in $teamslaves ; do
[ "$netif" != "$slave" ] && continue
[ -e /tmp/team.$teammaster.up ] && exit 0
# wait for all slaves to show up
for slave in $teamslaves ; do
# try to create the slave (maybe vlan or bridge)
NO_TEAM_MASTER=yes NO_AUTO_DHCP=yes ifup $slave
if ! ip link show dev $slave >/dev/null 2>&1; then
# wait for the last slave to show up
exit 0
fi
done
if [ ! -e /tmp/team.$teammaster.up ] ; then
# We shall only bring up those _can_ come up
# in case of some slave is gone in active-backup mode
working_slaves=""
for slave in $teamslaves ; do
ip link set $slave up 2>/dev/null
if wait_for_if_up $slave; then
working_slaves="$working_slaves$slave "
fi
done
# Do not add slaves now
teamd -d -U -n -N -t $teammaster -f /etc/teamd/$teammaster.conf
for slave in $working_slaves; do
# team requires the slaves to be down before joining team
ip link set $slave down
teamdctl $teammaster port add $slave
done
ip link set $teammaster up
> /tmp/team.$teammaster.up
NO_TEAM_MASTER=yes ifup $teammaster
exit $?
fi
done
done
fi
# all synthetic interfaces done.. now check if the interface is available
if ! ip link show dev $netif >/dev/null 2>&1; then
exit 1
fi
# disable manual ifup while netroot is set for simplifying our logic
# in netroot case we prefer netroot to bringup $netif automaticlly
[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
if [ -n "$manualup" ]; then
>/tmp/net.$netif.manualup
rm -f /tmp/net.${netif}.did-setup
else
[ -e /tmp/net.${netif}.did-setup ] && exit 0
[ -z "$DO_VLAN" ] && \
[ -e /sys/class/net/$netif/address ] && \
[ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0
fi
# No ip lines default to dhcp
ip=$(getarg ip)
if [ -z "$ip" ]; then
namesrv=$(getargs nameserver)
for s in $namesrv; do
echo nameserver $s >> /tmp/net.$netif.resolv.conf
done
if [ -z "$NO_AUTO_DHCP" ] && [ -z "$ip" ]; then
if [ "$netroot" = "dhcp6" ]; then
do_dhcp -6
else
do_dhcp -4
fi
for s in $(getargs nameserver); do
[ -n "$s" ] || continue
echo nameserver $s >> /tmp/net.$netif.resolv.conf
done
fi
@@ -309,18 +377,15 @@ for p in $(getargs ip=); do
esac
# If this option isn't directed at our interface, skip it
[ -n "$dev" ] && [ "$dev" != "$netif" ] && \
[ "$use_bridge" != 'true' ] && \
[ "$use_vlan" != 'true' ] && continue
# setup nameserver
namesrv="$dns1 $dns2 $(getargs nameserver)"
for s in $namesrv; do
echo nameserver $s >> /tmp/net.$netif.resolv.conf
done
if [ -n "$dev" ]; then
[ "$dev" != "$netif" ] && \
[ "$use_bridge" != 'true' ] && \
[ "$use_vlan" != 'true' ] && continue
else
iface_is_enslaved "$netif" && continue
fi
# Store config for later use
for i in ip srv gw mask hostname macaddr dns1 dns2; do
for i in ip srv gw mask hostname macaddr mtu dns1 dns2; do
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
done > /tmp/net.$netif.override
@@ -333,28 +398,42 @@ for p in $(getargs ip=); do
do_dhcp -6 ;;
auto6)
do_ipv6auto ;;
either6)
do_ipv6auto || do_dhcp -6 ;;
*)
do_static ;;
esac
done
ret=$?
> /tmp/net.${netif}.up
# setup nameserver
for s in "$dns1" "$dns2" $(getargs nameserver); do
[ -n "$s" ] || continue
echo nameserver $s >> /tmp/net.$netif.resolv.conf
done
case $autoconf in
dhcp|on|any|dhcp6)
if [ $ret -eq 0 ]; then
> /tmp/net.${netif}.up
if [ -z "$DO_VLAN" ] && [ -e /sys/class/net/${netif}/address ]; then
> /tmp/net.$(cat /sys/class/net/${netif}/address).up
fi
case $autoconf in
dhcp|on|any|dhcp6)
;;
*)
if [ $? -eq 0 ]; then
setup_net $netif
source_hook initqueue/online $netif
if [ -z "$manualup" ]; then
/sbin/netroot $netif
*)
if [ $ret -eq 0 ]; then
setup_net $netif
source_hook initqueue/online $netif
if [ -z "$manualup" ]; then
/sbin/netroot $netif
fi
fi
fi
;;
esac
exit 0
;;
esac
exit $ret
fi
done
# netif isn't the top stack? Then we should exit here.
@@ -365,12 +444,21 @@ if [ -n "$DO_BOND_SETUP" -o -n "$DO_TEAM_SETUP" -o -n "$DO_VLAN_SETUP" ]; then
fi
# no ip option directed at our interface?
if [ ! -e /tmp/net.${netif}.up ]; then
if getargs 'ip=dhcp6'; then
load_ipv6
do_dhcp -6
if [ -z "$NO_AUTO_DHCP" ] && [ ! -e /tmp/net.${netif}.up ]; then
if [ -e /tmp/net.bootdev ]; then
BOOTDEV=$(cat /tmp/net.bootdev)
if [ "$netif" = "$BOOTDEV" ] || [ "$BOOTDEV" = "$(cat /sys/class/net/${netif}/address)" ]; then
load_ipv6
do_dhcp
fi
else
do_dhcp -4
if getargs 'ip=dhcp6'; then
load_ipv6
do_dhcp -6
fi
if getargs 'ip=dhcp'; then
do_dhcp -4
fi
fi
fi

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
for f in /tmp/dhclient.*.pid; do
[ -e $f ] || continue

View File

@@ -1,6 +1,7 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
local _program
@@ -9,21 +10,66 @@ check() {
return 255
}
# called by dracut
depends() {
echo "kernel-network-modules"
return 0
}
# called by dracut
installkernel() {
return 0
# Include wired net drivers, excluding wireless
net_module_filter() {
local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open'
local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'
local _ret
# subfunctions inherit following FDs
local _merge=8 _side2=9
function nmf1() {
local _fname _fcont
while read _fname; do
[[ $_fname =~ $_unwanted_drivers ]] && continue
case "$_fname" in
*.ko) _fcont="$(< $_fname)" ;;
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
*.ko.xz) _fcont="$(xz -dc $_fname)" ;;
esac
[[ $_fcont =~ $_net_drivers
&& ! $_fcont =~ iw_handler_get_spy ]] \
&& echo "$_fname"
done
return 0
}
function rotor() {
local _f1 _f2
while read _f1; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}
fi
done | nmf1 1>&${_merge}
return 0
}
# Use two parallel streams to filter alternating modules.
set +x
eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
[[ $debug ]] && set -x
return 0
}
{ find_kernel_modules_by_path drivers/net; if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then find_kernel_modules_by_path drivers/s390/net; fi; } \
| net_module_filter | instmods
#instmods() will take care of hostonly
instmods \
=drivers/net/phy \
=drivers/net/team \
=drivers/net/ethernet \
ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net
hostonly="" instmods iscsi_ibft crc32c iscsi_boot_sysfs
}
# called by dracut
install() {
local _arch _i _dir
inst_multiple ip arping dhclient sed
inst_multiple ip arping dhclient sed awk
inst_multiple -o ping ping6
inst_multiple -o brctl
inst_multiple -o teamd teamdctl teamnl
@@ -32,8 +78,7 @@ install() {
inst_script "$moddir/netroot.sh" "/sbin/netroot"
inst_script "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
inst_simple "$moddir/net-lib.sh" "/lib/net-lib.sh"
inst_simple -H "/etc/dhclient.conf"
cat "$moddir/dhclient.conf" >> "${initdir}/etc/dhclient.conf"
inst_simple "$moddir/dhclient.conf" "/etc/dhclient.conf"
inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
@@ -46,6 +91,46 @@ install() {
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
inst_hook cleanup 10 "$moddir/kill-dhclient.sh"
# Special network nameing for idrac USB devs
inst_rules 73-idrac.rules
# install all config files for teaming
unset TEAM_MASTER
unset TEAM_CONFIG
unset TEAM_PORT_CONFIG
unset HWADDR
unset SUBCHANNELS
for i in /etc/sysconfig/network-scripts/ifcfg-*; do
[ -e "$i" ] || continue
case "$i" in
*~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
continue
;;
esac
(
. "$i"
if ! [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] \
&& [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
if [ -n "$TEAM_CONFIG" ] && [ -n "$DEVICE" ]; then
mkdir -p $initdir/etc/teamd
printf -- "%s" "$TEAM_CONFIG" > "$initdir/etc/teamd/${DEVICE}.conf"
elif [ -n "$TEAM_PORT_CONFIG" ]; then
inst_simple "$i"
HWADDR="$(echo $HWADDR | sed 'y/ABCDEF/abcdef/')"
if [ -n "$HWADDR" ]; then
ln_r "$i" "/etc/sysconfig/network-scripts/mac-${HWADDR}.conf"
fi
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
if [ -n "$SUBCHANNELS" ]; then
ln_r "$i" "/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf"
fi
fi
fi
)
done
_arch=$(uname -m)
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \

View File

@@ -12,11 +12,14 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
# Write udev rules
{
# bridge: attempt only the defined interface
if [ -e /tmp/bridge.info ]; then
. /tmp/bridge.info
IFACES="$IFACES ${bridgeslaves%% *}"
for i in /tmp/bridge.*.info; do
[ -e "$i" ] || continue
unset bridgeslaves
unset bridgename
. "$i"
RAW_IFACES="$RAW_IFACES $bridgeslaves"
MASTER_IFACES="$MASTER_IFACES $bridgename"
fi
done
# bond: attempt only the defined interface (override bridge defines)
for i in /tmp/bond.*.info; do
@@ -25,21 +28,34 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
unset bondname
. "$i"
# It is enough to fire up only one
IFACES="$IFACES ${bondslaves%% *}"
RAW_IFACES="$RAW_IFACES $bondslaves"
MASTER_IFACES="$MASTER_IFACES ${bondname}"
done
if [ -e /tmp/team.info ]; then
. /tmp/team.info
IFACES="$IFACES ${teamslaves}"
for i in /tmp/team.*.info; do
[ -e "$i" ] || continue
unset teamslaves
unset teammaster
. "$i"
RAW_IFACES="$RAW_IFACES ${teamslaves}"
MASTER_IFACES="$MASTER_IFACES ${teammaster}"
fi
done
if [ -e /tmp/vlan.info ]; then
. /tmp/vlan.info
IFACES="$IFACES $phydevice"
MASTER_IFACES="$MASTER_IFACES ${vlanname}"
fi
for j in /tmp/vlan.*.phy; do
[ -e "$j" ] || continue
unset phydevice
read phydevice < "$j"
RAW_IFACES="$RAW_IFACES $phydevice"
for i in /tmp/vlan.*.${phydevice}; do
[ -e "$i" ] || continue
unset vlanname
read vlanname < "$i"
MASTER_IFACES="$MASTER_IFACES ${vlanname}"
done
done
MASTER_IFACES="$(trim "$MASTER_IFACES")"
RAW_IFACES="$(trim "$RAW_IFACES")"
if [ -z "$IFACES" ]; then
[ -e /tmp/net.ifaces ] && read IFACES < /tmp/net.ifaces
@@ -50,15 +66,14 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
fi
ifup='/sbin/ifup $env{INTERFACE}'
[ -z "$netroot" ] && ifup="$ifup -m"
runcmd="RUN+=\"/sbin/initqueue --name ifup-\$env{INTERFACE} --unique --onetime $ifup\""
# We have some specific interfaces to handle
if [ -n "$IFACES" ]; then
if [ -n "${RAW_IFACES}${IFACES}" ]; then
echo 'SUBSYSTEM!="net", GOTO="net_end"'
echo 'ACTION!="add|change|move", GOTO="net_end"'
for iface in $IFACES; do
for iface in $IFACES $RAW_IFACES; do
case "$iface" in
??:??:??:??:??:??) # MAC address
cond="ATTR{address}==\"$iface\""
@@ -79,13 +94,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
done
echo 'LABEL="net_end"'
if [ -n "$MASTER_IFACES" ]; then
wait_ifaces=$MASTER_IFACES
else
wait_ifaces=$IFACES
fi
for iface in $wait_ifaces; do
for iface in $IFACES; do
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
echo "[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh
fi
@@ -93,7 +102,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
# Default: We don't know the interface to use, handle all
# Fixme: waiting for the interface as well.
else
cond='ACTION=="add", SUBSYSTEM=="net"'
cond='ACTION=="add", SUBSYSTEM=="net", ENV{DEVTYPE}!="wlan|wwan"'
# if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh
echo "$cond, $runcmd" > /etc/udev/rules.d/91-default-net.rules
fi

View File

@@ -1,4 +1,18 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
is_ip() {
echo "$1" | {
IFS=. read a b c d
test "$a" -ge 0 -a "$a" -le 255 \
-a "$b" -ge 0 -a "$b" -le 255 \
-a "$c" -ge 0 -a "$c" -le 255 \
-a "$d" -ge 0 -a "$d" -le 255 \
2> /dev/null
} && return 0
return 1
}
get_ip() {
local iface="$1" ip=""
@@ -60,6 +74,14 @@ all_ifaces_up() {
done
}
all_ifaces_setup() {
local iface="" IFACES=""
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
for iface in $IFACES; do
[ -e /tmp/net.$iface.did-setup ] || return 1
done
}
get_netroot_ip() {
local prefix="" server="" rest=""
splitsep "$1" ":" prefix server rest
@@ -80,7 +102,8 @@ ifdown() {
ip addr flush dev $netif
echo "#empty" > /etc/resolv.conf
rm -f -- /tmp/net.$netif.did-setup
[ -e /sys/class/net/$netif/address ] && \
[ -z "$DO_VLAN" ] && \
[ -e /sys/class/net/$netif/address ] && \
rm -f -- /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
# TODO: send "offline" uevent?
}
@@ -89,7 +112,8 @@ setup_net() {
local netif="$1" f="" gw_ip="" netroot_ip="" iface="" IFACES=""
local _p
[ -e /tmp/net.$netif.did-setup ] && return
[ -e /sys/class/net/$netif/address ] && \
[ -z "$DO_VLAN" ] && \
[ -e /sys/class/net/$netif/address ] && \
[ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && return
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
[ -z "$IFACES" ] && IFACES="$netif"
@@ -99,7 +123,7 @@ setup_net() {
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
# set up resolv.conf
[ -e /tmp/net.$netif.resolv.conf ] && \
cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf
awk '!array[$0]++' /tmp/net.$netif.resolv.conf > /etc/resolv.conf
[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
# add static route
@@ -107,7 +131,7 @@ setup_net() {
route_to_var "$_p" || continue
[ -n "$route_dev" ] && [ "$route_dev" != "$netif" ] && continue
ip route add "$route_mask" ${route_gw:+via "$route_gw"} ${route_dev:+dev "$route_dev"}
if strstr ":" "$route_mask"; then
if strstr "$route_mask" ":"; then
printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
> /tmp/net.route6."$netif"
else
@@ -146,7 +170,8 @@ setup_net() {
unset layer2
> /tmp/net.$netif.did-setup
[ -e /sys/class/net/$netif/address ] && \
[ -z "$DO_VLAN" ] && \
[ -e /sys/class/net/$netif/address ] && \
> /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
}
@@ -189,7 +214,7 @@ set_ifname() {
fix_bootif() {
local macaddr=${1}
local IFS='-'
macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
macaddr=$(printf '%s:' ${macaddr})
macaddr=${macaddr%:}
# strip hardware type field from pxelinux
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
@@ -213,19 +238,51 @@ ibft_to_cmdline() {
[ -e /tmp/net.${dev}.has_ibft_config ] && continue
[ -e ${iface}/flags ] && flags=$(read a < ${iface}/flags; echo $a)
# Skip invalid interfaces
(( $flags & 1 )) || continue
[ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
[ -e ${iface}/origin ] && origin=$(read a < ${iface}/origin; echo $a)
[ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a)
if [ -n "$dhcp" ]; then
echo "ip=$dev:dhcp"
if [ -n "$ip" ] ; then
case "$ip" in
*.*.*.*)
family=ipv4
;;
*:*)
family=ipv6
;;
esac
fi
if [ -n "$dhcp" ] || [ "$origin" -eq 3 ]; then
if [ "$family" = "ipv6" ] ; then
echo "ip=$dev:dhcp6"
else
echo "ip=$dev:dhcp"
fi
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)
[ "$gateway" = "0.0.0.0" ] && unset $gateway
[ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; echo $a)
[ -e ${iface}/prefix-len ] && prefix=$(read a < ${iface}/prefix-len; echo $a)
[ -e ${iface}/primary-dns ] && dns1=$(read a < ${iface}/primary-dns; echo $a)
[ "$dns1" = "0.0.0.0" ] && unset $dns1
[ -e ${iface}/secondary-dns ] && dns2=$(read a < ${iface}/secondary-dns; echo $a)
[ "$dns2" = "0.0.0.0" ] && unset $dns2
[ -e ${iface}/hostname ] && hostname=$(read a < ${iface}/hostname; echo $a)
if [ "$family" = "ipv6" ] ; then
if [ -n "$ip" ] ; then
ip="[$ip]"
[ -n "$prefix" ] || prefix=64
mask="$prefix"
fi
if [ -n "$gw" ] ; then
gw="[${gw}]"
fi
fi
if [ -n "$ip" ] && [ -n "$mask" ]; then
echo "ip=$ip::$gw:$mask:$hostname:$dev:none${dns1:+:$dns1}${dns2:+:$dns2}"
else
@@ -241,21 +298,21 @@ ibft_to_cmdline() {
fi
if [ -e ${iface}/vlan ]; then
vlan=$(read a < ${iface}/vlan; echo $a)
if [ "$vlan" -ne "0" ]; then
case "$vlan" in
[0-9]*)
echo "vlan=$dev.$vlan:$dev"
echo $mac > /tmp/net.${dev}.${vlan}.has_ibft_config
;;
*)
echo "vlan=$vlan:$dev"
echo $mac > /tmp/net.${vlan}.has_ibft_config
;;
esac
else
echo $mac > /tmp/net.${dev}.has_ibft_config
fi
vlan=$(read a < ${iface}/vlan; echo $a)
if [ "$vlan" -ne "0" ]; then
case "$vlan" in
[0-9]*)
echo "vlan=$dev.$vlan:$dev"
echo $mac > /tmp/net.${dev}.${vlan}.has_ibft_config
;;
*)
echo "vlan=$vlan:$dev"
echo $mac > /tmp/net.${vlan}.has_ibft_config
;;
esac
else
echo $mac > /tmp/net.${dev}.has_ibft_config
fi
else
echo $mac > /tmp/net.${dev}.has_ibft_config
fi
@@ -381,50 +438,84 @@ ip_to_var() {
done
unset ip srv gw mask hostname dev autoconf macaddr mtu dns1 dns2
case $# in
0) autoconf="error" ;;
1) autoconf=$1 ;;
2) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2 ;;
3) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3 ;;
4) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3; [ -n "$4" ] && macaddr=$4 ;;
*) [ -n "$1" ] && ip=$1; [ -n "$2" ] && srv=$2; [ -n "$3" ] && gw=$3; [ -n "$4" ] && mask=$4;
[ -n "$5" ] && hostname=$5; [ -n "$6" ] && dev=$6; [ -n "$7" ] && autoconf=$7;
case "$8" in
[0-9]*:*|[0-9]*.[0-9]*.[0-9]*.[0-9]*)
dns1="$8"
[ -n "$9" ] && dns2="$9"
;;
[0-9]*)
mtu="$8"
;;
*)
if [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
fi
;;
esac
;;
esac
# 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 strglob "$autoconf" "*.*.*.*"; then
ip="$autoconf"
gw=$(getarg gateway=)
mask=$(getarg netmask=)
hostname=$(getarg hostname=)
dev=$(getarg ksdevice=)
autoconf="none"
mtu=$(getarg mtu=)
# handle special values for ksdevice
case "$dev" in
bootif|BOOTIF) dev=$(fix_bootif $(getarg BOOTIF=)) ;;
link) dev="" ;; # FIXME: do something useful with this
ibft) dev="" ;; # ignore - ibft is handled elsewhere
esac
if [ $# -eq 0 ]; then
autoconf="error"
return 0
fi
if [ $# -eq 1 ]; then
# format: ip={dhcp|on|any|dhcp6|auto6|either6}
# or
# ip=<ipv4-address> means anaconda-style static config argument cluster
autoconf="$1"
if strstr "$autoconf" "*.*.*.*"; then
# 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>}
ip="$autoconf"
gw=$(getarg gateway=)
mask=$(getarg netmask=)
hostname=$(getarg hostname=)
dev=$(getarg ksdevice=)
autoconf="none"
mtu=$(getarg mtu=)
# handle special values for ksdevice
case "$dev" in
bootif|BOOTIF) dev=$(fix_bootif $(getarg BOOTIF=)) ;;
link) dev="" ;; # FIXME: do something useful with this
ibft) dev="" ;; # ignore - ibft is handled elsewhere
esac
fi
return 0
fi
if [ "$2" = "dhcp" -o "$2" = "on" -o "$2" = "any" -o "$2" = "dhcp6" -o "$2" = "auto6" -o "$2" = "either6" ]; then
# format: ip=<interface>:{dhcp|on|any|dhcp6|auto6}[:[<mtu>][:<macaddr>]]
[ -n "$1" ] && dev="$1"
[ -n "$2" ] && autoconf="$2"
[ -n "$3" ] && mtu=$3
if [ -z "$5" ]; then
macaddr="$4"
else
macaddr="${4}:${5}:${6}:${7}:${8}:${9}"
fi
return 0
fi
# format: ip=<client-IP>:[<peer>]:<gateway-IP>:<netmask>:<client_hostname>:<interface>:{none|off|dhcp|on|any|dhcp6|auto6|ibft}:[:[<mtu>][:<macaddr>]]
[ -n "$1" ] && ip=$1
[ -n "$2" ] && srv=$2
[ -n "$3" ] && gw=$3
[ -n "$4" ] && mask=$4
[ -n "$5" ] && hostname=$5
[ -n "$6" ] && dev=$6
[ -n "$7" ] && autoconf=$7
case "$8" in
[0-9]*:*|[0-9]*.[0-9]*.[0-9]*.[0-9]*)
dns1="$8"
[ -n "$9" ] && dns2="$9"
;;
[0-9]*)
mtu="$8"
if [ -n "${9}" -a -z "${10}" ]; then
macaddr="${9}"
elif [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
fi
;;
*)
if [ -n "${9}" -a -z "${10}" ]; then
macaddr="${9}"
elif [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
fi
;;
esac
return 0
}
route_to_var() {
@@ -464,8 +555,13 @@ parse_ifname_opts() {
# udev requires MAC addresses to be lower case
ifname_mac=$(echo $2:$3:$4:$5:$6:$7 | sed 'y/ABCDEF/abcdef/')
;;
21)
# infiniband MAC addrs are 20 bytes long not 6
ifname_if=$1
ifname_mac=$(echo $2:$3:$4:$5:$6:$7:$8:$9:$10:$11:$12:13:$14:$15$16:$17:$18:$19:$20:$21 | sed 'y/ABCDEF/abcdef/')
;;
*)
die "Invalid arguments for ifname="
die "Invalid arguments for ifname=$1"
;;
esac
@@ -474,7 +570,7 @@ parse_ifname_opts() {
warn "ifname=$ifname_if uses the kernel name space for interfaces"
warn "This can fail for multiple network interfaces and is discouraged!"
warn "Please use a custom name like \"netboot\" or \"bluesocket\""
warn "or use biosdevname and no ifname= at all."
warn "or use the persistent interface names from udev or biosdevname and no ifname= at all."
;;
esac
@@ -484,7 +580,11 @@ parse_ifname_opts() {
wait_for_if_link() {
local cnt=0
local li
while [ $cnt -lt 600 ]; do
local timeout="$(getargs rd.net.timeout.iflink=)"
timeout=${timeout:-60}
timeout=$(($timeout*10))
while [ $cnt -lt $timeout ]; do
li=$(ip -o link show dev $1 2>/dev/null)
[ -n "$li" ] && return 0
sleep 0.1
@@ -496,9 +596,27 @@ wait_for_if_link() {
wait_for_if_up() {
local cnt=0
local li
while [ $cnt -lt 200 ]; do
local timeout="$(getargs rd.net.timeout.ifup=)"
timeout=${timeout:-20}
timeout=$(($timeout*10))
while [ $cnt -lt $timeout ]; do
li=$(ip -o link show up dev $1)
[ -n "$li" ] && [ -z "${li##*state UP*}" ] && return 0
if [ -n "$li" ]; then
case "$li" in
*\<UP*)
return 0;;
*\<*,UP\>*)
return 0;;
*\<*,UP,*\>*)
return 0;;
esac
fi
if strstr "$li" "LOWER_UP" \
&& strstr "$li" "state UNKNOWN" \
&& ! strstr "$li" "DORMANT"; then
return 0
fi
sleep 0.1
cnt=$(($cnt+1))
done
@@ -507,7 +625,11 @@ wait_for_if_up() {
wait_for_route_ok() {
local cnt=0
while [ $cnt -lt 200 ]; do
local timeout="$(getargs rd.net.timeout.route=)"
timeout=${timeout:-20}
timeout=$(($timeout*10))
while [ $cnt -lt $timeout ]; do
li=$(ip route show)
[ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
sleep 0.1
@@ -516,12 +638,36 @@ wait_for_route_ok() {
return 1
}
wait_for_ipv6_dad_link() {
local cnt=0
local timeout="$(getargs rd.net.timeout.ipv6dad=)"
timeout=${timeout:-50}
timeout=$(($timeout*10))
while [ $cnt -lt $timeout ]; do
[ -n "$(ip -6 addr show dev "$1" scope link)" ] \
[ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
&& return 0
[ -n "$(ip -6 addr show dev "$1" scope link dadfailed)" ] \
&& return 1
sleep 0.1
cnt=$(($cnt+1))
done
return 1
}
wait_for_ipv6_dad() {
local cnt=0
local li
while [ $cnt -lt 500 ]; do
li=$(ip -6 addr show dev $1 scope link)
strstr "$li" "tentative" || return 0
local timeout="$(getargs rd.net.timeout.ipv6dad=)"
timeout=${timeout:-50}
timeout=$(($timeout*10))
while [ $cnt -lt $timeout ]; do
[ -n "$(ip -6 addr show dev "$1")" ] \
[ -z "$(ip -6 addr show dev "$1" tentative)" ] \
&& return 0
[ -n "$(ip -6 addr show dev "$1" dadfailed)" ] \
&& return 1
sleep 0.1
cnt=$(($cnt+1))
done
@@ -530,12 +676,14 @@ wait_for_ipv6_dad() {
wait_for_ipv6_auto() {
local cnt=0
local li
while [ $cnt -lt 400 ]; do
li=$(ip -6 addr show dev $1)
if ! strstr "$li" "tentative"; then
strstr "$li" "dynamic" && return 0
fi
local timeout="$(getargs rd.net.timeout.ipv6auto=)"
timeout=${timeout:-40}
timeout=$(($timeout*10))
while [ $cnt -lt $timeout ]; do
[ -z "$(ip -6 addr show dev "$1" tentative)" ] \
&& [ -n "$(ip -6 route list proto ra dev "$1")" ] \
&& return 0
sleep 0.1
cnt=$(($cnt+1))
done
@@ -549,25 +697,49 @@ linkup() {
}
type hostname >/dev/null 2>&1 || \
hostname() {
cat /proc/sys/kernel/hostname
hostname() {
cat /proc/sys/kernel/hostname
}
iface_has_link() {
iface_has_carrier() {
local cnt=0
local interface="$1" flags=""
[ -n "$interface" ] || return 2
interface="/sys/class/net/$interface"
[ -d "$interface" ] || return 2
local timeout="$(getargs rd.net.timeout.carrier=)"
timeout=${timeout:-15}
timeout=$(($timeout*10))
linkup "$1"
while [ $cnt -lt 50 ]; do
[ "$(cat $interface/carrier)" = 1 ] && return 0
li=$(ip -o link show up dev $1)
strstr "$li" "NO-CARRIER" && _no_carrier_flag=1
while [ $cnt -lt $timeout ]; do
if [ -n "$_no_carrier_flag" ]; then
# NO-CARRIER flag was cleared
strstr "$li" "NO-CARRIER" || return 0
fi
# double check the syscfs carrier flag
[ -e "$interface/carrier" ] && [ "$(cat $interface/carrier)" = 1 ] && return 0
sleep 0.1
cnt=$(($cnt+1))
done
return 1
}
iface_has_link() {
iface_has_carrier "$@"
}
iface_is_enslaved() {
local _li
_li=$(ip -o link show dev $1)
strstr "$li" " master " || return 1
return 0
}
find_iface_with_link() {
local iface_path="" iface=""
for iface_path in /sys/class/net/*; do
@@ -646,3 +818,21 @@ is_kernel_ethernet_name() {
esac
}
iface_get_subchannels() {
local _netif
local _subchannels
_netif="$1"
_subchannels=$({
for i in /sys/class/net/$_netif/device/cdev[0-9]*; do
[ -e $i ] || continue
channel=$(readlink -f $i)
printf -- "%s" "${channel##*/},"
done
})
[ -n "$_subchannels" ] || return 1
printf -- "%s" ${_subchannels%,}
}

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v getarg >/dev/null || . /lib/dracut-lib.sh
@@ -12,6 +14,11 @@ command -v setup_net >/dev/null || . /lib/net-lib.sh
# no sense in doing something if no (net)root info is available
# or root is already there
[ -d $NEWROOT/proc ] && exit 0
if [ -z "$netroot" ]; then
netroot=$(getarg netroot=)
fi
[ -z "$netroot" ] && exit 1
# Set or override primary interface
@@ -33,7 +40,7 @@ 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
if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
if getarg "root=dhcp" || getarg "netroot=dhcp" || getarg "root=dhcp6" || getarg "netroot=dhcp6"; then
# Load dhcp options
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
@@ -45,6 +52,8 @@ if [ -z "$2" ]; then
exit 1
fi
rm -f -- $hookdir/initqueue/finished/dhcp.sh
# Set netroot to new_root_path, so cmdline parsers don't call
netroot=$new_root_path
@@ -74,9 +83,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
# Network rootfs mount successful - save interface info for ifcfg etc.
save_netinfo $netif
fi
[ -n "$handler" ] && "$handler" "$netif" "$netroot" "$NEWROOT"
save_netinfo $netif
exit 0

View File

@@ -1,7 +1,7 @@
#!/bin/sh
#
# Format:
# bond=<bondname>[:<bondslaves>:[:<options>]]
# bond=<bondname>[:<bondslaves>:[:<options>[:<mtu>]]]
#
# bondslaves is a comma-separated list of physical (ethernet) interfaces
# options is a comma-separated list on bonding options (modinfo bonding for details) in format compatible with initscripts
@@ -9,14 +9,8 @@
#
# bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr
#
# return if bond already parsed
[ -n "$bondname" ] && return
# Check if bond parameter is valid
if getarg bond= >/dev/null ; then
:
fi
# if the mtu is specified, it will be set on the bond master
#
# We translate list of slaves to space-separated here to mwke it easier to loop over them in ifup
# Ditto for bonding options
@@ -28,24 +22,24 @@ parsebond() {
v=${v#*:}
done
unset bondname bondslaves bondoptions
case $# in
0) bondname=bond0; bondslaves="eth0 eth1" ;;
1) bondname=$1; bondslaves="eth0 eth1" ;;
2) bondname=$1; bondslaves=$(str_replace "$2" "," " ") ;;
3) bondname=$1; bondslaves=$(str_replace "$2" "," " "); bondoptions=$(str_replace "$3" "," " ") ;;
4) bondname=$1; bondslaves=$(str_replace "$2" "," " "); bondoptions=$(str_replace "$3" "," " "); bondmtu=$4;;
*) die "bond= requires zero to four parameters" ;;
esac
}
unset bondname bondslaves bondoptions
# Parse bond for bondname, bondslaves, bondmode and bondoptions
if getarg bond >/dev/null; then
# Read bond= parameters if they exist
bond="$(getarg bond=)"
if [ ! "$bond" = "bond" ]; then
parsebond "$(getarg bond=)"
# Parse bond for bondname, bondslaves, bondmode, bondoptions and bondmtu
for bond in $(getargs bond=); do
unset bondname
unset bondslaves
unset bondoptions
unset bondmtu
if [ "$bond" != "bond" ]; then
parsebond "$bond"
fi
# Simple default bond
if [ -z "$bondname" ]; then
@@ -57,5 +51,5 @@ if getarg bond >/dev/null; then
echo "bondname=$bondname" > /tmp/bond.${bondname}.info
echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.${bondname}.info
echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.${bondname}.info
return
fi
echo "bondmtu=\"$bondmtu\"" >> /tmp/bond.${bondname}.info
done

View File

@@ -7,14 +7,6 @@
# bridge without parameters assumes bridge=br0:eth0
#
# return if bridge already parsed
[ -n "$bridgename" ] && return
# Check if bridge parameter is valid
if getarg bridge= >/dev/null ; then
command -v brctl >/dev/null 2>&1 || die "No 'brctl' installed"
fi
parsebridge() {
local v=${1}:
set --
@@ -22,8 +14,6 @@ parsebridge() {
set -- "$@" "${v%%:*}"
v=${v#*:}
done
unset bridgename bridgeslaves
case $# in
0) bridgename=br0; bridgeslaves=$iface ;;
1) die "bridge= requires two parameters" ;;
@@ -32,14 +22,13 @@ parsebridge() {
esac
}
unset bridgename bridgeslaves
iface=eth0
# Parse bridge for bridgename and bridgeslaves
if bridge="$(getarg bridge)"; then
for bridge in $(getargs bridge=); do
unset bridgename
unset bridgeslaves
iface=eth0
# Read bridge= parameters if they exist
if [ -n "$bridge" ]; then
if [ "$bridge" != "bridge" ]; then
parsebridge $bridge
fi
# Simple default bridge
@@ -47,7 +36,6 @@ if bridge="$(getarg bridge)"; then
bridgename=br0
bridgeslaves=$iface
fi
echo "bridgename=$bridgename" > /tmp/bridge.info
echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.info
return
fi
echo "bridgename=$bridgename" > /tmp/bridge.${bridgename}.info
echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.${bridgename}.info
done

View File

@@ -1,8 +1,12 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
command -v getarg >/dev/null || . /lib/dracut-lib.sh
command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh
if getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then
modprobe -b -q iscsi_boot_sysfs 2>/dev/null
modprobe -b -q iscsi_ibft
ibft_to_cmdline
fi

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Format:
# ifname=<interface>:<mac>

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Format:
# ip=[dhcp|on|any]
@@ -36,8 +38,12 @@ unset count
# If needed, check if bootdev= contains anything usable
BOOTDEV=$(getarg bootdev=)
if [ -n "$NEEDBOOTDEV" ] ; then
[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
if [ -n "$NEEDBOOTDEV" ] && ! getargbool 0 rd.neednet; then
#[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
echo "rd.neednet=1" > /etc/cmdline.d/dracut-neednet.conf
info "Multiple ip= arguments: assuming rd.neednet=1"
else
unset NEEDBOOTDEV
fi
# Check ip= lines
@@ -46,17 +52,14 @@ for p in $(getargs ip=); do
ip_to_var $p
# make first device specified the BOOTDEV
if [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then
if [ -n "$NEEDBOOTDEV" ] && [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then
BOOTDEV="$dev"
[ -n "$NEEDBOOTDEV" ] && warn "Setting bootdev to '$BOOTDEV'"
info "Setting bootdev to '$BOOTDEV'"
fi
# skip ibft since we did it above
[ "$autoconf" = "ibft" ] && continue
# We need to have an ip= line for the specified bootdev
[ -n "$NEEDBOOTDEV" ] && [ "$dev" = "$BOOTDEV" ] && BOOTDEVOK=1
# Empty autoconf defaults to 'dhcp'
if [ -z "$autoconf" ] ; then
warn "Empty autoconf values default to dhcp"
@@ -75,9 +78,10 @@ for p in $(getargs ip=); do
die "Sorry, automatic calculation of netmask is not yet supported"
;;
auto6);;
either6);;
dhcp|dhcp6|on|any) \
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
#[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
# die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
[ -n "$ip" ] && \
die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoopt'"
;;
@@ -109,6 +113,16 @@ for p in $(getargs ip=); do
die "Server-ip or dhcp for netboot needed, but current arguments say otherwise"
fi
if str_starts "$dev" "enx" && [ ${#dev} -eq 15 ]; then
printf -- "ifname=%s:%s:%s:%s:%s:%s:%s\n" \
"$dev" \
"${dev:3:2}" \
"${dev:5:2}" \
"${dev:7:2}" \
"${dev:9:2}" \
"${dev:11:2}" \
"${dev:13:2}" >> /etc/cmdline.d/80-enx.conf
fi
done
# put BOOTIF in IFACES to make sure it comes up

View File

@@ -6,14 +6,6 @@
# teamslaves is a comma-separated list of physical (ethernet) interfaces
#
# return if team already parsed
[ -n "$teammaster" ] && return
# Check if team parameter is valid
if getarg team= >/dev/null ; then
:
fi
parseteam() {
local v=${1}:
set --
@@ -22,23 +14,22 @@ parseteam() {
v=${v#*:}
done
unset teammaster teamslaves
case $# in
2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;;
*) die "team= requires two parameters" ;;
esac
}
unset teammaster teamslaves
if getarg team>/dev/null; then
# Read team= parameters if they exist
team="$(getarg team=)"
if [ ! "$team" = "team" ]; then
parseteam "$(getarg team=)"
for team in $(getargs team=); do
unset teammaster teamslaves
parseteam "$(getarg team=)"
echo "teammaster=$teammaster" > /tmp/team.${teammaster}.info
echo "teamslaves=\"$teamslaves\"" >> /tmp/team.${teammaster}.info
if ! [ -e /etc/teamd/${teammaster}.conf ]; then
warn "Team master $teammaster specified, but no /etc/teamd/$teammaster.conf present. Using activebackup."
mkdir -p /etc/teamd
printf -- "%s" '{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}' > "/etc/teamd/${teammaster}.conf"
fi
echo "teammaster=$teammaster" > /tmp/team.info
echo "teamslaves=\"$teamslaves\"" >> /tmp/team.info
return
fi
done

View File

@@ -4,14 +4,6 @@
# vlan=<vlanname>:<phydevice>
#
# return if vlan already parsed
[ -n "$vlanname" ] && return
# Check if vlan parameter is valid
if getarg vlan= >/dev/null ; then
:
fi
parsevlan() {
local v=${1}:
set --
@@ -27,16 +19,11 @@ parsevlan() {
esac
}
unset vlanname phydevice
for vlan in $(getargs vlan=); do
unset vlanname
unset phydevice
parsevlan "$vlan"
if getarg vlan >/dev/null; then
# Read vlan= parameters if they exist
vlan="$(getarg vlan=)"
if [ ! "$vlan" = "vlan" ]; then
parsevlan "$(getarg vlan=)"
fi
echo "vlanname=\"$vlanname\"" > /tmp/vlan.info
echo "phydevice=\"$phydevice\"" >> /tmp/vlan.info
return
fi
echo "$phydevice" > /tmp/vlan.${phydevice}.phy
echo "$vlanname" > /tmp/vlan.${vlanname}.${phydevice}
done

View File

@@ -1,18 +1,17 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
[[ -d /etc/sysconfig/network-scripts ]] && return 0
return 255
}
# called by dracut
depends() {
echo "network"
return 0
}
# called by dracut
install() {
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
}

View File

@@ -1,18 +1,12 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# NFS root might have reached here before /tmp/net.ifaces was written
type is_persistent_ethernet_name >/dev/null 2>&1 || . /lib/net-lib.sh
udevadm settle --timeout=30
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/
@@ -48,7 +42,7 @@ print_s390() {
for i in /sys/class/net/$_netif/device/cdev[0-9]*; do
[ -e $i ] || continue
channel=$(readlink -f $i)
echo -n "${channel##*/},"
printf '%s' "${channel##*/},"
done
})
[ -n "$SUBCHANNELS" ] || return 1
@@ -122,13 +116,16 @@ for netup in /tmp/net.*.did-setup ; do
netif=${netup%%.did-setup}
netif=${netif##*/net.}
strglobin "$netif" ":*:*:*:*:" && continue
strstr "$netif" ":*:*:*:*:" && continue
[ -e /tmp/ifcfg/ifcfg-$netif ] && continue
unset bridge
unset bond
unset team
unset bondslaves
unset bondname
unset bondoptions
unset bridgename
unset bridgeslaves
unset uuid
unset ip
unset gw
@@ -138,24 +135,39 @@ for netup in /tmp/net.*.did-setup ; do
unset slave
unset ethname
unset vlan
unset phydevice
[ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info
[ -e /tmp/bridge.${netif}.info ] && . /tmp/bridge.${netif}.info
[ -e /tmp/team.${netif}.info ] && . /tmp/team.${netif}.info
[ -e /tmp/net.${netif}.override ] && . /tmp/net.${netif}.override
uuid=$(cat /proc/sys/kernel/random/uuid)
if [ "$netif" = "$bridgename" ]; then
bridge=yes
elif [ "$netif" = "$teammaster" ]; then
team=yes
elif [ "$netif" = "$bondname" ]; then
# $netif can't be bridge and bond at the same time
# $netif can't be bridge and bond at the same time
bond=yes
fi
if [ "$netif" = "$vlanname" ]; then
vlan=yes
if ! [ -e /tmp/vlan.${netif}.phy ]; then
for i in /tmp/vlan.${netif}.*; do
[ ! -e "$i" ] && continue
phydevice=${i##/tmp/vlan.${netif}.}
vlan=yes
break
done
fi
# skip team interfaces for now, the host config must be in sync
[ "$netif" = "$teammaster" ] && continue
{
echo "# Generated by dracut initrd"
echo "NAME=\"$netif\""
interface_bind "$netif" "$macaddr"
[ -z "$vlan" ] && interface_bind "$netif" "$macaddr"
echo "ONBOOT=yes"
echo "NETBOOT=yes"
echo "UUID=\"$uuid\""
@@ -169,9 +181,7 @@ for netup in /tmp/net.*.did-setup ; do
fi
cp /tmp/dhclient.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease
else
# If we've booted with static ip= lines, the override file is there
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
if strglobin "$ip" '*:*:*'; then
if strstr "$ip" '*:*:*'; then
echo "IPV6INIT=yes"
echo "IPV6_AUTOCONF=no"
echo "IPV6ADDR=\"$ip/$mask\""
@@ -188,7 +198,7 @@ for netup in /tmp/net.*.did-setup ; do
fi
fi
fi
if strglobin "$gw" '*:*:*'; then
if strstr "$gw" '*:*:*'; then
echo "IPV6_DEFAULTGW=\"$gw\""
elif [ -n "$gw" ]; then
echo "GATEWAY=\"$gw\""
@@ -198,18 +208,15 @@ for netup in /tmp/net.*.did-setup ; do
} > /tmp/ifcfg/ifcfg-$netif
# bridge needs different things written to ifcfg
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ] && [ -z "$team" ]; then
# standard interface
{
echo "TYPE=Ethernet"
[ -n "$mtu" ] && echo "MTU=\"$mtu\""
} >> /tmp/ifcfg/ifcfg-$netif
echo "TYPE=Ethernet" >> /tmp/ifcfg/ifcfg-$netif
fi
if [ -n "$vlan" ] ; then
{
echo "TYPE=Vlan"
echo "NAME=\"$netif\""
echo "DEVICE=\"$netif\""
echo "VLAN=yes"
echo "PHYSDEV=\"$phydevice\""
} >> /tmp/ifcfg/ifcfg-$netif
@@ -236,7 +243,7 @@ for netup in /tmp/net.*.did-setup ; do
echo "MASTER=\"$netif\""
echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
unset macaddr
[ -e /tmp/net.$slave.override ] && . /tmp/net.$slave.override
[ -e /tmp/net.${slave}.override ] && . /tmp/net.${slave}.override
interface_bind "$slave" "$macaddr"
) >> /tmp/ifcfg/ifcfg-$slave
done
@@ -259,11 +266,12 @@ for netup in /tmp/net.*.did-setup ; do
echo "BRIDGE=\"$bridgename\""
echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
unset macaddr
[ -e /tmp/net.$slave.override ] && . /tmp/net.$slave.override
[ -e /tmp/net.${slave}.override ] && . /tmp/net.${slave}.override
interface_bind "$slave" "$macaddr"
) >> /tmp/ifcfg/ifcfg-$slave
done
fi
i=1
for ns in $(getargs nameserver); do
echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-$netif

View File

@@ -1,23 +1,19 @@
#!/bin/bash
# module-setup for url-lib
# called by dracut
check() {
require_binaries curl || return 1
return 255
}
# called by dracut
depends() {
echo network
return 0
}
# called by dracut
install() {
local _dir _crt _found _lib
inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
inst_multiple -o ctorrent
inst_multiple curl
# also install libs for curl https
inst_libdir_file "libnsspem.so*"
@@ -32,7 +28,7 @@ install() {
_crt=$(grep -F --binary-files=text -z .crt $_lib)
[[ $_crt ]] || continue
[[ $_crt == /*/* ]] || continue
if ! inst_simple "$_crt"; then
if ! inst "$_crt"; then
dwarn "Couldn't install '$_crt' SSL CA cert bundle; HTTPS might not work."
continue
fi

View File

@@ -76,51 +76,19 @@ curl_fetch_url() {
fi
if [ -z "$2" ]; then echo "$outloc" ; fi
}
add_url_handler curl_fetch_url http https ftp tftp
add_url_handler curl_fetch_url http https ftp
set_http_header() {
echo "header = \"$1: $2\"" >> $CURL_HOME/.curlrc
}
### TORRENT ##########################################################
ctorrent_args="-E 0 -e 0"
ctorrent_fetch_url() {
local url="$1" outloc="$2"
url=${url#*//}
torrent_outloc="$outloc.torrent"
echo "$url" > /proc/self/fd/0
if [ -n "$outloc" ]; then
curl $curl_args --output - -- "$url" > "$torrent_outloc" || return $?
else
local outdir="$(mkuniqdir /tmp torrent_fetch_url)"
( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
torrent_outloc="$outdir/$(ls -A $outdir)"
outloc=${torrent_outloc%.*}
fi
if ! [ -f "$torrent_outloc" ]; then
warn "Downloading '$url' failed!"
return 253
fi
ctorrent $ctorrent_args -s $outloc $torrent_outloc >&2
if ! [ -f "$outloc" ]; then
warn "Torrent download of '$url' failed!"
return 253
fi
if [ -z "$2" ]; then echo "$outloc" ; fi
}
command -v ctorrent >/dev/null \
&& add_url_handler ctorrent_fetch_url torrent
### NFS ##############################################################
[ -e /lib/nfs-lib.sh ] && . /lib/nfs-lib.sh
nfs_already_mounted() {
local server="$1" path="$2" localdir="" s="" p=""
cat /proc/mounts | while read src mnt rest || [ -n "$src" ]; do
cat /proc/mounts | while read src mnt rest; do
splitsep ":" "$src" s p
if [ "$server" = "$s" ]; then
if [ "$path" = "$p" ]; then
@@ -138,7 +106,7 @@ 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" "$filepath")
if [ -z "$mntdir" ]; then
local mntdir="$(mkuniqdir /run nfs_mnt)"
mount_nfs "$nfs:$server:$filepath${options:+:$options}" "$mntdir"

View File

@@ -1,16 +1,15 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
installkernel() {
local _modname
# Include KMS capable drm drivers
@@ -22,7 +21,7 @@ installkernel() {
local _merge=8 _side2=9
function nmf1() {
local _fname _fcont
while read _fname || [ -n "$_fname" ]; do
while read _fname; do
case "$_fname" in
*.ko) _fcont="$(< $_fname)" ;;
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
@@ -35,7 +34,7 @@ installkernel() {
}
function rotor() {
local _f1 _f2
while read _f1 || [ -n "$_f1" ]; do
while read _f1; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}
@@ -49,17 +48,6 @@ installkernel() {
return 0
}
if [[ "$(uname -p)" == arm* ]]; then
# arm specific modules needed by drm
instmods \
"=drivers/gpu/drm/i2c" \
"=drivers/gpu/drm/panel" \
"=drivers/pwm" \
"=drivers/video/backlight" \
"=drivers/video/fbdev/omap2/displays-new" \
${NULL}
fi
instmods amdkfd hyperv_fb
for _modname in $(find_kernel_modules_by_path drivers/gpu/drm \
@@ -68,12 +56,8 @@ installkernel() {
# as we could e.g. be in the installer; nokmsboot boot parameter will disable
# loading of the driver if needed
if [[ $hostonly ]] && modinfo -F alias $_modname | sed -e 's,\?,\.,g' -e 's,\*,\.\*,g' \
| grep -qxf - /sys/bus/{pci/devices,soc/devices/soc?}/*/modalias 2>/dev/null; then
| grep -qxf - /sys/bus/pci/devices/*/modalias 2>/dev/null; then
hostonly='' instmods $_modname
# if radeon.ko is installed, we want amdkfd also
if strstr "$_modname" radeon.ko; then
hostonly='' instmods amdkfd
fi
continue
fi
instmods $_modname

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
CDROOT=0
. /lib/gensplash-lib.sh

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
CDROOT=0
. /lib/gensplash-lib.sh

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if getargbool 1 rd.splash -d -n rd_NO_SPLASH; then
info "Starting Gentoo Splash"

View File

@@ -1,18 +1,17 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
# TODO: splash_geninitramfs
# TODO: /usr/share/splashutils/initrd.splash
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
local _opts
local _splash_theme

View File

@@ -1,30 +1,23 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
[[ "$mount_needs" ]] && return 1
require_binaries plymouthd plymouth plymouth-set-default-theme
require_binaries plymouthd plymouth
}
# called by dracut
depends() {
echo drm
}
# called by dracut
install() {
PKGLIBDIR="/usr/lib/plymouth"
if type -P dpkg-architecture &>/dev/null; then
PKGLIBDIR="/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth"
fi
[ -x /usr/libexec/plymouth/plymouth-populate-initrd ] && PKGLIBDIR="/usr/libexec/plymouth"
if grep -q nash ${PKGLIBDIR}/plymouth-populate-initrd \
|| [ ! -x ${PKGLIBDIR}/plymouth-populate-initrd ]; then
if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \
|| [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
. "$moddir"/plymouth-populate-initrd.sh
else
PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
${PKGLIBDIR}/plymouth-populate-initrd -t "$initdir"
/usr/libexec/plymouth/plymouth-populate-initrd -t "$initdir"
fi
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh

View File

@@ -1,3 +1,4 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
plymouth --hide-splash 2>/dev/null || :

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if type plymouth >/dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then
plymouth --newroot=$NEWROOT

View File

@@ -1,5 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
PLYMOUTH_LOGO_FILE="/usr/share/pixmaps/system-logo-white.png"
PLYMOUTH_THEME=$(plymouth-set-default-theme)
@@ -26,7 +27,7 @@ if [[ $hostonly ]]; then
if [ -L /usr/share/plymouth/themes/default.plymouth ]; then
inst /usr/share/plymouth/themes/default.plymouth
# Install plugin for this theme
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth | while read a b c || [ -n "$b" ]; do echo $b; done;)
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth | while read a b c; do echo $b; done;)
inst_libdir_file "plymouth/${PLYMOUTH_PLUGIN}.so"
fi
else

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if type plymouthd >/dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then
if getargbool 1 plymouth.enable && getargbool 1 rd.plymouth -d -n rd_NO_PLYMOUTH; then

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