dracut-function Description
This is a description of dracut-function. See [1], for the basics description, as the rules of names an such stuf.
Dash instead of Sh
Dracut prefer the dash shell, instead the sh, and the first thing that do is to look if there are instaled in the
Files
All the files in the modules.d reside in a dir with the stantdar XX<mod>, see [1], all have a file named install, and many of them have a file called check. Install make the instalation of the files in the initrd fs.
check and dash
Dracut prefer the dash shell instead the sh, so the first thing is to check if there are installed, to do so, dracut use the file check, such file exist in many other modules' directories, if the check find that dependencies doesn't exist, the module is not installed, by example in 50plymount:
[[ $1 = -d ]] && echo crypt [[ -x /sbin/plymounthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]]
As you can see the preference of dash is not a restriction, because you can use sh or bash shells. In the previous script the -x <file> return true if the file exist, and && is the logical and operator, $1 = -d return true if the parameter exist and is a directory [2].
install functions
In install functions you could find functions as:
* inst Install all the files listed as parameter, is for general purposes, see the file 00dash/install. If the path of the file is not provided as part of the name, and the file is somewhere in the $PATH, it will put the file in the same path.
* args as I see it look to be removed, because is deprecated as is iqual to inst.
* dracut_install ident to inst, but if one parameter does'n exist the is flagget to be optional, and a warnig appear, so is better to use it instead of inst.
* inst_rules instalator to de udev (kernel's device manager) rules, that is always in the same place /etc/udev/rules.d, example on 10redhad-il8n/install:
... isnt_rules 10-console.rules inst_hook comdline 20 "$moddir/parse-il8n.sh"
* inst_hook Instalator of the kernel's hooks, the parameters are type of hook, hook priority and the hook, example see previous code.
* inst_simple use two parĂ¡meters, the first it the source to install, and the second optional to the target file on the ramdisk, it the file exist it doesn't overwrite.
* dinfo Used to write in the standart error out if the verbose flag is especified, and the same to the dracut's logfile.
kernel functions
* instmods Install a kernel module, normally reside in a file named installkernel
Go with dracut
To extract the files in the inird file system, you could use
cd tmp mkdir initrd cd initrd gunzip -c /boot/initramfs-$(uname -r).img | cpio -i
To create one, firts make a copy of your existend one, and be sure that you have an alternative kernel, and the proper configuration of grub, that allo you to select the alternative kernel, that are change in /boot/grub/grub.conf the parĂ¡meter timeout more than 0, and comment the line hiddenmenu. Whith that in consideration you could create one as:
su ... cd /boot mv initramfs-$(uname -r).img $(uname -r) dracut --force initramfs-$(uname -r).img $(uname -r)
If you want to debug, and make the process vervose, you could use:
dracut -v --debug --force initramfs-$(uname -r).img $(uname -r) > /tmp/outdracut.txt 2> /tmp/outdracut2.txt
The --force is to overwrite te previous one.
[1] http://fedoraproject.org/wiki/Dracut
[2] http://www.network-theory.co.uk/docs/bashref/BashConditionalExpressions.html