Compare commits

..

1136 Commits

Author SHA1 Message Date
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
Harald Hoyer
d8cc8c0499 version 033 2013-09-12 14:52:20 +02:00
Colin Walters
36b2e5e2c2 dracut.sh: Fixup previous commit to only read /sys and /proc in hostonly mode
The gnome-ostree build system generates dracut initramfs images on the
build server, therefore not in hostonly mode.  The build system at the
moment doesn't mount /sys, and the previous commit caused a hard
failure due to lack of /sys/devices.

Because we only want /sys/devices in hostonly mode, just move those
bits inside the hostonly conditional above.
2013-09-11 22:50:22 +02:00
Harald Hoyer
3c4315fa13 dracut-functions.sh: extend module_is_host_only()
If the currently running kernel is not present in the installer root,
fall back to modalias checking.
2013-09-11 12:53:50 +02:00
Harald Hoyer
d97d130da9 Makefile: create hostonly test image without debug 2013-09-11 09:57:25 +02:00
Harald Hoyer
e0aa98a1df network: correctly name iBFT vlan devices 2013-09-11 09:56:57 +02:00
Harald Hoyer
84bc192946 TEST-50-MULTINIC: improve interface test 2013-09-10 10:51:04 +02:00
Harald Hoyer
e684eab878 nfs/nfsroot-cleanup.sh: silently try to umount rpc_pipefs 2013-09-10 10:50:23 +02:00
Harald Hoyer
debf483d4d network/ifup.sh: ifup with dhcp, if no ip= params specified 2013-09-10 10:49:51 +02:00
Harald Hoyer
d681df8e5f network/net-genrules.sh: react also on NAME
Recent systemd-udevd network renaming rules work on NAME.
Also enqueue only one unique initqueue job.
2013-09-10 10:48:18 +02:00
Harald Hoyer
540a5169b9 dracut.sh: reorder things to let "--print-cmdline" work 2013-09-09 16:52:19 +02:00
Harald Hoyer
12beb05a73 bcache: newer util-linux supports bcache with blkid
and probe-bcache should not be needed in that case
2013-09-09 16:51:44 +02:00
Harald Hoyer
e6aafacb23 dmsquash-live/iso-scan: do the iso scan regardless of /dev/loop0
The loop driver could be a module and would never be loaded, so the
iso-scan never takes place.

To let the iso-scan happen, it is now placed into the initqueue/settled
unconditionally.
2013-09-09 16:49:45 +02:00
Harald Hoyer
8d3d72a68c no more global $CMDLINE
Do not use the global variable CMDLINE anymore. Use
CMDLINE=$(getcmdline)
2013-09-05 09:57:48 +02:00
WANG Chao
b2fab575dc dracut-lib: do not use cached CMDLINE in _getcmdline
Cached CMDLINE doesn't work 100%. For example the following case,

1. dracut starts to run dracut-cmdline.sh. CMDLINE is cached when calling
   getarg 'rd.break=cmdline'.
2. In 92-parse-ibft.sh, ibft_to_cmdline() calls $(set_ifname ibft xx:xx..)
   multiple times in each subshell.
3. In 1st call, set_ifname() will check $(getargs ifname) and write out
   ifname=xxxx accordingly.
4. In 2nd call, set_ifname() will check $(getargs ifname) and it's wrong here.
   Because in step 3, we introduce a new cmdline arg ifname=xxx, but CMDLINE
   isn't updated. Thus we fail to get the new ifname arg.

It's doable to unset CMDLINE every time after a new cmdline arg is in. But
unset should be done in the parent process, because unset CMDLINE in a
subshell won't unset CMDLINE in its parent or sibling process. And also it's
painful to unset CMDLINE every time. In the future, functions and code
snippet could probably separate or move to other file, the unset CMDLINE could
malfunction again like this time.

So I'm thinking not to cache CMDLINE. It's doesn't hurt to re-read all the
cmdline args everytime. Because it's in initramfs, a non cached _getcmdline()
should be fast enough.

Please consider!

Thanks
WANG Chao
2013-09-05 08:45:39 +02:00
Harald Hoyer
de74e1ef41 Rewrite "rootok" and "netroot" logic
Previously if "$rootok" = 1, parsing of netroot command line arguments
was skipped. For multiple netroot arguments, all parse scripts have to
run.

Previously only the first netroot argument was taken into account for
the parsing scripts. Now every netroot argument is processed.
2013-09-04 09:49:19 +02:00
WANG Chao
f2cbd4cbd6 net-lib: ibft_to_cmdline() fixes
Fix 3 issues in ibft_to_cmdline():
- unset local variables at the beginning of each loop
- only write vlan.conf when we write out ip=xxx
- when vlan id is 0, don't write out vlan.conf. Because 0 means untagged
  and we don't actually need vlan interface.
2013-09-04 08:04:20 +02:00
Harald Hoyer
5ecc117a25 iscsi: parse iscsi parameter, even if rootok=1 2013-09-03 15:23:28 +02:00
Harald Hoyer
00ed3ccfd9 dracut-functions.sh:for_each_module_dir() skip empty modules
skip modules, which have no module-setup.sh, install or installkernel

https://bugzilla.redhat.com/show_bug.cgi?id=1003153
2013-09-02 10:28:36 +02:00
Harald Hoyer
6a877a79c4 dracut-logger.sh: check is journald.socket is active
before using systemd-cat, make sure someone is listening
2013-08-28 20:01:54 +02:00
Harald Hoyer
cb73315dd6 resume: debian's resume is in /usr/lib/uswsusp
Hurray! Everybody reinvents the wheel!
2013-08-28 10:57:23 +02:00
Harald Hoyer
8552a3270c dracut-functions.sh:get_devpath_block() make local vars local 2013-08-27 11:34:39 +02:00
Harald Hoyer
281327f72c dmraid/mdraid: improve hostonly recognition
Factor out get_devpath_block(), which also fixes a dmraid hostonly bug.

Also only include dmraid and mdraid, if they are actually in use.
2013-08-26 14:04:56 +02:00
Harald Hoyer
da119ab18c dmraid/parse-dm.sh: if rd.md=0, use dmraid for imsm and ddf 2013-08-26 12:46:51 +02:00
Harald Hoyer
87bd8907a6 i18n: check for setfont and loadkeys binaries 2013-08-26 10:19:49 +02:00
Harald Hoyer
a242ef13e0 network: move ibft parsing before all other network cmdline parser
otherwise the config produced by ibft will not get processed
2013-08-26 10:18:47 +02:00
Harald Hoyer
2b9d8f65a6 dracut-functions.sh:get_persistent_dev() do not check non-existent dirs 2013-08-23 19:04:12 +02:00
Harald Hoyer
ffc68f357e use ${var:+val} rather than ${var+val}
${var:+val} also catches var=""
2013-08-22 11:24:01 +02:00
Harald Hoyer
ace51ef520 dracut-functions.sh:inst_rules() do not install from /etc in generic mode
In generic mode, local configuration should not be part of the image.

Also handle symlinks for rule files.
2013-08-22 10:53:43 +02:00
Harald Hoyer
93b02f502e dracut-functions.sh: use builtin bash functions rather than tr
convert uppercase to lowercase using bash syntax
2013-08-22 10:53:25 +02:00
Harald Hoyer
49c062821a removed freenode.txt 2013-08-22 10:24:15 +02:00
Harald Hoyer
c504d8b435 freenode IRC #dracut verification 2013-08-22 10:14:24 +02:00
Harald Hoyer
39fe00ef60 dracut.asc: document debugging dracut on shutdown 2013-08-22 09:39:38 +02:00
Harald Hoyer
bae44febb5 add dracut.css for dracut.html 2013-08-21 13:15:08 +02:00
Harald Hoyer
5c274467d6 url-lib.sh: handle 0-size files with curl
https://bugzilla.redhat.com/show_bug.cgi?id=989133#c9
2013-08-20 16:15:17 +02:00
Harald Hoyer
c82a11334d dracut-functions.sh: add expand_persistent_dev()
also fixes missing '{' for LABEL=... swaps
2013-08-20 16:03:17 +02:00
Harald Hoyer
f34e1d6b0e network: do not depend on ifcfg
rather let ifcfg return 0 if /etc/sysconfig/network-scripts exists
2013-08-20 15:09:33 +02:00
Harald Hoyer
a073aa5a26 dracut-032 2013-08-20 13:08:52 +02:00
Harald Hoyer
575733aa25 add newline to cmdline config files 2013-08-20 13:08:52 +02:00
Harald Hoyer
546d5dacf5 dracut.sh: recognize swap entries in fstab with mountpoint "none" 2013-08-20 12:01:17 +02:00
Harald Hoyer
3411ad661a add persistent_policy configuration option 2013-08-20 10:28:14 +02:00
Harald Hoyer
a2b64e30b8 dracut.conf.5.asc: correct ro_mnt documentation 2013-08-20 10:27:29 +02:00
Harald Hoyer
50411d30d5 dracut-functions.sh:dracut_module_included() check with spaces
check also for surrounding spaces in the module strings
2013-08-20 09:04:20 +02:00
Harald Hoyer
88c86ac7f0 dracut.sh: fixed checking for FIPS mode 2013-08-20 09:02:48 +02:00
WANG Chao
55c912ae40 systemd: pre-pivot hooks runs after /sysroot is mounted
If rootflags=nofail, sysroot.mount won't strictly run "Before"
initrd-root-fs.target. So we need to order dracut-pre-pivot after
sysroot.mount.
2013-08-19 15:50:57 +02:00
Daniel Schaal
b7c770e186 dracut.sh: Fix [no-]early-microcode parameter and add documentation.
[no-]early-microcode was missing from getopt argument list.

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

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

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

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

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

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

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

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

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

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

Too many problems with adjtime in the initramfs

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

Example

/etc/crypttab:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This is useful since it's common for a user who is booting a new OS for
the first time to know the MAC of the device, but not know what the
kernel name will be.
2013-06-13 14:07:17 +02:00
Will Woods
215ff169db move fix_bootif to net-lib
This might be useful to other parts of dracut; move it to net-lib.sh.
2013-06-13 13:54:16 +02:00
Harald Hoyer
85b458d90d Makefile: source dracut-version.sh and correct dist tarball 2013-06-13 12:55:26 +02:00
Harald Hoyer
268ae2841b Makefile: pipe git describe errors to /dev/null 2013-06-13 12:55:26 +02:00
Harald Hoyer
638cad7c97 add dracut-shutdown.service.8.asc manpage 2013-06-13 12:55:26 +02:00
Harald Hoyer
0fbb79d54f move dracut-shutdown.service to modules.d/98systemd 2013-06-13 11:42:26 +02:00
Harald Hoyer
36c34f4e71 Don't use do syncheck for target all and refine syncheck
instead of "dash -n" we now use "bash --posix -n"
we also check for "[[ " in posix shell files
2013-06-13 11:19:26 +02:00
Harald Hoyer
373efa4427 systemd: make unit files symlinks 2013-06-13 11:08:03 +02:00
Harald Hoyer
cee4599131 systemd/dracut-pre-pivot.service: also execute for cleanup hooks or rd.break 2013-06-13 10:37:45 +02:00
Harald Hoyer
c6011f2add i18n: make the default font configurable
To set the default font for your distribution, add
i18n_default_font="latarcyrheb-sun16"
to your /lib/dracut/dracut.conf.d/01-dist.conf distribution config.
2013-06-13 09:29:17 +02:00
Harald Hoyer
f8b958dc62 network: wait 40 seconds for IPv6 auto configuration
https://bugzilla.redhat.com/show_bug.cgi?id=973719
2013-06-12 17:42:35 +02:00
Harald Hoyer
036712546b NEWS: update 2013-06-12 13:29:39 +02:00
Harald Hoyer
391d605790 rename kernel command line param action_on_fail to rd.action_on_fail 2013-06-12 13:16:33 +02:00
Harald Hoyer
aef0f55791 dmsquash-live/iso-scan: wait until the iso-scan/filename is found
Do not only run once, but wait until all devices are found.
2013-06-12 12:49:03 +02:00
Harald Hoyer
66ed711ccf systemd/dracut-initqueue.service: specify all initqueues 2013-06-07 13:56:16 +02:00
Harald Hoyer
960b1e48e8 TODO: update 2013-06-07 12:39:46 +02:00
WANG Chao
437a56dc6b dracut-initqueue.service: Fix systemd start condition
Scripts in dracut initqueue hooks are placed under
/usr/lib/dracut/hooks/initqueue/*/ directory.

And also start initqueue service when kernel cmdline has
rd.break=initqueue

Signed-off-by: WANG Chao <chaowang@redhat.com>
2013-06-07 12:38:36 +02:00
Harald Hoyer
630aed8b66 udev-rules: add 80-net-name-slot.rules 2013-06-06 15:40:29 +02:00
Harald Hoyer
af6292f0fc cms/cmssetup.sh: untabify 2013-06-06 14:13:36 +02:00
Harald Hoyer
b710520a3d cms/cmssetup.sh: reload udev rules after adding them 2013-06-06 14:13:01 +02:00
Harald Hoyer
66e092bb53 cms/cmssetup.sh: fix LAYER2 ccw.conf setup 2013-06-06 12:32:36 +02:00
Harald Hoyer
fdc1037b19 cms/cmsifup.sh: correctly set MACADDR and MTU for the ip line
https://bugzilla.redhat.com/show_bug.cgi?id=971025
2013-06-06 12:28:34 +02:00
Harald Hoyer
76df206685 cms/cmssetup.sh: do not echo newlines for ccw.conf
https://bugzilla.redhat.com/show_bug.cgi?id=970982
2013-06-06 12:27:19 +02:00
WANG Chao
77364fd6bb base: setup correct system time and time zone in initrd
Currently in initrd, hardware clock is always considered to use UTC time
format and system time zone is also UTC. Thus system time isn't correct
if hw clock is localtime or we're using other time zone in real root.

To fix this, install /etc/adjtime and /etc/localtime to initrd. If not
using systemd, install /usr/sbin/hwclock for dracut init to setup system
time.

[harald: combined the two hostonly if's]

Signed-off-by: WANG Chao <chaowang@redhat.com>
Signed-off-by: Harald Hoyer <harald@redhat.com>
2013-06-06 12:10:50 +02:00
Harald Hoyer
41b0e41a09 Makefile: report syntax check files for V=1 2013-06-06 11:31:07 +02:00
Harald Hoyer
791532b0ce dracut-install: install libs also from one dir above
some HW has different flavors of basic libs

$ ldconfig -p|fgrep libc.so
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

because setting LD_HWCAP_MASK=0 does not work, we have to workaround
this.

$ LD_TRACE_LOADED_OBJECTS=1  LD_HWCAP_MASK=0 /lib64/ld64.so.1 /bin/sh | fgrep libc.so
libc.so.6 => /lib64/power6/libc.so.6 (0x000000804e260000)

Now we try to install the same library from one directory above the one
we installed also.
2013-06-06 11:06:55 +02:00
Harald Hoyer
ad45024416 lvm: fixed "thin" recognition 2013-06-06 09:40:26 +02:00
Dennis Gilmore
3ae5ac28af include panel-tfp410 module on arm systems in the initramfs needed for framebuffer on omap systems 2013-06-06 09:38:44 +02:00
Harald Hoyer
fd28794bbc TEST-99-RPM: generate rpms and exclude /boot loader entries 2013-05-31 10:00:07 +02:00
Harald Hoyer
d18fd0235b dmsquash-live/dmsquash-live-root.sh: fixup 32214acb3a 2013-05-31 09:04:55 +02:00
Harald Hoyer
15c5c072f4 dracut-functions.sh:get_persistent_dev() fix case for multipath
/dev/mapper/mpath* is not a persistent device path

https://bugzilla.redhat.com/show_bug.cgi?id=969068
2013-05-31 07:47:01 +02:00
Harald Hoyer
caf207afa7 ifcfg/write-ifcfg.sh: fixed logic
seems like nobody tested this with recent dracut versions.
2013-05-30 14:37:41 +02:00
Harald Hoyer
57937cf480 lvm: add tools for thin provisioning
https://bugzilla.redhat.com/show_bug.cgi?id=921235
2013-05-30 12:02:59 +02:00
Harald Hoyer
feaf30ffaa network: wait for all required interfaces if "rd.neednet=1"
also set bootdev to the first configured interface, if missing

https://bugzilla.redhat.com/show_bug.cgi?id=801829
2013-05-30 11:38:23 +02:00
Harald Hoyer
dcae873414 systemd/emergency.service: do not run for action_on_fail=continue
same as for dracut-emergency.service
2013-05-30 11:14:39 +02:00
Harald Hoyer
32214acb3a dmsquash-live/dmsquash-live-root.sh: add parameter rd.live.squashimg
rd.live.squashimg names the squash image in the rd.live.dir
and defaults to squashfs.img

https://bugzilla.redhat.com/show_bug.cgi?id=789036
https://bugzilla.redhat.com/show_bug.cgi?id=782108
2013-05-30 09:27:54 +02:00
Harald Hoyer
e64bcf5a99 kernel-modules/module-setup.sh: add hid-hyperv and hv-vmbus 2013-05-30 08:38:40 +02:00
Harald Hoyer
62cb52f431 base/dracut-lib.sh: export DRACUT_SYSTEMD and NEWROOT 2013-05-30 08:32:18 +02:00
dyoung@redhat.com
cf8b1b7853 selinux: load_policy script fix
chroot load_policy will use selinuxfs which should be mounted
in $NEWROOT/sys/fs/selinux for Fedora 19, but because there's
no $NEWROOT/sys/fs, so later process will fail.

Fixing this by bind mount /sys to $NEWROOT/sys.

Signed-off-by: Dave Young <dyoung@redhat.com>
2013-05-30 08:28:11 +02:00
Dan Horák
bc97e005fa use system provides udev rule and initialization script 2013-05-30 08:28:10 +02:00
Baoquan He
679fa7ed3c 99fs-lib/fs-lib.sh: Let user specify the action after fail for fsck
The fsck is ignored when replace emergency_shell with action_on_fail,
now add it.

Signed-off-by: Baoquan He <bhe@redhat.com>
2013-05-30 08:28:08 +02:00
Harald Hoyer
4f084f3ab5 fs-lib/module-setup.sh: add xfs_metadump 2013-05-29 17:51:57 +02:00
Harald Hoyer
af2716626a kernel-modules/module-setup.sh: add nvme kernel module
apparently not caught by the block driver regexp

https://bugzilla.redhat.com/show_bug.cgi?id=910734
2013-05-29 14:48:13 +02:00
Harald Hoyer
6625c085ae ifcfg/write-ifcfg.sh:
- fix ONBOOT for slaves
- set TYPE=Bond for bonding

https://bugzilla.redhat.com/show_bug.cgi?id=919001
2013-05-29 14:38:52 +02:00
Harald Hoyer
af2578562c udev-rules/module-setup.sh: optionally install /etc/pcmcia/config.opts
https://bugzilla.redhat.com/show_bug.cgi?id=920076
2013-05-29 14:29:02 +02:00
Harald Hoyer
8099e7b1ba crypt-loop/module-setup.sh: install loop kernel module 2013-05-29 13:31:54 +02:00
Harald Hoyer
0a3e348225 i18n/module-setup.sh: install default font latarcyrheb-sun16 2013-05-29 13:27:03 +02:00
Harald Hoyer
b78e6ac2c3 dracut-emergency.service: do not start for "action_on_fail=continue" 2013-05-29 11:33:25 +02:00
Dennis Schridde
cbfe65c2fe [40network] Provide a hostname fallback function, in case there is no executable of this name 2013-05-29 11:32:57 +02:00
Harald Hoyer
284d62da81 ifcfg/write-ifcfg.sh: proper NAME the interfaces
https://bugzilla.redhat.com/show_bug.cgi?id=965842
2013-05-28 16:56:40 +02:00
Harald Hoyer
c6df70fb48 btrfs: include btrfs-zero-log in the initramfs
https://bugzilla.redhat.com/show_bug.cgi?id=963257
2013-05-28 16:34:56 +02:00
Harald Hoyer
1b8616adee url-lib/url-lib.sh: turn off curl globbing
https://bugzilla.redhat.com/show_bug.cgi?id=907497
2013-05-28 16:16:26 +02:00
Harald Hoyer
639bd4873b dracut.spec: put selinux for kdump crash file contexts 2013-05-28 15:40:45 +02:00
Kamil Rytarowski
e0904b27ff Fix memory leak 2013-05-28 14:36:37 +02:00
Kamil Rytarowski
d9eff33ce2 Always check the return number of asprintf
asprintf prints to an allocated string. When  successful,  the
functions return the number of bytes printed. If memory allocation
wasn't possible, or some other error occurs, the function will return
-1.

Don't check strp as a result of asprintf, it's content may be undefined.

man 3 asprintf
2013-05-28 14:35:54 +02:00
Kamil Rytarowski
8974102f6b Use consistiently termination code macros
Operate in install_all and install_one consequently on EXIT_SUCCESS
and EXIT_FAILURE termination code macros as they are meant to be
returned from these functions.
2013-05-28 14:34:44 +02:00
Kamil Rytarowski
599182b108 Introduce stricter type correctness 2013-05-28 14:34:29 +02:00
Kamil Rytarowski
6a736cc129 Fix parsing command line arguments
Adjust correctly the *optstring argument of getopt_long. Add support
for a missing option -v|--verbose and drop unknown options -D, -I and -L.
2013-05-28 14:33:02 +02:00
Baoquan He
15b93069bb 01fips/module-setup.sh: add libssl.so.10 to make kdump work with fips mode
FIPS can work well in 1st kernel, but failed in kdump kernel. the
libssl.so.10 and related hmac file are needed. Now add it and it
works.

Signed-off-by: Baoquan He <bhe@redhat.com>
2013-05-28 14:26:31 +02:00
Harald Hoyer
19b5c10963 dracut-functions.sh: clarify instmods() error message 2013-05-28 14:25:49 +02:00
Harald Hoyer
bcfbddefe1 don't add volatile swap partitions to host_devs 2013-05-28 13:36:37 +02:00
Harald Hoyer
780cb33741 systemd: set environment vars DRACUT_SYSTEMD, NEWROOT in service file 2013-05-28 12:50:57 +02:00
Adam Williamson
8d7c07f191 don't specify "p" as a separator for dmraid arrays (RHBZ #966162)
As per RHBZ #966162, parted stopped unconditionally using "p" as a
separator for dmraid device names in version 3.1, so other things need
to fall in line with that convention now.
2013-05-27 10:08:53 +02:00
Harald Hoyer
fefd3f66f9 dracut.sh: degrade message about missing tools for stripping
warning -> info

https://bugzilla.redhat.com/show_bug.cgi?id=958519
2013-05-06 14:20:16 +02:00
Colin Guthrie
d57b8833c4 usrmount: Fix miss-detection of btrfs subvolumes.
This causes the root FS options to be incorrectly applied to to /usr
In some cases this can cause boot failure e.g. due to and XFS /usr
not supporting the 'acl' option from the ext4 root FS.

https://bugs.mageia.org/show_bug.cgi?id=9884
2013-05-06 14:06:07 +02:00
Harald Hoyer
9584c6ae90 zfcp: match udev rule against KERNEL=="zfcp"
zfcp_cfdc will go away in the future

	tt
2013-04-30 18:56:15 +02:00
Harald Hoyer
021b2fddff test: use grep option "-F" and install /etc/os-release 2013-04-30 18:54:33 +02:00
WANG Chao
b6f2e05819 _emergency_shell: Show current working directory correctly in shell.
When dropped to emergency shell, for example, use rd.break=pre-pivot,
the PS1 won't correctly show current directory we're in:

pre-pivot:/# cd /sysroot/
pre-pivot:/#
(still shows "/")

Let's take a look at PS1 variable:

(I'm adding prefix/suffix 'x' to make it clear):
pre-pivot:/# echo x${PS1}x
xpre-pivot:/# x
(PS1 isn't dynamic)

Regarding the current dracut code, it should be:

pre-pivot:/# cd /sysroot/etc
pre-pivot:/sysroot/etc#

With this patch:

pre-pivot:/# echo x${PS1}x
xpre-pivot:${PWD}# x
(Now PS1 is dynamic, it will show the directory correctly)

I tested for both normal boot and kdump boot.

Signed-off-by: WANG Chao <chaowang@redhat.com>
2013-04-30 12:13:56 +02:00
Harald Hoyer
3ed08d1e4d dracut-install: make use of _cleanup_* macros 2013-04-29 11:35:23 +02:00
Harald Hoyer
26a077fc7e fips: do not fail immediatly after loading the crypto modules
Fail only if tcrypt insmod failed.
2013-04-29 11:34:26 +02:00
Harald Hoyer
8461734ee4 dracut.sh: do not preunlink for fips mode
just install prelink and the cache files
2013-04-25 21:16:03 +02:00
Harald Hoyer
6f4c2dada4 fixed fips mode
- preserve timestamps
- copy /lib*/hmaccalc files
- run sha512hmac after kernel module loading
- add more fips kernel modules
2013-04-25 19:44:01 +02:00
Harald Hoyer
ab42fe38fd fixup 3be5d63c2f
either test or []
2013-04-19 15:08:16 +02:00
Harald Hoyer
3be5d63c2f shutdown: redirect output to /dev/console only if it exists 2013-04-19 15:00:20 +02:00
Harald Hoyer
b4dc22cab7 dracut-install: error out, if ldd reports no execution permission
This turns off lazy resolving on noexec mounted tmp directories.

https://bugzilla.redhat.com/show_bug.cgi?id=953426
2013-04-18 12:54:55 +02:00
Harald Hoyer
2b125c69cc base/dracut-lib.sh: do not setdebug, if not in initramfs 2013-04-18 12:54:30 +02:00
Harald Hoyer
9268366cad Makefile: remove dracut-version.sh on clean 2013-04-16 13:41:19 +02:00
Harald Hoyer
d0eedc4a5f .gitignore: ignore more files 2013-04-16 13:38:16 +02:00
Harald Hoyer
4460416abc lsinitrd.sh: do not output filename for a single file 2013-04-16 13:36:04 +02:00
Harald Hoyer
884e1cda7c lsinitrd: drop use of "file" 2013-04-16 13:04:21 +02:00
Harald Hoyer
46a885bf9f dracut-bash-completion.sh: file filename completion 2013-04-16 11:32:32 +02:00
Harald Hoyer
7dbca9be86 lsinitrd: add bash completion 2013-04-16 11:32:31 +02:00
Harald Hoyer
7d9bb76ac7 lsinitrd: switch to getopt and add "-f" and "-k" parameter 2013-04-16 11:32:31 +02:00
Harald Hoyer
26ab7b07a6 Makefile: fixup tarball Makefile 2013-04-15 11:53:03 +02:00
Harald Hoyer
14499534ba dmsquash-live: add support for "iso-scan/filename" kernel parameter
now you can write grub entries like

  set isofile="/Fedora-live.iso"
  loopback loop $isofile
  linux loop)/isolinux/vmlinuz iso-scan/filename=$isofile root=live:CDLABEL=Fedora-...
  initrd (loop)/isolinux/initrd0.img
2013-04-15 11:39:32 +02:00
Harald Hoyer
1540df0e79 url-lib/module-setup.sh: install ca-bundle.crt by libcurl.so
https://bugzilla.redhat.com/show_bug.cgi?id=950770

curl seems to look for /etc/pki/tls/certs/ca-bundle.crt

extract the correct path by disecting libcurl.so
2013-04-12 15:27:27 +02:00
Harald Hoyer
5d68c80b16 systemd: include the systemd-random-seed-load.service
The systemd cryptsetup-generator wants systemd-random-seed-load.service
in case /dev/urandom is the device.
2013-04-12 15:27:27 +02:00
Harald Hoyer
5f8cd1a4be Makefile,git2spec.pl: use "git describe" 2013-04-12 15:27:27 +02:00
Harald Hoyer
14201d23e7 AUTHORS: update 2013-04-12 15:27:27 +02:00
Harald Hoyer
a229b17434 plymouth/plymouth-pretrigger.sh: fixup of ca2c6936 2013-04-12 15:25:44 +02:00
Harald Hoyer
ca2c693679 Do not call plymouth with full path 2013-04-11 16:08:26 +02:00
Harald Hoyer
cdcb27a4fe crypt/module-setup.sh: also handle UUID= while filtering crypttab
The crypttab filter for host-only did not handle UUID= entries.
https://bugzilla.redhat.com/show_bug.cgi?id=919752
2013-04-10 10:16:49 +02:00
WANG Chao
0c5ccb35c7 ifup.sh: Add support for bridge over a vlan tagged interface
This patch add support for bridge a vlan tagged interface, like
br0 -> bond0.7 -> bond0 -> eth0

Signed-off-by: WANG Chao <chaowang@redhat.com>
2013-04-09 13:39:32 +02:00
Baoquan He
9d787df196 Let user specify the action after fail
Currently the default action is emergency_shell when failure happened
during system boot. In kdump, this default may not be expected. E.g,
if dump target is not rootfs, it does not matter if mount root failed.
Adding an action which allow dracut always go ahead though failure
happens is needed by kdump.

So here add a function action_on_fail() and cmdline parameter
action_on_fail=<shell | continue>. Use action_to_fail() to replace
emergency_shell which was called after failure. By $(getarg action_on_fail=),
decide to drop into shell, or to leave away the failure and go ahead.

v3->v4:
add handling of selinux policy loaded failure, and change code format to
be consitent

Signed-off-by: Baoquan He <bhe@redhat.com>

[Edited by harald@redhat.com]
2013-04-09 11:14:08 +02:00
Baoquan He
0290e98271 Wait for logical interface to be up
If bootdev is logical interface like bond, bridge or vlan, we need
wait them up.

Signed-off-by: Baoquan He <bhe@redhat.com>
2013-04-09 10:53:08 +02:00
Harald Hoyer
d136ca4eeb network: support multiple bonding interfaces
Currently dracut only support 1 bond, namyly bond0 by default. However multiple
bonds configuration may be needed. For example in kdump, in 1st kernel, more
than one bonds may be configured, and bondX other than bond0 is used as output
interface to remote host which will store dump core. This patch can solve this
problem, to write real bond information to initramfs, 2nd kdump kernel will
use it to create the relevant bondX interface.

Tested-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Baoquan He <bhe@redhat.com>
2013-04-09 10:52:22 +02:00
WANG Chao
a55f910cf6 ifup.sh: Add support for bridge over team and vlan tagged team
Team is the same network stack as bonding. Therefore give ifup the ability to
handle bridge over team and vlan tagged team as bonding too.

Signed-off-by: WANG Chao <chaowang@redhat.com>
2013-04-09 10:52:22 +02:00
Harald Hoyer
96efbc51ac crypt/module-setup.sh: filter /etc/crypttab in host-only mode
only take those /etc/crypttab entries, which we need to boot the system
2013-04-09 10:48:26 +02:00
Harald Hoyer
9d36d4fb1d dracut-functions.sh: make use of findmnt 2013-04-09 10:47:39 +02:00
Harald Hoyer
41bfa5dad1 nfs/module-setup.sh: combine egreps for /etc/passwd and /etc/group 2013-04-05 16:34:36 +02:00
Harald Hoyer
db9fbaf9b8 TEST-99-RPM: ignore rescue images 2013-04-05 11:52:33 +02:00
Harald Hoyer
56fb5c4dbf TESTSUITE: s/i6300esbwdt/i6300esb ib700wdt/g 2013-04-05 11:07:55 +02:00
Harald Hoyer
a8986425a4 TEST-50-MULTINIC: fixup test suite
qemu of the day doesn't like multicast anymore
2013-04-05 11:07:40 +02:00
Harald Hoyer
ea3c4e8273 Add missing options to manpage and --help output
https://bugzilla.redhat.com/show_bug.cgi?id=948510
2013-04-05 09:01:48 +02:00
Harald Hoyer
6db8c5a5fe base/dracut-lib.sh:wait_for_dev()/cancel_wait_for_dev() set systemd timeouts
Set systemd unit timeouts for the devices we wait for. The systemd
default is 90 seconds, which is way too low for complicated setups.
2013-04-05 08:32:17 +02:00
Harald Hoyer
ab9b04f55b crypt/parse-crypt.sh: create udev rule for systemd
Start the systemd-cryptsetup@luks-*.service for the detected crypto_LUKS
device in the initqueue, so we block in the initqueue and wait for the
password entry.
2013-04-04 12:54:59 +02:00
Harald Hoyer
c4b572b5ca base/dracut-lib.sh: add dev_unit_name()
add helper function to convert device path to systemd unit names
2013-04-04 12:52:53 +02:00
Harald Hoyer
cc6f0925df base/init.sh: fix version output 2013-04-02 13:29:24 +02:00
Harald Hoyer
d50cf62d62 dracut.spec: Require systemd >= 199 2013-03-26 17:04:43 +01:00
Harald Hoyer
75369f8ba0 version 027 2013-03-26 16:55:03 +01:00
Harald Hoyer
8e2bcb4b42 dracut.spec: don't BuildRequire bash-completion for rhel 2013-03-26 16:54:34 +01:00
Harald Hoyer
bfac40665b systemd: add new timers.target and paths.target 2013-03-26 16:19:27 +01:00
Harald Hoyer
6c6d805765 use systemd*dir variables everywhere 2013-03-26 16:19:00 +01:00
Harald Hoyer
44f870be42 test: change qemu param -nographic to -display none for -daemonize
qemu does not like -nographic in combination with -daemonize
2013-03-26 16:17:24 +01:00
Harald Hoyer
b37398dc1c x-initrd-rootfs.mount -> x-initrd.mount 2013-03-26 15:38:50 +01:00
Harald Hoyer
1b0a362d83 multipath: install native systemd service 2013-03-25 07:58:45 +01:00
Harald Hoyer
bb425d20a1 systemd: add dracut.bootup(7) reference to service man pages 2013-03-25 07:56:12 +01:00
Harald Hoyer
cbd69dc6ff install dracut-*.service units 2013-03-25 07:56:12 +01:00
Harald Hoyer
cb8def95c4 dracut.sh: export systemdsystemconfdir 2013-03-22 09:09:10 +01:00
Harald Hoyer
78d1d4f86d dracut.sh: turn off hostonly mode, if udev database is not found 2013-03-20 10:25:23 +01:00
Harald Hoyer
5bfa3b363a dracut.sh: turn off host-only mode, if essential system filesystems not mounted 2013-03-20 10:22:41 +01:00
Harald Hoyer
1d4b337543 dracut.spec: use configure 2013-03-20 08:01:29 +01:00
Harald Hoyer
8c67d395d4 dracut.spec: use pkg-config for bashcompletiondir 2013-03-20 07:15:04 +01:00
Harald Hoyer
02566acdd7 dracut.sh: remove temporary cpio output in trap 2013-03-20 07:08:29 +01:00
Harald Hoyer
478aa7dac1 51-dracut-rescue-postinst.sh,51-dracut-rescue.install: use systemd-machine-id-setup
if /etc/machine-id is empty, use systemd-machine-id-setup
2013-03-20 07:08:29 +01:00
Harald Hoyer
967db70090 51-dracut-rescue-postinst.sh: Rename image and grub entry
grub2-mkconfig ordered the rescue entries higher than the normal ones.

https://bugzilla.redhat.com/show_bug.cgi?id=923439
2013-03-20 07:08:29 +01:00
Harald Hoyer
619c1bb334 51-dracut-rescue-postinst.sh: add extra checks 2013-03-19 16:56:56 +01:00
Harald Hoyer
57aa1e9140 TEST-40-NBD/test.sh: kill_server() after test_run() 2013-03-19 14:53:17 +01:00
Harald Hoyer
af2fcbafe8 network/netroot.sh: do not unset root 2013-03-19 14:53:09 +01:00
Harald Hoyer
7b6bdc3f94 nbd/nbdroot.sh: fix root != blockdev case 2013-03-19 12:26:06 +01:00
Harald Hoyer
db43f56d94 fs-lib/fs-lib.sh:write_fs_tab() start initrd-root-fs.target 2013-03-19 12:26:06 +01:00
Harald Hoyer
a1ebd77179 add dracut.bootup.7 man page 2013-03-19 12:26:06 +01:00
Harald Hoyer
e26d76dca1 systemd: add more ordering 2013-03-19 12:22:33 +01:00
Harald Hoyer
d59732004d drm/module-setup.sh: redirect grep to /dev/null
on some architectures, no pci devices exist
2013-03-18 14:17:19 +01:00
Harald Hoyer
a3a8f58d73 Makefile: use -D_FILE_OFFSET_BITS=64 to build dracut-install 2013-03-18 10:58:25 +01:00
Harald Hoyer
c9e5b75308 kernel-modules/module-setup.sh: don't fail hard on a missing module 2013-03-18 09:29:08 +01:00
Harald Hoyer
fd191a7b41 kernel-modules/module-setup.sh: install all host filesystem drivers
https://bugzilla.redhat.com/show_bug.cgi?id=922565
2013-03-18 08:43:23 +01:00
Harald Hoyer
e42c7a980c sosreport: mkdir /run/initramfs, if it does not exist yet 2013-03-16 10:34:20 +01:00
Harald Hoyer
85804a9197 dmsquash-live: force load squashfs kernel module
https://bugzilla.redhat.com/show_bug.cgi?id=922248
2013-03-16 10:31:37 +01:00
Harald Hoyer
ee2321c91e dracut.conf.5.asc: remove duplicated install_items 2013-03-15 16:54:38 +01:00
Harald Hoyer
11fbde4454 TEST-16-DMSQUASH: use current releasever 2013-03-15 14:41:11 +01:00
Harald Hoyer
fb05f9876a dracut-bash-completion.sh: add --kver kernel version completion 2013-03-15 10:42:18 +01:00
Harald Hoyer
7e9bfdde14 sosreport.sh: use -o short-monotonic for the journal output 2013-03-15 10:41:41 +01:00
Harald Hoyer
7e9fc37db8 dracut.spec: bump systemd version requirement 2013-03-15 07:11:17 +01:00
Harald Hoyer
bb278147cf fixed testsuite 2013-03-15 07:10:20 +01:00
Will Woods
81b676a675 fix typo in dracut.conf.5.asc
It's /etc/dracut.conf.d, not /etc/dracut/conf.d
2013-03-15 07:10:20 +01:00
Harald Hoyer
6b46e7baa0 systemd: do not use "systemd --version" until fixed 2013-03-15 07:10:20 +01:00
Harald Hoyer
85c85f07e2 systemd: switch to new initrd.target
(normal startup)
                                    :
                                    :
                                    v
                              basic.target
                                    |
             ______________________/|
            /                       |
            |                  sysroot.mount
            |                       |
            |                       v
            |             initrd-root-fs.target
            |                       |
            |                       v
            |            initrd-parse-etc.service
(custom initrd services)            |
            |                       v
            |            (sysroot-usr.mount and
            |             various mounts marked
            |               with fstab option
            |                x-initrd.mount)
            |                       |
            |                       v
            |                initrd-fs.target
            |                       |
            \______________________ |
                                   \|
                                    v
                               initrd.target
                                    |
                                    v
                          initrd-cleanup.service
                               isolates to
                         initrd-switch-root.target
                                    |
                                    v
             ______________________/|
            /                       |
            |        initrd-udevadm-cleanup-db.service
            |                       |
(custom initrd services)            |
            |                       |
            \______________________ |
                                   \|
                                    v
                        initrd-switch-root.target
                                    |
                                    v
                        initrd-switch-root.service
                                    |
                                    v
                               switch-root
2013-03-15 07:10:20 +01:00
Harald Hoyer
c853dc72e9 udev-rules/module-setup.sh: do not install /run/* 2013-03-14 18:30:35 +01:00
Harald Hoyer
18d0c9b858 nfs/nfsroot.sh: only cat /etc/fstab, if existant 2013-03-14 18:30:35 +01:00
Harald Hoyer
0a5fd0dcec iscsi/iscsiroot.sh: do not mount manually in systemd mode 2013-03-14 18:30:35 +01:00
Harald Hoyer
e0e99c59a5 ifcfg/write-ifcfg.sh: fixed typo 2013-03-14 18:30:35 +01:00
Harald Hoyer
d46394ad33 dracut.spec: fix requirements 2013-03-14 18:30:35 +01:00
Harald Hoyer
87dc81a1f6 dracut-install: handle more ldd errors 2013-03-14 18:30:35 +01:00
Harald Hoyer
ce92ca0527 51-dracut-rescue-postinst.sh: fixed new-kernel-pkg call 2013-03-14 18:30:35 +01:00
Harald Hoyer
c390590fac TODO: remove completed items 2013-03-14 18:30:35 +01:00
Radek Vykydal
fd8e4aef90 Write BOOTPROTO=ibft for ip=ibft to ifcfg files 2013-03-14 10:54:28 +01:00
Radek Vykydal
c5a742a3bf Don't write DHCPV6C=yes for each dhcp (ipv4) configuration.
Caused probably by commit 32ec0a762d
2013-03-14 10:54:28 +01:00
Harald Hoyer
fc4e10a859 shutdown/shutdown.sh: mount --move all basic mounts out of /oldroot
After mount moving /dev away, apps like plymouth can do reexec with fd
passing of devices, which they want to keep open until the very end.
2013-03-13 17:45:37 +01:00
Harald Hoyer
83bb0893ed dracut.sh: Add --noimageifnotneeded parameter
Do not create an image in host-only mode, if no kernel driver is needed
and no $initdir/etc/cmdline/*.conf is generated.
2013-03-13 14:49:20 +01:00
Harald Hoyer
8fdcc1a9b1 kernel-modules: move usb-storage out of fixed drivers 2013-03-13 14:46:39 +01:00
Harald Hoyer
a23b368c92 systemd: remove upstream renamed old service files 2013-03-13 14:45:55 +01:00
dyoung@redhat.com
bbfff3e58b Add memdebug at different points in 99base/init.sh
Previously I added several trace point to the begin of several
init hooks of systemd, old init script also need this debug info.

Doing same here as what's added in the systemd service scripts:
At cmdline hooks adding trace of "1+:mem 1+:iomem 3+:slab"
For other hooks adding trace of "1:shortmem 2+:mem 3+:slab"

Signed-off-by: Dave Young <dyoung@redhat.com>
2013-03-13 13:12:57 +01:00
dyoung@redhat.com
9c322b2f3b Improve documentation of rd.memdebug
Explain more about rd.memdebug verbose level in dracut.cmdline.7.asc.

Signed-off-by: Dave Young <dyoung@redhat.com>
2013-03-13 13:12:57 +01:00
dyoung@redhat.com
dff9a66c44 print memdebug to stderr
memory usage tracing outputs are debug info, so it should be moved to
stderr instead of stdout.

Signed-off-by: Dave Young <dyoung@redhat.com>
2013-03-13 13:12:57 +01:00
Harald Hoyer
449b0e0707 dracut-initramfs-restore.sh: also look for image in boot loader spec dir 2013-03-13 13:09:13 +01:00
Harald Hoyer
4a5a9c6d89 dracut.spec: fix requirements 2013-03-13 13:01:33 +01:00
Harald Hoyer
917f3e4d25 add dracut-bash-completion.sh 2013-03-13 13:01:33 +01:00
Harald Hoyer
7d848c55a6 dracut.sh: add --regenerate-all 2013-03-13 13:01:33 +01:00
Harald Hoyer
7d17d6c976 plymouth: do not install hooks in systemd mode 2013-03-13 13:01:20 +01:00
Harald Hoyer
b8060ef781 systemd: add sysctl.d and sysctl.conf 2013-03-13 11:37:05 +01:00
Harald Hoyer
727543c1e6 systemd: add modules-load.d modules to the initramfs 2013-03-13 11:37:05 +01:00
Harald Hoyer
c85cda9e2f systemd: local-fs.target is now root-fs.target and initrd-fs.target
Also rename dracut.target to initrd.target

see also systemd commit 700e07f
http://cgit.freedesktop.org/systemd/systemd/commit/?id=700e07f
2013-03-13 09:34:47 +01:00
Harald Hoyer
c0c6c74d99 51-dracut-rescue.install: create directory, if it does not exist 2013-03-13 09:32:14 +01:00
Harald Hoyer
d26bd6ca55 lsinitrd.sh: simplify check for boot loader spec dirs 2013-03-13 09:32:14 +01:00
Harald Hoyer
e22eb857be dracut.spec: add nohostonly and norescue subpackages
we need rpm subpackages, to be able to pull them in the installation
transaction for the initial %posttrans initramfs image creation.
2013-03-12 13:52:57 +01:00
Harald Hoyer
2fa6fd3aaa add 51-dracut-rescue-postinst.sh
also fixup 51-dracut-rescue.install to read in dracut conf
2013-03-11 18:58:32 +01:00
Harald Hoyer
dd5875499e dracut.sh: add swap partitions to host-only setup 2013-03-11 18:58:32 +01:00
Harald Hoyer
d351541ee6 make host_fs_types a hashmap
This requires bash >= 4, but hash maps are so much more comfortable
2013-03-11 18:58:32 +01:00
Harald Hoyer
d928724c3c lsinitrd.sh: removed trailing "}" 2013-03-11 15:46:37 +01:00
Harald Hoyer
727e68d0b5 lsinitrd.sh: fix for default initrd not found, but image given 2013-03-11 15:13:02 +01:00
Harald Hoyer
8d28614e4f 51-dracut-rescue.install: do not unset installonly on remove 2013-03-11 15:12:49 +01:00
Harald Hoyer
fba5fbbdad dracut.spec: add rescue module 2013-03-09 15:32:32 +01:00
Harald Hoyer
d008b6b89f dracut.sh: move cleanup trap, just after mktemp 2013-03-09 15:31:09 +01:00
Harald Hoyer
aede120c92 add rescue dracut module 2013-03-09 15:17:26 +01:00
Harald Hoyer
cc2303001e dracut.sh: add new default path to initramfs according to bootloader spec
see kernel-install(8) and
http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec
2013-03-09 15:17:26 +01:00
Harald Hoyer
54e7d7c32d dracut.sh: remove (default) marker in --help 2013-03-09 15:17:26 +01:00
Harald Hoyer
bcd352dfa1 fedora.conf.example: make hostonly default for fedora 2013-03-09 15:17:26 +01:00
Harald Hoyer
d837ac3984 add /lib/kernel/install.d/51-dracut-rescue.install
Upon installation of a kernel, check if a rescue image is already
available and if not, create a non-hostonly generic initramfs image with
the rescue module added.
2013-03-09 15:16:31 +01:00
Harald Hoyer
900e15da34 systemd/module-setup.sh: call systemd in private dir for version 2013-03-08 11:50:03 +01:00
Harald Hoyer
19d69051a3 NEWS: dracut-026 2013-03-08 07:07:48 +01:00
Harald Hoyer
31737a05e1 systemd: add version check in install() 2013-03-08 07:07:01 +01:00
Harald Hoyer
1161f03777 fips: add lzo module 2013-03-08 07:05:55 +01:00
Harald Hoyer
cf24ac8c19 crypt, dmraid, mdraid: use for_each_host_dev_and_slaves_all()
To catch _all_ UUIDs and not only the first one, use
for_each_host_dev_and_slaves_all
2013-03-07 16:00:00 +01:00
Harald Hoyer
af3ef92a6b dmsquash-live: add iso9660 kernel module 2013-03-07 15:49:24 +01:00
Harald Hoyer
c46cda8260 split 95udev-rules/59-persistent-storage.rules to md and dm modules 2013-03-07 15:01:47 +01:00
Harald Hoyer
34bd2be23f dracut-functions.sh: fix inst_rule_programs()
Logic for the $env{.*} check was reversed and env was missing.

Thanks Colin Guthrie!
2013-03-07 15:01:47 +01:00
Harald Hoyer
c3dd68fcf1 iscsi: run iscsiroot even if no network configured
Also inject finished hooks for every iscsiroot netroot
2013-03-07 14:17:49 +01:00
Harald Hoyer
3e35441f18 kernel-modules: better match for arm architecure 2013-03-07 14:17:33 +01:00
Harald Hoyer
dde2db3da9 lsinitrd: use /boot/<machine-id>/<kernel-version>/initrd as the default image
if /boot/<machine-id> exists; then
use /boot/<machine-id>/<kernel-version>/initrd as the default image;
else fallback to /boot/initramfs-<kernel-version>.img
2013-03-07 13:03:24 +01:00
Harald Hoyer
cbc21754e5 kernel-modules: move some kernel modules out of unconditional install 2013-03-07 12:10:53 +01:00
Harald Hoyer
eb2dc8c34b systemd: add missing dracut-mount.service dracut-pre-mount.service 2013-03-07 11:47:00 +01:00
Harald Hoyer
c4e098a514 document /usr/lib/dracut/dracut.conf.d 2013-03-07 11:44:44 +01:00
Harald Hoyer
72875215a3 dracut.conf: move default settings to distro example 2013-03-07 11:44:16 +01:00
Harald Hoyer
335bc217b3 dracut.sh: rename source_dirs_prio() to dropindirs_sort() 2013-03-07 11:43:52 +01:00
Harald Hoyer
510aecdbd8 systemd: add missing dracut-mount.sh dracut-pre-mount.sh dracut.target 2013-03-07 10:35:06 +01:00
Harald Hoyer
9dd9d81fc6 add 50-dracut.install 2013-03-07 10:08:35 +01:00
Harald Hoyer
a5b48ce798 add systemd-bootchart module 2013-03-07 09:56:30 +01:00
Harald Hoyer
59afbd8e73 add missing systemd service man pages 2013-03-07 09:42:00 +01:00
Harald Hoyer
348baca3e4 dracut.conf.d/fedora.conf.example: turn off rd.auto
realinitpath is not needed anymore for systemd >= 198
2013-03-06 17:29:12 +01:00
Harald Hoyer
83691c413f testsuite fixup 2013-03-06 17:29:12 +01:00
Harald Hoyer
ca36b9b8f8 base: save host_devs which we need bring up and process them with wait_for_dev 2013-03-06 17:29:12 +01:00
Harald Hoyer
a9c7dc74c4 base: in systemd mode parse-root-opts.sh is in the services 2013-03-06 17:29:12 +01:00
Harald Hoyer
ce862de624 base/dracut-lib.sh: reset /etc/profile 2013-03-06 17:29:12 +01:00
Harald Hoyer
500861cd05 base/init.sh: reset main loop counter, if work is in initqueue 2013-03-06 17:29:12 +01:00
Harald Hoyer
44d26d9209 base/dracut-lib.sh: extend wait_for_dev() for systemd 2013-03-06 17:29:12 +01:00
Harald Hoyer
35270e34d0 rootfs-block/parse-block.sh: wait_for_dev 2013-03-06 17:29:12 +01:00
Harald Hoyer
fe654ff0aa usrmount: in systemd mode, functionality is in systemd 2013-03-06 17:29:12 +01:00
Harald Hoyer
5e1e1ec060 iscsi, nbd: call write_fs_tab() and write /etc/fstab 2013-03-06 17:29:12 +01:00
Harald Hoyer
2673ff1932 rootfs-block: in systemd mode, functionality is in the dracut services 2013-03-06 17:29:11 +01:00
Harald Hoyer
e8f7ea6794 resume: generate rules already in parse-resume.sh 2013-03-06 17:29:11 +01:00
Harald Hoyer
3899211bfc resume: in systemd mode move functionality in the dracut services 2013-03-06 17:29:11 +01:00
Harald Hoyer
6e0c1c448d nfs/nfsroot.sh: trigger nfs mount with cat'ing /etc/fstab
otherwise the whole nfs communication can take too long for the
systemd-fstab-generator
2013-03-06 17:29:11 +01:00
Harald Hoyer
6ae68b4674 kernel-modules: handle rd.driver.* in systemd mode in dracut-pre-udev 2013-03-06 17:29:11 +01:00
Harald Hoyer
41eba87b32 dracut_need_initqueue 2013-03-06 17:29:11 +01:00
Harald Hoyer
a1084c02fd fs-lib/fs-lib.sh: add write_fs_tab() 2013-03-06 17:29:11 +01:00
Harald Hoyer
5ac8420abc crypt/parse-crypt.sh: don't generate luks rules in systemd mode 2013-03-06 17:29:11 +01:00
Harald Hoyer
24d009507f btrfs: no need for btrfs_timeout in systemd mode 2013-03-06 17:29:11 +01:00
Harald Hoyer
e9020221a7 crypt: do not cleanup in systemd mode 2013-03-06 17:29:11 +01:00
Harald Hoyer
b59e9e5724 network/netroot.sh: remove the dhcp finished hook, if we have a handler 2013-03-06 17:22:09 +01:00
Harald Hoyer
b5859d6359 i18n: no manual setup needed if systemd is in the game 2013-03-06 17:22:09 +01:00
Harald Hoyer
dbfaae0e34 systemd: changes for new initrd services
Requires systemd >= 198
2013-03-06 17:21:47 +01:00
Harald Hoyer
8d85429a44 dracut-functions.sh: add dracut_need_initqueue() dracut_module_included()
for all rules files, which reference initqueue also call
dracut_need_initqueue()
2013-03-06 16:04:03 +01:00
Harald Hoyer
3e4ab73cd4 test: make testsuite work with systemd 2013-03-02 13:27:08 +01:00
Harald Hoyer
4e32b2e916 test: removed unused cryptroot-ask.sh scripts 2013-03-02 13:22:29 +01:00
Harald Hoyer
356333b331 test: add finished-false.sh for create-root.sh initqueue job 2013-03-02 13:20:59 +01:00
Harald Hoyer
f62f3a2191 reset initqueue loop counter only if new uevents exist 2013-03-02 13:19:20 +01:00
Harald Hoyer
389333396a resume: move resume hook from mount to pre-mount 2013-03-02 13:11:38 +01:00
Harald Hoyer
cfb7410cd0 mdraid/mdraid_start.sh: remove mdmon workaround 2013-03-02 13:10:57 +01:00
Harald Hoyer
f672b1c399 btrfs/btrfs_timeout.sh: do not "exit 0" 2013-03-02 13:10:04 +01:00
Harald Hoyer
f12f694355 btrfs: Use upstream 64-btrfs.rules 2013-02-22 11:14:04 +01:00
Lars R. Damerow
9a9c6e1256 dracut: write initramfs to temp file then move into place
We've been finding cases where multiple instances of dracut can be launched
simultaneously, resulting in a corrupted initramfs file. This patch makes
dracut write the initramfs to a new file, then move it into place atomically.
2013-02-22 11:05:29 +01:00
Harald Hoyer
9c65c125a9 systemd: change path of switch-root.conf
we do not have to clean it up for /etc/switch-root.conf
2013-02-21 12:18:21 +01:00
Harald Hoyer
7d4d3f8da6 lvm/module-setup.sh: use for_each_host_dev_and_slaves_all
Use for_each_host_dev_and_slaves_all to get all lvm setups for the
host-only case.

Thanks to Olivier Thauvin
2013-02-21 12:13:56 +01:00
Harald Hoyer
569ffe77bf systemd: add systemd-modules-load.service and hook dirs 2013-02-21 12:13:09 +01:00
Harald Hoyer
a42b2b8133 introduce /usr/lib/dracut/dracut.conf.d/ drop-in directory
/usr/lib/dracut/dracut.conf.d/*.conf can be overwritten by the same
filenames in /etc/dracut.conf.d.

Packages should use /usr/lib/dracut/dracut.conf.d rather than
/etc/dracut.conf.d. /etc/dracut.conf.d belongs to the system
administrator.
2013-02-19 17:46:24 +01:00
Harald Hoyer
31ba4de21d url-lib/url-lib.sh: remove bashism
remove the forgotten bashism "+="
2013-02-19 16:13:49 +01:00
Stefan Reimer
a005c47763 base/init.sh: create /run/log
If the systemd module is not used /run/log is not created which results
in dangeling softlink from /var/log which causes stuff to fail.
2013-02-18 12:05:23 +01:00
Harald Hoyer
5db6ca5a4b dracut: enable initramfs building without kernel modules 2013-02-18 12:03:02 +01:00
Harald Hoyer
1a6fdf2417 btrfs: use "btrfs device ready" 2013-02-18 11:58:11 +01:00
Harald Hoyer
27a2c3a406 systemd: services got renamed 2013-02-14 12:32:12 +01:00
Harald Hoyer
b347edfa23 dracut-emergency.service: wants systemd-vconsole-setup.service 2013-02-14 12:32:04 +01:00
Colin Guthrie
3ed09d970e resume: Ensure we remove the timout job when we find the resume device 2013-02-13 17:46:24 +01:00
Thomas Backlund
a28e2aeefe kernel-modules: Add ehci support for kernel 3.8+
Kernel 3.8 split ehci-hcd into ehci-hcd, ehci-pci and ehci-platform,
so adapt the list to cope with this change.
2013-02-13 17:42:32 +01:00
Wim Muskee
c6a71c7b8a make nbd port check more robust
The following change makes the check for the nbd port or named export
more robust.
I wasn't sure whether to include sed in the dracut_install() of
module-setup.sh since net already does that (and nbd depends on that).
2013-02-11 15:44:11 +01:00
Harald Hoyer
6ecb9a2d68 url-lib/url-lib.sh: add proxy support for curl 2013-02-11 13:56:04 +01:00
Harald Hoyer
918a6874df url-lib/url-lib.sh: remove bashisms 2013-02-11 13:55:44 +01:00
Harald Hoyer
2663232a01 systemd/dracut-initqueue.sh: call udevadm settle directly 2013-02-11 11:49:19 +01:00
Harald Hoyer
cebab07e68 systemd/dracut-initqueue: run after cryptsetup.target 2013-02-11 11:49:19 +01:00
Harald Hoyer
a04f3077cd systemd/dracut-pre-pivot.sh: remove /dev/root symlink after shell 2013-02-11 11:49:19 +01:00
Harald Hoyer
04b873598b systemd: set udev debug/info via config file and report obsolete options 2013-02-11 11:49:19 +01:00
Harald Hoyer
22137f9cac systemd/dracut-pre-trigger.sh: enable rd.break=pre-trigger debug shell 2013-02-11 11:49:19 +01:00
Harald Hoyer
54665349ec systemd/dracut-cmdline.sh: create /run/log subdir 2013-02-11 11:49:19 +01:00
Harald Hoyer
f251a89772 systemd/dracut-pre-trigger.service: load service on demand 2013-02-11 11:49:19 +01:00
Harald Hoyer
fbdfa57746 systemd/dracut-pre-udev.service: load service on demand 2013-02-11 11:49:19 +01:00
Harald Hoyer
6b095274fb systemd: trigger systemd-vconsole-setup.service only on demand 2013-02-11 11:49:19 +01:00
Harald Hoyer
11174408e8 systemd/dracut-initqueue.sh: replace $UDEV_QUEUE_EMPTY
for systemd-udevd the version of udevd is high enough
2013-02-11 11:49:19 +01:00
Harald Hoyer
c2117747fd virtfs: add virtio_pci kernel module 2013-02-11 11:49:19 +01:00
Harald Hoyer
4f6e293308 udev-rules: modify udev rules on initramfs creation time 2013-02-11 11:49:19 +01:00
Harald Hoyer
d9076cac19 btrfs/btrfs_finished.sh: use btrfs device ready for probing 2013-02-08 16:52:38 +01:00
Harald Hoyer
ff52ca1b57 btrfs/80-btrfs.rules: remove modprobe of btrfs module
this should be automatically modprobed by the kernel on demand
2013-02-08 16:52:38 +01:00
Harald Hoyer
8a3c4957fc drm/module-setup.sh: make drm module only install on dependency 2013-02-08 16:52:38 +01:00
Harald Hoyer
3f54a83ca8 dracut.sh: make /var/log a symlink to /run/log 2013-02-08 16:52:38 +01:00
Harald Hoyer
7fa3b9e376 url-lib/url-lib.sh: turn off curl globbing
https://bugzilla.redhat.com/show_bug.cgi?id=907497
2013-02-08 16:52:38 +01:00
Harald Hoyer
39135af155 network/ifup.sh: echo in get_vid() instead of using the return value
The return value is module 256, so VLAN ids > 255 could not be returned.
2013-02-08 16:52:38 +01:00
Dan Horák
02640e8e65 set peer for point-to-point connections
network/net-lib.sh: only set net vars, if they have a value
2013-02-08 16:52:30 +01:00
Frederick Grose
579f385384 Provide devices to enable booting with rd.live.overlay.readonly=1 2013-02-06 13:52:30 +01:00
Kevin Yung
56d60c4b2d network/ifup.sh: enable bridged vlan interfaces
To use vlan for net boot, you need to specify vlan and ip kernel options
for the boot interface. For example,

 vlan=eth1.1:eth1 bootdev=eth1.1
 ip=1.2.3.4:1.2.3.4::255.255.255.0:my-hostname:eth1:none

To use bridge for net boot, you need to specify bridge and ip kernel
option for the boot interface. For example

 bridge=br1:eth1 bootdev=br1
 ip=1.2.3.4:1.2.3.4::255.255.255.0:my-hostname:eth1:none

In my environment, I needs to boot machines from network within
a vlan or on a bridged network.	I found curent dracut release
if-up.sh script in 40network module bypass ip setting for both
bridge and vlan interface.
2013-02-06 13:52:30 +01:00
Dan Horák
62fd2b3644 fix CTC example in rd.znet
The CTC interface uses 2 channels.
2013-02-06 13:52:30 +01:00
Colin Guthrie
cd9072d342 Mount /proc before including dracut-lib.sh.
When dracut-lib.sh is sourced it checks the command line (when not using systemd)
as part of the check_quiet() call.

Therefore mount /proc earlier in init.

Avoids the error:

init: 77: /lib/dracut-lib.sh: /proc/cmdline: No such file or directory
2013-02-06 13:52:30 +01:00
Harald Hoyer
19bab59c48 dracut.sh: reverting return value change
reverting _get_fs_type() return values of patch
c8d685c9d3
2013-02-05 16:45:42 +01:00
Harald Hoyer
d8b627b9dc shutdown: call "losetup -D" on shutdown 2013-02-05 11:04:02 +01:00
Harald Hoyer
6320d072a1 mdmon: renamed mdmon-offroot@.service to mdmon@.service 2013-02-05 10:58:06 +01:00
Harald Hoyer
7abeb49878 TODO: updated 2013-02-05 10:58:05 +01:00
Harald Hoyer
14fcfbec3e network/net-genrules.sh: remove some bashisms 2013-01-30 17:22:25 +01:00
Joe Lawrence
fa9f15e3be Support out-of-tree and updated drivers in initramfs creation
The find_kernel_modules_by_path function shouldn't filter out modules not
located underneath the /lib/modules/ver/kernel directory as out-of-tree
drivers may reside in /lib/modules/ver/extra and updated drivers in
/lib/modules/ver/updates.

Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com>
2013-01-25 13:07:59 +01:00
Harald Hoyer
ae4758ce0d rootfs-block/mount-root.sh: fixup for 8b6bf0ef5
not only fix the warning message, but the real mount arguments, too
2013-01-23 16:24:33 +01:00
Harald Hoyer
66f01450a8 NEWS: update for version 025 2013-01-23 16:12:18 +01:00
Harald Hoyer
e5786ed1b7 version 025 2013-01-23 15:38:48 +01:00
Harald Hoyer
b47517140b dracut.spec: add drm module 2013-01-23 15:38:48 +01:00
Colin Guthrie
3de6001e1e Include crc32c module for xfs.
Just like btrfs, xfs now requires CRC module that cannot be resolved via
normal module resolving.

Move this hack into fs-lib and remove it from btrfs module.

https://bugs.mageia.org/show_bug.cgi?id=8676
2013-01-23 15:24:27 +01:00
Harald Hoyer
c8d685c9d3 dracut-functions.sh: cope with optional field #7 in mountinfo
also handle fstab entries with LABEL=, UUID= and PARTUUID=
2013-01-23 15:24:27 +01:00
Harald Hoyer
d6d3173916 network/dhclient-script.sh: also touch "/tmp/setup_net_<mac>.ok" 2013-01-23 15:24:27 +01:00
Harald Hoyer
8b6bf0ef57 romount fix 2013-01-23 15:24:27 +01:00
Dave Young
7bd8f23303 Add memory usage trace to diffrent hook points
Hi, Here is an update of this patch, fixed the local variable issue.
2013-01-23 15:24:27 +01:00
dyoung@redhat.com
a08ea34aba add function getargnum
For cmdline argument with numeric value, add a new function getargnum
It will get proper value with default value as $1, min value as $2,
max value as $3, and param name as $4. valid result will be echo to stdout.
for nul or value not valid it will just echo the default value.
Note: The values should be >=0

[v1->v2]: add arg <minval>
[v2->v3]: do not use bash string match =~

Signed-off-by: Dave Young <dyoung@redhat.com>
2013-01-23 15:24:27 +01:00
Dave Young
6cb77ea91f use linkup in dhclient-script.sh
linkup is a wrapper function for waiting interface ready and up.
change to use linkup as what we do in ifup script.

Signed-off-by: Dave Young <dyoung@redhat.com>
2013-01-23 15:24:27 +01:00
Colin Guthrie
c586b033a7 Extend 52f1b041 to allow devices to be specified in config files as well as cmdline.
This also changes the command line switch to be --add-device and the
config directive is set to add_device. This was chosen as device= in the
config file seems too generic and not quite as consistent with other
directives (i.e. drivers/add_drivers)

The --device command line is still supported but it should be considered
deprecated in favour of --add-device.
2013-01-23 15:24:27 +01:00
Jiri Pirko
a9f634f815 fix teamd exec in case config does not include devname
In case that configuration file did not include name of team device,
teamd would not start. Fix this by adding "-t" parameter.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-01-23 15:24:27 +01:00
Harald Hoyer
551c2dd71f shutdown: kill all processes and report remaining ones 2013-01-22 15:31:45 +01:00
Harald Hoyer
ffc4f173b6 mdraid: add mdmon-offroot@.service and takeover mdmon in shutdown 2013-01-22 15:31:41 +01:00
Harald Hoyer
ebd1d65a1b shutdown: source pre-shutdown hook and force quit plymouth before umount 2013-01-22 15:31:22 +01:00
Harald Hoyer
5b68300899 dracut-lib.sh: force hide plymouth in shutdown emergency shell 2013-01-22 15:31:19 +01:00
Harald Hoyer
2b6dd6a1fc dracut-functions.sh: add pre-shutdown hook 2013-01-22 15:31:16 +01:00
Harald Hoyer
1d22c670b0 dracut.asc: document shutdown procedure 2013-01-18 10:13:14 +01:00
Harald Hoyer
0ae480dcbf dracut.asc: s/rd.ip/ip/g 2013-01-07 18:00:06 +01:00
Harald Hoyer
256cba18c3 dracut-functions.sh: fixed inst_rules search path 2013-01-03 09:29:05 +01:00
Harald Hoyer
e6fcec9173 usrmount/mount-usr.sh: filter "subvol=" from root rflags
https://bugzilla.redhat.com/show_bug.cgi?id=890577
2013-01-02 14:06:44 +01:00
Harald Hoyer
1db3d2615d kernel-modules: create /etc/modprobe.d if it does not yet exist
https://bugzilla.redhat.com/show_bug.cgi?id=873220
2013-01-02 13:57:40 +01:00
Harald Hoyer
5204d1d36d dmsquash-live: fixed checkisomd5 service call 2013-01-02 13:56:27 +01:00
dyoung@redhat.com
3fa59d171d Wait for interface up at the early stage
In case long delay of network driver initqueue will exit before net dev is
ready. We have no chance to setup it then.
For dhcp, when we finish the setup there will be a setup_net_<dev>.ok. Doing
same for static ip case. Also add a check to initqueue when we generate udev
rules to ensure it's early enough.

[v1->v2]: only wait for bootdev or it's possible to cause boot fail for
waiting for non-bootdev. For example bond0->eth0, set bond0 as bootdev and
dhcp, we only need to wait bond0 setup ok.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:09:00 +01:00
dyoung@redhat.com
d7264a3cc0 Get ifaces for udev rule use
In case BOOTIF is not set and IFACES are not set in bonding/vlan/bridge code,
net-genrule.sh will fall to bring up all net interfaces.

Here add a failsafe option to read IFACES from /tmp/net.ifaces

[v1->v2]: move IFACES reading from net.ifaces after bonding/vlan/bridge info
code chunks.
[v2->v3]: [ -n "$IFACES" ] should be  [ -z "$IFACES" ]

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:08:59 +01:00
dyoung@redhat.com
9078167927 Wait for link ready before use the interface
Some network driver will take long time to initialize. We have an example
in a HP machine which take about one minute for this. The callback such as
"ip link set <dev> up" will fail, afterwards setup for network will also
fail.

Fix this by add a new function wait_for_if_link, wait the link ready before
use it.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:08:59 +01:00
dyoung@redhat.com
3bd7fba7af Change to use linkup function in network scripts
Update ifup.sh and fcoe-up.sh, use linkup function instead of directly
call ip command.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:08:59 +01:00
dyoung@redhat.com
b455451f49 Add function linkup
set link up usually include two steps, ip link set <dev> up and
wait_for_if_up <dev>. Now do these two steps in one function linkup.
Later patch will add other code into it.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:08:59 +01:00
dyoung@redhat.com
efa5eb424d Move wait for if functions to net lib
net-lib.sh are created for net related functions, move the wait_for_if* to
net-lib.sh naturally.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:08:59 +01:00
Cong Wang
3baa150bd4 dracut: add team device support
V2: merge patch 2/2
    fix active-backup mode by adding slaves one by one
    sync with the latest teamd
    improve the comments
    wait for team ports to come up
    install /etc/libnl/classid too

This patch adds the initial support for team device [1].
A new cmdline team= is introduced for it.

Note, currently we don't support stacked devices
on/under team, it is tricky and can be added on request.

1. http://www.libteam.org/

Cc: Harald Hoyer <harald@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Cong Wang <amwang@redhat.com>
2012-12-14 09:06:51 +01:00
Harald Hoyer
43cc4d84bc change for "udevadm control": s/--reload-rules/--reload/g 2012-12-14 09:04:56 +01:00
Harald Hoyer
6b84015e67 iscsi/iscsiroot.sh: reload rules after adding 99-iscsi-root.rules 2012-12-14 09:04:56 +01:00
Harald Hoyer
60bbb8fcc9 cms/cms-write-ifcfg.sh: also fill in /etc/hostname 2012-12-14 09:04:56 +01:00
Harald Hoyer
16c84f2873 udev-rules/udev-rules-prepare.sh: get UDEVVERSION, if unset 2012-12-14 09:04:56 +01:00
Amadeusz Żołnowski
579238a3ac Fallback to external blkid and path_id in udev rules for <udev-176.
Starting with commit 24a38bc1cb dracut
uses udev builtins but still depends on >=udev-166 in dracut.spec.  This
patch makes dracut work with older udev again.

All credits go to Alexander Tsoy <alexander@tsoy.me>; see

  https://bugs.gentoo.org/show_bug.cgi?id=437700
2012-12-14 09:04:56 +01:00
Harald Hoyer
2b5cd3dbf8 nfs/nfsroot-cleanup.sh: mount --bind instead of --move 2012-12-14 09:04:55 +01:00
Harald Hoyer
3d8a164d0e dracut.spec: add iputils and iproute requirement for dracut-network 2012-12-14 09:04:55 +01:00
Nicolas Chauvet
00ae54f00a Fix rd.blacklist.driver when no /etc/modprobe.d exists
This bug was reported as http://bugzilla.redhat.com/873220#c2

As the /etc/modprobe.d isn't created in the boot process
nor bundled within the initramfs, the initramfsblacklist.conf
cannot be created.

Instead, the /usr/lib/modprobe.d directory is available and using it
will restore the blacklist behavior.
2012-12-14 09:04:55 +01:00
Will Woods
488d55c546 add 'swapoff' to initramfs to fix shutdown/reboot
systemd shutdown/reboot won't work unless 'swapoff' is available.
2012-12-14 09:04:55 +01:00
Will Woods
9d6165f235 drop NEWROOT from module-setup.sh
This was almost certainly copy-pasted from mount-root.sh, but it's not
valid here - dracut doesn't use NEWROOT outside of the initramfs.
2012-12-14 09:04:55 +01:00
Dave Young
2258f00e91 split plymouth module
Kdump module will need the drm and kms kernel modules so user can see the
emergency shell at least.

Fix this by split 50plymouth module to 50drm and 50plymouth. Moving the
installkernel part to 50drm so user can use drm directly without adding
extra plymouth utils.

Signed-off-by: Dave Young <dyoung@redhat.com>
Tested-by: Chao Wang <chaowang@redhat.com>
2012-12-14 09:04:55 +01:00
Harald Hoyer
2bac2d6d76 systemd/dracut-cmdline.service: run before systemd-vconsole-setup
cmdline does generate vconsole.conf, which is needed by vconsole-setup
2012-12-14 09:04:55 +01:00
Harald Hoyer
b6b895bab5 systemd/service-to-run.sh: silence "cp" errors 2012-12-14 09:04:55 +01:00
Harald Hoyer
fdeae2a3ac crypt/crypt-run-generator.sh: do not timeout for LUKS passwords with systemd 2012-12-14 09:04:55 +01:00
Harald Hoyer
040f388331 dmsquash-live: add systemd checkisomd5 service 2012-12-14 09:04:55 +01:00
Harald Hoyer
7990578443 network: fixed MAC address assignment 2012-11-26 13:49:38 +01:00
Harald Hoyer
528ae4f46c systemd/module-setup.sh: turn off RateLimit for the journal 2012-11-26 13:49:19 +01:00
Harald Hoyer
0fb7b847c5 cms/cmssetup.sh: sync udev rules names with network/net-genrules.sh
https://bugzilla.redhat.com/show_bug.cgi?id=825199
2012-11-22 12:32:19 +01:00
Harald Hoyer
a67a6f957d nfs/nfs-start-rpc.sh: prevent mount error, if sunrpc kernel module is not in the initramfs
https://bugzilla.redhat.com/show_bug.cgi?id=870632
2012-11-22 12:29:43 +01:00
Harald Hoyer
965edeb63b i18n/parse-i18n.sh: fix locale.conf caused by 4dbc1d1bb3
https://bugzilla.redhat.com/show_bug.cgi?id=870632
2012-11-22 11:59:10 +01:00
Harald Hoyer
329bbd797f crypt/crypt-run-generator.sh: fixup last commit 065fc56ab2 2012-11-21 16:36:37 +01:00
Robert Buchholz
065fc56ab2 Make short uuid specification for allow-discards work
1) strstr " $discarduuids " did not remove the optional
'luks-' prefix from the argument as the documentation says.

2) The lookup seems backwards. $luksdev ($luks in the other code copy)
is the full uuid and thus one should check whether the user-supplied
argument (short form) is contained therein, not the other way around.

Before this commit, the only way to trigger allow-discards was to
specify the full uuid without the 'luks-' prefix.
2012-11-21 16:01:45 +01:00
Harald Hoyer
64d144aece Add sosreport script and generate /run/initramfs/sosreport.txt 2012-11-21 14:17:43 +01:00
Harald Hoyer
2d9b156e9e dracut.sh: do not strip signed kernel modules
https://bugzilla.redhat.com/show_bug.cgi?id=873796
2012-11-21 14:07:32 +01:00
Harald Hoyer
2b9be6f707 [nfs|cifs]root.sh: make "/dev/root" a symlink, so it gets cleaned up later on 2012-11-19 17:03:55 +01:00
Harald Hoyer
b26897fb60 dracut.sh: only 'warn' not 'error', if we don't strip 2012-10-19 11:20:30 +02:00
WANG Chao
8bf25df640 40network/ifup.sh: do_static() and do_ipv6auto return 0 if no errors.
Commit a0be1ed removes some lines from do_static() and do_ipv6auto().

When $hostname is empty, do_static() and do_ipv6auto() will return 1
and fails to run setup_net at the last of ifup.sh

Signed-off-by: WANG Chao <chaowang@redhat.com>
2012-10-19 11:10:52 +02:00
Harald Hoyer
e743cfdd4b dracut.conf.d/fedora.conf.example: s/kernelcmdline/kernel_cmdline 2012-10-19 11:10:03 +02:00
Harald Hoyer
636e5cd2d5 dracut.sh: only save $kernel_cmdline, if set 2012-10-19 11:09:38 +02:00
Harald Hoyer
f046336c44 version 024 2012-10-16 16:31:06 +02:00
Harald Hoyer
665b7e58ba TEST-04-FULL-SYSTEMD: fixed poweroff 2012-10-16 16:20:33 +02:00
Harald Hoyer
1391a06d80 AUTHORS: update 2012-10-16 16:19:51 +02:00
Harald Hoyer
404815eaf0 prelink and preunlink (for FIPS) in the initramfs
also hardlink before strip
2012-10-16 14:57:09 +02:00
Harald Hoyer
6c128565b1 strip initramfs binaries by default (not all for FIPS) 2012-10-16 14:55:45 +02:00
Harald Hoyer
e1cb85802b Makefile: cleanup xml files 2012-10-16 14:51:42 +02:00
Radek Vykydal
cbd60fcaaf Do not overwrite ifcfg files generated by Anaconda kickstart (#865192) 2012-10-16 14:43:13 +02:00
Harald Hoyer
28a88b6886 fcoe/fcoe-up: sleep for 3s to allow dcb negotiation
https://bugzilla.redhat.com/show_bug.cgi?id=813057
2012-10-16 13:25:10 +02:00
Harald Hoyer
7081e99735 network/parse-ip-opts.sh: relax bootdev handling 2012-10-16 13:21:14 +02:00
Harald Hoyer
dc67eda6bf combine some instmods 2012-10-16 13:16:53 +02:00
Harald Hoyer
b85f723535 udev-rules: do not install all /etc/group 2012-10-16 13:16:18 +02:00
Harald Hoyer
9ff9dde8d7 virtfs: only install by default, if virt environment detected 2012-10-16 13:15:40 +02:00
Harald Hoyer
8714280104 only install /etc/modprobe.d for hostonly 2012-10-16 13:15:21 +02:00
Harald Hoyer
6d70aa7836 lsinitrd.sh: sort by filename 2012-10-16 10:25:10 +02:00
Harald Hoyer
14986b9d58 dracut.cmdline.7.asc: document rd.ctty 2012-10-16 09:40:32 +02:00
Canek Peláez Valdés
e5c9bc1198 Don't install FONT if it's the same as DEFAULT_FONT.
If the user defines FONT in /etc/vconsole.conf as the same font
defined in DEFAULT_FONT, when creating her initd she will get a
message similar to this one:

gzip: /var/tmp/initramfs.wzl9Qt/usr/share/consolefonts/LatArCyrHeb-16.psfu
already exists; do you wish to overwrite (y or n)?

Signed-off-by: Canek Peláez <canek@ciencias.unam.mx>
2012-10-16 09:38:17 +02:00
dyoung@redhat.com
fc9bc6f8db ssh-client: remove ctty related check
cttyhack was removed and ctty is supported by default, so no need to
check it in ssh-client module any more.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-10-16 09:38:17 +02:00
Harald Hoyer
c62b94614d dracut-functions.sh: don't ask question on gzip uncompress 2012-10-16 09:37:49 +02:00
Harald Hoyer
833685ded5 dracut.cmdline.7.asc: add warning about passwords on the kernel cmdline 2012-10-10 15:56:21 +02:00
Harald Hoyer
3cff5fb56f dracut*.asc: add documentation about /etc/cmdline.d/*.conf 2012-10-10 15:25:48 +02:00
Harald Hoyer
3e6dad37c4 Makefile: use fedora css for documentation 2012-10-10 14:32:18 +02:00
Harald Hoyer
600c876968 consistently lowercase "dracut" 2012-10-10 14:15:11 +02:00
Harald Hoyer
cc68f78d92 TEST-04-FULL-SYSTEMD/test.sh: fixed $kernel var 2012-10-10 14:14:31 +02:00
Harald Hoyer
48ca487621 install virtio* modules in the generic case
https://bugzilla.redhat.com/show_bug.cgi?id=864012
2012-10-09 17:44:29 +02:00
Brian C. Lane
13cb578a37 Add rd.noverifyssl argument (#852229)
This adds --insecure to the curl args so that self-signed certificates
will be accepted.
2012-10-09 17:37:29 +02:00
Harald Hoyer
df2afa9ff4 test: disable systemd for encryption 2012-10-09 16:46:46 +02:00
Harald Hoyer
76d5c79e9c dracut-functions.sh: inst_rules_program() skip udev vars ${} 2012-10-08 15:39:23 +02:00
Harald Hoyer
fdf2b152e5 i18n/parse-i18n.sh: correctly populate /etc/vconsole.conf 2012-10-08 15:38:41 +02:00
Harald Hoyer
178c189b0b shutdown/shutdown.sh: failsafe shutdown for kexec
copy kexec from the real root, if it is not found in the unpacked
initramfs for shutdown.

Also drop to an emergency shell, if we can't do the ACTION
2012-10-08 15:37:04 +02:00
Harald Hoyer
14be3b16cd TEST-20-NFS/test.sh: reformat 2012-10-08 15:36:41 +02:00
Harald Hoyer
2e111dd57a TEST-50-MULTINIC/test.sh: fix multinic issues 2012-10-08 15:35:57 +02:00
Dave Young
06e9f8870a return proper value in function dracut_install
dracut_install should return the real return value, so module install function
can detect the install failure.

Such as below in 99base:
dracut_install switch_root || dfatal "Failed to install switch_root"

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-10-08 06:17:28 -04:00
Amadeusz Żołnowski
7e0d508002 dracut-functions.sh: find_binary: path starting with variable
Credits go to Alexander Tsoy <bugs+gentoo@puleglot.ru> who provided the
patch with following explanation:

  I get messages "Skipping program $env{DM_SBIN_PATH}/..." when
  generating initramfs. This happens because some udev rules contains
  variables in path to command:

  $ egrep -r 'IMPORT\{program\}=\"\$' /lib64/udev/rules.d/
  /lib64/udev/rules.d/10-dm.rules:ENV{DM_COOKIE}=="?*", IMPORT{program}="$env{DM_SBIN_PATH}/dmsetup udevflags $env{DM_COOKIE}"

  [...]

  $ sudo dracut -f "" 3.5.4-hardened-r1
  I: *** Including module: dm ***
  I: Skipping program $env{DM_SBIN_PATH}/dmsetup using in udev rule 10-dm.rules as it cannot be found
2012-10-08 03:46:19 -04:00
Amadeusz Żołnowski
585b3b37c0 90crypt: call systemd commands only if systemd binaries are there 2012-10-08 03:28:43 -04:00
Harald Hoyer
167a320e5f s/libnss*.so/libnss_*.so so that we don't install libnss3.so 2012-10-04 14:38:25 -04:00
Harald Hoyer
2242cd92ee systemd: rename emergency.service to dracut-emergency.service for rd.shell 2012-10-04 13:24:07 -04:00
Harald Hoyer
d20fb951fa add "--kernel-cmdline" and kernel_cmdline options for default parameters 2012-10-04 13:23:19 -04:00
Harald Hoyer
e0a393361d dracut-functions: add inst_rule_group_owner()
add inst_rule_group_owner() to install GROUP and OWNER of udev rules
2012-10-04 13:04:36 -04:00
Harald Hoyer
da9c518116 dracut-functions.sh:inst_rules_program() also recognize RUN+= 2012-10-04 12:15:36 -04:00
Harald Hoyer
4d51eff05f dracut-functions.sh: move the i2o_scsi to the omit_drivers variable 2012-10-03 16:40:36 -04:00
Harald Hoyer
a6c718ce8e systemd: improve the emergency shell 2012-10-03 16:39:27 -04:00
Harald Hoyer
43a050e542 install/dracut-install.c: do not ldd directories 2012-10-03 16:39:27 -04:00
Harald Hoyer
25787f8071 systemd/module-setup.sh: move some services to sysinit 2012-10-03 16:35:13 -04:00
Harald Hoyer
ecfa02bdc8 dracut-functions.sh: do not check all modules for filesystems 2012-10-03 16:33:50 -04:00
Harald Hoyer
080d1b718d dracut-functions.sh: make hostonly case more failsafe for new modules
If new modules are introduced, or modules get renamed, or modules change
from builtin to real modules, we want to include them in the host-only
image, just to be safe.
2012-10-03 16:32:07 -04:00
Harald Hoyer
8ea8d6de80 base/dracut-lib.sh: better error message for deprecated cmdline options 2012-09-28 15:29:53 +02:00
Harald Hoyer
4dbc1d1bb3 i18n/parse-i18n.sh: corrected the right option to use for the cmdline 2012-09-28 15:29:53 +02:00
Harald Hoyer
3b9669cff4 Makefile: fix css style for dracut.html 2012-09-28 15:29:53 +02:00
Harald Hoyer
a6332e6980 dracut.cmdline.7.asc: extend rd.auto doc 2012-09-28 15:29:53 +02:00
Harald Hoyer
9037b63eb2 dracut-functions.sh:get_persistent_dev() exception for multipath devices
An exception is multipath devices, child and top layer device may have
same uuid. As dm devices maintain /dev/mapper/* as persistent names,
just do not doing converting for them.
2012-09-28 15:29:47 +02:00
Harald Hoyer
308015bc4d Makefile: revert documentation logic 2012-09-27 17:04:37 +02:00
Colin Walters
2692a42231 build: Add --disable-documentation option
Some operating system builders may not want to build documention, for
example during a bootstrapping process.
2012-09-27 16:50:25 +02:00
Harald Hoyer
e064127729 add "rd.auto" parameter and switch off automatic assembly
No automatic assembly is done anymore by default. You will have to
specify exactly what devices to assemble
("rd.md.uuid=" "rd.luks.uuid" ...)
or use "rd.auto=1" or "rd.auto" on the kernel command line.

For big servers with thousands of disks we don't want to assemble
everything by default (error prone, slow).
2012-09-27 14:05:50 +02:00
Colin Walters
103281f3b6 Support GNOME Build API
For dracut:

See people.gnome.org/~walters/docs/build-api.txt

We have a new stub configure script that writes out a Makefile.inc.
2012-09-27 12:59:57 +02:00
Harald Hoyer
69ba546721 TODO: update 2012-09-27 12:28:46 +02:00
Harald Hoyer
d65638dacb shutdown/shutdown.sh: reboot, if no argument was given 2012-09-27 12:10:14 +02:00
Harald Hoyer
a0be1eddcf network/ifup.sh: setup nameserver for every interface
even for dhcp

https://bugzilla.redhat.com/show_bug.cgi?id=840769
2012-09-27 11:52:27 +02:00
Harald Hoyer
e1b48995c2 dracut.sh: create the initramfs non-world readable 2012-09-27 10:18:29 +02:00
Harald Hoyer
194e074764 dm/module-setup.sh: instmods dm_mod 2012-09-26 15:05:34 +02:00
Harald Hoyer
7f1d77d9fb TEST-16-DMSQUASH: reenable test 2012-09-26 11:58:51 +02:00
Harald Hoyer
3722020071 crypt/crypt-run-generator.sh: add allow-discards to options in crypttab 2012-09-26 11:49:28 +02:00
Harald Hoyer
f7235c223d dracut.cmdline.7.asc: fixed rd.luks.allow-discards format 2012-09-26 11:49:03 +02:00
Harald Hoyer
868eba13f2 install/dracut-install.c: support find_binary for <src> <dst>
also factor out find_binary()
2012-09-26 11:34:38 +02:00
Harald Hoyer
2cae00be9e busybox/module-setup.sh: generate nice relative symlinks with ln_r 2012-09-26 11:34:00 +02:00
Daniel Drake
69eba8c40a busybox: fix installation from /sbin/busybox
"inst busybox" no longer seems to work when busybox is at
/sbin/busybox. Reproduced on Fedora 18 (dracut-023-39.git20120910).

Use type -P to find the full path to busybox to solve this problem.
2012-09-26 11:30:15 +02:00
Harald Hoyer
17b01c5b13 url-lib/module-setup.sh: also install libs for https 2012-09-26 10:52:33 +02:00
Harald Hoyer
a0508937fc i18n/10-console.rules: do the console init only one time 2012-09-24 15:12:20 +02:00
Harald Hoyer
bc07024624 TEST-10-RAID/test.sh: add "rd.auto=1" 2012-09-24 13:59:03 +02:00
Harald Hoyer
907f75447b TEST-03-USR-MOUNT/create-root.sh: load btrfs module manually 2012-09-24 13:56:21 +02:00
Harald Hoyer
500d8e6002 udev-rules/module-setup.sh: add udev groups 2012-09-24 13:30:46 +02:00
Harald Hoyer
3d12d7a2cc crypt: install /etc/crypttab only in host-only mode 2012-09-24 13:15:08 +02:00
Harald Hoyer
886b9afcc5 systemd/initrd-switch-root.target: run switch-root.target after cryptsetup
Ensure, that all crypto devices have been queried.
2012-09-24 13:12:42 +02:00
Dave Young
f3f9777497 use by-uuid firstly in get_persistent_dev
For devices with filesystem, udev /dev/disk/by-uuid/* links are always
reliable. So improve the get_persistent_dev() by using by-uuid/* firstly,
and fallback to use by-id/*

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-09-24 13:12:26 +02:00
Harald Hoyer
5596b70bd0 dracut-logger.sh: don't check for *lvl==0 in dlog_init() 2012-09-24 13:05:44 +02:00
Harald Hoyer
4211605000 fallback to old ismounted, if findmnt is not installed 2012-09-20 10:36:13 +02:00
Harald Hoyer
aa09b74a41 dash compat: use "2>&1" rather than "&>" 2012-09-20 10:26:14 +02:00
Dave Young
d9a7ea5b43 ismounted fix
ismounted handles both find-by-dev and find-by-mnt, but there's two issues:
1. for find-by-dev, it use readlink to get the canonical dev name, but
   lvm is different with other devices, the canonical name for lvm devices
   are symlinks like /dev/mapper/vg-lv00
2. for nfs mounting, just use [ -b $dev ] is not enough, it need being handled
   seperately.

Per Karel Zak's suggestion, findmnt util is suitable for this purpose, it
handles these cases well, so just use findmnt instead of implement all the
logic by ourselves. Thanks, Karel.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-09-19 18:37:07 +02:00
Harald Hoyer
914f531f39 45url-lib/url-lib.sh: give info what URL curl failed to download
https://bugzilla.redhat.com/show_bug.cgi?id=857836

Also allow self signed Certs and use "--insecure".

https://bugzilla.redhat.com/show_bug.cgi?id=852229
2012-09-18 16:31:24 +02:00
Harald Hoyer
0fc0dcff60 bye bye iscsi_wait_scan ... officially gone for kernel 3.6 2012-09-18 13:39:54 +02:00
Harald Hoyer
0e32ce3219 resume/resume.sh: prevent "resume: not found"
Problem lies in modules.d/95resume:

[ -x $(command -v resume) ] && command resume $a_splash "$resume"

``command -v resume'' prints nothing and ``test -x'' returns 0.

Thanks to Consus!
2012-09-18 13:37:35 +02:00
Dave Young
ff0636635a move get_persistent_dev to dracut-functions.sh
kdump module also need to convert dev name to udev symlinks.
So better to move function get_persistent_dev() to dracut-functions.sh

Also in this patch improvement and fix the original function:
a) use udevadm info --query=name to get the kernel name.
   This will fix the issue caused by passing symbolic link of a device.
b) fix a bug to compare $_tmp instead of $i with $_dev. Really sorry,
   should have tested more carefully.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-09-10 15:50:36 +02:00
Harald Hoyer
ba111df2b9 nfs: install all nfs submodules 2012-09-10 15:49:58 +02:00
Harald Hoyer
dff1671f8f iscsi/parse-iscsiroot.sh: delay loading of iscsi modules 2012-09-10 15:49:37 +02:00
Will Woods
44f77ac1b0 apply-live-updates.sh: handle updates for /run
/run will get mounted at $NEWROOT/run after switch_root, but it's not
there yet. bind-mount it in place so updates for /run actually land in
/run.

(also: remove a redundant check for existing directories. mkdir -p
doesn't do anything if the directory already exists.)
2012-09-07 14:09:42 +02:00
Harald Hoyer
641a8558f4 mdraid/parse-md.sh: fixed commit cc4037d120
my fault, sorry.
2012-09-06 16:16:31 +02:00
Will Woods
3bff70ef15 hide 'setsid --help' output in emergency_shell()
When emergency_shell() happens, it does 'setsid --help' to figure out if
the setsid binary supports the '-c' flag (to set the controlling tty).

This output shows up in the logs (and on-screen if you're using
rd.debug), which keeps confusing people looking for other problems.

Using "case" instead of "strstr" lets us avoid this.
2012-09-06 12:18:06 +02:00
Chris Leech
d672bf167c network: fix ip=ibft regression
It looks like ip=ibft has been busted since
  25aa3c5 network: refactor stuff from netroot/parse-ip-opts to net-lib
which moved ibft parsing code out to the ibft_to_cmdline function.

The use of ifname_mac was partially replaced by a local mac, but not
completely, causing ibft_to_cmdline to abort without generating network
configuration options.

Signed-off-by: Chris Leech <cleech@redhat.com>
2012-09-06 12:18:06 +02:00
Harald Hoyer
ea62729238 kernel-modules/module-setup.sh: add yenta_socket to the initramfs
https://bugzilla.redhat.com/show_bug.cgi?id=853787
2012-09-06 11:51:31 +02:00
Harald Hoyer
32ec0a762d ifcfg/write-ifcfg.sh: add "IPV6INIT=yes" for IPv6
https://bugzilla.redhat.com/show_bug.cgi?id=852808
2012-09-06 11:38:48 +02:00
Wim Muskee
ca121b1a5c unquote nbd port
Name based connects fail because of the quotes around the $nbdport.
For name based connects, the -N option also gets included. For
instance nbd-client 192.168.0.1 '-N ltsp' /dev/nbd0.
I believe the quotes are not necessary for actual port numbers.
2012-09-06 10:50:05 +02:00
Frederick Grose
0db77f5a2b dmsquash-live/dmsquash-live-root.sh: Physically write overlay reset at time of request 2012-09-06 10:48:37 +02:00
Vivek Goyal
cc4037d120 dracut: Override rd.md settings if rd.md.uuid is provided
Currently anaconda provides rd.md=0 on kernel's command line as a boot
time optimization if root is not on md device. But this leads to kdump
failure. We copy the command line from first kernel and if dump target
is on md device, it fails as we never try to assemble md devices as
rd.md=0.

We have already set rd.md.uuid though in /etc/cmdlind.d/ dir providing
dracut the info about what md devices to assemble. So this patch overrides
rd.md settings if rd.md.uuid is provided.

This is a stop gap measure to get kdump working on software raid
devices. Harald seems to have bigger cleanup plans for rd.md. Once
that happens, this patch will not be needed and things should
automatically be fixed.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2012-09-06 10:45:24 +02:00
Dave Young
a999414eaf use check_block_and_slaves in for_each_host_dev_and_slaves
for_each_host_dev_and_slaves currently is used in some module check()
functions and it's not necessary iterate all slaves. So use
check_block_and_slaves instead of check_block_and_slaves_all is fine.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-09-06 10:39:59 +02:00
Milan Broz
00083a0909 FIPS workaround for fipscheck dir
Also patch old install path... (used in Fedora 17)

Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-09-06 10:39:59 +02:00
Harald Hoyer
8a7f561ee5 crypt: do not run systemd crypt generator
"systemctl daemon-reload" does it already for us
2012-09-04 09:49:45 +02:00
Will Woods
32b2fb8a27 make splitsep preserve backslashes (RHBZ#851295)
splitsep() would drop escapes from its inputs. For example:

  splitsep ':' 'first:middle:\e\s\c\a\p\e\d' a b c

gave a='first', b='middle', c='escaped'. Even worse:

  splitsep ':' '\e\s\c\a\p\e\d:middle:last' a b c

gave a='escaped', b='escaped', c='escaped:middle:last'.

This fixes the quoting so both calls return the values you'd expect
(e.g. 'first', 'middle', '\e\s\c\a\p\e\d').
2012-08-24 09:29:31 +02:00
Milan Broz
104727ad6e Require fipscheck and libssl in FIPS module
To properly perform verification in FIPS mode,
we need to install fipscheck and libssl explicitly.

(cryptsetup seems to be the first user of this verification in ramdisk...)

Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-08-24 09:26:59 +02:00
Milan Broz
cce471c9ce dracut-install: FIPS workaround for fipscheck dir
In recent Fedora distro are all hmac files located in /lib
(to avoid multiarch conflict).

When installing hmac file, also install files from these locations.

Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-08-24 09:26:59 +02:00
Harald Hoyer
353e7a7ec3 install/dracut-install.c: correct usage() for hmac 2012-08-23 15:02:37 +02:00
Harald Hoyer
73088e46f7 moved the /etc/host_devs write out to 99base
also removed some left-over debugging code
2012-08-23 12:13:02 +02:00
dyoung@redhat.com
52f1b04183 Add a dracut option --device to bring up a device in initramfs
Kdump support dump to raw device which could be on top of complex storage
such as multipath and iscsi which are standalone dracut modules.

Add a --device option to dracut which will add the device to host_devs so
dracut can add the dependent modules automaticlly and enable them in initramfs.

--device will accept device node name as the param.

Signed-off-by: Dave Young <dyoung@redhat.com>
Tested-by: Chao Wang <chaowang@redhat.com>
2012-08-23 10:15:09 +02:00
dyoung@redhat.com
83e0dc7a3d Add for_each_host_dev_and_slaves for device only checking
For lvm, multipath, iscsi modules they do not care about the filesystem,
Also there could be devcie in host_devs but it does not get formated.

For these kind of modules, use for_each_host_dev_and_slaves will be better than use
for_each_host_dev_fs, here add a new function to iterate the host_devs and
their slave devices.

In original for_each_host_dev_fs, it will call check_block_and_slaves which
will return once helper function return 0, but this is not enough for kdump
iscsi setup. For kdump iscsi case, it need setup each slave devices so that
the iscsi target can be properly setuped in initramfs.

Thus, this patch also add new functions check_block_and_slaves_all and
for_each_host_dev_and_slaves_all.

Signed-off-by: Dave Young <dyoung@redhat.com>
Tested-by: WANG Chao <chaowang@redhat.com>
2012-08-23 10:15:09 +02:00
dyoung@redhat.com
c4bb88715c wait host devs in base module
each dev in host_devs[] should be waited in initqueue to make sure they
are oneline before initqueue finish.

Add a new wait_host_devs.sh in base module to make this a generic thing.
Because all the devs in fstab lines are also added to host_devs, so no need
do same wait in fstab-sys module anymore.

[v2->v3]: do not add slave devices to host_devs
          wait for persistent dev name in initramfs

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-08-23 10:15:09 +02:00
Harald Hoyer
54c7ace145 network: add ping and ping6
better for a quick debug
2012-08-22 17:28:06 +02:00
Harald Hoyer
c1b8934faa znet: add some more kernel drivers 2012-08-22 13:16:23 +02:00
Harald Hoyer
5746f04994 mdraid: catch nested md raids
Thanks to Ian Dall!
2012-08-22 13:01:53 +02:00
Colin Guthrie
f9452c94c0 udev-rules: Pre usrmove systemd installs might not find udevd.
If users had switched to systemd-183+ but have not completed
the usrmove, then the variable ${systemdutildir} will likely
refer to /usr/lib/systemd NOT /lib/systemd and thus the
systemd-udevd daemon may not be found.

So let's try a little harder and add another hard coded path
and if we don't find it, then bail out hard.
2012-08-21 18:46:20 +02:00
Colin Guthrie
68c49db952 install/dracut-install.c: No need to compare the NULL byte each time. 2012-08-21 18:46:20 +02:00
Colin Guthrie
f9c7788ba5 install/dracut-install.c: Deal gracefully with paths containing double /'s
While such paths should not be included internally, we cannot
guarantee that external scripts with shebangs will not do this.

Some older versions of plymouth also resulted in double /'s
in some paths, so best deal with this gracefully.
2012-08-21 18:46:20 +02:00
Colin Guthrie
68318328f1 install/dracut-install.c: Ensure deps are resolved when handling scripts
If we are doing lazy dep solving and happen to process a script with a
shebang on e.g. /bin/bash before we encounter the actual binary itself
we effectively ignore the fact that we've been asked to resolve the deps
and put the item in the 'seen' hashmap. Thus when we later really do try
and resolve deps, we short circuit and don't do anything.

Example test case:

$ cd
$ mkdir -p foo/bin
$ cp /bin/bash foo/bin
$ echo '#!/bin/bash' >foo/bin/script
$ dracut-install -D $HOME/foo -R $HOME/foo/bin/script $HOME/foo/bin/bash
2012-08-21 18:46:20 +02:00
Harald Hoyer
c9a9968dfc fips: set /boot as symlink to /sysroot/boot if no boot= parameter
otherwise sha512hmac will error out with:

sha512hmac -c /sysroot/boot/.vmlinuz-2.6.32-220.el6.x86_64.hmac
Error opening "/boot/vmlinuz-2.6.32-220.el6.x86_64": No such file or directory.
2012-08-21 18:46:20 +02:00
Harald Hoyer
48dba7f9ac network: reintroduce rd.neednet
rd.neednet is used by anaconda and the network interfaces cannot
be known in advance.
2012-08-21 18:46:20 +02:00
Harald Hoyer
bdf1f472b4 add back scsi_wait_scan 2012-08-17 09:22:12 +02:00
Harald Hoyer
e4297a66b1 mdraid: always create need_shutdown, if we have assembled a raid 2012-08-14 17:44:46 +02:00
Dennis Gilmore
ec6d8eab69 include the omap_hsmmc module on arm 2012-08-02 12:18:48 +02:00
Harald Hoyer
dece5ee1f5 dracut.conf.5.asc: s#dracut/conf.d#dracut.conf.d#g 2012-08-01 16:35:46 +02:00
Amadeusz Żołnowski
a41dc8f969 dracut.conf.d/gentoo.conf.example: fix header 2012-08-01 16:24:40 +02:00
Harald Hoyer
aa11b710ce COPYING: updated to recent version of http://www.gnu.org/licenses/gpl-2.0.txt 2012-08-01 15:53:25 +02:00
Harald Hoyer
6af5a4accf version 023 2012-08-01 15:30:30 +02:00
Frederic Crozat
ec8974914f ensure af_packet module is loaded (if not built-in) 2012-08-01 14:40:43 +02:00
Frederic Crozat
b9775297cd add package name for openSUSE 2012-08-01 14:40:28 +02:00
Harald Hoyer
4a6b33f1ee plymouth/plymouth-pretrigger.sh: s/! -n/-z/ 2012-08-01 14:36:58 +02:00
Harald Hoyer
7dd7ff0f33 base/dracut-lib.sh: make use of DRACUT_SYSTEMD 2012-08-01 14:36:38 +02:00
Dave Young
126732bcc1 split emergency_shell function
Kdump dracut hooks need to enter emergency shell, currently it directly call
"sh -i -l", with recent dracut this does not work anymore without proper ctty.

It will be convinient to seperate a standalone function _emergency_shell for
dracut modules to call.
2012-08-01 14:29:15 +02:00
Harald Hoyer
23d6dcd125 test: s/ib700wdt/i6300esbwdt/g 2012-08-01 12:53:39 +02:00
Harald Hoyer
9fd9e96130 test/Makefile: fixed TESTS parsing 2012-08-01 12:50:54 +02:00
Harald Hoyer
f0a7fc5b43 watchdog: set watchdog timeout with wdctl, if available
"wdctl -s" does not yet exist upstream. I patched
util-linux/sys-utils/wdctl.c to set the timeout.
2012-08-01 12:49:45 +02:00
Chao Wang
d82e0d7dd8 Revert "dracut-functions: $_x should exist, no need to test."
This reverts commit b2d225a669.

When there's no /sys/dev/block/$2/slaves/*/dev/ exists, $_x will
be assigned with '/sys/dev/block/$2/slaves/*/dev/', this is invalid.
That commit will lead to some warn msg like:
cat: /sys/dev/block/8:16/slaves/*/dev: No such file or directory
cat: /sys/dev/block/8:32/slaves/*/dev: No such file or directory
2012-08-01 09:24:12 +02:00
Harald Hoyer
5545fc3046 base/dracut-lib.sh:ismounted() check for block device rather than pathname 2012-07-31 14:44:50 +02:00
Harald Hoyer
a638056838 base/dracut-lib.sh: fixed ismounted() for "/dev" 2012-07-31 14:43:05 +02:00
Harald Hoyer
1f524c4544 Prevent testsuite runs from non-root users. 2012-07-31 13:49:04 +02:00
Harald Hoyer
47b8f66ced rootfs-block/mount-root.sh: corrected check for journaldev 2012-07-31 13:28:45 +02:00
Harald Hoyer
52da8a514a dracut.cmdline.7.asc: corrected rd.retry section 2012-07-31 13:28:07 +02:00
Harald Hoyer
5cd7c104bd document rd.retry and change the default value to 30s
Also start the timeout scripts after 2/3 of the time.
2012-07-31 12:37:35 +02:00
Amadeusz Żołnowski
173edca09e dracut.cmdline.7: add NOTE about how dracut pipes key to cryptsetup 2012-07-31 12:28:55 +02:00
Harald Hoyer
506b219237 dracut.sh: create relative symlinks for /var/lock and /var/run 2012-07-31 11:48:03 +02:00
Harald Hoyer
6c83d7d5bf dracut.sh: do not copy /var/run and /var/lock from the system
https://bugs.gentoo.org/show_bug.cgi?id=428142

If /var/run and /var/lock are real directories, we would end up with:
var/lock/lock -> /run/lock
var/run/run -> /run
2012-07-31 11:44:40 +02:00
Stefan Reimer
a059f72b09 i18n/module-setup.sh: fixed include parsing
Due to bug in module-setup.sh in the i18n module includes from the main
keymap are not working and not added to the initrd image.

Only one quotation per line is removed. Needs to remove all.
2012-07-31 11:36:17 +02:00
Amadeusz Żołnowski
afcebd136f 99shutdown: remove --no-wall argument for reboot, halt, etc...
In some distros (Gentoo, for example) these commands don't honor
--no-wall argument.
2012-07-31 10:55:17 +02:00
Harald Hoyer
3d3c192621 crypt/crypt-run-generator.sh: check if crypttab exists 2012-07-30 22:29:47 +02:00
Harald Hoyer
92b3ee855f removed finished-ask-password.sh 2012-07-30 22:29:42 +02:00
Harald Hoyer
650ab3b077 TEST-10-RAID/test.sh: comment debug options 2012-07-30 21:07:14 +02:00
Harald Hoyer
474cca1e9d TODO: update 2012-07-30 21:07:03 +02:00
Harald Hoyer
c0cae7f702 dmraid,mdraid,lvm,udev: don't process DM_MULTIPATH_DEVICE_PATH devs 2012-07-30 20:41:16 +02:00
Harald Hoyer
3f7e5358e5 crypt/crypt-run-generator.sh: do not add already existing luks 2012-07-30 20:41:16 +02:00
Harald Hoyer
3d352f5228 crypt: add systemd crypt support 2012-07-30 17:08:52 +02:00
Harald Hoyer
540eca9d9d plymouth/plymouth-pretrigger.sh: don't "exit 0" for a sourced script 2012-07-30 17:08:52 +02:00
Harald Hoyer
19cd47fd26 plymouth/plymouth-newroot.sh: don't "exit 0" for sourced scripts 2012-07-30 17:08:52 +02:00
Harald Hoyer
cf62cc435f virtfs/mount-virtfs.sh: don't exit != 0 2012-07-30 17:08:52 +02:00
Harald Hoyer
8b6bdafc39 systemd/module-setup.sh: install systemd udev rules 2012-07-30 17:08:52 +02:00
Harald Hoyer
27790828d1 base/dracut-lib.sh: fixed ismounted(<mountpoint>) 2012-07-30 17:08:52 +02:00
Harald Hoyer
d782ffb822 i18n/parse-i18n.sh: remove udev rules 2012-07-30 17:08:52 +02:00
Harald Hoyer
5a84ac3fe3 dracut-functions.sh: inst_hook() with [0-9]-<name> 2012-07-30 17:08:51 +02:00
Harald Hoyer
343b7d7488 kernel-modules/module-setup.sh: add missing "fi" 2012-07-30 17:08:51 +02:00
Harald Hoyer
aefea76cf8 set DRACUT_SYSTEMD for systemd mode in the initramfs 2012-07-30 17:08:51 +02:00
Harald Hoyer
4976edb1a6 dracut.spec: add Requires: kbd kbd-misc 2012-07-30 13:58:58 +02:00
Harald Hoyer
171ba532bc plymouth/plymouth-newroot.sh: fixed pre-pivot hook 2012-07-30 13:39:37 +02:00
Harald Hoyer
bfd2e8c25f dracut.sh: test if we can lazy resolve with ldd 2012-07-30 13:02:41 +02:00
Chao Wang
b2d225a669 dracut-functions: $_x should exist, no need to test.
Signed-off-by: Chao Wang <chaowang@redhat.com>
2012-07-30 12:23:32 +02:00
Will Woods
a5f01bbfb5 dracut-lib: add find_mount, use it to implement ismounted
find_mount is really the same thing as ismounted with two additions:

  1) uses "readlink" so "ismounted /dev/disk/by-label/LABEL" works
  2) returns the mountpoint of the device

And ismounted is now just "find_mount $dev >/dev/null".
2012-07-30 12:23:32 +02:00
Will Woods
7e2285a48a add comment for getargbool()
I always forget how getargbool works. Add a comment documenting it.
2012-07-30 12:23:32 +02:00
Harald Hoyer
3e964eeb96 dracut.sh: put $drivers and $filesystems back in export 2012-07-27 16:06:36 +02:00
Harald Hoyer
aec9f902f0 kernel-modules/module-setup.sh: move "$drivers" "$filesystems" and "$add_drivers" to dracut.sh 2012-07-27 16:03:42 +02:00
Harald Hoyer
764eb40cc9 TODO: update 2012-07-27 16:03:25 +02:00
Harald Hoyer
95a5b23a38 i18n,terminfo/module-setup.sh: fixed "cp -t" calls 2012-07-27 15:34:54 +02:00
Harald Hoyer
5d833a9f5b add "af_packet" kernel module to network testsuite tests 2012-07-27 15:11:01 +02:00
Harald Hoyer
3e51b2f6fc fixed i18n and plymouth for systemd 2012-07-27 14:15:48 +02:00
Harald Hoyer
852105dc44 i18n/console_init.sh: skip, if we use systemd and use systemd-vconsole-init 2012-07-27 14:11:22 +02:00
Harald Hoyer
a7473ef379 cifs/parse-cifsroot.sh: fixed more root/netroot parsing 2012-07-27 12:40:55 +02:00
Harald Hoyer
f7f3792390 iscsi/iscsiroot.sh: force link initiatorname 2012-07-27 12:18:08 +02:00
Harald Hoyer
2d674a9336 README.testsuite: add instructions on how to run the testsuite 2012-07-27 12:14:04 +02:00
Harald Hoyer
24a38bc1cb fixed install locations for udev rules and change to IMPORT{builtin} 2012-07-27 11:55:31 +02:00
Harald Hoyer
82b1739dce cifs/parse-cifsroot.sh: do not unset netroot, we need it 2012-07-27 11:54:24 +02:00
Amadeusz Żołnowski
fc6b272f41 gitignore install/dracut-install 2012-07-27 09:55:06 +02:00
Amadeusz Żołnowski
c9baff669d Makefile: add dependencies for dracut-install (generated with gcc -MM) 2012-07-27 09:54:49 +02:00
Harald Hoyer
72ee74b9be dracut.spec: add cifs module 2012-07-27 06:26:26 +02:00
Harald Hoyer
cc21808764 dracut-functions.sh:inst_rule_programs() fix error messages 2012-07-26 19:35:12 +02:00
Harald Hoyer
78021eace1 install/dracut-install.c: convert destrootdir to realpath
otherwise we get strange errors if it ends with a slash and does not
exist.
2012-07-26 19:35:00 +02:00
Harald Hoyer
65d1a8a4ae dracut-functions.sh:inst_rule_programs() fixed IMPORT{program} 2012-07-26 19:12:40 +02:00
Amadeusz Żołnowski
187a8e08d5 gentoo.conf: enable ro_mnt 2012-07-26 19:07:28 +02:00
Harald Hoyer
c9a81c1f91 plymouth: do not start plymouth via dracut for systemd in the initramfs 2012-07-26 19:00:04 +02:00
Mike Gorse
d580636e97 Added cifs 2012-07-26 18:51:45 +02:00
Harald Hoyer
6ca264a151 nfs/module-setup.sh: check for "rpc.rpc" before running chown 2012-07-26 18:12:05 +02:00
Amadeusz Żołnowski
aa505d588f parse-root-opts: first check for ro, later for rw
This order is already in 98usrmount.
2012-07-26 17:35:59 +02:00
Harald Hoyer
96c6fa9202 base/module-setup.sh: removed mount-hook 2012-07-26 17:35:25 +02:00
Harald Hoyer
25706eafac README.testsuite updated with requirements for TEST-04-SYSTEMD 2012-07-26 17:26:31 +02:00
Harald Hoyer
8aa9926839 mv rootfs-block/module-setup.sh:search_option() in dracut-functions.sh
new function fs_get_option()
2012-07-26 17:24:01 +02:00
Amadeusz Żołnowski
ff3953efe1 ro_mnt - option at build time to force ro mount of / and /usr 2012-07-26 17:16:56 +02:00
Harald Hoyer
ec5e5ae27a dracut-functions.sh: corrected usage comment of find_mp_fstype() 2012-07-26 17:05:24 +02:00
Harald Hoyer
3cc4c8ba9b rootfs-block/module-setup.sh: add support for xfs / reiserfs separate journal device
xfs and reiserfs (among other) supports storing journal data to a
separate device. Unfortunately, XFS requires this information to boot
properly (reiserfs can embed the information in its metadata but you
might want to override it).

Frederic Crozat <fcrozat@suse.com>
2012-07-26 17:00:47 +02:00
Harald Hoyer
81672479af dracut-functions.sh: add find_mp_fstype() 2012-07-26 17:00:07 +02:00
Frederic Crozat
6a5170a15f PATCH: add support for xfs / reiserfs separate journal device
xfs and reiserfs (among other) supports storing journal data to a
separate device. Unfortunately, XFS requires this information to boot
properly (reiserfs can embed the information in its metadata but you
might want to override it).

Attached patch ensure host information are stored in initramfs and also
allows to give data over kernel commandline.

--
Frederic Crozat <fcrozat@suse.com>
SUSE

>From a7c592b9bb7de0d7874ae51d02944a7eee2ec75b Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 24 Jul 2012 18:52:17 +0200
Subject: [PATCH] Add support for separate journal on reiserfs and xfs
2012-07-26 16:38:14 +02:00
Amadeusz Żołnowski
1f4aaaeb5e modules.d/99base/mount-hook.sh is not used - removed 2012-07-26 16:35:13 +02:00
Amadeusz Żołnowski
79148c2945 apply "ro" and "rw" options from cmdline to / mount
rflags is no longer guaranteed to be non empty.  / is mounted according
to rootflags parameter but forced ro at first.  Later it is remounted
according to /etc/fstab + rootflags parameter and "ro"/"rw".  If
parameters are still the same as for first mount, / isn't remounted.

Conflicts:

    modules.d/95rootfs-block/mount-root.sh
    modules.d/99base/parse-root-opts.sh
2012-07-26 16:35:13 +02:00
Amadeusz Żołnowski
5767201eaf dracut-lib: new functions: listlist and are_lists_eq
listlist is like strstr for lists with specified separator and
are_lists_eq uses listlist to check equality of specified lists.
2012-07-26 16:35:13 +02:00
Amadeusz Żołnowski
221c342d50 98usrmount: [ "x$_usr_found" != "x" ] - removed redundant 'x' 2012-07-26 16:35:13 +02:00
Amadeusz Żołnowski
b56e174322 98usrmount: print mount options 2012-07-26 16:35:13 +02:00
Amadeusz Żołnowski
5afa957915 98usrmount: use rw and ro options instead of rd.usrmount.ro
In result /usr is forced to be mounted ro or rw along with /.
2012-07-26 16:35:13 +02:00
Amadeusz Żołnowski
af3b67b213 95rootfs-block: fix left fsck rel. checks 2012-07-26 16:35:13 +02:00
Harald Hoyer
93d7b823b4 systemd/dracut-cmdline.sh: output dracut version 2012-07-26 14:23:31 +02:00
Harald Hoyer
4a1255bc38 Makefile: use symlink for topsrcdir/dracut-install 2012-07-26 13:04:45 +02:00
Harald Hoyer
15976a0670 multipath/module-setup.sh: add dm dependency 2012-07-26 12:55:53 +02:00
Harald Hoyer
24ba78cb77 Makefile: fixed dracut-install make target 2012-07-26 12:15:16 +02:00
Amadeusz Żołnowski
15f0b1f624 90multipath: added kpartx.rules; multipath.rules - different prefix 2012-07-26 11:40:37 +02:00
Cong Wang
823311ea3b 90kernel-modules: remove unused variables in install()
The local variables in install() are unused, can be removed.

Cc: Harald Hoyer <harald@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-07-26 10:10:04 +02:00
Amadeusz Żołnowski
f67a1f7f64 gentoo.conf: set udevdir 2012-07-26 10:10:04 +02:00
Amadeusz Żołnowski
e625eea4f9 Config file for systemd on Gentoo. 2012-07-26 10:10:04 +02:00
Amadeusz Żołnowski
f6297ebe73 Remove obsolete gentoo conf file. 2012-07-26 10:10:04 +02:00
Harald Hoyer
372c9b9647 dmsquash-live: do not eject medium for live_ram 2012-07-26 09:25:28 +02:00
Chao Wang
63c65b984a 90multipath: check() - Regexp fix to match multipath partition.
A multipath partition's uuid will be presented like:
 # cat /sys/dev/block/$_dev/dm/uuid
 part1-mpath-360060e801047103004f2c4b300000008

So in this case, change the match regexp from '^mpath-' to 'mpath-'.

Signed-off-by: Chao Wang <chaowang@redhat.com>
2012-07-26 08:35:02 +02:00
Chao Wang
06c6ea654f 95fstab-sys: Skip mounted filesystem.
Signed-off-by: Chao Wang <chaowang@redhat.com>
2012-07-26 08:35:02 +02:00
Amadeusz Żołnowski
ab8bfca794 Makefile: use implicit rules for install/dracut-install
Don't fail on install rule if install/dracut-install is not build - just
skip it.  $(strip) is not used by install rule, because it is nowhere
set.
2012-07-26 08:35:02 +02:00
Amadeusz Żołnowski
386579a45a Remove object file from repo: install/hashmap.o 2012-07-26 08:35:02 +02:00
Harald Hoyer
f1040fc470 qemu*/module-setup.sh: provide alternative for systemd-detect-virt 2012-07-25 16:03:49 +02:00
Harald Hoyer
585fd00624 TODO: update 2012-07-25 15:20:37 +02:00
Harald Hoyer
e045e1f386 Makefile: honor CFLAGS 2012-07-25 15:20:22 +02:00
Harald Hoyer
bf7883ebca network/module-setup.sh: instmods af_packet 2012-07-25 14:56:29 +02:00
Harald Hoyer
a844fb1552 dracut.asc: add doc about journalctl 2012-07-25 14:53:23 +02:00
Harald Hoyer
35022f987c iscsiroot.sh: do not source /etc/conf.d
this should have been done already.
2012-07-25 14:52:25 +02:00
Harald Hoyer
8a240aca9e require kpartx and partx for some modules 2012-07-25 13:00:08 +02:00
Harald Hoyer
68e7661ca7 deprecate old command line options 2012-07-25 10:32:42 +02:00
Leho Kraav
e88e3b2797 91crypt-loop: replace basename calls with string matching 2012-07-25 10:31:43 +02:00
Leho Kraav
df68781fca 91crypt-loop: use initqueue for cleanup strategy 2012-07-25 10:31:43 +02:00
Leho Kraav
f855f9daaf 91crypt-loop: open root device with a key inside encrypted loop container 2012-07-25 10:31:43 +02:00
Leho Kraav
c5758f2090 90crypt: enhance crypt-lib keydev mounting
Combining $keydev and $keypath should result in a unique, re-usable keydev
mountpoint. mkuniqdir doesn't seem to have any an advantage here and lacks
reusability. Is there ever a use case where these are true:

 * there are more than one rd.luks.key=$keypath:$keydev
 * one is actually different from the other
2012-07-25 10:31:43 +02:00
Leho Kraav
3e9b4330a9 90crypt: recognize .img as loop key container 2012-07-25 10:31:43 +02:00
Harald Hoyer
c072e13162 get rid of "basename" 2012-07-24 14:12:36 +02:00
Harald Hoyer
f2271428d4 dracut-functions.sh: small error print correction 2012-07-24 14:08:32 +02:00
Harald Hoyer
cef379bb03 i18n/10-console.rules: move console_init to the initqueue 2012-07-24 11:52:28 +02:00
Harald Hoyer
3e624cd9dc kernel-modules/module-setup.sh: just optionally install all modprobe.d 2012-07-23 15:40:20 +02:00
Harald Hoyer
5297d4f5b2 lvm/lvm_scan.sh: udevadm settle after lvm scan 2012-07-23 15:36:58 +02:00
Harald Hoyer
b7c8f59fef kernel-modules/module-setup.sh: fix modprobe.d install
if /lib/modprobe.d does not exist, it errors with:
find: `/lib/modprobe.d/': No such file or directory
2012-07-23 11:38:36 +02:00
Harald Hoyer
13f77e9fd5 add documentation for systemd services in the initramfs 2012-07-23 11:29:20 +02:00
Harald Hoyer
472189da15 dracut.sh: add -N option for --no-hostonly 2012-07-21 13:03:56 +02:00
Harald Hoyer
e5ec81a354 AUTHORS: update 2012-07-21 12:55:23 +02:00
Harald Hoyer
4c3be42cdf dracut.8: add more description about calling dracut 2012-07-21 12:52:01 +02:00
Harald Hoyer
24450a5ab7 resume: move resume in the initqueue/finished hook
this ensures, that resume is called as soon as possible
2012-07-20 14:47:41 +02:00
Harald Hoyer
df7be11b38 Version 022 2012-07-20 13:11:21 +02:00
Harald Hoyer
52f74c8010 dracut-functions.sh: fixed host-only kernel module bug 2012-07-20 13:10:58 +02:00
353 changed files with 14032 additions and 5406 deletions

2
.dir-locals.el Normal file
View File

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

6
.gitignore vendored
View File

@@ -1,3 +1,4 @@
/Makefile.inc
/dracut.8
/dracut-catimages.8
/dracut.conf.5
@@ -11,3 +12,8 @@ test*.img
/.buildpath
/.project
/dracut-version.sh
/install/dracut-install
/*.rpm
/*.[0-9]
/modules.d/98systemd/*.service.8
/*.sign

1
.kateconfig Normal file
View File

@@ -0,0 +1 @@
kate: space-indent on; tab-width 4; indent-width 4; replace-tabs on; eol unix;

9
.kateproject Normal file
View File

@@ -0,0 +1,9 @@
{
"name": "Kate"
, "files": [ { "git": 1 } ]
, "build": {
"directory": "build"
, "build": "make -j $(getconf _NPROCESSORS_ONLN) all"
, "clean": "make clean"
}
}

View File

@@ -1,12 +1,15 @@
Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer-omB+W0Dpw2o@public.gmane.org>
Seewer Philippe <philippe.seewer@bfh.ch> <philippe.seewer@bfh.ch>
Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer@bfh.ch>
Victor Lowther <victor.lowther@gmail.com> <victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Harald Hoyer <harald@redhat.com> <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Harald Hoyer <harald@redhat.com> <harald@eeepc.(none)>
Mike Snitzer <snitzer@redhat.com> <msnitzer@redhat.com>
Amerigo Wang <amwang@redhat.com> <xiyou.wangcong@gmail.com>
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>
Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer-omB+W0Dpw2o@public.gmane.org>
Seewer Philippe <philippe.seewer@bfh.ch> <philippe.seewer@bfh.ch>
Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer@bfh.ch>
Victor Lowther <victor.lowther@gmail.com> <victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Harald Hoyer <harald@redhat.com> <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Harald Hoyer <harald@redhat.com> <harald@eeepc.(none)>
Mike Snitzer <snitzer@redhat.com> <msnitzer@redhat.com>
Amerigo Wang <amwang@redhat.com> <xiyou.wangcong@gmail.com>
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
Frederick Grose <fgrose@sugarlabs.org> <fgrose@gmail.com>
Frederic Crozat <fcrozat@suse.com> <fcrozat@mandriva.com>

33
50-dracut.install Executable file
View File

@@ -0,0 +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
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 "$1" in
add)
dracut ${noimageifnotneeded:+--noimageifnotneeded} "$3"/initrd "$2"
ret=$?
;;
remove)
rm -f -- "$3"/initrd
ret=$?
;;
esac
exit $ret

70
51-dracut-rescue-postinst.sh Executable file
View File

@@ -0,0 +1,70 @@
#!/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
KERNEL_VERSION="$1"
KERNEL_IMAGE="$2"
[[ -f /etc/os-release ]] && . /etc/os-release
if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then
systemd-machine-id-setup
fi
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
[[ $MACHINE_ID ]] || exit 1
[[ -f $KERNEL_IMAGE ]] || exit 1
INITRDFILE="/boot/initramfs-0-rescue-${MACHINE_ID}.img"
NEW_KERNEL_IMAGE="${KERNEL_IMAGE%/*}/vmlinuz-0-rescue-${MACHINE_ID}"
[[ -f $INITRDFILE ]] && [[ -f $NEW_KERNEL_IMAGE ]] && exit 0
dropindirs_sort()
{
suffix=$1; shift
args=("$@")
files=$(
while (( $# > 0 )); do
for i in ${1}/*${suffix}; do
[[ -f $i ]] && echo ${i##*/}
done
shift
done | sort -Vu
)
for f in $files; do
for d in "${args[@]}"; do
if [[ -f "$d/$f" ]]; then
echo "$d/$f"
continue 2
fi
done
done
}
# source our config dir
for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do
[[ -e $f ]] && . "$f"
done
[[ $dracut_rescue_image != "yes" ]] && exit 0
if [[ ! -f $INITRDFILE ]]; then
dracut --no-hostonly -a "rescue" "$INITRDFILE" "$KERNEL_VERSION"
((ret+=$?))
fi
if [[ ! -f $NEW_KERNEL_IMAGE ]]; then
cp "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
((ret+=$?))
fi
new-kernel-pkg --install "$KERNEL_VERSION" --kernel-image "$NEW_KERNEL_IMAGE" --initrdfile "$INITRDFILE" --banner "$NAME $VERSION_ID Rescue $MACHINE_ID"
((ret+=$?))
exit $ret

103
51-dracut-rescue.install Executable file
View File

@@ -0,0 +1,103 @@
#!/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
COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="${3%/*}/0-rescue"
KERNEL_IMAGE="$4"
dropindirs_sort()
{
suffix=$1; shift
args=("$@")
files=$(
while (( $# > 0 )); do
for i in ${1}/*${suffix}; do
[[ -f $i ]] && echo ${i##*/}
done
shift
done | sort -Vu
)
for f in $files; do
for d in "${args[@]}"; do
if [[ -f "$d/$f" ]]; then
echo "$d/$f"
continue 2
fi
done
done
}
[[ -f /etc/os-release ]] && . /etc/os-release
if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then
systemd-machine-id-setup
fi
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
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
if ! [[ $BOOT_OPTIONS ]]; then
exit 1
fi
LOADER_ENTRY="/boot/loader/entries/${MACHINE_ID}-0-rescue.conf"
BOOT_DIR="/${MACHINE_ID}/0-rescue"
ret=0
case "$COMMAND" in
add)
for i in "/boot/loader/entries/${MACHINE_ID}-0-rescue.conf"; do
[[ -f $i ]] && exit 0
done
# source our config dir
for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do
[[ -e $f ]] && . "$f"
done
[[ $dracut_rescue_image != "yes" ]] && exit 0
[[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS"
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 "$2"
((ret+=$?))
{
echo "title $PRETTY_NAME - Rescue Image"
echo "version $KERNEL_VERSION"
echo "machine-id $MACHINE_ID"
echo "options ${BOOT_OPTIONS[@]} rd.auto=1"
echo "linux $BOOT_DIR/linux"
echo "initrd $BOOT_DIR/initrd"
} > $LOADER_ENTRY
((ret+=$?))
;;
remove)
exit 0
;;
*)
usage
ret=1;;
esac
((ret+=$?))
exit $ret

64
AUTHORS
View File

@@ -1,67 +1,103 @@
Harald Hoyer <harald@redhat.com>
Victor Lowther <victor.lowther@gmail.com>
Amadeusz Żołnowski <aidecoe@aidecoe.name>
Will Woods <wwoods@redhat.com>
Philippe Seewer <philippe.seewer@bfh.ch>
Warren Togami <wtogami@redhat.com>
Amadeusz Żołnowski <aidecoe@aidecoe.name>
Jeremy Katz <katzj@redhat.com>
David Dillow <dave@thedillows.org>
Will Woods <wwoods@redhat.com>
Michal Soltys <soltys@ziu.info>
Dave Young <dyoung@redhat.com>
David Dillow <dave@thedillows.org>
Michal Soltys <soltys@ziu.info>
Amerigo Wang <amwang@redhat.com>
Andrey Borzenkov <arvidjaar@gmail.com>
Colin Guthrie <colin@mageia.org>
Andrey Borzenkov <arvidjaar@gmail.com>
Peter Jones <pjones@redhat.com>
Andreas Thienemann <andreas@bawue.net>
Hans de Goede <hdegoede@redhat.com>
Peter Jones <pjones@redhat.com>
John Reiser <jreiser@bitwagon.com>
Luca Berra <bluca@vodka.it>
WANG Chao <chaowang@redhat.com>
Daniel Drake <dsd@laptop.org>
Marc Grimme <grimme@atix.de>
Dan Horák <dhorak@redhat.com>
Baoquan He <bhe@redhat.com>
Leho Kraav <leho@kraav.com>
Brian C. Lane <bcl@redhat.com>
Kamil Rytarowski <n54@gmx.com>
Marc Grimme <grimme@atix.de>
Chao Wang <chaowang@redhat.com>
Frederic Crozat <fcrozat@suse.com>
Jesse Keating <jkeating@redhat.com>
Milan Broz <mbroz@redhat.com>
Radek Vykydal <rvykydal@redhat.com>
Roberto Sassu <roberto.sassu@polito.it>
Anton Blanchard <anton@samba.org>
Bill Nottingham <notting@redhat.com>
Brian C. Lane <bcl@redhat.com>
Colin Walters <walters@verbum.org>
David Cantrell <dcantrell@redhat.com>
Dennis Gilmore <dennis@ausil.us>
Jon Ander Hernandez <jonan.h@gmail.com>
Juan RP <xtraeme@gmail.com>
Lance Albertson <lance@osuosl.org>
Marian Ganisin <mganisin@redhat.com>
Michael Ploujnikov <plouj@somanetworks.com>
Peter Rajnoha <prajnoha@redhat.com>
Wim Muskee <wimmuskee@gmail.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Alan Pevec <apevec@redhat.com>
Frederick Grose <fgrose@sugarlabs.org>
Ian Dall <ian@beware.dropbear.id.au>
James Buren <ryuo@frugalware.org>
James Lee <jlee@thestaticvoid.com>
Joey Boggs <jboggs@redhat.com>
Jon Ander Hernandez <jonan.h@gmail.com>
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mike Snitzer <snitzer@redhat.com>
Peter Rajnoha <prajnoha@redhat.com>
Przemysław Rudy <prudy1@o2.pl>
Stefan Reimer <it@startux.de>
Thomas Lange <lange@informatik.uni-koeln.de>
Vivek Goyal <vgoyal@redhat.com>
Vladislav Bogdanov <bubble@hoster-ok.com>
Adam Williamson <awilliam@redhat.com>
Alexander Todorov <atodorov@redhat.com>
Andy Lutomirski <luto@mit.edu>
Anssi Hannula <anssi@mageia.org>
Brandon Philips <brandon@ifup.co>
Canek Peláez Valdés <caneko@gmail.com>
Chris Leech <cleech@redhat.com>
Christian Heinz <christian.ch.heinz@gmail.com>
Cong Wang <amwang@redhat.com>
Daniel Schaal <farbing@web.de>
Dave Jones <davej@redhat.com>
Dave Young <dave@redhat.com>
Dennis Schridde <devurandom@gmx.net>
Duane Griffin <duaneg@dghda.com>
Frederic Crozat <fcrozat@mandriva.com>
Glen Gray <slaine@slaine.org>
Hermann Gausterer <git-dracut-2012@mrq1.org>
James Laska <jlaska@redhat.com>
Jan Stodola <jstodola@redhat.com>
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Leho Kraav <leho@kraav.com>
Jiri Pirko <jiri@resnulli.us>
Joe Lawrence <Joe.Lawrence@stratus.com>
Kevin Yung <Kevin.Yung@myob.com>
Kyle McMartin <kyle@redhat.com>
Lars R. Damerow <lars@pixar.com>
Lennert Buytenhek <buytenh@wantstofly.org>
Lubomir Rintel <lkundrak@v3.sk>
Matt <smoothsailing72@hotmail.com>
Matt Smith <shadowfax@gmx.com>
Michal Schmidt <mschmidt@redhat.com>
Mike Gorse <mgorse@suse.com>
Munehiro Matsuda <haro@kgt.co.jp>
Nicolas Chauvet <kwizart@gmail.com>
Nikoli <nikoli@lavabit.com>
Olivier Blin <dev@blino.org>
Paolo Bonzini <pbonzini@redhat.com>
Peter Robinson <pbrobinson@fedoraproject.org>
Pádraig Brady <P@draigBrady.com>
Quentin Armitage <quentin@armitage.org.uk>
Robert Buchholz <rbu@goodpoint.de>
Sergey Fionov <fionov@gmail.com>
Srinivasa T N <seenutn@linux.vnet.ibm.com>
Thilo Bangert <thilo.bangert@gmx.net>
Thomas Lange <lange@informatik.uni-koeln.de>
Thomas Backlund <tmb@mageia.org>
Tomasz Torcz <tomek@pipebreaker.pl>
Vadim Kuznetsov <vadimk@gentoo.org>
Ville Skyttä <ville.skytta@iki.fi>

42
COPYING
View File

@@ -1,12 +1,12 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
@@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
@@ -225,7 +225,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
Copyright (C) <year> <name of author>
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
@@ -303,16 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
@@ -335,5 +335,5 @@ necessary. Here is a sample; alter the names:
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

188
Makefile
View File

@@ -1,5 +1,9 @@
VERSION=021
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
-include dracut-version.sh
VERSION = $(shell [ -d .git ] && git describe --abbrev=0 --tags 2>/dev/null || echo $(DRACUT_VERSION))
GITVERSION = $(shell [ -d .git ] && { v=$$(git describe --tags 2>/dev/null); [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
-include Makefile.inc
prefix ?= /usr
libdir ?= ${prefix}/lib
@@ -8,54 +12,88 @@ pkglibdir ?= ${libdir}/dracut
sysconfdir ?= ${prefix}/etc
bindir ?= ${prefix}/bin
mandir ?= ${prefix}/share/man
CFLAGS ?= -O2 -g -Wall
CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64
bashcompletiondir ?= ${datadir}/bash-completion/completions
manpages = dracut.8 \
dracut.cmdline.7 \
dracut.conf.5 \
dracut-catimages.8 \
lsinitrd.1 \
mkinitrd.8
man1pages = lsinitrd.1
.PHONY: install clean archive rpm testimage test all check AUTHORS doc
man5pages = dracut.conf.5
all: syncheck dracut-version.sh dracut-install
man7pages = dracut.cmdline.7 \
dracut.bootup.7 \
dracut.modules.7
DRACUT_INSTALL_SOURCE = \
install/dracut-install.c \
install/hashmap.c\
install/log.c \
install/util.c
man8pages = dracut.8 \
dracut-catimages.8 \
mkinitrd.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
DRACUT_INSTALL_HEADER = \
install/hashmap.h \
install/log.h \
install/macro.h \
install/util.h
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
dracut-install: $(DRACUT_INSTALL_SOURCE) $(DRACUT_INSTALL_HEADER)
gcc -std=gnu99 -O2 -g -Wall -o dracut-install $(DRACUT_INSTALL_SOURCE)
.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
all: dracut-version.sh dracut-install skipcpio/skipcpio
DRACUT_INSTALL_OBJECTS = \
install/dracut-install.o \
install/hashmap.o\
install/log.o \
install/util.o
# deps generated with gcc -MM
install/dracut-install.o: install/dracut-install.c install/log.h install/macro.h \
install/hashmap.h install/util.h
install/hashmap.o: install/hashmap.c install/util.h install/macro.h install/log.h \
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/dracut-install: $(DRACUT_INSTALL_OBJECTS)
dracut-install: install/dracut-install
ln -fs $< $@
SKIPCPIO_OBJECTS= \
skipcpio/skipcpio.o
skipcpio/skipcpio.o: skipcpio/skipcpio.c
skipcpio/skipcpio: skipcpio/skipcpio.o
indent:
indent -i8 -nut -br -linux -l120 install/dracut-install.c
indent -i8 -nut -br -linux -l120 skipcpio/skipcpio.c
doc: $(manpages) dracut.html
ifneq ($(enable_documentation),no)
all: doc
endif
%: %.xml
xsltproc -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
%.xml: %.asc
asciidoc -d manpage -b docbook -o $@ $<
dracut.html: dracut.asc $(manpages)
dracut.8: dracut.usage.asc dracut.8.asc
dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc
xsltproc -o dracut.html --xinclude -nonet \
--stringparam draft.mode yes \
--stringparam html.stylesheet \
http://docs.redhat.com/docs/en-US/Common_Content/css/default.css \
--stringparam custom.css.source dracut.css \
--stringparam generate.css.header 1 \
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
rm dracut.xml
rm -f -- dracut.xml
install: doc dracut-version.sh
install: dracut-version.sh
mkdir -p $(DESTDIR)$(pkglibdir)
mkdir -p $(DESTDIR)$(bindir)
mkdir -p $(DESTDIR)$(sysconfdir)
@@ -67,78 +105,107 @@ install: doc dracut-version.sh
install -m 0755 lsinitrd.sh $(DESTDIR)$(bindir)/lsinitrd
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 -s dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
ln -fs dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
install -m 0755 dracut-logger.sh $(DESTDIR)$(pkglibdir)/dracut-logger.sh
install -m 0755 dracut-initramfs-restore.sh $(DESTDIR)$(pkglibdir)/dracut-initramfs-restore
cp -arx modules.d $(DESTDIR)$(pkglibdir)
install -m 0644 lsinitrd.1 $(DESTDIR)$(mandir)/man1/lsinitrd.1
install -m 0644 mkinitrd.8 $(DESTDIR)$(mandir)/man8/mkinitrd.8
install -m 0644 dracut.8 $(DESTDIR)$(mandir)/man8/dracut.8
install -m 0644 dracut-catimages.8 \
$(DESTDIR)$(mandir)/man8/dracut-catimages.8
install -m 0644 dracut.conf.5 $(DESTDIR)$(mandir)/man5/dracut.conf.5
install -m 0644 dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.cmdline.7
ln -s dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.kernel.7
ifneq ($(enable_documentation),no)
for i in $(man1pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man1/$${i##*/}; done
for i in $(man5pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man5/$${i##*/}; done
for i in $(man7pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man7/$${i##*/}; done
for i in $(man8pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man8/$${i##*/}; done
ln -fs dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.kernel.7
endif
if [ -n "$(systemdsystemunitdir)" ]; then \
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
install -m 0644 dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir); \
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98systemd/dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown.service; \
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants; \
ln -s ../dracut-shutdown.service \
$(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants/dracut-shutdown.service; \
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants; \
for i in \
dracut-cmdline.service \
dracut-initqueue.service \
dracut-mount.service \
dracut-pre-mount.service \
dracut-pre-pivot.service \
dracut-pre-trigger.service \
dracut-pre-udev.service \
; do \
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98systemd/$$i $(DESTDIR)$(systemdsystemunitdir); \
ln -s ../$$i \
$(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants/$$i; \
done \
fi
install $(strip) -m 0755 dracut-install $(DESTDIR)$(pkglibdir)/dracut-install
if [ -f install/dracut-install ]; then \
install -m 0755 install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
fi
if [ -f skipcpio/skipcpio ]; then \
install -m 0755 skipcpio/skipcpio $(DESTDIR)$(pkglibdir)/skipcpio; \
fi
mkdir -p $(DESTDIR)${prefix}/lib/kernel/install.d
install -m 0755 50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install
install -m 0755 51-dracut-rescue.install $(DESTDIR)${prefix}/lib/kernel/install.d/51-dracut-rescue.install
mkdir -p $(DESTDIR)${bashcompletiondir}
install -m 0644 dracut-bash-completion.sh $(DESTDIR)${bashcompletiondir}/dracut
install -m 0644 lsinitrd-bash-completion.sh $(DESTDIR)${bashcompletiondir}/lsinitrd
dracut-version.sh:
@echo "DRACUT_VERSION=$(VERSION)-$(GITVERSION)" > dracut-version.sh
@echo "DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh
clean:
$(RM) *~
$(RM) */*~
$(RM) */*/*~
$(RM) $(manpages:%=%.xml) dracut.xml
$(RM) test-*.img
$(RM) dracut-*.rpm dracut-*.tar.bz2
$(RM) dracut-install
$(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
archive: dracut-$(VERSION)-$(GITVERSION).tar.bz2
dist: dracut-$(VERSION).tar.bz2
dracut-$(VERSION).tar.bz2: doc
dracut-$(VERSION).tar.bz2: doc syncheck
@echo "DRACUT_VERSION=$(VERSION)" > dracut-version.sh
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ > dracut-$(VERSION).tar
mkdir -p dracut-$(VERSION)
cp $(manpages) dracut.html dracut-$(VERSION)
tar -rf dracut-$(VERSION).tar dracut-$(VERSION)/*.[0-9] dracut-$(VERSION)/dracut.html
rm -fr dracut-$(VERSION).tar.bz2 dracut-$(VERSION)
for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(VERSION)/$${i%/*}"; cp "$$i" "dracut-$(VERSION)/$$i"; done
tar --owner=root --group=root -rf dracut-$(VERSION).tar $$(find dracut-$(VERSION) -type f)
rm -fr -- dracut-$(VERSION).tar.bz2 dracut-$(VERSION)
bzip2 -9 dracut-$(VERSION).tar
rm -f dracut-$(VERSION).tar
rm -f -- dracut-$(VERSION).tar
rpm: dracut-$(VERSION).tar.bz2
rpm: dracut-$(VERSION).tar.bz2 syncheck
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
cp dracut-$(VERSION).tar.bz2 "$$rpmbuild"; \
LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
(cd "$$rpmbuild"; rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
( mv "$$rpmbuild"/$$(arch)/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr "$$rpmbuild"; ls *.rpm )
( mv "$$rpmbuild"/$$(arch)/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr -- "$$rpmbuild"; ls *.rpm )
syncheck:
@ret=0;for i in dracut-initramfs-restore.sh dracut-logger.sh \
modules.d/99base/init.sh modules.d/*/*.sh; do \
@ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \
[ "$${i##*/}" = "module-setup.sh" ] && continue; \
read line < "$$i"; [ "$${line#*bash*}" != "$$line" ] && continue; \
dash -n "$$i" ; ret=$$(($$ret+$$?)); \
[ $$V ] && echo "posix syntax check: $$i"; bash --posix -n "$$i" ; ret=$$(($$ret+$$?)); \
[ $$V ] && echo "checking for [[: $$i"; if grep -Fq '[[ ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains [["; fi \
done;exit $$ret
@ret=0;for i in *.sh mkinitrd-dracut.sh modules.d/*/*.sh \
modules.d/*/module-setup.sh; do \
bash -n "$$i" ; ret=$$(($$ret+$$?)); \
[ $$V ] && echo "bash syntax check: $$i"; bash -n "$$i" ; ret=$$(($$ret+$$?)); \
done;exit $$ret
check: all syncheck
$(MAKE) -C test check
check: all syncheck rpm
@[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; }
@$(MAKE) -C test check
testimage: all
./dracut.sh -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
@@ -151,8 +218,15 @@ testimages: all
@echo wrote test-dracut.img
hostimage: all
./dracut.sh -H -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
./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; do echo $$rest;done > AUTHORS
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.bz2 dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/
kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/

266
NEWS
View File

@@ -1,3 +1,269 @@
dracut-033
==========
- improved hostonly device recognition
- improved hostonly module recognition
- add dracut.css for dracut.html
- do not install udev rules from /etc in generic mode
- fixed LABEL= parsing for swap devices
- fixed iBFT network setup
- url-lib.sh: handle 0-size files with curl
- dracut.asc: document debugging dracut on shutdown
- if rd.md=0, use dmraid for imsm and ddf
- skip empty dracut modules
- removed caching of kernel cmdline
- fixed iso-scan, if the loop device driver is a kernel module
- bcache: support new blkid
- fixed ifup udev rules
- ifup with dhcp, if no "ip=" specified for the interface
dracut-032
==========
- add parameter --print-cmdline
This prints the kernel command line parameters for the current disk
layout.
$ dracut --print-cmdline
rd.luks.uuid=luks-e68c8906-6542-4a26-83c4-91b4dd9f0471
rd.lvm.lv=debian/root rd.lvm.lv=debian/usr root=/dev/mapper/debian-root
rootflags=rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered
rootfstype=ext4
- dracut.sh: add --persistent-policy option and persistent_policy conf option
--persistent-policy <policy>:
Use <policy> to address disks and partitions.
<policy> can be any directory name found in /dev/disk.
E.g. "by-uuid", "by-label"
- dracut now creates the initramfs without udevadm
that means the udev database does not have to populated
and the initramfs can be built in a chroot with
/sys /dev /proc mounted
- renamed dracut_install() to inst_multiple() for consistent naming
- if $libdirs is unset, fall back to ld.so.cache paths
- always assemble /usr device in initramfs
- bash module added (disable it, if you really want dash)
- continue to boot, if the main loop times out, in systemd mode
- removed inst*() shell pure versions, dracut-install binary is in charge now
- fixed ifcfg file generation for vlan
- do not include adjtime and localtime anymore
- fixed generation of zfcp.conf of CMS setups
- install vt102 terminfo
dracut_install() is still there for backwards compat
- do not strip files in FIPS mode
- fixed iBFT interface configuration
- fs-lib: install fsck and fsck.ext*
- shutdown: fixed killall_proc_mountpoint()
- network: also wait for ethernet interfaces to setup
- fixed checking for FIPS mode
Contributions from:
Harald Hoyer
WANG Chao
Baoquan He
Daniel Schaal
Dave Young
James Lee
Radek Vykydal
dracut-031
==========
- do not include the resume dracut module in hostonly mode,
if no swap is present
- don't warn twice about omitted modules
- use systemd-cat for logging on systemd systems, if logfile is unset
- fixed PARTUUID parsing
- support kernel module signing keys
- do not install the usrmount dracut module in hostonly mode,
if /sbin/init does not live in /usr
- add debian udev rule files
- add support for bcache
- network: handle bootif style interfaces
e.g. ip=77-77-6f-6f-64-73:dhcp
- add support for kmod static devnodes
- add vlan support for iBFT
Contributions from:
Harald Hoyer
Amadeusz Żołnowski
Brandon Philips
Colin Walters
James Lee
Kyle McMartin
Peter Jones
dracut-030
==========
- support new persistent network interface names
- fix findmnt calls, prevents hang on stale NFS mounts
- add systemd.slice and slice.target units
- major shell cleanup
- support root=PARTLABEL= and root=PARTUUID=
- terminfo: only install l/linux v/vt100 and v/vt220
- unset all LC_* and LANG, 10% faster
- fixed dependency loop for dracut-cmdline.service
- do not wait_for_dev for the root devices
- do not wait_for_dev for devices, if dracut-initqueue is not needed
- support early microcode loading with --early-microcode
- dmraid, let dmraid setup its own partitions
- sosreport renamed to rdsosreport
Contributions from:
Harald Hoyer
Konrad Rzeszutek Wilk
WANG Chao
dracut-029
==========
- wait for IPv6 autoconfiguration
- i18n: make the default font configurable
To set the default font for your distribution, add
i18n_default_font="latarcyrheb-sun16"
to your /lib/dracut/dracut.conf.d/01-dist.conf distribution config.
- proper handle "rd.break" in systemd mode before switch-root
- systemd: make unit files symlinks
- build without dash requirement
- add dracut-shutdown.service.8 manpage
- handle MACs for "ip="
"ip=77-77-6f-6f-64-73:dhcp"
- don't explode when mixing BOOTIF and ip=
- 90lvm/module-setup.sh: redirect error message of lvs to /dev/null
Contributions from:
Harald Hoyer
Will Woods
Baoquan He
dracut-028
==========
- full integration of crypto devs in systemd logic
- support for bridge over team and vlan tagged team
- support multiple bonding interfaces
- new kernel command line param "rd.action_on_fail"
to control the emergency action
- support for bridge over a vlan tagged interface
- support for "iso-scan/filename" kernel parameter
- lsinitrd got some love and does not use "file" anymore
- fixed issue with noexec mounted tmp dirs
- FIPS mode fixed
- dracut_install got some love
- fixed some /usr mounting problems
- ifcfg dracut module got some love and fixes
- default installed font is now latarcyrheb-sun16
- new parameters rd.live.dir and rd.live.squashimg
- lvm: add tools for thin provisioning
- also install non-hwcap libs
- setup correct system time and time zone in initrd
- s390: fixed cms setup
- add systemd-udevd persistent network interface naming
Contributions from:
Harald Hoyer
Kamil Rytarowski
WANG Chao
Baoquan He
Adam Williamson
Colin Guthrie
Dan Horák
Dave Young
Dennis Gilmore
Dennis Schridde
dracut-027
==========
- dracut now has bash-completion
- require bash version 4
- systemd module now requires systemd >= 199
- dracut makes use of native systemd initrd units
- added hooks for new-kernel-pkg and kernel-install
- hostonly is now default for fedora
- comply with the BootLoaderSpec paths
http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec
- added rescue module
- host_fs_types is now a hashmap
- new dracut argument "--regenerate-all"
- new dracut argument "--noimageifnotneeded"
- new man page dracut.bootup
- install all host filesystem drivers
- use -D_FILE_OFFSET_BITS=64 to build dracut-install
dracut-026
==========
- introduce /usr/lib/dracut/dracut.conf.d/ drop-in directory
/usr/lib/dracut/dracut.conf.d/*.conf can be overwritten by the same
filenames in /etc/dracut.conf.d.
Packages should use /usr/lib/dracut/dracut.conf.d rather than
/etc/dracut.conf.d for drop-in configuration files.
/etc/dracut.conf and /etc/dracut.conf.d belong to the system administrator.
- uses systemd-198 native initrd units
- totally rely on the fstab-generator in systemd mode for block devices
- dracut systemd now uses dracut.target rather than basic.target
- dracut systemd services optimize themselves away
- fixed hostonly parameter generation
- turn off curl globbing (fixes IPv6)
- modify the udev rules on install and not runtime time
- enable initramfs building without kernel modules (fixed regression)
- in the initqueue/timeout,
reset the main loop counter, as we see new udev events or initqueue/work
- fixed udev rule installation
dracut-025
==========
- do not strip signed kernel modules
- add sosreport script and generate /run/initramfs/sosreport.txt
- make short uuid specification for allow-discards work
- turn off RateLimit for the systemd journal
- fixed MAC address assignment
- add systemd checkisomd5 service
- splitout drm kernel modules from plymouth module
- add 'swapoff' to initramfs to fix shutdown/reboot
- add team device support
- add pre-shutdown hook
- kill all processes in shutdown and report remaining ones
- "--device" changed to "--add-device" and "add_device=" added for conf files
- add memory usage trace to different hook points
- cope with optional field #7 in /proc/self/mountinfo
- lots of small bugfixes
dracut-024
==========
- new dracut option "--device"
- new dracut kernel command line options "rd.auto"
- new dracut kernel command line options "rd.noverifyssl"
- new dracut option "--kernel-cmdline" and "kernel_cmdline" option for default parameters
- fixes for systemd and crypto
- fix for kexec in shutdown, if not included in initramfs
- create the initramfs non-world readable
- prelink/preunlink in the initramfs
- strip binaries in the initramfs by default now
- various FIPS fixes
- various dracut-install fixes
dracut-023
==========
- resume from hibernate fixes
- -N option for --no-hostonly
- support for systemd crypto handling
- new dracut module "crypt-loop"
- deprecate the old kernel command line options
- more documentation
- honor CFLAGS for dracut-install build
- multipath fixes
- / is mounted according to rootflags parameter but forced ro at first.
Later it is remounted according to /etc/fstab + rootflags parameter
and "ro"/"rw".
- support for xfs / reiserfs separate journal device
- new "ro_mnt" option to force ro mount of / and /usr
- root on cifs support
- dracut-install: fixed issue for /var/tmp containing a symlink
- only lazy resolve with ldd, if the /var/tmp partition is not mounted with "noexec"
- i18n: fixed inclusion of "include" keymaps
dracut-022
==========
- fixed host-only kernel module bug
dracut-021
==========
- fixed systemd in the initramfs (requires systemd >= 187)

4
README
View File

@@ -1,6 +1,6 @@
Dracut
dracut
------
Dracut is a new initramfs infrastructure.
dracut is a new initramfs infrastructure.
Information about the initial goals and aims can be found at
https://fedoraproject.org/wiki/Initrdrewrite

View File

@@ -1,5 +1,5 @@
Most of the functionality that dracut implements are actually implemented
by dracut modules. Dracut modules live in modules.d, and have the following
by dracut modules. dracut modules live in modules.d, and have the following
structure:
dracut_install_dir/modules.d/
@@ -38,7 +38,7 @@ installkernel():
check():
Dracut calls this function to check and see if a module can be installed
dracut calls this function to check and see if a module can be installed
on the initrd.
When called without options, check should check to make sure that

View File

@@ -1,11 +1,32 @@
For the testsuite to work, you will have to install at least the following software packages:
dash
asciidoc
mdadm
lvm2
cryptsetup
nfs-utils
netbsd-iscsi
nbd
dhcp
dash \
bridge-utils \
asciidoc \
mdadm \
lvm2 \
cryptsetup \
nfs-utils \
nbd \
dhcp-server \
scsi-target-utils \
iscsi-initiator-utils
TEST-04-FULL-SYSTEMD: systemd >= 187
How to run the testsuite:
$ sudo make clean check
in verbose mode:
$ sudo make V=1 clean check
only specific test:
$ sudo make TESTS="01 20 40" clean check
only runs the 01, 20 and 40 tests.
debug a specific test case:
$ cd TEST-01-BASIC
$ sudo make clean setup run
... change some kernel parameters ...
$ sudo make run
to run the test without doing the setup

15
TODO
View File

@@ -6,23 +6,32 @@ Items are ordered in priority.
INITRAMFS TODO
- use info and warn prefix
- generate systemd unit dracut-initramfs-restore in /run/systemd dynamically
- put "root=" parsing hooks in separate hook dir
- call "root=" parsing hooks after getting new rootpath from dhcp
- put mount hook in main initqueue loop / careful about resume!
- the hard-coded list of udev rules that we care about is kind of lame.
- panic fallback
- bridging/bonding without "netroot=" https://bugzilla.redhat.com/show_bug.cgi?id=822750
- progress indication for fsck https://bugzilla.redhat.com/show_bug.cgi?id=827118
- domain, searchdomain https://bugzilla.redhat.com/show_bug.cgi?id=840778
- disable write-ifcfg https://bugzilla.redhat.com/show_bug.cgi?id=840784
- check for /var to be mounted in convertfs https://bugzilla.redhat.com/show_bug.cgi?id=848172
- probably fix "--include" https://bugzilla.redhat.com/show_bug.cgi?id=849338
GENERATOR TODO
- remove wait for swap devs, if no "resume=" is given on the kernel command line
- add presets (predefined set of modules)
- add interpreter/plugin-scripts to be sourced at the beginning or end (can use dracut-functions)
- provide "installkernel" and "new-kernel-pkg"
- add mechanism for module specific command line options
- pkg-config integration, to make it easy for other packages to use us.
- add recovery image creator (mkrecovery)
- default module specification could use some work
- udev rule copying, as mentioned above, is a bit too hard-coded
- dracut-install parse LD_SHOW_AUXV="" AT_PLATFORM for lib install
CODE TODO
- document more functions
@@ -31,5 +40,5 @@ CODE TODO
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
- https://bugzilla.redhat.com/show_bug.cgi?id=524727 - dracut + encrypted root + networking

78
configure vendored Executable file
View File

@@ -0,0 +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
# We don't support srcdir != builddir
echo \#buildapi-variable-no-builddir >/dev/null
prefix=/usr
enable_documentation=yes
# 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
local rematch='^[^=]*=(.*)$'
if [[ $2 =~ $rematch ]]; then
read "$1" <<< "${BASH_REMATCH[1]}"
else
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
return 0
}
while (($# > 0)); do
case "${1%%=*}" in
--prefix) read_arg prefix "$@" || shift;;
--libdir) read_arg libdir "$@" || shift;;
--datadir) read_arg datadir "$@" || shift;;
--sysconfdir) read_arg sysconfdir "$@" || shift;;
--sbindir) read_arg sbindir "$@" || shift;;
--mandir) read_arg mandir "$@" || shift;;
--disable-documentation) enable_documentation=no;;
--program-prefix) read_arg programprefix "$@" || shift;;
--exec-prefix) read_arg execprefix "$@" || shift;;
--bindir) read_arg bindir "$@" || shift;;
--includedir) read_arg includedir "$@" || shift;;
--libexecdir) read_arg libexecdir "$@" || shift;;
--localstatedir) read_arg localstatedir "$@" || shift;;
--sharedstatedir) read_arg sharedstatedir "$@" || shift;;
--infodir) read_arg infodir "$@" || shift;;
--systemdsystemunitdir) read_arg systemdsystemunitdir "$@" || shift;;
--bashcompletiondir) read_arg bashcompletiondir "$@" || shift;;
*) echo "Ignoring unknown option '$1'";;
esac
shift
done
cat > Makefile.inc.$$ <<EOF
prefix ?= ${prefix}
libdir ?= ${libdir:-${prefix}/lib}
datadir ?= ${datadir:-${prefix}/share}
sysconfdir ?= ${sysconfdir:-${prefix}/etc}
sbindir ?= ${sbindir:-${prefix}/sbin}
mandir ?= ${mandir:-${prefix}/share/man}
enable_documentation ?= ${enable_documentation:-yes}
bindir ?= ${bindir:-${prefix}/bin}
EOF
{
[[ $programprefix ]] && echo "programprefix ?= ${programprefix}"
[[ $execprefix ]] && echo "execprefix ?= ${execprefix}"
[[ $includedir ]] && echo "includedir ?= ${includedir}"
[[ $libexecdir ]] && echo "libexecdir ?= ${libexecdir}"
[[ $localstatedir ]] && echo "localstatedir ?= ${localstatedir}"
[[ $sharedstatedir ]] && echo "sharedstatedir ?= ${sharedstatedir}"
[[ $infodir ]] && echo "infodir ?= ${infodir}"
[[ $systemdsystemunitdir ]] && echo "systemdsystemunitdir ?= ${systemdsystemunitdir}"
[[ $bashcompletiondir ]] && echo "bashcompletiondir ?= ${bashcompletiondir}"
} >> Makefile.inc.$$
mv Makefile.inc.$$ Makefile.inc

79
dracut-bash-completion.sh Normal file
View File

@@ -0,0 +1,79 @@
#
# -*- 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
# 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/>.
#
__contains_word () {
local word=$1; shift
for w in $*; do [[ $w = $word ]] && return 0; done
return 1
}
_dracut() {
local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
local -A OPTS=(
[STANDALONE]='-f -v -q -l -H -h -M -N
--ro-mnt --force --kernel-only --no-kernel --strip --nostrip
--hardlink --nohardlink --noprefix --mdadmconf --nomdadmconf
--lvmconf --nolvmconf --debug --profile --verbose --quiet
--local --hostonly --no-hostonly --fstab --help --bzip2 --lzma
--xz --no-compress --gzip --list-modules --show-modules --keep
--printsize --regenerate-all --noimageifnotneeded --early-microcode
--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'
)
if __contains_word "$prev" ${OPTS[ARG]}; then
case $prev in
--kmoddir|-k|--fwdir|--confdir|--tmpdir)
comps=$(compgen -d -- "$cur")
compopt -o filenames
;;
-c|--conf|--sshkey|--add-fstab|--add-device|-I|--install)
comps=$(compgen -f -- "$cur")
compopt -o filenames
;;
-a|-m|-o|--add|--modules|--omit)
comps=$(dracut --list-modules 2>/dev/null)
;;
--persistent-policy)
comps=$(cd /dev/disk/; echo *)
;;
--kver)
comps=$(cd /lib/modules; echo [0-9]*)
;;
*)
return 0
;;
esac
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
return 0
fi
if [[ $cur = -* ]]; then
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
return 0
fi
}
complete -F _dracut dracut

View File

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

File diff suppressed because it is too large Load Diff

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,18 +1,35 @@
#!/bin/sh
#!/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
KERNEL_VERSION="$(uname -r)"
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
SKIP="$dracutbasedir/skipcpio"
[[ -x $SKIP ]] || SKIP=cat
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
fi
[[ -f $IMG ]] || IMG="/boot/initramfs-${KERNEL_VERSION}.img"
cd /run/initramfs
IMG="/boot/initramfs-$(uname -r).img"
[ -f .need_shutdown -a -f "$IMG" ] || exit 1
if zcat "$IMG" | cpio -id >/dev/null 2>&1; then
rm .need_shutdown
elif xzcat "$IMG" | cpio -id >/dev/null 2>&1; then
rm .need_shutdown
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
rm -f -- .need_shutdown
elif $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet >/dev/null; then
rm -f -- .need_shutdown
else
# something failed, so we clean up
rm -f /run/initramfs/shutdown
echo "Unpacking of $IMG to /run/initramfs failed" >&2
rm -f -- /run/initramfs/shutdown
exit 1
fi

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 et filetype=sh
#
@@ -23,7 +23,7 @@
__DRACUT_LOGGER__=1
## @brief Logging facility module for Dracut both at build- and boot-time.
## @brief Logging facility module for dracut both at build- and boot-time.
#
# @section intro Introduction
#
@@ -89,7 +89,7 @@ __DRACUT_LOGGER__=1
# @see dlog_init()
## @brief Initializes Dracut Logger.
## @brief Initializes dracut Logger.
#
# @retval 1 if something has gone wrong
# @retval 0 on success.
@@ -116,39 +116,56 @@ dlog_init() {
if [ -z "$fileloglvl" ]; then
[ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
elif (( $fileloglvl >= 0 )); then
__oldumask=$(umask)
umask 0377
! [ -e "$logfile" ] && >"$logfile"
umask $__oldumask
if [ -w "$logfile" -a -f "$logfile" ]; then
elif (( $fileloglvl > 0 )); then
if [[ $logfile ]]; then
__oldumask=$(umask)
umask 0377
! [ -e "$logfile" ] && >"$logfile"
umask $__oldumask
if [ -w "$logfile" -a -f "$logfile" ]; then
# Mark new run in the log file
echo >>"$logfile"
if command -v date >/dev/null; then
echo "=== $(date) ===" >>"$logfile"
echo >>"$logfile"
if command -v date >/dev/null; then
echo "=== $(date) ===" >>"$logfile"
else
echo "===============================================" >>"$logfile"
fi
echo >>"$logfile"
else
echo "===============================================" >>"$logfile"
fi
echo >>"$logfile"
else
# We cannot log to file, so turn this facility off.
fileloglvl=0
ret=1
errmsg="'$logfile' is not a writable file"
fileloglvl=0
ret=1
errmsg="'$logfile' is not a writable file"
fi
fi
fi
if (( $sysloglvl >= 0 )); then
if ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null
then
if (( $UID != 0 )); then
kmsgloglvl=0
sysloglvl=0
fi
if (( $sysloglvl > 0 )); then
if [[ -d /run/systemd/journal ]] \
&& 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"
mkfifo "$_systemdcatfile"
readonly _dlogfd=15
systemd-cat -t 'dracut' --level-prefix=true <"$_systemdcatfile" &
exec 15>"$_systemdcatfile"
elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then
# We cannot log to syslog, so turn this facility off.
kmsgloglvl=$sysloglvl
sysloglvl=0
ret=1
errmsg="No '/dev/log' or 'logger' included for syslog logging"
fi
fi
if (($sysloglvl >= 0)) || (($kmsgloglvl >= 0 )); then
if (($sysloglvl > 0)) || (($kmsgloglvl > 0 )); then
if [ -n "$dracutbasedir" ]; then
readonly syslogfacility=user
else
@@ -165,34 +182,34 @@ dlog_init() {
export maxloglvl
if (($stdloglvl < 6)) && (($kmsgloglvl < 6)) && (($fileloglvl < 6)); then
if (($stdloglvl < 6)) && (($kmsgloglvl < 6)) && (($fileloglvl < 6)) && (($sysloglvl < 6)); then
unset dtrace
dtrace() { :; };
fi
if (($stdloglvl < 5)) && (($kmsgloglvl < 5)) && (($fileloglvl < 5)); then
if (($stdloglvl < 5)) && (($kmsgloglvl < 5)) && (($fileloglvl < 5)) && (($sysloglvl < 5)); then
unset ddebug
ddebug() { :; };
fi
if (($stdloglvl < 4)) && (($kmsgloglvl < 4)) && (($fileloglvl < 4)); then
if (($stdloglvl < 4)) && (($kmsgloglvl < 4)) && (($fileloglvl < 4)) && (($sysloglvl < 4)); then
unset dinfo
dinfo() { :; };
fi
if (($stdloglvl < 3)) && (($kmsgloglvl < 3)) && (($fileloglvl < 3)); then
if (($stdloglvl < 3)) && (($kmsgloglvl < 3)) && (($fileloglvl < 3)) && (($sysloglvl < 3)); then
unset dwarn
dwarn() { :; };
unset dwarning
dwarning() { :; };
fi
if (($stdloglvl < 2)) && (($kmsgloglvl < 2)) && (($fileloglvl < 2)); then
if (($stdloglvl < 2)) && (($kmsgloglvl < 2)) && (($fileloglvl < 2)) && (($sysloglvl < 2)); then
unset derror
derror() { :; };
fi
if (($stdloglvl < 1)) && (($kmsgloglvl < 1)) && (($fileloglvl < 1)); then
if (($stdloglvl < 1)) && (($kmsgloglvl < 1)) && (($fileloglvl < 1)) && (($sysloglvl < 1)); then
unset dfatal
dfatal() { :; };
fi
@@ -306,15 +323,23 @@ _dlvl2syslvl() {
_do_dlog() {
local lvl="$1"; shift
local lvlc=$(_lvl2char "$lvl") || return 0
local msg="$lvlc: $*"
local msg="$*"
local lmsg="$lvlc: $*"
(( $lvl <= $stdloglvl )) && echo "$msg" >&2
if (( $lvl <= $sysloglvl )); then
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) "$msg"
if [[ "$_dlogfd" ]]; then
printf -- "<%s>%s\n" "$(($(_dlvl2syslvl $lvl) & 7))" "$msg" >&$_dlogfd
else
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) -- "$msg"
fi
fi
if (( $lvl <= $fileloglvl )) && [[ -w "$logfile" ]] && [[ -f "$logfile" ]]; then
echo "$msg" >>"$logfile"
echo "$lmsg" >>"$logfile"
fi
(( $lvl <= $kmsgloglvl )) && \
echo "<$(_dlvl2syslvl $lvl)>dracut[$$] $msg" >/dev/kmsg
}
@@ -342,7 +367,7 @@ dlog() {
if (( $# > 1 )); then
_do_dlog "$@"
else
while read line; do
while read line || [ -n "$line" ]; do
_do_dlog "$1" "$line"
done
fi

View File

@@ -10,10 +10,16 @@ dracut - low-level tool for generating an initramfs image
SYNOPSIS
--------
*dracut* ['OPTION...'] [<image> [_<kernel version>_]]
*dracut* [__OPTION...__] [__<image>__ [__<kernel version>__]]
DESCRIPTION
-----------
Create an initramfs <image> for the kernel with the version <kernel version>.
If <kernel version> is omitted, then the version of the actual running
kernel is used. If <image> is omitted or empty, then the default location
/boot/initramfs-<kernel version>.img is used.
dracut creates an initial image used by the kernel for preloading the block
device modules (such as IDE, SCSI or RAID) which are needed to access the root
filesystem, mounting the root filesystem and booting into the real system.
@@ -22,7 +28,19 @@ At boot time, the kernel unpacks that archive into RAM disk, mounts and uses it
as initial root file system. All finding of the root device happens in this
early userspace.
For a complete list of kernel command line options see *dracut.cmdline*(7)
For a complete list of kernel command line options see *dracut.cmdline*(7).
If you are dropped to an emergency shell, while booting your initramfs,
the file _/run/initramfs/rdsosreport.txt_ is created, which can be safed to a
(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. It should be attached to any report about dracut problems.
USAGE
-----
include::dracut.usage.asc[]
OPTIONS
-------
@@ -154,12 +172,25 @@ example:
specify additional directories, where to look for firmwares. This parameter
can be specified multiple times.
**--kernel-cmdline <parameters>**::
specify default kernel command line parameters
**--kernel-only**::
only install kernel drivers and firmware files
**--no-kernel**::
do not install kernel drivers and firmware files
**--early-microcode**::
Combine early microcode with ramdisk
**--no-early-microcode**::
Do not combine early microcode with ramdisk
**--print-cmdline**::
print the kernel command line for the current disk layout
**--mdadmconf**::
include local _/etc/mdadm.conf_
@@ -190,10 +221,16 @@ example:
inhibit installation of any fsck tools
**--strip**::
strip binaries in the initramfs
strip binaries in the initramfs (default)
**--nostrip**::
do not strip binaries in the initramfs (default)
do not strip binaries in the initramfs
**--prelink**::
prelink binaries in the initramfs (default)
**--noprelink**::
do not prelink binaries in the initramfs
**--hardlink**::
hardlink files in the initramfs (default)
@@ -238,6 +275,12 @@ Default:
**--sshkey** _<sshkey file>_:: ssh key file used with ssh-client module.
**--logfile** _<logfile>_:: logfile to use; overrides any setting from
the configuration files.
+
Default:
_/var/log/dracut.log_
**-l, --local**::
activates the local mode. dracut will use modules from the current working
directory instead of the system-wide installed modules in
@@ -254,26 +297,47 @@ If chrooted to another root other than the real root device, use "--fstab" and
provide a valid _/etc/fstab_.
====
**--no-hostonly**::
**-N, --no-hostonly**::
Disable Host-Only mode
**--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
**--persistent-policy** _<policy>_::
Use _<policy>_ to address disks and partitions.
_<policy>_ can be any directory name found in /dev/disk.
E.g. "by-uuid", "by-label"
**--fstab**::
Use _/etc/fstab_ instead of _/proc/self/mountinfo_.
**--add-fstab** _<filename>_ ::
**--add-fstab** _<filename>_::
Add entries of _<filename>_ to the initramfs /etc/fstab.
**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ _<filesystem options>_"::
Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem
options>_ in the initramfs
**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ [_<filesystem options>_ [_<dump frequency>_ [_<fsck order>_]]]"::
Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ in the
initramfs. _<filesystem options>_, _<dump options>_ and _<fsck order>_ can
be specified, see fstab manpage for the details.
The default _<filesystem options>_ is "defaults".
The default _<dump frequency>_ is "0".
the default _<fsck order>_ is "2".
**-i, --include** _<SOURCE>_ _<TARGET>_::
**--add-device** _<device>_ ::
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
This can be useful in hostonly mode for resume support when your swap is on
LVM or an encrypted partition.
[NB --device can be used for compatibility with earlier releases]
**-i, --include** _<SOURCE>_ _<TARGET>_::
include the files in the SOURCE directory into the
TARGET directory in the final initramfs. If SOURCE is a file, it will be
installed to TARGET in the final initramfs. This parameter can be specified
multiple times.
**-I, --install** _<file list>_::
**-I, --install** _<file list>_::
install the space separated list of files into the initramfs.
+
[NOTE]
@@ -305,7 +369,7 @@ will not be able to boot. Equivalent to "--compress=bzip2"
[WARNING]
====
Make sure your kernel has lzma decompression support compiled in, otherwise you
will not be able to boot. Equivalent to "--compress=lzma -9"
will not be able to boot. Equivalent to "lzma --compress=lzma -9"
====
**--xz**::
@@ -314,8 +378,24 @@ will not be able to boot. Equivalent to "--compress=lzma -9"
[WARNING]
====
Make sure your kernel has xz decompression support compiled in, otherwise you
will not be able to boot. Equivalent to "--compress=xz --check=crc32
--lzma2=dict=1MiB"
will not be able to boot. Equivalent to
"lzma --compress=xz --check=crc32 --lzma2=dict=1MiB"
====
**--lzo**::
Compress the generated initramfs using lzop.
[WARNING]
====
Make sure your kernel has lzo decompression support compiled in, otherwise you
will not be able to boot.
====
**--lz4**::
Compress the generated initramfs using lz4.
[WARNING]
====
Make sure your kernel has lz4 decompression support compiled in, otherwise you
will not be able to boot.
====
**--compress** _<compressor>_::
@@ -338,6 +418,31 @@ will not be able to boot. Equivalent to "--compress=xz --check=crc32
**--keep**::
Keep the initramfs temporary directory for debugging purposes.
**--printsize**::
Print out the module install size
**--profile**:
Output profile information of the build process
**--ro-mnt**:
Mount / and /usr read-only by default.
**-L, --stdlog** _<level>_::
[0-6] Specify logging level (to standard error)
----
0 - suppress any messages
1 - only fatal errors
2 - all errors
3 - warnings
4 - info
5 - debug info (here starts lots of output)
6 - trace info (and even more)
----
**--regenerate-all**::
Regenerate all initramfs images at the default location with the kernel
versions found on the system. Additional parameters are passed through.
FILES
-----
_/var/log/dracut.log_::
@@ -353,6 +458,9 @@ _/etc/dracut.conf_::
_/etc/dracut.conf.d/*.conf_::
see dracut.conf5
_/usr/lib/dracut/dracut.conf.d/*.conf_::
see dracut.conf5
Configuration in the initramfs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_/etc/conf.d/_::
@@ -361,6 +469,10 @@ _/etc/conf.d/_::
set in the configuration files.
_/etc/cmdline_::
Can contain additional command line options. Deprecated, better use
/etc/cmdline.d/*.conf.
_/etc/cmdline.d/*.conf_::
Can contain additional command line options.
AVAILABILITY

View File

@@ -1,7 +1,7 @@
dracut
======
Harald Hoyer <harald@redhat.com>
v2.0, March 2011
v3.0, October 2013
:language: bash
@@ -79,7 +79,7 @@ udev pulls in modules matching the computer's detected hardware.
initialized and a user-space helper started to paint animations onto the display
in lockstep with the boot process.
* If the root file system is on NFS, dracut does then:
* If the root file system is on NFS, dracut does then:
** Bring up the primary network interface.
** Invoke a DHCP client, with which it can obtain a DHCP lease.
** Extract the name of the NFS share and the address of the NFS server from the
@@ -120,902 +120,39 @@ final cleanup tasks. On an initramfs, the initial root file system cannot be
rotated away. Instead, it is simply emptied and the final root file system
mounted over the top.
If the systemd module is used in the initramfs, the ordering of the services
started looks like <<dracutbootup7>>.
== Dracut on shutdown
On a systemd driven system, the dracut initramfs is also used for the shutdown
procedure.
The following steps are executed during a shutdown:
* systemd switches to the shutdown.target
* systemd starts
/lib/systemd/system/shutdown.target.wants/dracut-shutdown.service
* dracut-shutdown.service executes /usr/lib/dracut/dracut-initramfs-restore
which unpacks the initramfs to /run/initramfs
* systemd finishes shutdown.target
* systemd kills all processes
* systemd tries to unmount everything and mounts the remaining read-only
* systemd checks, if there is a /run/initramfs/shutdown executable
* if yes, it does a pivot_root to /run/initramfs and executes ./shutdown.
The old root is then mounted on /oldroot.
/usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable.
* shutdown will try to umount every /oldroot mount and calls the various
shutdown hooks from the dracut modules
This ensures, that all devices are disassembled and unmounted cleanly.
= User Manual
== Creating an initramfs Image
To create a initramfs image, the most simple command is:
----
# dracut
----
This will generate a general purpose initramfs image, with all possible
functionality resulting of the combination of the installed dracut modules and
system tools. The image is /boot/initramfs-_++<kernel version>++_.img and
contains the kernel modules of the currently active kernel with version
_++<kernel version>++_.
If the initramfs image already exists, dracut will display an error message, and
to overwrite the existing image, you have to use the --force option.
----
# dracut --force
----
If you want to specify another filename for the resulting image you would issue
a command like:
----
# dracut foobar.img
----
To generate an image for a specific kernel version, the command would be:
----
# dracut foobar.img 2.6.40-1.rc5.f20
----
A shortcut to generate the image at the default location for a specific kernel
version is:
----
# dracut --kver 2.6.40-1.rc5.f20
----
If you want to create lighter, smaller initramfs images, you may want to specify
the --host-only 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
--host-only 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.
=== Inspecting the Contents
To see the contents of the image created by dracut, you can use the lsinitrd tool.
----
# lsinitrd /boot/initramfs-$(uname -r).img | less
----
To display the contents of a file in the initramfs also use the lsinitrd tool:
----
# lsinitrd /boot/initramfs-$(uname -r).img /etc/ld.so.conf
include ld.so.conf.d/*.conf
----
=== Adding dracut Modules
Some dracut modules are turned off by default and have to be activated manually.
You can do this by adding the dracut modules to the configuration file
_/etc/dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_. See <<dracutconf5>>.
You can also add dracut modules on the command line
by using the -a or --add option:
----
# dracut --add bootchart initramfs-bootchart.img
----
To see a list of available dracut modules, use the --list-modules option:
----
# dracut --list-modules
----
or, if you have a dracut version earlier than +008+, issue the command:
----
# for mod in /usr/lib/dracut/modules.d/*; do echo ${mod##*/??}; done
----
=== Omitting dracut Modules
Sometimes you don't want a dracut module to be included for reasons of speed,
size or functionality. To do this, either specify the omit_dracutmodules
variable in the _dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_ configuration
file (see <<dracutconf5>>), or use the -o or --omit option
on the command line:
----
# dracut -o "multipath lvm" no-multipath-lvm.img
----
=== Adding Kernel Modules
If you need a special kernel module in the initramfs, which is not
automatically picked up by dracut, you have the use the --add-drivers option
on the command line or the drivers vaiable in the _/etc/dracut.conf_
or _/etc/dracut.conf.d/myconf.conf_ configuration file (see <<dracutconf5>>):
----
# dracut --add-drivers mymod initramfs-with-mymod.img
----
== Boot parameters
The generated initramfs.img file normally does not contain any system
configuration files (except for some special exceptions), so the configuration
has to be done on the kernel command line. With this flexibility, you can easily
boot from a changed root partition, without the need to recompile the initramfs
image. So, you could completly change your root partition (move it inside a md
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_, if
grub 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>>.
For a full reference of all kernel command line parameters, see <<dracut8>>.
=== Specifying the root Device
This is the only option dracut really needs to boot from your root partition.
Because your root partition can live in various environments, there are a lot of
formats for the root= option. The most basic one is root=_++<path to device
node>++_:
----
root=/dev/sda2
----
Because device node names can change, dependent on the drive ordering, you are
encouraged to use the filesystem identifier (UUID) or filesystem label (LABEL)
to specify your root partition:
----
root=UUID=19e9dda3-5a38-484d-a9b0-fa6b067d0331
----
or
----
root=LABEL=myrootpartitionlabel
----
To see all UUIDs or LABELs on your system, do:
----
# ls -l /dev/disk/by-uuid
----
or
----
# ls -l /dev/disk/by-label
----
If your root partition is on the network see <<NetworkBoot>>.
=== Keyboard Settings
If you have to input passwords for encrypted disk volumes, you might want to set
the keyboard layout and specify a display font.
A typical german kernel command would contain:
----
vconsole.font=latarcyrheb-sun16 vconsole.keymap=de-latin1-nodeadkeys locale.LANG=de_DE.UTF-8
----
Setting these options can override the setting stored on your system, if you use
a modern init system, like systemd.
For dracut versions prior to version +008+ the line would look like:
----
LANG=de_DE.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=de-latin1-nodeadkeys
----
=== Blacklisting Kernel Modules
Sometimes it is required to prevent the automatic kernel module loading of a
specific kernel module. To do this, just add rd.blacklist=_++<kernel module
name>++_, with _++<kernel module name>++_ not containing the _.ko_
suffix, to the kernel command line. For example:
----
rd.driver.blacklist=mptsas rd.driver.blacklist=nouveau
----
The option can be specified multiple times on the kernel command line.
=== Speeding up the Boot Process
If you want to speed up the boot process, you can specify as much information
for dracut on the kernel command as possible. For example, you can tell dracut,
that you root partition is not on a LVM volume or not on a raid partition, or
that it lives inside a specific crypto LUKS encrypted volume. By default, dracut
searches everywhere. A typical dracut kernel command line for a plain primary or
logical partition would contain:
----
rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0
----
On systems with dracut version prior to +008+ the line would look like:
----
rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM
----
This turns off every automatic assembly of LVM, MD raids, DM raids and crypto LUKS.
Of course, you could also omit the dracut modules in the initramfs creation
process, but then you would lose the posibility to turn it on on demand.
[[Injecting]]
=== Injecting custom Files
To add your own files to the initramfs image, you have several possibilities.
The --include option let you specify a source path and a target path. For example
----
# dracut --include cmdline-preset /etc/cmdline initramfs-cmdline-pre.img
----
will create an initramfs image, where the file cmdline-preset will be copied
inside the initramfs to _/etc/cmdline_. --include can only be specified once.
----
# mkdir rd.live.overlay
# mkdir rd.live.overlay/etc
# mkdir rd.live.overlay/etc/conf.d
# echo "ip=auto" >> rd.live.overlay/etc/cmdline
# echo export TESTVAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
# echo export TESTVAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
# tree rd.live.overlay/
rd.live.overlay/
└── etc
├── cmdline
└── conf.d
└── testvar.conf
# dracut --include rd.live.overlay / initramfs-rd.live.overlay.img
----
This will put the contents of the rd.live.overlay directory into the root of the
initramfs image.
The --install option let you specify several files, which will get installed in
the initramfs image at the same location, as they are present on initramfs
creation time.
----
# dracut --install 'strace fsck.ext3 ssh' initramfs-dbg.img
----
This will create an initramfs with the strace, fsck.ext3 and ssh executables,
together with the libraries needed to start those. The --install option can be
specified multiple times.
[[NetworkBoot]]
== Network Boot
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 rd.ip=auto 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
mechanism, you have static configuration on your client machine and a
centralized boot configuration on your TFTP/DHCP server. If you can't pass a
kernel command line, then you can inject _/etc/cmdline_, with a method described
in <<Injecting>>.
=== Reducing the Image Size
To reduce the size of the initramfs, you should create it with by ommitting all
dracut modules, which you know, you don't need to boot the machine.
You can also specify the exact dracut and kernel modules to produce a very tiny
initramfs image.
For example for a NFS image, you would do:
----
# dracut -m "nfs network base" initramfs-nfs-only.img
----
Then you would boot from this image with your target machine and reduce the size
once more by creating it on the target machine with the --host-only option:
----
# dracut -m "nfs network base" --host-only initramfs-nfs-host-only.img
----
This will reduce the size of the initramfs image significantly.
=== NFS Root Device
FIXME
=== iSCSI Root Device
FIXME
=== FCoE Root Device
FIXME
== Troubleshooting
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:
http://fedoraproject.org/wiki/How_to_debug_Dracut_problems
[[identifying-your-problem-area]]
=== Identifying your problem area
. Remove ''rhgb'' and ''quiet'' from the kernel command line
. Add ''rd.shell'' to the kernel command line. This will present a shell should
dracut be unable to locate your root device
. Add ''rd.shell rd.debug log_buf_len=1M'' to the kernel command line so that
dracut shell commands are printed as they are executed
. With dracut >= 002-11, you can inspect the rd.debug output with:
+
----
# less /run/initramfs/init.log
# dmesg | less
----
[[information-to-include-in-your-report]]
=== Information to include in your report
[[all-bug-reports]]
==== All bug reports
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_.
* A copy of your disk partition information from _/etc/fstab_, which might be
obtained booting an old working initramfs or a rescue medium.
* A device listing from device-mapper. This can be obtained by running the
command
+
----
# dmsetup ls --tree
----
+
* A list of block device attributes. This can be obtained by running the commands:
+
----
# blkid -p
# blkid -p -o udev
----
* Turn on dracut debugging (see _the 'debugging dracut' section_), and attach
all relevant information from the boot log. This can be obtained by running the
command
+
----
# dmesg|grep dracut
----
+
* If you use a dracut configuration file, please include _/etc/dracut.conf_ and
all files in _/etc/dracut.conf.d/*.conf_
[[logical-volume-management-related-problems]]
==== Logical Volume Management related problems
As well as the information from <<all-bug-reports>> include the following
information:
* Include physical volume information by running the command:
+
----
# lvm pvdisplay
----
+
* Include volume group information by running the command:
+
----
# lvm vgdisplay
----
+
* Include logical volume information by running the command:
+
----
# lvm lvdisplay
----
[[software-raid-related-problems]]
==== Software RAID related problems
As well as the information from <<all-bug-reports>>, include the following
information:
* If using software RAID disk partitions, please include the output of
+
----
# cat /proc/mdstat
----
[[network-root-device-related-problems]]
==== Network root device related problems
This section details information to include when experiencing problems on a
system whose root device is located on a network attached volume (e.g. iSCSI,
NFS or NBD). As well as the information from <<all-bug-reports>>, include the
following information:
* Please include the output of
+
----
# /sbin/ifup <interfacename>
# ip addr show
----
[[debugging-dracut]]
=== Debugging dracut
[[configure-a-serial-console]]
==== Configure a serial console
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''
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
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_)
. Remove the boot arguments ''rhgb'' and ''quiet''
+
A sample _/etc/grub.conf_ bootloader configuration file 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
----
+
. If system boot fails, you will be dropped into a shell as seen in the example below.
+
----
No root device found
Dropping to debug shell.
#
----
+
. Use this shell prompt to gather the information requested above (see <<all-bug-reports>>).
[[accessing-the-root-volume-from-the-dracut-shell]]
==== Accessing the root volume from the dracut shell
From the dracut debug shell, you can manually perform the task of locating and
preparing your root volume for boot. The required steps will depend on how your
root volume is configured. Common scenarios include:
* A block device (e.g. _/dev/sda7_)
* A LVM logical volume (e.g. _/dev/VolGroup00/LogVol00_)
* An encrypted device (e.g. _/dev/mapper/luks-4d5972ea-901c-4584-bd75-1da802417d83_)
* A network attached device (e.g. netroot=iscsi:@192.168.0.4::3260::iqn.2009-02.org.fedoraproject:for.all)
The exact method for locating and preparing will vary. However, to continue with
a successful boot, the objective is to locate your root volume and create a
symlink _/dev/root_ which points to the file system. For example, the following
example demonstrates accessing and booting a root volume that is an encrypted
LVM Logical volume.
. Inspect your partitions using parted
+
----
# parted /dev/sda -s p
Model: ATA HTS541060G9AT00 (scsi)
Disk /dev/sda: 60.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 10.8GB 107MB primary ext4 boot
2 10.8GB 55.6GB 44.7GB logical lvm
----
+
. You recall that your root volume was a LVM logical volume. Scan and activate
any logical volumes.
+
----
# lvm vgscan
# lvm vgchange -ay
----
+
. You should see any logical volumes now using the command blkid:
+
----
# blkid
/dev/sda1: UUID="3de247f3-5de4-4a44-afc5-1fe179750cf7" TYPE="ext4"
/dev/sda2: UUID="Ek4dQw-cOtq-5MJu-OGRF-xz5k-O2l8-wdDj0I" TYPE="LVM2_member"
/dev/mapper/linux-root: UUID="def0269e-424b-4752-acf3-1077bf96ad2c" TYPE="crypto_LUKS"
/dev/mapper/linux-home: UUID="c69127c1-f153-4ea2-b58e-4cbfa9257c5e" TYPE="ext3"
/dev/mapper/linux-swap: UUID="47b4d329-975c-4c08-b218-f9c9bf3635f1" TYPE="swap"
----
+
. From the output above, you recall that your root volume exists on an encrypted
block device. Following the guidance disk encryption guidance from the
Installation Guide, you unlock your encrypted root volume.
+
----
# UUID=$(cryptsetup luksUUID /dev/mapper/linux-root)
# cryptsetup luksOpen /dev/mapper/linux-root luks-$UUID
Enter passphrase for /dev/mapper/linux-root:
Key slot 0 unlocked.
----
+
. Next, make a symbolic link to the unlocked root volume
+
----
# ln -s /dev/mapper/luks-$UUID /dev/root
----
+
. With the root volume available, you may continue booting the system by exiting
the dracut shell
+
----
# exit
----
[[additional-dracut-boot-parameters]]
==== Additional dracut boot parameters
For more debugging options, see <<dracutkerneldebug>> in <<dracutcmdline7>>.
= Developer Manual
== dracut Components
dracut uses a modular system to build and extend the initramfs image. All
modules are located in _/usr/lib/dracut/modules.d_ or in _<git-src>/modules.d_.
The most basic dracut module is _99base_. In _99base_ the initial shell script
init is defined, which gets run by the kernel after initramfs loading. Although
you can replace init with your own version of _99base_, this is not encouraged.
Instead you should use, if possible, the hooks of dracut. All hooks, and the
point of time in which they are executed, are described in <<stages>>.
The main script, which creates the initramfs is dracut itsself. It parses all
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
archived and compressed to the final initramfs image. All helper functions used
by check, install and installkernel are found in in the file _dracut-functions_.
These shell functions are available to all module installer (install,
installkernel) scripts, without the need to source _dracut-functions_.
A module can check the preconditions for install and installkernel with the
check script. Also dependencies can be expressed with check. If a module passed
check, install and installkernel will be called to install all of the necessary
files for the module. To split between kernel and non-kernel parts of the
installation, all kernel module related parts have to be in installkernel. All
other files found in a module directory are module specific and mostly are hook
scripts and udev rules.
[[stages]]
== Boot Process Stages
The init script in _99base_ is the main script, which prepares the root file
system for usage, runs udev, mounts the real root device, kills the remaining
processes, and switches to the real root device for further booting. dracut
modules can insert custom script at various points, to control the boot process.
These hooks are plain directories containing shell scripts ending with ".sh",
which are sourced by init.
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
=== Basic Setup
The first thing init does, is to mount _/proc_ and _/sys_ and manually create
the basic device nodes and symbolic links in _/dev_ needed to execute basic
commands. Then logging is setup according to kernel command line arguments.
_/dev/pts_ and _/dev/shm_ are mounted and the first hook is sourced.
=== Hook: cmdline
The _cmdline_ hook is a place to insert scripts to parse the kernel command line
and prepare the later actions, like setting up udev rules and configuration
files.
In this hook the most important environment variable is defined: root. The
second one is rootok, which indicates, that a module claimed to be able to parse
the root defined. So for example, **root=**__iscsi:....__ will be claimed by the
iscsi dracut module, which then sets rootok.
=== Hook: pre-udev
This hook is executed right after the cmdline hook and a check if root and
rootok were set. Here modules can take action with the final root, and before
udev has been run.
=== Start Udev
Now udev is started and the logging for udev is setup.
=== Hook: pre-trigger
In this hook, you can set udev environment variables with **udevadm control
--property=KEY=_value_** or control the further execution of udev with
udevadm.
=== Trigger Udev
udev is triggered by calling udevadm trigger, which sends add events for all
devices and subsystems.
=== Main Loop
Now the main loop of 99base/init begins. Here we loop until udev has settled and
all scripts in _initqueue/finished_ returned true. In this loop there are three
hooks, where scripts can be inserted by calling /sbin/initqueue.
==== Initqueue
This hook gets executed every time a script is inserted here, regardless of the
udev state.
==== Initqueue settled
This hooks gets executed every time udev has settled.
==== Initqueue timeout
This hooks gets executed, when the main loop counter becomes half of the
rd.retry counter.
==== Initqueue finished
This hook is called after udev has settled and if all scripts herein return 0
the main loop will be ended.
=== Hook: pre-mount
Before the root device is mounted all scripts in the hook pre-mount are
executed. In some cases (e.g. NFS) the real root device is already mounted,
though.
=== Hook: mount
This hook is mainly to mount the real root device.
=== Hook: pre-pivot
This hook is called before cleanup hook, This is a good place for
actions other than cleanups which need to be called before pivot.
=== Hook: cleanup
This hook is the last hook and is called before init finally switches root to
the real root device. This is a good place to clean up and kill processes not
needed anymore.
=== Cleanup and switch_root
Init kills all udev processes, cleans up the environment, sets up the arguments
for the real init process and finally calls switch_root. switch_root removes the
whole filesystem hierarchy of the initramfs, chroot()s to the real root device
and calls /sbin/init with the specified arguments.
To ensure all files in the initramfs hierarchy can be removed, all processes
still running from the initramfs should not have any open file descriptors left.
== Network Infrastructure
FIXME
== Writing a Module
A simple example module is _96insmodpost_, which modprobes a kernel module after
udev has settled and the basic device drivers have been loaded.
All module installation information is in the file module-setup.sh.
First we create a check() function, which just exits with 0 indicating that this
module should be included by default.
check():
----
return 0
----
The we create the install() function, which installs a cmdline hook with
priority number 20 called _parse-insmodpost.sh_. It also installs the
_insmodpost.sh_ script in _/sbin_.
install():
----
inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
----
The _pase-instmodpost.sh_ parses the kernel command line for a argument
rd.driver.post, blacklists the module from being autoloaded and installs the
hook _insmodpost.sh_ in the _initqueue/settled_.
_parse-insmodpost.sh_:
----
for p in $(getargs rd.driver.post=); do
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
_do_insmodpost=1
done
[ -n "$_do_insmodpost" ] && /sbin/initqueue --settled --unique --onetime /sbin/insmodpost.sh
unset _do_insmodpost
----
_insmodpost.sh_, which is called in the _initqueue/settled_ hook will just
modprobe the kernel modules specified in all rd.driver.post kernel command line
parameters. It runs after udev has settled and is only called once (--onetime).
_insmodpost.sh_:
----
. /lib/dracut-lib.sh
for p in $(getargs rd.driver.post=); do
modprobe $p
done
----
=== check()
_check()_ is called by dracut to evaluate the inclusion of a dracut module in
the initramfs.
$hostonly:: If the $hostonly variable is set, then the module check() function
should be in "hostonly" mode, which means, that the check() should only return
0, if the module is really needed to boot this specific host.
check() should return with:
0:: Include the dracut module in the initramfs.
1:: Do not include the dracut module. The requirements are not fullfilled
(missing tools, etc.)
255:: Only include the dracut module, if another module requires it or if
explicitly specified in the config file or on the argument list.
=== depends()
The function depends() should echo all other dracut module names the module
depends on.
=== install()
dracut_install
inst
inst_hook
inst_rules
=== installkernel()
instmods
=== Creation Functions
FIXME
=== Initramfs Functions
FIXME
=== Network Modules
FIXME
:leveloffset: 1
[[dracut8]]
include::dracut.8.asc[]
:leveloffset: 1
[[dracutconf5]]
include::dracut.conf.5.asc[]
@@ -1028,6 +165,15 @@ include::lsinitrd.1.asc[]
[[mkinitrd8]]
include::mkinitrd.8.asc[]
= Developer Manual
:leveloffset: 1
[[dracutmodules7]]
include::dracut.modules.7.asc[]
[[dracutbootup7]]
include::dracut.bootup.7.asc[]
:leveloffset: 0
[appendix]
License

123
dracut.bootup.7.asc Normal file
View File

@@ -0,0 +1,123 @@
DRACUT.BOOTUP(7)
================
:doctype: manpage
:man source: dracut
:man manual: dracut
NAME
----
dracut.bootup - boot ordering in the initramfs
DESCRIPTION
-----------
This flow chart illustrates the ordering of the services, if systemd is used in
the dracut initramfs.
----
systemd-journal.socket
|
v
dracut-cmdline.service
|
v
dracut-pre-udev.service
|
v
systemd-udevd.service
|
v
local-fs-pre.target dracut-pre-trigger.service
| |
v v
(various mounts) (various swap systemd-udev-trigger.service
| devices...) | (various low-level (various low-level
| | | services: seed, API VFS mounts:
v v v tmpfiles, random mqueue, configfs,
local-fs.target swap.target dracut-initqueue.service sysctl, ...) debugfs, ...)
| | | | |
\_______________|____________________ | ___________________|____________________/
\|/
v
sysinit.target
|
_________________/|\___________________
/ | \
| | |
v | v
(various | rescue.service
sockets...) | |
| | v
v | rescue.target
sockets.target |
| |
\_________________ | emergency.service
\| |
v v
basic.target emergency.target
|
______________________/|
/ |
| v
| dracut-pre-mount.service
| |
| v
| sysroot.mount
| |
| v
| initrd-root-fs.target
(custom initrd services) |
| v
| dracut-mount.service
| |
| v
| initrd-parse-etc.service
| |
| v
| (sysroot-usr.mount and
| various mounts marked
| with fstab option
| x-initrd.mount)
| |
| v
| initrd-fs.target
\______________________ |
\|
v
initrd.target
|
v
dracut-pre-pivot.service
|
v
initrd-cleanup.service
isolates to
initrd-switch-root.target
|
v
______________________/|
/ |
| initrd-udevadm-cleanup-db.service
| |
(custom initrd services) |
| |
\______________________ |
\|
v
initrd-switch-root.target
|
v
initrd-switch-root.service
|
v
switch-root
----
AUTHOR
------
Harald Hoyer
SEE ALSO
--------
*dracut*(8) *bootup*(7)

File diff suppressed because it is too large Load Diff

View File

@@ -1,21 +1,21 @@
# PUT YOUR CONFIG HERE OR IN separate files named *.conf
# in /etc/dracut.conf.d
# /etc/dracut.conf.d/*.conf will override the settings in here
# SEE man dracut.conf(5)
# Sample dracut config file
logfile=/var/log/dracut.log
fileloglvl=6
#logfile=/var/log/dracut.log
#fileloglvl=6
# Exact list of dracut modules to use. Modules not listed here are not going
# to be included. If you only want to add some optional modules use
# add_dracutmodules option instead.
#dracutmodules+=""
# Dracut modules to omit
# dracut modules to omit
#omit_dracutmodules+=""
# Dracut modules to add to the default
# dracut modules to add to the default
#add_dracutmodules+=""
# additional kernel modules to the default
@@ -29,10 +29,10 @@ fileloglvl=6
#
# install local /etc/mdadm.conf
mdadmconf="yes"
#mdadmconf="no"
# install local /etc/lvm/lvm.conf
lvmconf="yes"
#lvmconf="no"
# A list of fsck tools to install. If it's not specified, module's hardcoded
# default is used, currently: "umount mount /sbin/fsck* xfs_db xfs_check
@@ -43,6 +43,9 @@ lvmconf="yes"
# inhibit installation of any fsck tools
#nofscks="yes"
# mount / and /usr read-only by default
#ro_mnt="no"
# set the directory for temporary files
# default: /var/tmp
#tmpdir=/tmp

View File

@@ -11,16 +11,25 @@ dracut.conf - configuration file(s) for dracut
SYNOPSIS
--------
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_
_/usr/lib/dracut/dracut.conf.d/*.conf_
Description
-----------
_dracut.conf_ is loaded during the initialisation phase of dracut. Command line
parameter will overwrite any values set here. _dracut.conf.d/*.conf_ files are
read in alphanumerical order and will overwrite parameters set in
_/etc/dracut.conf_. Each line specifies an attribute and a value. A '#'
parameter will overwrite any values set here.
_*.conf_ files are read from /usr/lib/dracut/dracut.conf.d and
/etc/dracut.conf.d. Files with the same name in /etc/dracut.conf.d will replace
files in /usr/lib/dracut/dracut.conf.d.
The files are then read in alphanumerical order and will overwrite parameters
set in _/etc/dracut.conf_. Each line specifies an attribute and a value. A '#'
indicates the beginning of a comment; following characters, up to the end of the
line are not interpreted.
dracut command line options will overwrite any values set here.
Configuration files must have the extension .conf; other extensions are ignored.
*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_.
@@ -44,10 +53,6 @@ line are not interpreted.
Specify a space-separated list of kernel modules not to add to the
initramfs. The kernel modules have to be specified without the ".ko" suffix.
*install_items+=*" __<kernel modules>__ "::
Specify a space-separated list of files, which are added to the initramfs
image.
*filesystems+=*" __<filesystem names>__ "::
Specify a space-separated list of kernel filesystem modules to exclusively
include in the generic initramfs.
@@ -64,16 +69,28 @@ line are not interpreted.
*do_strip=*"__{yes|no}__"::
Strip binaries in the initramfs (default=yes)
*do_prelink=*"__{yes|no}__"::
Prelink binaries in the initramfs (default=yes)
*hostonly=*"__{yes|no}__"::
Host-Only mode: Install only what is needed for booting the local host
instead of a generic host and generate host-specific configuration.
*hostonly_cmdline*"__{yes|no}__"::
If set, store the kernel command line arguments needed in the initramfs
*persistent_policy=*"__<policy>__"::
Use _<policy>_ to address disks and partitions.
_<policy>_ can be any directory name found in /dev/disk.
E.g. "by-uuid", "by-label"
*tmpdir=*"__<temporary directory>__"::
Specify temporary directory to use.
[WARNING]
====
If chrooted to another root other than the real root device, use --fstab and provide a valid _/etc/fstab_.
If chrooted to another root other than the real root device, use --fstab and
provide a valid _/etc/fstab_.
====
*use_fstab=*"__{yes|no}__"::
@@ -82,6 +99,11 @@ If chrooted to another root other than the real root device, use --fstab and pro
*add_fstab+=*" __<filename>__ "::
Add entries of __<filename>__ to the initramfs /etc/fstab.
*add_device+=*" __<device>__ "::
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
This can be useful in hostonly mode for resume support when your swap is on
LVM an encrypted partition.
*mdadmconf=*"__{yes|no}__"::
Include local _/etc/mdadm.conf_ (default=yes)
@@ -97,12 +119,36 @@ If chrooted to another root other than the real root device, use --fstab and pro
*nofscks=*"__{yes|no}__"::
If specified, inhibit installation of any fsck tools.
*ro_mnt=*"__{yes|no}__"::
Mount _/_ and _/usr_ read-only by default.
*kernel_cmdline=*"__parameters__"::
Specify default kernel command line parameters
*kernel_only=*"__{yes|no}__"::
Only install kernel drivers and firmware files. (default=no)
*no_kernel=*"{yes|no}"::
*no_kernel=*"__{yes|no}__"::
Do not install kernel drivers and firmware files (default=no)
*acpi_override=*"__{yes|no}__"::
[WARNING] ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING! +
Override BIOS provided ACPI tables. For further documentation read
Documentation/acpi/initrd_table_override.txt in the kernel sources.
Search for ACPI table files (must have .aml suffix) in acpi_table_dir=
directory (see below) and add them to a separate uncompressed cpio
archive. This cpio archive gets glued (concatenated, uncompressed one
must be the first one) to the compressed cpio archive. The first,
uncompressed cpio archive is for data which the kernel must be able
to access very early (and cannot make use of uncompress alogrithms yet)
like microcode or ACPI tables (default=no).
*acpi_table_dir=*"__<dir>__"::
Directory to search for ACPI tables if acpi_override= is set to yes.
*early_microcode=*"{yes|no}"::
Combine early microcode with ramdisk (default=no)
*stdloglvl*="__\{0-6\}__"::
Set logging to standard error level.
@@ -116,16 +162,27 @@ If chrooted to another root other than the real root device, use --fstab and pro
Path to log file.
*show_modules=*"__{yes|no}__"::
Print included module's name to standard output during build.
Print the name of the included modules to standard output during build.
*i18n_vars="__<variable mapping>__"::
Distribution specific variable mapping.
See dracut/modules.d/10i18n/README for a detailed description.
*i18n_default_font=*"__<fontname>__"::
The font <fontname> to install, if not specified otherwise.
Default is "LatArCyrHeb-16".
*i18n_install_all=*"__{yes|no}__"::
Install everything regardless of generic or hostonly mode.
Files
-----
_/etc/dracut.conf_::
Old configuration file. You better use your own file in
_/etc/dracut/conf.d/_.
_/etc/dracut.conf.d/_.
_/etc/dracut/conf.d/_::
Any _/etc/dracut/conf.d/*.conf_ file can overwrite the values in
_/etc/dracut.conf.d/_::
Any _/etc/dracut.conf.d/*.conf_ file can overwrite the values in
_/etc/dracut.conf_. The configuration files are read in alphanumerical
order.

View File

@@ -1,13 +1,17 @@
# Dracut config file customized for RedHat/Fedora.
# dracut config file customized for RedHat/Fedora.
# i18n
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
omit_drivers+=" .*/fs/ocfs/.* "
i18n_default_font="latarcyrheb-sun16"
i18n_install_all="yes"
stdloglvl=3
sysloglvl=5
install_items+=" vi /etc/virc ps grep cat rm "
prefix="/"
systemdutildir=/usr/lib/systemd
systemdsystemunitdir=/usr/lib/systemd/system
systemdsystemconfdir=/etc/systemd/system
udevdir=/usr/lib/udev
add_dracutmodules+=" systemd "
realinitpath="/usr/lib/systemd/systemd"
hostonly="yes"
hostonly_cmdline="no"
early_microcode="yes"

View File

@@ -1,9 +0,0 @@
# /etc/dracut.conf.d/gentoo-openrc.conf
# Dracut config file customized for Gentoo Base System release 2
#
# Modules
#
# i18n
i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE"

View File

@@ -0,0 +1,5 @@
# /etc/dracut.conf.d/gentoo-systemd.conf
# Paths of systemd dirs on Gentoo
systemdutildir=/usr/lib/systemd
systemdsystemunitdir=/usr/lib/systemd/system

View File

@@ -1,9 +1,15 @@
# /etc/dracut.conf.d/gentoo.conf
# Dracut config file customized for Gentoo Base System release 1
# dracut config file customized for Gentoo Base System release 2
udevdir=/lib/udev
ro_mnt=yes
#
# Modules
#
# i18n
i18n_vars="/etc/conf.d/keymaps:KEYMAP,EXTENDED_KEYMAPS-EXT_KEYMAPS /etc/conf.d/consolefont:CONSOLEFONT-FONT,CONSOLETRANSLATION-FONT_MAP /etc/rc.conf:UNICODE"
i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE"
i18n_default_font="LatArCyrHeb-16"
omit_drivers+=" i2o_scsi"

View File

@@ -1,2 +1,3 @@
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"

1120
dracut.css Normal file

File diff suppressed because it is too large Load Diff

299
dracut.modules.7.asc Normal file
View File

@@ -0,0 +1,299 @@
DRACUT.MODULES(7)
=================
:doctype: manpage
:man source: dracut
:man manual: dracut
NAME
----
dracut.modules - dracut modules
DESCRIPTION
-----------
dracut uses a modular system to build and extend the initramfs image. All
modules are located in _/usr/lib/dracut/modules.d_ or in _<git-src>/modules.d_.
The most basic dracut module is _99base_. In _99base_ the initial shell script
init is defined, which gets run by the kernel after initramfs loading. Although
you can replace init with your own version of _99base_, this is not encouraged.
Instead you should use, if possible, the hooks of dracut. All hooks, and the
point of time in which they are executed, are described in <<stages>>.
The main script, which creates the initramfs is dracut itsself. It parses all
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
archived and compressed to the final initramfs image. All helper functions used
by check, install and installkernel are found in in the file _dracut-functions_.
These shell functions are available to all module installer (install,
installkernel) scripts, without the need to source _dracut-functions_.
A module can check the preconditions for install and installkernel with the
check script. Also dependencies can be expressed with check. If a module passed
check, install and installkernel will be called to install all of the necessary
files for the module. To split between kernel and non-kernel parts of the
installation, all kernel module related parts have to be in installkernel. All
other files found in a module directory are module specific and mostly are hook
scripts and udev rules.
[[stages]]
== Boot Process Stages
dracut modules can insert custom script at various points, to control the boot
process.
These hooks are plain directories containing shell scripts ending with ".sh",
which are sourced by init.
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
=== Hook: cmdline
The _cmdline_ hook is a place to insert scripts to parse the kernel command line
and prepare the later actions, like setting up udev rules and configuration
files.
In this hook the most important environment variable is defined: root. The
second one is rootok, which indicates, that a module claimed to be able to parse
the root defined. So for example, **root=**__iscsi:....__ will be claimed by the
iscsi dracut module, which then sets rootok.
=== Hook: pre-udev
This hook is executed right after the cmdline hook and a check if root and
rootok were set. Here modules can take action with the final root, and before
udev has been run.
=== Start Udev
Now udev is started and the logging for udev is setup.
=== Hook: pre-trigger
In this hook, you can set udev environment variables with **udevadm control
--property=KEY=_value_** or control the further execution of udev with
udevadm.
=== Trigger Udev
udev is triggered by calling udevadm trigger, which sends add events for all
devices and subsystems.
=== Main Loop
In the main loop of dracut loops until udev has settled and
all scripts in _initqueue/finished_ returned true.
In this loop there are three hooks, where scripts can be inserted
by calling /sbin/initqueue.
==== Initqueue
This hook gets executed every time a script is inserted here, regardless of the
udev state.
==== Initqueue settled
This hooks (initqueue/settled) gets executed every time udev has settled.
==== Initqueue timeout
This hooks (initqueue/timeout) gets executed, when the main loop counter becomes
half of the rd.retry counter.
==== Initqueue finished
This hook (initqueue/finished) is called after udev has settled and
if all scripts herein return 0 the main loop will be ended.
Abritary scripts can be added here, to loop in the
initqueue until something happens, which a dracut module wants to wait for.
=== Hook: pre-mount
Before the root device is mounted all scripts in the hook pre-mount are
executed. In some cases (e.g. NFS) the real root device is already mounted,
though.
=== Hook: mount
This hook is mainly to mount the real root device.
=== Hook: pre-pivot
This hook is called before cleanup hook, This is a good place for
actions other than cleanups which need to be called before pivot.
=== Hook: cleanup
This hook is the last hook and is called before init finally switches root to
the real root device. This is a good place to clean up and kill processes not
needed anymore.
=== Cleanup and switch_root
Init (or systemd) kills all udev processes, cleans up the environment,
sets up the arguments for the real init process and finally calls switch_root.
switch_root removes the whole filesystem hierarchy of the initramfs,
chroot()s to the real root device and calls /sbin/init with the specified
arguments.
To ensure all files in the initramfs hierarchy can be removed, all processes
still running from the initramfs should not have any open file descriptors left.
== Network Infrastructure
FIXME
== Writing a Module
A simple example module is _96insmodpost_, which modprobes a kernel module after
udev has settled and the basic device drivers have been loaded.
All module installation information is in the file module-setup.sh.
First we create a check() function, which just exits with 0 indicating that this
module should be included by default.
check():
----
return 0
----
The we create the install() function, which installs a cmdline hook with
priority number 20 called _parse-insmodpost.sh_. It also installs the
_insmodpost.sh_ script in _/sbin_.
install():
----
inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
----
The _pase-instmodpost.sh_ parses the kernel command line for a argument
rd.driver.post, blacklists the module from being autoloaded and installs the
hook _insmodpost.sh_ in the _initqueue/settled_.
_parse-insmodpost.sh_:
----
for p in $(getargs rd.driver.post=); do
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
_do_insmodpost=1
done
[ -n "$_do_insmodpost" ] && /sbin/initqueue --settled --unique --onetime /sbin/insmodpost.sh
unset _do_insmodpost
----
_insmodpost.sh_, which is called in the _initqueue/settled_ hook will just
modprobe the kernel modules specified in all rd.driver.post kernel command line
parameters. It runs after udev has settled and is only called once (--onetime).
_insmodpost.sh_:
----
. /lib/dracut-lib.sh
for p in $(getargs rd.driver.post=); do
modprobe $p
done
----
=== module-setup.sh: check()
_check()_ is called by dracut to evaluate the inclusion of a dracut module in
the initramfs.
$hostonly:: If the $hostonly variable is set, then the module check() function
should be in "hostonly" mode, which means, that the check() should only return
0, if the module is really needed to boot this specific host.
check() should return with:
0:: Include the dracut module in the initramfs.
1:: Do not include the dracut module. The requirements are not fullfilled
(missing tools, etc.)
255:: Only include the dracut module, if another module requires it or if
explicitly specified in the config file or on the argument list.
=== module-setup.sh: depends()
The function depends() should echo all other dracut module names the module
depends on.
=== module-setup.sh: cmdline()
This function should print the kernel command line options needed to boot the
current machine setup. It should start with a space and should not print a
newline.
=== module-setup.sh: install()
The install() function is called to install everything non-kernel related.
To install binaries, scripts, and other files, you can use the functions
mentioned in <<creation>>.
To address a file in the current module directory, use the variable "$moddir".
=== module-setup.sh: installkernel()
In installkernel() all kernel related files should be installed. You can use all
of the functions mentioned in <<creation>> to install files.
=== [[creation]]Creation Functions
==== inst_multiple [-o] <file> [ <file> ...]
installs multiple binaries and files. If executables are specified without a
path, dracut will search the path PATH=/usr/sbin:/sbin:/usr/bin:/bin for the
binary. If the option "-o" is given as the first parameter, a missing file does
not lead to an error.
==== inst <src> [<dst>]
installs _one_ file <src> either to the same place in the initramfs or to an
optional <dst>.
==== inst_hook <hookdir> <prio> <src>
installs an executable/script <src> in the dracut hook <hookdir> with priority
<prio>.
==== inst_rules <udevrule> [ <udevrule> ...]
installs one ore more udev rules. Non-existant udev rules are reported, but do
not let dracut fail.
==== instmods <kernelmodule> [ <kernelmodule> ... ]
instmods should be used only in the installkernel() function.
instmods installs one or more kernel modules in the initramfs. <kernelmodule>
can also be a whole subsystem, if prefixed with a "=", like "=drivers/net/team".
instmods will not install the kernel module, if $hostonly is set and the kernel
module is not currently needed by any /sys/*...*/uevent MODALIAS.
To install a kernel module regardless of the hostonly mode use the form:
----
hostonly='' instmods <kernelmodule>
----
=== Initramfs Functions
FIXME
=== Network Modules
FIXME
AUTHOR
------
Harald Hoyer
SEE ALSO
--------
*dracut*(8)

1150
dracut.sh

File diff suppressed because it is too large Load Diff

View File

@@ -21,8 +21,8 @@ Group: System/Base
%endif
# The entire source code is GPLv2+
# except install/* which is LGPLv2.1+
License: GPLv2+ and LGPLv2.1+
# except install/* which is LGPLv2+
License: GPLv2+ and LGPLv2+
URL: https://dracut.wiki.kernel.org/
@@ -30,11 +30,17 @@ URL: https://dracut.wiki.kernel.org/
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
BuildRequires: dash bash git
BuildRequires: bash git
%if 0%{?fedora} || 0%{?rhel}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: pkgconfig
%endif
%if 0%{?fedora}
BuildRequires: bash-completion
BuildRequires: pkgconfig
%endif
%if 0%{?suse_version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%endif
@@ -70,7 +76,11 @@ Provides: mkinitrd = 2.6.1
Obsoletes: dracut-kernel < 005
Provides: dracut-kernel = %{version}-%{release}
Requires: bash
Obsoletes: dracut <= 029
Obsoletes: dracut-norescue
Provides: dracut-norescue
Requires: bash >= 4
Requires: coreutils
Requires: cpio
Requires: filesystem >= 2.1.0
@@ -78,14 +88,17 @@ Requires: findutils
Requires: grep
Requires: hardlink
Requires: gzip xz
Requires: module-init-tools >= 3.7-9
Requires: kmod
Requires: sed
Requires: file
Requires: udev > 166
Requires: kpartx
%if 0%{?fedora} || 0%{?rhel} > 6
Requires: util-linux >= 2.21
Conflicts: systemd < 187
Requires: systemd >= 219
Requires: procps-ng
Conflicts: grubby < 8.23
%else
Requires: udev > 166
Requires: util-linux-ng >= 2.21
%endif
@@ -94,16 +107,21 @@ Conflicts: initscripts < 8.63-1
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
%endif
Conflicts: mdadm < 3.2.6-14
%description
Dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
Unlike existing implementations, dracut does hard-code as little as possible
into the initramfs. Dracut contains various modules which are driven by the
into the initramfs. dracut contains various modules which are driven by the
event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
NFS, iSCSI, NBD, FCoE with the dracut-network package.
%package network
Summary: Dracut modules to build a dracut initramfs with network support
Summary: dracut modules to build a dracut initramfs with network support
Requires: %{name} = %{version}-%{release}
Requires: iputils
Requires: iproute
Requires: dhclient
Obsoletes: dracut-generic < 008
Provides: dracut-generic = %{version}-%{release}
@@ -113,7 +131,7 @@ all purpose initramfs with network support with dracut.
%if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?suse_version}
%package fips
Summary: Dracut modules to build a dracut initramfs with an integrity check
Summary: dracut modules to build a dracut initramfs with an integrity check
Requires: %{name} = %{version}-%{release}
Requires: hmaccalc
%if 0%{?rhel} > 5
@@ -126,29 +144,47 @@ Requires: nss-softokn-freebl
%description fips
This package requires everything which is needed to build an
all purpose initramfs with dracut, which does an integrity check.
initramfs with dracut, which does an integrity check.
%endif
%package fips-aesni
Summary: Dracut modules to build a dracut initramfs with an integrity check with aesni-intel
Summary: dracut modules to build a dracut initramfs with an integrity check with aesni-intel
Requires: %{name}-fips = %{version}-%{release}
%description fips-aesni
This package requires everything which is needed to build an
all purpose initramfs with dracut, which does an integrity check
and adds the aesni-intel kernel module.
initramfs with dracut, which does an integrity check and adds the aesni-intel kernel module.
%package caps
Summary: Dracut modules to build a dracut initramfs which drops capabilities
Summary: dracut modules to build a dracut initramfs which drops capabilities
Requires: %{name} = %{version}-%{release}
Requires: libcap
%description caps
This package requires everything which is needed to build an
all purpose initramfs with dracut, which drops capabilities.
initramfs with dracut, which drops capabilities.
%package config-generic
Summary: dracut configuration to turn off hostonly image generation
Requires: %{name} = %{version}-%{release}
Obsoletes: dracut-nohostonly
Provides: dracut-nohostonly
%description config-generic
This package provides the configuration to turn off the host specific initramfs
generation with dracut and generates a generic image by default.
%package config-rescue
Summary: dracut configuration to turn on rescue image generation
Requires: %{name} = %{version}-%{release}
Obsoletes: dracut <= 029
%description config-rescue
This package provides the configuration to turn on the rescue initramfs
generation with dracut.
%package tools
Summary: Dracut tools to build the local initramfs
Summary: dracut tools to build the local initramfs
Requires: %{name} = %{version}-%{release}
%description tools
@@ -169,39 +205,41 @@ git am -p1 %{patches}
%endif
%build
make all
%configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib
make %{?_smp_mflags}
%install
%if 0%{?fedora} || 0%{?rhel}
rm -rf $RPM_BUILD_ROOT
rm -rf -- $RPM_BUILD_ROOT
%endif
make install DESTDIR=$RPM_BUILD_ROOT \
libdir=%{_prefix}/lib \
bindir=%{_bindir} \
%if %{defined _unitdir}
systemdsystemunitdir=%{_unitdir} \
%endif
sysconfdir=/etc mandir=%{_mandir}
make %{?_smp_mflags} install \
DESTDIR=$RPM_BUILD_ROOT \
libdir=%{_prefix}/lib
echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh
%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} == 0
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
%endif
%if %{defined _unitdir}
# for systemd, better use systemd-bootchart
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00bootchart
%endif
# we do not support dash in the initramfs
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
# remove gentoo specific modules
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
%if %{defined _unitdir}
# with systemd IMA and selinux modules do not make sense
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/96securityfs
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/97masterkey
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98integrity
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98selinux
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/96securityfs
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/97masterkey
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98integrity
%endif
mkdir -p $RPM_BUILD_ROOT/boot/dracut
@@ -211,68 +249,95 @@ touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/40-fips.conf
install -m 0644 dracut.conf.d/fedora.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%{?suse_version}
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
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
rm $RPM_BUILD_ROOT%{_bindir}/mkinitrd
rm $RPM_BUILD_ROOT%{_bindir}/lsinitrd
rm -f -- $RPM_BUILD_ROOT%{_bindir}/mkinitrd
rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
%endif
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/dracut_log
%if 0%{?fedora} || 0%{?rhel} > 6
# FIXME: remove after F19
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf
%endif
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
> $RPM_BUILD_ROOT/etc/system-fips
%endif
# create compat symlink
mkdir -p $RPM_BUILD_ROOT/sbin
ln -s /usr/bin/dracut $RPM_BUILD_ROOT/sbin/dracut
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
ln -sr $RPM_BUILD_ROOT%{_bindir}/dracut $RPM_BUILD_ROOT%{_sbindir}/dracut
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf -- $RPM_BUILD_ROOT
%files
%defattr(-,root,root,0755)
%doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg
%{_bindir}/dracut
# compat symlink
/sbin/dracut
%{_sbindir}/dracut
%{_datadir}/bash-completion/completions/dracut
%{_datadir}/bash-completion/completions/lsinitrd
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
%{_bindir}/mkinitrd
%{_bindir}/lsinitrd
%endif
%dir %{dracutlibdir}
%dir %{dracutlibdir}/modules.d
%{dracutlibdir}/dracut-init.sh
%{dracutlibdir}/dracut-functions.sh
%{dracutlibdir}/dracut-functions
%{dracutlibdir}/dracut-version.sh
%{dracutlibdir}/dracut-logger.sh
%{dracutlibdir}/dracut-initramfs-restore
%{dracutlibdir}/dracut-install
%config(noreplace) /etc/dracut.conf
%{dracutlibdir}/skipcpio
%config(noreplace) %{_sysconfdir}/dracut.conf
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
%config /etc/dracut.conf.d/01-dist.conf
%{dracutlibdir}/dracut.conf.d/01-dist.conf
%endif
%dir /etc/dracut.conf.d
%dir %{_sysconfdir}/dracut.conf.d
%dir %{dracutlibdir}/dracut.conf.d
%{_mandir}/man8/dracut.8*
%{_mandir}/man8/*service.8*
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
%{_mandir}/man8/mkinitrd.8*
%{_mandir}/man1/lsinitrd.1*
%endif
%{_mandir}/man7/dracut.kernel.7*
%{_mandir}/man7/dracut.cmdline.7*
%{_mandir}/man7/dracut.modules.7*
%{_mandir}/man7/dracut.bootup.7*
%{_mandir}/man5/dracut.conf.5*
%if %{defined _unitdir}
%{dracutlibdir}/modules.d/00systemd-bootchart
%else
%{dracutlibdir}/modules.d/00bootchart
%endif
%{dracutlibdir}/modules.d/00bash
%{dracutlibdir}/modules.d/03modsign
%{dracutlibdir}/modules.d/03rescue
%{dracutlibdir}/modules.d/04watchdog
%{dracutlibdir}/modules.d/05busybox
%{dracutlibdir}/modules.d/10i18n
%{dracutlibdir}/modules.d/30convertfs
%{dracutlibdir}/modules.d/45url-lib
%{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
@@ -284,6 +349,7 @@ rm -rf $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/90multipath
%{dracutlibdir}/modules.d/90qemu
%{dracutlibdir}/modules.d/91crypt-gpg
%{dracutlibdir}/modules.d/91crypt-loop
%{dracutlibdir}/modules.d/95debug
%{dracutlibdir}/modules.d/95resume
%{dracutlibdir}/modules.d/95rootfs-block
@@ -297,12 +363,12 @@ rm -rf $RPM_BUILD_ROOT
%if %{undefined _unitdir}
%{dracutlibdir}/modules.d/96securityfs
%{dracutlibdir}/modules.d/97masterkey
%{dracutlibdir}/modules.d/98selinux
%{dracutlibdir}/modules.d/98integrity
%endif
%{dracutlibdir}/modules.d/97biosdevname
%{dracutlibdir}/modules.d/98ecryptfs
%{dracutlibdir}/modules.d/98pollcdrom
%{dracutlibdir}/modules.d/98selinux
%{dracutlibdir}/modules.d/98syslog
%{dracutlibdir}/modules.d/98systemd
%{dracutlibdir}/modules.d/98usrmount
@@ -310,12 +376,29 @@ rm -rf $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/99fs-lib
%{dracutlibdir}/modules.d/99img-lib
%{dracutlibdir}/modules.d/99shutdown
%config(noreplace) /etc/logrotate.d/dracut_log
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
%dir %{_sharedstatedir}/initramfs
%if %{defined _unitdir}
%{_unitdir}/dracut-shutdown.service
%{_unitdir}/shutdown.target.wants/dracut-shutdown.service
%{_unitdir}/dracut-cmdline.service
%{_unitdir}/dracut-initqueue.service
%{_unitdir}/dracut-mount.service
%{_unitdir}/dracut-pre-mount.service
%{_unitdir}/dracut-pre-pivot.service
%{_unitdir}/dracut-pre-trigger.service
%{_unitdir}/dracut-pre-udev.service
%{_unitdir}/initrd.target.wants/dracut-cmdline.service
%{_unitdir}/initrd.target.wants/dracut-initqueue.service
%{_unitdir}/initrd.target.wants/dracut-mount.service
%{_unitdir}/initrd.target.wants/dracut-pre-mount.service
%{_unitdir}/initrd.target.wants/dracut-pre-pivot.service
%{_unitdir}/initrd.target.wants/dracut-pre-trigger.service
%{_unitdir}/initrd.target.wants/dracut-pre-udev.service
%endif
%if 0%{?fedora} || 0%{?rhel} > 6
%{_prefix}/lib/kernel/install.d/50-dracut.install
%endif
%files network
@@ -325,17 +408,21 @@ rm -rf $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/95iscsi
%{dracutlibdir}/modules.d/90livenet
%{dracutlibdir}/modules.d/90qemu-net
%{dracutlibdir}/modules.d/95cifs
%{dracutlibdir}/modules.d/95nbd
%{dracutlibdir}/modules.d/95nfs
%{dracutlibdir}/modules.d/95ssh-client
%{dracutlibdir}/modules.d/45ifcfg
%{dracutlibdir}/modules.d/95znet
%{dracutlibdir}/modules.d/95fcoe-uefi
%{dracutlibdir}/modules.d/99uefi-lib
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
%files fips
%defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/01fips
%config(noreplace) /etc/dracut.conf.d/40-fips.conf
%{dracutlibdir}/dracut.conf.d/40-fips.conf
%config(missingok) /etc/system-fips
%endif
%files fips-aesni
@@ -355,4 +442,16 @@ rm -rf $RPM_BUILD_ROOT
%dir /var/lib/dracut
%dir /var/lib/dracut/overlay
%files config-generic
%defattr(-,root,root,0755)
%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
%files config-rescue
%defattr(-,root,root,0755)
%{dracutlibdir}/dracut.conf.d/02-rescue.conf
%if 0%{?fedora} || 0%{?rhel} > 6
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
%endif
%changelog

509
dracut.usage.asc Normal file
View File

@@ -0,0 +1,509 @@
To create a initramfs image, the most simple command is:
----
# dracut
----
This will generate a general purpose initramfs image, with all possible
functionality resulting of the combination of the installed dracut modules and
system tools. The image is /boot/initramfs-_++<kernel version>++_.img and
contains the kernel modules of the currently active kernel with version
_++<kernel version>++_.
If the initramfs image already exists, dracut will display an error message, and
to overwrite the existing image, you have to use the --force option.
----
# dracut --force
----
If you want to specify another filename for the resulting image you would issue
a command like:
----
# dracut foobar.img
----
To generate an image for a specific kernel version, the command would be:
----
# dracut foobar.img 2.6.40-1.rc5.f20
----
A shortcut to generate the image at the default location for a specific kernel
version is:
----
# dracut --kver 2.6.40-1.rc5.f20
----
If you want to create lighter, smaller initramfs images, you may want to specify
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.
[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
tool.
----
# lsinitrd | less
----
To display the contents of a file in the initramfs also use the lsinitrd tool:
----
# lsinitrd -f /etc/ld.so.conf
include ld.so.conf.d/*.conf
----
=== Adding dracut Modules
Some dracut modules are turned off by default and have to be activated manually.
You can do this by adding the dracut modules to the configuration file
_/etc/dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_. See *dracut.conf*(5).
You can also add dracut modules on the command line
by using the -a or --add option:
----
# dracut --add bootchart initramfs-bootchart.img
----
To see a list of available dracut modules, use the --list-modules option:
----
# dracut --list-modules
----
=== Omitting dracut Modules
Sometimes you don't want a dracut module to be included for reasons of speed,
size or functionality. To do this, either specify the omit_dracutmodules
variable in the _dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_ configuration
file (see *dracut.conf*(5)), or use the -o or --omit option
on the command line:
----
# dracut -o "multipath lvm" no-multipath-lvm.img
----
=== Adding Kernel Modules
If you need a special kernel module in the initramfs, which is not
automatically picked up by dracut, you have the use the --add-drivers option
on the command line or the drivers vaiable in the _/etc/dracut.conf_
or _/etc/dracut.conf.d/myconf.conf_ configuration file (see *dracut.conf*(5)):
----
# dracut --add-drivers mymod initramfs-with-mymod.img
----
=== Boot parameters
An initramfs generated without the "hostonly" mode, does not contain any system
configuration files (except for some special exceptions), so the configuration
has to be done on the kernel command line. With this flexibility, you can easily
boot from a changed root partition, without the need to recompile the initramfs
image. So, you could completly change your root partition (move it inside a md
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/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>>.
For a full reference of all kernel command line parameters,
see *dracut.cmdline*(5).
To get a quick start for the suitable kernel command line on your system,
use the __--print-cmdline__ option:
----
# dracut --print-cmdline
root=UUID=8b8b6f91-95c7-4da2-831b-171e12179081 rootflags=rw,relatime,discard,data=ordered rootfstype=ext4
----
==== Specifying the root Device
This is the only option dracut really needs to boot from your root partition.
Because your root partition can live in various environments, there are a lot of
formats for the root= option. The most basic one is root=_++<path to device
node>++_:
----
root=/dev/sda2
----
Because device node names can change, dependent on the drive ordering, you are
encouraged to use the filesystem identifier (UUID) or filesystem label (LABEL)
to specify your root partition:
----
root=UUID=19e9dda3-5a38-484d-a9b0-fa6b067d0331
----
or
----
root=LABEL=myrootpartitionlabel
----
To see all UUIDs or LABELs on your system, do:
----
# ls -l /dev/disk/by-uuid
----
or
----
# ls -l /dev/disk/by-label
----
If your root partition is on the network see <<NetworkBoot>>.
==== Keyboard Settings
If you have to input passwords for encrypted disk volumes, you might want to set
the keyboard layout and specify a display font.
A typical german kernel command would contain:
----
rd.vconsole.font=latarcyrheb-sun16 rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8
----
Setting these options can override the setting stored on your system, if you use
a modern init system, like systemd.
==== Blacklisting Kernel Modules
Sometimes it is required to prevent the automatic kernel module loading of a
specific kernel module. To do this, just add rd.blacklist=_++<kernel module
name>++_, with _++<kernel module name>++_ not containing the _.ko_
suffix, to the kernel command line. For example:
----
rd.driver.blacklist=mptsas rd.driver.blacklist=nouveau
----
The option can be specified multiple times on the kernel command line.
==== Speeding up the Boot Process
If you want to speed up the boot process, you can specify as much information
for dracut on the kernel command as possible. For example, you can tell dracut,
that you root partition is not on a LVM volume or not on a raid partition, or
that it lives inside a specific crypto LUKS encrypted volume. By default, dracut
searches everywhere. A typical dracut kernel command line for a plain primary or
logical partition would contain:
----
rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0
----
This turns off every automatic assembly of LVM, MD raids, DM raids and
crypto LUKS.
Of course, you could also omit the dracut modules in the initramfs creation
process, but then you would lose the posibility to turn it on on demand.
[[Injecting]]
=== Injecting custom Files
To add your own files to the initramfs image, you have several possibilities.
The --include option let you specify a source path and a target path.
For example
----
# dracut --include cmdline-preset /etc/cmdline.d/mycmdline.conf initramfs-cmdline-pre.img
----
will create an initramfs image, where the file cmdline-preset will be copied
inside the initramfs to _/etc/cmdline.d/mycmdline.conf_. --include can only
be specified once.
----
# mkdir -p rd.live.overlay/etc/cmdline.d
# mkdir -p rd.live.overlay/etc/conf.d
# echo "ip=dhcp" >> rd.live.overlay/etc/cmdline.d/mycmdline.conf
# echo export FOO=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
# echo export BAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
# tree rd.live.overlay/
rd.live.overlay/
`-- etc
|-- cmdline.d
| `-- mycmdline.conf
`-- conf.d
`-- testvar.conf
# dracut --include rd.live.overlay / initramfs-rd.live.overlay.img
----
This will put the contents of the rd.live.overlay directory into the root of the
initramfs image.
The --install option let you specify several files, which will get installed in
the initramfs image at the same location, as they are present on initramfs
creation time.
----
# dracut --install 'strace fsck.ext3 ssh' initramfs-dbg.img
----
This will create an initramfs with the strace, fsck.ext3 and ssh executables,
together with the libraries needed to start those. The --install option can be
specified multiple times.
[[NetworkBoot]]
=== Network Boot
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
mechanism, you have static configuration on your client machine and a
centralized boot configuration on your TFTP/DHCP server. If you can't pass a
kernel command line, then you can inject _/etc/cmdline.d/mycmdline.conf_, with a
method described in <<Injecting>>.
==== Reducing the Image Size
To reduce the size of the initramfs, you should create it with by ommitting all
dracut modules, which you know, you don't need to boot the machine.
You can also specify the exact dracut and kernel modules to produce a very tiny
initramfs image.
For example for a NFS image, you would do:
----
# dracut -m "nfs network base" initramfs-nfs-only.img
----
Then you would boot from this image with your target machine and reduce the size
once more by creating it on the target machine with the --host-only option:
----
# dracut -m "nfs network base" --host-only initramfs-nfs-host-only.img
----
This will reduce the size of the initramfs image significantly.
== Troubleshooting
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:
http://fedoraproject.org/wiki/How_to_debug_Dracut_problems
[[identifying-your-problem-area]]
=== Identifying your problem area
. Remove ''rhgb'' and ''quiet'' from the kernel command line
. Add ''rd.shell'' to the kernel command line. This will present a shell should
dracut be unable to locate your root device
. Add ''rd.shell rd.debug log_buf_len=1M'' to the kernel command line so that
dracut shell commands are printed as they are executed
. The file /run/initramfs/rdsosreport.txt is generated,
which contains all the logs and the output of all significant tools, which are
mentioned later.
If you want to save that output, simply mount /boot by hand or insert an USB
stick and mount that. Then you can store the output for later inspection.
[[information-to-include-in-your-report]]
=== Information to include in your report
[[all-bug-reports]]
==== All bug reports
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. _/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
the file /run/initramfs/rdsosreport.txt.
* If you use a dracut configuration file, please include _/etc/dracut.conf_ and
all files in _/etc/dracut.conf.d/*.conf_
[[network-root-device-related-problems]]
==== Network root device related problems
This section details information to include when experiencing problems on a
system whose root device is located on a network attached volume (e.g. iSCSI,
NFS or NBD). As well as the information from <<all-bug-reports>>, include the
following information:
* Please include the output of
+
----
# /sbin/ifup <interfacename>
# ip addr show
----
[[debugging-dracut]]
=== Debugging dracut
[[configure-a-serial-console]]
==== Configure a serial console
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.
. 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
----
+
. 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.
[[using-the-dracut-shell]]
==== Using the dracut shell
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. _/boot/grub2/grub.cfg_ (or _/boot/efi/EFI/redhat/grub.cfg_ for EFI systems))
. Remove the boot arguments ''rhgb'' and ''quiet''
+
A sample _grub.cfg_ bootloader configuration file snippet is listed below.
+
----
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
below.
+
----
No root device found
Dropping to debug shell.
#
----
+
. Use this shell prompt to gather the information requested above
(see <<all-bug-reports>>).
[[accessing-the-root-volume-from-the-dracut-shell]]
==== Accessing the root volume from the dracut shell
From the dracut debug shell, you can manually perform the task of locating and
preparing your root volume for boot. The required steps will depend on how your
root volume is configured. Common scenarios include:
* A block device (e.g. _/dev/sda7_)
* A LVM logical volume (e.g. _/dev/VolGroup00/LogVol00_)
* An encrypted device
(e.g. _/dev/mapper/luks-4d5972ea-901c-4584-bd75-1da802417d83_)
* A network attached device
(e.g. _netroot=iscsi:@192.168.0.4::3260::iqn.2009-02.org.example:for.all_)
The exact method for locating and preparing will vary. However, to continue with
a successful boot, the objective is to locate your root volume and create a
symlink _/dev/root_ which points to the file system. For example, the following
example demonstrates accessing and booting a root volume that is an encrypted
LVM Logical volume.
. Inspect your partitions using parted
+
----
# parted /dev/sda -s p
Model: ATA HTS541060G9AT00 (scsi)
Disk /dev/sda: 60.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 10.8GB 107MB primary ext4 boot
2 10.8GB 55.6GB 44.7GB logical lvm
----
+
. You recall that your root volume was a LVM logical volume. Scan and activate
any logical volumes.
+
----
# lvm vgscan
# lvm vgchange -ay
----
+
. You should see any logical volumes now using the command blkid:
+
----
# blkid
/dev/sda1: UUID="3de247f3-5de4-4a44-afc5-1fe179750cf7" TYPE="ext4"
/dev/sda2: UUID="Ek4dQw-cOtq-5MJu-OGRF-xz5k-O2l8-wdDj0I" TYPE="LVM2_member"
/dev/mapper/linux-root: UUID="def0269e-424b-4752-acf3-1077bf96ad2c" TYPE="crypto_LUKS"
/dev/mapper/linux-home: UUID="c69127c1-f153-4ea2-b58e-4cbfa9257c5e" TYPE="ext3"
/dev/mapper/linux-swap: UUID="47b4d329-975c-4c08-b218-f9c9bf3635f1" TYPE="swap"
----
+
. From the output above, you recall that your root volume exists on an encrypted
block device. Following the guidance disk encryption guidance from the
Installation Guide, you unlock your encrypted root volume.
+
----
# UUID=$(cryptsetup luksUUID /dev/mapper/linux-root)
# cryptsetup luksOpen /dev/mapper/linux-root luks-$UUID
Enter passphrase for /dev/mapper/linux-root:
Key slot 0 unlocked.
----
+
. Next, make a symbolic link to the unlocked root volume
+
----
# ln -s /dev/mapper/luks-$UUID /dev/root
----
+
. With the root volume available, you may continue booting the system by exiting
the dracut shell
+
----
# exit
----
[[additional-dracut-boot-parameters]]
==== Additional dracut boot parameters
For more debugging options, see *dracut.cmdline*(7).
[[debugging-dracut-on-shutdown]]
==== Debugging dracut on shutdown
To debug the shutdown sequence on systemd systems, you can _rd.break_
on _pre-shutdown_ or _shutdown_.
To do this from an already booted system:
----
# mkdir -p /run/initramfs/etc/cmdline.d
# echo "rd.break=pre-shutdown" > /run/initramfs/etc/cmdline.d/debug.conf
# touch /run/initramfs/.need_shutdown
----
This will give you a dracut shell after the system pivot'ed back in the
initramfs.

View File

@@ -1,21 +1,5 @@
#!/usr/bin/perl
sub last_tag {
open( GIT, 'git log --pretty=format:%H |');
LINE: while( <GIT> ) {
open( GIT2, "git tag --contains $_ |");
while( <GIT2> ) {
chomp;
last LINE if /..*/;
}
close GIT2;
}
$tag=$_;
close GIT2;
close GIT; # be done
return $tag;
};
sub create_patches {
my $tag=shift;
my $pdir=shift;
@@ -31,12 +15,12 @@ my $datestr = strftime "%Y%m%d", gmtime;
my $tag=shift;
my $pdir=shift;
$tag=&last_tag if not defined $tag;
$tag=`git describe --abbrev=0 --tags` if not defined $tag;
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:/) {

1
install/.kateconfig Normal file
View File

@@ -0,0 +1 @@
kate: space-indent on; tab-width 8; indent-width 8; replace-tabs on; eol unix;

View File

@@ -62,9 +62,13 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
static size_t dir_len(char const *file)
{
size_t length;
if(!file)
return 0;
/* Strip the basename and any redundant slashes before it. */
for (length = strlen(file); 0 < length; length--)
if (file[length] == '/')
for (length = strlen(file)-1; 0 < length; length--)
if (file[length] == '/' && file[length-1] != '/')
break;
return length;
}
@@ -73,27 +77,38 @@ static char *convert_abs_rel(const char *from, const char *target)
{
/* we use the 4*MAXPATHLEN, which should not overrun */
char relative_from[MAXPATHLEN * 4];
char *realtarget = NULL;
char *p, *q;
_cleanup_free_ char *realtarget = NULL;
_cleanup_free_ char *target_dir_p = NULL, *realpath_p = NULL;
const char *realfrom = from;
int level = 0, fromlevel = 0, targetlevel = 0;
int l, i, rl;
int dirlen;
size_t level = 0, fromlevel = 0, targetlevel = 0;
int l;
size_t i, rl, dirlen;
int ret;
p = strdup(target);
dirlen = dir_len(p);
p[dirlen] = '\0';
q = realpath(p, NULL);
target_dir_p = strdup(target);
if (!target_dir_p)
return strdup(from);
if (q == NULL) {
free(p);
dirlen = dir_len(target_dir_p);
target_dir_p[dirlen] = '\0';
realpath_p = realpath(target_dir_p, NULL);
if (realpath_p == NULL) {
log_warning("convert_abs_rel(): target '%s' directory has no realpath.", target);
return strdup(from);
}
asprintf(&realtarget, "%s/%s", q, &p[dirlen + 1]);
free(p);
free(q);
/* 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;
ret = asprintf(&realtarget, "%s/%s", realpath_p, &target_dir_p[i]);
if (ret < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
/* now calculate the relative path from <from> to <target> and
store it in <relative_from>
@@ -116,8 +131,6 @@ static char *convert_abs_rel(const char *from, const char *target)
if (realtarget[i] == '/')
level++;
free(realtarget);
/* add "../" to the relative_from path, until the common pathname is
reached */
for (i = level; i < targetlevel; i++) {
@@ -149,18 +162,16 @@ static char *convert_abs_rel(const char *from, const char *target)
static int ln_r(const char *src, const char *dst)
{
int ret;
const char *points_to = convert_abs_rel(src, dst);
_cleanup_free_ const char *points_to = convert_abs_rel(src, dst);
log_info("ln -s '%s' '%s'", points_to, dst);
ret = symlink(points_to, dst);
if (ret != 0) {
log_error("ERROR: ln -s '%s' '%s': %m", points_to, dst);
free((char *)points_to);
return 1;
}
free((char *)points_to);
return 0;
}
@@ -180,11 +191,11 @@ static bool use_clone = true;
static int cp(const char *src, const char *dst)
{
int pid;
int ret;
int ret = 0;
if (use_clone) {
struct stat sb;
int dest_desc, source_desc;
_cleanup_close_ int dest_desc = -1, source_desc = -1;
if (lstat(src, &sb) != 0)
goto normal_copy;
@@ -201,20 +212,24 @@ static int cp(const char *src, const char *dst)
(sb.st_mode) & (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO));
if (dest_desc < 0) {
close(source_desc);
goto normal_copy;
}
ret = clone_file(dest_desc, source_desc);
close(source_desc);
if (ret == 0) {
struct timeval tv[2];
if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0)
fchown(dest_desc, -1, sb.st_gid);
close(dest_desc);
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;
tv[1].tv_usec = 0;
futimes(dest_desc, tv);
return ret;
}
close(dest_desc);
dest_desc = -1;
/* clone did not work, remove the file */
unlink(dst);
/* do not try clone again */
@@ -224,16 +239,83 @@ 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", "-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);
break;
}
}
log_debug("cp ret = %d", ret);
return ret;
}
static int library_install(const char *src, const char *lib)
{
_cleanup_free_ char *p = NULL;
_cleanup_free_ char *pdir = NULL, *ppdir = NULL, *clib = NULL;
char *q;
int r, ret = 0;
p = strdup(lib);
r = dracut_install(p, p, false, false, true);
if (r != 0)
log_error("ERROR: failed to install '%s' for '%s'", p, src);
else
log_debug("Lib install: '%s'", p);
ret += r;
/* also install lib.so for lib.so.* files */
q = strstr(p, ".so.");
if (q) {
q[3] = '\0';
/* ignore errors for base lib symlink */
if (dracut_install(p, p, false, false, true) == 0)
log_debug("Lib install: '%s'", p);
}
/* Also try to install the same library from one directory above.
This fixes the case, where only the HWCAP lib would be installed
# ldconfig -p|fgrep libc.so
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);
pdir = dirname(p);
if (!pdir)
return ret;
pdir = strdup(pdir);
ppdir = dirname(pdir);
if (!ppdir)
return ret;
ppdir = strdup(ppdir);
strcpy(p, lib);
clib = strjoin(ppdir, "/", basename(p), NULL);
if (dracut_install(clib, clib, false, false, true) == 0)
log_debug("Lib install: '%s'", clib);
/* also install lib.so for lib.so.* files */
q = strstr(clib, ".so.");
if (q) {
q[3] = '\0';
/* ignore errors for base lib symlink */
if (dracut_install(clib, clib, false, false, true) == 0)
log_debug("Lib install: '%s'", p);
}
return ret;
}
@@ -242,17 +324,19 @@ static int resolve_deps(const char *src)
{
int ret = 0;
char *buf = malloc(LINE_MAX);
_cleanup_free_ char *buf = malloc(LINE_MAX);
size_t linesize = LINE_MAX;
FILE *fptr;
char *cmd;
_cleanup_pclose_ FILE *fptr = NULL;
_cleanup_free_ char *cmd = NULL;
if (strstr(src, ".so") == 0) {
int fd;
_cleanup_close_ int fd = -1;
fd = open(src, O_RDONLY | O_CLOEXEC);
if (fd < 0)
return -errno;
read(fd, buf, LINE_MAX);
buf[LINE_MAX - 1] = '\0';
close(fd);
if (buf[0] == '#' && buf[1] == '!') {
/* we have a shebang */
char *p, *q;
@@ -268,7 +352,14 @@ static int resolve_deps(const char *src)
}
/* run ldd */
asprintf(&cmd, "ldd %s 2>&1", src);
ret = asprintf(&cmd, "ldd %s 2>&1", src);
if (ret < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
ret = 0;
fptr = popen(cmd, "r");
while (!feof(fptr)) {
@@ -279,75 +370,109 @@ static int resolve_deps(const char *src)
log_debug("ldd: '%s'", buf);
if (strstr(buf, "you do not have execution permission")) {
log_error("%s", buf);
ret+=1;
break;
}
if (strstr(buf, "not a dynamic executable"))
break;
if (strstr(buf, "loader cannot load itself"))
break;
p = strstr(buf, "/");
if (strstr(buf, "not regular file"))
break;
if (strstr(buf, "cannot read header"))
break;
if (strstr(buf, destrootdir))
break;
p = strstr(buf, "=>");
if (!p)
p = buf;
p = strchr(p, '/');
if (p) {
int r;
for (q = p; *q && *q != ' ' && *q != '\n'; q++) ;
*q = '\0';
r = dracut_install(p, p, false, false, true);
if (r != 0)
log_error("ERROR: failed to install '%s' for '%s'", p, src);
else
log_debug("Lib install: '%s'", p);
ret += r;
/* also install lib.so for lib.so.* files */
q = strstr(p, ".so.");
if (q) {
q += 3;
*q = '\0';
ret += library_install(src, p);
/* ignore errors for base lib symlink */
if (dracut_install(p, p, false, false, true) == 0)
log_debug("Lib install: '%s'", p);
}
}
}
pclose(fptr);
return ret;
}
/* Install ".<filename>.hmac" file for FIPS self-checks */
static int hmac_install(const char *src, const char *dst)
static int hmac_install(const char *src, const char *dst, const char *hmacpath)
{
char *srcpath = strdup(src);
char *dstpath = strdup(dst);
char *srchmacname = NULL;
char *dsthmacname = NULL;
_cleanup_free_ char *srcpath = strdup(src);
_cleanup_free_ char *dstpath = strdup(dst);
_cleanup_free_ char *srchmacname = NULL;
_cleanup_free_ char *dsthmacname = NULL;
int ret;
if (!(srcpath && dstpath))
return -ENOMEM;
size_t dlen = dir_len(src);
if (endswith(src, ".hmac"))
return 0;
if (!hmacpath) {
hmac_install(src, dst, "/lib/fipscheck");
hmac_install(src, dst, "/lib64/fipscheck");
hmac_install(src, dst, "/lib/hmaccalc");
hmac_install(src, dst, "/lib64/hmaccalc");
}
srcpath[dlen] = '\0';
dstpath[dir_len(dst)] = '\0';
asprintf(&srchmacname, "%s/.%s.hmac", srcpath, &src[dlen + 1]);
asprintf(&dsthmacname, "%s/.%s.hmac", dstpath, &src[dlen + 1]);
if (hmacpath) {
ret = asprintf(&srchmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
if (ret < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
ret = asprintf(&dsthmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
if (ret < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
} else {
ret = asprintf(&srchmacname, "%s/.%s.hmac", srcpath, &src[dlen + 1]);
if (ret < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
ret = asprintf(&dsthmacname, "%s/.%s.hmac", dstpath, &src[dlen + 1]);
if (ret < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
}
log_debug("hmac cp '%s' '%s')", srchmacname, dsthmacname);
dracut_install(srchmacname, dsthmacname, false, false, true);
free(dsthmacname);
free(srchmacname);
free(srcpath);
free(dstpath);
return 0;
}
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst)
{
struct stat sb, db;
char *dname = NULL;
char *fulldstpath = NULL;
char *fulldstdir = NULL;
_cleanup_free_ char *fulldstpath = NULL;
_cleanup_free_ char *fulldstdir = NULL;
int ret;
bool src_exists = true;
char *i, *existing;
char *i = NULL;
char *existing;
log_debug("dracut_install('%s', '%s')", src, dst);
@@ -380,9 +505,16 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
}
i = strdup(dst);
if (!i)
return -ENOMEM;
hashmap_put(items, i, i);
asprintf(&fulldstpath, "%s%s", destrootdir, dst);
ret = asprintf(&fulldstpath, "%s%s", destrootdir, dst);
if (ret < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
ret = stat(fulldstpath, &sb);
@@ -392,10 +524,14 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
}
if (ret == 0) {
log_debug("'%s' already exists", fulldstpath);
free(fulldstpath);
if (resolvedeps && S_ISREG(sb.st_mode) && (sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
log_debug("'%s' already exists, but checking for any deps", fulldstpath);
ret = resolve_deps(src);
} else
log_debug("'%s' already exists", fulldstpath);
/* dst does already exist */
return 0;
return ret;
}
/* check destination directory */
@@ -405,6 +541,8 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
ret = stat(fulldstdir, &db);
if (ret < 0) {
_cleanup_free_ char *dname = NULL;
if (errno != ENOENT) {
log_error("ERROR: stat '%s': %m", fulldstdir);
return 1;
@@ -412,35 +550,34 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
/* create destination directory */
log_debug("dest dir '%s' does not exist", fulldstdir);
dname = strdup(dst);
if (!dname)
return 1;
dname[dir_len(dname)] = '\0';
ret = dracut_install(dname, dname, true, false, true);
free(dname);
if (ret != 0) {
log_error("ERROR: failed to create directory '%s'", fulldstdir);
free(fulldstdir);
return 1;
}
}
free(fulldstdir);
if (isdir && !src_exists) {
log_info("mkdir '%s'", fulldstpath);
return mkdir(fulldstpath, 0755);
ret = mkdir(fulldstpath, 0755);
return ret;
}
/* ready to install src */
if (S_ISDIR(sb.st_mode)) {
log_info("mkdir '%s'", fulldstpath);
return mkdir(fulldstpath, sb.st_mode | S_IWUSR);
ret = mkdir(fulldstpath, sb.st_mode | S_IWUSR);
return ret;
}
if (S_ISLNK(sb.st_mode)) {
char *abspath;
char *absdestpath = NULL;
_cleanup_free_ char *abspath = NULL;
abspath = realpath(src, NULL);
@@ -458,18 +595,20 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
}
if (lstat(fulldstpath, &sb) != 0) {
_cleanup_free_ char *absdestpath = NULL;
asprintf(&absdestpath, "%s%s", destrootdir, abspath);
ret = asprintf(&absdestpath, "%s%s", destrootdir, abspath);
if (ret < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
ln_r(absdestpath, fulldstpath);
free(absdestpath);
}
free(abspath);
if (arg_hmac) {
/* copy .hmac files also */
hmac_install(src, dst);
hmac_install(src, dst, NULL);
}
return 0;
@@ -480,12 +619,16 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
ret += resolve_deps(src);
if (arg_hmac) {
/* copy .hmac files also */
hmac_install(src, dst);
hmac_install(src, dst, NULL);
}
}
log_debug("dracut_install ret = %d", ret);
log_info("cp '%s' '%s'", src, fulldstpath);
ret += cp(src, fulldstpath);
log_debug("dracut_install ret = %d", ret);
return ret;
}
@@ -496,48 +639,49 @@ 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\
Install SOURCE to DEST in DESTROOTDIR with all needed dependencies.\n\
\n\
-D --destrootdir Install all files to DESTROOTDIR as the root\n\
-a --all Install all SOURCE arguments to DESTROOTDIR\n\
-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\
-R --resolvelazy Only install shebang executables and libraries for all SOURCE files\n\
-f --fips Also install all '.SOURCE.hmac' files\n\
-v --verbose Show more output\n\
--debug Show debug output\n\
--version Show package version\n\
-h --help Show this help\n\
\n\
Example:\n\
# %s -D /var/tmp/test-root --ldd -a sh tr\n\
# tree /var/tmp/test-root\n\
/var/tmp/test-root\n\
|-- lib64 -> usr/lib64\n\
`-- usr\n\
|-- bin\n\
| |-- bash\n\
| |-- sh -> bash\n\
| `-- tr\n\
`-- lib64\n\
|-- ld-2.15.90.so\n\
|-- ld-linux-x86-64.so.2 -> ld-2.15.90.so\n\
|-- libc-2.15.90.so\n\
|-- libc.so\n\
|-- libc.so.6 -> libc-2.15.90.so\n\
|-- libdl-2.15.90.so\n\
|-- 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);
{
/* */
printf("Usage: %s -D DESTROOTDIR [OPTION]... -a SOURCE...\n"
"or: %s -D DESTROOTDIR [OPTION]... SOURCE DEST\n"
"\n"
"Install SOURCE to DEST in DESTROOTDIR with all needed dependencies.\n"
"\n"
" -D --destrootdir Install all files to DESTROOTDIR as the root\n"
" -a --all Install all SOURCE arguments to DESTROOTDIR\n"
" -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"
" -R --resolvelazy Only install shebang executables and libraries\n"
" for all SOURCE files\n"
" -H --fips Also install all '.SOURCE.hmac' files\n"
" -v --verbose Show more output\n"
" --debug Show debug output\n"
" --version Show package version\n"
" -h --help Show this help\n"
"\n"
"Example:\n"
"# mkdir -p /var/tmp/test-root\n"
"# %s -D /var/tmp/test-root --ldd -a sh tr\n"
"# tree /var/tmp/test-root\n"
"/var/tmp/test-root\n"
"|-- lib64 -> usr/lib64\n"
"`-- usr\n"
" |-- bin\n"
" | |-- bash\n"
" | |-- sh -> bash\n"
" | `-- tr\n"
" `-- lib64\n"
" |-- ld-2.15.90.so\n"
" |-- ld-linux-x86-64.so.2 -> ld-2.15.90.so\n"
" |-- libc-2.15.90.so\n"
" |-- libc.so\n"
" |-- libc.so.6 -> libc-2.15.90.so\n"
" |-- libdl-2.15.90.so\n"
" |-- 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);
exit(status);
}
@@ -550,7 +694,7 @@ static int parse_argv(int argc, char *argv[])
ARG_DEBUG
};
static const struct option const options[] = {
static struct option const options[] = {
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, ARG_VERSION},
{"dir", no_argument, NULL, 'd'},
@@ -565,7 +709,7 @@ static int parse_argv(int argc, char *argv[])
{NULL, 0, NULL, 0}
};
while ((c = getopt_long(argc, argv, "adhloD:DHILR", options, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "adhloD:HR", options, NULL)) != -1) {
switch (c) {
case ARG_VERSION:
puts(PROGRAM_VERSION_STRING);
@@ -616,7 +760,7 @@ static int parse_argv(int argc, char *argv[])
static int resolve_lazy(int argc, char **argv)
{
int i;
int destrootdirlen = strlen(destrootdir);
size_t destrootdirlen = strlen(destrootdir);
int ret = 0;
char *item;
for (i = 0; i < argc; i++) {
@@ -644,63 +788,117 @@ static int resolve_lazy(int argc, char **argv)
return ret;
}
static char *find_binary(const char *src)
{
_cleanup_free_ char *path = NULL;
char *p, *q;
bool end = false;
char *newsrc = NULL;
int ret;
path = getenv("PATH");
if (path == NULL) {
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);
do {
struct stat sb;
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);
newsrc = NULL;
continue;
}
end = true;
} while (!end);
if (newsrc)
log_debug("find_binary(%s) == %s", src, newsrc);
return newsrc;
}
static int install_one(const char *src, const char *dst)
{
int r = EXIT_SUCCESS;
int ret;
if (strchr(src, '/') == NULL) {
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);
}
free(newsrc);
} else {
ret = -1;
}
} else {
ret = dracut_install(src, dst, arg_createdir, arg_resolvedeps, true);
}
if ((ret != 0) && (!arg_optional)) {
log_error("ERROR: installing '%s' to '%s'", src, dst);
r = EXIT_FAILURE;
}
return r;
}
static int install_all(int argc, char **argv)
{
int r = 0;
int r = EXIT_SUCCESS;
int i;
for (i = 0; i < argc; i++) {
int ret;
log_debug("Handle '%s'", argv[i]);
if (strchr(argv[i], '/') == NULL) {
char *path;
char *p, *q;
bool end = false;
path = getenv("PATH");
if (path == NULL) {
log_error("PATH is not set");
exit(EXIT_FAILURE);
}
path = strdup(path);
p = path;
log_debug("PATH=%s", path);
do {
char *newsrc = NULL;
char *dest;
struct stat sb;
for (q = p; *q && *q != ':'; q++) ;
if (*q == '\0')
end = true;
else
*q = '\0';
asprintf(&newsrc, "%s/%s", p, argv[i]);
p = q + 1;
if (stat(newsrc, &sb) != 0) {
free(newsrc);
ret = -1;
continue;
}
dest = strdup(newsrc);
_cleanup_free_ char *newsrc = find_binary(argv[i]);
if (newsrc) {
log_debug("dracut_install '%s'", newsrc);
ret = dracut_install(newsrc, dest, arg_createdir, arg_resolvedeps, true);
ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true);
if (ret == 0) {
end = true;
log_debug("dracut_install '%s' OK", newsrc);
}
free(newsrc);
free(dest);
} while (!end);
free(path);
} else {
ret = -1;
}
} else {
char *dest = strdup(argv[i]);
_cleanup_free_ char *dest = strdup(argv[i]);
ret = dracut_install(argv[i], dest, arg_createdir, arg_resolvedeps, true);
free(dest);
}
if ((ret != 0) && (!arg_optional)) {
@@ -742,9 +940,17 @@ int main(int argc, char **argv)
if (strcmp(destrootdir, "/") == 0) {
log_error("Environment DESTROOTDIR or argument -D is set to '/'!");
usage(EXIT_FAILURE);
}
i = destrootdir;
destrootdir = realpath(destrootdir, NULL);
if (!destrootdir) {
log_error("Environment DESTROOTDIR or argument -D is set to '%s': %m", i);
r = EXIT_FAILURE;
goto finish;
}
free(i);
items = hashmap_new(string_hash_func, string_compare_func);
items_failed = hashmap_new(string_hash_func, string_compare_func);
@@ -775,11 +981,7 @@ int main(int argc, char **argv)
r = install_all(argc - optind, &argv[optind]);
} else {
/* simple "inst src dst" */
r = dracut_install(argv[optind], argv[optind + 1], arg_createdir, arg_resolvedeps, true);
if ((r != 0) && (!arg_optional)) {
log_error("ERROR: installing '%s' to '%s'", argv[optind], argv[optind + 1]);
r = EXIT_FAILURE;
}
r = install_one(argv[optind], argv[optind + 1]);
}
if (arg_optional)

Binary file not shown.

View File

@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#ifndef foomacrohfoo
#define foomacrohfoo
#pragma once
/***
This file is part of systemd.
@@ -45,16 +44,38 @@
#define _hidden_ __attribute__ ((visibility("hidden")))
#define _weakref_(x) __attribute__((weakref(#x)))
#define _introspect_(x) __attribute__((section("introspect." x)))
#define _alignas_(x) __attribute__((aligned(__alignof(x))))
#define _cleanup_(x) __attribute__((cleanup(x)))
/* automake test harness */
#define EXIT_TEST_SKIP 77
#define XSTRINGIFY(x) #x
#define STRINGIFY(x) XSTRINGIFY(x)
/* Rounds up */
#define ALIGN(l) ALIGN_TO((l), sizeof(void*))
#define ALIGN4(l) (((l) + 3) & ~3)
#define ALIGN8(l) (((l) + 7) & ~7)
#if __SIZEOF_POINTER__ == 8
#define ALIGN(l) ALIGN8(l)
#elif __SIZEOF_POINTER__ == 4
#define ALIGN(l) ALIGN4(l)
#else
#error "Wut? Pointers are neither 4 nor 8 bytes long?"
#endif
#define ALIGN_PTR(p) ((void*) ALIGN((unsigned long) p))
#define ALIGN4_PTR(p) ((void*) ALIGN4((unsigned long) p))
#define ALIGN8_PTR(p) ((void*) ALIGN8((unsigned long) p))
static inline size_t ALIGN_TO(size_t l, size_t ali) {
return ((l + ali - 1) & ~(ali - 1));
}
#define ALIGN_TO_PTR(p, ali) ((void*) ALIGN_TO((unsigned long) p))
#define ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))
/*
@@ -64,34 +85,35 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) {
* @member: the name of the member within the struct.
*
*/
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
#ifndef MAX
#define MAX(a,b) \
__extension__ ({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
_a > _b ? _a : _b; \
#define container_of(ptr, type, member) \
__extension__ ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) ); \
})
#endif
#define MAX3(a,b,c) \
MAX(MAX(a,b),c)
#undef MAX
#define MAX(a,b) \
__extension__ ({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
_a > _b ? _a : _b; \
})
#ifndef MIN
#define MAX3(x,y,z) \
__extension__ ({ \
typeof(x) _c = MAX(x,y); \
MAX(_c, z); \
})
#undef MIN
#define MIN(a,b) \
__extension__ ({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
_a < _b ? _a : _b; \
})
#endif
#define MIN3(a,b,c) \
MIN(MIN(a,b),c)
#ifndef CLAMP
#define CLAMP(x, low, high) \
__extension__ ({ \
typeof(x) _x = (x); \
@@ -99,6 +121,7 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) {
typeof(high) _high = (high); \
((_x > _high) ? _high : ((_x < _low) ? _low : _x)); \
})
#endif
#define assert_se(expr) \
do { \
@@ -119,14 +142,21 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) {
log_assert_failed_unreachable(t, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
} while (false)
#define assert_cc(expr) \
do { \
switch (0) { \
case 0: \
case !!(expr): \
; \
} \
#if defined(static_assert)
#define assert_cc(expr) \
do { \
static_assert(expr, #expr); \
} while (false)
#else
#define assert_cc(expr) \
do { \
switch (0) { \
case 0: \
case !!(expr): \
; \
} \
} while (false)
#endif
#define PTR_TO_UINT(p) ((unsigned int) ((uintptr_t) (p)))
#define UINT_TO_PTR(u) ((void*) ((uintptr_t) (u)))
@@ -149,6 +179,8 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) {
#define memzero(x,l) (memset((x), 0, (l)))
#define zero(x) (memzero(&(x), sizeof(x)))
#define CHAR_TO_STR(x) ((char[2]) { x, 0 })
#define char_array_0(x) x[sizeof(x)-1] = 0;
#define IOVEC_SET_STRING(i, s) \
@@ -187,6 +219,66 @@ static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) {
return k;
}
#include "log.h"
#define VA_FORMAT_ADVANCE(format, ap) \
do { \
int _argtypes[128]; \
size_t _i, _k; \
_k = parse_printf_format((format), ELEMENTSOF(_argtypes), _argtypes); \
assert(_k < ELEMENTSOF(_argtypes)); \
for (_i = 0; _i < _k; _i++) { \
if (_argtypes[_i] & PA_FLAG_PTR) { \
(void) va_arg(ap, void*); \
continue; \
} \
\
switch (_argtypes[_i]) { \
case PA_INT: \
case PA_INT|PA_FLAG_SHORT: \
case PA_CHAR: \
(void) va_arg(ap, int); \
break; \
case PA_INT|PA_FLAG_LONG: \
(void) va_arg(ap, long int); \
break; \
case PA_INT|PA_FLAG_LONG_LONG: \
(void) va_arg(ap, long long int); \
break; \
case PA_WCHAR: \
(void) va_arg(ap, wchar_t); \
break; \
case PA_WSTRING: \
case PA_STRING: \
case PA_POINTER: \
(void) va_arg(ap, void*); \
break; \
case PA_FLOAT: \
case PA_DOUBLE: \
(void) va_arg(ap, double); \
break; \
case PA_DOUBLE|PA_FLAG_LONG_DOUBLE: \
(void) va_arg(ap, long double); \
break; \
default: \
assert_not_reached("Unknown format string argument."); \
} \
} \
} while(false)
#endif
/* Because statfs.t_type can be int on some architecures, we have to cast
* the const magic to the type, otherwise the compiler warns about
* signed/unsigned comparison, because the magic can be 32 bit unsigned.
*/
#define F_TYPE_CMP(a, b) (a == (typeof(a)) b)
/* Returns the number of chars needed to format variables of the
* specified type as a decimal string. Adds in extra space for a
* negative '-' prefix. */
#define DECIMAL_STR_MAX(type) \
(1+(sizeof(type) <= 1 ? 3 : \
sizeof(type) <= 2 ? 5 : \
sizeof(type) <= 4 ? 10 : \
sizeof(type) <= 8 ? 20 : sizeof(int[-2*(sizeof(type) > 8)])))
#include "log.h"

View File

@@ -185,3 +185,95 @@ static const char *const log_level_table[] = {
};
DEFINE_STRING_TABLE_LOOKUP(log_level, int);
char *strnappend(const char *s, const char *suffix, size_t b) {
size_t a;
char *r;
if (!s && !suffix)
return strdup("");
if (!s)
return strndup(suffix, b);
if (!suffix)
return strdup(s);
assert(s);
assert(suffix);
a = strlen(s);
if (b > ((size_t) -1) - a)
return NULL;
r = new(char, a+b+1);
if (!r)
return NULL;
memcpy(r, s, a);
memcpy(r+a, suffix, b);
r[a+b] = 0;
return r;
}
char *strappend(const char *s, const char *suffix) {
return strnappend(s, suffix, suffix ? strlen(suffix) : 0);
}
char *strjoin(const char *x, ...) {
va_list ap;
size_t l;
char *r, *p;
va_start(ap, x);
if (x) {
l = strlen(x);
for (;;) {
const char *t;
size_t n;
t = va_arg(ap, const char *);
if (!t)
break;
n = strlen(t);
if (n > ((size_t) -1) - l) {
va_end(ap);
return NULL;
}
l += n;
}
} else
l = 0;
va_end(ap);
r = new(char, l+1);
if (!r)
return NULL;
if (x) {
p = stpcpy(r, x);
va_start(ap, x);
for (;;) {
const char *t;
t = va_arg(ap, const char *);
if (!t)
break;
p = stpcpy(p, t);
}
va_end(ap);
} else
r[0] = 0;
return r;
}

View File

@@ -507,6 +507,42 @@ void* memdup(const void *p, size_t l);
int is_kernel_thread(pid_t pid);
static inline void freep(void *p) {
free(*(void**) p);
}
static inline void fclosep(FILE **f) {
if (*f)
fclose(*f);
}
static inline void pclosep(FILE **f) {
if (*f)
pclose(*f);
}
static inline void closep(int *fd) {
if (*fd >= 0)
close_nointr_nofail(*fd);
}
static inline void closedirp(DIR **d) {
if (*d)
closedir(*d);
}
static inline void umaskp(mode_t *u) {
umask(*u);
}
#define _cleanup_free_ _cleanup_(freep)
#define _cleanup_fclose_ _cleanup_(fclosep)
#define _cleanup_pclose_ _cleanup_(pclosep)
#define _cleanup_close_ _cleanup_(closep)
#define _cleanup_closedir_ _cleanup_(closedirp)
#define _cleanup_umask_ _cleanup_(umaskp)
#define _cleanup_globfree_ _cleanup_(globfree)
int fd_inc_sndbuf(int fd, size_t n);
int fd_inc_rcvbuf(int fd, size_t n);
@@ -524,4 +560,6 @@ bool in_initrd(void);
void warn_melody(void);
char *strjoin(const char *x, ...) _sentinel_;
#endif

View File

@@ -0,0 +1,63 @@
#
# -*- 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
# 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/>.
#
__contains_word () {
local word=$1; shift
for w in $*; do [[ $w = $word ]] && return 0; done
return 1
}
_lsinitrd() {
local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
local -A OPTS=(
[STANDALONE]='-s --size -h --help'
[ARG]='-f --file -k --kver'
)
if __contains_word "$prev" ${OPTS[ARG]}; then
case $prev in
--file|-f)
comps=$(compgen -f -- "$cur")
compopt -o filenames
;;
--kver|-k)
comps=$(cd /lib/modules; echo [0-9]*)
;;
*)
return 0
;;
esac
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
return 0
fi
if [[ $cur = -* ]]; then
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
return 0
fi
comps=$(compgen -f -- "$cur")
compopt -o filenames
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
return 0
}
complete -F _lsinitrd lsinitrd

View File

@@ -10,12 +10,15 @@ lsinitrd - tool to show the contents of an initramfs image
SYNOPSIS
--------
*lsinit* ['OPTION...'] [<image>]
*lsinitrd* ['OPTION...'] [<image> [<filename> [<filename> [...] ]]]
*lsinitrd* ['OPTION...'] -k <kernel-version>
DESCRIPTION
-----------
lsinitrd shows the contents of an initramfs image. if <image> is omitted, then
lsinitrd uses the default image /boot/initramfs-<kernel version>.img.
lsinitrd uses the default image _/boot/<machine-id>/<kernel-version>/initrd_ or
_/boot/initramfs-<kernel-version>.img_.
OPTIONS
-------
@@ -25,6 +28,12 @@ OPTIONS
**-s, --size**::
sort the contents of the initramfs by size.
**-f, --file** _<filename>_::
print the contents of <filename>.
**-k, --kver** _<kernel version>_::
inspect the initramfs of <kernel version>.
AVAILABILITY
------------
The lsinitrd command is part of the dracut package and is available from

View File

@@ -21,55 +21,219 @@
usage()
{
echo "Usage: $(basename $0) [-s] [<initramfs file> [<filename>]]"
{
echo "Usage: ${0##*/} [options] [<initramfs file> [<filename> [<filename> [...] ]]]"
echo "Usage: ${0##*/} [options] -k <kernel version>"
echo
echo "-h, --help print a help message and exit."
echo "-s, --size sort the contents of the initramfs by size."
echo "-m, --mod list modules."
echo "-f, --file <filename> print the contents of <filename>."
echo "-k, --kver <kernel version> inspect the initramfs of <kernel version>."
echo
} >&2
}
[[ $# -le 2 ]] || { usage ; exit 1 ; }
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
sorted=0
while getopts "s" opt; do
case $opt in
s) sorted=1;;
h) usage; exit 0;;
\?) usage; exit 1;;
modules=0
declare -A filenames
unset POSIXLY_CORRECT
TEMP=$(getopt \
-o "shmf:k:" \
--long kver: \
--long file: \
--long mod \
--long help \
--long size \
-- "$@")
if (( $? != 0 )); then
usage
exit 1
fi
eval set -- "$TEMP"
while (($# > 0)); do
case $1 in
-k|--kver) KERNEL_VERSION="$2"; shift;;
-f|--file) filenames[${2#/}]=1; shift;;
-s|--size) sorted=1;;
-h|--help) usage; exit 0;;
-m|--mod) modules=1;;
--) shift;break;;
*) usage; exit 1;;
esac
shift
done
shift $((OPTIND-1))
image="${1:-/boot/initramfs-$(uname -r).img}"
[[ -f "$image" ]] || { echo "$image does not exist" ; exit 1 ; }
[[ $KERNEL_VERSION ]] || KERNEL_VERSION="$(uname -r)"
CAT=zcat
FILE_T=$(file --dereference "$image")
if echo "test"|xz|xz -dc --single-stream >/dev/null 2>&1; then
XZ_SINGLE_STREAM="--single-stream"
fi
if [[ "$FILE_T" =~ :\ gzip\ compressed\ data ]]; then
CAT=zcat
elif [[ "$FILE_T" =~ :\ xz\ compressed\ data ]]; then
CAT="xzcat $XZ_SINGLE_STREAM"
elif [[ "$FILE_T" =~ :\ XZ\ compressed\ data ]]; then
CAT="xzcat $XZ_SINGLE_STREAM"
elif [[ "$FILE_T" =~ :\ LZMA ]]; then
CAT="xzcat $XZ_SINGLE_STREAM"
elif [[ "$FILE_T" =~ :\ data ]]; then
CAT="xzcat $XZ_SINGLE_STREAM"
fi
if [[ $# -eq 2 ]]; then
$CAT $image | cpio --extract --verbose --quiet --to-stdout ${2#/} 2>/dev/null
exit $?
fi
echo "$image: $(du -h $image | while read a b; do echo $a;done)"
echo "========================================================================"
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout '*lib/dracut/dracut-*' 2>/dev/null
echo "========================================================================"
if [ "$sorted" -eq 1 ]; then
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
if [[ $1 ]]; then
image="$1"
if ! [[ -f "$image" ]]; then
{
echo "$image does not exist"
echo
} >&2
usage
exit 1
fi
else
$CAT "$image" | cpio --extract --verbose --quiet --list
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
if [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
&& [[ $MACHINE_ID ]] \
&& [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
else
image="/boot/initramfs-${KERNEL_VERSION}.img"
fi
fi
echo "========================================================================"
shift
while (($# > 0)); do
filenames[${1#/}]=1;
shift
done
if ! [[ -f "$image" ]]; then
{
echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
echo
} >&2
usage
exit 1
fi
extract_files()
{
(( ${#filenames[@]} == 1 )) && nofileinfo=1
for f in ${!filenames[@]}; do
[[ $nofileinfo ]] || echo "initramfs:/$f"
[[ $nofileinfo ]] || echo "========================================================================"
$CAT $image 2>/dev/null | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
((ret+=$?))
[[ $nofileinfo ]] || echo "========================================================================"
[[ $nofileinfo ]] || echo
done
}
list_modules()
{
echo "dracut modules:"
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/modules.txt' 'usr/lib/dracut/modules.txt' 2>/dev/null
((ret+=$?))
}
list_files()
{
echo "========================================================================"
if [ "$sorted" -eq 1 ]; then
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
else
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -k9
fi
((ret+=$?))
echo "========================================================================"
}
if (( ${#filenames[@]} <= 0 )); then
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
echo "========================================================================"
fi
read -N 6 bin < "$image"
case $bin in
$'\x71\xc7'*|070701)
CAT="cat --"
is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2>/dev/null)
if [[ "$is_early" ]]; then
if (( ${#filenames[@]} > 0 )); then
extract_files
else
echo "Early CPIO image"
list_files
fi
SKIP="$dracutbasedir/skipcpio"
if ! [[ -x $SKIP ]]; then
echo
echo "'$SKIP' not found, cannot display remaining contents!" >&2
echo
exit 0
fi
fi
;;
esac
CAT=$({
if [[ $SKIP ]]; then
$SKIP "$image"
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
})
skipcpio()
{
$SKIP "$@" | $ORIG_CAT
}
if [[ $SKIP ]]; then
ORIG_CAT="$CAT"
CAT=skipcpio
fi
ret=0
if (( ${#filenames[@]} > 0 )); then
extract_files
else
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
if [ "$modules" -eq 1 ]; then
list_modules
echo "========================================================================"
else
echo -n "Arguments: "
$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
fi
fi
exit $ret

View File

@@ -41,8 +41,8 @@ OPTIONS
**--preload=<module>**::
preload the kernel module <module> in the initramfs before any other kernel
modules are loaded. This can be used to ensure a certain device naming, which
should in theory be avoided and the use of symbolic links in /dev is
modules are loaded. This can be used to ensure a certain device naming,
which should in theory be avoided and the use of symbolic links in /dev is
encouraged.
**--nocompress**::

View File

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

View File

@@ -4,7 +4,7 @@
check() {
[[ "$mount_needs" ]] && return 1
[ -x /sbin/bootchartd ] || return 1
require_binaries /sbin/bootchartd || return 1
return 255
}
@@ -16,7 +16,7 @@ install() {
inst_symlink /init /sbin/init
inst_dir /lib/bootchart/tmpfs
dracut_install bootchartd bash \
inst_multiple bootchartd bash \
/lib/bootchart/bootchart-collector /etc/bootchartd.conf \
accton \
echo \

View File

@@ -3,7 +3,7 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
[ -x /bin/dash ]
require_binaries /bin/dash
}
depends() {

View File

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

View File

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

View File

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

View File

@@ -15,6 +15,12 @@ mount_boot()
UUID=*)
boot="/dev/disk/by-uuid/${boot#UUID=}"
;;
PARTUUID=*)
boot="/dev/disk/by-partuuid/${boot#PARTUUID=}"
;;
PARTLABEL=*)
boot="/dev/disk/by-partlabel/${boot#PARTLABEL=}"
;;
/dev/*)
;;
*)
@@ -32,8 +38,6 @@ mount_boot()
udevadm settle --timeout=30
fi
[ -e $boot ] && break
modprobe scsi_wait_scan && rmmod scsi_wait_scan
[ -e $boot ] && break
sleep 0.5
i=$(($i+1))
[ $i -gt 40 ] && break
@@ -45,35 +49,76 @@ mount_boot()
mkdir /boot
info "Mounting $boot as /boot"
mount -oro "$boot" /boot || return 1
elif [ -d "$NEWROOT/boot" ]; then
rm -fr -- /boot
ln -sf "$NEWROOT/boot" /boot
fi
}
do_rhevh_check()
{
KERNEL=$(uname -r)
kpath=${1}
# If we're on RHEV-H, the kernel is in /run/initramfs/live/vmlinuz0
HMAC_SUM_ORIG=$(cat $NEWROOT/boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done)
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b; do printf "%s\n" $a; done || return 1)
if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
warn "HMAC sum mismatch"
return 1
fi
info "rhevh_check OK"
return 0
}
do_fips()
{
info "Checking integrity of kernel"
newroot=$NEWROOT
local _v
local _s
local _v
local _module
KERNEL=$(uname -r)
[ -e "$newroot/boot/.vmlinuz-${KERNEL}.hmac" ] || unset newroot
if ! [ -e "$newroot/boot/.vmlinuz-${KERNEL}.hmac" ]; then
warn "$newroot/boot/.vmlinuz-${KERNEL}.hmac does not exist"
if ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
warn "/boot/.vmlinuz-${KERNEL}.hmac does not exist"
return 1
fi
sha512hmac -c "$newroot/boot/.vmlinuz-${KERNEL}.hmac" || return 1
FIPSMODULES=$(cat /etc/fipsmodules)
info "Loading and integrity checking all crypto modules"
for module in $FIPSMODULES; do
if [ "$module" != "tcrypt" ]; then
modprobe ${module} || return 1
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
for _module in $FIPSMODULES; do
if [ "$_module" != "tcrypt" ]; then
if ! modprobe "${_module}"; then
# check if kernel provides generic algo
_found=0
while read _k _s _v; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
[ "$_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
fi
info "All initrd crypto checks done"
> /tmp/fipsdone

View File

@@ -12,9 +12,12 @@ depends() {
installkernel() {
local _fipsmodules _mod
_fipsmodules="aead aes_generic xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr gcm ghash_generic"
_fipsmodules+=" des deflate ecb eseqiv hmac seqiv sha256 sha256_generic sha512 sha512_generic"
_fipsmodules+=" cryptomgr crypto_null tcrypt dm-mod dm-crypt"
_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 tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib"
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
@@ -24,7 +27,6 @@ installkernel() {
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
fi
done
hostonly='' instmods scsi_wait_scan
}
install() {
@@ -33,12 +35,14 @@ install() {
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
inst_script "$moddir/fips.sh" /sbin/fips.sh
dracut_install sha512hmac rmmod insmod mount uname umount
inst_multiple sha512hmac rmmod insmod mount uname umount fipscheck
inst_libdir_file libsoftokn3.so libsoftokn3.so \
libsoftokn3.chk libfreebl3.so libfreebl3.chk \
'hmaccalc/sha512hmac.hmac'
libssl.so 'hmaccalc/sha512hmac.hmac' libssl.so.10 \
libfreeblpriv3.so libfreeblpriv3.chk
dracut_install -o prelink
inst_multiple -o prelink
inst_simple /etc/system-fips
}

View File

@@ -3,7 +3,7 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
type -P capsh >/dev/null 2>&1
require_binaries capsh
}
depends() {
@@ -11,9 +11,13 @@ depends() {
}
install() {
inst_hook pre-pivot 00 "$moddir/caps.sh"
inst $(type -P capsh 2>/dev/null) /usr/sbin/capsh
# capsh wants bash and we need bash also
inst /bin/bash
if ! dracut_module_included "systemd"; then
inst_hook pre-pivot 00 "$moddir/caps.sh"
inst $(type -P capsh 2>/dev/null) /usr/sbin/capsh
# capsh wants bash and we need bash also
inst /bin/bash
else
dwarning "caps: does not work with systemd in the initramfs"
fi
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,12 @@
#!/bin/sh
if [ -e /dev/watchdog ]; then
if [ ! -e /tmp/watchdog_timeout ]; then
wdctl -s 60 /dev/watchdog >/dev/null 2>&1
> /tmp/watchdog_timeout
fi
info "Triggering watchdog"
>/dev/watchdog
else
modprobe ib700wdt
modprobe i6300esb
fi

View File

@@ -3,7 +3,7 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
type -P busybox >/dev/null || return 1
require_binaries busybox || return 1
return 255
}
@@ -13,9 +13,10 @@ depends() {
}
install() {
local _i _progs _path
inst busybox /usr/bin/busybox
for _i in `/sbin/busybox | sed -ne '1,/Currently/!{s/,//g; s/busybox//g; p}'`
local _i _progs _path _busybox
_busybox=$(type -P busybox)
inst $_busybox /usr/bin/busybox
for _i in $($_busybox | sed -ne '1,/Currently/!{s/,//g; s/busybox//g; p}')
do
_progs="$_progs $_i"
done
@@ -26,11 +27,7 @@ install() {
for _i in $_progs; do
_path=$(find_binary "$_i")
[ -z "$_path" ] && continue
if [[ $_path != ${_path#/usr} ]]; then
ln -sf ../../usr/bin/busybox "$initdir/$_path"
else
ln -sf ../usr/bin/busybox "$initdir/$_path"
fi
ln_r /usr/bin/busybox $_path
done
}

View File

@@ -1,2 +1,2 @@
# Console initialization - keyboard, font, etc.
KERNEL=="tty0", RUN+="/lib/udev/console_init $root/$name"
KERNEL=="tty0", RUN+="/sbin/initqueue --onetime --unique --name console_init_$name /lib/udev/console_init $root/$name"

View File

@@ -1,4 +1,4 @@
Dracut i18n module
dracut i18n module
------------------
INDEX
@@ -21,7 +21,7 @@ is intended to be generic across different GNU/Linux distributions.
i18n and keyboard settings are stored in different files among
distributions. To deal with it avoiding hardcoding those differences in
the installation script we handle it by mappings between variables used
by Dracut and the ones in the system. Package maintainer is expected to
by dracut and the ones in the system. Package maintainer is expected to
create those for his/her distribution and it's appreciated to share it
with us, so we can include it in source package.

View File

@@ -2,7 +2,11 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
[ -x /lib/systemd/systemd-vconsole-setup ] && exit 0
[ -n "$DRACUT_SYSTEMD" ] && exit 0
if [ -x $systemdutildir/systemd-vconsole-setup ]; then
$systemdutildir/systemd-vconsole-setup "$@"
fi
[ -e /etc/vconsole.conf ] && . /etc/vconsole.conf

View File

@@ -4,6 +4,9 @@
check() {
[[ "$mount_needs" ]] && return 1
require_binaries setfont loadkeys kbd_mode || return 1
return 0
}
@@ -12,9 +15,14 @@ depends() {
}
install() {
[ -x /lib/systemd/systemd-vconsole-setup ] && dracut_install /lib/systemd/systemd-vconsole-setup
if dracut_module_included "systemd"; then
unset FONT
unset KEYMAP
[[ -f /etc/vconsole.conf ]] && . /etc/vconsole.conf
fi
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
DEFAULT_FONT=LatArCyrHeb-16
DEFAULT_FONT="${i18n_default_font:-LatArCyrHeb-16}"
I18N_CONF="/etc/locale.conf"
VCONFIG_CONF="/etc/vconsole.conf"
@@ -31,7 +39,7 @@ install() {
*) cmd=grep ;;
esac
for INCL in $($cmd "^include " $MAP | while read a a b; do echo ${a/\"/}; done); do
for INCL in $($cmd "^include " $MAP | while read a a b; do echo ${a//\"/}; done); do
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
findkeymap $FN
done
@@ -84,11 +92,13 @@ install() {
}
install_base() {
dracut_install setfont loadkeys kbd_mode stty
inst_multiple setfont loadkeys kbd_mode stty
inst ${moddir}/console_init.sh /lib/udev/console_init
inst_rules ${moddir}/10-console.rules
inst_hook cmdline 20 "${moddir}/parse-i18n.sh"
if ! dracut_module_included "systemd"; then
inst ${moddir}/console_init.sh /lib/udev/console_init
inst_rules ${moddir}/10-console.rules
inst_hook cmdline 20 "${moddir}/parse-i18n.sh"
fi
}
install_all_kbd() {
@@ -96,20 +106,20 @@ install() {
for _src in $(eval echo ${kbddir}/{${KBDSUBDIRS}}); do
inst_dir "$_src"
cp --reflink=auto --sparse=auto -prfL -t "${initdir}/${_src%/*}" "$_src"
cp --reflink=auto --sparse=auto -prfL -t "${initdir}/${_src}" "$_src"/*
done
# remove unnecessary files
rm -f "${initdir}${kbddir}/consoletrans/utflist"
rm -f -- "${initdir}${kbddir}/consoletrans/utflist"
find "${initdir}${kbddir}/" -name README\* -delete
find "${initdir}${kbddir}/" -name '*.gz' -print -quit \
| while read line; do
dracut_install gzip
inst_multiple gzip
done
find "${initdir}${kbddir}/" -name '*.bz2' -print -quit \
| while read line; do
dracut_install bzip2
inst_multiple bzip2
done
}
@@ -173,7 +183,7 @@ install() {
inst_opt_decompress ${kbddir}/consolefonts/${DEFAULT_FONT}.*
if [[ ${FONT} ]]
if [[ ${FONT} ]] && [[ ${FONT} != ${DEFAULT_FONT} ]]
then
FONT=${FONT%.psf*}
inst_opt_decompress ${kbddir}/consolefonts/${FONT}.*
@@ -191,10 +201,20 @@ install() {
inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni
fi
mksubdirs ${initdir}${I18N_CONF}
mksubdirs ${initdir}${VCONFIG_CONF}
print_vars LC_ALL LANG >> ${initdir}${I18N_CONF}
print_vars KEYMAP EXT_KEYMAPS UNICODE FONT FONT_MAP FONT_UNIMAP >> ${initdir}${VCONFIG_CONF}
if dracut_module_included "systemd" && [[ -f ${I18N_CONF} ]]; then
inst_simple ${I18N_CONF}
else
mksubdirs ${initdir}${I18N_CONF}
print_vars LC_ALL LANG >> ${initdir}${I18N_CONF}
fi
if dracut_module_included "systemd" && [[ -f ${VCONFIG_CONF} ]]; then
inst_simple ${VCONFIG_CONF}
else
mksubdirs ${initdir}${VCONFIG_CONF}
print_vars KEYMAP EXT_KEYMAPS UNICODE FONT FONT_MAP FONT_UNIMAP >> ${initdir}${VCONFIG_CONF}
fi
return 0
}
@@ -210,12 +230,6 @@ install() {
kbddir=''
done
[[ ${kbddir} ]] || {
derror "Directories ${KBDSUBDIRS//,/, } not found. Please" \
"inform us about the issue including your OS name and version."
return 1
}
[[ -f $I18N_CONF && -f $VCONFIG_CONF ]] || \
[[ ! ${hostonly} || ${i18n_vars} ]] || {
derror 'i18n_vars not set! Please set up i18n_vars in ' \
@@ -224,16 +238,13 @@ install() {
return 0
}
if checks
then
if checks; then
install_base
if [[ ${hostonly} ]]
then
if [[ ${hostonly} ]] && ! [[ ${i18n_install_all} == "yes" ]]; then
install_local_i18n || install_all_kbd
else
install_all_kbd
fi
fi
}

View File

@@ -13,21 +13,21 @@ inst_key_val() {
_value=$(getarg $@)
[ -z "${_value}" ] && _value=$_default
if [ -n "${_value}" ]; then
printf '%s="%s"\n' $1 ${_value} >> $_file
printf '%s="%s"\n' $2 ${_value} >> $_file
fi
unset _file
unset _value
}
inst_key_val '' /etc/vconsole.conf KEYMAP vconsole.keymap KEYTABLE
inst_key_val '' /etc/vconsole.conf FONT vconsole.font SYSFONT
inst_key_val '' /etc/vconsole.conf FONT_MAP vconsole.font.map CONTRANS
inst_key_val '' /etc/vconsole.conf FONT_UNIMAP vconsole.font.unimap UNIMAP
inst_key_val 1 /etc/vconsole.conf UNICODE vconsole.unicode vconsole.font.unicode
inst_key_val '' /etc/vconsole.conf EXT_KEYMAP vconsole.keymap.ext
inst_key_val '' /etc/vconsole.conf vconsole.keymap KEYMAP -d KEYTABLE
inst_key_val '' /etc/vconsole.conf vconsole.font FONT -d SYSFONT
inst_key_val '' /etc/vconsole.conf vconsole.font.map FONT_MAP -d CONTRANS
inst_key_val '' /etc/vconsole.conf vconsole.font.unimap FONT_UNIMAP -d UNIMAP
inst_key_val 1 /etc/vconsole.conf vconsole.font.unicode UNICODE vconsole.unicode
inst_key_val '' /etc/vconsole.conf vconsole.keymap.ext EXT_KEYMAP
inst_key_val '' /etc/locale.conf LANG locale.LANG
inst_key_val '' /etc/locale.conf LC_ALL locale.LC_ALL
inst_key_val '' /etc/locale.conf locale.LANG LANG
inst_key_val '' /etc/locale.conf locale.LC_ALL LC_ALL
if [ -f /etc/locale.conf ]; then
. /etc/locale.conf
@@ -35,10 +35,8 @@ if [ -f /etc/locale.conf ]; then
export LC_ALL
fi
# FIXME: fix systemd-vconsole-setup
#if [ -x /lib/systemd/systemd-vconsole-setup ]; then
# /lib/systemd/systemd-vconsole-setup
# rm -f /{etc,lib}/udev/rules.d/10-console.rules
# rm -f /lib/udev/console_init
# ln -s /lib/systemd/systemd-vconsole-setup /lib/udev/console_init
#fi
if [ -n "$DRACUT_SYSTEMD" ]; then
rm -f -- /etc/udev/rules.d/10-console.rules
rm -f -- /lib/udev/rules.d/10-console.rules
rm -f -- /lib/udev/console_init
fi

View File

@@ -56,41 +56,63 @@ if ! needconvert; then
fi
testfile="$ROOT/.usrmovecheck$$"
rm -f "$testfile"
rm -f -- "$testfile"
> "$testfile"
if [[ ! -e "$testfile" ]]; then
echo "Cannot write to $ROOT/"
exit 1
fi
rm -f "$testfile"
rm -f -- "$testfile"
testfile="$ROOT/usr/.usrmovecheck$$"
rm -f "$testfile"
rm -f -- "$testfile"
> "$testfile"
if [[ ! -e "$testfile" ]]; then
echo "Cannot write to $ROOT/usr/"
exit 1
fi
rm -f "$testfile"
rm -f -- "$testfile"
ismounted() {
while read a m a; do
[[ "$m" = "$1" ]] && return 0
find_mount() {
local dev mnt etc wanted_dev
wanted_dev="$(readlink -e -q $1)"
while read dev mnt etc; do
[ "$dev" = "$wanted_dev" ] && echo "$dev" && return 0
done < /proc/mounts
return 1
}
# usage: ismounted <mountpoint>
# usage: ismounted /dev/<device>
if command -v findmnt >/dev/null; then
ismounted() {
findmnt "$1" > /dev/null 2>&1
}
else
ismounted() {
if [ -b "$1" ]; then
find_mount "$1" > /dev/null && return 0
return 1
fi
while read a m a; do
[ "$m" = "$1" ] && return 0
done < /proc/mounts
return 1
}
fi
# clean up after ourselves no matter how we die.
cleanup() {
echo "Something failed. Move back to the original state"
for dir in "$ROOT/bin" "$ROOT/sbin" "$ROOT/lib" "$ROOT/lib64" \
"$ROOT/usr/bin" "$ROOT/usr/sbin" "$ROOT/usr/lib" \
"$ROOT/usr/lib64"; do
[[ -d "${dir}.usrmove-new" ]] && rm -fr "${dir}.usrmove-new"
[[ -d "${dir}.usrmove-new" ]] && rm -fr -- "${dir}.usrmove-new"
if [[ -d "${dir}.usrmove-old" ]]; then
mv "$dir" "${dir}.del~"
mv "${dir}.usrmove-old" "$dir"
rm -fr "${dir}.del~"
rm -fr -- "${dir}.del~"
fi
done
}
@@ -104,7 +126,7 @@ set -e
# merge / and /usr in new dir in /usr
for dir in bin sbin lib lib64; do
rm -rf "$ROOT/usr/${dir}.usrmove-new"
rm -rf -- "$ROOT/usr/${dir}.usrmove-new"
[[ -L "$ROOT/$dir" ]] && continue
[[ -d "$ROOT/$dir" ]] || continue
echo "Make a copy of \`$ROOT/usr/$dir'."
@@ -128,7 +150,7 @@ done
for dir in bin sbin lib lib64; do
[[ -d "$ROOT/usr/${dir}.usrmove-new" ]] || continue
echo "Switch to new \`$ROOT/usr/$dir'."
rm -fr "$ROOT/usr/${dir}.usrmove-old"
rm -fr -- "$ROOT/usr/${dir}.usrmove-old"
mv "$ROOT/usr/$dir" "$ROOT/usr/${dir}.usrmove-old"
mv "$ROOT/usr/${dir}.usrmove-new" "$ROOT/usr/$dir"
done
@@ -138,7 +160,7 @@ for dir in bin sbin lib lib64; do
[[ -L "$ROOT/$dir" ]] && continue
[[ -d "$ROOT/$dir" ]] || continue
echo "Create \`$ROOT/$dir' symlink."
rm -rf "$ROOT/${dir}.usrmove-old" || :
rm -fr -- "$ROOT/${dir}.usrmove-old" || :
mv "$ROOT/$dir" "$ROOT/${dir}.usrmove-old"
ln -sfn usr/$dir "$ROOT/$dir"
done
@@ -156,9 +178,9 @@ done
for dir in bin sbin lib lib64; do
[[ -d "$ROOT/usr/${dir}.usrmove-old~" ]] \
&& rm -rf "$ROOT/usr/${dir}.usrmove-old~" || :
&& rm -rf -- "$ROOT/usr/${dir}.usrmove-old~" || :
[[ -d "$ROOT/${dir}.usrmove-old~" ]] \
&& rm -rf "$ROOT/${dir}.usrmove-old~" || :
&& rm -rf -- "$ROOT/${dir}.usrmove-old~" || :
done
for dir in lib lib64; do

View File

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

View File

@@ -2,6 +2,14 @@
# -*- 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
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
# We already need a set netif here
netif=$interface
setup_interface() {
ip=$new_ip_address
mtu=$new_interface_mtu
@@ -9,10 +17,15 @@ setup_interface() {
bcast=$new_broadcast_address
gw=${new_routers%%,*}
domain=$new_domain_name
search=$(printf "$new_domain_search")
search=$(printf -- "$new_domain_search")
namesrv=$new_domain_name_servers
hostname=$new_host_name
[ -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
# Taken from debian dhclient-script:
@@ -25,14 +38,21 @@ setup_interface() {
if ! ip link set $netif mtu $mtu ; then
ip link set $netif down
ip link set $netif mtu $mtu
ip link set $netif up
wait_for_if_up $netif
linkup $netif
fi
fi
ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} 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}}
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
if [ -n "$gw" ] ; then
if [ "$mask" == "255.255.255.255" ] ; then
# point-to-point connection => set explicit route to gateway
echo ip route add $gw dev $netif > /tmp/net.$netif.gw
fi
echo ip route replace default via $gw dev $netif >> /tmp/net.$netif.gw
fi
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
if [ -n "$namesrv" ] ; then
@@ -43,27 +63,50 @@ setup_interface() {
# Note: hostname can be fqdn OR short hostname, so chop off any
# trailing domain name and explicity add any domain if set.
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
}
PATH=/usr/sbin:/usr/bin:/sbin:/bin
setup_interface6() {
domain=$new_domain_name
search=$(printf -- "$new_domain_search")
namesrv=$new_domain_name_servers
hostname=$new_host_name
[ -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
export PS4="dhclient.$interface.$$ + "
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
[ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
# We already need a set netif here
netif=$interface
ip -6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
dev ${netif} scope global \
${lease_time:+valid_lft $lease_time} \
${preferred_lft:+preferred_lft ${preferred_lft}}
# Huh? Interface configured?
[ -f "/tmp/net.$netif.up" ] && exit 0
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf
# Note: hostname can be fqdn OR short hostname, so chop off any
# trailing domain name and explicity add any domain if set.
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
}
case $reason in
PREINIT)
echo "dhcp: PREINIT $netif up"
ip link set $netif up
wait_for_if_up $netif
linkup $netif
;;
PREINIT6)
echo "dhcp: PREINIT6 $netif up"
linkup $netif
wait_for_ipv6_dad $netif
;;
BOUND)
echo "dhcp: BOND setting $netif"
unset layer2
@@ -71,7 +114,7 @@ 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
@@ -88,13 +131,63 @@ case $reason in
echo "setup_net $netif"
echo "source_hook initqueue/online $netif"
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
echo "> /tmp/setup_net_$netif.ok"
echo "rm -f $hookdir/initqueue/setup_net_$netif.sh"
echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
} > $hookdir/initqueue/setup_net_$netif.sh
echo "[ -f /tmp/setup_net_$netif.ok ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
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; do
[ "${line#new_}" = "$line" ] && continue
echo "$line"
done >/tmp/dhclient.$netif.dhcpopts
{
echo '. /lib/net-lib.sh'
echo "setup_net $netif"
echo "source_hook initqueue/online $netif"
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
} > $hookdir/initqueue/setup_net_$netif.sh
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

@@ -2,20 +2,24 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# Don't continue if root is ok
[ -n "$rootok" ] && return
# This script is sourced, so root should be set. But let's be paranoid
[ -z "$root" ] && root=$(getarg root=)
[ -z "$netroot" ] && netroot=$(getarg netroot=)
if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] ; then
if [ -z "$netroot" ]; then
for netroot in $(getargs netroot=); do
[ "$netroot" = "dhcp" ] && break
[ "$netroot" = "dhcp6" ] && break
done
[ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] || unset netroot
fi
if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ]; then
# Tell ip= checker that we need dhcp
NEEDDHCP="1"
# Done, all good!
rootok=1
if [ "$netroot" != "dhcp" ] ; then
if [ "$netroot" != "dhcp" ] && [ "$netroot" != "dhcp6" ]; then
netroot=$root
fi

View File

@@ -17,59 +17,118 @@ 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?
if [ -e /tmp/bond.info ]; then
. /tmp/bond.info
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
fi
done
# bridge this interface?
if [ -e /tmp/bridge.info ]; then
. /tmp/bridge.info
for ethname in $ethnames ; do
if [ "$netif" = "$ethname" ]; then
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
: # We need to really setup bond (recursive call)
else
netif="$bridgename"
fi
for i in /tmp/team.*.info; do
[ -e "$i" ] || continue
unset teamslaves
unset teammaster
. "$i"
for slave in $teamslaves ; do
if [ "$netif" = "$slave" ] ; then
netif=$teammaster
fi
done
fi
done
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
[ -n "$manualup" ] && >/tmp/net.$netif.manualup
if [ -n "$manualup" ]; then
>/tmp/net.$netif.manualup
rm -f /tmp/net.${netif}.did-setup
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
fi
# Run dhclient
do_dhcp() {
# dhclient-script will mark the netif up and generate the online
# event for nfsroot
# XXX add -V vendor class and option parsing per kernel
echo "Starting dhcp for interface $netif"
dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif \
|| echo "dhcp failed"
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
warn "No carrier detected on interface $netif"
return 1
fi
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() {
[ -d /proc/sys/net/ipv6 ] && return
modprobe ipv6
i=0
while [ ! -d /proc/sys/net/ipv6 ]; do
@@ -84,44 +143,51 @@ do_ipv6auto() {
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
ip link set $netif up
wait_for_if_up $netif
linkup $netif
wait_for_ipv6_auto $netif
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
namesrv=$(getargs nameserver)
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf
return 0
}
# Handle static ip configuration
do_static() {
strstr $ip '*:*:*' && load_ipv6
ip link set $netif up
wait_for_if_up $netif
[ -n "$macaddr" ] && ip link set address $macaddr
[ -n "$mtu" ] && ip link set mtu $mtu
if strstr $ip '*:*:*'; then
# note no ip addr flush for ipv6
ip addr add $ip/$mask dev $netif
else
ip addr flush dev $netif
ip addr add $ip/$mask brd + dev $netif
if ! linkup $netif; then
warn "Could not bring interface $netif up!"
return 1
fi
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
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
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
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
if ! arping -f -q -D -c 2 -I $netif $ip; then
warn "Duplicate address detected for $ip for interface $netif."
return 1
fi
ip addr flush dev $netif
ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif
fi
[ -n "$gw" ] && echo ip route replace default via $gw dev $netif > /tmp/net.$netif.gw
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
namesrv=$(getargs nameserver)
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf
return 0
}
# loopback is always handled the same way
@@ -132,11 +198,12 @@ if [ "$netif" = "lo" ] ; then
fi
# start bond if needed
if [ -e /tmp/bond.info ]; then
. /tmp/bond.info
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
@@ -157,13 +224,13 @@ if [ -e /tmp/bond.info ]; then
fi
done
ip link set $netif up
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
ip link set $slave up
wait_for_if_up $slave
linkup $slave
done
# add the bits to setup the needed post enslavement parameters
@@ -177,6 +244,46 @@ if [ -e /tmp/bond.info ]; then
fi
fi
if [ -e /tmp/team.${netif}.info ]; then
. /tmp/team.${netif}.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
teamdctl ${teammaster} port present ${slave} 2>/dev/null \
&& continue
ip link set dev $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 dev $slave down
(
unset TEAM_PORT_CONFIG
_hwaddr=$(cat /sys/class/net/$slave/address)
_subchannels=$(iface_get_subchannels "$slave")
if [ -n "$_hwaddr" ] && [ -e "/etc/sysconfig/network-scripts/mac-${_hwaddr}.conf" ]; then
. "/etc/sysconfig/network-scripts/mac-${_hwaddr}.conf"
elif [ -n "$_subchannels" ] && [ -e "/etc/sysconfig/network-scripts/ccw-${_subchannels}.conf" ]; then
. "/etc/sysconfig/network-scripts/ccw-${_subchannels}.conf"
elif [ -e "/etc/sysconfig/network-scripts/ifcfg-${slave}" ]; then
. "/etc/sysconfig/network-scripts/ifcfg-${slave}"
fi
if [ -n "${TEAM_PORT_CONFIG}" ]; then
/usr/bin/teamdctl ${teammaster} port config update ${slave} "${TEAM_PORT_CONFIG}"
fi
)
teamdctl $teammaster port add $slave
done
ip link set dev $teammaster up
fi
fi
# XXX need error handling like dhclient-script
@@ -186,13 +293,16 @@ if [ -e /tmp/bridge.info ]; then
if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
brctl addbr $bridgename
brctl setfd $bridgename 0
for ethname in $ethnames ; do
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
ip link set $ethname up
linkup $ethname
fi
wait_for_if_up $ethname
brctl addif $bridgename $ethname
done
fi
@@ -201,10 +311,10 @@ fi
get_vid() {
case "$1" in
vlan*)
return ${1#vlan}
echo ${1#vlan}
;;
*.*)
return ${1##*.}
echo ${1##*.}
;;
esac
}
@@ -213,17 +323,24 @@ 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
ip link set "$phydevice" up
linkup "$phydevice"
fi
wait_for_if_up "$phydevice"
ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname; echo $?)"
ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname)"
ip link set "$vlanname" up
fi
# No ip lines default to dhcp
ip=$(getarg ip)
if [ -z "$ip" ]; then
for s in $(getargs nameserver); do
[ -n "$s" ] || continue
echo nameserver $s >> /tmp/net.$netif.resolv.conf
done
if [ "$netroot" = "dhcp6" ]; then
do_dhcp -6
else
@@ -231,6 +348,7 @@ if [ -z "$ip" ]; then
fi
fi
# Specific configuration, spin through the kernel command line
# looking for ip= lines
for p in $(getargs ip=); do
@@ -238,30 +356,59 @@ for p in $(getargs ip=); do
# skip ibft
[ "$autoconf" = "ibft" ] && continue
case "$dev" in
??:??:??:??:??:??) # MAC address
_dev=$(iface_for_mac $dev)
[ -n "$_dev" ] && dev="$_dev"
;;
??-??-??-??-??-??) # MAC address in BOOTIF form
_dev=$(iface_for_mac $(fix_bootif $dev))
[ -n "$_dev" ] && dev="$_dev"
;;
esac
# If this option isn't directed at our interface, skip it
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
[ -n "$dev" ] && [ "$dev" != "$netif" ] && \
[ "$use_bridge" != 'true' ] && \
[ "$use_vlan" != 'true' ] && continue
# setup nameserver
for s in "$dns1" "$dns2" $(getargs nameserver); do
[ -n "$s" ] || continue
echo nameserver $s >> /tmp/net.$netif.resolv.conf
done
# Store config for later use
for i in ip srv gw mask hostname macaddr; do
for i in ip srv gw mask hostname macaddr dns1 dns2; do
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
done > /tmp/net.$netif.override
case $autoconf in
dhcp|on|any)
do_dhcp -4 ;;
dhcp6)
do_dhcp -6 ;;
auto6)
do_ipv6auto ;;
*)
do_static ;;
esac
for autoopt in $(str_replace "$autoconf" "," " "); do
case $autoopt in
dhcp|on|any)
do_dhcp -4 ;;
dhcp6)
load_ipv6
do_dhcp -6 ;;
auto6)
do_ipv6auto ;;
*)
do_static ;;
esac
done
ret=$?
> /tmp/net.${netif}.up
if [ -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
if [ $ret -eq 0 ]; then
setup_net $netif
source_hook initqueue/online $netif
if [ -z "$manualup" ]; then
@@ -271,6 +418,33 @@ for p in $(getargs ip=); do
;;
esac
break
exit 0
done
# netif isn't the top stack? Then we should exit here.
# eg. netif is bond0. br0 is on top of it. dhcp br0 is correct but dhcp
# bond0 doesn't make sense.
if [ -n "$DO_BOND_SETUP" -o -n "$DO_TEAM_SETUP" -o -n "$DO_VLAN_SETUP" ]; then
exit 0
fi
# no ip option directed at our interface?
if [ ! -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
if getargs 'ip=dhcp6'; then
load_ipv6
do_dhcp -6
fi
if getargs 'ip=dhcp'; then
do_dhcp -4
fi
fi
fi
exit 0

View File

@@ -5,18 +5,12 @@
check() {
local _program
for _program in ip arping dhclient ; do
if ! type -P $_program >/dev/null; then
derror "Could not find program \"$_program\" required by network."
return 1
fi
done
require_binaries ip arping dhclient || return 1
return 255
}
depends() {
[ -d /etc/sysconfig/network-scripts/ ] && echo ifcfg
return 0
}
@@ -24,8 +18,8 @@ installkernel() {
# Include wired net drivers, excluding wireless
net_module_filter() {
local _net_drivers='eth_type_trans|register_virtio_device'
local _unwanted_drivers='/(wireless|isdn|uwb)/'
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
@@ -64,21 +58,22 @@ installkernel() {
{ 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 =drivers/net/phy
instmods ecb arc4
# bridge modules
instmods bridge stp llc
instmods ipv6
# bonding
instmods bonding
# vlan
instmods 8021q
#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
}
install() {
local _arch _i _dir
dracut_install ip arping dhclient sed
dracut_install -o brctl
inst_multiple ip arping dhclient sed
inst_multiple -o ping ping6
inst_multiple -o brctl
inst_multiple -o teamd teamdctl teamnl
inst_simple /etc/libnl/classid
inst_script "$moddir/ifup.sh" "/sbin/ifup"
inst_script "$moddir/netroot.sh" "/sbin/netroot"
inst_script "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
@@ -87,16 +82,57 @@ install() {
inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
inst_hook cmdline 92 "$moddir/parse-ibft.sh"
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
inst_hook cmdline 96 "$moddir/parse-bond.sh"
inst_hook cmdline 96 "$moddir/parse-team.sh"
inst_hook cmdline 97 "$moddir/parse-bridge.sh"
inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
inst_hook cleanup 10 "$moddir/kill-dhclient.sh"
# install all config files for teaming
unset TEAM_MASTER
unset TEAM_CONFIG
unset TEAM_PORT_CONFIG
unset HWADDR
unset SUBCHANNELS
for i in /etc/sysconfig/network-scripts/ifcfg-*; do
[ -e "$i" ] || continue
case "$i" in
*~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
continue
;;
esac
(
. "$i"
if ! [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] \
&& [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
if [ -n "$TEAM_CONFIG" ] && [ -n "$DEVICE" ]; then
mkdir -p $initdir/etc/teamd
printf -- "%s" "$TEAM_CONFIG" > "$initdir/etc/teamd/${DEVICE}.conf"
elif [ -n "$TEAM_PORT_CONFIG" ]; then
inst_simple "$i"
HWADDR="$(echo $HWADDR | sed 'y/ABCDEF/abcdef/')"
if [ -n "$HWADDR" ]; then
ln_r "$i" "/etc/sysconfig/network-scripts/mac-${HWADDR}.conf"
fi
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
if [ -n "$SUBCHANNELS" ]; then
ln_r "$i" "/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf"
fi
fi
fi
)
done
_arch=$(uname -m)
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
dracut_need_initqueue
}

View File

@@ -2,59 +2,105 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# pxelinux provides macaddr '-' separated, but we need ':'
fix_bootif() {
local macaddr=${1}
local IFS='-'
macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
macaddr=${macaddr%:}
# strip hardware type field from pxelinux
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
# return macaddr with lowercase alpha characters expected by udev
echo $macaddr | sed 'y/ABCDEF/abcdef/'
}
getargbool 0 rd.neednet && NEEDNET=1
# Don't continue if we don't need network
[ -z "$netroot" ] && ! [ -e "/tmp/net.ifaces" ] && return;
if [ -z "$netroot" ] && [ ! -e "/tmp/net.ifaces" ] && [ "$NEEDNET" != "1" ]; then
return
fi
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+=" ${ethnames%% *}"
IFACES="$IFACES ${bridgeslaves%% *}"
MASTER_IFACES="$MASTER_IFACES $bridgename"
fi
# bond: attempt only the defined interface (override bridge defines)
if [ -e /tmp/bond.info ]; then
. /tmp/bond.info
for i in /tmp/bond.*.info; do
[ -e "$i" ] || continue
unset bondslaves
unset bondname
. "$i"
# It is enough to fire up only one
IFACES+=" ${bondslaves%% *}"
fi
IFACES="$IFACES ${bondslaves%% *}"
MASTER_IFACES="$MASTER_IFACES ${bondname}"
done
for i in /tmp/team.*.info; do
[ -e "$i" ] || continue
unset teamslaves
unset teammaster
. "$i"
IFACES="$IFACES ${teamslaves}"
MASTER_IFACES="$MASTER_IFACES ${teammaster}"
done
if [ -e /tmp/vlan.info ]; then
. /tmp/vlan.info
IFACES+=" $phydevice"
IFACES="$IFACES $phydevice"
MASTER_IFACES="$MASTER_IFACES ${vlanname}"
fi
if [ -z "$IFACES" ]; then
[ -e /tmp/net.ifaces ] && read IFACES < /tmp/net.ifaces
fi
if [ -e /tmp/net.bootdev ]; then
bootdev=$(cat /tmp/net.bootdev)
fi
ifup='/sbin/ifup $env{INTERFACE}'
[ -z "$netroot" ] && ifup="$ifup -m"
# BOOTIF says everything, use only that one
BOOTIF=$(getarg 'BOOTIF=')
if [ -n "$BOOTIF" ] ; then
BOOTIF=$(fix_bootif "$BOOTIF")
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="%s"\n' "$BOOTIF" "/sbin/initqueue --onetime $ifup"
runcmd="RUN+=\"/sbin/initqueue --name ifup-\$env{INTERFACE} --unique --onetime $ifup\""
# If we have to handle multiple interfaces, handle only them.
elif [ -n "$IFACES" ] ; then
for iface in $IFACES ; do
printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="%s"\n' "$iface" "/sbin/initqueue --onetime $ifup"
# We have some specific interfaces to handle
if [ -n "$IFACES" ]; then
echo 'SUBSYSTEM!="net", GOTO="net_end"'
echo 'ACTION!="add|change|move", GOTO="net_end"'
for iface in $IFACES; do
case "$iface" in
??:??:??:??:??:??) # MAC address
cond="ATTR{address}==\"$iface\""
echo "$cond, $runcmd, GOTO=\"net_end\""
;;
??-??-??-??-??-??) # MAC address in BOOTIF form
cond="ATTR{address}==\"$(fix_bootif $iface)\""
echo "$cond, $runcmd, GOTO=\"net_end\""
;;
*) # an interface name
cond="ENV{INTERFACE}==\"$iface\""
echo "$cond, $runcmd, GOTO=\"net_end\""
cond="NAME==\"$iface\""
echo "$cond, $runcmd, GOTO=\"net_end\""
;;
esac
# The GOTO prevents us from trying to ifup the same device twice
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
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
echo "[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh
fi
done
# Default: We don't know the interface to use, handle all
# Fixme: waiting for the interface as well.
else
printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup" > /etc/udev/rules.d/91-default-net.rules
cond='ACTION=="add", SUBSYSTEM=="net"'
# 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
# if you change the name of "90-net.rules", also change modules.d/80cms/cmssetup.sh
} > /etc/udev/rules.d/90-net.rules

602
modules.d/40network/net-lib.sh Normal file → Executable file
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=""
@@ -12,6 +26,11 @@ iface_for_remote_addr() {
echo $5
}
iface_for_ip() {
set -- $(ip -o addr show to $1)
echo $2
}
iface_for_mac() {
local interface="" mac="$(echo $1 | sed 'y/ABCDEF/abcdef/')"
for interface in /sys/class/net/*; do
@@ -21,15 +40,30 @@ iface_for_mac() {
done
}
iface_has_link() {
local interface="$1" flags=""
[ -n "$interface" ] || return 2
interface="/sys/class/net/$interface"
[ -d "$interface" ] || return 2
flags=$(cat $interface/flags)
echo $(($flags|0x41)) > $interface/flags # 0x41: IFF_UP|IFF_RUNNING
[ "$(cat $interface/carrier)" = 1 ] || return 1
# XXX Do we need to reset the flags here? anaconda never bothered..
# get the iface name for the given identifier - either a MAC, IP, or iface name
iface_name() {
case $1 in
??:??:??:??:??:??|??-??-??-??-??-??) iface_for_mac $1 ;;
*:*:*|*.*.*.*) iface_for_ip $1 ;;
*) echo $1 ;;
esac
}
# list the configured interfaces
configured_ifaces() {
local IFACES="" iface_id="" rv=1
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
if { pidof udevd || pidof systemd-udevd; } > /dev/null; then
for iface_id in $IFACES; do
echo $(iface_name $iface_id)
rv=0
done
else
warn "configured_ifaces called before udev is running"
echo $IFACES
[ -n "$IFACES" ] && rv=0
fi
return $rv
}
all_ifaces_up() {
@@ -40,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
@@ -59,23 +101,42 @@ ifdown() {
ip link set $netif down
ip addr flush dev $netif
echo "#empty" > /etc/resolv.conf
rm -f /tmp/net.$netif.did-setup
rm -f -- /tmp/net.$netif.did-setup
[ -e /sys/class/net/$netif/address ] && \
rm -f -- /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
# TODO: send "offline" uevent?
}
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 ] && \
[ -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"
# run the scripts written by ifup
[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
[ -e /tmp/net.$netif.hostname ] && . /tmp/net.$netif.hostname
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
# set up resolv.conf
[ -e /tmp/net.$netif.resolv.conf ] && \
cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf
[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
# add static route
for _p in $(getargs rd.route); do
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
printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
> /tmp/net.route6."$netif"
else
printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
> /tmp/net.route."$netif"
fi
done
# Handle STP Timeout: arping the default gateway.
# (or the root server, if a) it's local or b) there's no gateway.)
@@ -101,12 +162,14 @@ setup_net() {
read layer2 < /sys/class/net/$netif/device/layer2
fi
if [ "$layer2" != "0" ] && [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then
info "Resolving $dest via ARP on $netif failed"
if [ "$layer2" != "0" ] && [ -n "$dest" ] && ! strstr "$dest" ":"; then
arping -q -f -w 60 -I $netif $dest || info "Resolving $dest via ARP on $netif failed"
fi
unset layer2
> /tmp/net.$netif.did-setup
[ -e /sys/class/net/$netif/address ] && \
> /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
}
save_netinfo() {
@@ -126,41 +189,104 @@ save_netinfo() {
}
set_ifname() {
local name="$1" mac="$2" num=0 n=""
local name="$1" mac="$2" num=-1 n=""
# if it's already set, return the existing name
for n in $(getargs ifname=); do
strstr "$n" "$mac" && echo ${n%%:*} && return
done
# otherwise, pick a new name and use that
while [ -e /sys/class/$name$num ]; do num=$(($num+1)); done
while :; do
num=$(($num+1));
[ -e /sys/class/net/$name$num ] && continue
for n in $(getargs ifname=); do
[ "$name$num" = "${n%%:*}" ] && continue 2
done
break
done
echo "ifname=$name$num:$mac" >> /etc/cmdline.d/45-ifname.conf
echo "$name$num"
}
# pxelinux provides macaddr '-' separated, but we need ':'
fix_bootif() {
local macaddr=${1}
local IFS='-'
macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
macaddr=${macaddr%:}
# strip hardware type field from pxelinux
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
# return macaddr with lowercase alpha characters expected by udev
echo $macaddr | sed 'y/ABCDEF/abcdef/'
}
ibft_to_cmdline() {
local iface="" mac="" dev=""
local dhcp="" ip="" gw="" mask="" hostname=""
local iface=""
modprobe -q iscsi_ibft
(
for iface in /sys/firmware/ibft/ethernet*; do
local mac="" dev=""
local dhcp="" ip="" gw="" mask="" hostname=""
local dns1 dns2
[ -e ${iface}/mac ] || continue
mac=$(read a < ${iface}/mac; echo $a)
[ -z "$ifname_mac" ] && continue
dev=$(set_ifname ibft $ifname_mac)
dhcp=$(read a < ${iface}/dhcp; echo $a)
[ -z "$mac" ] && continue
dev=$(set_ifname ibft $mac)
[ -e /tmp/net.${dev}.has_ibft_config ] && continue
[ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
if [ -n "$dhcp" ]; then
echo "ip=$dev:dhcp"
elif [ -e ${iface}/ip-addr ]; then
[ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a)
# skip not assigned ip adresses
[ "$ip" = "0.0.0.0" ] && continue
[ -e ${iface}/gateway ] && gw=$(read a < ${iface}/gateway; echo $a)
[ "$gateway" = "0.0.0.0" ] && unset $gateway
[ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; 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 [ -n "$ip" ] && [ -n "$mask" ]; then
echo "ip=$ip::$gw:$mask:$hostname:$dev:none${dns1:+:$dns1}${dns2:+:$dns2}"
else
warn "${iface} does not contain a valid iBFT configuration"
warn "ip-addr=$ip"
warn "gateway=$gw"
warn "subnet-mask=$mask"
warn "hostname=$hostname"
fi
else
ip=$(read a < ${iface}/ip-addr; echo $a)
gw=$(read a < ${iface}/gateway; echo $a)
mask=$(read a < ${iface}/subnet-mask; echo $a)
hostname=$(read a < ${iface}/hostname; echo $a)
echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
info "${iface} does not contain a valid iBFT configuration"
ls -l ${iface} | vinfo
fi
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
else
echo $mac > /tmp/net.${dev}.has_ibft_config
fi
done
) >> /etc/cmdline.d/40-ibft.conf
# reread cmdline
unset CMDLINE
}
parse_iscsi_root()
@@ -168,66 +294,63 @@ parse_iscsi_root()
local v
v=${1#iscsi:}
# extract authentication info
# extract authentication info
case "$v" in
*@*:*:*:*:*)
authinfo=${v%%@*}
v=${v#*@}
# allow empty authinfo to allow having an @ in iscsi_target_name like this:
# netroot=iscsi:@192.168.1.100::3260::iqn.2009-01.com.example:testdi@sk
if [ -n "$authinfo" ]; then
OLDIFS="$IFS"
IFS=:
set $authinfo
IFS="$OLDIFS"
if [ $# -gt 4 ]; then
warn "Wrong authentication info in iscsi: parameter!"
return 1
fi
iscsi_username=$1
iscsi_password=$2
if [ $# -gt 2 ]; then
iscsi_in_username=$3
iscsi_in_password=$4
fi
fi
;;
*@*:*:*:*:*)
authinfo=${v%%@*}
v=${v#*@}
# allow empty authinfo to allow having an @ in iscsi_target_name like this:
# netroot=iscsi:@192.168.1.100::3260::iqn.2009-01.com.example:testdi@sk
if [ -n "$authinfo" ]; then
OLDIFS="$IFS"
IFS=:
set $authinfo
IFS="$OLDIFS"
if [ $# -gt 4 ]; then
warn "Wrong authentication info in iscsi: parameter!"
return 1
fi
iscsi_username=$1
iscsi_password=$2
if [ $# -gt 2 ]; then
iscsi_in_username=$3
iscsi_in_password=$4
fi
fi
;;
esac
# extract target ip
# extract target ip
case "$v" in
[[]*[]]:*)
iscsi_target_ip=${v#[[]}
iscsi_target_ip=${iscsi_target_ip%%[]]*}
v=${v#[[]$iscsi_target_ip[]]:}
;;
*)
iscsi_target_ip=${v%%[:]*}
v=${v#$iscsi_target_ip:}
;;
[[]*[]]:*)
iscsi_target_ip=${v#[[]}
iscsi_target_ip=${iscsi_target_ip%%[]]*}
v=${v#[[]$iscsi_target_ip[]]:}
;;
*)
iscsi_target_ip=${v%%[:]*}
v=${v#$iscsi_target_ip:}
;;
esac
# extract target name
unset iscsi_target_name
# extract target name
case "$v" in
*:iqn.*)
iscsi_target_name=iqn.${v##*:iqn.}
v=${v%:iqn.*}:
;;
*:eui.*)
iscsi_target_name=iqn.${v##*:eui.}
v=${v%:iqn.*}:
;;
*:naa.*)
iscsi_target_name=iqn.${v##*:naa.}
v=${v%:iqn.*}:
;;
*)
warn "Invalid iscii target name, should begin with 'iqn.' or 'eui.' or 'naa.'"
return 1
;;
*:iqn.*)
iscsi_target_name=iqn.${v##*:iqn.}
v=${v%:iqn.*}:
;;
*:eui.*)
iscsi_target_name=eui.${v##*:eui.}
v=${v%:eui.*}:
;;
*:naa.*)
iscsi_target_name=naa.${v##*:naa.}
v=${v%:naa.*}:
;;
esac
# parse the rest
# parse the rest
OLDIFS="$IFS"
IFS=:
set $v
@@ -235,17 +358,34 @@ parse_iscsi_root()
iscsi_protocol=$1; shift # ignored
iscsi_target_port=$1; shift
if [ $# -eq 3 ]; then
iscsi_iface_name=$1; shift
if [ -n "$iscsi_target_name" ]; then
if [ $# -eq 3 ]; then
iscsi_iface_name=$1; shift
fi
if [ $# -eq 2 ]; then
iscsi_netdev_name=$1; shift
fi
iscsi_lun=$1; shift
if [ $# -ne 0 ]; then
warn "Invalid parameter in iscsi: parameter!"
return 1
fi
return 0
fi
if [ $# -eq 2 ]; then
iscsi_netdev_name=$1; shift
if [ $# -gt 3 ] && [ -n "$1$2" ]; then
if [ -z "$3" ] || [ "$3" -ge 0 ] 2>/dev/null ; then
iscsi_iface_name=$1; shift
iscsi_netdev_name=$1; shift
fi
fi
iscsi_lun=$1; shift
if [ $# -ne 0 ]; then
warn "Invalid parameter in iscsi: parameter!"
return 1
fi
iscsi_target_name=$(printf "%s:" "$@")
iscsi_target_name=${iscsi_target_name%:}
}
ip_to_var() {
@@ -265,16 +405,35 @@ ip_to_var() {
fi
done
unset ip srv gw mask hostname dev autoconf macaddr mtu
unset ip srv gw mask hostname dev autoconf macaddr mtu dns1 dns2
case $# in
0) autoconf="error" ;;
1) autoconf=$1 ;;
2) dev=$1; autoconf=$2 ;;
3) dev=$1; autoconf=$2; mtu=$3 ;;
4) dev=$1; autoconf=$2; mtu=$3; macaddr=$4 ;;
*) ip=$1; srv=$2; gw=$3; mask=$4; hostname=$5; dev=$6; autoconf=$7; mtu=$8; macaddr=$9 ;;
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
# anaconda-style argument cluster
# ip=<ipv4-address> means anaconda-style static config argument cluster:
# ip=<ip> gateway=<gw> netmask=<nm> hostname=<host> mtu=<mtu>
# ksdevice={link|bootif|ibft|<MAC>|<ifname>}
if strstr "$autoconf" "*.*.*.*"; then
ip="$autoconf"
gw=$(getarg gateway=)
@@ -283,13 +442,43 @@ ip_to_var() {
dev=$(getarg ksdevice=)
autoconf="none"
mtu=$(getarg mtu=)
# handle special values for ksdevice
case "$dev" in
# ignore fancy values for ksdevice=XXX
link|bootif|BOOTIF|ibft|*:*:*:*:*:*) dev="" ;;
bootif|BOOTIF) dev=$(fix_bootif $(getarg BOOTIF=)) ;;
link) dev="" ;; # FIXME: do something useful with this
ibft) dev="" ;; # ignore - ibft is handled elsewhere
esac
fi
}
route_to_var() {
local v=${1}:
local i
set --
while [ -n "$v" ]; do
if [ "${v#\[*:*:*\]:}" != "$v" ]; then
# handle IPv6 address
i="${v%%\]:*}"
i="${i##\[}"
set -- "$@" "$i"
v=${v#\[$i\]:}
else
set -- "$@" "${v%%:*}"
v=${v#*:}
fi
done
unset route_mask route_gw route_dev
case $# in
2) [ -n "$1" ] && route_mask="$1"; [ -n "$2" ] && route_gw="$2"
return 0;;
3) [ -n "$1" ] && route_mask="$1"; [ -n "$2" ] && route_gw="$2"; [ -n "$3" ] && route_dev="$3"
return 0;;
*) return 1;;
esac
}
parse_ifname_opts() {
local IFS=:
set $1
@@ -315,3 +504,228 @@ parse_ifname_opts() {
esac
}
# some network driver need long time to initialize, wait before it's ready.
wait_for_if_link() {
local cnt=0
local li
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
cnt=$(($cnt+1))
done
return 1
}
wait_for_if_up() {
local cnt=0
local li
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)
if ! strstr "$li" "NO-CARRIER"; then
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
fi
sleep 0.1
cnt=$(($cnt+1))
done
return 1
}
wait_for_route_ok() {
local cnt=0
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
cnt=$(($cnt+1))
done
return 1
}
wait_for_ipv6_dad() {
local cnt=0
local li
local timeout="$(getargs rd.net.timeout.ipv6dad=)"
timeout=${timeout:-50}
timeout=$(($timeout*10))
while [ $cnt -lt $timeout ]; do
li=$(ip -6 addr show dev $1 scope link)
strstr "$li" "tentative" || return 0
sleep 0.1
cnt=$(($cnt+1))
done
return 1
}
wait_for_ipv6_auto() {
local cnt=0
local li
local timeout="$(getargs rd.net.timeout.ipv6auto=)"
timeout=${timeout:-40}
timeout=$(($timeout*10))
while [ $cnt -lt $timeout ]; do
li=$(ip -6 addr show dev $1)
if ! strstr "$li" "tentative"; then
strstr "$li" "dynamic" && return 0
fi
sleep 0.1
cnt=$(($cnt+1))
done
return 1
}
linkup() {
wait_for_if_link $1 2>/dev/null\
&& ip link set $1 up 2>/dev/null\
&& wait_for_if_up $1 2>/dev/null
}
type hostname >/dev/null 2>&1 || \
hostname() {
cat /proc/sys/kernel/hostname
}
iface_has_link() {
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:-5}
timeout=$(($timeout*10))
linkup "$1"
while [ $cnt -lt $timeout ]; do
[ "$(cat $interface/carrier)" = 1 ] && return 0
sleep 0.1
cnt=$(($cnt+1))
done
return 1
}
find_iface_with_link() {
local iface_path="" iface=""
for iface_path in /sys/class/net/*; do
iface=${iface_path##*/}
str_starts "$iface" "lo" && continue
if iface_has_link $iface; then
echo "$iface"
return 0
fi
done
return 1
}
is_persistent_ethernet_name() {
local _netif="$1"
local _name_assign_type="0"
[ -f "/sys/class/net/$_netif/name_assign_type" ] \
&& _name_assign_type=$(cat "/sys/class/net/$_netif/name_assign_type")
# NET_NAME_ENUM 1
[ "$_name_assign_type" = "1" ] && return 1
# NET_NAME_PREDICTABLE 2
[ "$_name_assign_type" = "2" ] && return 0
case "$_netif" in
# udev persistent interface names
eno[0-9]|eno[0-9][0-9]|eno[0-9][0-9][0-9]*)
;;
ens[0-9]|ens[0-9][0-9]|ens[0-9][0-9][0-9]*)
;;
enp[0-9]s[0-9]*|enp[0-9][0-9]s[0-9]*|enp[0-9][0-9][0-9]*s[0-9]*)
;;
enP*p[0-9]s[0-9]*|enP*p[0-9][0-9]s[0-9]*|enP*p[0-9][0-9][0-9]*s[0-9]*)
;;
# biosdevname
em[0-9]|em[0-9][0-9]|em[0-9][0-9][0-9]*)
;;
p[0-9]p[0-9]*|p[0-9][0-9]p[0-9]*|p[0-9][0-9][0-9]*p[0-9]*)
;;
*)
return 1
esac
return 0
}
is_kernel_ethernet_name() {
local _netif="$1"
local _name_assign_type="1"
if [ -e "/sys/class/net/$_netif/name_assign_type" ]; then
_name_assign_type=$(cat "/sys/class/net/$_netif/name_assign_type")
case "$_name_assign_type" in
2|3|4)
# NET_NAME_PREDICTABLE 2
# NET_NAME_USER 3
# NET_NAME_RENAMED 4
return 1
;;
1|*)
# NET_NAME_ENUM 1
return 0
;;
esac
fi
# fallback to error prone manual name check
case "$_netif" in
eth[0-9]|eth[0-9][0-9]|eth[0-9][0-9][0-9]*)
return 0
;;
*)
return 1
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

@@ -14,19 +14,33 @@ 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
netif=$1
[ -e "/tmp/net.bootdev" ] && read netif < /tmp/net.bootdev
case "$netif" in
??:??:??:??:??:??) # MAC address
for i in /sys/class/net/*/address; do
mac=$(cat $i)
if [ "$mac" = "$netif" ]; then
i=${i%/address}
netif=${i##*/}
break
fi
done
esac
# Figure out the handler for root=dhcp by recalling all netroot cmdline
# handlers when this is not called from manually network bringing up.
if [ -z "$2" ]; then
if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
# Unset root so we can check later
unset root
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
@@ -38,10 +52,13 @@ 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
# FIXME!
unset rootok
for f in $hookdir/cmdline/90*.sh; do
[ -f "$f" ] && . "$f";
done
@@ -66,8 +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
# 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

@@ -54,8 +54,8 @@ if getarg bond >/dev/null; then
fi
# Make it suitable for initscripts export
bondoptions=$(str_replace "$bondoptions" ";" ",")
echo "bondname=$bondname" > /tmp/bond.info
echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.info
echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.info
echo "bondname=$bondname" > /tmp/bond.${bondname}.info
echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.${bondname}.info
echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.${bondname}.info
return
fi

View File

@@ -3,9 +3,9 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Format:
# bridge=<bridgename>:<ethnames>
# bridge=<bridgename>:<bridgeslaves>
#
# <ethnames> is a comma-separated list of physical (ethernet) interfaces
# <bridgeslaves> is a comma-separated list of physical (ethernet) interfaces
# bridge without parameters assumes bridge=br0:eth0
#
@@ -25,26 +25,20 @@ parsebridge() {
v=${v#*:}
done
unset bridgename ethnames
unset bridgename bridgeslaves
case $# in
0) bridgename=br0; ethnames=$iface ;;
0) bridgename=br0; bridgeslaves=$iface ;;
1) die "bridge= requires two parameters" ;;
2) bridgename=$1; ethnames=$(str_replace "$2" "," " ") ;;
2) bridgename=$1; bridgeslaves=$(str_replace "$2" "," " ") ;;
*) die "bridge= requires two parameters" ;;
esac
}
unset bridgename ethnames
unset bridgename bridgeslaves
iface=eth0
if [ -e /tmp/bond.info ]; then
. /tmp/bond.info
if [ -n "$bondname" ] ; then
iface=$bondname
fi
fi
# Parse bridge for bridgename and ethnames
# Parse bridge for bridgename and bridgeslaves
if bridge="$(getarg bridge)"; then
# Read bridge= parameters if they exist
if [ -n "$bridge" ]; then
@@ -53,9 +47,9 @@ if bridge="$(getarg bridge)"; then
# Simple default bridge
if [ -z "$bridgename" ]; then
bridgename=br0
ethnames=$iface
bridgeslaves=$iface
fi
echo "bridgename=$bridgename" > /tmp/bridge.info
echo "ethnames=\"$ethnames\"" >> /tmp/bridge.info
echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.info
return
fi

View File

@@ -0,0 +1,12 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
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

@@ -15,16 +15,8 @@
#
command -v getarg >/dev/null || . /lib/dracut-lib.sh
command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh
# Don't mix BOOTIF=macaddr from pxelinux and ip= lines
getarg ip= >/dev/null && getarg BOOTIF= >/dev/null && \
die "Mixing BOOTIF and ip= lines is dangerous"
# No more parsing stuff, BOOTIF says everything
[ -n "$(getarg BOOTIF)" ] && return
if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] ; then
if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] && [ -z "$(getarg BOOTIF=)" ]; then
# No ip= argument(s) for netroot provided, defaulting to DHCP
return;
fi
@@ -33,6 +25,10 @@ fi
if [ -z "$NEEDBOOTDEV" ] ; then
count=0
for p in $(getargs ip=); do
case "$p" in
ibft)
continue;;
esac
count=$(( $count + 1 ))
done
[ $count -gt 1 ] && NEEDBOOTDEV=1
@@ -40,19 +36,25 @@ fi
unset count
# If needed, check if bootdev= contains anything usable
if [ -n "$NEEDBOOTDEV" ] ; then
BOOTDEV=$(getarg bootdev=) || die "Please supply bootdev argument for multiple ip= lines"
[ -z "$BOOTDEV" ] && die "Bootdev argument is empty"
fi
BOOTDEV=$(getarg bootdev=)
# If ibft is requested, read ibft vals and write ip=XXX cmdline args
[ "ibft" = "$(getarg ip=)" ] && ibft_to_cmdline
if [ -n "$NEEDBOOTDEV" ] && getargbool 1 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"
fi
# Check ip= lines
# XXX Would be nice if we could errorcheck ip addresses here as well
for p in $(getargs ip=); do
ip_to_var $p
# make first device specified the BOOTDEV
if [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then
BOOTDEV="$dev"
[ -n "$NEEDBOOTDEV" ] && info "Setting bootdev to '$BOOTDEV'"
fi
# skip ibft since we did it above
[ "$autoconf" = "ibft" ] && continue
@@ -66,24 +68,26 @@ for p in $(getargs ip=); do
fi
# Error checking for autoconf in combination with other values
case $autoconf in
error) die "Error parsing option 'ip=$p'";;
bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";;
none|off)
[ -z "$ip" ] && \
die "For argument 'ip=$p'\nValue '$autoconf' without static configuration does not make sense"
[ -z "$mask" ] && \
die "Sorry, automatic calculation of netmask is not yet supported"
;;
auto6);;
dhcp|dhcp6|on|any) \
[ -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 '$autoconf'"
;;
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoconf'";;
esac
for autoopt in $(str_replace "$autoconf" "," " "); do
case $autoopt in
error) die "Error parsing option 'ip=$p'";;
bootp|rarp|both) die "Sorry, ip=$autoopt is currenty unsupported";;
none|off)
[ -z "$ip" ] && \
die "For argument 'ip=$p'\nValue '$autoopt' without static configuration does not make sense"
[ -z "$mask" ] && \
die "Sorry, automatic calculation of netmask is not yet supported"
;;
auto6);;
dhcp|dhcp6|on|any) \
[ -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'"
;;
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoopt'";;
esac
done
if [ -n "$dev" ] ; then
# We don't like duplicate device configs
@@ -96,9 +100,6 @@ for p in $(getargs ip=); do
IFACES="$IFACES $dev"
fi
# Small optimization for udev rules
[ -z "$NEEDBOOTDEV" ] && [ -n "$dev" ] && BOOTDEV=$dev
# Do we need to check for specific options?
if [ -n "$NEEDDHCP" ] || [ -n "$DHCPORSERVER" ] ; then
# Correct device? (Empty is ok as well)
@@ -112,8 +113,24 @@ 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
if getargbool 1 "rd.bootif" && BOOTIF="$(getarg BOOTIF=)"; then
BOOTDEV=$(fix_bootif $BOOTIF)
IFACES="$BOOTDEV $IFACES"
fi
# This ensures that BOOTDEV is always first in IFACES
if [ -n "$BOOTDEV" ] && [ -n "$IFACES" ] ; then
IFACES="${IFACES%$BOOTDEV*} ${IFACES#*$BOOTDEV}"
@@ -123,6 +140,3 @@ fi
# Store BOOTDEV and IFACES for later use
[ -n "$BOOTDEV" ] && echo $BOOTDEV > /tmp/net.bootdev
[ -n "$IFACES" ] && echo $IFACES > /tmp/net.ifaces
# We need a ip= line for the configured bootdev=
[ -n "$NEEDBOOTDEV" ] && [ -z "$BOOTDEVOK" ] && die "Bootdev Argument '$BOOTDEV' not found"

View File

@@ -0,0 +1,54 @@
#!/bin/sh
#
# Format:
# team=<teammaster>:<teamslaves>
#
# 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 --
while [ -n "$v" ]; do
set -- "$@" "${v%%:*}"
v=${v#*:}
done
unset teammaster teamslaves
case $# in
2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;;
*) warn "team= requires two parameters"; return 1;;
esac
return 0
}
unset teammaster teamslaves
if getarg team>/dev/null; then
# Read team= parameters if they exist
for team in $(getargs team); do
[ "$team" = "team" ] && continue
unset teammaster
unset teamslaves
parseteam "$team" || continue
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
done
fi

0
modules.d/40network/parse-vlan.sh Normal file → Executable file
View File

View File

@@ -3,10 +3,12 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
[[ -d /etc/sysconfig/network-scripts ]] && return 0
return 255
}
depends() {
echo "network"
return 0
}

View File

@@ -3,20 +3,18 @@
# 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
# Don't write anything if we don't know our bootdev
[ -f /tmp/net.ifaces ] || return 1
read IFACES < /tmp/net.ifaces
if [ -e /tmp/bond.info ]; then
. /tmp/bond.info
fi
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/
@@ -59,9 +57,9 @@ print_s390() {
SUBCHANNELS=${SUBCHANNELS%,}
echo "SUBCHANNELS=\"${SUBCHANNELS}\""
CONFIG_LINE=$(get_config_line_by_subchannel $SUBCHANNELS)
[ $? -ne 0 -o -z "$CONFIG_LINE" ] && return
CONFIG_LINE=$(get_config_line_by_subchannel $SUBCHANNELS)
[ $? -ne 0 -o -z "$CONFIG_LINE" ] && return 0
OLD_IFS=$IFS
IFS=","
@@ -81,69 +79,148 @@ print_s390() {
OPTIONS=${OPTIONS## }
echo "NETTYPE=\"${NETTYPE}\""
echo "OPTIONS=\"${OPTIONS}\""
return 0
}
hw_bind() {
local _netif="$1"
local _macaddr="$2"
for netif in $IFACES ; do
# bridge?
[ -n "$_macaddr" ] \
&& echo "MACADDR=\"$_macaddr\""
print_s390 "$_netif" \
&& return 0
[ -n "$_macaddr" ] && return 0
is_persistent_ethernet_name "$_netif" && return 0
[ -f "/sys/class/net/$_netif/addr_assign_type" ] \
&& [ "$(cat "/sys/class/net/$_netif/addr_assign_type")" != "0" ] \
&& return 1
[ -f "/sys/class/net/$_netif/address" ] \
|| return 1
echo "HWADDR=\"$(cat /sys/class/net/$_netif/address)\""
}
interface_bind() {
local _netif="$1"
local _macaddr="$2"
# see, if we can bind it to some hw parms
if hw_bind "$_netif" "$_macaddr"; then
# only print out DEVICE, if it's user assigned
is_kernel_ethernet_name "$_netif" && return 0
fi
echo "DEVICE=\"$_netif\""
}
for netup in /tmp/net.*.did-setup ; do
[ -f $netup ] || continue
netif=${netup%%.did-setup}
netif=${netif##*/net.}
strstr "$netif" ":*:*:*:*:" && continue
[ -e /tmp/ifcfg/ifcfg-$netif ] && continue
unset bridge
unset bond
unset team
unset bondslaves
unset bondname
unset bondoptions
unset uuid
unset ip
unset gw
unset mtu
unset mask
unset macaddr
unset slave
unset ethname
unset vlan
[ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info
[ -e /tmp/team.${netif}.info ] && . /tmp/team.${netif}.info
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
bond=yes
fi
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
if [ "$netif" = "$vlanname" ]; then
vlan=yes
fi
# skip team interfaces for now, the host config must be in sync
[ "$netif" = "$teammaster" ] && continue
{
echo "# Generated by dracut initrd"
echo "DEVICE=$netif"
echo "NAME=\"$netif\""
[ -z "$vlan" ] && interface_bind "$netif" "$macaddr"
echo "ONBOOT=yes"
echo "NETBOOT=yes"
echo "UUID=$uuid"
[ -n "$mtu" ] && echo "MTU=$mtu"
if [ -f /tmp/net.$netif.lease ]; then
strstr "$ip" '*:*:*' &&
echo "DHCPV6C=yes"
echo "BOOTPROTO=dhcp"
cp /tmp/net.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease
echo "UUID=\"$uuid\""
strstr "$(ip -6 addr show dev $netif)" 'inet6' && echo "IPV6INIT=yes"
if [ -f /tmp/dhclient.$netif.lease ]; then
[ -f /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
if [ -f /tmp/net.$netif.has_ibft_config ]; then
echo "BOOTPROTO=ibft"
else
echo "BOOTPROTO=dhcp"
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 strstr "$ip" '*:*:*'; then
echo "IPV6INIT=yes"
echo "IPV6_AUTOCONF=no"
echo "IPV6ADDR=$ip/$mask"
echo "IPV6ADDR=\"$ip/$mask\""
else
echo "BOOTPROTO=none"
echo "IPADDR=$ip"
if strstr "$mask" "."; then
echo "NETMASK=$mask"
if [ -f /tmp/net.$netif.has_ibft_config ]; then
echo "BOOTPROTO=ibft"
else
echo "PREFIX=$mask"
echo "BOOTPROTO=none"
echo "IPADDR=\"$ip\""
if strstr "$mask" "."; then
echo "NETMASK=\"$mask\""
else
echo "PREFIX=\"$mask\""
fi
fi
fi
if strstr "$gw" '*:*:*'; then
echo "IPV6_DEFAULTGW=$gw"
echo "IPV6_DEFAULTGW=\"$gw\""
elif [ -n "$gw" ]; then
echo "GATEWAY=$gw"
echo "GATEWAY=\"$gw\""
fi
fi
[ -n "$mtu" ] && echo "MTU=\"$mtu\""
} > /tmp/ifcfg/ifcfg-$netif
# bridge needs different things written to ifcfg
if [ -z "$bridge" ] && [ -z "$bond" ]; then
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ] && [ -z "$team" ]; then
# standard interface
{
if [ -n "$macaddr" ]; then
echo "MACADDR=$macaddr"
else
echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
fi
print_s390 $netif
echo "TYPE=Ethernet"
echo "NAME=\"Boot Disk\""
[ -n "$mtu" ] && echo "MTU=$mtu"
[ -n "$mtu" ] && echo "MTU=\"$mtu\""
} >> /tmp/ifcfg/ifcfg-$netif
fi
if [ -n "$vlan" ] ; then
{
echo "TYPE=Vlan"
echo "DEVICE=\"$netif\""
echo "VLAN=yes"
echo "PHYSDEV=\"$phydevice\""
} >> /tmp/ifcfg/ifcfg-$netif
fi
@@ -152,23 +229,25 @@ for netif in $IFACES ; do
{
# This variable is an indicator of a bond interface for initscripts
echo "BONDING_OPTS=\"$bondoptions\""
echo "NAME=\"Boot Disk\""
echo "NAME=\"$netif\""
echo "TYPE=Bond"
} >> /tmp/ifcfg/ifcfg-$netif
for slave in $bondslaves ; do
# Set ONBOOT=no to prevent initscripts from trying to setup already bonded physical interface
# write separate ifcfg file for the raw eth interface
{
(
echo "# Generated by dracut initrd"
echo "DEVICE=$slave"
echo "NAME=\"$slave\""
echo "TYPE=Ethernet"
echo "ONBOOT=no"
echo "ONBOOT=yes"
echo "NETBOOT=yes"
echo "HWADDR=$(cat /sys/class/net/$slave/address)"
echo "SLAVE=yes"
echo "MASTER=$netif"
echo "NAME=$slave"
} >> /tmp/ifcfg/ifcfg-$slave
echo "MASTER=\"$netif\""
echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
unset macaddr
[ -e /tmp/net.$slave.override ] && . /tmp/net.$slave.override
interface_bind "$slave" "$macaddr"
) >> /tmp/ifcfg/ifcfg-$slave
done
fi
@@ -176,54 +255,33 @@ for netif in $IFACES ; do
# bridge
{
echo "TYPE=Bridge"
echo "NAME=\"Boot Disk\""
echo "NAME=\"$netif\""
} >> /tmp/ifcfg/ifcfg-$netif
if [ "$ethname" = "$bondname" ] ; then
{
# Set ONBOOT=no to prevent initscripts from trying to setup already bridged bond interface
echo "# Generated by dracut initrd"
echo "DEVICE=$bondname"
echo "ONBOOT=no"
echo "NETBOOT=yes"
# This variable is an indicator of a bond interface for initscripts
echo "BONDING_OPTS=\"$bondoptions\""
echo "BRIDGE=$netif"
echo "NAME=\"$bondname\""
} >> /tmp/ifcfg/ifcfg-$bondname
for slave in $bondslaves ; do
# write separate ifcfg file for the raw eth interface
# Set ONBOOT=no to prevent initscripts from trying to setup already bridged physical interface
{
echo "# Generated by dracut initrd"
echo "DEVICE=$slave"
echo "TYPE=Ethernet"
echo "ONBOOT=no"
echo "NETBOOT=yes"
echo "HWADDR=$(cat /sys/class/net/$slave/address)"
echo "SLAVE=yes"
echo "MASTER=$bondname"
echo "NAME=$slave"
} >> /tmp/ifcfg/ifcfg-$slave
done
else
for slave in $bridgeslaves ; do
# write separate ifcfg file for the raw eth interface
{
(
echo "# Generated by dracut initrd"
echo "DEVICE=$ethname"
echo "NAME=\"$slave\""
echo "TYPE=Ethernet"
echo "ONBOOT=no"
echo "ONBOOT=yes"
echo "NETBOOT=yes"
echo "HWADDR=$(cat /sys/class/net/$ethname/address)"
echo "BRIDGE=$netif"
echo "NAME=$ethname"
} >> /tmp/ifcfg/ifcfg-$ethname
fi
echo "BRIDGE=\"$bridgename\""
echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
unset macaddr
[ -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
echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-$netif
i=$((i+1))
done
[ -f /tmp/net.route6."$netif" ] && cp /tmp/net.route6."$netif" /tmp/ifcfg/route6-"$netif"
[ -f /tmp/net.route."$netif" ] && cp /tmp/net.route."$netif" /tmp/ifcfg/route-"$netif"
done
# Pass network opts

View File

@@ -2,7 +2,7 @@
# module-setup for url-lib
check() {
command -v curl >/dev/null || return 1
require_binaries curl || return 1
return 255
}
@@ -12,13 +12,29 @@ depends() {
}
install() {
local _dir _crt _found _lib
inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
dracut_install curl
mkdir -m 0755 -p "$initdir/etc/ssl/certs"
if ! inst_any -t /etc/ssl/certs/ca-bundle.crt \
/etc/ssl/certs/ca-bundle.crt \
/etc/ssl/certs/ca-certificates.crt; then
dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
fi
inst_multiple curl
# also install libs for curl https
inst_libdir_file "libnsspem.so*"
inst_libdir_file "libnsssysinit.so*"
inst_libdir_file "libsoftokn3.so*"
inst_libdir_file "libsqlite3.so*"
for _dir in $libdirs; do
[[ -d $_dir ]] || continue
for _lib in $_dir/libcurl.so.*; do
[[ -e $_lib ]] || continue
_crt=$(grep -F --binary-files=text -z .crt $_lib)
[[ $_crt ]] || continue
[[ $_crt == /*/* ]] || continue
if ! inst_simple "$_crt"; then
dwarn "Couldn't install '$_crt' SSL CA cert bundle; HTTPS might not work."
continue
fi
_found=1
done
done
[[ $_found ]] || dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
}

View File

@@ -23,7 +23,7 @@ fetch_url() {
local handler="$(get_url_handler $url)"
[ -n "$handler" ] || return 254
[ -n "$url" ] || return 255
$handler "$url" "$outloc"
"$handler" "$url" "$outloc"
}
# get_url_handler URL
@@ -54,19 +54,26 @@ add_url_handler() {
export CURL_HOME="/run/initramfs/url-lib"
mkdir -p $CURL_HOME
curl_args="--location --retry 3 --fail --show-error"
curl_args="--globoff --location --retry 3 --fail --show-error"
getargbool 0 rd.noverifyssl && curl_args="$curl_args --insecure"
proxy=$(getarg proxy=)
[ -n "$proxy" ] && curl_args="$curl_args --proxy $proxy"
curl_fetch_url() {
local url="$1" outloc="$2"
echo "$url" > /proc/self/fd/0
if [ -n "$outloc" ]; then
curl $curl_args --output "$outloc" "$url" || return $?
curl $curl_args --output - -- "$url" > "$outloc" || return $?
else
local outdir="$(mkuniqdir /tmp curl_fetch_url)"
( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
outloc="$outdir/$(ls -A $outdir)"
fi
[ -f "$outloc" ] || return 253
if ! [ -f "$outloc" ]; then
warn "Downloading '$url' failed!"
return 253
fi
if [ -z "$2" ]; then echo "$outloc" ; fi
}
add_url_handler curl_fetch_url http https ftp
@@ -99,18 +106,18 @@ nfs_fetch_url() {
local filepath="${path%/*}" filename="${path##*/}" mntdir=""
# skip mount if server:/filepath is already mounted
mntdir=$(nfs_already_mounted $server $path)
mntdir=$(nfs_already_mounted "$server" "$path")
if [ -z "$mntdir" ]; then
local mntdir="$(mkuniqdir /run nfs_mnt)"
mount_nfs $nfs:$server:$filepath${options:+:$options} $mntdir
mount_nfs "$nfs:$server:$filepath${options:+:$options}" "$mntdir"
# lazy unmount during pre-pivot hook
inst_hook --hook pre-pivot --name 99url-lib-umount-nfs umount -l $mntdir
inst_hook --hook pre-pivot --name 99url-lib-umount-nfs umount -l -- "$mntdir"
fi
if [ -z "$outloc" ]; then
outloc="$mntdir/$filename"
else
cp -f "$mntdir/$filename" "$outloc" || return $?
cp -f -- "$mntdir/$filename" "$outloc" || return $?
fi
[ -f "$outloc" ] || return 253
if [ -z "$2" ]; then echo "$outloc" ; fi

65
modules.d/50drm/module-setup.sh Executable file
View File

@@ -0,0 +1,65 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
return 255
}
depends() {
return 0
}
installkernel() {
local _modname
# Include KMS capable drm drivers
drm_module_filter() {
local _drm_drivers='drm_crtc_init'
local _ret
# subfunctions inherit following FDs
local _merge=8 _side2=9
function nmf1() {
local _fname _fcont
while read _fname; do
case "$_fname" in
*.ko) _fcont="$(< $_fname)" ;;
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
*.ko.xz) _fcont="$(xz -dc $_fname)" ;;
esac
[[ $_fcont =~ $_drm_drivers
&& ! $_fcont =~ iw_handler_get_spy ]] \
&& echo "$_fname"
done
}
function rotor() {
local _f1 _f2
while read _f1; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}
fi
done | nmf1 1>&${_merge}
}
# Use two parallel streams to filter alternating modules.
set +x
eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
[[ $debug ]] && set -x
return 0
}
instmods amdkfd hyperv_fb
for _modname in $(find_kernel_modules_by_path drivers/gpu/drm \
| drm_module_filter) ; do
# if the hardware is present, include module even if it is not currently loaded,
# 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/*/modalias 2>/dev/null; then
hostonly='' instmods $_modname
continue
fi
instmods $_modname
done
}

View File

@@ -1,4 +1,4 @@
Dracut gensplash module
dracut gensplash module
-----------------------
INDEX

View File

@@ -2,7 +2,7 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if getargbool 1 rd.splash -n rd_NO_SPLASH; then
if getargbool 1 rd.splash -d -n rd_NO_SPLASH; then
info "Starting Gentoo Splash"
[ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0

View File

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

View File

@@ -4,63 +4,11 @@
check() {
[[ "$mount_needs" ]] && return 1
[[ -x /sbin/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]]
require_binaries plymouthd plymouth
}
depends() {
return 0
}
installkernel() {
local _modname
# Include KMS capable drm drivers
drm_module_filter() {
local _drm_drivers='drm_crtc_init'
local _ret
# subfunctions inherit following FDs
local _merge=8 _side2=9
function nmf1() {
local _fname _fcont
while read _fname; do
case "$_fname" in
*.ko) _fcont="$(< $_fname)" ;;
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
*.ko.xz) _fcont="$(xz -dc $_fname)" ;;
esac
[[ $_fcont =~ $_drm_drivers
&& ! $_fcont =~ iw_handler_get_spy ]] \
&& echo "$_fname"
done
}
function rotor() {
local _f1 _f2
while read _f1; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}
fi
done | nmf1 1>&${_merge}
}
# Use two parallel streams to filter alternating modules.
set +x
eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
[[ $debug ]] && set -x
return 0
}
for _modname in $(find_kernel_modules_by_path drivers/gpu/drm \
| drm_module_filter) ; do
# if the hardware is present, include module even if it is not currently loaded,
# 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/*/modalias; then
hostonly='' instmods $_modname
continue
fi
instmods $_modname
done
echo drm
}
install() {
@@ -69,16 +17,16 @@ install() {
. "$moddir"/plymouth-populate-initrd.sh
else
PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
/usr/libexec/plymouth/plymouth-populate-initrd -t $initdir
/usr/libexec/plymouth/plymouth-populate-initrd -t "$initdir"
fi
inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
dracut_install readlink
if [[ -x $systemdutildir/systemd ]]; then
dracut_install -o $systemdsystemunitdir/plymouth-quit-wait.service
inst_multiple readlink
if ! dracut_module_included "systemd"; then
inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
fi
}

View File

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

View File

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

View File

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

View File

@@ -2,8 +2,8 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if [ -x /bin/plymouthd ]; then
if getargbool 1 plymouth.enable && getargbool 1 rd.plymouth -n rd_NO_PLYMOUTH; then
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
# first trigger graphics subsystem
udevadm trigger --action=add --attr-match=class=0x030000 >/dev/null 2>&1
# first trigger graphics and tty subsystem
@@ -16,8 +16,8 @@ if [ -x /bin/plymouthd ]; then
read consoledev rest < /sys/class/tty/console/active
consoledev=${consoledev:-tty0}
[ -x /lib/udev/console_init -a -e "/dev/$consoledev" ] && /lib/udev/console_init "/dev/$consoledev"
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session --pid-file /run/plymouth/pid
/bin/plymouth --show-splash 2>&1 | vinfo
plymouthd --attach-to-session --pid-file /run/plymouth/pid
plymouth --show-splash 2>&1 | vinfo
# reset tty after plymouth messed with it
[ -x /lib/udev/console_init -a -e "/dev/$consoledev" ] && /lib/udev/console_init "/dev/$consoledev"
fi

View File

@@ -9,6 +9,7 @@ mkdir -m 0755 -p /run/initramfs/state/etc/sysconfig/network-scripts
function cms_write_config()
{
. /tmp/cms.conf
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
OLDIFS=$IFS
IFS=,
read -a subch_array <<< "indexzero,$SUBCHANNELS"
@@ -32,6 +33,7 @@ function cms_write_config()
cat > /etc/sysconfig/network << EOF
HOSTNAME=$HOSTNAME
EOF
echo "$HOSTNAME" > /etc/hostname
if [ "$ipv6" ]; then
echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network
else

View File

@@ -27,15 +27,14 @@ else
fi
{
echo "ip=$IPADDR::$GATEWAY:$NETMASK:$HOSTNAME:$DEVICE:none:$MACADDR"
echo "ip=$IPADDR::$GATEWAY:$NETMASK:$HOSTNAME:$DEVICE:none:$MTU:$MACADDR"
for i in $DNS1 $DNS2; do
echo "nameserver=$i"
done
} > /etc/cmdline.d/80-cms.conf
unset CMDLINE
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
IFACES="$IFACES $DEVICE"
echo "$IFACES" >> /tmp/net.ifaces
ifup $DEVICE -m
exec ifup "$DEVICE"

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