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
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>
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
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>
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>
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.
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').
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>
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.
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".
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