Commit Graph

130 Commits (ace51ef520090e214bac2f6d98f772da0e36376a)

Author SHA1 Message Date
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
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
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 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 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
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 5a84ac3fe3 dracut-functions.sh: inst_hook() with [0-9]-<name> 2012-07-30 17:08:51 +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
Harald Hoyer cc21808764 dracut-functions.sh:inst_rule_programs() fix error messages 2012-07-26 19:35:12 +02:00
Harald Hoyer 65d1a8a4ae dracut-functions.sh:inst_rule_programs() fixed IMPORT{program} 2012-07-26 19:12:40 +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
Harald Hoyer ec5e5ae27a dracut-functions.sh: corrected usage comment of find_mp_fstype() 2012-07-26 17:05:24 +02:00
Harald Hoyer 81672479af dracut-functions.sh: add find_mp_fstype() 2012-07-26 17:00:07 +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 52f74c8010 dracut-functions.sh: fixed host-only kernel module bug 2012-07-20 13:10:58 +02:00
Harald Hoyer 258de82819 dracut-functions.sh: set LC_MESSAGES=C not LC_ALL 2012-07-19 13:35:50 +02:00
Harald Hoyer 0f283709c9 dracut-functions.sh: output more info, if dependency modules are omitted 2012-07-16 12:21:56 +02:00
Harald Hoyer 593b315c70 dracut-functions.sh: bail out, if $initdir is not set 2012-07-09 10:02:04 +02:00
Harald Hoyer 338b43cd6a fips: add instmods silent check mode "-c -s" 2012-07-05 11:15:42 +02:00
Harald Hoyer 194b80f974 dracut-functions.sh:find_kernel_modules_by_path() fixed hostonly part
filter /sys/module/* modules by path
2012-07-02 22:51:24 +02:00
Harald Hoyer ec61f0a3af dracut-functions.sh: forgot --set-version $kernel for modprobe 2012-07-02 22:14:49 +02:00
Harald Hoyer eaa924b69e dracut-functions.sh: create $initdir, if it does not exist 2012-07-02 18:52:49 +02:00
Harald Hoyer 73575f11a9 dracut-functions.sh,dracut.sh: use xargs with "-r" 2012-07-02 18:52:49 +02:00
Harald Hoyer 0e95d84892 dracut-functions.sh: set LC_ALL=C to get correct parsing information 2012-07-02 18:52:49 +02:00
Harald Hoyer f4031e8a9a move dracut-install to dracutbasedir
We do not want to install dracut-install to /usr/bin until all
interfaces are set to stone and the manpage is written. Until then the
tool is dracut internal.
2012-07-02 18:52:49 +02:00
Harald Hoyer 89d44e720b Use /usr/bin/dracut-install if available
/usr/bin/dracut-install greatly improves initramfs creation speed
2012-06-29 12:54:38 +02:00
Harald Hoyer 7224913d16 dracut-functions.sh: grep for "--relative" for the ln_r() check 2012-06-29 12:54:38 +02:00
Harald Hoyer 70c6b773ca dracut.sh, dracut-functions.sh: add dracut_kernel_post()
dracut_kernel_post() does lazy kernel module dependency installation,
depmod and cleans up temporary files
2012-06-29 12:41:28 +02:00
Harald Hoyer ec1aa3bc48 dracut-functions.sh: error out, if $initdir is not set 2012-06-29 12:41:27 +02:00
Harald Hoyer 92f26b6202 dracut-functions: inst(),inst_binary() fixed inst_symlink call 2012-06-29 12:41:27 +02:00
Harald Hoyer 0c6565c810 dracut-functions.sh:inst_libdir_files() combine installs
first, search for all files, then call dracut_install only once
2012-06-29 12:41:27 +02:00
Harald Hoyer d8aeb3a72a dracut.sh, dracut-functions.sh: do lazy kernel module dep resolving
First, we just install the kernel module and keep track, what we
installed. At the very end, call modprobe and modinfo for firmwares to
resolve all kernel module dependencies. This speeds up image creation,
because we can call modprobe and modinfo with many modules.
2012-06-29 12:41:27 +02:00
Harald Hoyer 744054779f dracut-functions.sh:find_kernel_modules_by_path() use IFS=:
For modules.dep use simpler IFS=: to read the file.
2012-06-29 12:41:25 +02:00
Harald Hoyer b19c5d51f8 dracut-functions.sh:inst_decompress() simplify function 2012-06-29 12:41:25 +02:00
Harald Hoyer 22048b44db dracut-functions.sh:inst_simple() do inst_symlink for symlinks 2012-06-29 12:41:25 +02:00
Harald Hoyer d5b5bb3103 dracut-functions.sh: cp with --reflink=auto and --sparse=auto
cp will use COW data copy most of the time. So, it's even better than
hardlink, because we don't have to care about hardlinks, when modifying
files in post.
2012-06-29 12:41:25 +02:00
Harald Hoyer f8be752874 dracut-functions.sh: mksubdirs(): check for dir existence first 2012-06-29 12:41:25 +02:00
Harald Hoyer 520047c3c4 dracut-functions.sh: replace strstr()
the new strstr() is faster, when compared
2012-06-29 12:41:25 +02:00
Harald Hoyer a20d24ded2 dracut-functions.sh: use "ln -r" instead of shell functions 2012-06-21 01:57:11 +02:00
Harald Hoyer 8d95b8b338 Set some global variables in dracut-functions.sh 2012-06-18 13:26:37 +02:00
Harald Hoyer 7abd426438 fixed instmods() return code and set pipefail globally 2012-06-18 13:26:01 +02:00
Harald Hoyer 7828692f97 dracut-functions.sh: fixup inst_libdir_file() again 2012-06-15 09:34:00 +02:00
Thomas Lange cacaa90c63 Debian multiarch support
Hi Jon,

here's the diff which works for me.  The quotation marks around $@ do
not work for me. Instead of "$@" I must to use $_dir/$@ (or
"$_dir"/$@) but no quotation marks around $@. Could you please review
my patch.
2012-06-15 09:20:01 +02:00
Harald Hoyer fe1484f3db modules are now only handled with /sys/modules and modules.dep
No more "find" and /proc/modules checking. We now rely entirely on
depmod and modules.dep
2012-06-06 18:20:35 +02:00
Harald Hoyer d161561290 make udevdir systemdutildir systemdsystemunitdir global vars
your distribution should ship those settings in
/etc/dracut.conf.d/01-distro.conf

see dracut.conf.d/fedora.conf.example
2012-06-06 15:16:00 +02:00
Juan RP 2cf4f4fb74 Avoid annonying warnings when pkg-config is not installed. 2012-06-06 15:02:00 +02:00
Harald Hoyer 604d1eb21a use pkg-config to determine the udev directory 2012-06-04 12:58:42 +02:00
Cong Wang a6d3be9dd5 check kernel module existance
This patch adds check of kernel module existance and
propagate errors to upper callers.

In case of break other callers of instmods(), this patch
adds an option '-c' to it, only when "-c" is specified
we fail, otherwise, errors are ignored.

Reported-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Harald Hoyer <harald@redhat.com>
2012-05-16 11:43:25 +02:00
Harald Hoyer cce69be668 removed old udev "vol_id" 2012-05-07 16:27:48 +02:00
Harald Hoyer eef7649e71 merge "cleanup" and "pre-pivot-cleanup" hooks 2012-04-23 11:32:45 +02:00
Dave Young 2e7257a2e3 add pre-pivot-cleanup hook
Sometimes some hook script will need to be before the cleanup hook scripts
For example dhclient killing, nfs cleanup, etc. must not happen before kdump
because it will use their fuctionalities.

So here introduce a new hook pre-pivot-cleanup, all cleanup scripts will go there.
that means pre-pivot hook is splited to two hooks pre-pivot and pre-pivot-cleanup

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-04-19 11:59:45 +02:00
Jon Ander Hernandez c9143a63fe Debian multiarch support
Another solution could be searching in directories found at
/etc/ld.so.conf.d/*.conf or adding a new parameter. Here is a patch
which adds a new --libdirs parameter, and also a new inst_libdir_file
function which will try to expand metacharacters on each lib
directory:

    inst_libdir_file "libdevmapper-event-lvm*.so"
2012-04-16 14:46:53 +02:00
Harald Hoyer 0e979d4829 dracut-functions.sh:get_fs_env() bail out early
if udevadm found information about a device (DEVPATH set), then bail out
early, if ID_FS_TYPE was not set.
2012-03-30 10:47:35 +02:00
Harald Hoyer 66b750a08e dracut-functions.sh: fix get_fs_env() 2012-03-29 15:20:41 +02:00
Harald Hoyer a5cde2dd18 dracut-functions.sh: removed get_fs_uuid() and get_fs_type()
get_fs_uuid() and get_fs_type() are not used anymore
2012-03-29 14:56:46 +02:00
Harald Hoyer 2f6fe2ec79 dracut-functions.sh: no '' for shell regex 2012-03-29 14:38:45 +02:00
Harald Hoyer e03c77cb5b dracut-functions.sh: proper return get_fs_env() and get_fs_type() 2012-03-29 14:37:41 +02:00
Harald Hoyer 85f8bb16b2 dracut-functions.sh: skip comment lines in fstab 2012-03-28 11:09:46 +02:00
Amadeusz Żołnowski e7da9734d8 inst_symlink: create parent dir if doesn't exist
If symlink is yet alone in target directory, inst_symlink will fail to
create it.  This is how to reproduce the bug:

 # mkdir /tmp/test
 # ln -s /bin/cp /tmp/test/cp
 # ./dracut -l -f -H /tmp/test.img -I /tmp/test/cp

Result:

[...]

I: *** Including modules done ***
ln: failed to create symbolic link
`/var/tmp/initramfs.Z5isVu//tmp/test/cp': No such file or directory
ln: failed to create symbolic link
`/var/tmp/initramfs.Z5isVu//tmp/test/cp': No such file or directory
I: Wrote /tmp/test.img:

[...]

Following patch creates directory for the symlink if it doesn't exist.
2012-03-26 13:20:29 +02:00
Will Woods 6e3cc00f48 add initqueue --env and "online" hook
The "online" hook runs whenever a network interface comes online (that
is, once it's actually up and configured).

The initqueue --env argument is used to set "$netif" to the name of the
newly-online network interface.
2012-03-08 11:05:29 +01:00
Harald Hoyer 4fed3ddf16 add "initqueue/*" to hookdirs and create them in dracut itsself
now we can just use
    inst_hook initqueue/settled 99 "$moddir/pollcdrom.sh"
2012-03-08 11:00:29 +01:00
Harald Hoyer 6a2c23d125 dracut-functions.sh: check for .kernelmodseen dir, before using it 2012-03-08 11:00:29 +01:00
Harald Hoyer e12c1a8da1 dracut-functions.sh:install_kmod_with_fw() delay .kernelmodseen
first check for omit, then mark the kernel module as seen

when we temporarily omit_drivers, we don't want to mark them as seen.

example: nfs.ko module in kernel-modules, but the nfs module
should be able to load it later on.
2012-03-01 17:45:30 +01:00
Harald Hoyer 379c34d2cf dracut.sh/dracut-functions.sh: use a marker-dir for kernel modules
use "$initdir/.kernelmodseen" to mark kernel modules, which we already
handled with install_kmod_with_fw()
2012-02-25 17:09:15 +01:00
Harald Hoyer 334cc28327 dracut-functions.sh: instmods() print only filename instead of fullpath
do not print the full path, when we use "find" for kernel modules, but
rather only the filename.
2012-02-25 17:09:14 +01:00
Harald Hoyer edea870c3c dracut-functions.sh: instmods() removed special case for "=ata" 2012-02-25 17:09:14 +01:00
Harald Hoyer 86191581d1 dracut-functions.sh: instmods(): replace egrep with shell code 2012-02-25 17:09:14 +01:00
Harald Hoyer 07f3e4f168 dracut-functions.sh: get_fs_env() replaced egrep with shell 2012-02-25 17:09:14 +01:00
Harald Hoyer d18bc9070d dracut-functions.sh: optimize ldd 2012-02-24 14:59:18 +01:00
Harald Hoyer 86bf239ede dracut-functions.sh: only call ldd in find_binary() for "*.so*" 2012-02-24 14:59:18 +01:00
Harald Hoyer 3249c257a0 dracut-functions.sh: optimized
get rid off lots of duplicated checks and code
2012-02-24 14:56:40 +01:00
Harald Hoyer 2efa546f26 dracut-functions.sh:for_each_host_dev_fs() return a value
for_each_host_dev_fs() now returns 0 if one func returned with 0
2012-02-22 19:06:00 +01:00
Harald Hoyer 34248c926c change omit_drivers to support regexp expressions 2012-02-22 16:14:38 +01:00
Harald Hoyer 9cb8447c90 dracut-functions.sh:inst_library(): readlink source dir first
read link of the source dir, before convert_abs_to_rel()
2012-02-22 16:13:20 +01:00
Harald Hoyer cc227886c6 dracut-functions.sh:inst_simple(): no inst_dir if dir exists 2012-02-22 16:13:20 +01:00
Harald Hoyer 6d2a7942aa dracut-functions.sh: set IFS only for variable setting 2012-02-22 16:13:20 +01:00
Harald Hoyer 43dfbeec7b dracut-functions.sh: turn off regexp for strstr() 2012-02-22 16:13:20 +01:00
Harald Hoyer 552ecca6db Renamed all shell scripts to *.sh 2012-02-22 15:15:21 +01:00