Compare commits

..

884 Commits
001 ... 010

Author SHA1 Message Date
Harald Hoyer
829c258554 lsinitrd: default to /boot/initramfs-$(uname -r).img 2011-03-31 19:50:31 +02:00
Harald Hoyer
5dcd565dab NEWS: inc version and add NEWS 2011-03-31 18:49:27 +02:00
Harald Hoyer
7838d85351 dracut.spec: drop net-tools requirement 2011-03-31 18:49:02 +02:00
Harald Hoyer
db59288d79 PKGBUILD, debian/*: changed URLs to kernel.org 2011-03-31 18:48:27 +02:00
Harald Hoyer
82794b4b90 dracut.spec: fixed URL 2011-03-31 18:45:49 +02:00
Harald Hoyer
b4fbdbbe1e Makefile: "make dist" now generates .tar.gz 2011-03-31 18:45:01 +02:00
Harald Hoyer
9853774351 base/init: reset PATH after the /run move 2011-03-31 14:10:22 +02:00
Harald Hoyer
79471f365e base/dracut-lib.sh: changed kmgs log levels
New kernel/dmesg understands syslog levels, so we log with "+24" to indicate
that dracut is a daemon (current init).
2011-03-31 13:12:38 +02:00
Harald Hoyer
98b108284c dmsquash-live/dmsquash-live-genrules.sh: fixed udev rule location
Fixed the rule directory to $UDEVRULESD
2011-03-31 08:24:15 +02:00
Harald Hoyer
8ee30d09a4 plymouth: use /run/plymouth/pid instead of /run/initramfs/plymouth 2011-03-30 16:24:57 +02:00
Harald Hoyer
01583ae4ad fips: fixed "boot=<dev>" handling 2011-03-30 14:57:01 +02:00
Harald Hoyer
249f8b5bfc base/init: fixed compat /dev/.initramfs copy 2011-03-30 03:23:37 +02:00
Harald Hoyer
561d7f4d7c doc: s#/init.log#/run/initramfs/init.log#g 2011-03-30 03:22:14 +02:00
Harald Hoyer
4ad453445a base/dracut-lib.sh: relax getargbool value parsing
if a non-boolean value was specified, like "yes" or "no",
getargbool() would error, because we check for "$val -eq 0"
2011-03-30 01:45:17 +02:00
Harald Hoyer
e620bb01da base/init: fix cdrom polling 2011-03-30 00:01:00 +02:00
Harald Hoyer
7931bf0420 plymouth gensplash: check for console_init before calling it
Thanks Jon Ander Hernandez!
2011-03-29 16:38:11 +02:00
Jon Ander Hernandez
c174aea07d Ensure rpc_pipefs is mounted
While on some systems (like Fedora) rpc_pipefs is mounted
automatically when sunrpc module is loaded, on Debian based systems it
needs to be mounted manually.
2011-03-29 16:17:03 +02:00
Harald Hoyer
85323dcbb9 40network/dhcp-root.sh: s#initqueue-finished#initqueue/finished#g 2011-03-29 15:46:53 +02:00
Harald Hoyer
8bc650d9dc dracut: add "/lib/firmware/updates" to default firmware path 2011-03-29 15:32:34 +02:00
Harald Hoyer
ea216a650e dracut: removed extra char in "Including modules done" 2011-03-29 14:45:08 +02:00
Harald Hoyer
a16ebfd56a dracut-functions: bashified ret=ret+$? to ret+=$? 2011-03-29 11:30:27 +02:00
Harald Hoyer
2aad23443e dracut: source reformat with line breaks 2011-03-29 11:27:15 +02:00
Harald Hoyer
8a5354a9a5 dracut: simplify $kernel version argument setting 2011-03-29 11:21:54 +02:00
Amadeusz Żołnowski
dbf381f7fb dracut: don't skip zero-length string outfile argument
When '' was passed as outfile, dracut generated name with following
pattern:

  /boot/initramfs-$kernel

With commit 486a1b9324 dracut skips ''
argument.
2011-03-29 10:52:50 +02:00
Harald Hoyer
1080ce600a Revert "dracut: don't skip zero-length string outfile argument"
This reverts commit 0dd37f13c5.
2011-03-29 10:52:22 +02:00
Harald Hoyer
0dd37f13c5 dracut: don't skip zero-length string outfile argument
When '' was passed as outfile, dracut generated name with following
pattern:

  /boot/initramfs-${kernel}.img

With commit 486a1b9324 dracut skips ''
argument.
2011-03-29 10:25:24 +02:00
Harald Hoyer
6981a0bfe7 NEWS: update 2011-03-28 21:09:34 +02:00
Harald Hoyer
e232c168d8 dracut.conf.d/fedora.conf.example: change stdloglvl to 3 2011-03-28 21:08:54 +02:00
Harald Hoyer
66259efc14 AUTHORS: update 2011-03-28 21:08:23 +02:00
Harald Hoyer
dc36969ae1 02caps: changed pre-pivot priority to 00
caps should be dropped before any actions with the mounted rootfs happen
2011-03-28 20:33:20 +02:00
Harald Hoyer
ec88eb91d6 10rpmversion/version.sh: version file moved to /lib/dracut 2011-03-28 20:26:29 +02:00
Harald Hoyer
9a54908fd7 NEWS: update 2011-03-28 17:52:56 +02:00
Harald Hoyer
5b2cc025f4 99base/init: fall back to manual cdrom polling 2011-03-28 17:52:33 +02:00
Harald Hoyer
1489c9b1af 40network: make dhclient mandatory again 2011-03-28 17:23:06 +02:00
Amadeusz Żołnowski
86d404513f 40network: install dhclient, brctl and ifenslave optionally
Warning given by check() function in case if any of those binaries
doesn't exist was removed, because it's produces by "dracut_install -o"
later.
2011-03-25 16:28:28 +01:00
Amadeusz Żołnowski
adcccd187d dracut.conf.5.xml, dracut.8.xml: logging options and -M documented 2011-03-25 16:24:10 +01:00
Amadeusz Żołnowski
956af8f26e dracut: new option: -M, --show-modules - lists modules on build
Module name is printed to standard output before its inclusion.
2011-03-25 16:24:09 +01:00
Amadeusz Żołnowski
d60b71e8e8 dracut-logger: /dev/log is socket, not character device
Fixed typo in error message by the way.
2011-03-25 16:23:49 +01:00
Amadeusz Żołnowski
d1ef3951f3 modules.d: logging functions adjusted to dracut-logger 2011-03-25 16:22:05 +01:00
Amadeusz Żołnowski
e27770e10c dracut-functions: logging functions adjusted to dracut-logger 2011-03-25 16:21:32 +01:00
Amadeusz Żołnowski
0b70674329 dracut-functions: code formatting corrected 2011-03-25 16:21:08 +01:00
Amadeusz Żołnowski
b991617f19 dracut: when stdloglvl not set defaulted to 0 - should be 4
Removed unnecessary stdloglvl default in dracut.conf.
2011-03-25 16:10:48 +01:00
Amadeusz Żołnowski
9ebc51100b dracut-logger: 'user' facility for build-time and 'daemon' for boot-time 2011-03-25 16:10:48 +01:00
Harald Hoyer
0874654c78 dracut-functions: try to find dracutbasedir, if not set 2011-03-25 16:10:47 +01:00
Harald Hoyer
d6d53f60b2 dracut-functions: use "type" to determine the need of sourcing dracut-logger 2011-03-25 16:10:47 +01:00
Harald Hoyer
e94f4cce47 loginit: log to /run/initramfs/init.log 2011-03-25 16:10:47 +01:00
Harald Hoyer
07fa164e16 loginit: use /run/initramfs/init.log.end as end marker 2011-03-25 16:10:47 +01:00
Harald Hoyer
9e7a3bf242 base/dracut-lib.sh: s/RDDEBUG/RD_DEBUG/g
RDDEBUG would be unset by the environment cleanup in init and logging
would be turned off afterwards.
2011-03-25 16:10:47 +01:00
Harald Hoyer
0b53ca70b6 Move all hooks to "$hookdir"
hookdir=/lib/dracut/hooks for now, to keep the root directory clean
2011-03-25 16:10:46 +01:00
Harald Hoyer
c9f1e3d1f4 check for getarg() function before sourcing dracut-lib.sh
make use of "type getarg" to check, if we really need to source
dracut-lib.sh
2011-03-25 16:10:46 +01:00
Harald Hoyer
c97e1a76f3 dracut-functions: install udev rules
Install the udev rules to /lib, if the original rule is found there.
2011-03-25 16:10:46 +01:00
Harald Hoyer
94f4923039 mkdir -m 0755
add the missing directory permissions to mkdir
2011-03-25 15:44:00 +01:00
Harald Hoyer
e86a6d390d network: install brctl optionally 2011-03-25 15:44:00 +01:00
Harald Hoyer
4af5e99124 move dracut version file to /lib/dracut/dracut-$version 2011-03-25 15:44:00 +01:00
Harald Hoyer
7bfacf2f21 dracut: use readlink for drautbasedir if "-l" 2011-03-25 15:44:00 +01:00
Harald Hoyer
e43df9e342 base/init: fixed /dev/.initramfs creation, for no "/run" 2011-03-25 15:43:54 +01:00
Harald Hoyer
52eed26853 dracut: fixed directory handling, if image is created in "/" 2011-03-24 11:30:23 +01:00
Victor Lowther
4b3124ae85 Update PKGBUILD to force backups of /etc/dracut.conf on install. 2011-03-23 11:29:36 +01:00
Victor Lowther
3a71443953 Make compression do The Right Thing based on what is in the config files. 2011-03-23 11:29:36 +01:00
Victor Lowther
5e6c3b035d Update and slightly refactor compression handling.
This adds a --compress= option along with xz support for 2.6.38 and above.
2011-03-23 11:29:13 +01:00
Michal Soltys
e5e5c8952d dracut: fix arithemtic ${#VAR[@]} tests
This patch fixes a handful of ${#VAR[@]} tests, which can't be evaluated
as text expressions - the results is always true in such case, because
"0" is non-empty string.

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-03-23 11:25:55 +01:00
Harald Hoyer
19f3a804e7 s#/dev/.run#/run#g
Move things where they really belong to.
2011-03-18 18:23:44 +01:00
Harald Hoyer
519d339233 dracut-logger: don't debug log "return 0" of dlog() 2011-03-17 12:16:33 +01:00
Harald Hoyer
1e64e4939f dracut-logger: turn off xtrace for log messages
Turn off xtrace for log messages and turn it back on, if $debug is set.
2011-03-17 12:13:44 +01:00
Harald Hoyer
da22a02130 Makefile: split syntax check from target "check" to "syncheck"
also add syntax check for the bash scripts
2011-03-17 12:12:48 +01:00
Amadeusz Żołnowski
432196aef8 dracut: script adjusted to new logging facility; -v changed
-v meaning has changed. Now it increases verbosity level. -q option has
been added, which decreases verbosity level. Both options might be
specified multiple times.
2011-03-16 21:42:32 +01:00
Amadeusz Żołnowski
46265a9d3e dracut-logger: make $maxloglvl public
$maxloglvl might be useful to check, if expensive informational
operation is going to be logged at all, before executing it.
2011-03-16 21:42:32 +01:00
Amadeusz Żołnowski
1953052994 dracut: install ld.so.conf* with dracut_install instead of cp 2011-03-16 21:42:30 +01:00
Harald Hoyer
0afae1c7ce base/init: for udev > 166 we will create and use /dev/.run/udev/rules.d
See:
http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff;h=e68b4c2857942257268134cf7028b80f5a6a8103;hp=98ab6a377285d5943563cfa397e8b350e43878ec
2011-03-16 21:24:57 +01:00
Harald Hoyer
e7b1b342bf dracut: add "--check=crc32" to xz compression
As mentioned in kernel/Documentation/xz.txt:

...
Notes on compression options

  Since the XZ Embedded supports only streams with no integrity check
  or CRC32, make sure that you don't use some other integrity check
  type when encoding files that are supposed to be decoded by the
  kernel. With liblzma, you need to use either LZMA_CHECK_NONE or
  LZMA_CHECK_CRC32 when encoding. With the xz command line tool, use
  --check=none or --check=crc32.

  Using CRC32 is strongly recommended unless there is some other layer
  which will verify the integrity of the uncompressed data anyway.
...
2011-03-16 21:17:26 +01:00
Harald Hoyer
f709fa439b Install dracut-logger and add it to the spec file 2011-03-16 13:56:20 +01:00
Amadeusz Żołnowski
510ef3af84 dracut-logger: convertion to kernel console log level for kmsg 2011-03-16 12:01:42 +01:00
Will Woods
bb08c7632a docs: "/conf/conf.d" should be "/etc/conf.d"
The code actually looks in /etc/conf.d; make the docs reflect that.
2011-03-16 12:01:39 +01:00
Harald Hoyer
200c7fd4b2 dracut-logger: wrap dlog to read stdin
Moved dlog() to _do_dlog() and created dlog() which reads from stdin if
no arguments (except the loglevel) are given.

This enables e.g.:

dwarn "This is a warning!"

echo "This is a warning!" | dwarn
2011-03-15 20:51:58 +01:00
Harald Hoyer
4f7654715f dracut: initialize stdloglvl_l 2011-03-15 20:07:01 +01:00
Harald Hoyer
7fc4fb0131 dracut-logger: export _maxloglvl to skip multiple dlog_init() 2011-03-15 20:03:17 +01:00
Amadeusz Żołnowski
e103615be2 dracut-logger: logging facility module for build- and boot-time
It's dash compatible to be used also at boot-time. For now it's included
by dracut-functions and replaces functions: dinfo(), dwarning() and
derror(). New options are introduced: -L|--stdlog, and -q|--quiet to
control stderr verbosity. Logging to file or syslog may be controlled by
options set in config file.

Note that code is not adjusted to the meaning of the new logging
functions, yet.

Doxygen formatted documentation (as a proposal, by the way) is included
in dracut-logger.
2011-03-15 19:52:59 +01:00
Harald Hoyer
d486e8f607 dracut: add --xz to compress with xz 2011-03-15 19:51:07 +01:00
Harald Hoyer
66fe35eb3e lsinitrd: cope with xz and lzma compressed images 2011-03-15 19:51:07 +01:00
Harald Hoyer
29cfd6c80b syslog: fixed warn() and dwarning() calls 2011-03-15 19:51:07 +01:00
Will Woods
fe17f4e86b dmsquash-live: use 'rootfs.img' for rootfs image name
Every image gets handled the same way regardless of filesystem, so
let's use a filesystem-neutral name (rather than adding new
lines for every fstype anyone might want to use).
2011-03-14 16:30:39 +01:00
Andrey Borzenkov
6927f09e1c cryptoroot-ask: limit number of plymouth password requests
Set number ot retries to 5 to align with non-plymouth case.

Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
2011-03-11 11:44:02 +01:00
Andrey Borzenkov
96d1d01572 cryptroot-ask: check that plymouth is running before use
Otherwise there is no way to skip pasword prompt. --has-active-vt
seems to correctly catch also the case when plymouthd is started
but splash is disabled.

Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
2011-03-11 09:43:44 +01:00
Harald Hoyer
b151c3b1fe dracut.conf.d/fedora.conf.example: turn off fips again
use dracut.conf.d/fips.conf.example and install it to
/etc/dracut.conf.d/40-fips.conf to turn it on
2011-03-10 21:38:02 +01:00
Harald Hoyer
28eb2436c8 TEST-50-MULTINIC: change /dev/.initramfs to /dev/.run/initramfs 2011-03-10 19:49:08 +01:00
Harald Hoyer
4877bb510e dracut.spec: inc release to 009 prerelease 2011-03-10 19:25:09 +01:00
Harald Hoyer
2aee7e16ac dracut.spec: remove insmodpost module 2011-03-10 19:23:21 +01:00
Harald Hoyer
52881470ee dracut.spec: add caps subpackage 2011-03-10 19:22:40 +01:00
Harald Hoyer
77e607a3a7 prepare for future udev rules.d location
future udev will have rules.d in /dev/.run/udev/rules.d

Also remove compat symlinks, because we want to get rid of these files
anyway.
2011-03-10 19:19:09 +01:00
Harald Hoyer
1e2a167fe6 rootfs-block/mount-root.sh: rename flag file for fsck
/dev/.run/initramfs/fsck -> /dev/.run/initramfs/root-fsck
2011-03-10 19:17:23 +01:00
Harald Hoyer
2d7fe72bbb base/init: copy /init.log with rd.copystate=1 2011-03-10 19:16:29 +01:00
Harald Hoyer
661f9a3451 dracut: let some parameters be specified multiple times
These parameters can now be specified multiple times:
-a|--add
--add-drivers
-m|--modules
-o|--omit
-d|--drivers
--filesystems
-I|--install
--fwdir
-i|--include
2011-03-10 17:22:56 +01:00
Harald Hoyer
8466db967e dracut-functions: add pop() and push() 2011-03-10 17:22:56 +01:00
Harald Hoyer
486a1b9324 dracut: make options position independent
now this is possible:
$ dracut test.img -f
$ dracut test.img '' -f
2011-03-10 17:22:56 +01:00
Harald Hoyer
4fea3ea6f1 dracut: make "-i, --include SOURCE TARGET" work for files, too 2011-03-10 17:22:56 +01:00
Harald Hoyer
529349c66d add caps module, to drop capabilities
This adds the following parameters:
rd.caps=1
	turn the caps module on/off
rd.caps.initdrop=cap_sys_module,cap_sys_rawio
	drop the specified comma seperated capabilities
rd.caps.disablemodules=1
	turn off module loading
rd.caps.disablekexec=1
	turn off the kexec functionality

If module loading is turned off, all modules have to be loaded in the
initramfs, which are used later on. This can be done with
"rd.driver.pre="
rd.driver.pre=autofs4,sunrpc,ipt_REJECT,nf_conntrack_ipv4,....

Because the kernel command line would get huge with all those drivers, I
recommend to make use of $initramfs/etc/cmdline.

So, all rd.caps.* and rd.driver.pre arguments are in caps.conf can be
copied to $initramfs/etc/cmdline with "-i caps.conf /etc/cmdline".

Also all modules have to be loaded in the initramfs via "--add-drivers".

The resulting initramfs creation would look like this:

  --add-drivers "autofs4 sunrpc ipt_REJECT nf_conntrack_ipv4 \
  nf_defrag_ipv4 iptable_filter ip_tables
  ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack
  ip6table_filter ip6_tables dm_mirror dm_region_hash dm_log uinput ppdev
  parport_pc parport ipv6 sg 8139too 8139cp mii i2c_piix4 i2c_core ext3
  jbd mbcache sd_mod crc_t10dif sr_mod cdrom ata_generic pata_acpi ata_piix
  dm_mod" \
  /boot/initramfs-caps.img
2011-03-10 17:22:56 +01:00
Vadim Kuznetsov
80bafe6d36 mkinitrd: fix incorrect basename in mkinitrd usage message
Steps to Reproduce:
1. run mkinitrd -h

Actual results:
$ mkinitrd
usage: /usr/sbin [--version] [--help] [-v] [-f] [--preload <module>]
       [--image-version] [--with=<module>]
        <initrd-image> <kernel-version>

Expected results:
$ mkinitrd
usage: mkinitrd [--version] [--help] [-v] [-f] [--preload <module>]
       [--image-version] [--with=<module>]
       <initrd-image> <kernel-version>
2011-03-10 17:22:55 +01:00
Harald Hoyer
7838ab5010 kernel-modules/module-setup.sh: fix instmods $filesystems
especially in host_only mode, $filesystems was not honored
2011-03-10 17:22:55 +01:00
Harald Hoyer
5078c98abe move insmodpost and blacklisting to 90kernel-modules
also correctly parse rd.driver.{blacklist,pre,post}
2011-03-10 17:22:25 +01:00
Harald Hoyer
4c4c8b7239 rd.driver.*: accept comma separated list
accept a comma seperated list of kernel drivers for
rd.driver.blacklist
rd.driver.pre
rd.driver.post
2011-03-10 14:11:42 +01:00
Harald Hoyer
b177e9133e move all /dev/.initramfs to /dev/.run/initramfs
We want all "/var/run" information to live in /dev/.run, until the real
root is mounted.
Therefore we mount a tmpfs on /dev/.run, which can/will be bind/move mounted
on /var/run later on.
2011-03-10 12:40:47 +01:00
Amadeusz Żołnowski
9fe4f5ff25 crypt: installing all crypto kernel modules instead of few selected 2011-03-09 18:09:23 +01:00
Will Woods
0ddd68f7e6 Add support for in-initramfs live images with "root=live:/path/name.img"
This allows creation of initramfs images which contain a Live system.
The primary use for this is keeping very large initramfs-based systems
(e.g. anaconda, the Fedora installer) compressed in-memory, by using a
compressed filesystem image like squashfs or btrfs.

dmsquash-live-genrules.sh will initqueue dmsquash-live-root itself
(rather than making udev rules) if the given live "device" is actually
an existing, plain file.

parse-dmsquash-live.sh will only accept paths that end in ".img".
dmsquash-live-root will only handle images named "*squashfs.img",
"*ext3fs.img", or "*btrfs.img".
2011-03-09 12:10:22 +01:00
Will Woods
533318113b Look for btrfs.img in dmsquash-live-root
Btrfs is an excellent option for the root fs image for live systems,
especially since it does its own transparent compression.
2011-03-09 12:09:34 +01:00
Will Woods
a5e33c7d6f Use 'btrfs' command rather than 'btrfsctl', and install btrfs driver
btrfsctl is being replaced by the btrfs command in the upstream
tools, so change accordingly. Also, if we're using the btrfs module
we should probably make sure the btrfs driver gets installed.
2011-03-09 12:09:29 +01:00
Will Woods
dfec8467b9 Change EXT3FS to FSIMG
Change the EXT3FS variable to FSIMG, since we might want to use other
filesystems as our live root. Change comments to reflect this fact.
2011-03-09 12:09:24 +01:00
Will Woods
44159d0598 Make dmsquash-live install the squashfs driver
dmsquash-live uses squashfs, so let's make sure the driver is installed
2011-03-09 12:09:20 +01:00
Will Woods
fe9cdf741f inst_dir: fix handling of relative symlinks outside the current dir
inst_dir used the following to try to resolve a relative path:
  [[ $target = ${target##*/} ]] && target="${file%/*}/$target"
  inst_dir $target

This will only match if $target has no slashes, so something like
/usr/bin -> ../sbin would result in: inst_dir ../sbin, or
/usr/share -> local/share would result in: inst_dir local/share
which is not going to do the right thing.

Instead, we resolve any non-absolute link, like so:
  [[ $target == ${target#/} ]] && target=$(dirname "$file")/$target
Thus /usr/bin -> ../sbin results in: inst_dir /usr/../sbin, and
/usr/share -> local/share results in: inst_dir /usr/local/share
which is what you would expect.
2011-03-09 12:09:10 +01:00
Will Woods
3d88d27810 Fix bash logic typo/buglet ([ condition ] & expression) 2011-03-09 12:08:59 +01:00
Amadeusz Żołnowski
d8e8e14e0b listing modules fixed
Modules were not listed because code relied only on deprecated 'install'
and 'installkernel' scripts. Check for 'module-setup.sh' script was
added.
2011-03-09 12:08:58 +01:00
Harald Hoyer
fa79f00803 test/*/test.sh: mv 01hard-off.sh 000-hard-off.sh
otherwise "die" will let the kernel panic
2011-03-07 16:22:42 +01:00
Amadeusz Żołnowski
b20ff981c4 crypt-lib.sh: moved IFS=: from before 'read' to before 'while'
Some versions of dash don't behave as expected with code like this:

while IFS=: read a b c; do
    blah
done

Thanks to Eric Mertens who identified the issue.
2011-03-07 13:56:41 +01:00
Harald Hoyer
535ad9d1fb dracut-lib: improve die() logging 2011-03-07 13:37:22 +01:00
Harald Hoyer
a382492bf3 init: improve emergency logging 2011-03-07 13:37:22 +01:00
Harald Hoyer
8be12be16a biosdevname: be verbose about biosdevname activation 2011-03-07 13:37:22 +01:00
Harald Hoyer
6fecffaab5 fcoe: add EDD parsing
[backport of 70dfe537]
2011-03-07 13:37:21 +01:00
Harald Hoyer
6767fdaaed lvm: move emergency script from 00 to 90
[forward port of cfb4747e]
2011-03-07 13:37:21 +01:00
Harald Hoyer
fcbcc89bb2 crypt: fix emergency script generation
[ forward port of e45a2dba]
2011-03-07 13:37:20 +01:00
Harald Hoyer
38ba0d7a62 network: add iBFT interface configuration
[forward port of 0828d4c357]
2011-03-07 13:37:20 +01:00
Harald Hoyer
10b5dca0f7 fips/fips.sh: do not load tcrypt with "noexit" parameter
"noexit=1" is the default mode for the tcrypt module now.

[forward ported 7e7308158c]
2011-03-07 13:37:20 +01:00
Harald Hoyer
b60d5e90a5 fips/fips.sh: die(), if boot=<device> is not present or has wrong format 2011-03-07 13:37:19 +01:00
Harald Hoyer
674bdee804 fips/fips.sh: only trigger udev, if device node of boot is not present 2011-03-07 13:37:19 +01:00
Harald Hoyer
62d0c4e7c1 dracut.spec: add dracut logrotate 2011-03-07 13:37:19 +01:00
Harald Hoyer
0b440844bd dracut-functions: fixed instmods() return value
The FIPS installkernel() relies on the instmods() return value. So only
return 0, if the module and its dependencies were actually installed
correctly.
2011-03-07 13:37:18 +01:00
Harald Hoyer
724b87a6f8 dracut-functions: check for missing dracut modules
If the user explicitly specified "-a <modules>" or "-m <modules>",
   warn him about possible missing modules.
2011-03-07 13:37:18 +01:00
Harald Hoyer
5242d8fb57 dracut-functions: if .hmac files are present, install them also
For FIPS mode, we need all checksum files, called .<filename>.hmac. So,
if we find one, we install it.
2011-03-07 13:37:18 +01:00
Harald Hoyer
1a0d82a3dd dracut-functions: space 2011-03-07 13:37:17 +01:00
Harald Hoyer
ebaee770ac dracut-functions: more verbose logging message format 2011-03-07 13:37:17 +01:00
Harald Hoyer
ee89f47453 dracut-functions: check if directory of logfile is writable
Do not check, if the logfile itsself is writable. Check the directory
instead.
2011-03-07 13:37:11 +01:00
Harald Hoyer
58dad7025b dracut: more verbose logging 2011-03-07 12:54:47 +01:00
Amadeusz Żołnowski
5d72984a01 Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install rules:
10-dm.rules
  11-dm-lvm.rules
  13-dm-disk.rules
  95-dm-notify.rules

but provides only 64-device-mapper.rules combining more or less the
above rules files.
2011-03-04 13:07:28 +01:00
Amadeusz Żołnowski
f90fd5b34b dracut-functions: fixed doubled $initdir prefix inst_library()
Commit 172d85b9c9 caused following error:

./dracut-functions: line 307: cd: /tmp/initramfs.mP7cPY/tmp/initramfs.mP7cPY/lib64: No such file or directory

Patch removes beginning $initdir for symlink case.
2011-02-25 10:06:35 +01:00
Harald Hoyer
9d49507f80 kernel-modules: add hid-cherry hid-logitech hid-microsoft kbd drivers 2011-02-23 16:34:23 +01:00
Harald Hoyer
e38e9e3f5e AUTHORS: update 2011-02-23 13:35:46 +01:00
Harald Hoyer
6f590cd1c5 dracut: do not use "derror", when we cannot find dracut-functions 2011-02-23 13:32:31 +01:00
Harald Hoyer
41f90cbe50 dracut.spec: add /var/lib/initramfs 2011-02-23 13:21:07 +01:00
Harald Hoyer
7d4f1101bc add missing editor format commands 2011-02-23 09:41:08 +01:00
Harald Hoyer
8ce58f1f42 add missing shebang 2011-02-23 09:38:25 +01:00
Harald Hoyer
2826a877af 90lvm/lvm_scan.sh: removed garbage line 2011-02-22 18:40:40 +01:00
Harald Hoyer
53570e16c3 90lvm/lvm_scan.sh: fixed lvm version parsing 2011-02-22 17:45:11 +01:00
Harald Hoyer
94cce410aa vconsole.font.unicode -> vconsole.unicode 2011-02-21 09:23:27 +01:00
Andrey Borzenkov
06e07df001 fix c0a82e271e
Let inst_key_val usage agree with above patch :)

Also UNICODE is rather global console property, not font specific
(and if anything, is rather keyboard specific). Let it be just
vconsole.unicode

Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
Cc: initramfs@vger.kernel.org
2011-02-21 09:21:22 +01:00
Harald Hoyer
9edf1b206b init: set cdrom polling in kernel
and reset to -1 after we are done.
2011-02-18 13:27:31 +01:00
Harald Hoyer
440a4cc247 Makefile: do not dash syntax check module-setup.sh
module-setup.sh is bash syntax, so dash complains about bash contructs
2011-02-18 13:11:53 +01:00
Harald Hoyer
b282107fa9 lvm: use --sysinit, if lvm version >= v2.02.65 2011-02-18 10:58:39 +01:00
Harald Hoyer
0ce274f02b selinux: turn off selinux by default
In Fedora selinux is now handled by systemd. If you want to enable
selinux by default, just add it to your /etc/dracut.conf.d/01-dist.conf
with:
add_dracutmodules+=" selinux "
2011-02-18 09:44:47 +01:00
Harald Hoyer
c0a82e271e i18n: default to vconsole.font.unicode=1 2011-02-18 09:37:11 +01:00
Harald Hoyer
ebaed7d51f i18n: fixed config file parsing in hostonly mode
I accidently removed some parenthesis.
2011-02-18 09:33:06 +01:00
Jon Ander Hernandez
172d85b9c9 dracut-functions: fixed installing libraries which links to another directory
$ ldd `which bash` | grep ld
/lib64/ld-linux-x86-64.so.2 (0x00007fa1cc3ff000)

$ readlink -f /lib64/ld-linux-x86-64.so.2
/lib/ld-2.12.1.so

So inst_library /lib64/ld-linux-x86-64.so.2 was doing :

(cd "/tmp/initramfs.4uaeD9/lib64" && ln -s "/lib/ld-2.12.1.so"
 "ld-linux-x86-64.so.2")

But, /tmp/initramfs.4uaeD9/lib64 -> /lib... :-S
2011-02-17 10:50:18 +01:00
Harald Hoyer
81c6e7fb69 dracut-functions: handle shared objects in find_binary w/o the exec flag 2011-02-17 10:50:16 +01:00
maximilian attems
f63c30d89b dracut: Don't suppress the modprobe error output.
It happens that either due to newer modprobe or missing depmod
module-init-tools cries.
Suppressing the error ensures for a funny debug search for the user.
Resulting initramfs is generally unbootable due to missing module deps.

Better use the quiet option of modprobe itself.
It makes it less chatty, but doesn't suppress "fatal" errors.

Signed-off-by: maximilian attems <max@stro.at>
2011-02-16 15:01:30 +01:00
Harald Hoyer
1cedde0681 plymouth: touch /dev/.systemd/plymouth
until plymouth does it itsself, touch /dev/.systemd/plymouth
https://bugzilla.redhat.com/show_bug.cgi?id=676302
2011-02-09 13:22:49 +01:00
Harald Hoyer
c965ed2db4 dracut.8.xml: corrected typo 2011-02-08 18:06:25 +01:00
Harald Hoyer
52889453c1 dracut-functions: write to $HOME/dracut.log instead of /tmp/dracut.log 2011-02-08 17:59:48 +01:00
Harald Hoyer
534b0525a5 dracut.spec: add biosdevname 2011-02-02 17:43:03 +01:00
Harald Hoyer
051501eea6 add rpmversion and fips to the fedora default modules 2011-02-02 17:39:45 +01:00
Harald Hoyer
71df3c4329 renamed module-info.sh to module-setup.sh 2011-02-02 16:35:18 +01:00
Harald Hoyer
6ae5caf008 version 008 2011-02-02 16:33:35 +01:00
Harald Hoyer
b9d7fda0e1 selinux: call emergency_shell for failures 2011-02-02 15:10:42 +01:00
Harald Hoyer
e6752f1a6c fips: add aes-xts module 2011-02-02 14:48:37 +01:00
Harald Hoyer
46bc0593ac dracut: use derror for error messages 2011-02-02 13:56:04 +01:00
Harald Hoyer
76c4613abc multipath: use new "-B" parameter 2011-02-02 13:56:04 +01:00
Harald Hoyer
7238aa0cf0 base/init: do not poll cdrom, if kernel supports polling 2011-02-02 13:56:03 +01:00
Harald Hoyer
95d2dabc25 replaced check,install,installkernel with module-info.sh 2011-02-02 13:56:03 +01:00
Harald Hoyer
07caee2662 add 97biosdevname dracut module 2011-01-26 13:01:10 +01:00
Harald Hoyer
b43f4df540 iscsi: changed parameters to new rd.iscsi style 2011-01-25 11:53:52 +01:00
Harald Hoyer
a2b5bb004d dracut.kernel.7.xml: s/rd_ZNET/rd.znet 2011-01-25 11:34:25 +01:00
Harald Hoyer
444061de67 base/init: drop "noexec" from /dev/shm 2011-01-25 10:35:20 +01:00
Harald Hoyer
ee1fa07f3d base/install: create emergency subdir 2011-01-24 13:41:24 +01:00
Harald Hoyer
cf3bc080c1 dracut.spec: removed "mount" requirement
mount is part of util-linux-ng. There is no mount package.
2011-01-17 11:15:16 +01:00
Harald Hoyer
2ca68bb82b base/install: make install of "less" optional 2011-01-07 12:05:42 +01:00
Harald Hoyer
e2d86d001a fips: s/==/= 2011-01-03 09:48:37 +01:00
Harald Hoyer
8082a0946e multipath/install: install the complete /etc/multipath directory
Resolves: rhbz#630911
2010-12-06 16:20:43 +01:00
Harald Hoyer
79799c954f mkinitrd-dracut.sh: add "--force"
Resolves: rhbz#626389
2010-12-06 16:19:27 +01:00
Harald Hoyer
1b434f1ba9 mdraid/parse-md.sh: create new rules, then mv to old one
If udevd is already running, then we should assemble the new rules files
in a seperate file first, before calling it *.rules

Resolves: rhbz#595096
2010-12-06 16:12:54 +01:00
Harald Hoyer
3003cfdf9e kernel-modules/installkernel: add hid_sunplus to keyboard drivers 2010-12-02 17:13:15 +01:00
Harald Hoyer
7c6eb15280 added dracut logo 2010-12-02 17:13:04 +01:00
Christian Heinz
ab9b7eee0a fix installation of `modules.builtin.bin'
`modules.builtin.bin' is installed like a regular file, thereby ending
up in the wrong place when `--kmoddir' is in effect. Fix this by
specifying the installation destination.
2010-11-26 09:36:18 +01:00
Tomasz Torcz
3f003263d2 - move btrfs rules order from 40 to 80 for ID_FS_TYPE to work (which is populated by 60-persistent-storage.rules) 2010-11-24 19:02:13 +01:00
Harald Hoyer
b9cc6f7ca9 dracut.xml: fixed "Omitting dracut Modules" 2010-11-23 12:51:31 +01:00
Harald Hoyer
5b928ffade dracut.spec: inc release 2010-11-22 10:05:42 +01:00
Lubomir Rintel
ae202ef02e Search in for KMS-capable drivers in extra/ as well
User can have an out-of-tree video driver supporting KMS installed;
Intel GMA500 drivers from RPM Fusion are one example of such module.
2010-11-19 19:08:03 +01:00
Harald Hoyer
7f7a91b75f base/init: fix init executable check 2010-11-19 13:40:34 +01:00
Harald Hoyer
770b796e52 base/init: honor old "real_init=" 2010-11-19 13:37:17 +01:00
Harald Hoyer
b2415f4414 base: use systemd-timestamp for RD_TIMESTAMP, if possible 2010-11-18 12:28:21 +01:00
Harald Hoyer
2eea164db7 base/init: do not set umask
somehow /dev/dri gets created with the wrong permissions
https://bugzilla.redhat.com/show_bug.cgi?id=626559
2010-11-17 17:37:22 +01:00
Amadeusz Żołnowski
7a8a33b6cd dracut-lib.sh: splitsep fix 2010-11-16 10:30:33 +01:00
Harald Hoyer
325d491360 dracut.spec: remove uswsusp and added busybox module 2010-11-12 14:27:36 +01:00
Harald Hoyer
91f4d45f93 crypt: change /tmp/luks.keys seperator from "|" to ":"
Do it like on the kernel command line, so we only have one forbidden
character.
2010-11-12 14:11:33 +01:00
Amadeusz Żołnowski
c7e72136b2 dracut.kernel.7: updated to latest changes in 90crypt 2010-11-12 14:08:09 +01:00
Amadeusz Żołnowski
8844cd6b6c 90crypt: probe for keydev asynchronously; changed kernel arg
New kernel argument syntax for LUKS-keydev is introduced:

  rd.luks.key=<key_path>[:<key_dev>[:<luks_dev>]]

Unfolding <key_dev> in BNF:

  <key_dev> ::= "UUID=" <uuid> | "LABEL=" <label> | <kname>

Where <kname> matches following regular expression:

  ^/dev/.*

<kname> need to be a character device and not a symlink for now.

For every rd.luks.key argument udev rule is created.  That rule runs
test to check whether matching device contains <key_path>.  If it does
it's applied to matching <luks_dev>.
2010-11-12 14:08:08 +01:00
Amadeusz Żołnowski
ccb0ab7348 99base/dracut-lib.sh: 5 new functions & 1 modified
New:
  str_starts, str_replace
  funiq - print new unique file name
  mkuniqdir - create and print new unique dir
  splitsep - splits given string 'str' with separator 'sep' into vars
  udevmatch - create udev rule match for a device

Modified:
  foreach_uuid_until - use $___ as a place holder
2010-11-12 14:08:08 +01:00
Harald Hoyer
5023964844 move initlog.pipe to /dev/.initramfs 2010-11-11 11:08:40 +01:00
Harald Hoyer
4af673c3f8 base/init: merge mkdir and add more mount options 2010-11-11 11:08:40 +01:00
Harald Hoyer
5dc6f24085 base/loginit: s/==/=
stupid bug!
2010-11-10 22:50:20 +01:00
Harald Hoyer
e53fdd1c35 rootfs-block/mount-root.sh: remove $NEWROOT/.autofsck if possible 2010-11-10 22:10:54 +01:00
Harald Hoyer
040f3d2ffc base/init: re-add initqueue-finished 2010-11-10 21:27:33 +01:00
Harald Hoyer
d884af8077 rootfs-block/mount-root.sh: remove $NEWROOT/{.autofsck,forcefsck} if possible 2010-11-10 20:47:15 +01:00
Harald Hoyer
a4f88b8a49 rootfs-block/mount-root.sh: set prompt in emergency shell 2010-11-10 20:45:02 +01:00
Harald Hoyer
3d7c58ca1e rootfs-block/mount-root.sh: echo fsck return code to
/dev/.initramfs/fsck
2010-11-10 20:43:22 +01:00
Harald Hoyer
ce51f3be11 rootfs-block/mount-root.sh: fixed filesystem type udev parsing 2010-11-10 20:12:05 +01:00
Harald Hoyer
4cba811f6c rootfs-block/mount-root.sh: correctly printf to fstab 2010-11-10 20:11:31 +01:00
Harald Hoyer
85de3d281a rootfs-block/mount-root.sh: only warn if fsck returned != 0 2010-11-10 20:06:34 +01:00
Harald Hoyer
3817c2f138 rootfs-block/mount-root.sh: default rootfs to auto, even without fstab 2010-11-10 20:01:30 +01:00
Harald Hoyer
13af399f65 rootfs-block/mount-root.sh: clear fsckoptions 2010-11-10 19:58:15 +01:00
Harald Hoyer
2cbcbd7532 AUTHORS: update 2010-11-10 19:07:16 +01:00
Peter Rajnoha
c2c3108882 *.rules: honor DM_UDEV_DISABLE_OTHER_RULES_FLAG
honour the DM_UDEV_DISABLE_OTHER_RULES_FLAG which is set by
libdevmapper/LVM directly for devices that should be skipped.
2010-11-10 18:14:59 +01:00
Harald Hoyer
cd7ee4913d busybox/check: disable module by default and check for busybox binary 2010-11-10 16:38:40 +01:00
Andrey Borzenkov
856285aa90 resume: merge uswsusp module into resume
uswsusp almost completely duplicates resume; merge them.

Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
2010-11-10 16:07:01 +01:00
Andrey Borzenkov
0e08f1de8d 95rootfs-block: fix missing root when label contains slash
It is not clearly documented, but apparently fsck
(or, probably, getmntent) is using backslash as
escape character.

Label containing slash is converted to \x2f but '\'
is eaten by fsck later. Escape '\' before writing
into fstab.

v2:
- fix sed expression
- use printf instead of echo because echo eats '\' as well

Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
2010-11-10 16:03:14 +01:00
Andrey Borzenkov
161da365e2 i18n: do not use systemd-vconsole-setup
systemd-vconsole-setup was not designed to be run from udevd.
It checks locale environment to decide, whether UNICODE should
be enabled or disabled. Normally environment is setup by
systemd; but the only environment available in udev rules is
those from device properties. It means systemd-vconsole-setup
always assumes default C locale and disables UNICODE.

Revert to using built-in console_init which explicitly
imports locale settings from /etc/vconsole.conf. Alternative
is to revert 6545b9d7 and call console_init directly :)

Additionally patch fixes console_init to use new namespace as
well as ensures that default font is always installed.

Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
2010-11-10 15:53:04 +01:00
Daniel Drake
dbcc4e94c5 Add busybox shell replacements module
On the OLPC XO-1, there is a noticable delay during boot while the
initramfs is loaded from disk and uncompressed, so we have an interest
in making it small. We are also pushed for disk space.

Using busybox instead of all the regular tools saves a lot of space.
I have not tried every module but the basics are working with busybox's
replacements. Our initramfs is now down to 1.9mb.
2010-11-10 15:49:48 +01:00
Andrey Borzenkov
d118a5990a i18n: mention {vconsole,locale}.conf in README
i18n does not use /etc/sysconfig/{i18n,keyboard} anymore

Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
2010-11-10 15:49:48 +01:00
Harald Hoyer
498a131239 Makefile: use xhtml instead of xhtml-1_1 for the docbook.xsl 2010-11-10 15:05:04 +01:00
Harald Hoyer
9840eaade6 rootfs-block/install: install e2fsck for slackware 2010-11-10 15:00:30 +01:00
Harald Hoyer
f8fcc56ed9 dm/install: install dmeventd, only if present 2010-11-10 15:00:01 +01:00
Harald Hoyer
1c290032a4 dracut.spec: bump release 2010-11-05 14:15:09 -04:00
Harald Hoyer
1fbe575888 base/init: removed scsi_wait_scan hack 2010-11-05 14:14:34 -04:00
Harald Hoyer
6545b9d792 i18n/parse-i18n: remove manual call for console_init
setfont and loadkeys are better called in udev,
because then they are started in parallel to other jobs
2010-11-05 14:13:00 -04:00
Harald Hoyer
67bde9f067 bootchart/install: create tmpfs directory 2010-11-05 14:12:33 -04:00
Harald Hoyer
921f4b5b52 base/init: fixed " typo 2010-11-03 15:41:50 -04:00
Harald Hoyer
7853bbfa7d base/init: do not clean RD_* environment variables 2010-11-03 14:15:11 -04:00
Harald Hoyer
c79517b4d9 base/init: fixed indention 2010-11-03 14:12:30 -04:00
Harald Hoyer
5e1898fa5a base/init: only mknod /dev/null, if it does not exist yet 2010-11-03 13:45:14 -04:00
Harald Hoyer
11a2ab6228 base/init: merge mkdir calls 2010-11-03 13:42:20 -04:00
Harald Hoyer
c56e44a63a rootfs-block/mount-root.sh: fixed fsck "-a" option 2010-11-03 13:40:42 -04:00
Harald Hoyer
3871942d13 rootfs-block:mount-root.sh add fsck 2010-10-29 19:00:35 +02:00
Harald Hoyer
07ecac56da 10i18n/parse-i18n.sh: run console_init directly if /dev/tty0 exists 2010-10-29 18:38:55 +02:00
Harald Hoyer
5ce6642fed dracut.spec: s#fedora_version#fedora#g and simplified %if checks 2010-10-29 16:57:52 +02:00
Harald Hoyer
fb4ba86f44 dracut.conf.d/suse.conf.example: remove hostonly mode 2010-10-29 16:22:56 +02:00
Harald Hoyer
353ef76019 dracut.spec: dracut-network obsoletes and provides dracut-generic 2010-10-29 15:22:59 +02:00
Harald Hoyer
44b013967a dracut.spec: add dracut.html to %doc 2010-10-29 15:08:51 +02:00
Harald Hoyer
67c0c1847b i18n/install: if hostonly install fails, install all files 2010-10-29 14:07:56 +02:00
Harald Hoyer
544de3c87f i18n/install: s/dwarn/dwarning/ 2010-10-29 14:00:13 +02:00
Harald Hoyer
1be365c500 i18n/install: do not error out, if local i18n could not be found 2010-10-29 13:58:40 +02:00
Harald Hoyer
13f91fc78d i18n/install: cleanup and honor new config files
honor local /etc/locale.conf and /etc/vconsole.conf files
2010-10-29 13:55:22 +02:00
Harald Hoyer
256a816c9f dracut.conf.d/fedora.conf.example: SYSFONT -> FONT 2010-10-29 13:47:05 +02:00
Harald Hoyer
ee6fa3240d i18n: move to vconfig.* and locale.* namespace 2010-10-29 13:39:20 +02:00
Harald Hoyer
9b79345001 base/init: rd.shell=1 per default
to securely lock a machine, the admin has to set rd.shell=0!
2010-10-29 13:24:12 +02:00
Harald Hoyer
51c977d1ff dracut-functions:find_block_device() workaround for btrfs
/proc/self/mountinfo contains the btrfs virtual device major minor.
Determine the real major minor with the device.
2010-10-29 12:34:27 +02:00
Harald Hoyer
577b1fc833 base/init: s/RDTIMESTAMP/RD_TIMESTAMP/g
systemd will clear all RD_* env for its children
2010-10-28 18:09:45 +02:00
Harald Hoyer
6ef8e5b4d3 mkdir /dev/.initramfs with "-p" 2010-10-28 17:11:35 +02:00
Harald Hoyer
9bfff3746f base: send DRACUT_LOG_END to loginit at the end 2010-10-28 17:11:35 +02:00
Harald Hoyer
b2559a8895 TEST-50-MULTINIC/test.sh: only set hdc for no cdrom 2010-10-28 17:11:35 +02:00
Harald Hoyer
51b28ba9c4 test/TEST-*/test.sh: set -serial to null for servers
-serial udp might have stalled
2010-10-28 17:11:35 +02:00
Pádraig Brady
c8584872be network: don't die if gateway is down and root server is local
modules.d/40network/netroot: Don't arping the gateway if we don't need to
2010-10-28 17:11:34 +02:00
Harald Hoyer
387bf82e30 test/*/*-init: set PATH
/sbin and /usr/sbin are no longer in $PATH
2010-10-28 17:11:34 +02:00
Harald Hoyer
11adeb7c01 dracut-functions:inst_symlink() create target dir
if the target directory of the symlink didn't exist, we failed
2010-10-28 17:11:34 +02:00
Vladislav Bogdanov
3afca618da ifcfg/write-ifcfg.sh: fixes typos and generated ifcfg files 2010-10-28 17:11:34 +02:00
Harald Hoyer
2c1f37d45c base/init: fix for /sbin/init being an absolute softlink 2010-10-28 17:11:34 +02:00
Harald Hoyer
fa7ada31d0 new parameter option names with "rd.*" namespace
Renamed Options
       Here is a list of options, which were used in dracut prior to
       version 008, and their new replacement.

       rdbreak
           rd.break

       rd_CCW
           rd.ccw

       rdcopystate
           rd.copystate

       rd_DASD_MOD
           rd.dasd_mod.dasd

       rd_DASD
           rd.dasd

       rdinitdebug rdnetdebug
           rd.debug

       rd_NO_DM
           rd.dm=0

       rd_DM_UUID
           rd.dm.uuid

       rdblacklist
           rd.driver.blacklist

       rdinsmodpost
           rd.driver.post

       rdloaddriver
           rd.driver.pre

       rd_NO_FSTAB
           rd.fstab=0

       rdinfo
           rd.info

       check
           rd.live.check

       rdlivedebug
           rd.live.debug

       live_dir
           rd.live.dir

       liveimg
           rd.live.image

       overlay
           rd.live.overlay

       readonly_overlay
           rd.live.overlay.readonly

       reset_overlay
           rd.live.overlay.reset

       live_ram
           rd.live.ram

       rd_NO_CRYPTTAB
           rd.luks.crypttab=0

       rd_LUKS_KEYDEV_UUID
           rd.luks.keydev.uuid

       rd_LUKS_KEYPATH
           rd.luks.keypath

       rd_NO_LUKS
           rd.luks=0

       rd_LUKS_UUID
           rd.luks.uuid

       rd_LUKS_UUID
           rd.luks.uuid

       rd_NO_LVMCONF
           rd.lvm.conf

       rd_LVM_LV
           rd.lvm.lv

       rd_NO_LVM
           rd.lvm=0

       rd_LVM_SNAPSHOT
           rd.lvm.snapshot

       rd_LVM_SNAPSIZE
           rd.lvm.snapsize

       rd_LVM_VG
           rd.lvm.vg

       rd_NO_MDADMCONF
           rd.md.conf=0

       rd_NO_MDIMSM
           rd.md.imsm=0

       rd_NO_MD
           rd.md=0

       rd_MD_UUID
           rd.md.uuid

       rd_NFS_DOMAIN
           rd.nfs.domain

       rd_NO_PLYMOUTH
           rd.plymouth=0

       rd_retry
           rd.retry

       rdshell
           rd.shell

       rd_NO_SPLASH
           rd.splash

       rdudevdebug
           rd.udev.debug

       rdudevinfo
           rd.udev.info

       rd_NO_ZFCPCONF
           rd.zfcp.conf=0

       rd_ZFCP
           rd.zfcp
2010-10-28 17:11:27 +02:00
Harald Hoyer
54b01e99d3 dracut-functions: suppress modinfo errors for hostonly mode 2010-10-27 11:19:27 +02:00
Harald Hoyer
75bb595c6c fcoe: remove vconfig requirement 2010-10-26 12:45:59 +02:00
Harald Hoyer
490f98aa6c dracut.spec: own dracut/modules.d directory 2010-10-26 11:50:09 +02:00
Harald Hoyer
e6b637b067 dracut-gencmdline: strip also _rnetdev
https://bugzilla.redhat.com/show_bug.cgi?id=644494
2010-10-26 11:48:14 +02:00
Harald Hoyer
453fd25152 bootchart: fixed file perms 2010-10-25 17:27:06 +02:00
Harald Hoyer
228694e5a9 dracut.spec: modified to build on opensuse 2010-10-25 17:27:00 +02:00
Harald Hoyer
c54f73a2ff dracut.spec: removed gittag 2010-10-25 14:21:33 +02:00
Harald Hoyer
d9416c0df5 dracut.spec: add opensuse 2010-10-25 14:20:33 +02:00
Harald Hoyer
771c215192 dracut.spec: add 95fstab-sys and 96insmodpost 2010-10-25 14:20:32 +02:00
Harald Hoyer
0a70f452bb add dracut.conf.d/suse.conf.example 2010-10-25 14:20:26 +02:00
Harald Hoyer
bfd602f849 base: install switch_root to /sbin and call it with the full path 2010-10-25 12:31:38 +02:00
Harald Hoyer
8541b35ed7 i18n: also search in /usr/share/kbd 2010-10-25 12:31:07 +02:00
Harald Hoyer
57a49c6727 chmod 0755 modules.d/40network/parse-bond.sh 2010-10-18 16:20:19 +02:00
Vladislav Bogdanov
96fb9c8dd7 add bonding
Format:
bond=<bondname>[:<bondslaves>:[:<options>]]

bondslaves is a comma-separated list of physical (ethernet) interfaces.

options is a comma-separated list on bonding options (modinfo bonding for
details) in format compatible with initscripts.

If options include multi-valued arp_ip_target option, then its values
should be separated by semicolon.

bond without parameters assumes bond=bond0:eth0,eth1:balance-rr
2010-10-18 16:10:41 +02:00
Harald Hoyer
6daac70e55 add 96insmodpost dracut module
due to popular demand, this module loads a custom kernel module, after the
first udev settle (all basic device drivers loaded)
2010-10-18 16:07:58 +02:00
Harald Hoyer
d4916e36d0 documentation update 2010-10-18 16:05:47 +02:00
Harald Hoyer
1b4a9d8ad8 documentation update 2010-10-15 13:14:08 +02:00
Amadeusz Żołnowski
6bde7a17be suppress modprobe errors on builtins (credits to Kay Sievers)
Install /lib/modules/$kv/modules.builtin.bin to suppress modprobe error
messages saying module was not found, while it's built-in.

Credits go to Kay Sievers who enlighten us about meaning of this cool
file.
2010-10-15 09:52:45 +02:00
Amadeusz Żołnowski
9d1015b646 Revert "add option --ignore-kernel-modules"
This reverts commit 0ca3a5ee84
and removes later changes related to this commit.

Conflicts:

	dracut
	dracut.8
	modules.d/99base/install
2010-10-15 09:52:45 +02:00
Harald Hoyer
2ca35ac7ee init: symlink /dev/stdin /dev/stdout /dev/stderr 2010-10-07 19:11:11 +02:00
Amadeusz Żołnowski
4bacdf2811 99base/init: honor env. vars provided by kernel (PATH, HOME and TERM)
Let take a look at Linux sources, /usr/src/linux-2.6.35/init/main.c:

  204: char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };

  857: run_init_process("/sbin/init");

  817: static void run_init_process(char *init_filename)
  818: {
  819:        argv_init[0] = init_filename;
  820:        kernel_execve(init_filename, argv_init, envp_init);
  821: }

As we can see HOME=/ and TERM=linux are provided for init and this might be
expected on some systems (Gentoo comes to my mind, here ;-)).  That's why we
should give to init the same set of env. vars as Linux kernel does.
2010-10-01 11:38:14 +02:00
Harald Hoyer
94388aaffa init: removed bogus nop line
+    initargs="$initargs"
2010-09-23 17:45:37 +02:00
Harald Hoyer
a8a949d9e5 network: kill -9 dhclient, if normal kill does not succeed
https://bugzilla.redhat.com/show_bug.cgi?id=583348
2010-09-23 16:26:30 +02:00
Harald Hoyer
1b29b0f7cf test: double disk space for root images 2010-09-23 16:10:00 +02:00
Ian Dall
ecefdfc280 95fstab-sys: mount all /etc/fstab.sys volumes before switch_root
A new dracut module to implement fstab.sys handling

This module implements fstab.sys handling. This has to happen after the root
mount and before the nfsroot-cleanup pre-pivot at least. I've made to happen at
the beginning of the pre-pivot scripts, although it should maybe be at the end
of the mount scripts. This latter would be harder to do because the actual
mount is currently done by 99mount-root.sh and there is no 2 digit integer
higher than 99 :-(

There are perhaps other ways of achieving this end, such as having the
nfsroot-cleanup trawl through the newroot's /etc/fstab and auto-magically
figure out if there are any mounts which are pre-requisites for the
/var/lib/nfs/rpc_pipefs mount and do them first. Likewise post pivot,
/etc/rc.sysinit could figure out of there are any pre-requisite mounts for
/var/lib/stateless/{writeable,state} before doing those mounts. In short, make
it the responsibility of anything doing a mount to check if there are any
pre-requisites in /etc/fstab and mount them first. However, this spreads the
changes needed over more places, so I favour the fstab.sys approach. Also, who
knows what other uses administartors may have put fstab.sys to? and this undoes
a regression caused by the move from mkinitrd to dracut.
2010-09-22 16:50:35 +02:00
James Laska
b2dff45423 lvm: support for dynamic LVM SNAPSHOT root volume
I'm looking for a way to have a system with disposable storage that can be
rebooted and all filesystem changes are thrown away.  After reboot, the system
starts with a fresh root volume again.  The use case is for automated testing.
We run test scripts that could potentially not clean up after themselves.

This is almost like stateless, but the storage is local to the system (not
iSCSI, NFS or NBB).

1. Install Fedora 13 using default partition layout
  NOTE: modify the layout to leave extra room in the LVM volume group
2. Apply attached patch
3. Update grub.conf to enable dracut LVM snapshot support.  Add the following
boot arguments

 rd_LVM_SNAPSHOT=vg_test1055/lv_snap (note the VG name will depend on your
system).
 rd_LVM_SNAPSIZE= (optional, defaults to size of volume specified with by
rd_LVM_SNAPSHOT)

4. Adjust grub.conf and fstab to use LVM snapshot
 $ sed -i -e 's|lv_root|lv_snap|' /boot/grub/grub.conf
 $ sed -i -e 's|lv_root|lv_snap|' /etc/fstab
5. Reboot system

Expected results (no value provided for rd_LVM_SNAPSIZE):

  dracut: Starting plymouth daemon
  dracut: rd_NO_DM: removing DM RAID activation
  dracut: rd_NO_MD: removing MD RAID activation
  dracut: Removing existing LVM snapshot vg_test1055/lv_snap
  dracut: Logical volume "lv_snap" successfully removed
  dracut: No LVM snapshot size provided, using size of vg_test1055/lv_root (
9024.00m)
  dracut: Creating LVM snapshot vg_test1055/lv_snap  (  9024.00m)
  dracut: Logical volume "lv_snap" created
  dracut: Scanning devices sda2  for LVM logical volumes vg_test1055/lv_root
vg_test1055/lv_swap
  dracut: inactive Original '/dev/vg_test1055/lv_root' [8.81 GiB] inherit
  dracut: inactive '/dev/vg_test1055/lv_swap' [1.00 GiB] inherit
  dracut: inactive Snapshot '/dev/vg_test1055/lv_snap' [8.81 GiB] inherit
  dracut: Mounted root filesystem /dev/mapper/vg_test1055-lv_snap
  dracut: Loading SELinux policy
  dracut: Switching root

Expected results (rd_LVM_SNAPSIZE=100m):

  dracut: Starting plymouth daemon
  dracut: rd_NO_DM: removing DM RAID activation
  dracut: rd_NO_MD: removing MD RAID activation
  dracut: Removing existing LVM snapshot vg_test1055/lv_snap
  dracut: Logical volume "lv_snap" successfully removed
  dracut: Creating LVM snapshot vg_test1055/lv_snap  (100m )
  dracut: Rounding up size to full physical extent 128.00 MiB
  dracut: Logical volume "lv_snap" created
  dracut: Scanning devices sda2  for LVM logical volumes vg_test1055/lv_root
vg_test1055/lv_swap
  dracut: inactive Original '/dev/vg_test1055/lv_root' [8.81 GiB] inherit
  dracut: inactive '/dev/vg_test1055/lv_swap' [1.00 GiB] inherit
  dracut: inactive Snapshot '/dev/vg_test1055/lv_snap' [128.00 MiB] inherit
  dracut: Mounted root filesystem /dev/mapper/vg_test1055-lv_snap
  dracut: Loading SELinux policy
  dracut: Switching root
2010-09-22 16:39:51 +02:00
Harald Hoyer
1f9de919e0 dracut-functions: filter_kernel_modules() search in extra dirs
search also in "extra" and "weak-updates" for kernel modules
https://bugzilla.redhat.com/show_bug.cgi?id=622641
2010-09-22 16:19:11 +02:00
Harald Hoyer
0437ced41d lvm: also handle LVM1 volumes 2010-09-22 16:13:20 +02:00
Harald Hoyer
90ccb5efe7 documentation update 2010-09-22 14:33:10 +02:00
Harald Hoyer
647bef8ca6 base/init: set RDTIMESTAMP
set $RDTIMESTAMP for init, if rd.timestamp is specified on the
kernel command line, so that systemd can print out:

"systemd: Boot finished after 15s = 3s (kernel) + 2s (initrd) + 10s
(userspace)"
2010-09-20 14:58:25 +02:00
Harald Hoyer
2d9f5858bc add dracut.xml documentation 2010-09-20 14:53:51 +02:00
Harald Hoyer
5b11bb734a dracut: added --list-modules 2010-09-20 14:53:45 +02:00
Harald Hoyer
430bfefda3 lsinitrd: add "catinitrd" functionality
lsinitrd <initramfs image> [<file to cat>]
2010-09-20 14:53:45 +02:00
Harald Hoyer
3636d59e38 base/init: unset HOME and TERM for real init 2010-09-20 14:53:45 +02:00
Peter Jones
9346982f22 Be sure and get the right architecture for rsylogd modules.
I've tested this locally on 64-bit with:

dracut -a syslog -f -v foo.img `uname -r`

And I see this in the output:

I: *** Sourcing module syslog
I: Installing /sbin/rsyslogd
I: Installing /lib64/rsyslog/lmnet.so
I: Installing /lib64/rsyslog/imklog.so
I: Installing /lib64/rsyslog/imuxsock.so
I: Installing /usr/share/dracut/modules.d/98syslog/parse-syslog-opts.sh
I: Installing /usr/share/dracut/modules.d/98syslog/syslog-genrules.sh
I: Installing /usr/share/dracut/modules.d/98syslog/syslog-cleanup.sh
I: Installing /usr/share/dracut/modules.d/98syslog/rsyslogd-start.sh
I: Installing /usr/share/dracut/modules.d/98syslog/rsyslogd-stop.sh
I: Installing /usr/share/dracut/modules.d/98syslog/rsyslog.conf
2010-09-10 12:32:31 -04:00
Harald Hoyer
48d2199e94 nfs/install: fixed s/LIBDIR/libdir 2010-09-10 17:51:32 +02:00
Harald Hoyer
f8bc899063 reformat source
untabified
2010-09-10 15:55:51 +02:00
Harald Hoyer
cc02093d69 reformat source code
removed tabs and set indention to 4 spaces
added emacs and vi format headers
2010-09-10 15:34:36 +02:00
Glen Gray
d95d2f3b44 update rsyslog plugin paths
rsyslog's plugin paths moved, so correct for them.
2010-08-27 11:11:24 -04:00
Harald Hoyer
a79f11d254 plymouth: do not create hvc0
must have been a copy&paste error
2010-08-25 13:26:13 +02:00
Andrey Borzenkov
89fb4162e3 mkinitrd-dracut.sh: fix stray "fi"
Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
2010-08-23 22:32:47 +02:00
Harald Hoyer
dab1a1dc99 dmraid: switch to rd_NO_MDIMSM, if no mdadm installed 2010-08-23 14:42:33 +02:00
Andrey Borzenkov
4c77612245 bootchart module cleanup
- create /lib/bootchart in initramfs, not in live filesystem
- use proper dracut API to install files

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
2010-08-23 12:43:45 +02:00
Harald Hoyer
5acc508cae fixed "use $libdir and $usrlibdir instead of ..." 2010-08-23 12:40:15 +02:00
Harald Hoyer
f844e7dc8f manpage corrections 2010-08-23 12:22:52 +02:00
Harald Hoyer
620d031534 NEWS: fixed typo 2010-08-23 12:22:03 +02:00
Harald Hoyer
e4e3b4c821 mkinitrd: do not call dracut in host only mode 2010-08-23 12:13:48 +02:00
Harald Hoyer
094d9cae63 dm: install all md/dm* kernel modules 2010-08-23 12:13:19 +02:00
Harald Hoyer
eaa62cd541 dracut: fixed "Add support for bzip2 and xz"
s/xz/lzma/g and added manpage documentation
2010-08-23 12:06:28 +02:00
Harald Hoyer
ae24b1146b dracut: fixed "Clean up some conditional checking..." 2010-08-23 11:58:39 +02:00
Harald Hoyer
0a325a917d dracut: fixed "Shorten permission checking..." 2010-08-23 11:57:39 +02:00
Matt Smith
7254c24a76 Merged cryptroot-ask.sh from plymouth to crypt module.
First, it's duplicate code.

Second, it did not allow those who had plymouth installed to use other
methods, like the new usb key file. When building the initram,
it would install the plymouth cryptroot-ask script, and not
the crypt module one.

Added these new items to crypt module's cryptroot-ask.sh:
  - 'unset' for used variables
  - udevsettle

The non-plymouth cryptsetup prompt was using $1 instead of $device.
Changed prompt number from 1 to 5, as this is much nicer.
I believe plymouth already does infinite prompts.

Also added unset for usb key. Just saw it didn't unset its vars.
2010-08-23 11:55:11 +02:00
Amadeusz Żołnowski
55309e7800 use $libdir and $usrlibdir instead of individual detect with ldd 2010-08-23 11:55:11 +02:00
Amadeusz Żołnowski
fa5cd2bf50 dracut: lib and usr/lib dirs detection
First we check if $libdir and $usrlibdir vars are already set in config
file. If not we perform simple detect. Vars are exported - to be useful
in module/check scripts.
2010-08-23 11:54:09 +02:00
Amadeusz Żołnowski
1ad309fbc6 60xen: use 'hash' instead of 'type' 2010-08-23 11:54:09 +02:00
Amadeusz Żołnowski
f3af7bd66b use 'type' built-in instead of external cmd 'which' in every Bash script 2010-08-23 11:54:09 +02:00
Victor Lowther
5fce1ef0c9 Add a PKGBUILD file to make building on Arch Linux from a git checkout easy.
This might come in handy for anyone else trying out dracut on Arch.
2010-08-23 11:51:35 +02:00
Victor Lowther
85ab21a6e0 We are precise about hostonly checking these days.
So get rid of the comment in 90crypt/check.
Also do a bit of trivial bashification.
2010-08-23 11:51:35 +02:00
Victor Lowther
1de37e808c Trivial bashification of 00dash/install 2010-08-23 11:51:35 +02:00
Victor Lowther
b2ff4317f1 Trivial bashification and minor code rearrangement for initramfs compression. 2010-08-23 11:51:35 +02:00
Victor Lowther
690396a5b1 Prettify the option setting loop in dracut.
THis just makes the args line up all nice and pretty.
2010-08-23 11:51:34 +02:00
Victor Lowther
5bc545ed79 Bashify mkinitrd-dracut.sh, introduce read_arg.
Hack up argument processing in dracut and mkinitrd-dracut.sh to use
read_arg to flexibly process arguments.
2010-08-23 11:51:34 +02:00
Victor Lowther
644c5241d2 Bashify error() and usage() in mkinitrd-dracut.sh
Some more trivial bashification.
2010-08-23 11:51:34 +02:00
Victor Lowther
937f678ef6 Just test the status of the cpio-and-compress pipe directly. 2010-08-23 11:51:34 +02:00
Victor Lowther
5b158ad3a9 Add support for bzip2 and xz compressed initramfs images.
Current kernels know how to uncompress bzip2 and xz, so use them for compressing
the initramfs if asked.  The more compression the merrier.

Also add support for generating uncompressed images, although they
are usually not what you want.
2010-08-23 11:51:34 +02:00
Victor Lowther
afbeadb9da We have $UID, use it instead of $(id -u)
No point in spawning a command and parsing its output when the UID
is already in the environment.
2010-08-23 11:51:34 +02:00
Victor Lowther
8a4745694b Flatten our check to ensure that depmod works.
No need for a nested if here.
2010-08-23 11:51:34 +02:00
Victor Lowther
ebfdb219c6 Shorten permission checking to ensure we can actually write our initramfs.
These tests can be combined into an if... elif... elif... statement, and
that makes it clear they are all part of the same test.
2010-08-23 11:51:34 +02:00
Victor Lowther
6438b4fedf Bashify the code that actually sources out config files.
Just some trivial bashification.
2010-08-23 11:51:33 +02:00
Victor Lowther
eebc929abb Clean up some conditional checking when trying to find our config files.
No point in checking the same condition twice when compound commands will do.
2010-08-23 11:51:33 +02:00
Victor Lowther
0e4fee3d5a Get rid of unneeded dirname calls.
Use parameter expansion instead.
2010-08-23 11:51:33 +02:00
Victor Lowther
3478b3146f Trivial cleanups in dracut-functions
This is a patch series I have been playing with for awhile.

It cleans up some of the dracut code and adds a PKGBUILD file to make
it easier to use in Arch Linux.
2010-08-23 11:51:33 +02:00
Harald Hoyer
cfa5a0da6d plymouth: udev trigger with action=add 2010-08-13 11:26:34 +02:00
Harald Hoyer
c033d96e49 version inc 2010-08-09 16:28:38 +02:00
Harald Hoyer
59a232ddcd version 007 2010-08-09 16:13:51 +02:00
Harald Hoyer
01816f2bb1 NEWS: update for 007 2010-08-09 16:13:50 +02:00
Harald Hoyer
0d86614794 dracut.spec: add dracut.kernel man page 2010-08-09 16:13:45 +02:00
Harald Hoyer
8821f4109e dracut.spec: build require docbook tools 2010-08-09 16:11:22 +02:00
Harald Hoyer
783721b34b dracut.spec: remove gentoo specific modules 2010-08-09 16:06:50 +02:00
Harald Hoyer
f6c76abe8e dracut.spec s/bootchartd/bootchart 2010-08-09 16:03:47 +02:00
Harald Hoyer
41bad60c82 dracut.spec: install fedora.conf.example 2010-08-09 16:01:48 +02:00
Harald Hoyer
9c7f67a94d crypt: depend on dm 2010-08-09 13:24:08 +02:00
Amadeusz Żołnowski
26df1299cb add module gensplash 2010-08-09 13:10:04 +02:00
Amadeusz Żołnowski
1f03abefad 10i18n: --quiet for loadkeys 2010-08-09 13:10:04 +02:00
Harald Hoyer
f2db681002 plymouth: load dm_crypt module 2010-08-09 13:09:13 +02:00
Harald Hoyer
5bb59e428f Makefile: install dracut.kernel.7 2010-08-06 18:15:51 +02:00
Harald Hoyer
a1ef436531 AUTHORS update 2010-08-06 16:06:06 +02:00
Harald Hoyer
c865ecbf32 manpage update 2010-08-06 15:38:52 +02:00
Harald Hoyer
2576bec68f manpage update 2010-08-06 15:32:08 +02:00
Harald Hoyer
7c1796860f dracut: add --fstab, to ignore /proc/self/mountinfo 2010-08-06 13:54:34 +02:00
Harald Hoyer
d350ae6966 manpage xml: changed DTD to docbook 4.5 2010-08-06 13:53:24 +02:00
Amadeusz Żołnowski
9b3d462b68 dracut.kernel.7.xml: updated I18N and LUKS sections
10i18n/README: typo corrected
2010-08-06 13:36:13 +02:00
Amadeusz Żołnowski
5150d44a7e Makefile: use $(MAKE) and $(RM) instead of make and rm -f
See: http://www.gnu.org/software/make/manual/make.html#MAKE-Variable
2010-08-06 11:53:02 +02:00
Harald Hoyer
30cd3616e9 fedora.conf moved back to fedora.conf.example 2010-08-06 11:47:39 +02:00
Harald Hoyer
609d00c467 manpages: changed to UTF-8 2010-08-06 11:46:39 +02:00
Harald Hoyer
27e15000d0 manpages: add note, that host-only mode does not work in chroot() 2010-08-05 19:13:16 +02:00
Harald Hoyer
029f2691f8 dracut-functions: use /proc/self/mountinfo, instead of /proc/mounts
1. it's easier to get the major:minor
2. it's more failsafe in a chroot() (rescue CD case)
2010-08-05 18:59:51 +02:00
Andrey Borzenkov
0493f9c849 Fix ahci detection in kernel 2.6.35
Kernel 2.6.35 (may be, earlier) split ahci into libahci.ko and ahci.ko
and added ahci_platform.ko. As a result, drivers ahci and ahci_platform
do not contain any symbol that are checked for storage modules (it is
libahci.ko that references ata_scsi_ioctl now). So add additional
symbol ahci_init_controller; it seems this is expected to be called by
every driver based on libahci.ko.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
2010-08-05 18:16:37 +02:00
Harald Hoyer
3eccdb5289 manpage corrections 2010-08-05 18:12:38 +02:00
Harald Hoyer
17cb0e3fe8 dracut: let --fwdir be specified multiple times 2010-08-05 18:12:08 +02:00
Harald Hoyer
cdc8d9c403 documentation: moved to docbook man pages 2010-08-05 16:38:49 +02:00
Harald Hoyer
719cc30626 fips: udev trigger with action=add 2010-08-05 08:47:17 +02:00
Amadeusz Żołnowski
0ca3a5ee84 add option --ignore-kernel-modules
Instead of adding modprobe and rmmod, create symlinks to /bin/true to
don't produce unnecessary errors.  Anyway it's a workaround for
following desired behaviour: modprobe tries to insert module only if
it's not built into kernel
2010-08-04 18:30:03 +02:00
Andrey Borzenkov
62f8a2b63c Harden check for used modules in hostonly mode
Make sure that we do not accept module name which is substring of
some other module name. This resulted in piix being mistakenly loaded
together with ata_piix. It completely broke DVD access here.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
2010-08-04 18:30:02 +02:00
Amadeusz Żołnowski
a0342347e9 10i18n: exit if console already initialized 2010-08-04 18:30:02 +02:00
Harald Hoyer
076bab08c1 renamed 00bootchartd to 00bootchart 2010-08-04 18:27:48 +02:00
Harald Hoyer
578c24a473 dracut-functions: fixed --omit 2010-08-04 17:46:54 +02:00
Harald Hoyer
c492fe12c0 init: create /dev/.udev/rules.d with correct permissions 2010-08-02 15:58:48 +02:00
Harald Hoyer
e0c1d4e79f mkdir /dev/.udev/rules.d with mode 0755 2010-08-02 15:26:55 +02:00
Harald Hoyer
0b2ddf8f69 NEWS: update for version 007 2010-08-02 14:54:09 +02:00
Harald Hoyer
80a18b8bef manpages: updated for /etc/dracut.conf.d 2010-08-02 14:53:47 +02:00
Harald Hoyer
3a4d0c9c14 dracut-lib.sh: fixed getarg for nonexistent parameters
getarg returned an old "$val" for nonexistent parameters, because "val"
was not local
2010-08-02 14:18:00 +02:00
Harald Hoyer
3122e93350 mdraid: try to start degraded arrays in various ways 2010-08-02 14:18:00 +02:00
Harald Hoyer
21a7b84486 mdraid: remove mdadm.conf on rd_NO_MDADMCONF 2010-08-02 14:18:00 +02:00
Harald Hoyer
4b0a61c586 TEST-12-RAID-DEG: do not execute rd_NO_MDADMCONF tests 2010-08-02 14:18:00 +02:00
Harald Hoyer
cc97412c32 TEST-14-IMSM: fixed test 2010-08-02 14:17:59 +02:00
Harald Hoyer
aceaf13b44 TEST-13-ENC-RAID-LVM: prepend "luks-" to rd_LUKS_UUID argument 2010-08-02 14:17:59 +02:00
Harald Hoyer
d7cc3f2ef5 mdraid: remove "local" 2010-08-02 14:17:59 +02:00
Harald Hoyer
db3641a2ea init: set old umask before switch_root 2010-08-02 14:17:59 +02:00
Harald Hoyer
8e102a2487 crypt: fix printf 2010-08-02 14:17:58 +02:00
Harald Hoyer
4c2d8f5816 TEST-12-RAID-DEG: double disk space 2010-08-02 14:17:58 +02:00
Harald Hoyer
d6351b36b8 i18n: only source config files, if present 2010-08-02 14:17:58 +02:00
Harald Hoyer
d752c51b90 mdraid: --no-degraded not allowed with -I 2010-08-02 14:17:58 +02:00
Harald Hoyer
f007e84e8e dracut-functions: fix check=255 logic and dependencies 2010-08-02 14:17:52 +02:00
Harald Hoyer
9c111e59c9 TEST: omit network module for non-network tests 2010-08-02 10:35:31 +02:00
Harald Hoyer
4754226a1a dracut: let some arguments add up
Specifying multiple -a, -o, -m, -d, --add-drivers, --filesystems now
adds up.
2010-08-02 10:35:31 +02:00
Harald Hoyer
606852a4a6 crypt: loop until all non-busy crypt devs closed 2010-08-02 09:59:10 +02:00
Harald Hoyer
8220945b2c debug: add fsck to debug module 2010-08-02 09:39:49 +02:00
Harald Hoyer
6292ee9d18 dracut: use hardlink, if available to safe some space 2010-08-02 09:39:13 +02:00
Harald Hoyer
dd2c34a82b version pre 7 2010-08-02 09:00:01 +02:00
Harald Hoyer
1246703bb4 dracut.spec: redhat-i18n -> i18n 2010-08-02 09:00:00 +02:00
Harald Hoyer
d2a535855b dracut.spec: add bootchartd 2010-08-02 08:59:14 +02:00
Harald Hoyer
ddd109bdf9 dracut.spec: add dracut.conf.d/fedora.conf 2010-08-02 08:19:54 +02:00
Harald Hoyer
3f62b2637c crypt: strip "luks-" from rd_LUKS_UUID 2010-07-29 16:35:31 +02:00
Harald Hoyer
08852c50b9 removed redundant 64-lvm.rules install
Thanks to Amadeusz Żołnowski, who found it.
2010-07-28 14:09:28 +02:00
Harald Hoyer
bb7645459e dracut-functions: fix "-m -a" handling 2010-07-27 11:51:27 +02:00
Harald Hoyer
e5c6cb2a8c crypt: remove emergency source of dracut-lib.sh 2010-07-23 12:26:42 +02:00
Harald Hoyer
3272ed884f fcoe: add sleeps to fcoe-up 2010-07-23 12:20:32 +02:00
Harald Hoyer
3ad4f77cef lvm: wait for all rd_LVM_LV and rd_LVM_VG specified to appear 2010-07-23 12:16:11 +02:00
Harald Hoyer
e001359311 mknod with mode and set umask for the rest 2010-07-23 11:30:45 +02:00
Harald Hoyer
dcdca91d91 btrfs: add hostonly check 2010-07-21 14:31:13 +02:00
Harald Hoyer
6baa63110e 10i18n: fixed i18n_vars parsing
gather_vars() should replace "every" occurance of the seperator
2010-07-21 14:21:47 +02:00
Harald Hoyer
93ad8c19bb selinux: fixed error handling for load-policy
{} | cmd opens a subshell for {}
2010-07-21 13:44:03 +02:00
Amadeusz Żołnowski
2926b5b35d 90crypt: keys on external devices support
99base/dracut-lib.sh: new fun.: getoptcomma, foreach_uuid_until
2010-07-21 13:38:47 +02:00
Amadeusz Żołnowski
76514565c0 10i18n: README corrected 2010-07-21 13:38:46 +02:00
Amadeusz Żołnowski
bd324b9d94 README for 10i18n module 2010-07-21 13:38:46 +02:00
Amadeusz Żołnowski
a10a1416c1 dracut-functions: additional symlinks for library files
rev_lib_symlinks: it's new
inst_library: creating additional symlinks for installed library files
2010-07-21 13:38:46 +02:00
Harald Hoyer
e13918d24a bootchartd: do not enable bootchartd by default
users can always add "-a bootchartd" on image creation or add it
to /etc/dracut.conf.d/myconf.conf
2010-07-21 13:37:23 +02:00
Frederic Crozat
466f36159d bootchartd support
add preliminary bootchard support

Signed-off-by: Maarten Vanraes <maarten.vanraes@gmail.com>
2010-07-21 13:33:43 +02:00
Andrey Borzenkov
2245f3723b conffile before confdir
conffile should be sourced before confdir

Signed-off-by: Maarten Vanraes <maarten.vanraes@gmail.com>
2010-07-21 13:33:35 +02:00
Harald Hoyer
dde97b301f dracut: fixed stripping of kernel modules 2010-07-20 11:24:37 +02:00
Harald Hoyer
6f9d69c95a multipath: install by default, but run only if wwids are present 2010-07-20 11:23:14 +02:00
Harald Hoyer
adde3a7a27 dracut-lib.sh: getarg() returns the value of the last argument
a=0 a=1 a=2
$(getarg a) == "2"
2010-07-12 18:52:44 +02:00
Harald Hoyer
ed61aae141 cryptroot-ask: s/getargs rd_NO_CRYPTTAB/getarg rd_NO_CRYPTTAB/g 2010-07-12 18:47:08 +02:00
Harald Hoyer
26257a5cf4 dracut.conf.d/fedora.conf: created 2010-07-12 16:33:14 +02:00
Harald Hoyer
0e1d2c3efa 10i18n: fixed directory check logic 2010-07-12 16:32:32 +02:00
Harald Hoyer
b8a2f174d7 TEST-13-ENC-RAID: add check for rd_LUKS_UUID argument parsing 2010-07-12 16:16:57 +02:00
Harald Hoyer
e9ef52b460 crypt: wait for all rd_LUKS_UUID disks to appear
Also give a hint in emergency, if one disk is not found.
2010-07-12 16:16:39 +02:00
Harald Hoyer
3a4989cae2 dracut-lib: export RDDEBUG 2010-07-12 15:33:44 +02:00
Harald Hoyer
ecee64bffa crypt/parse-crypt.sh: fix end label for luks udev rules 2010-07-12 14:43:11 +02:00
Harald Hoyer
540eb97162 crypt: removed default 70-luks.rules 2010-07-12 14:33:43 +02:00
Harald Hoyer
013986a8ad crypt: assemble 70-luks.rules dynamically 2010-07-12 14:31:21 +02:00
Harald Hoyer
a0af4fa5ea dracut.spec: removed duplicate COPYING 2010-07-09 11:19:57 +02:00
Harald Hoyer
5cae1fe179 plymouth: depend on crypt, if cryptsetup exists 2010-07-09 11:19:32 +02:00
Harald Hoyer
91bb250aed dmsquash-live: do not umount /dev/.initramfs/live for cdrom_id to work 2010-07-09 11:18:31 +02:00
Harald Hoyer
40d69001ac dm: load dm_mod if device-mapper not in /proc/misc 2010-07-08 16:18:09 +02:00
Harald Hoyer
06f91665df dmsquash-live: depend on dm module 2010-07-08 16:14:55 +02:00
Harald Hoyer
8442b51e20 i18n: now on by default and removed redhat-i18n 2010-07-07 11:21:38 +02:00
Harald Hoyer
e9a9c8bb7e fcoe: moved fcoeup to initqueue (udev timeouts) 2010-07-07 11:20:27 +02:00
Harald Hoyer
847b618b4c dmsquash-live: mount live image at /dev/.initramfs/live 2010-07-06 10:19:02 +02:00
Amadeusz Żołnowski
fd2312e03d dracut-functions: cosmetic changes to inst_rules 2010-07-06 10:19:02 +02:00
Amadeusz Żołnowski
5f70a1bd06 dracut-functions: info which udev rules are skipped
I found it useful.  Maybe help others debugging.
2010-07-06 10:19:01 +02:00
Amadeusz Żołnowski
876bd1a2be dracut: info which module is sourced; updated dracut usage
Added description for --confdir.
2010-07-06 10:19:01 +02:00
Amadeusz Żołnowski
87122afcda add module i18n
dracut-functions: added functions: mksubdirs, inst_decompress,
                  inst_opt_decompress and print_vars

dracut.conf.d: added configuration files for Gentoo and RedHat/Fedora
2010-07-06 10:18:30 +02:00
Harald Hoyer
78cd3b9824 dracut.spec: dracut-network needs vconfig for fcoe 2010-06-25 12:06:19 +02:00
Harald Hoyer
185468f57d dmsquash, resume: do not name the /dev/.udev/rules like the /etc ones 2010-06-25 11:42:51 +02:00
Harald Hoyer
45b5a4e142 dracut-functions: use LC_ALL=C rather than LANG=C 2010-06-22 11:59:49 +02:00
Harald Hoyer
e4ebd474ec dracut-functions: set LANG=C for ldd output parsing 2010-06-22 10:32:25 +02:00
Harald Hoyer
ae5ec68355 Write rules for symlinks to /dev/.udev/rules.d for later usage
We want some symlinks to persist in the real root, so we write them to
/dev/.udev/rules.d, that they survive a retrigger.
2010-06-22 10:30:39 +02:00
Harald Hoyer
95c1941ce5 crypt: add fpu kernel module 2010-06-21 20:47:01 +02:00
Harald Hoyer
59a083d8d1 fips: fixes copy&paste error for "check" 2010-06-18 12:52:52 +02:00
Harald Hoyer
be217dc4d4 dracut.8: changed IPv6 addresses to the documentation address space 2010-06-17 17:14:09 +02:00
Harald Hoyer
e8e4b28dfa dracut.8: add note about putting IPv6 addresses in brackets 2010-06-17 17:03:38 +02:00
Harald Hoyer
1c894acb42 fixed "ip=dhcp6" 2010-06-17 16:25:28 +02:00
Harald Hoyer
7d86d90d11 Version 006 2010-06-17 10:58:27 +02:00
Harald Hoyer
532b8c7a43 dracut.spec: moved znet to dracut-network 2010-06-17 10:46:29 +02:00
Amadeusz Żołnowski
22ecea456b dracut, dracut-functions: better vercmp
credits go to V. Lowther
2010-06-17 09:43:16 +02:00
Harald Hoyer
5f927f201d network: strip pxelinux hardware type field from BOOTIF 2010-06-11 13:16:36 +02:00
Harald Hoyer
b48d98dda3 crypt: install more aes modules 2010-06-11 12:52:16 +02:00
Harald Hoyer
4eab305062 network: depend on ifcfg, if /etc/sysconfig/network-scripts exist 2010-06-10 13:52:31 +02:00
Harald Hoyer
edcd2c5eb7 lvm: install lvm mirror and snaphot libs 2010-06-10 13:51:40 +02:00
Amadeusz Żołnowski
2c24ee9a72 dracut-functions: fun. vercmp optimized; credits go to Victor Lowther 2010-06-09 17:36:02 +02:00
Harald Hoyer
169f167151 iscsi: add support for multiple netroot=iscsi:
The whole netdisk concept should be reviewed though!
2010-06-09 16:46:33 +02:00
Harald Hoyer
08e10f05f6 plymouth/cryptroot-ask.sh: beautify password prompt 2010-06-09 11:56:06 +02:00
Harald Hoyer
bd987e3036 selinux: move selinux to a separate module 2010-06-09 11:22:22 +02:00
Amadeusz Żołnowski
be0921a413 90crypt: 'crypto_LUKS' identifier corrected 2010-06-09 11:04:02 +02:00
Amadeusz Żołnowski
f01d965f0e 95uswsusp: Gentoo path for 'resume' binary 2010-06-09 10:46:38 +02:00
Amadeusz Żołnowski
ecf42850c3 Support old version of module-init-tools
modprobe included in version prior to 3.7 of module-init-tools doesn't
have -d | --dirname option which allows to give a prefix other than
'/' for kernel modules path. Dracut assumes existence of that
option and uses it even with default '/'. The patch passes -d option
only if it's different from default and also checks module-init-tools
version if user changes the prefix by --kmoddir Dracut option.
2010-06-09 10:46:38 +02:00
Victor Lowther
2974f382f8 Have cryptroot-ask load dm_crypt if needed. 2010-06-09 10:46:38 +02:00
Victor Lowther
6a4f980921 Just look for cryptroot instead of /sbin/cryptroot
We know what the path is and what it contains in the initrd, and
not everyone puts cryptroot in /sbin
2010-06-09 10:46:38 +02:00
Victor Lowther
5a4bbf1bda Arch handles loading modules from udev in a somewhat customized manner. 2010-06-09 10:46:38 +02:00
Harald Hoyer
123e24a3b5 multipath: remove multipath udev rules, if no multipath.conf was found 2010-05-27 14:34:02 +02:00
Harald Hoyer
dcdf5c8801 multipath: simplify and install wwids (rhbz 595719)
install /etc/multipath/wwids

With the proper 40-multipath.rules and new udev device-mapper mechanism,
we don't need the multipath scan anymore.

rhbz#595719
2010-05-27 14:19:11 +02:00
Harald Hoyer
ed8c7bf5c2 dracut-functions: beautified warnings 2010-05-26 17:43:18 +02:00
Harald Hoyer
70503db416 dracut-functions: check if specific dracut module is missing 2010-05-26 17:42:57 +02:00
Harald Hoyer
a2929f90ff selinux-loadpolicy.sh: exit for "selinux=0" 2010-05-19 10:01:33 +02:00
Harald Hoyer
9cdde06d50 Makefile: make more clean 2010-05-19 09:55:48 +02:00
Harald Hoyer
b6a7c09070 chmod 0755 *.sh 2010-05-19 09:40:48 +02:00
Harald Hoyer
680ac04370 95znet: removed 55-ccw.rules and ccw_init 2010-05-19 09:39:36 +02:00
Harald Hoyer
e54a84113e get rid of rdnetdebug
set PS4 and output to /dev/initlog.pipe
2010-05-19 09:38:09 +02:00
Harald Hoyer
91d8394093 95fcoe/fcoe-up: wait_for_if_up 2010-05-19 09:36:11 +02:00
Harald Hoyer
e02c2d5c43 TEST-50-MULTINIC: do not provide a cdrom in the testcase 2010-05-19 09:35:01 +02:00
Harald Hoyer
7c0aa2a2ea 40network/ifup: be more verbose 2010-05-19 09:33:58 +02:00
Harald Hoyer
9ab1426534 40network/dhclient-script: be more verbose 2010-05-19 09:33:20 +02:00
Harald Hoyer
647035f9aa 40network/parse-ip-opts.sh: add "ip=auto6" to valid options 2010-05-19 08:29:05 +02:00
Andy Lutomirski
a3afcf2a5a 90mdraid dracut-functions: fix md raid hostonly detection
check_block_and_slaves looks at slaves but not parents.
2010-05-19 08:13:12 +02:00
Harald Hoyer
7e33fa5b52 dracut.spec: clean up the requirements 2010-05-07 11:04:23 +02:00
Harald Hoyer
d0ced35fc6 dracut: get rid of the "file" command 2010-05-07 11:03:55 +02:00
Harald Hoyer
a8ca68a91e plymouth/plymouth-populate-initrd: get rid of awk 2010-05-07 11:02:31 +02:00
Harald Hoyer
5be225d299 use "grep" directly without "nm" to drop binutils requirement 2010-05-07 10:44:30 +02:00
Harald Hoyer
a8a103e093 dracut.spec: remove elfutils-libelf requirement 2010-05-07 10:16:03 +02:00
Harald Hoyer
d7a272a95e plymouth: only display luksname and device for multiple luks
https://bugzilla.redhat.com/show_bug.cgi?id=561092
2010-05-06 17:32:34 +02:00
Alexander Todorov
c198a4bc8c dracut.8: fix rd_LVM_LV description 2010-05-06 16:58:51 +02:00
Harald Hoyer
13289be133 fcoe: add /sbin/vconfig and the 8021q kernel module 2010-05-06 16:23:46 +02:00
Harald Hoyer
3df3a99759 znet: renamed rd_CCW to rd_ZNET
but parse old rd_CCW anyway
2010-05-05 12:54:04 +02:00
Dan Horák
270ba358fa znet: use ccw-init and ccw rules from s390utils in dracut 2010-05-05 12:51:46 +02:00
Harald Hoyer
d87c2708ec dracut.conf: use "+=" as default for config variables 2010-05-03 11:35:10 +02:00
Harald Hoyer
d8b9844c61 dracut-functions: use udevadm to get ID_FS_* 2010-05-03 11:34:30 +02:00
Harald Hoyer
1d323cd938 kernel-modules: add more hardcoded modules 2010-05-03 11:33:52 +02:00
Harald Hoyer
8f74a60ced btfrs: load btrfs module and updated NEWS 2010-04-16 18:10:47 +02:00
Matt
127fb81754 Needs btrfsctl, not btrfs module 2010-04-16 18:03:08 +02:00
Harald Hoyer
ebcfda6c61 test/NBD: check for nbd kernel module first 2010-04-16 17:59:51 +02:00
Harald Hoyer
bdcb63b0e6 NEWS: update 2010-04-16 17:59:51 +02:00
Harald Hoyer
8f4c066020 test/MULTINIC: kill server after passing all tests 2010-04-16 17:59:51 +02:00
Harald Hoyer
1fca65c576 dracut.spec: removed e2fsprogs requirement 2010-04-16 17:59:51 +02:00
Harald Hoyer
da4e644327 test/TEST-50-MULTINIC: install sd_mod and ata_piix kernel modules 2010-04-16 17:59:51 +02:00
Harald Hoyer
c5ef4b63a3 test/TEST-50-MULTINIC: install all nfsidmap libs for server 2010-04-16 17:59:50 +02:00
Harald Hoyer
6c980807d0 test/TEST-50-MULTINIC: kill server after failed test 2010-04-16 17:59:50 +02:00
Harald Hoyer
97add1b383 NBD: kill server after failed test 2010-04-16 17:59:50 +02:00
Harald Hoyer
3de984ba7f test/nfs: correct return code and cleanup 2010-04-16 17:59:50 +02:00
Harald Hoyer
85fd75f91f add rd_retry kernel command line parameter
rd_retry=<seconds to retry in the main loop>

speeds up internal test suite
2010-04-16 17:59:50 +02:00
Harald Hoyer
0c88742669 test: change testsuite to local tcp rather than udp multicast
multicast needs an ethernet device and correct firewall rules
the loopback interface suites better as we only have 2 machines
2010-04-16 17:59:49 +02:00
Harald Hoyer
709302e3cc run-qemu: add /usr/libexec/qemu-kvm to search 2010-04-16 17:59:49 +02:00
Harald Hoyer
3e96d7aa33 TEST-12-RAID-DEG/create-root: filter MD_UUID only 2010-04-16 17:59:49 +02:00
Harald Hoyer
3409c2377f loginit: turn off debugging 2010-04-16 17:59:49 +02:00
Harald Hoyer
4058d85cb6 init: do not redirect to - 2010-04-16 17:59:49 +02:00
Harald Hoyer
2937028c54 init: fix cdrom polling loop 2010-04-16 17:59:49 +02:00
Harald Hoyer
56f184310a mdraid: try to start container childs manually with "mdadm -R" 2010-04-16 17:59:48 +02:00
Harald Hoyer
1d149cd039 dracut-lib: turn of shell debug mode in strstr and getarg(s) 2010-04-16 17:59:48 +02:00
Harald Hoyer
dafa4f621f udev-rules: be more careful about md devices and blkid runs 2010-04-16 17:59:48 +02:00
Harald Hoyer
0679a6d24e nfs: add missing nfsidmap libs 2010-04-16 17:59:48 +02:00
Harald Hoyer
8ded2a65c0 network: correct rules for multiple nics 2010-04-16 17:59:48 +02:00
Harald Hoyer
400723054c network: removed bogus udev rules 2010-04-16 17:59:48 +02:00
Harald Hoyer
7f00669875 nfs: fixed nsswitch.conf parsing
based on a patch of Ian Dall.
https://bugzilla.redhat.com/show_bug.cgi?id=578060
2010-04-15 16:26:06 +02:00
Ville Skyttä
c91570782c Use pigz for gzipping if available. 2010-04-15 14:46:48 +02:00
Harald Hoyer
fede5bbcda dracut.spec: add btrfs module 2010-04-15 14:38:38 +02:00
Harald Hoyer
e9e93e2ec6 kernel-modules: only remove ocfs2, if all filesystems are installed 2010-04-15 12:47:52 +02:00
Harald Hoyer
d4abad2288 kernel-modules: hardcode sr_mod 2010-04-15 12:47:26 +02:00
Harald Hoyer
ddbdebb9c8 AUTHORS: updated 2010-04-15 11:54:28 +02:00
Harald Hoyer
4828beb949 dracut: add_drivers from the command line should add up to the conffile 2010-04-14 19:32:44 +02:00
Harald Hoyer
9b17b085f3 manpage addition for kernel drivers
The kernel modules have to be specified without the ".ko" suffix.
2010-04-14 17:58:56 +02:00
Harald Hoyer
d293133982 add missing paragraph for --add-drivers 2010-04-14 17:50:39 +02:00
Harald Hoyer
cd83e4c54d init: trigger with --action=add 2010-04-14 16:36:30 +02:00
Joey Boggs
fbf1b5b138 teach dmsquash-live-root to use rootflags 2010-04-13 16:02:10 +02:00
Harald Hoyer
58ffd15bff add module btrfs 2010-04-13 15:22:36 +02:00
Harald Hoyer
0e0bf83057 init: add hacky cdrom polling mechanism 2010-04-13 13:51:49 +02:00
Harald Hoyer
d693f34afb dmraid: parse different error messages 2010-04-13 12:54:12 +02:00
Harald Hoyer
d1bae3cd17 dracut.8: add information, which parameter can be specified multiple times 2010-04-13 12:53:41 +02:00
Harald Hoyer
7ea25f3a34 dracut.8: fixed LUKS paragraph 2010-04-13 12:53:36 +02:00
Harald Hoyer
e876763655 updated NEWS, moved tag 005 2010-03-19 17:35:47 +01:00
Harald Hoyer
ab56546dc7 version 005 2010-03-19 16:51:05 +01:00
Harald Hoyer
3592d8683b dracut.spec: rpmlint cosmetics 2010-03-19 16:51:05 +01:00
Harald Hoyer
c55b20803a dracut.spec: change description and summaries 2010-03-19 16:51:05 +01:00
Harald Hoyer
7095aab4a2 dracut.spec: remove libselinux, libsepol requirement 2010-03-19 16:51:05 +01:00
Harald Hoyer
8ef5ade737 dracut.spec: remove dracut-kernel subpackage 2010-03-19 16:51:05 +01:00
Harald Hoyer
b3561ee15f lvm/lvm_scan.sh: silence lvm version check 2010-03-19 16:51:05 +01:00
Harald Hoyer
16b046d5da fcoe: soft install fcoe bins 2010-03-19 16:51:04 +01:00
Hans de Goede
37b14e7295 Add dcb support to dracut's FCoE support (rh563794)
Note that there are still some patches queued upstream for fcoe-utils to
enable it to work with the new lldpad and to add support to fipvlan to
bring up FCoE connections without requiring fcoemon to run.

The invocations of the various tools as in this patch should be final though,
see the discussion in:
http://bugzilla.redhat.com/show_bug.cgi?id=563794

This is the second revision of this patch, which no longer adds /etc/fcoe
to the initrd as that is not needed.
2010-03-19 15:03:21 +01:00
Mike Snitzer
f6458b80ef lvm_scan: use '--ignoremonitoring' rather than '--monitor n'
lvchange and vgchange '--monitor n' will not prevent lvm from
attempting to dlopen the libdevmapper-event library.

dracut git commit 47ab3b6c5e introduced the use of '--monitor n' but
'--ignoremonitoring' is needed now that the libdevmapper-event library
isn't copied into the initramfs (ever since 0fae59d6eb)

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
2010-03-17 11:59:38 +01:00
Harald Hoyer
3b0f71921d kernel-modules/installkernel: force install some modules even in
hostonly mode
2010-03-17 11:50:18 +01:00
Luca Berra
df54ef1390 silence xen-detect detection
Signed-off-by: Luca Berra <bluca@comedia.it>
2010-03-17 11:50:18 +01:00
Philippe Seewer
16add2aac7 debian: add dracut-gencmdline 2010-03-05 15:01:18 +01:00
Philippe Seewer
501cc2458c debian: Add manpage for dracut-catimages 2010-03-05 14:58:59 +01:00
Philippe Seewer
ee7eb10523 debian: add dracut.conf.d 2010-03-05 14:55:37 +01:00
Philippe Seewer
232c082cbc debian: Add xen and uswsusp modules 2010-03-05 11:57:14 +01:00
Philippe Seewer
58659bf221 xen: try harder to locate xen-detect
On debian systems xen-detect does not resite somewhere in $PATH,
but under /usr/lib/xen-default/bin. This patch ensures that this
is searched as well when locating and installing xen-detect.
2010-03-05 11:51:56 +01:00
Philippe Seewer
8a08012764 test: use ldconfig processing for roots as well 2010-03-05 11:42:04 +01:00
Harald Hoyer
fdc421dbac dracut: move ldconfig after include 2010-03-05 11:14:28 +01:00
Harald Hoyer
70aaa95d52 dracut: do a full ldconfig in the initramfs 2010-03-05 11:07:10 +01:00
Harald Hoyer
80a6943fc4 ifcfg: set mode 0755 for scripts 2010-03-04 18:03:36 +01:00
Harald Hoyer
72011255e0 rpmversion/install: add shebang 2010-03-04 18:02:27 +01:00
Harald Hoyer
de50046cd7 dmsquash-live-root: use blockdev with --getsz
Thanks Karel for pointing this out.. again :)
2010-03-04 16:49:51 +01:00
Harald Hoyer
e606012ce6 udev-rules: hotplug.functions is not executable, so use -e instead of -x 2010-03-04 14:21:56 +01:00
Andrey Borzenkov
b63fd4d905 Pass init argument(s) to real init
Common wisdom to enter single user on Linux is to edit command
line and add "single". This was not possible because switch_root
was always called with empty init arguments. Collect them from
command line and pass to real init when switching root.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
2010-03-04 14:06:48 +01:00
Andrey Borzenkov
01b8cdffca Fix boot with user suspend and no resume= kernel argument
Mandriva bug https://qa.mandriva.com/show_bug.cgi?id=57924. Check
if dracut got resume= argument before calling /usr/sbin/resume
2010-03-04 14:06:48 +01:00
Harald Hoyer
aab70adc0b dmsquash-live: use --getsize64 instead of --getsize 2010-03-04 14:06:48 +01:00
Joey Boggs
7baade2b87 add readonly overlay support for dmsquash
Adds the readonly_overlay karg for cases where the dm snapshot should be set to readonly. Use case would be a livecd that is configured to have a readonly root where filling up the dm snapshot would cause a problem.
2010-03-04 14:06:47 +01:00
Harald Hoyer
b686095f99 udev-rules: choose between several firmware upload tools
debian: firmware.agent hotplug.functions
old fedora: firmware.sh
new udev upstream: firmware
2010-03-04 14:06:47 +01:00
Harald Hoyer
a56e93c10c kernel-modules: add keyboard kernel modules 2010-03-04 14:06:46 +01:00
Philippe Seewer
465f223905 fix permissions: should be +x 2010-03-03 17:29:39 +01:00
Philippe Seewer
3121677949 parse-kernel.sh must have a shebang 2010-03-03 17:29:26 +01:00
Philippe Seewer
a65914b4a2 debian: update Standards-Version 2010-03-03 16:49:10 +01:00
Philippe Seewer
cff621603c debian: dracut package should at least suggest dracut-network 2010-03-03 16:48:43 +01:00
Philippe Seewer
259872feac debian: complete s/dracut-net/dracut-network/g
When changing package names, corresponding files must be renamed
as well.
2010-03-03 16:48:16 +01:00
Peter Jones
43f2533977 Use multipath if it's installed and being used for the root fs.
Don't conditionalize on hostonly; use multipath if it's installed and in
use.
2010-02-25 10:24:14 -05:00
Harald Hoyer
454771cd86 dracut: add check, if we can write to the output image file 2010-02-18 18:27:39 +01:00
Harald Hoyer
0ec519f8a4 mount-root: also filter "defaults" from mount options 2010-02-18 18:05:51 +01:00
Harald Hoyer
d793fc2e8b mount-root: skip comments 2010-02-18 17:46:01 +01:00
Harald Hoyer
26999d6ddb dracut: removed "local" not inside of function 2010-02-18 17:28:41 +01:00
Harald Hoyer
9232cab470 fix IFS restoring 2010-02-18 09:46:19 +01:00
Harald Hoyer
a15935c143 selinux: fix "selinux=0" handling 2010-02-18 08:46:57 +01:00
Harald Hoyer
11ce36d78e mount-root: do not pollute init arguments
and do not remount if no new rootopts set in /etc/fstab
2010-02-17 20:18:10 +01:00
Harald Hoyer
4819ae98ac fix lib64 check
on ppc we can have libc in /lib64/power6/
2010-02-17 17:02:04 +01:00
Harald Hoyer
8c8cd69d32 s390: *_cio_free needs "seq" 2010-02-15 18:08:11 +01:00
Harald Hoyer
7800cc247e fix selinux disabled state
Execute load-policy when the config file contains SELINUX=disabled.
2010-02-15 12:58:00 +01:00
Harald Hoyer
21a74b32b2 nfs4: rpc.idmapd does not accept parameters anymore
modify /etc/idmapd.conf instead
2010-02-15 10:43:51 +01:00
Harald Hoyer
1cf0b1750b removed cdrom hack for live CDs
The hack does not work reliable for CDROMs with the firmware bug.
We have really to fix cdrom_id.
2010-02-15 09:55:20 +01:00
Harald Hoyer
94d2148707 dracut.conf: added add_dracutmodules 2010-02-12 12:19:33 +01:00
Harald Hoyer
2c2c45800c add /etc/dracut.conf.d 2010-02-12 11:12:37 +01:00
Harald Hoyer
edb511860c Fixed: Move multipath scan earlier. It must go before any other dm rules.
Also changed the filename in the install file.
2010-02-12 11:00:21 +01:00
Harald Hoyer
a39ea24f10 nfs: suppress error message about missing passwd 2010-02-10 18:54:31 +01:00
Harald Hoyer
93bc3d440c make nfs4 work 2010-02-10 17:21:46 +01:00
Peter Jones
7e22ab0891 Move multipath scan earlier. It must go before any other dm rules.
multipath scan needs to go before lvm, or else lvm may grab the device
multipath would activate, and multipath will be unable to claim it.
2010-02-05 14:23:20 -05:00
Harald Hoyer
c98bcec89c add preliminary IPv6 support 2010-02-04 16:05:19 +01:00
Harald Hoyer
b456ab777d zfcp: install s390utils script rather than local one 2010-02-04 16:03:35 +01:00
Harald Hoyer
d43036ffeb rootfs-block: strip "ro|rw" options from fstab options
https://bugzilla.redhat.com/show_bug.cgi?id=560424
2010-02-03 17:24:51 +01:00
Harald Hoyer
54aaad9dad test/iSCSI: fixed test script 2010-02-03 16:42:43 +01:00
Harald Hoyer
c88b219410 dasd_mod: changed prio of cmdline hook to be executed after dasd 2010-02-03 10:17:58 +01:00
Harald Hoyer
bab749e23e init: dashified $[] -> $(()) 2010-02-02 15:21:51 +01:00
Harald Hoyer
d54a0e5ae8 beautified man pages 2010-02-02 15:11:59 +01:00
Harald Hoyer
4dc4cc3fc6 fixed permissions for the check files 2010-01-27 16:11:19 +01:00
Peter Jones
3d45f9bba9 Add a check file for multipath.
If multipath isn't installed, don't use it.  If we're in hostonly mode,
only install the multipath module if it's used for / .  Otherwise, if
the user was dumb enough to install it, they get it during bootup.
2010-01-27 16:10:43 +01:00
Harald Hoyer
97c97ff6d5 base: fix selinux handling if .autorelabel is present
rhbz#557744
2010-01-27 16:09:15 +01:00
Harald Hoyer
d8231fa5c2 mdraid: prefer /etc/mdadm.conf over /etc/mdadm/mdadm.conf
see https://bugzilla.redhat.com/show_bug.cgi?id=557339
https://bugzilla.redhat.com/show_bug.cgi?id=559073
2010-01-27 15:59:10 +01:00
Harald Hoyer
5db587d7c1 init: fixed emergency_shell argument parsing 2010-01-20 16:04:55 +01:00
Harald Hoyer
3ee26913e7 version 004 2010-01-15 14:09:06 +01:00
Harald Hoyer
4bb570c9a4 dracut-lib: do not leave debug mode in getarg and getargs 2010-01-15 14:07:54 +01:00
Harald Hoyer
0e8b76a57e test: remove lvm.conf in create-root.sh 2010-01-15 12:58:46 +01:00
Harald Hoyer
2dfdcbf4e7 dracut-lib: read multiple lines from $init/etc/cmdline 2010-01-15 12:33:41 +01:00
Harald Hoyer
1b3bdcc1a6 dracut.spec: only obsolete for rhel >= 6 and fedora > 12
and do not provide lsinitrd and mkinitrd
2010-01-15 10:28:44 +01:00
Warren Togami
dc5bb506ff dracut.spec: nbd is Fedora only 2010-01-14 18:11:52 +01:00
Harald Hoyer
074d12c1fa add lsinitrd 2010-01-14 17:20:43 +01:00
Harald Hoyer
80deff7c4b lvm: remove lvm-cleanup 2010-01-14 17:04:06 +01:00
Harald Hoyer
b7b6c6e1c6 test: remove lvm.conf in create-root.sh 2010-01-14 17:02:18 +01:00
Munehiro Matsuda
651f3f3d1a dmsquash: add support for loopmounted *.iso files
https://bugzilla.redhat.com/show_bug.cgi?id=548283
2010-01-14 16:47:16 +01:00
Harald Hoyer
0bc4ef1caf dracut.spec: update plymouth requirements 2010-01-14 15:54:17 +01:00
Harald Hoyer
dc0a0f6c93 lvm: add rd_LVM_LV and "--poll n" 2010-01-13 17:59:14 +01:00
Harald Hoyer
63d8d27b03 install lsinitrd/mkinitrd 2010-01-13 17:13:20 +01:00
Harald Hoyer
dc40ea7fa1 crypt/dm: move dmeventd to dm module 2010-01-13 16:33:40 +01:00
Mike Snitzer
0fae59d6eb lvm: lvm.conf (locking_type = 4)
- the use of sed is placeholder "hack" until lvm2 provides a proper
  tool for changing lvm.conf
- lvm_scan.sh should run lvm commands with --ignorelockingfailure to
  re-use lvm's existing initrd-specific logic; future lvm2 changes
  will split this flag out into various new command-line switches
- no monitoring should be started from within initramfs
- NOTE: the same should apply to 90dmraid/install
- the correct types would be: '[ "blkext", 1 , "cciss0", 16 ]'
  but lvm2 (>= 2.02.52) already properly supports both 'blkext' and
  'cciss' (including cciss0 -> cciss7)
2010-01-13 16:29:12 +01:00
Andrey Borzenkov
5c7821b6c5 Add user suspend support
This patch adds support for user mode suspend to disk. It is installed
in parallel to kernel mode suspend module; either will fail if
system was not suspended using correct tool so next one can be tried.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
2010-01-13 16:08:22 +01:00
Luca Berra
f5745ec58b Ensure UNICODE keyboard layout is functional in emergency shell
/lib/udev/cosole_init will load either non-unicode or unicode versions
of keyboard layout for the same value of KEYMAP depending on language
setting. The simplest solution is to install both versions in initrd;
it does not take much space.

While on it, copy some additional maps to ensure emergency shell
has the same keyboard layout as full system.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
Signed-off-by: Luca Berra <bluca@vodka.it>
2010-01-13 16:06:11 +01:00
Luca Berra
b21d5cb2dc add mkinitrd-dracut.sh wrapper
a wrapper around dracut with the syntax from mkinitrd, could
help transition to dracut.
2010-01-13 16:03:32 +01:00
Luca Berra
74c5dd2158 dracut-functions: add additional drivers in host-only mode, too
this makes dracut load kernel module specified in add-drivers even
if building an host-only mkinitrd, it is useful in cases where we
might change some storage drivers and still don't want to build
an enormous initrd (e.g. ahci/ata_piix)
2010-01-13 16:02:10 +01:00
Luca Berra
b5664d5d02 base: improve emergency shell
for some unknown reason the emergency shell
starts with stderr closed, at first I even tought it was not working at
all, then I came up with this hack, which seems to work properly. I also
change the prompt to remind which step are we breaking to.
2010-01-13 16:01:36 +01:00
Luca Berra
506c7f2ab0 install umount for the modules, which use it 2010-01-13 15:57:32 +01:00
Luca Berra
17dcc1a801 base: do not force load policy if selinux is not installed at all 2010-01-13 15:56:34 +01:00
Luca Berra
9b37edbff5 dracut-functions: add support for compressed kernel modules 2010-01-13 15:53:17 +01:00
Luca Berra
e22cdb9ef8 terminfo: search also for /usr/share/terminfo 2010-01-13 15:50:52 +01:00
Luca Berra
636fa8bea8 redhat-i18n: search also in /usr/lib
we have kbd data in /usr/lib, so this patch will
search for /lib/kbd and /usr/lib/kbd and use the existing one
2010-01-13 15:50:02 +01:00
Konrad Rzeszutek Wilk
9799e0ad8e 60xen: add support for loading Xen modules 2010-01-13 15:37:05 +01:00
Harald Hoyer
6ca1d346be kernel: add rdloaddriver kernel command line parameter
rdloaddriver=<drivername>
force loading kernel module <drivername>
2010-01-13 15:34:18 +01:00
Harald Hoyer
e1603bf7e4 s390: add call to *_cio_free and use current s390utils udev rules 2010-01-13 14:26:46 +01:00
Harald Hoyer
5c554bd278 dracut.spec: add Obsoletes of mkinitrd/nash/libbdevid-python 2010-01-13 14:16:49 +01:00
Harald Hoyer
71cfa2e225 dmsquash: add nasty hack for cdroms
Some CDROMs do not generate a label symlink and have to be read from.
2010-01-12 15:08:54 +01:00
Harald Hoyer
bb2200ffca cryptroot-ask.sh: fixed luks handling
see https://bugzilla.redhat.com/show_bug.cgi?id=530898#c16
2010-01-12 14:55:09 +01:00
Harald Hoyer
66e45737e1 add man pages for dracut-catimages and dracut-gencmdline 2010-01-12 14:51:17 +01:00
Harald Hoyer
695de8493d dracut-lib: prevent double log output 2010-01-12 10:37:27 +01:00
Harald Hoyer
c5488692d4 multipath: check for existance before trying to install 2010-01-12 10:31:51 +01:00
Harald Hoyer
0a19e31886 plymouth-pretrigger: force initializing of console (bug #526570) 2009-12-21 15:15:38 +01:00
Harald Hoyer
2c2e3ad860 cryptroot-ask.sh: s/==/=/g (bug #542081) 2009-12-21 15:15:23 +01:00
Harald Hoyer
938dbad1e8 multipath: supress warnings, if multipath not installed on system 2009-11-30 15:24:47 +01:00
Harald Hoyer
ff0bfa28d3 .mailmap: updated 2009-11-27 15:38:37 +01:00
Harald Hoyer
d3e11cf813 AUTHORS: updated 2009-11-27 15:38:21 +01:00
Harald Hoyer
9993392f6d version 003 2009-11-27 15:25:46 +01:00
Harald Hoyer
e891618572 debian: s/dracut-net/dracut-network/g 2009-11-27 15:03:34 +01:00
Philippe Seewer
96f8e314b3 Debian support: Add necessary control files for packaging
This patch adds all necessary files to build dracut debian packages.

- I've split dracut into two parts: The dracut package for booting from block
  devices and dracut-net for netroot.
- I've deliberately left out all redhat specific modules, they do not make any
  sense on debian at all
2009-11-27 15:02:41 +01:00
Philippe Seewer
0edcf5fa8b Debian support: Add dracut-update-initramfs
This script is necessary to integrate dracut into the initramfs-
infrastructure of debian.

The file itself is just a copy from initramfs-tools' update-initramfs,
with a few lines modified to run dracut instead of mkinitramfs.
2009-11-27 15:02:38 +01:00
Harald Hoyer
0cd23d778e Makefile: gitrpm: cleanup on failed rpmbuild 2009-11-27 14:57:37 +01:00
Harald Hoyer
14f6ad921b dracut.spec: removed ubuntu module 2009-11-27 14:57:28 +01:00
Harald Hoyer
8e93970944 fips: do not activate fips module by default 2009-11-27 14:55:02 +01:00
Harald Hoyer
b65f499f60 fips: more shebang 2009-11-27 14:32:28 +01:00
Harald Hoyer
c2bcc5be2f fips: add shebang to fips.sh 2009-11-27 14:31:05 +01:00
Harald Hoyer
ba67b9239b changed hostonly documentation and handling 2009-11-27 14:29:32 +01:00
Harald Hoyer
f4f45af792 dracut.spec: add comment how to get source for a git snapshot 2009-11-27 14:17:53 +01:00
Philippe Seewer
9cce5af5af Remove Ubuntu 8.10 support
This is outdated and no longer needed
2009-11-27 14:07:21 +01:00
Philippe Seewer
2e6b98c7f6 All module scripts should have a shebang 2009-11-27 14:07:21 +01:00
Philippe Seewer
a8dbfbb8ce Fix manpage display errors
Some lines in dracut's manpage are just too long for justified
display on 80c terminals. These small corrections fix this. In addition
man --warnings does not complain anymore about anything at all.
2009-11-27 14:07:21 +01:00
Philippe Seewer
a68c99c94e loginit: Fix shebang 2009-11-27 14:07:21 +01:00
Philippe Seewer
00da3293e2 initqueue: Remove trailing ;
dash -n complains about the trailing ';' and somehow I think this
really isn't needed.
2009-11-27 14:07:21 +01:00
Philippe Seewer
6a0ce0a518 Module scripts should be executable 2009-11-27 14:07:20 +01:00
Philippe Seewer
7ce55fd6b7 syslog-genrules.sh: Shebang should be /bin/sh not /bin/dash 2009-11-27 14:07:20 +01:00
Harald Hoyer
6cc96b358a add dracut.conf man page 2009-11-27 10:53:28 +01:00
Harald Hoyer
4d6660c2ed dracut: fix no_kernel typo 2009-11-27 10:52:55 +01:00
Harald Hoyer
f5b01e3c57 test: set PATH 2009-11-26 19:12:20 +01:00
Harald Hoyer
57c6b805ce rootfs-block/mount-root: remount root with /etc/fstab filesystem options 2009-11-26 19:12:10 +01:00
Harald Hoyer
17ed15182a multipath: corrected initqueue parameter 2009-11-26 11:41:53 +01:00
Harald Hoyer
77eaa2fea1 dm: install dmsetup 2009-11-26 11:02:34 +01:00
Harald Hoyer
3c56f37265 dracut-functions: inst_simple(): do not bail out if target is a dir and exists 2009-11-26 10:56:53 +01:00
Harald Hoyer
4073e3a325 nfs: add rd_NFS_DOMAIN parameter to set the NFSv4 domain name
https://bugzilla.redhat.com/show_bug.cgi?id=537969
2009-11-26 10:38:40 +01:00
Harald Hoyer
48df9fcc11 nfs: install passwd entries for nobody and nfsnobody 2009-11-26 10:38:06 +01:00
Harald Hoyer
bad6113059 lvm/dmraid: make LIBDIR depend on the binary 2009-11-25 20:08:22 +01:00
Yanko Kaneti
9e7ac6982a Wildcards need dracut_install 2009-11-25 19:55:17 +01:00
Harald Hoyer
47ab3b6c5e lvm: scan without monitor
https://bugzilla.redhat.com/show_bug.cgi?id=540289
2009-11-25 19:55:17 +01:00
Peter Jones
c761b26aef Handle modules with hyphens in their names properly.
If a module has a hyphen in its name, it will show up as an underscore
in /proc/modules.  Because of this, when we're testing /proc/modules,
we have to munge our module filename expression to match.
2009-11-25 13:40:22 -05:00
Peter Jones
4ee9ce444b This has to be executable.
multipath-scan.sh has to be executable, of course.
2009-11-25 11:26:38 -05:00
Peter Jones
01ba5f2192 Fix missing shell variables.
Somehow copy+paste from one machine to the other removed all the shell
variables from this line.  Oops.
2009-11-25 11:06:35 -05:00
Peter Jones
b869710aff Bring up multipath devices that are configured in multipath.conf.
This brings up multipath devices which are configured in multipath.conf
as we find them.
2009-11-25 10:54:12 -05:00
Peter Jones
323428ced5 Make sure and get all the multipath related modules.
Install all modules that are any of:
- scsi device handler
- dm log handler
- dm path selector
- dm target

It would be nice if we could tell which log handlers and targets are
multipath related, but we really can't.
2009-11-25 10:54:12 -05:00
Peter Jones
8f99a7f6e3 Add #!/bin/bash for consistency.
Most install scripts seem to have it there, may as well make this one
like the rest...
2009-11-25 10:54:12 -05:00
Peter Jones
aff873923c Use glob for libdir when installing multipath libraries.
Use "/lib*/" not "/lib/" so it works when they're in /lib/multipath as
well as when they're in /lib64/multipath
2009-11-25 10:54:09 -05:00
Harald Hoyer
4d1661d39a specfile update 2009-11-23 15:19:19 +01:00
Harald Hoyer
a34a0df207 90dm: install more device mapper kernel modules 2009-11-23 12:28:58 +01:00
Harald Hoyer
5841610c7f kernel-modules: add firewire-ohci to hardcoded modules list 2009-11-23 12:28:58 +01:00
Harald Hoyer
557ea7a8da fips: search different lib paths 2009-11-23 12:28:57 +01:00
Harald Hoyer
7f1282834f Makefile: add WITH_SWITCH_ROOT 2009-11-23 12:28:53 +01:00
Harald Hoyer
4e0ef1d982 dracut: create initramfs-$(kernelversion).img by default 2009-11-19 15:47:06 +01:00
Harald Hoyer
734a0d9ebc dracut: check more return codes, check for permissions and use derror 2009-11-19 15:46:09 +01:00
Harald Hoyer
4d66861107 dracut.8: fixed formatting for rootfs and mount options 2009-11-18 10:24:08 +01:00
Harald Hoyer
44a6a0d941 specfile update 2009-11-17 15:00:56 +01:00
Harald Hoyer
95940758e9 multipath: install multipath kernel module 2009-11-17 14:58:51 +01:00
Harald Hoyer
bfd98ad44b multipath: install xdr utils 2009-11-17 14:58:42 +01:00
Harald Hoyer
b59d3549fd NEWS update 2009-11-13 10:36:27 +01:00
Harald Hoyer
5f7149068e multipath: install udev rules and helper tools 2009-11-13 10:27:09 +01:00
Harald Hoyer
8ec6bfcbe7 specfile update 2009-11-13 10:26:50 +01:00
Dan Horák
200e59149c move dasd initialization script and rules to s390utils
The primary source for dasd initialization script and udev rules is
now in s390utils package. The s390utils-base subpackage, that carries
the required files, is always installed on s390/s390x, because it's
part of the Core group in comps.

Signed-off-by: Dan Horák <dan@danny.cz>
2009-11-12 15:56:58 +01:00
Harald Hoyer
978d78f7b2 add module 90multipath 2009-11-12 15:12:18 +01:00
Harald Hoyer
03d8ec2601 add module fips 2009-11-12 14:59:28 +01:00
Harald Hoyer
b941e8fb9f renamed module 95ccw to 95znet 2009-11-12 14:59:28 +01:00
Harald Hoyer
394f30d8d4 crypt: ignore devices in /etc/crypttab (root is not in there) 2009-11-12 14:56:36 +01:00
Harald Hoyer
1e0eb68b69 dasd: only install /etc/dasd.conf in hostonly mode 2009-11-12 14:55:30 +01:00
Harald Hoyer
f791957ae3 zfcp: only install /etc/zfcp.conf in hostonly mode 2009-11-12 14:55:04 +01:00
Harald Hoyer
f21b3f874f kernel-modules: add scsi_dh scsi_dh_rdac scsi_dh_emc 2009-11-12 13:50:12 +01:00
Dan Horák
8fa510d483 control filesystems included in the generic initramfs
New "filesystems" command line/config file option is added with the ability to
control the list of kernel filesystem modules that are included in the generic
initramfs.

Signed-off-by: Dan Horák <dan@danny.cz>
2009-11-10 11:16:50 +01:00
Harald Hoyer
ff777576d8 dracut.8: add FILES section 2009-11-10 11:15:22 +01:00
Harald Hoyer
3b6c1c661e dracut.spec: update 2009-11-06 08:51:50 +01:00
Harald Hoyer
8686bd554b 95dasd: fixed rd_DASD argument handling 2009-11-06 08:44:01 +01:00
Harald Hoyer
62cfb5c161 dracut.8: add more documentation to rd_LUKS_UUID 2009-11-05 17:06:27 +01:00
Harald Hoyer
349bac4214 crypt: install /etc/crypttab and honor crypttab entries 2009-11-05 17:06:26 +01:00
Harald Hoyer
c3844cbf4a crypt: refix rd_LUKS_UUID handling
https://bugzilla.redhat.com/show_bug.cgi?id=533177
2009-11-05 17:06:26 +01:00
Harald Hoyer
556e4ccb42 dracut-gencmdline: do not use full path for readlink 2009-11-05 17:06:26 +01:00
Harald Hoyer
116cb137fe dracut-functions: dinfo() on missing firmware, rather than dwarning() 2009-11-05 17:06:26 +01:00
Harald Hoyer
d7b97367b2 udev-rules: do not run blkid on temporary device mapper devices 2009-11-05 17:06:26 +01:00
Harald Hoyer
b82e22dcaf kernel-modules: install all usb storage modules also 2009-11-05 17:06:26 +01:00
Alan Jenkins
95bde7588c Tidy up some comments
Fix a few typos.
2009-11-03 17:47:38 +01:00
Alan Jenkins
13425eb243 dracut-gencmdline: fix regex quoting in findstoragedriver()
On my LVM system this changes the relevant output from "rd_NO_LVM" to
"rd_LVM_VG=alan-desktop.Linux"

Note that on my newer system, it now reaches moduledep() and complains.
I don't know enough awk to tell whose fault it is :).

    awk: line 2: function gensub never defined
    awk: line 2: function gensub never defined
    rd_NO_MD rd_NO_LVM rd_NO_LUKS LANG=en_GB.UTF-8 root=/dev/sda2

Both my systems (old ubuntu and debian unstable) agree that bash
regexes should not be quoted:

    $ [[ 'a' =~ a ]] && echo match
    match
    $ [[ 'a' =~ ^a$ ]] && echo match
    match
    $ [[ 'a' =~ '^a$' ]] && echo match
    $

(and yes, it is safe against globbing)

    $ touch 9
    $ echo [0-9]
    9
    $ [[ 1 =~ [0-9] ]] && echo match
    match
2009-11-03 17:47:38 +01:00
Harald Hoyer
5bde13f927 specfile update 2009-11-03 17:42:51 +01:00
David Cantrell
78b52181bd Update dracut.8 with new rd_DASD parameter information.
Rename existing rd_DASD parameter to rd_DASD_MOD.  Document new rd_DASD
parameter handling.
2009-11-03 10:43:23 +01:00
David Cantrell
a790547896 Support new rd_DASD parameter for s390 systems.
The new rd_DASD parameter allows dracut to handle multiple rd_DASD
options.  One parameter per DASD.  The syntax is:

    rd_DASD=<device path>[,readonly=X][,erplog=X][,use_diag=X][,failfast=X]

The device path is a CCW device path, such as 0.0.0200.  The optional
parameters are sysfs attributes for the DASD.  The X value can be 0 or
1.  Dracut will write out each of the rd_DASD settings to
/etc/dasd.conf and on bootup, the dasdconf.sh script will parse this
file and bring each DASD online with the specified attribute settings.
2009-11-03 10:43:15 +01:00
David Cantrell
fe32b77f87 Rename existing 95dasd handling to 95dasd_mod.
Rename the existing rd_DASD module handler to rd_DASD_MOD.
2009-11-03 10:43:03 +01:00
Harald Hoyer
dd854ea985 dracut.spec: update 2009-10-27 16:02:57 +01:00
Harald Hoyer
121e7b3e2d TEST-14-IMSM/create-root.sh: wait until md0 is ready synced 2009-10-27 16:02:56 +01:00
Harald Hoyer
15c82415c2 90dmraid,90lvm: device mapper upstream rules got renamed 2009-10-27 16:02:56 +01:00
Harald Hoyer
5d791c0ea9 join $dsrc and $dracutbasedir 2009-10-27 16:02:56 +01:00
Harald Hoyer
07db0defa7 specfile update 2009-10-27 16:02:56 +01:00
Philippe Seewer
41f8a4f14f Add dm_mod loader
Some kernel configurations might build base dm support as a module.
Add module dm which ensures that dm_mod is there and loaded.
2009-10-27 16:02:56 +01:00
Philippe Seewer
778d2ba28b test: Add compatibility for different kernel configs
Some distros, including debian unstable with 2.6.30, still shop
style ide drivers and/or have important filesystems like ext3 as
modules.

This patch ensures that all test cases work on these configurations
by including the necessary modules and adding a simple udev rule
file that provides /dev/sd* symlinks for the case where old style
ide drivers are still in use.
2009-10-27 16:02:56 +01:00
Philippe Seewer
dc490a0f08 Add old style ide drivers if available
Some distros, including debian unstable with 2.6.30, still ship
old style ide drivers. These should be installed as well.

Sadly there are no symbols to use for nm, so a simple =ide needs
to suffice.
2009-10-27 16:02:56 +01:00
Harald Hoyer
641eae0f5a dracut.spec: reverse switch_root logic 2009-10-27 16:02:55 +01:00
Harald Hoyer
2cc8cbeaf4 test/TEST-20-NFS: kill server if pid file present on run() 2009-10-27 16:02:54 +01:00
Warren Togami
24dcacc78f dmsquash-live-root requires grep 2009-10-13 16:23:56 -04:00
Warren Togami
157a8ddf5c Revert to per-device resolv.conf by Seewer's suggestion. 2009-10-13 14:19:49 -04:00
Warren Togami
08d82be71d Better check if writing ifcfg files is necessary. 2009-10-13 13:20:07 -04:00
Harald Hoyer
ba54a4c747 test: add rdinfo 2009-10-09 13:57:35 +02:00
Harald Hoyer
b26260a0b9 dracut-lib: fixed wait_for_if_up() 2009-10-09 13:18:59 +02:00
Harald Hoyer
ffd0861b7c test/*/hard-off.sh: do not powerdown on rdshell 2009-10-09 13:18:05 +02:00
Harald Hoyer
e5ccf5eb93 run-qemu: specify PATH 2009-10-09 13:17:45 +02:00
Harald Hoyer
67307075d1 dmraid: only install libdmraid-events-isw.so
the symlink will trigger install of the real lib file
2009-10-09 13:16:02 +02:00
Harald Hoyer
42c719474e dracut: if called with "-l" read only local dracut.conf 2009-10-09 13:15:32 +02:00
Harald Hoyer
4d9b6060d4 dmraid: do not fail if /usr/lib/libdmraid-events-isw.so is not present 2009-10-09 10:16:08 +02:00
Harald Hoyer
2331d1ff15 ccw: s/layer1/layer2/g 2009-10-08 18:19:11 +02:00
Harald Hoyer
218292f6b1 add s390 network support 2009-10-08 18:10:02 +02:00
Harald Hoyer
95c07b4659 dracut.8: correct typo 2009-10-08 18:09:37 +02:00
Harald Hoyer
186b9c9aac network/parse-bridge: check for bridge parameter not ip 2009-10-08 18:08:34 +02:00
Harald Hoyer
1ccc0fad27 add zfcp support for s390 2009-10-08 14:21:32 +02:00
Harald Hoyer
3e0f415fc6 dasd: rename dasd= to rd_DASD= 2009-10-08 14:21:32 +02:00
Harald Hoyer
5af0cf0ce6 dracut: exit traps with original exitcode 2009-10-08 14:21:31 +02:00
Harald Hoyer
8aa36728f5 plymouth: suppress "find" errors 2009-10-08 14:21:31 +02:00
Harald Hoyer
f2a716d47c base/init: make link /dev/fd, mount devpts,tmpfs with correct dev parm 2009-10-08 14:21:31 +02:00
Warren Togami
4431431c23 Fix comment typo 2009-10-07 16:23:52 -04:00
Harald Hoyer
13ef589dc8 dracut.8: fixed typos 2009-10-07 16:53:59 +02:00
Harald Hoyer
ac36d5db7e base/init: kill loginit after one second of waiting 2009-10-07 16:09:20 +02:00
Harald Hoyer
cdc74b198e dmsquash-live: run dmsquash-live-root after udev settle 2009-10-07 12:49:52 +02:00
Harald Hoyer
8d0a55cfac do not use init= arg as first argument 2009-10-07 12:48:47 +02:00
Harald Hoyer
3f793c91f4 AUTHORS: generated by git-shortlog
add AUTHORS target to Makefile

only list main authors in man page
2009-10-07 10:11:55 +02:00
Harald Hoyer
2dc4a31b6c add .mailmap 2009-10-07 10:03:47 +02:00
Harald Hoyer
40ef4325d9 test: run all tests with rdinitdebug by default 2009-10-06 19:09:22 +02:00
Harald Hoyer
16da29bf9d 99base/initqueue: make operations more atomic 2009-10-06 19:09:22 +02:00
Harald Hoyer
9fbe8a001b TEST-50-MULTINIC/test.sh: add selinux=0 2009-10-06 19:09:21 +02:00
Harald Hoyer
f12b432efd test: add "failme" parameter for failing tests 2009-10-06 19:09:17 +02:00
Harald Hoyer
e71a5ca5f2 test/*/hard-off.sh: poweroff, if failme specified 2009-10-06 16:37:20 +02:00
Harald Hoyer
837a5a6021 dracut.spec: update changelog and filelists 2009-10-06 15:24:31 +02:00
Philippe Seewer
7a6e646c83 Move write-ifcfg to its own module
ifcfg config style is redhat specific, this should be in its own
module.
2009-10-06 15:23:52 +02:00
Philippe Seewer
a71f1b4917 Add multinic test suite
This is a start a test suite for the multinic support of dracut
2009-10-06 15:17:39 +02:00
Philippe Seewer
5fb4ac2286 Add DAD to dhclient-script
The manpage for dhclient-script says:

Before actually configuring the address, dhclient-script should
somehow ARP for it and exit with a nonzero status if it receives a
reply.

By using arping in dracut this is very easy, since arping has a
specific option to do just that.
2009-10-06 15:17:39 +02:00
Philippe Seewer
98f25e9694 Add simple STP timeout handler
This patch adds STP timeout error handling with arping. It's rather
simple since it only cares about the primary interface and blindly
assumes that if no gateway is available the root server is on the
same subnet.
2009-10-06 15:16:52 +02:00
Philippe Seewer
d92ca28b16 Get rid of hostname utility
dracut doesn't really need a utility to set the hostname. It only
saves a few ks of space, but every bit is good.
2009-10-06 15:14:04 +02:00
Seewer Philippe
d1dd6bb746 Be a bit more optimistic when setting mtus
The usual approach to setting mtus is to set the interface down,
set the mtu then set the interface back up again. Modern hardware
and/or drivers may support setting this on the fly, so we try
this and fall back to the old behaviour it it doesn't work.

In addition this patch only allows mtus greater than 576, this is
taken from debian/ubuntu dhclient-script.
2009-10-06 15:09:34 +02:00
Harald Hoyer
bf87d252f3 network: wait for interfaces to come up, before proceeding 2009-10-06 15:07:52 +02:00
Harald Hoyer
8f397a9be7 base: add missing loginit 2009-10-06 14:43:53 +02:00
Michal Schmidt
ca270f7c17 dracut.8: removed switch_root relicts and changed URL 2009-10-06 10:30:43 +02:00
Harald Hoyer
a8a3ca5102 updated NEWS 2009-10-01 19:59:43 +02:00
Harald Hoyer
2c78a5a5a0 dracut-gencmdline: fixed rd_NO_LUKS case 2009-10-01 19:52:48 +02:00
Harald Hoyer
2521f714f9 fixed UUID= and LABEL= handling 2009-10-01 19:38:14 +02:00
Harald Hoyer
95b4875c8a updated NEWS 2009-10-01 18:57:23 +02:00
Harald Hoyer
ec01ab23fb dmsquash: use info() and die() rather than echo 2009-10-01 18:43:35 +02:00
Harald Hoyer
34debf18bf dracut: strip kernel modules which have no x bit set 2009-10-01 18:41:04 +02:00
Harald Hoyer
4592b6983a base: add logger for rdinitdebug
initlog logs to /init.log /dev/kmsg and /dev/console
2009-10-01 18:11:24 +02:00
Harald Hoyer
a0e44f97bd iscsi/iscsiroot: remove redirection on rdnetdebug
iscsiroot is now executed in the initqueue
2009-10-01 15:21:55 +02:00
Harald Hoyer
de439e24d7 base/init: stop udev exec queue before killing it 2009-10-01 15:17:59 +02:00
Harald Hoyer
187d04ccb0 syslog: use initqueue to start syslog 2009-10-01 14:46:16 +02:00
Harald Hoyer
f214273fd6 nfs/nfsroot: do not redirect output on rdnetdebug
nfsroot is now in the initqueue
2009-10-01 14:46:16 +02:00
Harald Hoyer
52aeb3f312 base/dracut-lib: add setdebug
do not clutter rdinitdebug output with getarg and getargs debug
2009-10-01 14:46:16 +02:00
Harald Hoyer
d84c1df906 nbd/nbdroot: add better check if nbd0 is ready to be mounted 2009-10-01 14:46:15 +02:00
Harald Hoyer
a1dd79d4fe network/netroot: remove flock
netroot is now in the initqueue
2009-10-01 14:46:15 +02:00
Harald Hoyer
0519556070 network/netroot: do not redirect output on rdnetdebug
netroot is now in the initqueue
2009-10-01 14:46:15 +02:00
Harald Hoyer
d64d04df39 nbd/nbdroot: do not redirect debug output on rdnetdebug
nbdroot is now in the initqueue and rdinitdebug should cover that
2009-10-01 14:46:15 +02:00
Harald Hoyer
cf476dbc41 nbd/nbdroot: use udevsettle to wait for /dev/nbd0
nbdroot is now in the initqueue, so we can use udevsettle
2009-10-01 14:46:15 +02:00
Harald Hoyer
8bfed103d8 mdraid: do not cleanup on auto assembly with mdadm.conf 2009-10-01 14:46:14 +02:00
Harald Hoyer
e9b6e4e839 nbd: finish on /dev/root rather than on nbd0 2009-10-01 14:46:14 +02:00
Harald Hoyer
1dc53cfd1e nfs: specify nfs version 3 explicitly and retry with nfs version 2 2009-10-01 14:46:13 +02:00
Harald Hoyer
f57b5bc735 network: move netroot to initqueue
Schedule netroot for the initqueue inside ifup and dhclient.
2009-10-01 14:45:24 +02:00
Harald Hoyer
d46c2e8b0a dracut-functions: let inst*() honor and handle symlinks correctly 2009-09-30 15:35:33 +02:00
Harald Hoyer
f6d1cb89de dracut-functions: inst_simple() with cp -p to preserver timestamps, etc. 2009-09-30 15:34:12 +02:00
Harald Hoyer
0e0031dc61 init: start udevd with --resolve-names=never 2009-09-30 15:04:50 +02:00
Harald Hoyer
2168327bfa init: mount /dev/shm 2009-09-30 15:04:36 +02:00
Harald Hoyer
5cf5569d6e Makefile: reorder targets 2009-09-30 10:18:25 +02:00
Lance Albertson
b4391067ff dracut-gencmdline: check for keyboard & i18n files 2009-09-29 19:02:05 +02:00
Lance Albertson
1961248339 dir symlinks
On amd64 multilib Gentoo, /lib is a symlink to /lib64, and dracut creates
duplicate files in /lib and /lib64 in a resulting cpio image. Other files are
missing in /lib64 but exists in /lib in that image. So /usr/sbin/lvm fails to
run from initrd due to missing libraries.  A possible solution is to create in
the initrd the same /lib symlink as in host system, if /lib is a symlink.

http://bugs.gentoo.org/show_bug.cgi?id=278442#c10
2009-09-29 19:01:29 +02:00
Lance Albertson
13d942e163 custom paths
Fix Makefile so that it allows us to install the root in a sane location (which
is needed in Gentoo).
2009-09-29 19:00:48 +02:00
Harald Hoyer
99fd62e3be dm/lvm: make usage of new udev event rules optionally 2009-09-29 18:29:34 +02:00
Harald Hoyer
0cded44025 95dasd: add dasd_diag_mod module 2009-09-29 18:20:48 +02:00
Harald Hoyer
a8aad9de61 dracut.8: fixed ifname position 2009-09-29 17:12:03 +02:00
Harald Hoyer
ffe53c91c5 95dasd: use 'uname -m' instead of 'arch' 2009-09-29 17:10:22 +02:00
Harald Hoyer
9a2860a3ee 95dasd: fixed typo in modules.conf generation 2009-09-29 14:51:21 +02:00
Harald Hoyer
896199c652 95dasd: do not install zfcp kernel module 2009-09-29 14:48:06 +02:00
Harald Hoyer
5fcc6b4a0a rename 95s390 to 95dasd 2009-09-29 14:47:29 +02:00
Harald Hoyer
678b3605e8 dmraid: add missing dso 2009-09-23 17:16:31 -07:00
Harald Hoyer
b9c4654a63 devicemapper: add dmeventd and new rules for device mapper 2009-09-23 16:52:14 -07:00
Warren Togami
845dd50275 Removing umount appears to be a mistake, it seems to have been OK prior. 2009-09-23 15:16:59 -04:00
Warren Togami
23aa204856 Fix LiveCD boot regression caused by bf55e2c5d3
FIXME: There is still something wrong with this boot where it wants to use umount, but doing so breaks live boot.
2009-09-21 18:14:27 -04:00
Harald Hoyer
8eb16b0827 selinux: bail out if policy could not be loaded and selinux=0 not
specified
2009-09-21 17:44:14 +02:00
Harald Hoyer
fc1abcfa1f dmsquash-live: add initqueue-finished 2009-09-19 10:51:34 +02:00
Harald Hoyer
c53acc3015 lvm: add rd_NO_LVMCONF 2009-09-18 12:28:36 +02:00
Harald Hoyer
7a34efa5c4 md/dm/lvm: install pre-pivot cleanup hooks only if actually needed
- removed dmraid cleanup
- only call lvm cleanup, if no lvm.conf provided
- copy over lvm.conf by default
- add --nolvmconf --lvmconf parameters
2009-09-18 12:20:21 +02:00
Harald Hoyer
2727e45b43 kernel-modules: force install of scsi_wait_scan in hostonly mode 2009-09-18 12:20:04 +02:00
Harald Hoyer
5e5ec023be dracut-gencmdline: add missing functions 2009-09-18 09:08:23 +02:00
Hans de Goede
d6a5b04043 Recognize nodmraid and noiswmd kernel cmdline options
Recognize nodmraid and noiswmd kernel cmdline options, for anaconda /
rc.sysinit / mkinitrd compatibility.
2009-09-18 08:58:14 +02:00
Hans de Goede
1de9edc06e Do not stop / start udev exec-queue around "mdadm -As --run"
When assembling containers + embedded arrays from mdadm.conf,
mdadm needs the /dev/md# node for the container to assemble the
arrays within the container. Stopping the udev exec queue, results in
this node not getting created and mdadm failing to online the
arrays within the container.

Not having stop / start udev exec-queue around "mdadm -As --run" should
be safe as the exact same command is run from rc.sysinit without
any queue locking.
2009-09-18 08:15:59 +02:00
Harald Hoyer
9a99c974a4 version 002 2009-09-17 17:52:00 +02:00
Quentin Armitage
bf84ee3c7c dracut : remove extraneous output to screen during execution 2009-09-17 17:48:02 +02:00
Harald Hoyer
f8545d04b7 dracut: use and export PATH=/sbin:/bin:/usr/sbin:/usr/bin
There's no need for /usr/local to be in our paths at all, nor to
include a :$PATH at the end. The path should be exported though,
so modules don't have to worry about finding things.
2009-09-17 16:36:08 +02:00
Harald Hoyer
e73c975bad dracut.spec: inc release 2009-09-17 16:36:08 +02:00
Harald Hoyer
0f7e10cef4 mdraid: save state dir for mdmon/mdadm for the real root 2009-09-17 12:13:54 +02:00
Harald Hoyer
689f9b8af7 create /var/run in 99base 2009-09-17 12:10:48 +02:00
Harald Hoyer
654cbf0687 dracut.spec: removed gittags 2009-09-16 16:25:47 +02:00
Harald Hoyer
041b0d76ca dracut.spec: update changelog 2009-09-16 16:24:54 +02:00
Harald Hoyer
24bac034d1 65-md-incremental-imsm.rules: check if md raid is already running 2009-09-16 16:10:09 +02:00
Harald Hoyer
094097fab3 lvm/dm/md: switch from lockfiles to $sys/$devpath/holders/*
This is a more sane solution, than ignoring subsequent "change" events.

The only danger is that we could loop, if a lvm scan triggers a broken
md partition, which triggers a broken PV and so on.

Better fix the scanning tools, not to emit change events for devices,
if no action was taken.
2009-09-16 15:34:13 +02:00
Harald Hoyer
26fbe9a101 TEST-14-IMSM: rd_NO_DM rd_NO_MDIMSM rd_NO_MDADMCONF succeeds now
This test succeeds, because the mirror parts are found without
assembling the mirror itsself, which is what we want

client_run rd_NO_DM rd_NO_MDIMSM rd_NO_MDADMCONF || return 1
2009-09-16 15:32:55 +02:00
Harald Hoyer
f8ddafcca2 TEST-11-LVM: add rdinfo 2009-09-16 15:32:29 +02:00
Hans de Goede
04a8f224c1 Add ifname= argument for persistent netdev names
ifname=<interface>:<MAC>
Assign network device name <interface> (ie eth0) to the NIC
with MAC <MAC>.
Note that if you use this option you *must* specify an ifname=
argument for all interfaces used in ip= or fcoe= arguments
2009-09-16 15:01:08 +02:00
Harald Hoyer
597839331c dmraid: use and install kpartx for dmraids 2009-09-16 11:21:24 +02:00
Hans de Goede
26b72485cf 90dmraid: use kpartx to scan for partitions 2009-09-16 11:20:57 +02:00
Harald Hoyer
7dbaf59ccf 10rpmversion/install: fix non-rpm install 2009-09-16 11:18:22 +02:00
Harald Hoyer
95cf0a8803 10rpmversion,dracut.spec: generate version file and install it 2009-09-16 10:43:50 +02:00
Harald Hoyer
1dd5bc3fba add udevproperty() to dracut-lib and use it
newer versions of udev use --property instead of --env
2009-09-16 10:43:50 +02:00
Warren Togami
bf55e2c5d3 dmsquash-live-root requires umount 2009-09-15 17:17:57 -04:00
Harald Hoyer
4d92475240 changelog/NEWS update 2009-09-15 15:54:14 +02:00
Harald Hoyer
a52586e8ea network: break udevsettle early 2009-09-15 15:38:53 +02:00
Hans de Goede
5759574b26 Document that MAC addresses must be lowercase 2009-09-15 15:14:19 +02:00
Hans de Goede
56580efe68 Document netroot=fcoe:.... 2009-09-15 15:14:19 +02:00
Hans de Goede
68f28d6976 Add ifname= argument for persistent netdev names
ifname=<interface>:<MAC>
Assign network device name <interface> (ie eth0) to the NIC with MAC <MAC>.
Note that if you use this option you *must* specify an ifname= argument
for all interfaces used in ip= or fcoe= arguments
2009-09-15 15:13:21 +02:00
Harald Hoyer
5c3f5746bb 90mdraid/65-md-incremental-imsm.rules: first set initqueue-finished,
then initqueue-settled

also introduce md_finished.sh to check for all md activity to be settled
2009-09-15 15:00:25 +02:00
Harald Hoyer
54a73cbb2b dracut-lib.sh: change -f to -e to allow symlinks 2009-09-15 15:00:24 +02:00
Harald Hoyer
ab0f04844b 10rpmversion: try to get the correct dracut rpm version during %post 2009-09-15 15:00:24 +02:00
Harald Hoyer
ad8f03af22 TEST-14-IMSM: "rd_NO_DM rd_NO_MDIMSM rd_NO_MDADMCONF" fails 2009-09-15 15:00:24 +02:00
Harald Hoyer
3329f92136 90crypt/70-luks.rules: set unique name for initqueue job 2009-09-15 15:00:24 +02:00
Harald Hoyer
c27ec060da 95rootfs-block/block-genrules.sh: beautify code 2009-09-15 15:00:24 +02:00
Harald Hoyer
82b2189d01 initqueue-finished: fail also on empty queue 2009-09-15 15:00:24 +02:00
Harald Hoyer
4ce52970c0 initqueue: first remove the job, then execute it 2009-09-15 15:00:24 +02:00
Harald Hoyer
99433dd289 90mdraid: only switch mdmon to new root, if an instance is running 2009-09-15 15:00:23 +02:00
Harald Hoyer
b94c520660 plymouth: add rd_NO_PLYMOUTH 2009-09-15 15:00:23 +02:00
Harald Hoyer
2f02ae9d45 mdraid: add rd_NO_MDADMCONF --mdadmconf --nomdadmconf
Copy /etc/mdadm.conf to initramfs (even for non-hostonly) if
mdadmconf="yes" is set in dracut.conf or --mdadmconf is specified on the
dracut command line.

This was done, because there seems _no_ sane way to autoassemble md raid
arrays.

also moved rd_NO_MD to an udev ENV
2009-09-15 15:00:18 +02:00
Harald Hoyer
11fcc8c8f9 95resume/install: give resume higher prio than mount 2009-09-15 11:17:28 +02:00
Harald Hoyer
e8cf498dcc 95rootfs-block/mount-root.sh: ignore /.resume 2009-09-15 11:17:28 +02:00
Harald Hoyer
2178a00eea 95resume: simplyfy rules and also recognize blkid typo 2009-09-15 11:17:27 +02:00
Harald Hoyer
33ff830c1b 90dmraid: switch rd_NO_DM to udev ENV 2009-09-15 11:17:27 +02:00
Harald Hoyer
5a8d8dfbb6 switch modules to initqueue-finished 2009-09-15 11:17:22 +02:00
Harald Hoyer
8238850caa init: add initqueue-finished
/initqueue-finished/*.sh are scripts, which return != 0, if the main
loop still has pending jobs to do.
2009-09-15 08:47:47 +02:00
Harald Hoyer
fc3c64c8d4 dracut: determine path to dracut-functions 2009-09-14 19:35:18 +02:00
Harald Hoyer
1888e57bf9 plymouth: grep for PLYMOUTH_POPULATE_SOURCE_FUNCTIONS 2009-09-14 19:34:30 +02:00
Harald Hoyer
94dcc5b8d8 fix backwards inst() compat 2009-09-14 19:33:54 +02:00
Harald Hoyer
4839a7995e add pcmcia adapter 2009-09-14 19:30:20 +02:00
Harald Hoyer
1aca526cb4 90dmraid: install parse-dm.sh 2009-09-14 16:47:30 +02:00
Harald Hoyer
9541165d33 dracut-functions: fixed inst() for mkinitrd compat 2009-09-14 15:53:55 +02:00
Harald Hoyer
600131fe85 selinux-loadpolicy: do not check for selinux config files
leave it up to load_policy
2009-09-11 16:30:10 +02:00
Harald Hoyer
8c45b484ce plymouth: removed rd_plytheme 2009-09-11 16:29:40 +02:00
Harald Hoyer
650da7bada removed initrdargs from parse-*.sh 2009-09-10 17:34:15 +02:00
Harald Hoyer
247c9f70bf init: fixed command line handling for /sbin/init and init=<custom init> 2009-09-10 16:48:36 +02:00
Harald Hoyer
233f79df99 selinux-loadpolicy.sh: also check for /etc/selinux/config 2009-09-10 15:49:03 +02:00
Harald Hoyer
236852c109 dracut.spec: require plymouth-scripts 2009-09-09 21:16:01 +02:00
Harald Hoyer
6f0e469d79 selinux-loadpolicy: set initial ret=0 2009-09-09 19:50:44 +02:00
Harald Hoyer
f9749f368f plymouth: use /usr/libexec/plymouth/plymouth-populate-initrd if possible 2009-09-09 18:05:00 +02:00
Harald Hoyer
f165864f09 dracut-functions: make inst() mkinitrd compatible 2009-09-09 18:05:00 +02:00
Harald Hoyer
dc077a52c9 dracut.spec: do not require policycoreutils
since might do load_policy with chroot, we don't need to require it
2009-09-09 18:05:00 +02:00
Harald Hoyer
0b2de1f895 99base/init: output more info() 2009-09-09 18:04:55 +02:00
Harald Hoyer
94eb3cf222 selinux-loadpolicy: do not mount /proc and /selinux
load_policy already does these things for us
2009-09-09 17:06:21 +02:00
Harald Hoyer
cb47caf786 add parameter to specify additional kernel modules to include
--add-drivers for dracut
add_drivers for dracut.conf
2009-09-09 17:02:37 +02:00
Harald Hoyer
d9f0633878 selinux-loadpolicy: do not mount /proc and /selinux
load_policy mounts it for us
2009-09-09 14:41:40 +02:00
Harald Hoyer
71094bee63 base/init: add scsi_wait_scan to wait for host adapter scans 2009-09-09 11:09:04 +02:00
Harald Hoyer
f5c4374d2c selinux-loadpolicy.sh: mount /proc and /selinux before loading the
policies

also check for /sbin/load_policy
2009-09-08 16:26:37 +02:00
Harald Hoyer
aa297ca6b6 65-md-incremental-imsm.rules: refine rules 2009-09-08 15:33:19 +02:00
Harald Hoyer
4712e4ece6 initqueue: add --name parameter to give a name for --unique 2009-09-08 15:31:48 +02:00
Harald Hoyer
e51b607189 TEST-14-IMSM: create raid5 inside isw raid container 2009-09-08 15:31:27 +02:00
Harald Hoyer
fdf2a763d4 TEST-14-IMSM: more test cases 2009-09-08 15:31:00 +02:00
Harald Hoyer
f25c9697f8 mdraid: stop udev queue until mdraid assembled 2009-09-08 15:30:17 +02:00
Harald Hoyer
7e282f5df1 dmraid: only install 64-md-raid.rules if no vol_id present 2009-09-08 15:29:30 +02:00
Harald Hoyer
0e9bb3f30c TEST-14-IMSM: no test for a isw raid array 2009-09-08 13:43:21 +02:00
Harald Hoyer
3bb5b261c7 65-md-incremental-imsm: add additional check for md-non-containers 2009-09-08 13:42:31 +02:00
Harald Hoyer
273b197d75 added initqueue-settled and refactored code 2009-09-07 19:12:01 +02:00
Harald Hoyer
906dedf4d5 mdraid-cleanup: do not stop mdraid container 2009-09-07 19:12:00 +02:00
Harald Hoyer
4f4a79b1a1 add scp to debug module 2009-09-07 17:10:19 +02:00
Harald Hoyer
587b3497c1 mdraid_start.sh: fixed raid activation 2009-09-07 16:18:12 +02:00
Harald Hoyer
1753a63081 TEST-12-RAID-DEG: check with root=LABEL=root 2009-09-07 11:41:38 +02:00
Harald Hoyer
96f3cf1d27 95udev-rules: fixed c&p bug which did not install 61-persistent-storage.rules 2009-09-07 11:40:20 +02:00
Harald Hoyer
e4dec3d6b6 {crypt,dmraid,lvm,mdraid}: cleanup with pre-pivot 30 and 31 2009-09-03 17:11:57 +02:00
Harald Hoyer
429aa1a2c2 mdraid: add grep for convenience 2009-09-03 17:11:03 +02:00
Harald Hoyer
d889c019e7 version 001 2009-09-02 15:55:35 +02:00
Harald Hoyer
52168b7b9d reordered blkid/vol_id rules 2009-09-02 15:55:34 +02:00
Peter Rajnoha
d6462323d6 LVM/DM rules in dracut
I've looked at the LVM rules used in dracut just recently
and it needs fixing - we should react to change events only
for DM devices, so we have to skip vol_id/blkid call on ADD:

KERNEL=="dm-[0-9]*", ACTION=="add", GOTO="lvm_end"

Also, MD devices have their own rules, where vol_id/blkid
is called and where the symlinks are created (when looking
into raw initrd, this is in  64-md-raid.rules).

Also, if those rules are meant to be for DM devices only,
maybe we should skip symlink creation for the other devices
there, to keep the rules clean and straightforward. I think
we shouldn't create/recreate symlinks for non-dm devices in
LVM/DM rules (..should be in appropriate rules for that type
of device):

KERNEL!="dm-[0-9]*", GOTO="lvm_end"
2009-09-02 15:55:34 +02:00
Victor Lowther
1d368457e3 Merge commit 'origin/master' 2009-09-02 07:40:28 -05:00
Victor Lowther
7c3fe07ac0 Made hostonly checking for fcoe fail for now.
Having it unconditionally pass pulls in all the networking cruft even
for systems that do not need it, and that sorta defeats the purpose of
hostonly mode.
2009-09-02 07:37:33 -05:00
305 changed files with 13881 additions and 2878 deletions

5
.gitignore vendored
View File

@@ -1,3 +1,8 @@
test*.img
modules.d/99base/switch_root
*~
dracut.kernel.7
dracut.conf.5
dracut.8
dracut-catimages.8
dracut-gencmdline.8

8
.mailmap Normal file
View File

@@ -0,0 +1,8 @@
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>

58
AUTHORS
View File

@@ -1,11 +1,53 @@
Andreas Thienemann <andreas@bawue.net>
Bill Nottingham <notting@redhat.com>
Dave Jones <davej@redhat.com>
David Dillow <dave@thedillows.org>
Harald Hoyer <harald@redhat.com>
Jeremy Katz <katzj@redhat.com>
Peter Jones <pjones@redhat.com>
Seewer Philippe <philippe.seewer@bfh.ch>
Victor Lowther <victor.lowther@gmail.com>
Philippe Seewer <philippe.seewer@bfh.ch>
Warren Togami <wtogami@redhat.com>
Jeremy Katz <katzj@redhat.com>
Amadeusz Żołnowski <aidecoe@aidecoe.name>
David Dillow <dave@thedillows.org>
Andreas Thienemann <andreas@bawue.net>
Hans de Goede <hdegoede@redhat.com>
Peter Jones <pjones@redhat.com>
Luca Berra <bluca@comedia.it>
Will Woods <wwoods@redhat.com>
Andrey Borzenkov <arvidjaar@mail.ru>
Andrey Borzenkov <arvidjaar@gmail.com>
Marc Grimme <grimme@atix.de>
Daniel Drake <dsd@laptop.org>
Bill Nottingham <notting@redhat.com>
David Cantrell <dcantrell@redhat.com>
Lance Albertson <lance@osuosl.org>
Michael Ploujnikov <plouj@somanetworks.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Dan Horák <dan@danny.cz>
Joey Boggs <jboggs@redhat.com>
Mike Snitzer <snitzer@redhat.com>
Peter Rajnoha <prajnoha@redhat.com>
Vladislav Bogdanov <bubble@hoster-ok.com>
Alexander Todorov <atodorov@redhat.com>
Andy Lutomirski <luto@mit.edu>
Christian Heinz <christian.ch.heinz@gmail.com>
Dan Horák <dhorak@redhat.com>
Dave Jones <davej@redhat.com>
Frederic Crozat <fcrozat@mandriva.com>
Glen Gray <slaine@slaine.org>
Ian Dall <ian@beware.dropbear.id.au>
James Laska <jlaska@redhat.com>
Jon Ander Hernandez <jonan.h@gmail.com>
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Lubomir Rintel <lkundrak@v3.sk>
Luca Berra <bluca@vodka.it>
Matt <smoothsailing72@hotmail.com>
Matt Smith <shadowfax@gmx.com>
Michal Schmidt <mschmidt@redhat.com>
Michal Soltys <soltys@ziu.info>
Munehiro Matsuda <haro@kgt.co.jp>
Pádraig Brady <P@draigBrady.com>
Quentin Armitage <quentin@armitage.org.uk>
Sergey Fionov <fionov@gmail.com>
Thilo Bangert <thilo.bangert@gmx.net>
Tomasz Torcz <tomek@pipebreaker.pl>
Vadim Kuznetsov <vadimk@gentoo.org>
Ville Skyttä <ville.skytta@iki.fi>
Yanko Kaneti <yaneti@declera.com>
maximilian attems <max@stro.at>

View File

@@ -1,50 +1,85 @@
VERSION=001
VERSION=010
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
prefix = /usr
datadir = ${prefix}/share
pkglibdir = ${datadir}/dracut
sysconfdir = ${prefix}/etc
sbindir = ${prefix}/sbin
mandir = ${prefix}/share/man
prefix ?= /usr
datadir ?= ${prefix}/share
pkglibdir ?= ${datadir}/dracut
sysconfdir ?= ${prefix}/etc
sbindir ?= ${prefix}/sbin
mandir ?= ${prefix}/share/man
manpages = dracut.8 dracut.kernel.7 dracut.conf.5 dracut-catimages.8 dracut-gencmdline.8
.PHONY: install clean archive rpm testimage test all check AUTHORS
ifeq (1,${WITH_SWITCH_ROOT})
targets = modules.d/99base/switch_root
else
targets =
endif
all: $(targets) $(manpages) dracut.html
%: %.xml
xsltproc -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
dracut.html: dracut.xml $(manpages)
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 \
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
modules.d/99base/switch_root: switch_root.c
gcc -D _GNU_SOURCE -D 'PACKAGE_STRING="dracut"' -std=gnu99 -fsigned-char -g -O2 -o modules.d/99base/switch_root switch_root.c
all: modules.d/99base/switch_root
.PHONY: install clean archive rpm testimage test all check
install:
mkdir -p $(DESTDIR)$(pkglibdir)
mkdir -p $(DESTDIR)$(sbindir)
mkdir -p $(DESTDIR)$(sysconfdir)
mkdir -p $(DESTDIR)$(pkglibdir)/modules.d
mkdir -p $(DESTDIR)$(mandir)/man8
mkdir -p $(DESTDIR)$(mandir)/man{5,7,8}
install -m 0755 dracut $(DESTDIR)$(sbindir)/dracut
install -m 0755 dracut-gencmdline $(DESTDIR)$(sbindir)/dracut-gencmdline
install -m 0755 dracut-catimages $(DESTDIR)$(sbindir)/dracut-catimages
install -m 0755 mkinitrd-dracut.sh $(DESTDIR)$(sbindir)/mkinitrd
install -m 0755 lsinitrd $(DESTDIR)$(sbindir)/lsinitrd
ifeq (1,${WITH_SWITCH_ROOT})
install -m 0755 modules.d/99base/switch_root $(DESTDIR)$(sbindir)/switch_root
endif
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
install -m 0755 dracut-functions $(DESTDIR)$(pkglibdir)/dracut-functions
install -m 0755 dracut-logger $(DESTDIR)$(pkglibdir)/dracut-logger
cp -arx modules.d $(DESTDIR)$(pkglibdir)
install -m 0644 dracut.8 $(DESTDIR)$(mandir)/man8
install -m 0644 dracut-catimages.8 $(DESTDIR)$(mandir)/man8
install -m 0644 dracut-gencmdline.8 $(DESTDIR)$(mandir)/man8
install -m 0644 dracut.conf.5 $(DESTDIR)$(mandir)/man5
install -m 0644 dracut.kernel.7 $(DESTDIR)$(mandir)/man7
ifeq (1,${WITH_SWITCH_ROOT})
rm $(DESTDIR)$(pkglibdir)/modules.d/99base/switch_root
endif
clean:
rm -f *~
rm -f modules.d/99base/switch_root
rm -f test-*.img
rm -f dracut-*.rpm dracut-*.tar.bz2
make -C test clean
$(RM) *~
$(RM) */*~
$(RM) */*/*~
$(RM) modules.d/99base/switch_root
$(RM) test-*.img
$(RM) dracut-*.rpm dracut-*.tar.bz2
$(RM) $(manpages) dracut.html
$(MAKE) -C test clean
archive: dracut-$(VERSION)-$(GITVERSION).tar.bz2
dist: dracut-$(VERSION).tar.bz2
dist: dracut-$(VERSION).tar.gz
dracut-$(VERSION).tar.bz2:
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ |bzip2 > dracut-$(VERSION).tar.bz2
dracut-$(VERSION).tar.gz:
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ |gzip > dracut-$(VERSION).tar.gz
dracut-$(VERSION)-$(GITVERSION).tar.bz2:
git archive --format=tar HEAD --prefix=dracut-$(VERSION)-$(GITVERSION)/ |bzip2 > dracut-$(VERSION)-$(GITVERSION).tar.bz2
@@ -58,15 +93,22 @@ gitrpm: dracut-$(VERSION)-$(GITVERSION).tar.bz2
cat dracut.spec >> dracut.spec.git
mv dracut.spec dracut.spec.bak
mv dracut.spec.git dracut.spec
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" --define "gittag $(GITVERSION)" -ba dracut.spec
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" --define "gittag $(GITVERSION)" -ba dracut.spec || :
mv dracut.spec.bak dracut.spec
rm -fr BUILD BUILDROOT
check: all
@ret=0;for i in modules.d/99base/init modules.d/*/*.sh; do \
syncheck:
@ret=0;for i in dracut-logger modules.d/99base/init modules.d/*/*.sh; do \
[ "$${i##*/}" = "module-setup.sh" ] && continue; \
[ "$${i##*/}" = "caps.sh" ] && continue; \
dash -n "$$i" ; ret=$$(($$ret+$$?)); \
done;exit $$ret
make -C test check
@ret=0;for i in dracut modules.d/02caps/caps.sh modules.d/*/module-setup.sh; do \
bash -n "$$i" ; ret=$$(($$ret+$$?)); \
done;exit $$ret
check: all syncheck
$(MAKE) -C test check
testimage: all
./dracut -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
@@ -77,9 +119,10 @@ testimages: all
@echo wrote test-$(shell uname -r).img
./dracut -l -a debug --no-kernel -f test-dracut.img $(shell uname -r)
@echo wrote test-dracut.img
hostimage: all
./dracut -H -l -a debug -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

160
NEWS
View File

@@ -1,3 +1,163 @@
dracut-010
==========
- lots of bugfixes
- plymouth: use /run/plymouth/pid instead of /run/initramfs/plymouth
- add "/lib/firmware/updates" to default firmware path
dracut-009
==========
- dracut generator
- dracut-logger
- xz compression
- better argument handling
- initramfs
- hooks moved to /lib/dracut/hooks in initramfs
- rd.driver.{blacklist|pre|post} accept comma seperated driver list
- iSCSI: iSCSI Boot Firmware Table (iBFT) support
- support for /run
- live image: support for generic rootfs.img (instead of ext3fs.img)
- caps module
- FCoE: EDD support
dracut-008
==========
- removed --ignore-kernel-modules option (no longer necessary)
- renamed kernel command line arguments to follow the rd. naming scheme
- merged check, install, installkernel to module-setup.sh
- support for bzip2 and xz compressed initramfs images.
- source code beautification
- lots of documentation
- lsinitrd: "catinitrd" functionality
- dracut: --list-modules
- lvm: support for dynamic LVM SNAPSHOT root volume
- 95fstab-sys: mount all /etc/fstab.sys volumes before switch_root
- 96insmodpost dracut module
- rd.shell=1 per default
- rootfs-block:mount-root.sh add fsck
- busybox shell replacements module
- honor old "real_init="
- 97biosdevname dracut module
dracut-007
==========
- module i18n is no longer fedora/red hat specific (Amadeusz Żołnowski)
- distribution specific conf file
- bootchartd support
- debug module now has fsck
- use "hardlink", if available, to save some space
- /etc/dracut.conf can be overwritten by settings in /etc/dracut.conf.d/*.conf
- gentoo splash module
- --ignore-kernel-modules option
- crypto keys on external devices support
- bugfixes
dracut-006
==========
- fixed mdraid with IMSM
- fixed dracut manpages
- dmraid parse different error messages
- add cdrom polling mechanism for slow cdroms
- add module btrfs
- add btrfsctl scan for btrfs multi-devices (raid)
- teach dmsquash live-root to use rootflags
- trigger udev with action=add
- fixed add_drivers handling
- add sr_mod
- use pigz instead of gzip, if available
- boot from LVM mirrors and snapshots
- iscsi: add support for multiple netroot=iscsi:
- Support old version of module-init-tools
- got rid of rdnetdebug
- fixed "ip=auto6"
- dracut.conf: use "+=" as default for config variables
- bugfixes
dracut-005
==========
- dcb support to dracut's FCoE support
- add readonly overlay support for dmsquash
- add keyboard kernel modules
- dracut.conf: added add_dracutmodules
- add /etc/dracut.conf.d
- add preliminary IPv6 support
- bugfixes
dracut-004
==========
- dracut-lib: read multiple lines from $init/etc/cmdline
- lsinitrd and mkinitrd
- dmsquash: add support for loopmounted *.iso files
- lvm: add rd_LVM_LV and "--poll n"
- user suspend support
- add additional drivers in host-only mode, too
- improved emergency shell
- support for compressed kernel modules
- support for loading Xen modules
- rdloaddriver kernel command line parameter
- man pages for dracut-catimages and dracut-gencmdline
- bugfixes
dracut-003
==========
- add debian package modules
- add dracut.conf manpage
- add module 90multipath
- add module 01fips
- crypt: ignore devices in /etc/crypttab (root is not in there)
unless rd_NO_CRYPTTAB is specified
- kernel-modules: add scsi_dh scsi_dh_rdac scsi_dh_emc
- add multinic support
- add s390 zfcp support
- add s390 dasd support
- add s390 network support
- fixed dracut-gencmdline for root=UUID or LABEL
- do not destroy assembled raid arrays if mdadm.conf present
- mount /dev/shm
- let udevd not resolve group and user names
- moved network from udev to initqueue
- improved debug output: specifying "rdinitdebug" now logs
to dmesg, console and /init.log
- strip kernel modules which have no x bit set
- redirect stdin, stdout, stderr all RW to /dev/console
so the user can use "less" to view /init.log and dmesg
- add new device mapper udev rules and dmeventd
- fixed dracut-gencmdline for root=UUID or LABEL
- do not destroy assembled raid arrays if mdadm.conf present
- mount /dev/shm
- let udevd not resolve group and user names
- preserve timestamps of tools on initramfs generation
- generate symlinks for binaries correctly
- moved network from udev to initqueue
- mount nfs3 with nfsvers=3 option and retry with nfsvers=2
- fixed nbd initqueue-finished
- improved debug output: specifying "rdinitdebug" now logs
to dmesg, console and /init.log
- strip kernel modules which have no x bit set
- redirect stdin, stdout, stderr all RW to /dev/console
so the user can use "less" to view /init.log and dmesg
- make install of new dm/lvm udev rules optionally
- add new device mapper udev rules and dmeventd
- Fix LiveCD boot regression
- bail out if selinux policy could not be loaded and
selinux=0 not specified on kernel command line
- do not cleanup dmraids
- copy over lvm.conf
dracut-002
==========
- add ifname= argument for persistent netdev names
- new /initqueue-finished to check if the main loop can be left
- copy mdadm.conf if --mdadmconf set or mdadmconf in dracut.conf
- plymouth: use plymouth-populate-initrd
- add add_drivers for dracut and dracut.conf
- add modprobe scsi_wait_scan to be sure everything was scanned
- fix for several problems with md raid containers
- fix for selinux policy loading
- fix for mdraid for IMSM
- fix for bug, which prevents installing 61-persistent-storage.rules (bug #520109)
- fix for missing grep for md
dracut-001
==========
- better --hostonly checks

21
PKGBUILD Normal file
View File

@@ -0,0 +1,21 @@
pkgname=dracut-git
pkgver=$(date +%s)
pkgrel=$(git log --pretty=format:%h |head -n 1)
pkgdesc="Initramfs generation utility"
arch=('i686' 'x86_64')
url="https://dracut.wiki.kernel.org/"
license=('GPL')
conflicts=('dracut' 'mkinitcpio')
provides=('dracut=9999' 'mkinitcpio=9999')
depends=('bash')
optdepends=('cryptsetup' 'lvm2')
makedepends=('libxslt')
backup=(etc/dracut.conf)
source=()
md5sums=()
build() {
cd ..
make sysconfdir=/etc || return 1
make DESTDIR="${pkgdir}" sysconfdir=/etc install || return 1
}

View File

@@ -1,6 +1,3 @@
dracut-kernel is used to pull in all firmware files to build an initrd with
only kernel modules and firmware files.
dracut --kernel-only only executes "installkernel" in the modules
subdirectories.
"dracut --kernel-only" is to build an initrd with only kernel modules and firmware files.
"dracut --kernel-only" only executes "installkernel" in the modules subdirectories.

53
debian/changelog vendored Normal file
View File

@@ -0,0 +1,53 @@
dracut (2.26) unstable; urgency=low
[ Harald Hoyer ]
* multipath: install udev rules and helper tools
* NEWS update
* multipath: install xdr utils
* multipath: install multipath kernel module
* specfile update
* dracut.8: fixed formatting for rootfs and mount options
* dracut: check more return codes, check for permissions and use
derror
* dracut: create initramfs-$(kernelversion).img by default
* Makefile: add WITH_SWITCH_ROOT
* fips: search different lib paths
* kernel-modules: add firewire-ohci to hardcoded modules list
* 90dm: install more device mapper kernel modules
* specfile update
[ Peter Jones ]
* Use glob for libdir when installing multipath libraries.
* Add #!/bin/bash for consistency.
* Make sure and get all the multipath related modules.
* Bring up multipath devices that are configured in multipath.conf.
* Fix missing shell variables.
* This has to be executable.
* Handle modules with hyphens in their names properly.
[ Harald Hoyer ]
* lvm: scan without monitor
[ Yanko Kaneti ]
* Wildcards need dracut_install
[ Harald Hoyer ]
* lvm/dmraid: make LIBDIR depend on the binary
* nfs: install passwd entries for nobody and nfsnobody
* nfs: add rd_NFS_DOMAIN parameter to set the NFSv4 domain name
* dracut-functions: inst_simple(): do not bail out if target is a dir
and exists
* dm: install dmsetup
* multipath: corrected initqueue parameter
* rootfs-block/mount-root: remount root with /etc/fstab filesystem
options
* test: set PATH
-- Philippe Seewer <philippe.seewer@.bfh.ch> Fri, 27 Nov 2009 10:58:26 +0100
dracut (2.21) unstable; urgency=low
[ Harald Hoyer ]
* fix rd_DASD argument handling (bug #531720)
* Resolves: rhbz#531720
-- Philippe Seewer <philippe.seewer@.bfh.ch> Fri, 06 Nov 2009 15:52:00 +0100

1
debian/compat vendored Normal file
View File

@@ -0,0 +1 @@
5

41
debian/control vendored Normal file
View File

@@ -0,0 +1,41 @@
Source: dracut
Section: utils
Priority: optional
Maintainer: Philippe Seewer <philippe.seewer@bfh.ch>
Build-Depends: debhelper (>= 5.0), cdbs
Standards-Version: 3.8.4
Vcs-Browser: http://git.kernel.org/?p=boot/dracut/dracut.git
Vcs-Git: git://git.kernel.org/pub/scm/boot/dracut/dracut.git
Package: dracut
Architecture: all
Recommends: cryptsetup, dmsetup, dmraid, lvm2, mdadm
Suggests: dracut-network
Depends: cpio, module-init-tools, udev, ${misc:Depends}
Provides: linux-initramfs-tool
Description: A new initramfs infrastructure
Unlike existing initramfs's, this is an attempt at having as little as
possible hard-coded into the initramfs as possible. The initramfs has
(basically) one purpose in life -- getting the rootfs mounted so that
we can transition to the real rootfs. This is all driven off of
device availability. Therefore, instead of scripts hard-coded to do
various things, we depend on udev to create device nodes for us and
then when we have the rootfs's device node, we mount and carry on.
Having the root on MD, LVM2, LUKS is supported as well as NFS, iSCSI,
NBD and FCOE with dracut-network.
Package: dracut-network
Architecture: all
Recommends: nfs-common, open-iscsi, nbd-client
Depends: dracut, iputils-arping, dhcp3-client, ${misc:Depends}
Description: A new initramfs infrastucture
Unlike existing initramfs's, this is an attempt at having as little as
possible hard-coded into the initramfs as possible. The initramfs has
(basically) one purpose in life -- getting the rootfs mounted so that
we can transition to the real rootfs. This is all driven off of
device availability. Therefore, instead of scripts hard-coded to do
various things, we depend on udev to create device nodes for us and
then when we have the rootfs's device node, we mount and carry on.
Having the root on MD, LVM2, LUKS is supported as well as NFS, iSCSI,
NBD and FCOE with dracut-network.

39
debian/copyright vendored Normal file
View File

@@ -0,0 +1,39 @@
This package was debianized by Philippe Seewer <philippe.seewer@bfh.ch> on
Fri Nov 20 15:45:00 +0100
Sources can be downloaded from:
http://www.kernel.org/pub/linux/utils/boot/dracut/
Upstream Maintainer:
Harald Hoyer <harald@redhat.com>
Updstream Authors:
Victor Lowther <victor.lowther@gmail.com>
Warren Togami <wtogami@redhat.com>
Jeremy Katz <katzj@redhat.com>
Philippe Seewer <philippe.seewer@bfh.ch>
David Dillow <dave@thedillows.org>
Andreas Thienemann <andreas@bawue.net>
Hans de Goede <hdegoede@redhat.com>
Marc Grimme <grimme@atix.de>
Bill Nottingham <notting@redhat.com>
Daniel Drake <dsd@laptop.org>
Lance Albertson <lance@osuosl.org>
Michael Ploujnikov <plouj@somanetworks.com>
Peter Jones <pjones@redhat.com>
Dave Jones <davej@redhat.com>
Michal Schmidt <mschmidt@redhat.com>
Peter Rajnoha <prajnoha@redhat.com>
Quentin Armitage <quentin@armitage.org.uk>
Sergey Fionov <fionov@gmail.com>
Thilo Bangert <thilo.bangert@gmx.net>
Copyright:
Copyright 2009 Harald Hoyer <harald@redhat.com>
License: GPLv2
On Debian systems, the complete text of the GNU General Public
License version 2 can be found in `/usr/share/common-licenses/GPL-2'.

5
debian/dracut-network.dirs vendored Normal file
View File

@@ -0,0 +1,5 @@
usr/share/dracut/modules.d/40network
usr/share/dracut/modules.d/95fcoe
usr/share/dracut/modules.d/95iscsi
usr/share/dracut/modules.d/95nbd
usr/share/dracut/modules.d/95nfs

5
debian/dracut-network.install vendored Normal file
View File

@@ -0,0 +1,5 @@
modules.d/40network usr/share/dracut/modules.d
modules.d/95fcoe usr/share/dracut/modules.d
modules.d/95iscsi usr/share/dracut/modules.d
modules.d/95nbd usr/share/dracut/modules.d
modules.d/95nfs usr/share/dracut/modules.d

25
debian/dracut.dirs vendored Normal file
View File

@@ -0,0 +1,25 @@
usr/share/dracut
usr/share/dracut/modules.d/00dash
usr/share/dracut/modules.d/01fips
usr/share/dracut/modules.d/60xen
usr/share/dracut/modules.d/90crypt
usr/share/dracut/modules.d/90dm
usr/share/dracut/modules.d/90dmraid
usr/share/dracut/modules.d/90kernel-modules
usr/share/dracut/modules.d/90lvm
usr/share/dracut/modules.d/90mdraid
usr/share/dracut/modules.d/90multipath
usr/share/dracut/modules.d/95dasd
usr/share/dracut/modules.d/95dasd_mod
usr/share/dracut/modules.d/95debug
usr/share/dracut/modules.d/95resume
usr/share/dracut/modules.d/95rootfs-block
usr/share/dracut/modules.d/95terminfo
usr/share/dracut/modules.d/95udev-rules
usr/share/dracut/modules.d/95uswsusp
usr/share/dracut/modules.d/95zfcp
usr/share/dracut/modules.d/95znet
usr/share/dracut/modules.d/98syslog
usr/share/dracut/modules.d/99base
/var/lib/dracut
/etc/dracut.conf.d

4
debian/dracut.docs vendored Normal file
View File

@@ -0,0 +1,4 @@
HACKING
README.generic
README.kernel
README.modules

28
debian/dracut.install vendored Normal file
View File

@@ -0,0 +1,28 @@
dracut usr/sbin
dracut-catimages usr/sbin
dracut-update-initramfs usr/sbin
dracut-gencmdline usr/sbin
dracut-functions usr/share/dracut
dracut.conf etc
modules.d/00dash usr/share/dracut/modules.d
modules.d/01fips usr/share/dracut/modules.d
modules.d/60xen usr/share/dracut/modules.d
modules.d/90crypt usr/share/dracut/modules.d
modules.d/90dm usr/share/dracut/modules.d
modules.d/90dmraid usr/share/dracut/modules.d
modules.d/90kernel-modules usr/share/dracut/modules.d
modules.d/90lvm usr/share/dracut/modules.d
modules.d/90mdraid usr/share/dracut/modules.d
modules.d/90multipath usr/share/dracut/modules.d
modules.d/95dasd usr/share/dracut/modules.d
modules.d/95dasd_mod usr/share/dracut/modules.d
modules.d/95debug usr/share/dracut/modules.d
modules.d/95resume usr/share/dracut/modules.d
modules.d/95rootfs-block usr/share/dracut/modules.d
modules.d/95terminfo usr/share/dracut/modules.d
modules.d/95udev-rules usr/share/dracut/modules.d
modules.d/95uswsusp usr/share/dracut/modules.d
modules.d/95zfcp usr/share/dracut/modules.d
modules.d/95znet usr/share/dracut/modules.d
modules.d/98syslog usr/share/dracut/modules.d
modules.d/99base usr/share/dracut/modules.d

4
debian/dracut.manpages vendored Normal file
View File

@@ -0,0 +1,4 @@
dracut.8
dracut.conf.5
dracut-catimages.8
dracut-gencmdline.8

8
debian/dracut.postinst vendored Normal file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
set -e
# Regenerate initramfs when we're `installed`
DPKG_MAINTSCRIPT_PACKAGE='' dracut-update-initramfs -u
#DEBHELPER#

1
debian/dracut.triggers vendored Normal file
View File

@@ -0,0 +1 @@
interest update-initramfs

3
debian/rules vendored Executable file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk

548
dracut
View File

@@ -1,11 +1,13 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Generator script for a dracut initramfs
# Tries to retain some degree of compatibility with the command line
# of the various mkinitrd implementations out there
#
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
# Copyright 2005-2010 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
@@ -21,10 +23,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# store for logging
dracut_args="$@"
usage() {
# 80x25 linebreak here ^
echo "Usage: $0 [OPTION]... <initramfs> <kernel-version>
cat << EOF
Usage: $0 [OPTION]... <initramfs> <kernel-version>
Creates initial ramdisk images for preloading modules
-f, --force Overwrite existing initramfs file.
@@ -34,218 +39,535 @@ Creates initial ramdisk images for preloading modules
-o, --omit [LIST] Omit a space-separated list of dracut modules.
-a, --add [LIST] Add a space-separated list of dracut modules.
-d, --drivers [LIST] Specify a space-separated list of kernel modules to
include in the initramfs.
exclusively include in the initramfs.
--add-drivers [LIST] Specify a space-separated list of kernel
modules to add to the initramfs.
--filesystems [LIST] Specify a space-separated list of kernel filesystem
modules to exclusively include in the generic
initramfs.
-k, --kmoddir [DIR] Specify the directory, where to look for kernel
modules
--fwdir [DIR] Specify additional directories, where to look for
firmwares, separated by :
--kernel-only Only install kernel drivers and firmware files
--no-kernel Do not install kernel drivers and firmware files
--strip Strip binaries in the initramfs (default)
--nostrip Do not strip binaries in the initramfs
--strip Strip binaries in the initramfs
--nostrip Do not strip binaries in the initramfs (default)
--mdadmconf Include local /etc/mdadm.conf
--nomdadmconf Do not include local /etc/mdadm.conf
--lvmconf Include local /etc/lvm/lvm.conf
--nolvmconf Do not include local /etc/lvm/lvm.conf
-h, --help This message
--debug Output debug information of the build process
-v, --verbose Verbose output during the build process
-L, --stdlog [0-6] Specify logging level (to standard error)
0 - suppress any messages
1 - only fatal errors
2 - all errors
3 - warnings
4 - info (default)
5 - debug info (here starts lots of output)
6 - trace info (and even more)
-v, --verbose Increase verbosity level (default is info(4))
-q, --quiet Decrease verbosity level (default is info(4))
-c, --conf [FILE] Specify configuration file to use.
Default: /etc/dracut.conf
--confdir [DIR] Specify configuration directory to use *.conf files
from. Default: /etc/dracut.conf.d
-l, --local Local mode. Use modules from the current working
directory instead of the system-wide installed in
/usr/share/dracut/modules.d.
Useful when running dracut from a git checkout.
-H, --hostonly Host-Only mode: Install only what is needed for
-H, --hostonly Host-Only mode: Install only what is needed for
booting the local host instead of a generic host.
--fstab Use /etc/fstab to determine the root device.
-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.
-I, --install [LIST] Install the space separated list of files into the
initramfs.
"
--gzip Compress the generated initramfs using gzip.
This will be done by default, unless another
compression option or --no-compress is passed.
--bzip2 Compress the generated initramfs using bzip2.
Make sure your kernel has bzip2 decompression support
compiled in, otherwise you will not be able to boot.
--lzma Compress the generated initramfs using lzma.
Make sure your kernel has lzma support compiled in,
otherwise you will not be able to boot.
--xz Compress the generated initramfs using xz.
Make sure that your kernel has xz support compiled
in, otherwise you will not be able to boot.
--compress [COMPRESSION] Compress the generated initramfs with the
passed compression program. Make sure your kernel
knows how to decompress the generated initramfs,
otherwise you will not be able to boot.
--no-compress Do not compress the generated initramfs. This will
override any other compression options.
--list-modules List all available dracut modules.
-M, --show-modules Print included module's name to standard output during
build.
EOF
}
# function push()
# push values to a stack
# $1 = stack variable
# $2.. values
# example:
# push stack 1 2 "3 4"
push() {
local __stack=$1; shift
for i in "$@"; do
eval ${__stack}'[${#'${__stack}'[@]}]="$i"'
done
}
# function pop()
# pops the last value from a stack
# assigns value to second argument variable
# or echo to stdout, if no second argument
# $1 = stack variable
# $2 = optional variable to store the value
# example:
# pop stack val
# val=$(pop stack)
pop() {
local __stack=$1; shift
local __resultvar=$1
local myresult;
# check for empty stack
eval '[[ ${#'${__stack}'[@]} -eq 0 ]] && return 1'
eval myresult='${'${__stack}'[${#'${__stack}'[@]}-1]}'
if [[ "$__resultvar" ]]; then
eval $__resultvar="'$myresult'"
else
echo "$myresult"
fi
eval unset ${__stack}'[${#'${__stack}'[@]}-1]'
return 0
}
# 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
}
# Little helper function for reading args from the commandline to a stack.
# it automatically handles -a b and -a=b variants, and returns 1 if
# we need to shift $3.
push_arg() {
# $1 = arg name
# $2 = arg value
# $3 = arg parameter
local rematch='^[^=]*=(.*)$'
if [[ $2 =~ $rematch ]]; then
push "$1" "${BASH_REMATCH[1]}"
else
push "$1" "$3"
# There is no way to shift our callers args, so
# return 1 to indicate they should do it instead.
return 1
fi
}
verbosity_mod_l=0
while (($# > 0)); do
case $1 in
-f|--force) force=yes;;
-m|--modules) dracutmodules_l="$2"; shift;;
-o|--omit) omit_dracutmodules_l="$2"; shift;;
-a|--add) add_dracutmodules_l="$2"; shift;;
-d|--drivers) drivers_l="$2"; shift;;
-k|--kmoddir) drivers_dir_l="$2"; shift;;
--fwdir) fw_dir_l="$2"; shift;;
--kernel-only) kernel_only="yes"; nokernel="no";;
--no-kernel) kernel_only="no"; no_kernel="yes";;
--strip) do_strip_l="yes";;
--nostrip) do_strip_l="no";;
-h|--help) usage; exit 1 ;;
--debug) debug="yes";;
-v|--verbose) beverbose="yes";;
-c|--conf) conffile="$2"; shift;;
-l|--local) allowlocal="yes" ;;
-H|--hostonly) hostonly_l="yes" ;;
-i|--include) include_src="$2"; include_target="$3"; shift 2;;
-I|--install) install_items="$2"; shift;;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
*) break ;;
case ${1%%=*} in
-a|--add) push_arg add_dracutmodules_l "$@" || shift;;
--add-drivers) push_arg add_drivers_l "$@" || shift;;
-m|--modules) push_arg dracutmodules_l "$@" || shift;;
-o|--omit) push_arg omit_dracutmodules_l "$@" || shift;;
-d|--drivers) push_arg drivers_l "$@" || shift;;
--filesystems) push_arg filesystems_l "$@" || shift;;
-I|--install) push_arg install_items "$@" || shift;;
--fwdir) push_arg fw_dir_l "$@" || shift;;
-k|--kmoddir) read_arg drivers_dir_l "$@" || shift;;
-c|--conf) read_arg conffile "$@" || shift;;
--confdir) read_arg confdir "$@" || shift;;
-L|--stdlog) read_arg stdloglvl_l "$@" || shift;;
-I|--install) read_arg install_items "$@" || shift;;
--fwdir) read_arg fw_dir_l "$@" || shift;;
--compress) read_arg compress_l "$@" || shift;;
-f|--force) force=yes;;
--kernel-only) kernel_only="yes"; no_kernel="no";;
--no-kernel) kernel_only="no"; no_kernel="yes";;
--strip) do_strip_l="yes";;
--nostrip) do_strip_l="no";;
--mdadmconf) mdadmconf_l="yes";;
--nomdadmconf) mdadmconf_l="no";;
--lvmconf) lvmconf_l="yes";;
--nolvmconf) lvmconf_l="no";;
--debug) debug="yes";;
-v|--verbose) ((verbosity_mod_l++));;
-q|--quiet) ((verbosity_mod_l--));;
-l|--local) allowlocal="yes" ;;
-H|--hostonly) hostonly_l="yes" ;;
--fstab) use_fstab_l="yes" ;;
-h|--help) usage; exit 1 ;;
-i|--include) push include_src "$2"
push include_target "$3"
shift 2;;
--bzip2) compress_l="bzip2";;
--lzma) compress_l="lzma";;
--xz) compress_l="xz";;
--no-compress) _no_compress_l="cat";;
--gzip) compress_l="gzip";;
--list-modules)
do_list="yes";
;;
-M|--show-modules)
show_modules_l="yes"
;;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
*)
if ! [[ ${outfile+x} ]]; then
outfile=$1
elif ! [[ ${kernel+x} ]]; then
kernel=$1
else
usage; exit 1;
fi
;;
esac
shift
done
if ! [[ $kernel ]]; then
kernel=$(uname -r)
fi
[[ $outfile ]] || outfile="/boot/initramfs-$kernel.img"
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
[[ $debug ]] && {
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
set -x
}
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
[[ $allowlocal && -f "$(readlink -f ${0%/*})/dracut-functions" ]] && \
dracutbasedir="$(readlink -f ${0%/*})"
# if we were not passed a config file, try the default one
[[ ! -f $conffile ]] && conffile="/etc/dracut.conf"
if [[ ! -f $conffile ]]; then
[[ $allowlocal ]] && conffile="$dracutbasedir/dracut.conf" || \
conffile="/etc/dracut.conf"
fi
if [[ ! -d $confdir ]]; then
[[ $allowlocal ]] && confdir="$dracutbasedir/dracut.conf.d" || \
confdir="/etc/dracut.conf.d"
fi
# source our config file
[[ -f $conffile ]] && . "$conffile"
# source our config dir
if [[ $confdir && -d $confdir ]]; then
for f in "$confdir"/*.conf; do
[[ -e $f ]] && . "$f"
done
fi
# these optins add to the stuff in the config file
if (( ${#add_dracutmodules_l[@]} )); then
while pop add_dracutmodules_l val; do
add_dracutmodules+=" $val "
done
fi
if (( ${#add_drivers_l[@]} )); then
while pop add_drivers_l val; do
add_drivers+=" $val "
done
fi
# these options override the stuff in the config file
[[ $dracutmodules_l ]] && dracutmodules=$dracutmodules_l
[[ $omit_dracutmodules_l ]] && omit_dracutmodules=$omit_dracutmodules_l
[[ $add_dracutmodules_l ]] && add_dracutmodules="$add_dracutmodules $add_dracutmodules_l"
[[ $drivers_l ]] && drivers=$drivers_l
if (( ${#dracutmodules_l[@]} )); then
dracutmodules=''
while pop dracutmodules_l val; do
dracutmodules+="$val "
done
fi
if (( ${#omit_dracutmodules_l[@]} )); then
omit_dracutmodules=''
while pop omit_dracutmodules_l val; do
omit_dracutmodules+="$val "
done
fi
if (( ${#drivers_l[@]} )); then
drivers=''
while pop drivers_l val; do
drivers+="$val "
done
fi
if (( ${#filesystems_l[@]} )); then
filesystems=''
while pop filesystems_l val; do
filesystems+="$val "
done
fi
if (( ${#fw_dir_l[@]} )); then
fw_dir=''
while pop fw_dir_l val; do
fw_dir+="$val "
done
fi
[[ $stdloglvl_l ]] && stdloglvl=$stdloglvl_l
[[ ! $stdloglvl ]] && stdloglvl=4
stdloglvl=$((stdloglvl + verbosity_mod_l))
((stdloglvl > 6)) && stdloglvl=6
((stdloglvl < 0)) && stdloglvl=0
[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
[[ $fw_dir_l ]] && fw_dir=$fw_dir_l
[[ $do_strip_l ]] && do_strip=$do_strip_l
[[ $hostonly_l ]] && hostonly=$hostonly_l
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
[[ $fw_dir ]] || fw_dir=/lib/firmware
[[ $do_strip ]] || do_strip=yes
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware"
[[ $do_strip ]] || do_strip=no
[[ $compress_l ]] && compress=$compress_l
[[ $show_modules_l ]] && show_modules=$show_modules_l
# eliminate IFS hackery when messing with fw_dir
fw_dir=${fw_dir//:/ }
[[ $hostonly = yes ]] && hostonly="-h"
[[ $allowlocal && -f "$(dirname $0)/dracut-functions" ]] && dsrc="$(dirname $0)" || dsrc=$dracutbasedir
if [[ -f $dsrc/dracut-functions ]]; then
. $dsrc/dracut-functions
else
echo "Cannot find $dsrc/dracut-functions. Are you running from a git checkout?"
echo "Try passing -l as an argument to $0"
exit 1
# handle compression options.
case $compress in
bzip2) compress="bzip -9";;
lzma) compress="lzma -9";;
xz) compress="xz --check=crc32 --lzma2=dict=1MiB";;
gzip) type pigz > /dev/null 2>&1 && compress="pigz -9" || \
compress="gzip -9";;
esac
if [[ $_no_compress_l = "cat" ]]; then
compress="cat"
fi
dracutfunctions=$dsrc/dracut-functions
[[ $hostonly = yes ]] && hostonly="-h"
[[ $hostonly != "-h" ]] && unset hostonly
[[ $compress ]] || compress="gzip -9"
if [[ -f $dracutbasedir/dracut-functions ]]; then
. $dracutbasedir/dracut-functions
else
echo "Cannot find $dracutbasedir/dracut-functions." >&2
echo "Are you running from a git checkout?" >&2
echo "Try passing -l as an argument to $0" >&2
exit 1
fi
dracutfunctions=$dracutbasedir/dracut-functions
export dracutfunctions
ddebug "Executing $0 $dracut_args"
[[ $do_list = yes ]] && {
for mod in $dracutbasedir/modules.d/*; do
[[ -d $mod ]] || continue;
[[ -e $mod/install || -e $mod/installkernel || \
-e $mod/module-setup.sh ]] || continue
echo ${mod##*/??}
done
exit 0
}
# Detect lib paths
[[ $libdir ]] || for libdir in /lib64 /lib; do
[[ -d $libdir ]] && break
done || {
dfatal 'No lib directory?!!!'
exit 1
}
[[ $usrlibdir ]] || for usrlibdir in /usr/lib64 /usr/lib; do
[[ -d $usrlibdir ]] && break
done || dwarn 'No usr/lib directory!'
# This is kinda legacy -- eventually it should go away.
case $dracutmodules in
""|auto) dracutmodules="all" ;;
esac
[[ $2 ]] && kernel=$2 || kernel=$(uname -r)
[[ $1 ]] && outfile=$(readlink -f $1) || outfile="/boot/initrd-$kernel.img"
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
srcmods="/lib/modules/$kernel/"
[[ $drivers_dir ]] && srcmods="$drivers_dir"
[[ $drivers_dir ]] && {
if vercmp $(modprobe --version | cut -d' ' -f3) lt 3.7; then
dfatal 'To use --kmoddir option module-init-tools >= 3.7 is required.'
exit 1
fi
srcmods="$drivers_dir"
}
export srcmods
if [[ -f $outfile && ! $force ]]; then
echo "Will not override existing initramfs ($outfile) without --force"
dfatal "Will not override existing initramfs ($outfile) without --force"
exit 1
fi
hookdirs="cmdline pre-udev pre-trigger netroot pre-mount pre-pivot mount emergency"
outdir=${outfile%/*}
[[ $outdir ]] || outdir="/"
if [[ ! -d "$outdir" ]]; then
dfatal "Can't write $outfile: Directory $outdir does not exist."
exit 1
elif [[ ! -w "$outdir" ]]; then
dfatal "No permission to write $outdir."
exit 1
elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
dfatal "No permission to write $outfile."
exit 1
fi
[[ $TMPDIR && ! -w $TMPDIR ]] && unset TMPDIR
readonly initdir=$(mktemp -d -t initramfs.XXXXXX)
trap 'rm -rf "$initdir"' 0 # clean up after ourselves no matter how we die.
# clean up after ourselves no matter how we die.
trap 'ret=$?;rm -rf "$initdir";exit $ret;' EXIT
# clean up after ourselves no matter how we die.
trap 'exit 1;' SIGINT
# Need to be able to have non-root users read stuff (rpcbind etc)
chmod 755 "$initdir"
export initdir hookdirs dsrc dracutmodules drivers \
fw_dir drivers_dir debug beverbose no_kernel kernel_only
export initdir dracutbasedir dracutmodules drivers \
fw_dir drivers_dir debug no_kernel kernel_only \
add_drivers mdadmconf lvmconf filesystems \
use_fstab libdir usrlibdir \
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
debug
if [[ $kernel_only != yes ]]; then
# Create some directory structure first
for d in bin sbin usr/bin usr/sbin usr/lib etc proc sys sysroot tmp dev/pts var/run; do
mkdir -p "$initdir/$d";
for d in bin sbin usr/bin usr/sbin usr/lib etc \
proc sys sysroot tmp dev/pts var/run; do
inst_dir "/$d";
done
fi
# check all our modules to see if they should be sourced.
# This builds a list of modules that we will install next.
check_modules
#source our modules.
for moddir in "$dsrc/modules.d"/[0-9][0-9]*; do
check_module_dir
# source our modules.
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
if strstr "$mods_to_load" " $mod "; then
if [[ $kernel_only = yes ]]; then
[[ -x $moddir/installkernel ]] && . "$moddir/installkernel"
else
. "$moddir/install"
if [[ $no_kernel != yes && -x $moddir/installkernel ]]; then
. "$moddir/installkernel"
fi
fi
mods_to_load=${mods_to_load// $mod /}
[[ $show_modules = yes ]] && echo "$mod" || \
dinfo "*** Including module: $mod ***"
if [[ $kernel_only = yes ]]; then
module_installkernel $mod
else
module_install $mod
if [[ $no_kernel != yes ]]; then
module_installkernel $mod
fi
fi
mods_to_load=${mods_to_load// $mod /}
fi
done
unset moddir
echo $mods_to_load
dinfo "*** Including modules done ***"
## final stuff that has to happen
# generate module dependencies for the initrd
if [[ -d $initdir/lib/modules/$kernel ]]; then
if ! depmod -a -b "$initdir" $kernel; then
echo "\"depmod -a $kernel\" failed."
exit 1
if [[ -d $initdir/lib/modules/$kernel ]] && \
! depmod -a -b "$initdir" $kernel; then
dfatal "\"depmod -a $kernel\" failed."
exit 1
fi
while pop include_src src && pop include_target tgt; do
if [[ $src && $tgt ]]; then
if [[ -f $src ]]; then
inst $src $tgt
else
ddebug "Including directory: $src"
mkdir -p "${initdir}/${tgt}"
cp -a -t "${initdir}/${tgt}" "$src"/*
fi
fi
fi
done
# make sure that library links are correct and up to date
ldconfig -n -r "$initdir" /lib* /usr/lib*
if [[ $include_src && $include_target ]]; then
mkdir -p "$initdir$include_target"
cp -a -t "$initdir$include_target" "$include_src"/*
fi
for item in $install_items; do
dracut_install "$item"
while pop install_items items; do
for item in $items; do
dracut_install "$item"
done
done
unset item
[[ $beverbose = yes ]] && (du -c "$initdir" | sort -n)
# make sure that library links are correct and up to date
dracut_install /etc/ld.so.conf /etc/ld.so.conf.d/*
if ! ldconfig -r "$initdir"; then
if [[ $UID = 0 ]]; then
derror "ldconfig exited ungracefully"
else
derror "ldconfig might need uid=0 (root) for chroot()"
fi
fi
if (($maxloglvl >= 5)); then
ddebug "Listing sizes of included files:"
du -c "$initdir" | sort -n | ddebug
fi
# strip binaries
if [[ $do_strip = yes ]] ; then
for p in strip objdump sed grep find; do
if ! which $p >/dev/null 2>&1; then
derror "Could not find '$p'. You should run $0 with '--nostrip'."
do_strip=no
fi
for p in strip grep find; do
if ! type -P $p >/dev/null; then
derror "Could not find '$p'. You should run $0 with '--nostrip'."
do_strip=no
fi
done
fi
if [[ $do_strip = yes ]] ; then
for f in $(find "$initdir" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; |
grep -v ' shared object,' |
sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'); do
dinfo "Stripping $f"
strip -g "$f" || :
#
# FIXME: only strip -g for now
#
#strip -g --strip-unneeded "$f" || :
#note="-R .note"
#if objdump -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \
# grep -q ALLOC; then
# note=
#fi
#strip -R .comment $note "$f" || :
for f in $(find "$initdir" -type f \
\( -perm -0100 -or -perm -0010 -or -perm -0001 \
-or -path '*/lib/modules/*.ko' \) ); do
dinfo "Stripping $f"
strip -g "$f" 2>/dev/null|| :
done
fi
( cd "$initdir"; find . |cpio -R 0:0 -H newc -o |gzip -9 > "$outfile"; )
type hardlink &>/dev/null && {
hardlink "$initdir" 2>&1
}
[[ $beverbose = yes ]] && ls -lh "$outfile"
if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet | \
$compress > "$outfile"; ); then
dfatal "dracut: creation of $outfile failed"
exit 1
fi
dinfo "Wrote $outfile:"
dinfo "$(ls -l "$outfile")"
exit 0

View File

@@ -1,5 +1,7 @@
#!/bin/bash --norc
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Copyright 2009 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
@@ -31,7 +33,8 @@ derror() {
usage() {
# 80x25 linebreak here ^
echo "Usage: $0 [OPTION]... <initramfs> <base image> [<image>...]
cat << EOF
Usage: $0 [OPTION]... <initramfs> <base image> [<image>...]
Creates initial ramdisk image by concatenating several images from the command
line and /boot/dracut/
@@ -45,7 +48,7 @@ line and /boot/dracut/
-h, --help This message
--debug Output debug information of the build process
-v, --verbose Verbose output during the build process
"
EOF
}
@@ -54,16 +57,16 @@ overlay=/var/lib/dracut/overlay
while (($# > 0)); do
case $1 in
-f|--force) force=yes;;
-i|--imagedir) imagedir=$2;shift;;
-o|--overlaydir) overlay=$2;shift;;
--nooverlay) no_overlay=yes;shift;;
--noimagedir) no_imagedir=yes;shift;;
-h|--help) usage; exit 1 ;;
--debug) debug="yes";;
-v|--verbose) beverbose="yes";;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
*) break ;;
-f|--force) force=yes;;
-i|--imagedir) imagedir=$2;shift;;
-o|--overlaydir) overlay=$2;shift;;
--nooverlay) no_overlay=yes;shift;;
--noimagedir) no_imagedir=yes;shift;;
-h|--help) usage; exit 1 ;;
--debug) debug="yes";;
-v|--verbose) beverbose="yes";;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
*) break ;;
esac
shift
done
@@ -102,12 +105,13 @@ fi
if [[ ! $no_overlay ]]; then
ofile="$imagedir/90-overlay.img"
dinfo "Creating image $ofile from directory $overlay"
( cd "$overlay"; find . |cpio --quiet -H newc -o |gzip -9 > "$ofile"; )
type pigz &>/dev/null && gzip=pigz || gzip=gzip
( cd "$overlay"; find . |cpio --quiet -H newc -o |$gzip -9 > "$ofile"; )
fi
if [[ ! $no_imagedir ]]; then
for i in "$imagedir/"*.img; do
[[ -f $i ]] && images+=("$i")
[[ -f $i ]] && images+=("$i")
done
fi

116
dracut-catimages.8.xml Normal file
View File

@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
<!-- lifted from troff+man by doclifter -->
<refentry id='dracutcatimages8'>
<refmeta>
<refentrytitle>DRACUT-CATIMAGES</refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo class='source'>June 2009</refmiscinfo>
<refmiscinfo class='manual'>Linux</refmiscinfo>
</refmeta>
<refnamediv id='name'>
<refname>dracut-catimages</refname>
<refpurpose>creates initial ramdisk image by concatenating images</refpurpose>
</refnamediv>
<!-- body begins here -->
<refsynopsisdiv id='synopsis'>
<cmdsynopsis>
<command>dracut-catimages</command> <arg choice='opt' rep='repeat'><replaceable>OPTION</replaceable></arg>
<arg choice='plain'><replaceable>&lt;initramfs</replaceable></arg>
<arg choice='plain'><replaceable>base</replaceable></arg>
<arg choice='plain'><replaceable>image&gt;</replaceable></arg>
<arg choice='opt' rep='repeat'><replaceable>&lt;image&gt;</replaceable></arg>
<sbr/>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id='description'><title>DESCRIPTION</title>
<para><command>dracut-catimages</command>
creates an initial ramdisk image by concatenating several images from the command
line and /boot/dracut/*.img</para>
</refsect1>
<refsect1 id='options'><title>OPTIONS</title>
<variablelist remap='TP'>
<varlistentry>
<term><option>-f</option>, <option>--force</option></term>
<listitem>
<para>overwrite existing initramfs file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-i</option>, <option>--imagedir</option></term>
<listitem>
<para>Directory with additional images to add (default: /boot/dracut/)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-o</option>, <option>--overlaydir</option></term>
<listitem>
<para>Overlay directory, which contains additional files that will be used to create an additional image</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--nooverlay</option></term>
<listitem>
<para>Do not use the overlay directory</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--noimagedir</option></term>
<listitem>
<para>Do not use the additional image directory</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option>, <option>--help</option></term>
<listitem>
<para>display help text and exit.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--debug</option></term>
<listitem>
<para>output debug information of the build process</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-v</option>, <option>--verbose</option></term>
<listitem>
<para>verbose output during the build process</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='files'><title>FILES</title>
<variablelist remap='TP'>
<varlistentry>
<term><filename>/boot/dracut/*.img</filename></term>
<listitem>
<para></para> <!-- FIXME: blank list item -->
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='authors'><title>AUTHORS</title>
<literallayout remap='.nf'>
Harald Hoyer &lt;harald@redhat.com&gt;
</literallayout> <!-- .fi -->
</refsect1>
<refsect1 id='availability'><title>AVAILABILITY</title>
<para>The dracut-catimages command is part of the dracut package and is available from
<ulink url='http://sourceforge.net/apps/trac/dracut/wiki'>http://sourceforge.net/apps/trac/dracut/wiki</ulink></para>
</refsect1>
<refsect1 id='see_also'><title>SEE ALSO</title>
<para><citerefentry><refentrytitle>dracut</refentrytitle><manvolnum>8</manvolnum></citerefentry></para>
</refsect1>
</refentry>

View File

@@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# functions used by dracut and other tools.
#
@@ -18,49 +20,93 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
if ! [[ $dracutbasedir ]]; then
dracutbasedir=${BASH_SOURCE[0]%/*}
[[ $dracutbasedir = "dracut-functions" ]] && dracutbasedir="."
[[ $dracutbasedir ]] || dracutbasedir="."
dracutbasedir="$(readlink -f $dracutbasedir)"
fi
if ! type dinfo >/dev/null 2>&1; then
. "$dracutbasedir/dracut-logger"
dlog_init
fi
IF_RTLD=""
IF_dynamic=""
# Generic substring function. If $2 is in $1, return 0.
strstr() { [[ $1 =~ $2 ]]; }
# Log initrd creation.
if ! [[ $dracutlogfile ]]; then
[[ $dsrc = /usr/share/dracut ]] && \
dracutlogfile=/var/log/dracut.log || \
dracutlogfile=/tmp/dracut.log
# [[ -w $dracutlogfile ]] || dracutlogfile=/tmp/dracut.log
if [[ -w $dracutlogfile ]]; then
>"$dracutlogfile"
fi
fi
# Create all subdirectories for given path without creating the last element.
# $1 = path
mksubdirs() { mkdir -m 0755 -p ${1%/*}; }
dwarning() {
echo "W: $@" >&2
[[ -w $dracutlogfile ]] && echo "W: $@" >>"$dracutlogfile"
# Version comparision function. Assumes Linux style version scheme.
# $1 = version a
# $2 = comparision op (gt, ge, eq, le, lt, ne)
# $3 = version b
vercmp() {
local n1=(${1//./ }) op=$2 n2=(${3//./ }) i res
for ((i=0; ; i++))
do
if [[ ! ${n1[i]}${n2[i]} ]]; then res=0
elif ((${n1[i]:-0} > ${n2[i]:-0})); then res=1
elif ((${n1[i]:-0} < ${n2[i]:-0})); then res=2
else continue
fi
break
done
case $op in
gt) ((res == 1));;
ge) ((res != 2));;
eq) ((res == 0));;
le) ((res != 1));;
lt) ((res == 2));;
ne) ((res != 0));;
esac
}
dinfo() {
[[ $beverbose ]] && echo "I: $@" >&2
[[ -w $dracutlogfile ]] && echo "I: $@" >>"$dracutlogfile"
is_func() {
[[ $(type -t $1) = "function" ]]
}
derror() {
echo "E: $@" >&2
[[ -w $dracutlogfile ]] && echo "E: $@" >>"$dracutlogfile"
# Function prints global variables in format name=value line by line.
# $@ = list of global variables' name
print_vars() {
local var value
for var in $@
do
value=$(eval echo \$$var)
[[ ${value} ]] && echo "${var}=\"${value}\""
done
}
get_fs_env() {
[[ $1 ]] || return
eval $(udevadm info --query=env --name=$1|egrep 'ID_FS_(TYPE|UUID)=')
[[ $ID_FS_TYPE ]] && return
if [[ -x /lib/udev/vol_id ]]; then
eval $(/lib/udev/vol_id --export $1)
eval $(/lib/udev/vol_id --export $1)
elif find_binary blkid >/dev/null; then
eval $(blkid -o udev $1)
eval $(blkid -o udev $1)
else
return 1
return 1
fi
}
get_fs_type() (
[[ $1 ]] || return
if [[ $1 != ${1#/dev/block/nfs:} ]] \
|| [[ $1 != ${1#/dev/block/nfs3:} ]] \
|| [[ $1 != ${1#/dev/block/nfs4:} ]]; then
echo "nfs"
return
fi
get_fs_env $1 || return
echo $ID_FS_TYPE
)
@@ -72,15 +118,43 @@ get_fs_uuid() (
# finds the major:minor of the block device backing the root filesystem.
find_block_device() {
local rootdev blkdev fs type opts misc
while read blkdev fs type opts misc; do
[[ $blkdev = rootfs ]] && continue # skip rootfs entry
[[ $fs = $1 ]] && { rootdev=$blkdev; break; } # we have a winner!
done < /proc/mounts
[[ -b $rootdev ]] || return 1 # oops, not a block device.
# get major/minor for the device
ls -nLl "$rootdev" | \
(read x x x x maj min x; maj=${maj//,/}; echo $maj:$min)
local x mpt majmin dev fs misc maj min
if [[ $use_fstab != yes ]]; then
while read x x majmin x mpt x x fs dev misc; do
[[ $fs = nfs ]] && { echo $dev; return 0;}
[[ $fs = nfs3 ]] && { echo $dev; return 0;}
[[ $fs = nfs4 ]] && { echo $dev; return 0;}
[[ $fs = btrfs ]] && {
ls -nLl "$dev" | {
read x x x x maj min x
maj=${maj//,/}
echo $maj:$min
} && return 0
}
if [[ $mpt = $1 ]] && [[ ${majmin#0:} = $majmin ]]; then
echo $majmin
return 0 # we have a winner!
fi
done < /proc/self/mountinfo
fi
# fall back to /etc/fstab
while read dev mpt fs misc; do
if [[ $mpt = $1 ]]; then
[[ $fs = nfs ]] && { echo $dev; return 0;}
[[ $fs = nfs3 ]] && { echo $dev; return 0;}
[[ $fs = nfs4 ]] && { echo $dev; return 0;}
[[ $dev != ${dev#UUID=} ]] && dev=/dev/disk/by-uuid/${dev#UUID=}
[[ $dev != ${dev#LABEL=} ]] && dev=/dev/disk/by-label/${dev#LABEL=}
[[ -b $dev ]] || return 1 # oops, not a block device.
ls -nLl "$dev" | {
read x x x x maj min x
maj=${maj//,/}
echo $maj:$min
} && return 0
fi
done < /etc/fstab
return 1
}
find_root_block_device() { find_block_device /; }
@@ -89,21 +163,24 @@ find_root_block_device() { find_block_device /; }
# Stop when our helper function returns success
# $1 = function to call on every found block device
# $2 = block device in major:minor format
check_block_and_slaves() {
local x
check_block_and_slaves() {
local x
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
"$1" $2 && return
check_vol_slaves "$@" && return 0
if [[ -f /sys/dev/block/$2/../dev ]]; then
check_block_and_slaves $1 $(cat "/sys/dev/block/$2/../dev") && return 0
fi
[[ -d /sys/dev/block/$2/slaves ]] || return 1
for x in /sys/dev/block/$2/slaves/*/dev; do
[[ -f $x ]] || continue
check_block_and_slaves $1 $(cat "$x") && return 0
check_block_and_slaves $1 $(cat "$x") && return 0
done
return 1
}
get_numeric_dev() {
ls -lH "$1" | { read a b c d maj min rest; printf "%d:%d" ${maj%%,} $min;}
ls -lH "$1" | { read a b c d maj min rest; printf "%d:%d" ${maj%%,} $min; }
}
# ugly workaround for the lvm design
@@ -111,26 +188,55 @@ get_numeric_dev() {
# so, there are no slave devices for volume groups.
# Logical volumes only have the slave devices they really live on,
# but you cannot create the logical volume without the volume group.
# And the volume group might be bigger than the devices the LV needes.
# And the volume group might be bigger than the devices the LV needs.
check_vol_slaves() {
for i in /dev/mapper/*; do
lv=$(get_numeric_dev $i)
if [[ $lv = $2 ]]; then
vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
# strip space
vg=$(echo $vg)
if [[ $vg ]]; then
for pv in $(lvm vgs --noheadings -o pv_name "$vg" 2>/dev/null); \
do
check_block_and_slaves $1 $(get_numeric_dev $pv) \
&& return 0
done
fi
fi
for i in /dev/mapper/*; do
lv=$(get_numeric_dev $i)
if [[ $lv = $2 ]]; then
vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
# strip space
vg=$(echo $vg)
if [[ $vg ]]; then
for pv in $(lvm vgs --noheadings -o pv_name "$vg" 2>/dev/null)
do
check_block_and_slaves $1 $(get_numeric_dev $pv) && return 0
done
fi
fi
done
return 1
}
# Install a directory, keeping symlinks as on the original system.
# Example: if /lib64 points to /lib on the host, "inst_dir /lib/file"
# will create ${initdir}/lib64, ${initdir}/lib64/file,
# and a symlink ${initdir}/lib -> lib64.
inst_dir() {
local dir="$1"
[[ -e ${initdir}$dir ]] && return 0
# iterate over parent directories
local file=""
local IFS="/"
for part in $dir; do
[[ $part ]] || continue
file="$file/$part"
[[ -e ${initdir}$file ]] && continue
if [[ -L $file ]]; then
# create link as the original
local target=$(readlink "$file")
ln -sfn "$target" "${initdir}$file" || return 1
# resolve relative path and recursively install destination
[[ $target == ${target#/} ]] && target="$(dirname "$file")/$target"
inst_dir "$target"
else
# create directory
mkdir -m 0755 -p "${initdir}$file" || return 1
fi
done
}
# $1 = file to copy to ramdisk
# $2 (optional) Name for the file on the ramdisk
# Location of the image dir is assumed to be $initdir
@@ -138,37 +244,85 @@ check_vol_slaves() {
inst_simple() {
local src target
[[ -f $1 ]] || return 1
src=$1 target=${initdir}${2:-$1}
[[ -f $target ]] && return 0
mkdir -p "${target%/*}"
dinfo "Installing $src"
cp -pfL "$src" "$target"
src=$1 target="${2:-$1}"
if ! [[ -d ${initdir}$target ]]; then
[[ -e ${initdir}$target ]] && return 0
inst_dir "${target%/*}"
fi
# install checksum files also
if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then
inst "${src%/*}/.${src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
fi
ddebug "Installing $src"
cp -pfL "$src" "${initdir}$target"
}
# Same as above, but specialzed to handle dynamic libraries.
# find symlinks linked to given library file
# $1 = library file
# Function searches for symlinks by stripping version numbers appended to
# library filename, checks if it points to the same target and finally
# prints the list of symlinks to stdout.
#
# Example:
# rev_lib_symlinks libfoo.so.8.1
# output: libfoo.so.8 libfoo.so
# (Only if libfoo.so.8 and libfoo.so exists on host system.)
rev_lib_symlinks() {
[[ ! $1 ]] && return 0
local fn="$1" orig="$(readlink -f "$1")" links=''
[[ ${fn} =~ .*\.so\..* ]] || return 1
until [[ ${fn##*.} == so ]]; do
fn="${fn%.*}"
[[ -L ${fn} && $(readlink -f "${fn}") == ${orig} ]] && links+=" ${fn}"
done
echo "${links}"
}
# Same as above, but specialized to handle dynamic libraries.
# It handles making symlinks according to how the original library
# is referenced.
inst_library() {
local src=$1 dest=${2:-$1}
[[ -f $initdir$dest ]] && return 0
local src=$1 dest=${2:-$1} lib reallib symlink
[[ -e $initdir$dest ]] && return 0
if [[ -L $src ]]; then
reallib=$(readlink -f "$src")
lib=${src##*/}
inst_simple "$reallib" "$reallib"
mkdir -p "${initdir}${dest%/*}"
(cd "${initdir}${dest%/*}" && ln -s "$reallib" "$lib")
# install checksum files also
if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then
inst "${src%/*}/.${src##*/}.hmac" "${dest%/*}/.${dest##*/}.hmac"
fi
reallib=$(readlink -f "$src")
lib=${src##*/}
inst_simple "$reallib" "$reallib"
inst_dir "${dest%/*}"
(cd "${initdir}${dest%/*}" && ln -s "$reallib" "$lib")
else
inst_simple "$src" "$dest"
inst_simple "$src" "$dest"
fi
# Create additional symlinks. See rev_symlinks description.
for symlink in $(rev_lib_symlinks $src) $(rev_lib_symlinks $reallib); do
[[ ! -e $initdir$symlink ]] && {
ddebug "Creating extra symlink: $symlink"
inst_symlink $symlink
}
done
}
# find a binary. If we were not passed the full path directly,
# search in the usual places to find the binary.
find_binary() {
local binpath="/bin /sbin /usr/bin /usr/sbin" p
[[ -z ${1##/*} && -x $1 ]] && { echo $1; return 0; }
if [[ -z ${1##/*} ]]; then
if [[ -x $1 ]] || ldd $1 &>/dev/null; then
echo $1
return 0
fi
fi
for p in $binpath; do
[[ -x $p/$1 ]] && { echo "$p/$1"; return 0; }
[[ -x $p/$1 ]] && { echo "$p/$1"; return 0; }
done
return 1
}
@@ -179,37 +333,38 @@ inst_binary() {
local bin target
bin=$(find_binary "$1") || return 1
target=${2:-$bin}
inst_symlink $bin $target && return 0
local LDSO NAME IO FILE ADDR I1 n f TLIBDIR
[[ -f $initdir$target ]] && return 0
[[ -e $initdir$target ]] && return 0
# I love bash!
ldd $bin 2>/dev/null | while read line; do
[[ $line = 'not a dynamic executable' ]] && return 1
if [[ $line =~ not\ found ]]; then
derror "Missing a shared library required by $bin."
derror "Run \"ldd $bin\" to find out what it is."
derror "dracut cannot create an initrd."
exit 1
fi
so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
[[ $line =~ $so_regex ]] || continue
FILE=${BASH_REMATCH[1]}
[[ -f ${initdir}$FILE ]] && continue
# see if we are loading an optimized version of a shared lib.
lib_regex='^(/lib[^/]*).*'
if [[ $FILE =~ $lib_regex ]]; then
LC_ALL=C ldd $bin 2>/dev/null | while read line; do
[[ $line = 'not a dynamic executable' ]] && return 1
if [[ $line =~ not\ found ]]; then
dfatal "Missing a shared library required by $bin."
dfatal "Run \"ldd $bin\" to find out what it is."
dfatal "dracut cannot create an initrd."
exit 1
fi
so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
[[ $line =~ $so_regex ]] || continue
FILE=${BASH_REMATCH[1]}
[[ -e ${initdir}$FILE ]] && continue
# see if we are loading an optimized version of a shared lib.
lib_regex='^(/lib[^/]*).*'
if [[ $FILE =~ $lib_regex ]]; then
TLIBDIR=${BASH_REMATCH[1]}
BASE=${FILE##*/}
# prefer nosegneg libs, then unoptimized ones.
for f in "$TLIBDIR/i686/nosegneg" "$TLIBDIR"; do
[[ -f $f/$BASE ]] || continue
FILE=$f/$BASE
break
done
inst_library "$FILE" "$TLIBDIR/$BASE"
# prefer nosegneg libs, then unoptimized ones.
for f in "$TLIBDIR/i686/nosegneg" "$TLIBDIR"; do
[[ -e $f/$BASE ]] || continue
FILE=$f/$BASE
break
done
inst_library "$FILE" "$TLIBDIR/$BASE"
IF_dynamic=yes
continue
fi
inst_library "$FILE"
continue
fi
inst_library "$FILE"
done
inst_simple "$bin" "$target"
}
@@ -234,127 +389,280 @@ inst_symlink() {
[[ -L $target ]] && return 0
realsrc=$(readlink -f "$src")
[[ $realsrc = ${realsrc##*/} ]] && realsrc=${src%/*}/$realsrc
inst "$realsrc" && ln -s "$realsrc" "$target"
inst "$realsrc" && mkdir -m 0755 -p "${target%/*}" && \
ln -s "$realsrc" "$target"
}
# find a rule in the usual places.
# find a udev rule in the usual places.
find_rule() {
[[ -f $1 ]] && { echo "$1"; return 0; }
for r in . /lib/udev/rules.d /etc/udev/rules.d $dsrc/rules.d; do
[[ -f $r/$1 ]] && { echo "$r/$1"; return 0; }
for r in . /lib/udev/rules.d /etc/udev/rules.d $dracutbasedir/rules.d; do
[[ -f $r/$1 ]] && { echo "$r/$1"; return 0; }
done
return 1
}
# udev rules always get installed in the same place, so
# create a function to install them to make life simpler.
inst_rules() {
local target=/etc/udev/rules.d
mkdir -p "$initdir/lib/udev/rules.d" "$initdir$target"
inst_rules() {
local target=/etc/udev/rules.d rule found
inst_dir "/lib/udev/rules.d"
inst_dir "$target"
for rule in "$@"; do
rule=$(find_rule "$rule") && \
inst_simple "$rule" "$target/${rule##*/}"
for r in /lib/udev/rules.d /etc/udev/rules.d; do
if [[ -f $r/$rule ]]; then
found="$r/$rule"
inst_simple "$found"
fi
done
for r in '' ./ $dracutbasedir/rules.d/; do
if [[ -f ${r}$rule ]]; then
found="${r}$rule"
inst_simple "$found" "$target/${found##*/}"
fi
done
[[ $found ]] || dinfo "Skipping udev rule: $rule"
done
}
# general purpose installation function
# Same args as above.
inst() {
if (($# != 1 && $# != 2 )); then
derror "inst only takes 1 or 2 arguments"
exit 1
fi
case $# in
1) ;;
2) [[ ! $initdir && -d $2 ]] && export initdir=$2
[[ $initdir = $2 ]] && set $1;;
3) [[ -z $initdir ]] && export initdir=$2
set $1 $3;;
*) dfatal "inst only takes 1 or 2 or 3 arguments"
exit 1;;
esac
for x in inst_symlink inst_script inst_binary inst_simple; do
$x "$@" && return 0
$x "$@" && return 0
done
return 1
}
[[ $hookdirs ]] || {
hookdirs="cmdline pre-udev pre-trigger netroot initqueue pre-mount"
hookdirs+=" pre-pivot mount emergency"
export hookdirs
}
# install function specialized for hooks
# $1 = type of hook, $2 = hook priority (lower runs first), $3 = hook
# All hooks should be POSIX/SuS compliant, they will be sourced by init.
inst_hook() {
if ! [[ -f $3 ]]; then
derror "Cannot install a hook ($3) that does not exist."
derror "Aborting initrd creation."
exit 1
dfatal "Cannot install a hook ($3) that does not exist."
dfatal "Aborting initrd creation."
exit 1
elif ! strstr "$hookdirs" "$1"; then
derror "No such hook type $1. Aborting initrd creation."
exit 1
dfatal "No such hook type $1. Aborting initrd creation."
exit 1
fi
inst_simple "$3" "/${1}/${2}${3##*/}"
inst_simple "$3" "/lib/dracut/hooks/${1}/${2}${3##*/}"
}
dracut_install() {
if [[ $1 = '-o' ]]; then
local optional=yes
shift
if [[ $1 = '-o' ]]; then
local optional=yes
shift
fi
while (($# > 0)); do
if ! inst "$1" ; then
if [[ $optional = yes ]]; then
dwarning "Skipping program $1 as it cannot be found and is flagged to be optional"
else
derror "Failed to install $1"
exit 1
if ! inst "$1" ; then
if [[ $optional = yes ]]; then
dwarn "Skipping program $1 as it cannot be found and is" \
"flagged to be optional"
else
dfatal "Failed to install $1"
exit 1
fi
fi
shift
done
}
check_module_deps() {
local moddir dep ret
# if we are already set to be loaded, we do not have to be checked again.
strstr "$mods_to_load" " $1 " && return
# turn a module name into a directory, if we can.
moddir=$(echo ${dsrc}/modules.d/??${1})
[[ -d $moddir && -x $moddir/install ]] || return 1
# if we do not have a check script, we are unconditionally included
if [[ -x $moddir/check ]]; then
"$moddir/check"
ret=$?
# a return value of 255 = load module only as a dependency.
((ret==0||ret==255)) || return 1
for dep in $("$moddir/check" -d); do
check_module_deps "$dep" && continue
dwarning "Dependency $mod failed."
return 1
done
fi
mods_to_load+=" $1 "
}
should_source_module() {
local dep
if [[ $kernel_only = yes ]]; then
[[ -x $1/installkernel ]] && return 0
return 1
fi
[[ -x $1/install ]] || [[ -x $1/installkernel ]] || return 1
[[ -x $1/check ]] || return 0
"$1/check" $hostonly || return 1
for dep in $("$1/check" -d); do
check_module_deps "$dep" && continue
dwarning "Cannot load $mod, dependencies failed."
return 1
done
}
check_modules() {
for moddir in "$dsrc/modules.d"/[0-9][0-9]*; do
local mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
# If we are already scheduled to be loaded, no need to check again.
strstr "$mods_to_load" " $mod " && continue
# This should never happen, but...
[[ -d $moddir ]] || continue
[[ $dracutmodules != all ]] && ! strstr "$dracutmodules" "$mod" && \
continue
strstr "$omit_dracutmodules" "$mod" && continue
if ! strstr "$add_dracutmodules" "$mod"; then
should_source_module "$moddir" || continue
fi
mods_to_load+=" $mod "
shift
done
}
# install function decompressing the target and handling symlinks
# $@ = list of compressed (gz or bz2) files or symlinks pointing to such files
#
# Function install targets in the same paths inside overlay but decompressed
# and without extensions (.gz, .bz2).
inst_decompress() {
local src dst realsrc realdst cmd
for src in $@
do
case ${src} in
*.gz) cmd='gzip -d' ;;
*.bz2) cmd='bzip2 -d' ;;
*) return 1 ;;
esac
if [[ -L ${src} ]]
then
realsrc="$(readlink -f ${src})" # symlink target with extension
dst="${src%.*}" # symlink without extension
realdst="${realsrc%.*}" # symlink target without extension
mksubdirs "${initdir}/${src}"
# Create symlink without extension to target without extension.
ln -s "${realdst}" "${initdir}/${dst}"
fi
# If the source is symlink we operate on its target.
[[ ${realsrc} ]] && src=${realsrc}
inst ${src}
# Decompress with chosen tool. We assume that tool changes name e.g.
# from 'name.gz' to 'name'.
${cmd} "${initdir}${src}"
done
}
# It's similar to above, but if file is not compressed, performs standard
# install.
# $@ = list of files
inst_opt_decompress() {
local src
for src in $@
do
inst_decompress "${src}" || inst "${src}"
done
}
module_check() {
local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
[[ -d $moddir ]] || return 1
if [[ ! -f $moddir/module-setup.sh ]]; then
# if we do not have a check script, we are unconditionally included
[[ -x $moddir/check ]] || return 0
$moddir/check $hostonly
return $?
else
unset check depends install installkernel
. $moddir/module-setup.sh
is_func check || return 0
check
ret=$?
unset check depends install installkernel
return $ret
fi
}
module_depends() {
local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
[[ -d $moddir ]] || return 1
if [[ ! -f $moddir/module-setup.sh ]]; then
# if we do not have a check script, we have no deps
[[ -x $moddir/check ]] || return 0
$moddir/check -d
return $?
else
unset check depends install installkernel
. $moddir/module-setup.sh
is_func depends || return 0
depends
ret=$?
unset check depends install installkernel
return $ret
fi
}
module_install() {
local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
[[ -d $moddir ]] || return 1
if [[ ! -f $moddir/module-setup.sh ]]; then
[[ -x $moddir/install ]] && . "$moddir/install"
return $?
else
unset check depends install installkernel
. $moddir/module-setup.sh
is_func install || return 0
install
ret=$?
unset check depends install installkernel
return $ret
fi
}
module_installkernel() {
local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
[[ -d $moddir ]] || return 1
if [[ ! -f $moddir/module-setup.sh ]]; then
[[ -x $moddir/installkernel ]] && . "$moddir/installkernel"
return $?
else
unset check depends install installkernel
. $moddir/module-setup.sh
is_func installkernel || return 0
installkernel
ret=$?
unset check depends install installkernel
return $ret
fi
}
check_module() {
local mod=$1;
local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local moddep;
# If we are already scheduled to be loaded, no need to check again.
strstr " $mods_to_load " " $mod " && return 0
strstr " $mods_checked_as_dep " " $mod " && return 1
# This should never happen, but...
[[ -d $moddir ]] || return 1
[[ $2 ]] || mods_checked_as_dep+=" $mod "
strstr " $omit_dracutmodules " " $mod " && return 1
if strstr " $dracutmodules $add_dracutmodules " " $mod "; then
module_check $mod; ret=$?
# explicit module, so also accept ret=255
[[ $ret = 0 || $ret = 255 ]] || return 1
else
# module not in our list
if [[ $dracutmodules = all ]]; then
# check, if we can and should install this module
module_check $mod || return 1
else
# skip this module
return 1
fi
fi
for moddep in $(module_depends $mod); do
# handle deps as if they were manually added
strstr " $add_dracutmodules " " $moddep " || \
add_dracutmodules+=" $moddep "
# if a module we depend on fail, fail also
check_module $moddep || return 1
done
strstr " $mods_to_load " " $mod " || \
mods_to_load+=" $mod "
return 0
}
check_module_dir() {
local modcheck;
local mod;
mods_to_load=""
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
local mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
check_module $mod 1
done
# Report any missing dracut modules, the user has specified
modcheck=$add_dracutmodules
[[ $dracutmodules != all ]] && modcheck="$m $dracutmodules"
for mod in $modcheck; do
strstr "$mods_to_load" "$mod" && continue
strstr "$omit_dracutmodules" "$mod" && continue
derror "Dracut module \"$mod\" cannot be found."
done
}
@@ -362,40 +670,51 @@ check_modules() {
# $1 = full path to kernel module to install
install_kmod_with_fw() {
local modname=${1##*/} fwdir found
modname=${modname%.ko}
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" || \
return 0 # no need to go further if the module is already installed
modname=${modname%.ko*}
# no need to go further if the module is already installed
[[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \
&& return 0
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" \
|| return $?
for fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
found=''
for fwdir in $fw_dir; do
if [[ -d $fwdir && -f $fwdir/$fw ]]; then
inst_simple "$fwdir/$fw" "/lib/firmware/$fw"
found=yes
fi
done
if [[ $found != yes ]]; then
dwarning "Possible missing firmware ${fw} for module ${mod}.ko"
fi
found=''
for fwdir in $fw_dir; do
if [[ -d $fwdir && -f $fwdir/$fw ]]; then
inst_simple "$fwdir/$fw" "/lib/firmware/$fw"
found=yes
fi
done
if [[ $found != yes ]]; then
dwarn "Possible missing firmware \"${fw}\" for kernel module" \
"\"${mod}.ko\""
fi
done
return 0
}
# Do something with all the dependencies of a kernel module.
# Note that kernel modules depend on themselves using the technique we use
# $1 = function to call for each dependency we find
# It will be passed the full path to the found kernel module
# $1 = function to call for each dependency we find
# It will be passed the full path to the found kernel module
# $2 = module to get dependencies for
# rest of args = arguments to modprobe
for_each_kmod_dep() {
local func=$1 kmod=$2 cmd modpapth options
shift 2
modprobe "$@" --ignore-install --show-depends $kmod 2>/dev/null | \
while read cmd modpath options; do
[[ $cmd = insmod ]] || continue
$func $modpath
done
modprobe "$@" --ignore-install --show-depends $kmod 2>/dev/null | (
local found=0
while read cmd modpath options; do
[[ $cmd = insmod ]] || continue
$func ${modpath} || exit $?
found=1
done
[[ $found -eq 0 ]] && exit 1
exit 0
)
return $?
}
# filter kernel modules to install certian modules that meet specific
# filter kernel modules to install certain modules that meet specific
# requirements.
# $1 = function to call with module name to filter.
# This function will be passed the full path to the module to test.
@@ -404,58 +723,74 @@ for_each_kmod_dep() {
# If it is not, we will look at all kernel modules
# This function returns the full filenames of modules that match $1
filter_kernel_modules () (
if [[ $hostonly = '' ]]; then
filtercmd='find "$srcmods/kernel/drivers" -name "*.ko"'
if ! [[ $hostonly ]]; then
filtercmd='find "$srcmods/kernel/drivers" "$srcmods/extra"'
filtercmd+=' "$srcmods/weak-updates" -name "*.ko" -o -name "*.ko.gz"'
filtercmd+=' 2>/dev/null'
else
filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename -k $kernel'
filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename '
filtercmd+='-k $kernel 2>/dev/null'
fi
for modname in $(eval $filtercmd); do
"$1" "$modname" && echo "$modname"
case $modname in
*.ko) "$1" "$modname" && echo "$modname";;
*.ko.gz) gzip -dc "$modname" > $initdir/$$.ko
$1 $initdir/$$.ko && echo "$modname"
rm -f $initdir/$$.ko
;;
esac
done
)
# install kernel modules along with all their dependencies.
instmods() {
[[ $no_kernel = yes ]] && return
local mod mpargs modpath modname cmd
local mod mpargs modpath modname cmd moddirname
local ret=0
while (($# > 0)); do
mod=${1%.ko}
case $mod in
=*) # This introduces 2 incompatible meanings for =* arguments
mod=${1%.ko*}
case $mod in
=*)
# This introduces 2 incompatible meanings for =* arguments
# to instmods. We need to decide which one to keep.
if [[ $mod = =ata && -f $srcmods/modules.block ]] ; then
instmods $mpargs $(egrep 'ata|ahci' "${srcmods}/modules.block")
elif [ -f $srcmods/modules.${mod#=} ]; then
instmods $mpargs $(cat ${srcmods}/modules.${mod#=} )
else
instmods $mpargs $(find "$srcmods" -path "*/${mod#=}/*")
fi
;;
--*)
mod=${mod##*/}
mpargs+=" $mod";;
i2o_scsi)
# Must never run this diagnostic-only module
shift; continue;
if [[ $mod = =ata && -f $srcmods/modules.block ]]; then
instmods $mpargs \
$(egrep 'ata|ahci' "${srcmods}/modules.block")
elif [ -f $srcmods/modules.${mod#=} ]; then
instmods $mpargs $(cat ${srcmods}/modules.${mod#=} )
else
instmods $mpargs $(find "$srcmods" -path "*/${mod#=}/*")
fi
;;
*)
mod=${mod##*/}
--*)
mod=${mod##*/}
mpargs+=" $mod";;
i2o_scsi) shift; continue;; # Do not load this diagnostic-only module
*) mod=${mod##*/}
# if we are already installed, skip this module and go on
# to the next one.
[[ -f $initdir/$1 ]] && { shift; continue; }
# If we are building a host-specific initramfs and this
# module is not already loaded, move on to the next one.
[[ $hostonly ]] && ! grep -q "$mod" /proc/modules && {
shift; continue;
}
# ok, load the module, all its dependencies, and any firmware
# it may require
for_each_kmod_dep install_kmod_with_fw $mod \
--set-version $kernel -d ${srcmods%%/lib/modules/*}/
;;
esac
shift
done
}
# to the next one.
[[ -f $initdir/$1 ]] && { shift; continue; }
# If we are building a host-specific initramfs and this
# module is not already loaded, move on to the next one.
[[ $hostonly ]] && ! grep -qe "\<${mod//-/_}\>" /proc/modules \
&& ! echo $add_drivers | grep -qe "\<${mod}\>" && {
shift; continue
}
# vim:ts=8:sw=4:sts=4:et
# We use '-d' option in modprobe only if modules prefix path
# differs from default '/'. This allows us to use Dracut with
# old version of modprobe which doesn't have '-d' option.
moddirname=${srcmods%%/lib/modules/*}
[[ -n ${moddirname} ]] && moddirname="-d ${moddirname}/"
# ok, load the module, all its dependencies, and any firmware
# it may require
for_each_kmod_dep install_kmod_with_fw $mod \
--set-version $kernel ${moddirname}
((ret+=$?))
;;
esac
shift
done
return $ret
}

View File

@@ -1,4 +1,6 @@
#!/bin/bash --norc
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
#
@@ -19,6 +21,39 @@
#
#. /usr/libexec/initrd-functions
IF_verbose=""
function set_verbose() {
case $1 in
1|true|yes|on)
IF_verbose="-v"
;;
0|false|no|off)
IF_verbose=""
;;
esac
}
function is_verbose() {
[ -n "$IF_verbose" ] && return 0
return 1
}
function get_verbose() {
echo "$IF_verbose"
is_verbose
}
function get_numeric_dev() {
(
fmt="%d:%d"
if [ "$1" == "hex" ]; then
fmt="%x:%x"
fi
ls -lH "$2" | awk '{ sub(/,/, "", $5); printf("'"$fmt"'", $5, $6); }'
) 2>/dev/null
}
function error() {
echo "$@" >&2
@@ -37,7 +72,7 @@ moduledep() {
fi
vecho -n "Looking for deps of module $1"
deps=""
deps=$(modprobe $MPARGS --set-version $kernel --show-depends $1 2>/dev/null| awk '/^insmod / { print gensub(".*/","","g",$2) }' | while read foo ; do [ "${foo%%.ko}" != "$1" ] && echo -n "${foo%%.ko} " ; done)
deps=$(modprobe $MPARGS --set-version $kernel --quiet --show-depends $1 | awk '/^insmod / { print gensub(".*/","","g",$2) }' | while read foo ; do [ "${foo%%.ko}" != "$1" ] && echo -n "${foo%%.ko} " ; done)
[ -n "$deps" ] && vecho ": $deps" || vecho
}
@@ -119,20 +154,28 @@ qpopd() {
popd >/dev/null 2>&1
}
resolve_device_name() {
echo "$1"
# echo "resolve_device_name $1" 1>&2
}
freadlink() {
/usr/bin/readlink -f "$1"
readlink -f "$1"
}
resolve_device_name() {
if [ -z "${1##UUID=*}" ]; then
real=$(freadlink /dev/disk/by-uuid/${1##UUID=})
[ -b $real ] && { echo $real; return; }
fi
if [ -z "${1##LABEL=*}" ]; then
real=$(freadlink /dev/disk/by-label/${1##LABEL=})
[ -b $real ] && { echo $real; return; }
fi
echo "$1"
}
finddevnoinsys() {
majmin="$1"
if [ -n "$majmin" ]; then
dev=$(for x in /sys/block/* ; do find $x/ -name dev ; done | while read device ; do \
echo "$majmin" | cmp -s $device && echo $device ; done)
echo "$majmin" | cmp -s $device && echo $device ; done)
if [ -n "$dev" ]; then
dev=${dev%%/dev}
dev=${dev%%/}
@@ -171,7 +214,7 @@ findstoragedriverinsys () {
sysfs=$(freadlink ${sysfs%/*})
fi
if [[ ! "$sysfs" =~ '^/sys/.*block/.*$' ]]; then
if [[ ! "$sysfs" =~ ^/sys/.*block/.*$ ]]; then
#error "WARNING: $sysfs is a not a block sysfs path, skipping"
return
fi
@@ -182,12 +225,12 @@ findstoragedriverinsys () {
*) handleddevices="$handleddevices $sysfs" ;;
esac
if [[ "$sysfs" =~ '^/sys/.*block/md[0-9]+$' ]]; then
if [[ "$sysfs" =~ ^/sys/.*block/md[0-9]+$ ]]; then
local raid=${sysfs##*/}
vecho "Found MDRAID component $raid"
handleraid $raid
fi
if [[ "$sysfs" =~ '^/sys/.*block/dm-[0-9]+$' ]]; then
if [[ "$sysfs" =~ ^/sys/.*block/dm-[0-9]+$ ]]; then
vecho "Found DeviceMapper component ${sysfs##*/}"
handledm $(cat $sysfs/dev |cut -d : -f 1) $(cat $sysfs/dev |cut -d : -f 2)
fi
@@ -268,7 +311,7 @@ iscsi_set_parameters() {
iscsi_get_rec_val $tmpfile "node.session.auth.password"
chap_pw="-w ${result}"
else
chap=""
chap=""
fi
iscsi_get_rec_val $tmpfile "node.session.auth.username_in"
@@ -278,7 +321,7 @@ iscsi_set_parameters() {
iscsi_get_rec_val $tmpfile "node.session.auth.password_in"
chap_in_pw="-W ${result}"
else
chap_in=""
chap_in=""
fi
rm $tmpfile
@@ -354,29 +397,29 @@ handledm() {
done << EOF
$(dmsetup table -j $major -m $minor 2>/dev/null)
EOF
local name=$(dmsetup info --noheadings -c -j $major -m $minor -o name)
local vg=$(lvshow "/dev/mapper/$name")
local raids=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no raid disks")
if [ -n "$vg" ]; then
vg=`echo $vg` # strip whitespace
case " $vg_list " in
*" $vg "*) ;;
*) vg_list="$vg_list $vg"
[ -z "$nolvm" ] && find_base_dm_mods
;;
esac
fi
for raid in $raids ; do
if [ "$raid" == "$name" ]; then
case " $DMRAIDS " in
*" $raid "*) ;;
*) DMRAIDS="$DMRAIDS $raid"
[ -z "$nodmraid" ] && find_base_dm_mods
local name=$(dmsetup info --noheadings -c -j $major -m $minor -o name)
local vg=$(lvshow "/dev/mapper/$name")
local raids=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no raid disks")
if [ -n "$vg" ]; then
vg=`echo $vg` # strip whitespace
case " $vg_list " in
*" $vg "*) ;;
*) vg_list="$vg_list $vg"
[ -z "$nolvm" ] && find_base_dm_mods
;;
esac
break
fi
done
for raid in $raids ; do
if [ "$raid" == "$name" ]; then
case " $DMRAIDS " in
*" $raid "*) ;;
*) DMRAIDS="$DMRAIDS $raid"
[ -z "$nodmraid" ] && find_base_dm_mods
;;
esac
break
fi
done
}
handleiscsi() {
@@ -399,25 +442,25 @@ handleraid() {
return 0
fi
levels=$(awk "/^$1[ ]*:/ { print\$4 }" /proc/mdstat)
levels=$(awk "/^$1[ ]*:/ { print\$4 }" /proc/mdstat)
for level in $levels ; do
case $level in
linear)
start=1
;;
multipath)
start=1
;;
raid[01] | raid10)
start=1
;;
raid[456])
start=1
;;
*)
error "raid level $level (in /proc/mdstat) not recognized"
;;
linear)
start=1
;;
multipath)
start=1
;;
raid[01] | raid10)
start=1
;;
raid[456])
start=1
;;
*)
error "raid level $level (in /proc/mdstat) not recognized"
;;
esac
done
if [ "$start" = 1 ]; then
@@ -433,7 +476,7 @@ lvshow() {
vgdisplay() {
lvm vgdisplay --ignorelockingfailure -v $1 2>/dev/null |
sed -n 's/PV Name//p'
sed -n 's/PV Name//p'
}
dmmods_found="n"
@@ -467,78 +510,78 @@ while [ $# -gt 0 ]; do
shift
fi
;;
--rootdev*)
--rootdev*)
if [ "$1" != "${1##--rootdev=}" ]; then
rootdev="${1##--rootdev=}"
else
rootdev="$2"
shift
fi
;;
--thawdev*)
;;
--thawdev*)
if [ "$1" != "${1##--thawdev=}" ]; then
thawdev="${1##--thawdev=}"
else
thawdev="$2"
shift
fi
;;
--rootfs*)
;;
--rootfs*)
if [ "$1" != "${1##--rootfs=}" ]; then
rootfs="${1##--rootfs=}"
else
rootfs="$2"
shift
fi
;;
--rootopts*)
;;
--rootopts*)
if [ "$1" != "${1##--rootopts=}" ]; then
rootopts="${1##--rootopts=}"
else
rootopts="$2"
shift
fi
;;
--root*)
;;
--root*)
if [ "$1" != "${1##--root=}" ]; then
root="${1##--root=}"
else
root="$2"
shift
fi
;;
--loopdev*)
;;
--loopdev*)
if [ "$1" != "${1##--loopdev=}" ]; then
loopdev="${1##--loopdev=}"
else
loopdev="$2"
shift
fi
;;
--loopfs*)
;;
--loopfs*)
if [ "$1" != "${1##--loopfs=}" ]; then
loopfs="${1##--loopfs=}"
else
loopfs="$2"
shift
fi
;;
--loopopts*)
;;
--loopopts*)
if [ "$1" != "${1##--loopopts=}" ]; then
loopopts="${1##--loopopts=}"
else
loopopts="$2"
shift
fi
;;
--looppath*)
;;
--looppath*)
if [ "$1" != "${1##--looppath=}" ]; then
looppath="${1##--looppath=}"
else
looppath="$2"
shift
fi
;;
;;
--help)
usage -n
;;
@@ -556,37 +599,33 @@ while [ $# -gt 0 ]; do
shift
done
[ -z "$rootfs" ] && rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' $fstab)
[ -z "$rootopts" ] && rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' $fstab)
[ -z "$rootopts" ] && rootopts="defaults"
[ -z "$rootfs" ] && rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' $fstab)
[ -z "$rootopts" ] && rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' $fstab)
[ -z "$rootopts" ] && rootopts="defaults"
[ -z "$rootdev" ] && rootdev=$(awk '/^[ \t]*[^#]/ { if ($2 == "/") { print $1; }}' $fstab)
[ -z "$rootdev" ] && rootdev=$(awk '/^[ \t]*[^#]/ { if ($2 == "/") { print $1; }}' $fstab)
# check if it's nfsroot
physdev=""
if [ "$rootfs" == "nfs" ]; then
if [ "x$net_list" == "x" ]; then
handlenfs $rootdev
fi
else
# check if it's root by label
rdev=$rootdev
if [[ "$rdev" =~ ^(UUID=|LABEL=) ]]; then
rdev=$(resolve_device_name "$rdev")
fi
rootopts=$(echo $rootopts | sed -e 's/^r[ow],//' -e 's/,_netdev//' -e 's/_netdev//' -e 's/,r[ow],$//' -e 's/,r[ow],/,/' -e 's/^r[ow]$/defaults/' -e 's/$/,ro/')
findstoragedriver "$rdev"
physdev=""
if [ "$rootfs" == "nfs" ]; then
if [ "x$net_list" == "x" ]; then
handlenfs $rootdev
fi
else
# check if it's root by label
rdev=$rootdev
rdev=$(resolve_device_name "$rdev")
rootopts=$(echo $rootopts | sed -e 's/^r[ow],//' -e 's/,_netdev//' -e 's/_netdev//' -e 's/,_rnetdev//' -e 's/_rnetdev//' -e 's/,r[ow],$//' -e 's/,r[ow],/,/' -e 's/^r[ow]$/defaults/' -e 's/$/,ro/')
findstoragedriver "$rdev"
fi
# find the first swap dev which would get used for swsusp
[ -z "$thawdev" ] && thawdev=$(awk '/^[ \t]*[^#]/ { if ($3 == "swap") { print $1; exit }}' $fstab)
swsuspdev="$thawdev"
if [ -n "$swsuspdev" ]; then
if [[ "$swsuspdev" =~ ^(UUID=|LABEL=) ]]; then
swsuspdev=$(resolve_device_name "$swsuspdev")
fi
findstoragedriver "$swsuspdev"
fi
[ -z "$thawdev" ] && thawdev=$(awk '/^[ \t]*[^#]/ { if ($3 == "swap") { print $1; exit }}' $fstab)
swsuspdev="$thawdev"
if [ -n "$swsuspdev" ]; then
swsuspdev=$(resolve_device_name "$swsuspdev")
findstoragedriver "$swsuspdev"
fi
cemit()
@@ -629,35 +668,37 @@ emitcrypto()
echo -n "rd_LUKS_UUID=$luksuuid "
}
for cryptdev in ${!cryptopart@} ; do
emitcrypto `eval echo '$'$cryptdev`
done
if [ -n "$raiddevices" ]; then
for dev in $raiddevices; do
uid=$(udevadm info --query=all --name=/dev/${dev}|grep MD_UUID)
uid=$(IFS="=";set $uid;echo $2)
echo -n "rd_MD_UUID=$uid "
uid=$(udevadm info --query=env --name /dev/${dev}|grep MD_UUID)
uid=${uid##MD_UUID=}
[ -n "$uid" ] && echo -n "rd_MD_UUID=$uid "
done
else
echo -n "rd_NO_MD "
fi
for cryptdev in ${!cryptoraid@} ; do
emitcrypto `eval echo '$'$cryptdev`
done
if [ -z "$nolvm" -a -n "$vg_list" ]; then
for vg in $vg_list; do
echo -n "rd_LVM_VG=$vg "
echo -n "rd_LVM_VG=$vg "
done
else
echo -n "rd_NO_LVM "
fi
cryptdevs="$(echo ${!cryptoraid@} ${!cryptopart@} ${!cryptolv@})"
if [ -z "$cryptdevs" ]; then
echo -n "rd_NO_LUKS "
else
for cryptdev in ${!cryptoraid@} ${!cryptopart@} ${!cryptolv@} ; do
emitcrypto `eval echo '$'$cryptdev`
done
fi
for cryptdev in ${!cryptolv@} ; do
emitcrypto `eval echo '$'$cryptdev`
done
# output local keyboard/18n settings
. /etc/sysconfig/keyboard
. /etc/sysconfig/i18n
[ -e /etc/sysconfig/keyboard ] && . /etc/sysconfig/keyboard
[ -e /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
for i in KEYTABLE SYSFONT SYSFONTACM UNIMAP LANG; do
val=$(eval echo \$$i)
@@ -672,13 +713,4 @@ if [ -n "$rootdev" ]; then
echo -n "root=$rootdev "
fi
if [ -L /usr/share/plymouth/themes/default.plymouth ]; then
theme=$(basename \
$(dirname \
$(readlink -f \
/usr/share/plymouth/themes/default.plymouth)))
[ -n "$theme" ] && echo -n "rd_plytheme=$theme "
fi
echo
# vim:ts=8:sw=4:sts=4:et

46
dracut-gencmdline.8.xml Normal file
View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
<!-- lifted from troff+man by doclifter -->
<refentry id='dracutgencmdline8'>
<refmeta>
<refentrytitle>DRACUT-GENCMDLINE</refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo class='source'>June 2009</refmiscinfo>
<refmiscinfo class='manual'>Linux</refmiscinfo>
</refmeta>
<refnamediv id='name'>
<refname>dracut-gencmdline</refname>
<refpurpose>generates kernel command line parameters for the dracut generated initramfs</refpurpose>
</refnamediv>
<!-- body begins here -->
<refsynopsisdiv id='synopsis'>
<cmdsynopsis>
<command>dracut-gencmdline</command>
<sbr/>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id='description'><title>DESCRIPTION</title>
<para><command>dracut-gencmdline</command>
generates kernel command line parameters for the dracut generated initramfs, which are very specific to the host system.</para>
</refsect1>
<refsect1 id='authors'><title>AUTHORS</title>
<literallayout remap='.nf'>
Harald Hoyer &lt;harald@redhat.com&gt;
</literallayout> <!-- .fi -->
</refsect1>
<refsect1 id='availability'><title>AVAILABILITY</title>
<para>The dracut-gencmdline command is part of the dracut package and is available from
<ulink url='http://sourceforge.net/apps/trac/dracut/wiki'>http://sourceforge.net/apps/trac/dracut/wiki</ulink></para>
</refsect1>
<refsect1 id='see_also'><title>SEE ALSO</title>
<para><citerefentry><refentrytitle>dracut</refentrytitle><manvolnum>8</manvolnum></citerefentry></para>
</refsect1>
</refentry>

379
dracut-logger Executable file
View File

@@ -0,0 +1,379 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 et filetype=sh
#
# logging faciality module for dracut both at build- and boot-time
#
# Copyright 2010 Amadeusz Żołnowski <aidecoe@aidecoe.name>
#
# 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/>.
__DRACUT_LOGGER__=1
## @brief Logging facility module for Dracut both at build- and boot-time.
#
# @section intro Introduction
#
# The logger takes a bit from Log4j philosophy. There are defined 6 logging
# levels:
# - TRACE (6)
# The TRACE Level designates finer-grained informational events than the
# DEBUG.
# - DEBUG (5)
# The DEBUG Level designates fine-grained informational events that are most
# useful to debug an application.
# - INFO (4)
# The INFO level designates informational messages that highlight the
# progress of the application at coarse-grained level.
# - WARN (3)
# The WARN level designates potentially harmful situations.
# - ERROR (2)
# The ERROR level designates error events that might still allow the
# application to continue running.
# - FATAL (1)
# The FATAL level designates very severe error events that will presumably
# lead the application to abort.
# Descriptions are borrowed from Log4j documentation:
# http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html
#
# @section usage Usage
#
# First of all you have to start with dlog_init() function which initializes
# required variables. Don't call any other logging function before that one!
# If you're ready with this, you can use following functions which corresponds
# clearly to levels listed in @ref intro Introduction. Here they are:
# - dtrace()
# - ddebug()
# - dinfo()
# - dwarn()
# - derror()
# - dfatal()
# They take all arguments given as a single message to be logged. See dlog()
# function for details how it works. Note that you shouldn't use dlog() by
# yourself. It's wrapped with above functions.
#
# @see dlog_init() dlog()
#
# @section conf Configuration
#
# Logging is controlled by following global variables:
# - @var stdloglvl - logging level to standard error (console output)
# - @var sysloglvl - logging level to syslog (by logger command)
# - @var fileloglvl - logging level to file
# - @var kmsgloglvl - logging level to /dev/kmsg (only for boot-time)
# - @var logfile - log file which is used when @var fileloglvl is higher
# than 0
# and two global variables: @var maxloglvl and @var syslogfacility which <b>must
# not</b> be overwritten. Both are set by dlog_init(). @var maxloglvl holds
# maximum logging level of those three and indicates that dlog_init() was run.
# @var syslogfacility is set either to 'user' (when building initramfs) or
# 'daemon' (when booting).
#
# Logging level set by the variable means that messages from this logging level
# and above (FATAL is the highest) will be shown. Logging levels may be set
# independently for each destination (stderr, syslog, file, kmsg).
#
# @see dlog_init()
## @brief Initializes Dracut Logger.
#
# @retval 1 if something has gone wrong
# @retval 0 on success.
#
# @note This function need to be called before any other from this file.
#
# If any of the variables is not set, this function set it to default:
# - @var stdloglvl = 4 (info)
# - @var sysloglvl = 0 (no logging)
# - @var fileloglvl is set to 4 when @var logfile is set too, otherwise it's
# - @var kmsgloglvl = 0 (no logging)
# set to 0
#
# @warning Function sets global variables @var maxloglvl and @syslogfacility.
# See file doc comment for details.
dlog_init() {
# Skip initialization if it's already done.
[ -n "$maxloglvl" ] && return 0
local ret=0; local errmsg
[ -z "$stdloglvl" ] && stdloglvl=4
[ -z "$sysloglvl" ] && sysloglvl=0
[ -z "$kmsgloglvl" ] && kmsgloglvl=0
if [ -z "$fileloglvl" ]; then
[ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
elif [ $fileloglvl -gt 0 ]; then
! [ -e "$logfile" ] && >"$logfile"
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"
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"
fi
fi
if [ $sysloglvl -gt 0 ]; then
if ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null
then
# We cannot log to syslog, so turn this facility off.
sysloglvl=0
ret=1
errmsg="No '/dev/log' or 'logger' included for syslog logging"
fi
fi
if [ $sysloglvl -gt 0 -o $kmsgloglvl -gt 0 ]; then
if [ -n "$dracutbasedir" ]; then
readonly syslogfacility=user
else
readonly syslogfacility=daemon
fi
export syslogfacility
fi
local lvl; local maxloglvl_l=0
for lvl in $stdloglvl $sysloglvl $fileloglvl $kmsgloglvl; do
[ $lvl -gt $maxloglvl_l ] && maxloglvl_l=$lvl
done
readonly maxloglvl=$maxloglvl_l
export maxloglvl
[ -n "$errmsg" ] && derror "$errmsg"
return $ret
}
## @brief Converts numeric logging level to the first letter of level name.
#
# @param lvl Numeric logging level in range from 1 to 6.
# @retval 1 if @a lvl is out of range.
# @retval 0 if @a lvl is correct.
# @result Echoes first letter of level name.
_lvl2char() {
case "$1" in
1) echo F;;
2) echo E;;
3) echo W;;
4) echo I;;
5) echo D;;
6) echo T;;
*) return 1;;
esac
}
## @brief Converts numeric level to logger priority defined by POSIX.2.
#
# @param lvl Numeric logging level in range from 1 to 6.
# @retval 1 if @a lvl is out of range.
# @retval 0 if @a lvl is correct.
# @result Echoes logger priority.
_lvl2syspri() {
printf $syslogfacility.
case "$1" in
1) echo crit;;
2) echo error;;
3) echo warning;;
4) echo info;;
5) echo debug;;
6) echo debug;;
*) return 1;;
esac
}
## @brief Converts dracut-logger numeric level to syslog log level
#
# @param lvl Numeric logging level in range from 1 to 6.
# @retval 1 if @a lvl is out of range.
# @retval 0 if @a lvl is correct.
# @result Echoes kernel console numeric log level
#
# Conversion is done as follows:
#
# <tt>
# FATAL(1) -> LOG_EMERG (0)
# none -> LOG_ALERT (1)
# none -> LOG_CRIT (2)
# ERROR(2) -> LOG_ERR (3)
# WARN(3) -> LOG_WARNING (4)
# none -> LOG_NOTICE (5)
# INFO(4) -> LOG_INFO (6)
# DEBUG(5) -> LOG_DEBUG (7)
# TRACE(6) /
# </tt>
#
# @see /usr/include/sys/syslog.h
_dlvl2syslvl() {
local lvl
case "$1" in
1) lvl=0;;
2) lvl=3;;
3) lvl=4;;
4) lvl=6;;
5) lvl=7;;
6) lvl=7;;
*) return 1;;
esac
[ "$syslogfacility" = user ] && echo $((8+$lvl)) || echo $((24+$lvl))
}
## @brief Prints to stderr and/or writes to file, to syslog and/or /dev/kmsg
# given message with given level (priority).
#
# @param lvl Numeric logging level.
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
#
# @note This function is not supposed to be called manually. Please use
# dtrace(), ddebug(), or others instead which wrap this one.
#
# This is core logging function which logs given message to standard error, file
# and/or syslog (with POSIX shell command <tt>logger</tt>) and/or to /dev/kmsg.
# The format is following:
#
# <tt>X: some message</tt>
#
# where @c X is the first letter of logging level. See module description for
# details on that.
#
# Message to syslog is sent with tag @c dracut. Priorities are mapped as
# following:
# - @c FATAL to @c crit
# - @c ERROR to @c error
# - @c WARN to @c warning
# - @c INFO to @c info
# - @c DEBUG and @c TRACE both to @c debug
_do_dlog() {
[ -z "$maxloglvl" ] && return 0
local lvl="$1"; shift
local lvlc=$(_lvl2char "$lvl") || return 0
[ $lvl -le $maxloglvl ] || return 0
local msg="$lvlc: $*"
[ $lvl -le $stdloglvl ] && echo "$msg" >&2
if [ $lvl -le $sysloglvl ]; then
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) "$msg"
fi
if [ $lvl -le $fileloglvl -a -w "$logfile" -a -f "$logfile" ]; then
echo "$msg" >>"$logfile"
fi
[ $lvl -le $kmsgloglvl ] && \
echo "<$(_dlvl2syslvl $lvl)>dracut[$$] $msg" >/dev/kmsg
}
## @brief Internal helper function for _do_dlog()
#
# @param lvl Numeric logging level.
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
#
# @note This function is not supposed to be called manually. Please use
# dtrace(), ddebug(), or others instead which wrap this one.
#
# This function calls _do_dlog() either with parameter msg, or if
# none is given, it will read standard input and will use every line as
# a message.
#
# This enables:
# dwarn "This is a warning"
# echo "This is a warning" | dwarn
dlog() {
if [ $# -gt 1 ]; then
_do_dlog "$@"
else
while read line; do
_do_dlog "$1" "$line"
done
fi
[ -n "$debug" ] && set -x || :
}
## @brief Logs message at TRACE level (6)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dtrace() {
set +x
dlog 6 "$@"
}
## @brief Logs message at DEBUG level (5)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
ddebug() {
set +x
dlog 5 "$@"
}
## @brief Logs message at INFO level (4)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dinfo() {
set +x
dlog 4 "$@"
}
## @brief Logs message at WARN level (3)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dwarn() {
set +x
dlog 3 "$@"
}
## @brief It's an alias to dwarn() function.
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dwarning() {
set +x
dwarn "$@"
}
## @brief Logs message at ERROR level (2)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
derror() {
set +x
dlog 2 "$@"
}
## @brief Logs message at FATAL level (1)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dfatal() {
set +x
dlog 1 "$@"
}

560
dracut-update-initramfs Executable file
View File

@@ -0,0 +1,560 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
STATEDIR=/var/lib/dracut
BOOTDIR=/boot
CONF=/etc/dracut.conf
KPKGCONF=/etc/kernel-img.conf
USETRIGGERS=true
mode=""
version=""
set -e
if $USETRIGGERS \
&& [ x"$DPKG_MAINTSCRIPT_PACKAGE" != x ] \
&& [ $# = 1 ] \
&& [ x"$1" = x-u ] \
&& dpkg-trigger --check-supported 2>/dev/null
then
if dpkg-trigger --no-await update-initramfs; then
echo "dracut-update-initramfs: deferring update (trigger activated)"
exit 0
fi
fi
usage()
{
if [ -n "${1}" ]; then
printf "${@}\n\n" >&2
fi
cat >&2 << EOF
Usage: ${0} [OPTION]...
Options:
-k [version] Specify kernel version or 'all'
-c Create a new initramfs
-u Update an existing initramfs
-d Remove an existing initramfs
-t Take over a custom initramfs with this one
-b Set alternate boot directory
-v Be verbose
-h This message
EOF
exit 1
}
# chroot check
chrooted()
{
# borrowed from udev's postinst
if [ "$(stat -c %d/%i /)" = "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ]; then
# the devicenumber/inode pair of / is the same as that of
# /sbin/init's root, so we're *not* in a chroot and hence
# return false.
return 1
fi
return 0
}
mild_panic()
{
if [ -n "${1}" ]; then
printf "${@}\n" >&2
fi
exit 0
}
panic()
{
if [ -n "${1}" ]; then
printf "${@}\n" >&2
fi
exit 1
}
verbose()
{
if [ "${verbose}" = 1 ]; then
printf "${@}\n"
fi
}
version_exists()
{
[ -e "${STATEDIR}/${1}" ] && [ -e "${initramfs}" ]
return $?
}
set_initramfs()
{
initramfs="${BOOTDIR}/dracut.img-${version}"
}
# backup initramfs while running
backup_initramfs()
{
[ ! -r "${initramfs}" ] && return 0
initramfs_bak="${initramfs}.dpkg-bak"
[ -r "${initramfs_bak}" ] && rm -f "${initramfs_bak}"
ln -f "${initramfs}" "${initramfs_bak}" \
|| cp -a "${initramfs}" "${initramfs_bak}"
verbose "Keeping ${initramfs_bak}"
}
# keep booted initramfs
backup_booted_initramfs()
{
initramfs_bak="${initramfs}.dpkg-bak"
# first time run thus no backup
[ ! -r "${initramfs_bak}" ] && return 0
# chroot with no /proc
[ ! -r /proc/uptime ] && rm -f "${initramfs_bak}" && return 0
# no kept backup wanted
[ "${backup_initramfs}" = "no" ] && rm -f "${initramfs_bak}" && return 0
# no backup yet
if [ ! -r "${initramfs}.bak" ]; then
mv -f ${initramfs_bak} "${initramfs}.bak"
verbose "Backup ${initramfs}.bak"
return 0
fi
# keep booted initramfs
uptime_days=$(awk '{printf "%d", $1 / 3600 / 24}' /proc/uptime)
if [ -n "$uptime_days" ]; then
boot_initramfs=$(find "${initramfs}.bak" -mtime +${uptime_days})
fi
if [ -n "${boot_initramfs}" ]; then
mv -f "${initramfs_bak}" "${initramfs}.bak"
verbose "Backup ${initramfs}.bak"
return 0
fi
verbose "Removing current backup ${initramfs_bak}"
rm -f ${initramfs_bak}
}
# nuke generated copy
remove_initramfs()
{
[ -z "${initramfs_bak}" ] && return 0
rm -f "${initramfs_bak}"
verbose "Removing ${initramfs_bak}"
}
generate_initramfs()
{
echo "dracut-update-initramfs: Generating ${initramfs}"
OPTS=""
if [ "${verbose}" = 1 ]; then
OPTS="-v ${OPTS}"
fi
##WORK HERE!
if dracut ${OPTS} "${initramfs}.new" "${version}"; then
mv -f "${initramfs}.new" "${initramfs}"
set_sha1
else
mkinitramfs_return="$?"
remove_initramfs
rm -f "${initramfs}.new"
if [ "$mkinitramfs_return" = "2" ]; then
# minversion wasn't met, exit 0
exit 0
fi
echo "update-initramfs: failed for ${initramfs}"
exit $mkinitramfs_return
fi
}
# lilo call
run_lilo()
{
# show lilo errors on failure
if ! lilo -t > /dev/null 2>&1 ; then
echo "ERROR lilo fails for new ${initramfs}:"
echo
lilo -t
fi
lilo
}
# check if lilo is on mbr
mbr_check()
{
# try to discover grub|grub2 and be happy
[ -r /boot/grub/grub.cfg ] \
&& groot=$(awk '/^set root=/{print substr($2, 7, 3); exit}' \
/boot/grub/grub.cfg)
[ -r /boot/grub/menu.lst ] \
&& groot=$(awk '/^root/{print substr($2, 2, 3); exit}' \
/boot/grub/menu.lst)
[ -e /boot/grub/device.map ] && [ -n "${groot}" ] \
&& dev=$(awk "/${groot}/{ print \$NF}" /boot/grub/device.map)
[ -n "${dev}" ] && [ -r ${dev} ] \
&& dd if="${dev}" bs=512 skip=0 count=1 2> /dev/null \
| grep -q GRUB && return 0
# check out lilo.conf for validity
boot=$(awk -F = '/^boot=/{ print $2}' /etc/lilo.conf)
[ -z "${boot}" ] && return 0
case ${boot} in
/dev/md/*)
if [ -r /proc/mdstat ]; then
MD=${boot#/dev/md/}
boot="/dev/$(awk "/^md${MD}/{print substr(\$5, 1, 3)}" \
/proc/mdstat)"
fi
;;
/dev/md*)
if [ -r /proc/mdstat ]; then
MD=${boot#/dev/}
boot="/dev/$(awk "/^${MD}/{print substr(\$5, 1, 3)}" \
/proc/mdstat)"
fi
;;
esac
[ ! -r "${boot}" ] && return 0
dd if="${boot}" bs=512 skip=0 count=1 2> /dev/null | grep -q LILO \
&& run_lilo && return 0
# no idea which bootloader is used
echo
echo "WARNING: grub and lilo installed."
echo "If you use grub as bootloader everything is fine."
echo "If you use lilo as bootloader you must run lilo!"
echo
}
# Invoke bootloader
run_bootloader()
{
# if both lilo and grub around, figure out if lilo needs to be run
if ( command -v update-grub >/dev/null 2>&1 \
|| [ -e /boot/grub/menu.lst ] || [ -e /boot/grub/grub.cfg ] ) \
&& ( [ -e /etc/lilo.conf ] && command -v lilo >/dev/null 2>&1 ); then
[ -r "${KPKGCONF}" ] && \
do_b=$(awk '/^do_bootloader/{print $3}' "${KPKGCONF}")
if [ "${do_b}" = "yes" ] || [ "${do_b}" = "Yes" ] \
|| [ "${do_b}" = "YES" ]; then
run_lilo
return 0
elif [ "${do_b}" = "no" ] || [ "${do_b}" = "No" ] \
|| [ "${do_b}" = "NO" ]; then
return 0
fi
# do_bootloader unconfigured
mbr_check
return 0
fi
if [ -r /etc/lilo.conf ] && command -v lilo >/dev/null 2>&1; then
run_lilo
return 0
fi
if command -v elilo >/dev/null 2>&1; then
elilo
return 0
fi
if [ -r /etc/zipl.conf ]; then
zipl
fi
if flash-kernel --supported >/dev/null 2>&1; then
flash-kernel ${version}
fi
}
compare_sha1()
{
sha1sum "${initramfs}" | diff "${STATEDIR}/${version}" - >/dev/null 2>&1
return $?
}
# Note that this must overwrite so that updates work.
set_sha1()
{
sha1sum "${initramfs}" > "${STATEDIR}/${version}"
}
delete_sha1()
{
rm -f "${STATEDIR}/${version}"
}
# ro /boot is not modified
ro_boot_check()
{
# check irrelevant inside of a chroot
if [ ! -r /proc/mounts ] || chrooted; then
return 0
fi
boot_opts=$(awk '/boot/{if ((match($4, /^ro/) || match($4, /,ro/)) \
&& $2 == "/boot") print "ro"}' /proc/mounts)
if [ -n "${boot_opts}" ]; then
echo "WARNING: /boot is ro mounted."
echo "update-initramfs: Not updating ${initramfs}"
exit 0
fi
}
get_sorted_versions()
{
version_list=""
for gsv_x in "${STATEDIR}"/*; do
gsv_x="$(basename "${gsv_x}")"
if [ "${gsv_x}" = '*' ]; then
return 0
fi
worklist=""
for gsv_i in $version_list; do
if dpkg --compare-versions "${gsv_x}" '>' "${gsv_i}"; then
worklist="${worklist} ${gsv_x} ${gsv_i}"
gsv_x=""
else
worklist="${worklist} ${gsv_i}"
fi
done
if [ "${gsv_x}" != "" ]; then
worklist="${worklist} ${gsv_x}"
fi
version_list="${worklist}"
done
verbose "Available versions: ${version_list}"
}
set_current_version()
{
if [ -f /boot/dracut.img-`uname -r` ]; then
version=`uname -r`
fi
}
set_linked_version()
{
if [ -e /initrd.img ] && [ -L /initrd.img ]; then
linktarget="$(basename "$(readlink /initrd.img)")"
fi
if [ -e /boot/initrd.img ] && [ -L /boot/initrd.img ]; then
linktarget="$(basename "$(readlink /boot/initrd.img)")"
fi
if [ -z "${linktarget}" ]; then
return
fi
version="${linktarget##*img-}"
}
set_highest_version()
{
get_sorted_versions
set -- ${version_list}
version=${1}
}
create()
{
if [ -z "${version}" ]; then
usage "Create mode requires a version argument"
fi
set_initramfs
if [ "${takeover}" = 0 ]; then
if version_exists "${version}"; then
panic "Cannot create version ${version}: already exists"
fi
if [ -e "${initramfs}" ]; then
panic "${initramfs} already exists, cannot create."
fi
fi
generate_initramfs
}
update()
{
if [ "${update_initramfs}" = "no" ]; then
echo "update-initramfs: Not updating initramfs."
exit 0
fi
if [ -z "${version}" ]; then
set_highest_version
fi
if [ -z "${version}" ]; then
set_linked_version
fi
if [ -z "${version}" ]; then
set_current_version
fi
if [ -z "${version}" ]; then
verbose "Nothing to do, exiting."
exit 0
fi
set_initramfs
ro_boot_check
altered_check
backup_initramfs
generate_initramfs
run_bootloader
backup_booted_initramfs
}
delete()
{
if [ -z "${version}" ]; then
usage "Delete mode requires a version argument"
fi
set_initramfs
if [ ! -e "${initramfs}" ]; then
panic "Cannot delete ${initramfs}, doesn't exist."
fi
if ! version_exists "${version}"; then
panic "Cannot delete version ${version}: Not created by this utility."
fi
altered_check
echo "update-initramfs: Deleting ${initramfs}"
delete_sha1
rm -f "${initramfs}"
}
# Check for update mode on existing and modified initramfs
altered_check()
{
# No check on takeover
[ "${takeover}" = 1 ] && return 0
if [ ! -e "${initramfs}" ]; then
mild_panic "${initramfs} does not exist. Cannot update."
fi
if ! compare_sha1; then
echo "update-initramfs: ${initramfs} has been altered." >&2
mild_panic "update-initramfs: Cannot update. Override with -t option."
fi
}
# Defaults
verbose=0
yes=0
# We default to takeover=1 in Ubuntu, but not Debian
takeover=0
##
while getopts "k:cudyvtb:h?" flag; do
case "${flag}" in
k)
version="${OPTARG}"
;;
c)
mode="c"
;;
d)
mode="d"
;;
u)
mode="u"
;;
v)
verbose="1"
;;
y)
yes="1"
;;
t)
takeover="1"
;;
b)
BOOTDIR="${OPTARG}"
if [ ! -d "${BOOTDIR}" ]; then
echo "Error: ${BOOTDIR} is not a directory."
exit 1
fi
;;
h|?)
usage
;;
esac
done
shift $((${OPTIND} - 1))
if [ $# -ne 0 ]; then
echo "Invalid argument for option -k."
usage
fi
# Validate arguments
if [ -z "${mode}" ]; then
usage "You must specify at least one of -c, -u, or -d."
fi
if [ "${version}" = "all" ] \
|| ( [ "${update_initramfs}" = "all" ] && [ -z "${version}" ] ); then
: FIXME check for --yes, and if not ask are you sure
get_sorted_versions
if [ -z "${version_list}" ]; then
verbose "Nothing to do, exiting."
exit 0
fi
OPTS="-b ${BOOTDIR}"
if [ "${verbose}" = "1" ]; then
OPTS="${OPTS} -v"
fi
if [ "${takeover}" = "1" ]; then
OPTS="${OPTS} -t"
fi
if [ "${yes}" = "1" ]; then
OPTS="${OPTS} -y"
fi
for u_version in ${version_list}; do
# Don't stop if one version doesn't work.
set +e
verbose "Execute: ${0} -${mode} -k \"${u_version}\" ${OPTS}"
"${0}" -${mode} -k "${u_version}" ${OPTS}
set -e
done
exit 0
fi
case "${mode}" in
c)
create
;;
d)
delete
;;
u)
update
;;
esac

303
dracut.8
View File

@@ -1,303 +0,0 @@
.TH DRACUT 8 "June 2009" "Linux"
.SH NAME
switch_root \- switch to another filesystem as the root of the mount tree.
.SH SYNOPSIS
\fBdracut\fR [\fIOPTION\fR]... \fI<image>\fR \fI<kernel-version>\fR
.SH DESCRIPTION
.B switch_root
\fBdracut\fR 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.
.SH OPTIONS
.TP
.BR \-f ", " \-\-force
overwrite existing initramfs file.
.TP
.BR \-m ", " \-\-modules " \fILIST\fR"
specify a space-separated list of dracut modules to call
when building the initramfs.
Modules are located in
.IR /usr/share/dracut/modules.d .
.TP
.BR \-o ", " \-\-omit " \fILIST\fR"
omit a space-separated list of dracut modules.
.TP
.BR \-a ", " \-\-add " \fILIST\fR"
add a space-separated list of dracut modules.
.TP
.BR \-d ", " \-\-drivers " \fILIST\fR"
specify a space-separated list of kernel modules to include in the initramfs.
.TP
.BR \-k ", " \-\-kmoddir " \fI{DIR}\fR
specify the directory, where to look for kernel modules
.TP
.BR " \-\-fwdir " \fI{DIR}\fR
specify additional directory, where to look for firmwares
.TP
.BR \-\-kernel-only
only install kernel drivers and firmware files
.TP
.BR \-\-no-kernel
do not install kernel drivers and firmware files
.TP
.BR \-\-strip
strip binaries in the initramfs (default)
.TP
.BR \-\-nostrip
do not strip binaries in the initramfs
.TP
.BR \-h ", " \-\-help
display help text and exit.
.TP
.B \-\-debug
output debug information of the build process
.TP
.BR \-v ", " \-\-verbose
verbose output during the build process
.TP
.BR \-c ", " \-\-conf " \fIFILE\fR"
specify configuration file to use.
Default:
.IR /etc/dracut.conf
.TP
.BR \-l ", " \-\-local
local mode. Use modules from the current working
directory instead of the system-wide installed in
.IR /usr/share/dracut/modules.d .
Useful when running dracut from a git checkout.
.TP
.BR \-H ", " \-\-hostonly
Host-Only mode: Install only what is needed for
booting the local host instead of a generic host.
.TP
.BR \-i ", " \-\-include " \fISOURCE\fR" "" " \fITARGET\fR"
include the files in the SOURCE directory into the
target directory in the final initramfs.
.TP
.BR \-I ", " \-\-install " \fILIST\fR"
install the space separated list of files into the initramfs.
.SH KERNEL COMMAND LINE
The root filesystem used by the kernel is specified in the boot configuration
file, as always. The traditional \fBroot=/dev/hda1\fR style device
specification is allowed. If a label is used, as in \fBroot=LABEL=rootPart\fR
the initrd will search all available devices for an ext2 or ext3 filesystem
with the appropriate label, and mount that device as the root filesystem.
\fBroot=UUID=uuidnumber\fR will mount the partition with that UUID as the
root filesystem.
.SH Standard
.TP
.B init=<path to real init>
.TP
.B root=<path to blockdevice>
specify e.g. \fI/dev/sda1\fR or
\fI/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1\fR
.B rootfstype=<filesystem type>
"auto" if not specified, e.g. \fIrootfstype=ext3\fR
.B rootflags=<mount options>
specify additional mount options for the root filesystem
.SH I18N
e.g. LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=de-latin1-nodeadkeys
.TP
.B KEYBOARDTYPE=sun|pc
will be written to /etc/sysconfig/keyboard in the initramfs
.TP
.B KEYTABLE=<keytable filename>
will be written to /etc/sysconfig/keyboard in the initramfs
.TP
.B SYSFONT= Console font
will be written to /etc/sysconfig/i18n in the initramfs
.TP
.B SYSFONTACM= Unicode font map
will be written to /etc/sysconfig/i18n in the initramfs
.TP
.B UNIMAP= Unicode font map
will be written to /etc/sysconfig/i18n in the initramfs
.TP
.B LANG=<locale>
will be written to /etc/sysconfig/i18n in the initramfs
.SH Bootsplash - plymouth
.TP
.B rd_plytheme=<theme name>
specify the plymouth bootsplash theme (fallback is text)
.SH LVM
.TP
.B rd_NO_LVM
disable LVM detection
.TP
.B rd_LVM_VG=<volume group name>
only activate the volume groups with the given name
.SH crypto LUKS
.TP
.B rd_NO_LUKS
disable crypto LUKS detection
.TP
.B rd_LUKS_UUID=<luks uuid>
only activate the LUKS partitions with the given UUID
.SH MD
.TP
.B rd_NO_MD
disable MD RAID detection
.TP
.B rd_NO_MDIMSM
no MD RAID for imsm/isw raids, use dmraid instead
.TP
.B rd_MD_UUID=<md uuid>
only activate the raid sets with the given UUID
.SH DMRAID
.TP
.B rd_NO_DM
disable DM RAID detection
.TP
.B rd_DM_UUID=<dmraid uuid>
only activate the raid sets with the given UUID
.SH DASD
.TP
.B dasd=....
same syntax as the kernel module parameter (s390 only)
.SH DHCP
.TP
.B root=dhcp
get IP from dhcp server, root-path option from dhcp specifies root location
.SH NFS
.TP
.B root=[<server-ip>:]<root-dir>[:<nfs-options>]
mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given,
use dhcp next_server.
NFS options can be appended with the prefix "." or ","
.TP
.B root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>]
.TP
.B root=nfs4:[<server-ip>:]<root-dir>[:<nfs-options>]
.TP
.B root=dhcp
root=dhcp alone directs initrd to look at the DHCP root-path where NFS
options can be specified.
root-path=<server-ip>:<root-dir>[,<nfs-options>]
root-path=nfs:<server-ip>:<root-dir>[,<nfs-options>]
root-path=nfs4:<server-ip>:<root-dir>[,<nfs-options>]
.TP
.B root=/dev/nfs nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
\fBDeprecated!\fR kernel Documentation/filesystems/nfsroot.txt defines
this method.
This is supported by dracut but not recommended.
.SH iSCSI
.TP
.B root=iscsi:[username:password[reverse:password]@][<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
protocol defaults to "6", LUN defaults to "0".
If the "servername" field is provided by BOOTP or DHCP, then that
field is used in conjunction with other associated fields to contact
the boot server in the Boot stage (Section 7). However, if the
"servername" field is not provided, then the "targetname" field is
then used in the Discovery Service stage in conjunction with other
associated fields.
http://tools.ietf.org/html/rfc4173
.TP
.B root=iscsi:[username:password[:reverse:password]@][<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
e.g. root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
.TP
.B root=??? netroot=iscsi:[username:password[:reverse:password]@][<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname> ...
multiple netroot options allow setting up multiple iscsi disks
e.g.
root=UUID=12424547 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1
.B not yet implemented
.TP
.B root=??? iscsi_initiator= iscsi_target_name= iscsi_target_ip= iscsi_target_port= iscsi_target_group= iscsi_username= iscsi_password= iscsi_in_username= iscsi_in_password=
.TP
.B root=??? iscsi_firmware
will read the iscsi parameter from the BIOS firmware
.SH NBD
.TP
.B root=nbd:<server>:<port>[:<fstype>][:<mountopts>]
mount nbd share from <server>
.TP
.B root=dhcp
with dhcp root-path=nbd:<server>:<port>[:<fstype>][:<mountopts>]
root=dhcp alone directs initrd to look at the DHCP root-path where NBD options can be specified.
This syntax is only usable in cases where you are directly mounting the volume as the rootfs.
.SH Network
.TP bootdev=<interface>
.B specify the network interface to boot from
.TP
.B ip={dhcp|on|any}
get ip from dhcp server from all interfaces. If root=dhcp, loop sequentially through all interfaces (eth0, eth1, ...) and use the first with a valid DHCP root-path.
.TP
.B ip=<interface>:{dhcp|on|any}
get ip from dhcp server on a specific interface
.TP
.B ip=<client-IP-number>:[<server-id>]:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:{none|off}
explicit network configuration
.SH Misc
.TP
.B rdblacklist=<drivername>
do not load kernel module <drivername>
.SH Debug
.TP
.B rdinfo
print informational output though "quiet" is set
.TP
.B rdshell
allow dropping to a shell, if root mounting fails
.TP
.B rdinitdebug
set -x for the dracut shell
.TP
.B rdbreak
drop to a shell at the end
.TP
.B rdbreak={cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot}
drop to a shell on defined breakpoint
.TP
.B rdudevinfo
set udev to loglevel info
.TP
.B rdudevdebug
set udev to loglevel debug
.TP
.B rdnetdebug
debug network scripts in dracut. Output is written to /tmp/
.SH CONFIGURATION IN INITRAMFS
.TP
.B /conf/conf.d/
Any files found in /conf/conf.d/ will be sourced in the initramfs to
set initial values. Command line options will override these values
set in the configuration files.
.SH AUTHORS
.nf
Andreas Thienemann <andreas@bawue.net>
Bill Nottingham <notting@redhat.com>
Dave Jones <davej@redhat.com>
David Dillow <dave@thedillows.org>
Harald Hoyer <harald@redhat.com>
Jeremy Katz <katzj@redhat.com>
Peter Jones <pjones@redhat.com>
Seewer Philippe <philippe.seewer@bfh.ch>
Victor Lowther <victor.lowther@gmail.com>
Warren Togami <wtogami@redhat.com>
.fi
.SH AVAILABILITY
The dracut command is part of the dracut package and is available from
https://sourceforge.net/apps/trac/dracut/wiki

525
dracut.8.xml Normal file
View File

@@ -0,0 +1,525 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- This document was created with Syntext Serna Free. --><!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
<refentry id="dracut8">
<refentryinfo>
<title>dracut</title>
<productname>dracut</productname>
<authorgroup>
<author>
<contrib>Project Leader, Developer</contrib>
<firstname>Harald</firstname>
<surname>Hoyer</surname>
<email>harald@redhat.com</email>
</author>
<author>
<contrib>Developer</contrib>
<firstname>Victor</firstname>
<surname>Lowther</surname>
<email>victor.lowther@gmail.com</email>
</author>
<author>
<contrib>Developer</contrib>
<firstname>Warren</firstname>
<surname>Togami</surname>
<email>wtogami@redhat.com</email>
</author>
<author>
<contrib>Developer</contrib>
<firstname>Jeremy</firstname>
<surname>Katz</surname>
<email>katzj@redhat.com</email>
</author>
<author>
<contrib>Developer</contrib>
<firstname>Philippe</firstname>
<surname>Seewer</surname>
<email>philippe.seewer@bfh.ch</email>
</author>
<author>
<contrib>Developer</contrib>
<firstname>David</firstname>
<surname>Dillow</surname>
<email>dave@thedillows.org</email>
</author>
<author>
<contrib>Developer</contrib>
<firstname>Amadeusz</firstname>
<surname>Żołnowski</surname>
<email>aidecoe@aidecoe.name</email>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>dracut</refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo class="version"/>
</refmeta>
<refnamediv>
<refname>dracut</refname>
<refpurpose>create initial ramdisk images for preloading modules</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>dracut</command>
<arg choice="opt" rep="repeat">
<replaceable>OPTION</replaceable>
</arg>
<arg choice="opt">
<replaceable>&lt;image&gt;</replaceable>
<arg choice="opt">
<replaceable>&lt;kernel-version&gt;</replaceable>
</arg>
</arg>
<sbr/>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><command>dracut</command>
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.</para>
<para>
For a complete list of kernel command line options see
<citerefentry>
<refentrytitle>dracut.kernel</refentrytitle>
<manvolnum>7</manvolnum>
</citerefentry>
</para>
<refsect2>
<title>Options</title>
<variablelist>
<varlistentry>
<term>
<option>-f</option>
</term>
<term>
<option>--force</option>
</term>
<listitem>
<para>overwrite existing initramfs file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-m</option>
</term>
<term>
<option>--modules&nbsp;<replaceable>&lt;list of dracut modules&gt;</replaceable></option>
</term>
<listitem>
<para>specify a space-separated list of dracut modules to call
when building the initramfs.
Modules are located in
<filename>/usr/share/dracut/modules.d</filename>. This parameter can be specified multiple times.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-o</option>
</term>
<term>
<option>--omit&nbsp;<replaceable>&lt;list of dracut modules&gt;</replaceable></option>
</term>
<listitem>
<para>omit a space-separated list of dracut modules. This parameter can be specified multiple times.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-a</option>
</term>
<term>
<option>--add&nbsp;<replaceable>&lt;list of dracut modules&gt;</replaceable></option>
</term>
<listitem>
<para>add a space-separated list of dracut modules to the default set of modules. This parameter can be specified multiple times.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-d</option>
</term>
<term>
<option>--drivers&nbsp;<replaceable>&lt;list of kernel modules&gt;</replaceable></option>
</term>
<listitem>
<para>specify a space-separated list of kernel modules to exclusively include
in the initramfs.
The kernel modules have to be specified without the &quot;.ko&quot; suffix. This parameter can be specified multiple times.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--add-drivers&nbsp;<replaceable>&lt;list of kernel modules&gt;</replaceable></option>
</term>
<listitem>
<para>specify a space-separated list of kernel modules to add to the initramfs.
The kernel modules have to be specified without the &quot;.ko&quot; suffix. This parameter can be specified multiple times.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--filesystems&nbsp;<replaceable>&lt;list of filesystems&gt;</replaceable></option>
</term>
<listitem>
<para>specify a space-separated list of kernel filesystem modules to exclusively
include in the generic initramfs. This parameter can be specified multiple times.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-k</option>
</term>
<term>
<option>--kmoddir&nbsp;<replaceable>&lt;kernel directory&gt;</replaceable></option>
</term>
<listitem>
<para>specify the directory, where to look for kernel modules</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option> --fwdir&nbsp;<replaceable>&lt;dir&gt;[:&lt;dir&gt;...]</replaceable></option>
</term>
<listitem>
<para>specify additional directories, where to look for firmwares. This parameter can be specified multiple times.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--kernel-only</option>
</term>
<listitem>
<para>only install kernel drivers and firmware files</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--no-kernel</option>
</term>
<listitem>
<para>do not install kernel drivers and firmware files</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--mdadmconf</option>
</term>
<listitem>
<para>include local <filename>/etc/mdadm.conf</filename></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--nomdadmconf</option>
</term>
<listitem>
<para>do not include local <filename>/etc/mdadm.conf</filename></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--strip</option>
</term>
<listitem>
<para>strip binaries in the initramfs (default)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--nostrip</option>
</term>
<listitem>
<para>do not strip binaries in the initramfs</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-h</option>
</term>
<term>
<option>--help</option>
</term>
<listitem>
<para>display help text and exit.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--debug</option>
</term>
<listitem>
<para>output debug information of the build process</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-v</option>
</term>
<term>
<option>--verbose</option>
</term>
<listitem>
<para>increase verbosity level (default is info(4))</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-q</option>
</term>
<term>
<option>--quiet</option>
</term>
<listitem>
<para>decrease verbosity level (default is info(4))</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-c</option>
</term>
<term>
<option>--conf&nbsp;<replaceable>&lt;dracut configuration file&gt;</replaceable></option>
</term>
<listitem>
<para>specify configuration file to use.
Default:
<filename>/etc/dracut.conf</filename></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--confdir&nbsp;<replaceable>&lt;configuration directory&gt;</replaceable></option>
</term>
<listitem>
<para>specify configuration directory to use.
Default:
<filename>/etc/dracut.conf.d</filename></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-l</option>
</term>
<term>
<option>--local</option>
</term>
<listitem>
<para>activates the local mode. dracut will use modules from the current working
directory instead of the system-wide installed modules in
<filename>/usr/share/dracut/modules.d</filename>.
This is useful when running dracut from a git checkout.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-H</option>
</term>
<term>
<option>--hostonly</option>
</term>
<listitem>
<para>Host-Only mode: Install only what is needed for booting
the local host instead of a generic host.
<warning>
<para>If chrooted to another root other than the real root device, use &quot;--fstab&quot; and provide a valid <filename>/etc/fstab</filename>.</para>
</warning></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--fstab</option>
</term>
<listitem>
<para>Use <filename>/etc/fstab</filename> instead of <filename>/proc/self/mountinfo</filename>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-i</option>
</term>
<term>
<option>--include&nbsp;<replaceable>&lt;SOURCE&gt;</replaceable>&nbsp;<replaceable>&lt;TARGET&gt;</replaceable></option>
</term>
<listitem>
<para>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.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-I</option>
</term>
<term>
<option>--install&nbsp;<replaceable>&lt;file list&gt;</replaceable></option>
</term>
<listitem>
<para>install the space separated list of files into the initramfs.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--gzip</option>
</term>
<listitem>
<para>Compress the generated initramfs using gzip.
This will be done by default, unless another compression option or --no-compress is passed. Equivalent to "--compress=gzip -9"</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--bzip2</option>
</term>
<listitem>
<para>Compress the generated initramfs using bzip2.
<warning>
<para>Make sure your kernel has bzip2 decompression support compiled in, otherwise you will not be able to boot. Equivalent to "--compress=bzip2"</para>
</warning></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--lzma</option>
</term>
<listitem>
<para>Compress the generated initramfs using lzma.
<warning>
<para>Make sure your kernel has lzma decompression support compiled in, otherwise you will not be able to boot. Equivalent to "--compress=lzma -9"</para>
</warning></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--xz</option>
</term>
<listitem>
<para>Compress the generated initramfs using xz.
<warning>
<para>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"</para>
</warning></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--compress&nbsp;<replaceable>&lt;compressor&gt;</replaceable></option>
</term>
<listitem>
<para>Compress the generated initramfs using the passed compression program. If you pass it just the name of a compression program, it will call that program with known-working arguments. If you pass a quoted string with arguments, it will be called with exactly those arguments. Depending on what you pass, this may result in an initramfs that the kernel cannot decompress.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--no-compress</option>
</term>
<listitem>
<para>Do not compress the generated initramfs. This will override any other compression options.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--list-modules</option>
</term>
<listitem>
<para>List all available dracut modules.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-M</option>
</term>
<term>
<option>--show-modules</option>
</term>
<listitem>
<para>Print included module's name to standard output during build.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
</refsect1>
<refsect1>
<title>Files</title>
<variablelist>
<varlistentry>
<term>
<filename>/var/log/dracut.log</filename>
</term>
<listitem>
<para>logfile of initramfs image creation</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<filename>/tmp/dracut.log</filename>
</term>
<listitem>
<para>logfile of initramfs image creation, if <filename>/var/log/dracut.log</filename> is not writable</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<filename>/etc/dracut.conf</filename>
</term>
<listitem>
<para>see <citerefentry>
<refentrytitle>dracut.conf</refentrytitle>
<manvolnum>5</manvolnum>
</citerefentry></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<filename>/etc/dracut.conf.d/*.conf</filename>
</term>
<listitem>
<para>see <citerefentry>
<refentrytitle>dracut.conf</refentrytitle>
<manvolnum>5</manvolnum>
</citerefentry></para>
</listitem>
</varlistentry>
</variablelist>
<refsect2>
<title>Configuration in the Initramfs</title>
<variablelist>
<varlistentry>
<term>
<filename>/etc/conf.d/</filename>
</term>
<listitem>
<para>Any files found in <filename>/etc/conf.d/</filename> will be sourced in the initramfs to
set initial values. Command line options will override these values
set in the configuration files.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<filename>/etc/cmdline</filename>
</term>
<listitem>
<para>Can contain additional command line options.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
</refsect1>
<refsect1>
<title>Availability</title>
<para>The dracut command is part of the dracut package and is available from
<ulink url="http://sourceforge.net/apps/trac/dracut/wiki">http://sourceforge.net/apps/trac/dracut/wiki</ulink></para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<citerefentry>
<refentrytitle>dracut.kernel</refentrytitle>
<manvolnum>7</manvolnum>
</citerefentry>
<citerefentry>
<refentrytitle>dracut.conf</refentrytitle>
<manvolnum>5</manvolnum>
</citerefentry>
</para>
</refsect1>
</refentry>

View File

@@ -1,13 +1,29 @@
# Sample dracut config file
logfile=/var/log/dracut.log
fileloglvl=6
# Specific list of dracut modules to use
#dracutmodules=""
#dracutmodules+=""
# Dracut modules to omit
#omit_dracutmodules=""
#omit_dracutmodules+=""
# Additional kernel modules to install
#drivers=""
# Dracut modules to add to the default
#add_dracutmodules+=""
# additional kernel modules to the default
#add_drivers+=""
# list of kernel filesystem modules to be included in the generic initramfs
#filesystems+=""
# build initrd only to boot current hardware
#hostonly="-h"
#hostonly="yes"
#
# install local /etc/mdadm.conf
mdadmconf="yes"
# install local /etc/lvm/lvm.conf
lvmconf="yes"

241
dracut.conf.5.xml Normal file
View File

@@ -0,0 +1,241 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- This document was created with Syntext Serna Free. --><!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
<refentry id="dracutconf5">
<refentryinfo>
<title>dracut.conf</title>
<productname>dracut</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Harald</firstname>
<surname>Hoyer</surname>
<email>harald@redhat.com</email>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>dracut.conf</refentrytitle>
<manvolnum>5</manvolnum>
</refmeta>
<refnamediv>
<refname>dracut.conf</refname>
<refpurpose>configuration file(s) for dracut</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>/etc/dracut.conf</command>
<arg choice="plain">
<replaceable>/etc/dracut.conf.d/*.conf</replaceable>
</arg>
<sbr/>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><filename>dracut.conf</filename>
is loaded during the initialisation phase of dracut.
Command line parameter will overwrite any values set here.
<emphasis><filename>dracut.conf.d/*.conf</filename> files are read in alphanumerical order and will</emphasis>
overwrite parameters set in <filename>/etc/dracut.conf</filename>. Each line specifies an attribute and a value. A &apos;#&apos; indicates the beginning of a comment; following characters, up to the end of the line are not interpreted.</para>
<variablelist>
<varlistentry>
<term>
<envar>dracutmodules+=&quot;&nbsp;<replaceable>&lt;dracut modules&gt;</replaceable>&nbsp;&quot;</envar>
</term>
<listitem>
<para>Specify a space-separated list of dracut modules to
call when building the initramfs. Modules are located
in <filename>/usr/share/dracut/modules.d</filename>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>omit_dracutmodules+=&quot;&nbsp;<replaceable>&lt;dracut modules&gt;</replaceable>&nbsp;&quot;</envar>
</term>
<listitem>
<para>Omit a space-separated list of dracut modules.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>add_dracutmodules+=&quot;&nbsp;<replaceable>&lt;dracut modules&gt;</replaceable>&nbsp;&quot;</envar>
</term>
<listitem>
<para>Add a space-separated list of dracut modules.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>drivers+=&quot;&nbsp;<replaceable>&lt;kernel modules&gt;</replaceable>&nbsp;&quot;</envar>
</term>
<listitem>
<para>Specify a space-separated list of kernel modules to
exclusively include in the initramfs.
The kernel modules have to be specified without the &quot;.ko&quot; suffix.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>add_drivers+=&quot;&nbsp;<replaceable>&lt;kernel modules&gt;</replaceable>&nbsp;&quot;</envar>
</term>
<listitem>
<para>Specify a space-separated list of kernel
modules to add to the initramfs.
The kernel modules have to be specified without the &quot;.ko&quot; suffix.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>filesystems+=&quot;&nbsp;<replaceable>&lt;filesystem names&gt;</replaceable>&nbsp;&quot;</envar>
</term>
<listitem>
<para>Specify a space-separated list of kernel filesystem
modules to exclusively include in the generic
initramfs.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>drivers_dir=&quot;<replaceable>&lt;kernel modules directory&gt;</replaceable>&quot;</envar>
</term>
<listitem>
<para>Specify the directory, where to look for kernel modules</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>fw_dir+=&quot;&#160;:<replaceable>&lt;dir&gt;</replaceable>[:<replaceable>&lt;dir&gt;</replaceable>&nbsp;...]&nbsp;&quot;</envar>
</term>
<listitem>
<para>Specify additional directories, where to look for firmwares, separated by <constant>:</constant></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>do_strip=&quot;<replaceable>{yes|no}</replaceable>&quot;</envar>
</term>
<listitem>
<para>Strip binaries in the initramfs (default=yes)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>hostonly=&quot;<replaceable>{yes|no}</replaceable>&quot;</envar>
</term>
<listitem>
<para>Host-Only mode: Install only what is needed for booting
the local host instead of a generic host.
<warning><para>If chrooted to another root other than the real root device, use <option>--fstab</option> and provide a valid <filename>/etc/fstab</filename>.</para>
</warning>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>use_fstab=&quot;<replaceable>{yes|no}</replaceable>&quot;</envar>
</term>
<listitem>
<para>Use <filename>/etc/fstab</filename> instead of <filename>/proc/self/mountinfo</filename>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>mdadmconf=&quot;<replaceable>{yes|no}</replaceable>&quot;</envar>
</term>
<listitem>
<para>Include local <filename>/etc/mdadm.conf</filename> (default=yes)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>lvmconf=&quot;<replaceable>{yes|no}</replaceable>&quot;</envar>
</term>
<listitem>
<para>Include local <filename>/etc/lvm/lvm.conf</filename> (default=yes)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>kernel_only=&quot;<replaceable>{yes|no}</replaceable>&quot;</envar>
</term>
<listitem>
<para>Only install kernel drivers and firmware files. (default=no)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>no_kernel=&quot;<replaceable>{yes|no}</replaceable>&quot;</envar>
</term>
<listitem>
<para>Do not install kernel drivers and firmware files (default=no)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>stdloglvl=&quot;<replaceable>{0-6}</replaceable>&quot;</envar>
</term>
<listitem>
<para>Set logging to standard error level.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>sysloglvl=&quot;<replaceable>{0-6}</replaceable>&quot;</envar>
</term>
<listitem>
<para>Set logging to syslog level.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>fileloglvl=&quot;<replaceable>{0-6}</replaceable>&quot;</envar>
</term>
<listitem>
<para>Set logging to file level.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>logfile=&quot;<replaceable>&lt;file&gt;</replaceable>&quot;</envar>
</term>
<listitem>
<para>Path to log file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>show_modules=&quot;<replaceable>{yes|no}</replaceable>&quot;</envar>
</term>
<listitem>
<para>Print included module's name to standard output during build.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Files</title>
<variablelist>
<varlistentry>
<term>
<filename>/etc/dracut/conf.d/</filename>
</term>
<listitem>
<para>Any <filename>/etc/dracut/conf.d/*.conf</filename> file can overwrite the values in <filename>/etc/dracut.conf</filename>.
The configuration files are read in alphanumerical order.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>See Also</title>
<para><citerefentry>
<refentrytitle>dracut</refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>
<citerefentry>
<refentrytitle>dracut.kernel</refentrytitle>
<manvolnum>7</manvolnum>
</citerefentry>
</para>
</refsect1>
</refentry>

View File

@@ -0,0 +1,7 @@
# /etc/dracut.conf.d/redhat.conf
# 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"
add_dracutmodules+=" rpmversion "
stdloglvl=3

View File

@@ -0,0 +1,3 @@
# turn on fips module
add_dracutmodules+=" fips "

View File

@@ -0,0 +1,9 @@
# /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,9 @@
# /etc/dracut.conf.d/gentoo.conf
# Dracut config file customized for Gentoo Base System release 1
#
# 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"

View File

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

1230
dracut.kernel.7.xml Normal file

File diff suppressed because it is too large Load Diff

7
dracut.logrotate Normal file
View File

@@ -0,0 +1,7 @@
/var/log/dracut.log {
missingok
notifempty
size 30k
yearly
create 0600 root root
}

BIN
dracut.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@@ -1,7 +1,9 @@
%if 0%{?fedora} < 12
%define with_switch_root 1
%else
%define with_switch_root 0
# Variables must be defined
%define with_nbd 1
# nbd in Fedora only
%if 0%{?rhel} >= 6
%define with_nbd 0
%endif
%if %{defined gittag}
@@ -12,90 +14,149 @@
%endif
Name: dracut
Version: 001
Release: 1%{?rdist}
Summary: Initramfs generator using udev
Group: System Environment/Base
License: GPLv2+
URL: http://apps.sourceforge.net/trac/dracut/wiki
Source0: dracut-%{version}%{?dashgittag}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: udev
Requires: util-linux-ng
Requires: module-init-tools >= 3.7-9
Requires: cpio
Requires: coreutils
Requires: findutils
Requires: binutils
Requires: grep
Requires: which
Requires: mktemp >= 1.5-5
Requires: mount
Requires: bash
Requires: dash
Requires: /bin/sh
Requires: fileutils, gzip, tar
Requires: lvm2 >= 2.02.33-9, dhclient
Requires: filesystem >= 2.1.0, cpio, device-mapper, initscripts >= 8.63-1
Requires: e2fsprogs >= 1.38-12, libselinux, libsepol, coreutils
Requires: mdadm, elfutils-libelf, plymouth >= 0.7.0
Requires: cryptsetup-luks
Requires: file
Requires: bzip2
Requires: policycoreutils
Requires: dmraid
Requires: kbd
Version: 010
%define release_prefix 0%{?rdist}
Release: %{release_prefix}
Summary: Initramfs generator using udev
%if 0%{?fedora}
Group: System Environment/Base
%endif
%if 0%{?suse_version}
Group: System/Base
%endif
License: GPLv2+
URL: https://dracut.wiki.kernel.org/
# Source can be generated by
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{?dashgittag};sf=tgz
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}%{?dashgittag}.tar.bz2
%if ! 0%{?with_switch_root}
Requires: util-linux-ng >= 2.16
BuildArch: noarch
%if 0%{?fedora}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%endif
%if 0%{?suse_version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%endif
%if 0%{?fedora}
BuildRequires: docbook-style-xsl docbook-dtds libxslt
%endif
%if 0%{?suse_version}
BuildRequires: docbook-xsl-stylesheets libxslt
%endif
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6
# no "provides", because dracut does not offer
# all functionality of the obsoleted packages
Obsoletes: mkinitrd <= 6.0.93
Obsoletes: mkinitrd-devel <= 6.0.93
Obsoletes: nash <= 6.0.93
Obsoletes: libbdevid-python <= 6.0.93
%endif
%if 0%{?suse_version} > 9999
Obsoletes: mkinitrd < 2.6.1
Provides: mkinitrd = 2.6.1
%endif
Obsoletes: dracut-kernel < 005
Provides: dracut-kernel = %{version}-%{release}
Requires: bash
Requires: bzip2
Requires: coreutils
Requires: cpio
Requires: dash
Requires: filesystem >= 2.1.0
Requires: findutils
Requires: grep
Requires: gzip
Requires: kbd
Requires: mktemp >= 1.5-5
Requires: module-init-tools >= 3.7-9
Requires: sed
Requires: tar
Requires: udev
%if 0%{?fedora}
Requires: util-linux >= 2.16
Requires: initscripts >= 8.63-1
Requires: plymouth >= 0.8.0-0.2009.29.09.19.1
%endif
%if 0%{?suse_version}
Requires: util-linux >= 2.16
%endif
%description
dracut is a new, event-driven initramfs infrastructure based around udev.
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
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: rpcbind nfs-utils
Requires: iscsi-initiator-utils
Requires: rpcbind
%if %{with_nbd}
Requires: nbd
Requires: net-tools iproute
%endif
Requires: iproute
Requires: bridge-utils
%if 0%{?fedora}
Requires: iscsi-initiator-utils
Requires: nfs-utils
Requires: dhclient
%endif
%if 0%{?suse_version}
Requires: dhcp-client
Requires: nfs-client
Requires: vlan
%endif
Obsoletes: dracut-generic < 008
Provides: dracut-generic = %{version}-%{release}
%description network
This package requires everything which is needed to build a generic
all purpose initramfs with network support with dracut.
%package generic
Summary: Metapackage to build a generic initramfs with dracut
%if 0%{?fedora}
%package fips
Summary: Dracut modules to build a dracut initramfs with an integrity check
Requires: %{name} = %{version}-%{release}
Requires: %{name}-network = %{version}-%{release}
Requires: hmaccalc
%if 0%{?rhel} > 5
# For Alpha 3, we want nss instead of nss-softokn
Requires: nss
%else
Requires: nss-softokn
%endif
Requires: nss-softokn-freebl
%description generic
This package requires everything which is needed to build a generic
all purpose initramfs with dracut.
%description fips
This package requires everything which is needed to build an
all purpose initramfs with dracut, which does an integrity check.
%endif
%package kernel
Summary: Metapackage to build generic initramfs with dracut with only kernel modules
%package caps
Summary: Dracut modules to build a dracut initramfs which drops capabilities
Requires: %{name} = %{version}-%{release}
Requires: ql2100-firmware
Requires: ql2200-firmware
Requires: ql23xx-firmware
Requires: ql2400-firmware
Requires: ql2500-firmware
Requires: libcap
%description kernel
This package requires everything which is needed to build a initramfs with all
kernel modules and firmware files needed by dracut modules.
%description caps
This package requires everything which is needed to build an
all purpose initramfs with dracut, which drops capabilities.
%package tools
Summary: dracut tools to build the local initramfs
Requires: coreutils cryptsetup-luks device-mapper
Requires: diffutils dmraid findutils gawk grep lvm2
Requires: module-init-tools sed
Requires: cpio gzip
Summary: Dracut tools to build the local initramfs
Requires: %{name} = %{version}-%{release}
%description tools
This package contains tools to assemble the local initrd and host configuration.
@@ -104,54 +165,107 @@ This package contains tools to assemble the local initrd and host configuration.
%setup -q -n %{name}-%{version}%{?dashgittag}
%build
make
make WITH_SWITCH_ROOT=0%{?with_switch_root}
%install
%if 0%{?fedora}
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin \
sysconfdir=/etc mandir=%{_mandir}
%if ! 0%{?with_switch_root}
rm -f $RPM_BUILD_ROOT/sbin/switch_root
%endif
make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin \
sysconfdir=/etc mandir=%{_mandir} WITH_SWITCH_ROOT=0%{?with_switch_root}
echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/10rpmversion/dracut-version
%if 0%{?fedora} == 0
rm -fr $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/01fips
%endif
# remove gentoo specific modules
rm -fr $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/50gensplash
mkdir -p $RPM_BUILD_ROOT/boot/dracut
mkdir -p $RPM_BUILD_ROOT/var/lib/dracut/overlay
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log
touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
%if 0%{?fedora}
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
%endif
%if 0%{?suse_version}
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
%endif
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
rm $RPM_BUILD_ROOT/sbin/mkinitrd
rm $RPM_BUILD_ROOT/sbin/lsinitrd
%endif
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d/dracut
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/dracut
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,0755)
%doc README HACKING TODO COPYING AUTHORS NEWS
%doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg
/sbin/dracut
%if 0%{?with_switch_root}
/sbin/switch_root
%endif
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
/sbin/mkinitrd
/sbin/lsinitrd
%endif
%dir %{_datadir}/dracut
%dir %{_datadir}/dracut/modules.d
%{_datadir}/dracut/dracut-functions
%{_datadir}/dracut/dracut-logger
%config(noreplace) /etc/dracut.conf
%if 0%{?fedora} || 0%{?suse_version}
%config(noreplace) /etc/dracut.conf.d/01-dist.conf
%endif
%dir /etc/dracut.conf.d
%config(noreplace) /etc/logrotate.d/dracut
%{_mandir}/man8/dracut.8*
%{_mandir}/man7/dracut.kernel.7*
%{_mandir}/man5/dracut.conf.5*
%{_datadir}/dracut/modules.d/00bootchart
%{_datadir}/dracut/modules.d/00dash
%{_datadir}/dracut/modules.d/10redhat-i18n
%{_datadir}/dracut/modules.d/05busybox
%{_datadir}/dracut/modules.d/10i18n
%{_datadir}/dracut/modules.d/10rpmversion
%{_datadir}/dracut/modules.d/50plymouth
%{_datadir}/dracut/modules.d/60xen
%{_datadir}/dracut/modules.d/90btrfs
%{_datadir}/dracut/modules.d/90crypt
%{_datadir}/dracut/modules.d/90dm
%{_datadir}/dracut/modules.d/90dmraid
%{_datadir}/dracut/modules.d/90dmsquash-live
%{_datadir}/dracut/modules.d/90kernel-modules
%{_datadir}/dracut/modules.d/90lvm
%{_datadir}/dracut/modules.d/90mdraid
%{_datadir}/dracut/modules.d/90multipath
%{_datadir}/dracut/modules.d/95debug
%{_datadir}/dracut/modules.d/95resume
%{_datadir}/dracut/modules.d/95rootfs-block
%{_datadir}/dracut/modules.d/95s390
%{_datadir}/dracut/modules.d/95dasd
%{_datadir}/dracut/modules.d/95dasd_mod
%{_datadir}/dracut/modules.d/95fstab-sys
%{_datadir}/dracut/modules.d/95zfcp
%{_datadir}/dracut/modules.d/95terminfo
%{_datadir}/dracut/modules.d/95udev-rules
%{_datadir}/dracut/modules.d/95udev-rules.ub810
%{_datadir}/dracut/modules.d/97biosdevname
%{_datadir}/dracut/modules.d/98selinux
%{_datadir}/dracut/modules.d/98syslog
%{_datadir}/dracut/modules.d/99base
# logfile needs no logrotate, because it gets overwritten
# for every dracut run
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
%dir %{_sharedstatedir}/initramfs
%files network
%defattr(-,root,root,0755)
@@ -160,18 +274,24 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/dracut/modules.d/95iscsi
%{_datadir}/dracut/modules.d/95nbd
%{_datadir}/dracut/modules.d/95nfs
%{_datadir}/dracut/modules.d/45ifcfg
%{_datadir}/dracut/modules.d/95znet
%files kernel
%if 0%{?fedora}
%files fips
%defattr(-,root,root,0755)
%doc README.kernel
%{_datadir}/dracut/modules.d/01fips
%config(noreplace) /etc/dracut.conf.d/40-fips.conf
%endif
%files generic
%files caps
%defattr(-,root,root,0755)
%doc README.generic
%{_datadir}/dracut/modules.d/02caps
%files tools
%defattr(-,root,root,0755)
%doc COPYING NEWS
%{_mandir}/man8/dracut-gencmdline.8*
%{_mandir}/man8/dracut-catimages.8*
/sbin/dracut-gencmdline
/sbin/dracut-catimages
%dir /boot/dracut
@@ -179,43 +299,3 @@ rm -rf $RPM_BUILD_ROOT
%dir /var/lib/dracut/overlay
%changelog
* Wed Sep 02 2009 Harald Hoyer <harald@redhat.com> 001-1
- version 001
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
* Fri Aug 14 2009 Harald Hoyer <harald@redhat.com> 0.9-1
- version 0.9
* Thu Aug 06 2009 Harald Hoyer <harald@redhat.com> 0.8-1
- version 0.8
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
* Fri Jul 24 2009 Harald Hoyer <harald@redhat.com> 0.7-1
- version 0.7
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
* Wed Jul 22 2009 Harald Hoyer <harald@redhat.com> 0.6-1
- version 0.6
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
* Fri Jul 17 2009 Harald Hoyer <harald@redhat.com> 0.5-1
- version 0.5
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
* Sat Jul 04 2009 Harald Hoyer <harald@redhat.com> 0.4-1
- version 0.4
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
* Thu Jul 02 2009 Harald Hoyer <harald@redhat.com> 0.3-1
- version 0.3
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
* Wed Jul 01 2009 Harald Hoyer <harald@redhat.com> 0.2-1
- version 0.2
* Fri Jun 19 2009 Harald Hoyer <harald@redhat.com> 0.1-1
- first release
* Thu Dec 18 2008 Jeremy Katz <katzj@redhat.com> - 0.0-1
- Initial build

1701
dracut.svg Normal file

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 68 KiB

725
dracut.xml Normal file
View File

@@ -0,0 +1,725 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- This document was created with Syntext Serna Free. -->
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
<book>
<title><inlinemediaobject>
<imageobject>
<imagedata valign="middle" fileref="dracut.png" format="PNG"/>
</imageobject>
<imageobject>
<imagedata valign="middle" fileref="dracut.svg" format="SVG"/>
</imageobject>
<imageobject>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dracut.svg" encoding="UTF-8" parse="xml"/>
</imageobject>
</inlinemediaobject>dracut</title>
<bookinfo>
<author>
<firstname>Harald</firstname>
<surname>Hoyer</surname>
</author>
<pubdate>2010</pubdate>
<edition>Version 1.0</edition>
<copyright>
<year>2010</year>
<holder>Harald Hoyer</holder>
</copyright>
<legalnotice>
<para>
This work is licensed under the Creative Commons Attribution/Share-Alike License. To view a copy of this license, visit <ulink url="http://creativecommons.org/licenses/by-sa/3.0/">http://creativecommons.org/licenses/by-sa/3.0/</ulink> or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
</para>
</legalnotice>
</bookinfo>
<toc/>
<chapter>
<chapterinfo>
<legalnotice>
<para>
This section is a modified version of <ulink url="http://en.wikipedia.org/wiki/Initrd">http://en.wikipedia.org/wiki/Initrd</ulink>, which is licensed under the Creative Commons Attribution/Share-Alike License.
</para>
</legalnotice>
</chapterinfo>
<title>Introduction</title>
<section>
<title>Definition</title>
<para>An <emphasis>initial ramdisk</emphasis> is a temporary file system used in the boot process of the Linux kernel. <emphasis>initrd</emphasis> and <emphasis>initramfs</emphasis> refer to slightly different schemes for loading this file system into memory. Both are commonly used to make preparations before the real root file system can be mounted.</para>
</section>
<section>
<title>Rationale </title>
<para>Many Linux distributions ship a single, generic kernel image that is intended to boot as wide a variety of hardware as possible. The device drivers for this generic kernel image are included as loadable modules, as it is not possible to statically compile them all into the one kernel without making it too large to boot from computers with limited memory or from lower-capacity media like floppy disks.
</para>
<para>This then raises the problem of detecting and loading the modules necessary to mount the root file system at boot time (or, for that matter, deducing where or what the root file system is).
</para>
<para>To further complicate matters, the root file system may be on a software <acronym>RAID</acronym> volume, <acronym>LVM</acronym>, <acronym>NFS</acronym> (on diskless workstations), or on an encrypted partition. All of these require special preparations to mount.
</para>
<para>Another complication is kernel support for hibernation, which suspends the computer to disk by dumping an image of the entire system to a swap partition or a regular file, then powering off. On next boot, this image has to be made accessible before it can be loaded back into memory. </para>
<para>To avoid having to hardcode handling for so many special cases into the kernel, an initial boot stage with a temporary root file system—now dubbed early user space—is used. This root file system would contain user-space helpers that would do the hardware detection, module loading and device discovery necessary to get the real root file system mounted.
</para>
</section>
<section>
<title>Implementation </title>
<para>An image of this initial root file system (along with the kernel image) must be stored somewhere accessible by the Linux bootloader or the boot firmware of the computer. This can be: </para>
<itemizedlist>
<listitem>
<para>The root file system itself </para>
</listitem>
<listitem>
<para>A boot image on an optical disc
</para>
</listitem>
<listitem>
<para>A small ext2/ext3 or <acronym>FAT</acronym>-formatted partition on a local disk (a <emphasis>boot partition</emphasis>)</para>
</listitem>
<listitem>
<para>A <acronym>TFTP</acronym> server (on systems that can boot from Ethernet) </para>
</listitem>
</itemizedlist>
<para>The bootloader will load the kernel and initial root file system image into memory and then start the kernel, passing in the memory address of the image.
</para>
<para>Depending on which algorithms were compiled statically into it, the kernel can currently unpack initrd/initramfs images compressed with gzip, bzip2 and <acronym>LZMA</acronym>. </para>
</section>
<section>
<title>Mount preparations </title>
<para>dracut can generate a customized initrams image which contains only whatever is necessary to boot some particular computer, such as <acronym>ATA</acronym>, <acronym>SCSI</acronym> and filesystem kernel modules (host-only mode).</para>
<para>dracut can also generate a more generic initramfs image (default mode). </para>
<para>dracut&apos;s initramfs starts only with the device name of the root file system (or its <acronym>UUID</acronym>) and must discover everything else at boot time. A complex cascade of tasks must be performed to get the root file system mounted: </para>
<itemizedlist>
<listitem>
<para>Any hardware drivers that the boot process depends on must be loaded. All kernel modules for common storage devices are packed onto the initramfs and then udev pulls in modules matching the computer&apos;s detected hardware. </para>
</listitem>
<listitem>
<para>On systems which display a boot rd.splash screen, the video hardware must be initialized and a user-space helper started to paint animations onto the display in lockstep with the boot process. </para>
</listitem>
<listitem>
<para>If the root file system is on NFS, dracut does then: <itemizedlist>
<listitem>
<para>Bring up the primary network interface. </para>
</listitem>
<listitem>
<para>Invoke a DHCP client, with which it can obtain a DHCP lease. </para>
</listitem>
<listitem>
<para>Extract the name of the NFS share and the address of the NFS server from the lease. </para>
</listitem>
<listitem>
<para>Mount the <acronym>NFS</acronym> share. </para>
</listitem>
</itemizedlist></para>
</listitem>
<listitem>
<para>If the root file system appears to be on a software <acronym>RAID</acronym> device, there is no way of knowing which devices the <acronym>RAID</acronym> volume spans; the standard <acronym>MD</acronym> utilities must be invoked to scan all available block devices with a raid signature and bring the required ones online. </para>
</listitem>
<listitem>
<para>If the root file system appears to be on a logical volume, the <acronym>LVM</acronym> utilities must be invoked to scan for and activate the volume group containing it. </para>
</listitem>
<listitem>
<para>If the root file system is on an encrypted block device: <itemizedlist>
<listitem>
<para>Invoke a helper script to prompt the user to type in a passphrase and/or insert a hardware token (such as a smart card or a <acronym>USB</acronym> security dongle). </para>
</listitem>
<listitem>
<para>Create a decryption target with the device mapper. </para>
</listitem>
</itemizedlist></para>
</listitem>
</itemizedlist>
<para>dracut uses udev, an event-driven hotplug agent, which invokes helper programs as hardware devices, disk partitions and storage volumes matching certain rules come online. This allows discovery to run in parallel, and to progressively cascade into arbitrary nestings of <acronym>LVM</acronym>, <acronym>RAID</acronym> or encryption to get at the root file system. </para>
<para>When the root file system finally becomes visible: <itemizedlist>
<listitem>
<para>Any maintenance tasks which cannot run on a mounted root file system are done. </para>
</listitem>
<listitem>
<para>The root file system is mounted read-only. </para>
</listitem>
<listitem>
<para>Any processes which must continue running (such as the rd.splash screen helper and its command <acronym>FIFO</acronym>) are hoisted into the newly-mounted root file system. </para>
</listitem>
</itemizedlist></para>
<para>The final root file system cannot simply be mounted over /, since that would make the scripts and tools on the initial root file system inaccessible for any 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.
</para>
</section>
</chapter>
<chapter>
<title>User Manual</title>
<section>
<title>Creating an initramfs Image</title>
<para>To create a initramfs image, the most simple command is:</para>
<screen># dracut</screen>
<para>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-<replaceable>&lt;kernel version&gt;</replaceable>.img and contains the kernel modules of the currently active kernel with version <replaceable>&lt;kernel version&gt;</replaceable>.</para>
<para>If the initramfs image already exists, dracut will display an error message, and to overwrite the existing image, you have to use the <option>--force</option> option. </para>
<screen># dracut --force</screen>
<para>If you want to specify another filename for the resulting image you would issue a command like:</para>
<screen># dracut foobar.img</screen>
<para>To generate an image for a specific kernel version, the command would be:</para>
<screen># dracut foobar.img 2.6.40-1.rc5.f20</screen>
<para>A shortcut to generate the image at the default location for a specific kernel version is:</para>
<screen># dracut &apos;&apos; 2.6.40-1.rc5.f20</screen>
<para>If you want to create lighter, smaller initramfs images, you may want to specify the <option>--host-only</option> or <option>-H</option> 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&apos;t put the disk on another controller or machine, and that you can&apos;t switch to another root filesystem, without recreating the initramfs image. The usage of the <option>--host-only</option> 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.</para>
<section>
<title>Inspecting the Contents</title>
<para>To see the contents of the image created by dracut, you can use the <command>lsinitrd</command> tool.</para>
<screen># lsinitrd /boot/initramfs-$(uname -r).img | less</screen>
<para>To display the contents of a file in the initramfs also use the <command>lsinitrd</command> tool:</para>
<screen># lsinitrd /boot/initramfs-$(uname -r).img /etc/ld.so.conf
include ld.so.conf.d/*.conf</screen>
</section>
<section>
<title>Adding dracut Modules</title>
<para>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 <filename>/etc/dracut.conf</filename> or <filename>/etc/dracut.conf.d/myconf.conf</filename>. See the man page <xref linkend="dracutconf5"/>. You can also add dracut modules on the command line by using the <option>-a</option> or <option>--add</option> option:</para>
<screen># dracut --add bootchart initramfs-bootchart.img</screen>
<para>To see a list of available dracut modules, use the <option>--list-modules</option> option:</para>
<screen># dracut --list-modules</screen>
<para>or, if you have a dracut version earlier than <literal>008</literal>, issue the command:</para>
<screen># for mod in /usr/share/dracut/modules.d/*; do echo ${mod##*/??}; done</screen>
</section>
<section>
<title>Omitting dracut Modules</title>
<para>Sometimes you don&apos;t want a dracut module to be included for reasons of speed, size or functionality. To do this, either specify the <envar>omit_dracutmodules</envar> variable in the <filename>dracut.conf</filename> or <filename>/etc/dracut.conf.d/myconf.conf</filename> configuration file (see man page <xref linkend="dracutconf5"/>), or use the <option>-o</option> or <option>--omit</option> option on the command line:</para>
<screen># dracut -o &quot;multipath lvm&quot; no-multipath-lvm.img</screen>
</section>
<section>
<title>Adding Kernel Modules</title>
<para>If you need a special kernel module in the initramfs, which is not automatically picked up by dracut, you have the use the <option>--add-drivers</option> option on the command line or the drivers vaiable in the <filename>/etc/dracut.conf</filename> or <filename>/etc/dracut.conf.d/myconf.conf</filename> configuration file (see man page <xref linkend="dracutconf5"/>):</para>
<screen># dracut --add-drivers mymod initramfs-with-mymod.img</screen>
</section>
</section>
<section>
<title>Boot parameters</title>
<para>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 <varname>LABEL</varname> or <varname>UUID</varname> on the kernel command line for your root device, dracut will find it and boot from it.</para>
<para>The kernel command line usually can be configured in <filename>/boot/grub/grub.conf</filename>, if grub is your bootloader and it also can be edited in the real boot process in the grub menu.</para>
<para>The kernel command line can also be provided by the dhcp server with the root-path option. See <xref linkend="NetworkBoot"/>.</para>
<para>For a full reference of all kernel command line parameters, see the <xref linkend="dracutconf5"/> or <xref linkend="dracut8"/> man page.</para>
<section>
<title>Specifying the root Device</title>
<para>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 <envar>root=</envar> option. The most basic one is <envar>root=<replaceable>&lt;path to device node&gt;</replaceable></envar>:</para>
<screen>root=/dev/sda2</screen>
<para>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:</para>
<screen>root=UUID=19e9dda3-5a38-484d-a9b0-fa6b067d0331</screen>
<para>or</para>
<screen>root=LABEL=myrootpartitionlabel</screen>
<para>To see all <envar>UUID</envar>s or <envar>LABEL</envar>s on your system, do:</para>
<screen># ls -l /dev/disk/by-uuid</screen>
<para>or</para>
<screen># ls -l /dev/disk/by-label</screen>
<para>If your root partition is on the network see <xref linkend="NetworkBoot"/>.</para>
</section>
<section>
<title>Keyboard Settings</title>
<para>If you have to input passwords for encrypted disk volumes, you might want to set the keyboard layout and specify a display font.</para>
<para>A typical german kernel command would contain:</para>
<screen>vconsole.font=latarcyrheb-sun16 vconsole.keymap=de-latin1-nodeadkeys locale.LANG=de_DE.UTF-8</screen>
<para>Setting these options can override the setting stored on your system, if you use a modern init system, like systemd.</para>
<para>For dracut versions prior to version <literal>008</literal> the line would look like:</para>
<screen>LANG=de_DE.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=de-latin1-nodeadkeys</screen>
</section>
<section>
<title>Blacklisting Kernel Modules</title>
<para>Sometimes it is required to prevent the automatic kernel module loading of a specific kernel module. To do this, just add <envar>rd.blacklist=<replaceable>&lt;kernel module name&gt;</replaceable></envar>, with <replaceable>&lt;kernel module name&gt;</replaceable> not containing the <filename>.ko</filename> suffix, to the kernel command line. For example:</para>
<screen>rd.blacklist=mptsas rd.blacklist=nouveau</screen>
<para>The option can be specified multiple times on the kernel command line.</para>
</section>
<section>
<title>Speeding up the Boot Process</title>
<para>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 <acronym>LVM</acronym> volume or not on a raid partition, or that it lives inside a specific crypto <acronym>LUKS</acronym> encrypted volume. By default, dracut searches everywhere. A typical dracut kernel command line for a plain primary or logical partition would contain:</para>
<screen>rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0</screen>
<para>on systems with dracut version prior to <literal>008</literal> the line would look like:</para>
<screen>rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM</screen>
<para>This turns off every automatic assembly of <acronym>LVM</acronym>, <acronym>MD</acronym> raids, <acronym>DM</acronym> raids and crypto <acronym>LUKS</acronym>.</para>
<para>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.</para>
</section>
<section id="Injecting">
<title>Injecting custom Files</title>
<para>To add your own files to the initramfs image, you have several possibilities.</para>
<para>The <option>--include</option> option let you specify a source path and a target path. For example</para>
<screen># dracut --include cmdline-preset /etc/cmdline initramfs-cmdline-pre.img</screen>
<para>will create an initramfs image, where the file cmdline-preset will be copied inside the initramfs to <filename>/etc/cmdline</filename>. <option>--include</option> can only be specified once.</para>
<screen># mkdir rd.live.overlay
# mkdir rd.live.overlay/etc
# mkdir rd.live.overlay/etc/conf.d
# echo &quot;ip=auto&quot; &gt;&gt; rd.live.overlay/etc/cmdline
# echo export TESTVAR=testtest &gt;&gt; rd.live.overlay/etc/conf.d/testvar.conf
# echo export TESTVAR=testtest &gt;&gt; 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</screen>
<para>This will put the contents of the rd.live.overlay directory into the root of the initramfs image.</para>
<para>The <option>--install</option> 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.</para>
<screen># dracut --install &apos;strace fsck.ext3 ssh&apos; initramfs-dbg.img</screen>
<para>This will create an initramfs with the <command>strace</command>, <command>fsck.ext3</command> and <command>ssh</command> executables, together with the libraries needed to start those. The <option>--install</option> option can be specified multiple times.</para>
</section>
</section>
<section id="NetworkBoot">
<title>Network Boot</title>
<para>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.</para>
<para>On a Red Hat Enterprise Linux or Fedora system, this means, you have to install the <filename>dracut-network</filename> rpm package:</para>
<screen># yum install dracut-network</screen>
<para>The resulting initramfs image can be served by a boot manager residing on your local hard drive or it can be served by a <acronym>PXE</acronym>/<acronym>TFTP</acronym> server.</para>
<para>How to setup your <acronym>PXE</acronym>/<acronym>TFTP</acronym> server can be found in the <ulink url="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/">Red Hat Enterprise Linux Storage Administration Guide</ulink>.</para>
<para>If you specify <envar>rd.ip=auto</envar> 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 <acronym>TFTP</acronym>/<acronym>DHCP</acronym> server. If you can&apos;t pass a kernel command line, then you can inject <filename>/etc/cmdline</filename>, with a method described in <xref linkend="Injecting"/>.
</para>
<section>
<title>Reducing the Image Size</title>
<para>To reduce the size of the initramfs, you should create it with by ommitting all dracut modules, which you know, you don&apos;t need to boot the machine.</para>
<para>You can also specify the exact dracut and kernel modules to produce a very tiny initramfs image.</para>
<para>For example for a <acronym>NFS</acronym> image, you would do:</para>
<screen># dracut -m &quot;nfs network base&quot; initramfs-nfs-only.img</screen>
<para>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 <option>--host-only</option> option:</para>
<screen># dracut -m &quot;nfs network base&quot; --host-only initramfs-nfs-host-only.img</screen>
<para>This will reduce the size of the initramfs image significantly.</para>
</section>
<section>
<title>NFS Root Device</title>
<para/>
</section>
<section>
<title>iSCSI Root Device</title>
<para>
</para>
</section>
<section>
<title>FCoE Root Device</title>
<para>
</para>
</section>
</section>
<section>
<title>Troubleshooting</title>
<para>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: <ulink url="http://fedoraproject.org/wiki/How_to_debug_Dracut_problems">http://fedoraproject.org/wiki/How_to_debug_Dracut_problems</ulink></para>
<section id="identifying-your-problem-area">
<title>Identifying your problem area</title>
<orderedlist>
<listitem>
<para>Remove &apos;&apos;rhgb&apos;&apos; and &apos;&apos;quiet&apos;&apos; from the kernel command line
</para>
</listitem>
<listitem>
<para>Add &apos;&apos;rd.shell&apos;&apos; to the kernel command line. This will present a shell should dracut be unable to locate your root device
</para>
</listitem>
<listitem>
<para>Add &apos;&apos;rd.shell rd.debug&apos;&apos; to the kernel command line so that dracut shell commands are printed as they are executed
</para>
</listitem>
<listitem>
<para>With dracut &gt;= 002-11, you can inspect the rd.debug output with:
</para>
<screen># less /run/initramfs/init.log
# dmesg | less</screen>
</listitem>
</orderedlist>
</section>
<section id="information-to-include-in-your-report">
<title id="information-to-include-in-your-report-title">Information to include in your report</title>
<section id="all-bug-reports">
<title id="all-bug-reports-title">All bug reports</title>
<para>In all cases, the following should be mentioned and attached to your bug report:
</para>
<itemizedlist>
<listitem>
<para>The exact kernel command-line used. Typically from the bootloader configuration file (e.g. <filename>/etc/grub.conf</filename>) or from <filename>/proc/cmdline</filename>.</para>
</listitem>
<listitem>
<para>A copy of your disk partition information from <filename>/etc/fstab</filename>, which might be obtained booting an old working initramfs or a rescue medium.</para>
</listitem>
<listitem>
<para>A device listing from device-mapper. This can be obtained by running the command <screen># dmsetup ls --tree</screen></para>
</listitem>
<listitem>
<para>A list of block device attributes including vol_id compatible mode. This can be obtained by running the commands: <screen># blkid -p
# blkid -p -o udev</screen></para>
</listitem>
<listitem>
<para>Turn on dracut debugging (see <filename>the &apos;debugging dracut&apos; section</filename>), and attach all relevant information from the boot log. This can be obtained by running the command <screen># dmesg|grep dracut</screen></para>
</listitem>
<listitem>
<para>If you use a dracut configuration file, please include <filename>/etc/dracut.conf</filename>
and all files in <filename>/etc/dracut.conf.d/*.conf</filename></para>
</listitem>
</itemizedlist>
</section>
<section id="logical-volume-management-related-problems">
<title id="logical-volume-management-related-problems-title">Logical Volume Management related problems</title>
<para>As well as the information from <xref linkend="all-bug-reports"/> include the following information:
</para>
<itemizedlist>
<listitem>
<para>Include physical volume information by running the command: <screen># lvm pvdisplay</screen></para>
</listitem>
<listitem>
<para>Include volume group information by running the command: <screen># lvm vgdisplay</screen></para>
</listitem>
<listitem>
<para>Include logical volume information by running the command: <screen># lvm lvdisplay</screen></para>
</listitem>
</itemizedlist>
</section>
<section id="software-raid-related-problems">
<title id="software-raid-related-problems-title">Software RAID related problems</title>
<para>As well as the information from <xref linkend="all-bug-reports"/>, include the following information:
</para>
<itemizedlist>
<listitem>
<para>If using software RAID disk partitions, please include the output of <screen># cat /proc/mdstat</screen></para>
</listitem>
</itemizedlist>
</section>
<section id="network-root-device-related-problems">
<title id="network-root-device-related-problems-title">Network root device related problems</title>
<para>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 <xref linkend="all-bug-reports"/>, include the following information:
</para>
<itemizedlist>
<listitem>
<para>Please include the output of <screen># /sbin/ifup <replaceable>&lt;interfacename&gt;</replaceable>
# ip addr show</screen></para>
</listitem>
</itemizedlist>
</section>
</section>
<section id="debugging-dracut">
<title id="debugging-dracut-title">Debugging dracut</title>
<section id="configure-a-serial-console">
<title id="configure-a-serial-console-title">Configure a serial console</title>
<para>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.
</para>
<orderedlist>
<listitem>
<para>First, enable serial console output for both the kernel and the bootloader.
</para>
</listitem>
<listitem>
<para>Open the file <filename>/etc/grub.conf</filename> for editing. Below the line &apos;&apos;timeout=5&apos;&apos;, add the following:
<screen>serial --unit=0 --speed=9600
terminal --timeout=5 serial console</screen></para>
</listitem>
<listitem>
<para>Also in <filename>/etc/grub.conf</filename>, add the following boot arguemnts to the &apos;&apos;kernel&apos;&apos; line:
<screen>console=tty0 console=ttyS0,9600</screen></para>
</listitem>
<listitem>
<para>When finished, the <filename>/etc/grub.conf</filename> file should look similar to the example below.
<screen>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</screen></para>
</listitem>
<listitem>
<para>More detailed information on how to configure the kernel for console output can be found at <ulink url="http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL">http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL</ulink>.
</para>
</listitem>
</orderedlist>
<note>
<title>Redirecting non-interactive output</title>
<para>You can redirect all non-interactive output to <filename>/dev/kmsg</filename> and the kernel will put it out on the console when it reaches the kernel buffer by doing<screen># exec &gt;/dev/kmsg 2&gt;&amp;1 &lt;/dev/console</screen></para>
</note>
</section>
<section id="using-the-dracut-shell">
<title id="using-the-dracut-shell-title">Using the dracut shell</title>
<para>Dracut offers a shell for interactive debugging in the event dracut fails to locate your root filesystem. To enable the shell:
<orderedlist>
<listitem>
<para>Add the boot parameter &apos;&apos;rd.shell&apos;&apos; to your bootloader configuration file (e.g. <filename>/etc/grub.conf</filename>)</para>
</listitem>
<listitem>
<para>Remove the boot arguments &apos;&apos;rhgb&apos;&apos; and &apos;&apos;quiet&apos;&apos;
</para>
<para>
A sample <filename>/etc/grub.conf</filename> bootloader configuration file is listed below.
</para>
<para><screen>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</screen></para>
</listitem>
<listitem>
<para>If system boot fails, you will be dropped into a shell as seen in the example below.
<screen>No root device found
Dropping to debug shell.
sh: can&apos;t access tty; job control turned off
# </screen></para>
</listitem>
<listitem>
<para>Use this shell prompt to gather the information requested above (see <xref linkend="all-bug-reports"/>).
</para>
</listitem>
</orderedlist></para>
</section>
<section id="accessing-the-root-volume-from-the-dracut-shell">
<title id="accessing-the-root-volume-from-the-dracut-shell-title">Accessing the root volume from the dracut shell</title>
<para>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:
</para>
<itemizedlist>
<listitem>
<para>A block device (e.g. <filename>/dev/sda7</filename>)
</para>
</listitem>
<listitem>
<para>A LVM logical volume (e.g. <filename>/dev/VolGroup00/LogVol00</filename>)
</para>
</listitem>
<listitem>
<para>An encrypted device (e.g. <filename>/dev/mapper/luks-4d5972ea-901c-4584-bd75-1da802417d83</filename>)
</para>
</listitem>
<listitem>
<para>A network attached device (e.g. netroot=iscsi:@192.168.0.4::3260::iqn.2009-02.org.fedoraproject:for.all)
</para>
</listitem>
</itemizedlist>
<para>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 <filename>/dev/root</filename> 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. </para>
<orderedlist>
<listitem>
<para>Inspect your partitions using <command>parted</command><screen># 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</screen></para>
</listitem>
<listitem>
<para>You recall that your root volume was a LVM logical volume. Scan and activate any logical volumes.
<screen># lvm vgscan
# lvm vgchange -ay</screen></para>
</listitem>
<listitem>
<para>You should see any logical volumes now using the command <command>blkid</command>:
<screen># blkid
/dev/sda1: UUID=&quot;3de247f3-5de4-4a44-afc5-1fe179750cf7&quot; TYPE=&quot;ext4&quot;
/dev/sda2: UUID=&quot;Ek4dQw-cOtq-5MJu-OGRF-xz5k-O2l8-wdDj0I&quot; TYPE=&quot;LVM2_member&quot;
/dev/mapper/linux-root: UUID=&quot;def0269e-424b-4752-acf3-1077bf96ad2c&quot; TYPE=&quot;crypto_LUKS&quot;
/dev/mapper/linux-home: UUID=&quot;c69127c1-f153-4ea2-b58e-4cbfa9257c5e&quot; TYPE=&quot;ext3&quot;
/dev/mapper/linux-swap: UUID=&quot;47b4d329-975c-4c08-b218-f9c9bf3635f1&quot; TYPE=&quot;swap&quot;
</screen></para>
</listitem>
<listitem>
<para>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.
<screen># 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. </screen></para>
</listitem>
<listitem>
<para>Next, make a symbolic link to the unlocked root volume
<screen># ln -s /dev/mapper/luks-$UUID /dev/root</screen></para>
</listitem>
<listitem>
<para>With the root volume available, you may continue booting the system by exiting the dracut shell
<screen># exit</screen></para>
</listitem>
</orderedlist>
</section>
<section id="additional-dracut-boot-parameters">
<title id="additional-dracut-boot-parameters-title">Additional dracut boot parameters</title>
<para>For more debugging options, see <xref linkend="dracut-kernel-debug"/> in the man page <xref linkend="dracutkernel7"/>.</para>
</section>
</section>
</section>
</chapter>
<chapter>
<title>Developer Manual</title>
<section>
<title>dracut Components</title>
<para>dracut uses a modular system to build and extend the initramfs image. All modules are located in <filename>/usr/share/dracut/modules.d</filename> or in <filename><replaceable>&lt;git-src&gt;</replaceable>/modules.d</filename>. The most basic dracut module is <filename>99base</filename>. In <filename>99base</filename> the initial shell script <command>init</command> is defined, which gets run by the kernel after initramfs loading. Although you can replace <command>init</command> with your own version of <filename>99base</filename>, 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 <xref linkend="stages"/>.</para>
<para>The main script, which creates the initramfs is <command>dracut</command> itsself. It parses all arguments and sets up the directory, in which everything is installed. It then executes all <command>check</command>, <command>install</command>, <command>installkernel</command> 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 <command>check</command>, <command>install</command> and <command>installkernel</command> are found in in the file <filename>dracut-functions</filename>. These shell functions are available to all module installer (<command>install</command>, <command>installkernel</command>) scripts, without the need to source <filename>dracut-functions</filename>.</para>
<para>A module can check the preconditions for <command>install</command> and <command>installkernel</command> with the <command>check</command> script. Also dependencies can be expressed with <command>check</command>. If a module passed <command>check</command>, <command>install</command> and <command>installkernel</command> 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 <command>installkernel</command>. All other files found in a module directory are module specific and mostly are hook scripts and udev rules.</para>
</section>
<section id="stages">
<title>Boot Process Stages</title>
<para>The <command>init</command> script in <filename>99base</filename> 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 &quot;.sh&quot;, which are sourced by <command>init</command>.
Common used functions are in <filename>dracut-lib.sh</filename>, which can be sourced by any script. </para>
<section>
<title>Basic Setup</title>
<para>The first thing <command>init</command> does, is to mount <filename>/proc</filename> and <filename>/sys</filename> and manually create the basic device nodes and symbolic links in <filename>/dev</filename> needed to execute basic commands. Then logging is setup according to kernel command line arguments. <filename>/dev/pts</filename> and <filename>/dev/shm</filename> are mounted and the first hook is sourced.</para>
</section>
<section>
<title>Hook: cmdline</title>
<para>The <literal>
<function>cmdline</function>
</literal> 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.</para>
<para>In this hook the most important environment variable is defined: <envar>root</envar>. The second one is <envar>rootok</envar>, which indicates, that a module claimed to be able to parse the <envar>root</envar> defined. So for example, <envar>root=</envar><replaceable>iscsi:....</replaceable> will be claimed by the <function>iscsi</function> dracut module, which then sets <envar>rootok</envar>.</para>
</section>
<section>
<title>Hook: pre-udev</title>
<para>This hook is executed right after the <function>cmdline</function> hook and a check if <envar>root</envar> and <envar>rootok</envar> were set. Here modules can take action with the final <envar>root</envar>, and before <command>udev</command> has been run.</para>
</section>
<section>
<title>Start Udev</title>
<para>Now <command>udev</command> is started and the logging for <command>udev</command> is setup.</para>
</section>
<section>
<title>Hook: pre-trigger</title>
<para>In this hook, you can set udev environment variables with <code>udevadm control --property=<envar>KEY</envar>=<replaceable>value</replaceable></code> or control the further execution of <command>udev</command> with <command>udevadm</command>.</para>
</section>
<section>
<title>Trigger Udev</title>
<para><command>udev</command> is triggered by calling <command>udevadm trigger</command>, which sends <constant>add</constant> events for all devices and subsystems.
</para>
</section>
<section>
<title>Main Loop</title>
<para>Now the main loop of <command>99base/init</command> begins. Here we loop until <command>udev</command> has settled and all scripts in <filename>initqueue-finished</filename> returned true. In this loop there are three hooks, where scripts can be inserted by calling <command>/sbin/initqueue</command>.
</para>
<section>
<title>Initqueue</title>
<para>This hook gets executed every time a script is inserted here, regardless of the <command>udev</command> state.</para>
</section>
<section>
<title>Initqueue settled</title>
<para>This hooks gets executed every time <command>udev</command> has settled.</para>
</section>
<section>
<title>Initqueue finished</title>
<para>This hook is called after <command>udev</command> has settled and if all scripts herein return <errorcode>0</errorcode> the main loop will be ended.</para>
</section>
</section>
<section>
<title>Hook: pre-mount</title>
<para>Before the root device is mounted all scripts in the hook pre-mount are executed. In some cases (e.g. <acronym>NFS</acronym>) the real root device is already mounted, though.</para>
</section>
<section>
<title>Hook: mount</title>
<para>This hook is mainly to mount the real root device.</para>
</section>
<section>
<title>Hook: pre-pivot</title>
<para>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.</para>
</section>
<section>
<title>Cleanup and switch_root</title>
<para>Init kills all <command>udev</command> processes, cleans up the environment, sets up the arguments for the real <command>init</command> process and finally calls <command>switch_root</command>. <command>switch_root</command> removes the whole filesystem hierarchy of the initramfs, chroot()s to the real root device and calls <command>/sbin/init</command> with the specified arguments.</para>
<para>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.</para>
</section>
</section>
<section>
<title>Network Infrastructure</title>
<para>
</para>
</section>
<section>
<title>Writing a Module</title>
<para>A simple example module is <filename>96insmodpost</filename>, which modprobes a kernel module after udev has settled and the basic device drivers have been loaded.</para>
<para>All module installation information is in the file module-setup.sh.</para>
<para>First we create a <function>check()</function> function, which just exits with <errorcode>0</errorcode> indicating that this module should be included by default.</para>
<para><function>check()</function>:</para>
<programlisting>return 0</programlisting>
<para>The we create the <function>install()</function> function, which installs a cmdline hook with priority number 20 called <filename>parse-insmodpost.sh</filename>. It also installs the <filename>insmodpost.sh</filename> script in <filename>/sbin</filename>.</para>
<para><function>install()</function>:</para>
<programlisting>inst_hook cmdline 20 &quot;$moddir/parse-insmodpost.sh&quot;
inst_simple &quot;$moddir/insmodpost.sh&quot; /sbin/insmodpost.sh</programlisting>
<para>The <filename>pase-instmodpost.sh</filename> parses the kernel command line for a argument <envar>rd.driver.post</envar>, blacklists the module from being autoloaded and installs the hook <filename>insmodpost.sh</filename> in the <filename>initqueue-settled</filename>.</para>
<para><filename>parse-insmodpost.sh</filename>:</para>
<programlisting>for p in $(getargs rd.driver.post=); do
echo &quot;blacklist $p&quot; &gt;&gt; /etc/modprobe.d/initramfsblacklist.conf
_do_insmodpost=1
done
[ -n &quot;$_do_insmodpost&quot; ] &amp;&amp; /sbin/initqueue --settled --unique --onetime /sbin/insmodpost.sh
unset _do_insmodpost
</programlisting>
<para><filename>insmodpost.sh</filename>, which is called in the <filename>initqueue-settled</filename> hook will just modprobe the kernel modules specified in all <envar>rd.driver.post</envar> kernel command line parameters. It runs after <command>udev</command> has settled and is only called once (<parameter>--onetime</parameter>).</para>
<para><filename>insmodpost.sh</filename>:</para>
<programlisting>. /lib/dracut-lib.sh
for p in $(getargs rd.driver.post=); do
modprobe $p
done
</programlisting>
<section>
<title>check()</title>
<para><filename>
<function>check()</function>
</filename> is called by dracut to evaluate the inclusion of a dracut module in the initramfs.</para>
<variablelist>
<varlistentry>
<term> $hostonly</term>
<listitem>
<para>If the $hostonly variable is set, then the module check() function should be in &quot;hostonly&quot; mode, which means, that the check() should only return 0, if the module is really needed to boot this specific host.</para>
</listitem>
</varlistentry>
</variablelist>
<para><function>check()</function> should return with:</para>
<variablelist>
<varlistentry>
<term>0</term>
<listitem>
<para>Include the dracut module in the initramfs.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>1</term>
<listitem>
<para>Do not include the dracut module. The requirements are not fullfilled (missing tools, etc.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>255</term>
<listitem>
<para>Only include the dracut module, if another module requires it or if explicitly specified in the config file or on the argument list.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<section>
<title>depends()</title>
<para>The function <function>depends()</function> should <function>echo</function> all other dracut module names the module depends on.</para>
</section>
<section>
<title>install()</title>
<para>dracut_install</para>
<para>inst</para>
<para>inst_hook</para>
<para>inst_rules</para>
<para/>
</section>
<section>
<title>installkernel()</title>
<para>instmods</para>
</section>
<section>
<title>Creation Functions</title>
<para>
</para>
</section>
<section>
<title>Initramfs Functions</title>
<para>
</para>
</section>
<section>
<title>Network Modules</title>
<para>
</para>
</section>
</section>
</chapter>
<appendix>
<title>Man Pages</title>
<section id="dracut.man">
<title>dracut</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dracut.8.xml" encoding="UTF-8" parse="xml"/>
</section>
<section id="dracut.conf">
<title>dracut.conf</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dracut.conf.5.xml" encoding="UTF-8" parse="xml"/>
</section>
<section id="dracut.kernel">
<title>dracut.kernel</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dracut.kernel.7.xml" encoding="UTF-8" parse="xml"/>
</section>
</appendix>
</book>

47
lsinitrd Executable file
View File

@@ -0,0 +1,47 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Copyright 2005-2010 Harald Hoyer <harald@redhat.com>
# Copyright 2005-2010 Red Hat, Inc. All rights reserved.
#
# 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/>.
#
[[ $# -le 2 ]] || { echo "Usage: $(basename $0) [<initramfs file> [<filename>]]" ; exit 1 ; }
image="${1:-/boot/initramfs-$(uname -r).img}"
[[ -f "$image" ]] || { echo "$image does not exist" ; exit 1 ; }
CAT=zcat
FILE_T=$(file "$image")
if [[ "$FILE_T" =~ ": gzip compressed data" ]]; then
CAT=zcat
elif [[ "$FILE_T" =~ ": xz compressed data" ]]; then
CAT=xzcat
elif [[ "$FILE_T" =~ ": data" ]]; then
CAT=lzcat
fi
if [[ $# -eq 2 ]]; then
$CAT $image | cpio --extract --verbose --quiet --to-stdout ${2#/} 2>/dev/null
exit $?
fi
echo "$image:"
echo "========================================================================"
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout 'lib/dracut/dracut-*' 2>/dev/null
echo "========================================================================"
$CAT "$image" | cpio --extract --verbose --quiet --list
echo "========================================================================"

100
mkinitrd-dracut.sh Normal file
View File

@@ -0,0 +1,100 @@
#!/bin/bash --norc
kver=$(uname -r)
error() { echo "$@" >&2; }
usage () {
[[ $1 = '-n' ]] && cmd=echo || cmd=error
$cmd "usage: ${0##*/} [--version] [--help] [-v] [-f] [--preload <module>]"
$cmd " [--image-version] [--with=<module>]"
$cmd " <initrd-image> <kernel-version>"
$cmd ""
$cmd " (ex: ${0##*/} /boot/initramfs-$kver.img $kver)"
[[ $1 = '-n' ]] && exit 0
exit 1
}
# Little helper function for reading args from the commandline.
# it automatically handles -a b and -a=b variants, and returns 1 if
# we need to shift $3.
read_arg() {
# $1 = arg name
# $2 = arg value
# $3 = arg parameter
local rematch='^[^=]*=(.*)$'
if [[ $2 =~ $rematch ]]; then
read "$1" <<< "${BASH_REMATCH[1]}"
elif [[ $3 != -* ]]; then
# Only read next arg if it not an arg itself.
read "$1" <<< "$3"
# There is no way to shift our callers args, so
# return 1 to indicate they should do it instead.
return 1
fi
}
while (($# > 0)); do
case ${1%%=*} in
--with-usb) read_arg usbmodule "$@" || shift
basicmodules="$basicmodules ${usbmodule:-usb-storage}"
unset usbmodule;;
--with-avail) read_arg modname "$@" || shift
basicmodules="$basicmodules $modname";;
--with) read_arg modname "$@" || shift
basicmodules="$basicmodules $modname";;
--version)
echo "mkinitrd: dracut compatibility wrapper"
exit 0;;
-v|--verbose) dracut_args="${dracut_args} -v";;
-f|--force) dracut_args="${dracut_args} -f";;
--preload) read_args modname "$@" || shift
basicmodules="$basicmodules $modname";;
--image-version) img_vers=yes;;
--rootfs) read_args rootfs "$@" || shift
dracut_args="${dracut_args} --filesystems $rootfs";;
--nocompress) dracut_args="$dracut_args --no-compress";;
--help) usage -n;;
--builtin) ;;
--without*) ;;
--without-usb) ;;
--fstab*) ;;
--ifneeded) ;;
--omit-scsi-modules) ;;
--omit-ide-modules) ;;
--omit-raid-modules) ;;
--omit-lvm-modules) ;;
--omit-dmraid) ;;
--allow-missing) ;;
--net-dev*) ;;
--noresume) ;;
--rootdev*) ;;
--thawdev*) ;;
--rootopts*) ;;
--root*) ;;
--loopdev*) ;;
--loopfs*) ;;
--loopopts*) ;;
--looppath*) ;;
--dsdt*) ;;
--bootchart) ;;
*) if [[ ! $target ]]; then
target=$1
elif [[ ! $kernel ]]; then
kernel=$1
else
usage
fi;;
esac
shift
done
[[ $target && $kernel ]] || usage
[[ $img_vers ]] && target="$target-$kernel"
if [[ $basicmodules ]]; then
dracut $dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
else
dracut $dracut_args "$target" "$kernel"
fi

View File

@@ -0,0 +1,30 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
[ -x /sbin/bootchartd ] || return 1
return 255
}
depends() {
return 0
}
install() {
inst /sbin/bootchartd
inst /bin/bash
inst_symlink /init /sbin/init
inst_dir /lib/bootchart/tmpfs
inst /lib/bootchart/bootchart-collector
inst /etc/bootchartd.conf
inst /sbin/accton
inst /usr/bin/pkill /bin/pkill
inst /bin/echo
inst /bin/grep
inst /bin/usleep
inst /usr/bin/[ /bin/[
mknod -m 0666 "${initdir}/dev/null" c 1 3
}

View File

@@ -1,2 +0,0 @@
#!/bin/sh
[ -x /bin/dash ]

View File

@@ -1,6 +0,0 @@
#!/bin/bash
# If another shell is already installed, do not use dash
[ -x "${initdir}/bin/sh" ] && return
# Prefer dash as /bin/sh if it is available.
inst /bin/dash && ln -sf dash "${initdir}/bin/sh"

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() {
[ -x /bin/dash ]
}
depends() {
return 0
}
install() {
# If another shell is already installed, do not use dash
[[ -x $initdir/bin/sh ]] && return
# Prefer dash as /bin/sh if it is available.
inst /bin/dash && ln -sf dash "${initdir}/bin/sh"
}

72
modules.d/01fips/fips.sh Executable file
View File

@@ -0,0 +1,72 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
do_fips()
{
FIPSMODULES=$(cat /etc/fipsmodules)
boot=$(getarg boot=)
KERNEL=$(uname -r)
case "$boot" in
LABEL=*)
boot="$(echo $boot | sed 's,/,\\x2f,g')"
boot="/dev/disk/by-label/${boot#LABEL=}"
;;
UUID=*)
boot="/dev/disk/by-uuid/${boot#UUID=}"
;;
/dev/*)
;;
*)
die "You have to specify boot=<boot device> as a boot option for fips=1" ;;
esac
if ! [ -e "$boot" ]; then
udevadm trigger --action=add >/dev/null 2>&1
[ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
if [ $UDEVVERSION -ge 143 ]; then
udevadm settle --exit-if-exists=$boot
else
udevadm settle --timeout=30
fi
fi
[ -e "$boot" ]
mkdir /boot
info "Mounting $boot as /boot"
mount -oro "$boot" /boot
info "Checking integrity of kernel"
if ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
warn "/boot/.vmlinuz-${KERNEL}.hmac does not exist"
return 1
fi
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
info "Umounting /boot"
umount /boot
info "Loading and integrity checking all crypto modules"
for module in $FIPSMODULES; do
if [ "$module" != "tcrypt" ]; then
modprobe ${module} || return 1
fi
done
info "Self testing crypto algorithms"
modprobe tcrypt || return 1
rmmod tcrypt
info "All initrd crypto checks done"
return 0
}
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
else
set -e
do_fips || die "FIPS integrity test failed"
set +e
fi

View File

@@ -0,0 +1,41 @@
#!/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() {
FIPSMODULES="aead aes_generici aes-xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr"
FIPSMODULES="$FIPSMODULES des deflate ecb eseqiv hmac seqiv sha256 sha512"
FIPSMODULES="$FIPSMODULES cryptomgr crypto_null tcrypt"
mkdir -p "${initdir}/etc/modprobe.d"
for mod in $FIPSMODULES; do
if instmods $mod; then
echo $mod >> "${initdir}/etc/fipsmodules"
echo "blacklist $mod" >> "${initdir}/etc/modprobe.d/fips.conf"
fi
done
}
install() {
inst_hook pre-trigger 01 "$moddir/fips.sh"
dracut_install sha512hmac rmmod insmod mount uname umount
for dir in "$usrlibdir" "$libdir"; do
[[ -e $dir/libsoftokn3.so ]] && \
dracut_install $dir/libsoftokn3.so $dir/libsoftokn3.chk \
$dir/libfreebl3.so $dir/libfreebl3.chk && \
break
done
dracut_install $usrlibdir/hmaccalc/sha512hmac.hmac
}

33
modules.d/02caps/README Normal file
View File

@@ -0,0 +1,33 @@
This adds the following parameters:
rd.caps=1
turn the caps module on/off
rd.caps.initdrop=cap_sys_module,cap_sys_rawio
drop the specified comma seperated capabilities
rd.caps.disablemodules=1
turn off module loading
rd.caps.disablekexec=1
turn off the kexec functionality
If module loading is turned off, all modules have to be loaded in the
initramfs, which are used later on. This can be done with
"rd.driver.pre="
rd.driver.pre=autofs4,sunrpc,ipt_REJECT,nf_conntrack_ipv4,....
Because the kernel command line would get huge with all those drivers, I
recommend to make use of $initramfs/etc/cmdline.
So, all rd.caps.* and rd.driver.pre arguments are in caps.conf can be
copied to $initramfs/etc/cmdline with "-i caps.conf /etc/cmdline".
Also all modules have to be loaded in the initramfs via "--add-drivers".
The resulting initramfs creation would look like this:
--add-drivers "autofs4 sunrpc ipt_REJECT nf_conntrack_ipv4 \
nf_defrag_ipv4 iptable_filter ip_tables
ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack
ip6table_filter ip6_tables dm_mirror dm_region_hash dm_log uinput ppdev
parport_pc parport ipv6 sg 8139too 8139cp mii i2c_piix4 i2c_core ext3
jbd mbcache sd_mod crc_t10dif sr_mod cdrom ata_generic pata_acpi ata_piix
dm_mod" \
/boot/initramfs-caps.img

36
modules.d/02caps/caps.sh Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
capsmode=$(getarg rd.caps)
if [ "$capsmode" = "1" ]; then
CAPS_INIT_DROP=$(getarg rd.caps.initdrop=)
CAPS_USERMODEHELPER_BSET=$(capsh --drop="$CAPS_INIT_DROP" -- -c 'while read a b ; do [ "$a" = "CapBnd:" ] && echo $((0x${b:$((${#b}-8)):8})) $((0x${b:$((${#b}-16)):8})) && break; done < /proc/self/status')
CAPS_MODULES_DISABLED=$(getarg rd.caps.disablemodules=)
CAPS_KEXEC_DISABLED=$(getarg rd.caps.disablekexec=)
info "Loading CAPS_MODULES $CAPS_MODULES"
for i in $CAPS_MODULES;do modprobe $i 2>&1 >/dev/null | vinfo; done
if [ "$CAPS_MODULES_DISABLED" = "1" -a -e /proc/sys/kernel/modules_disabled ]; then
info "Disabling module loading."
echo $CAPS_MODULES_DISABLED > /proc/sys/kernel/modules_disabled
fi
if [ "$CAPS_KEXEC_DISABLED" = "1" -a -e /proc/sys/kernel/kexec_disabled ]; then
info "Disabling kexec."
echo $CAPS_KEXEC_DISABLED > /proc/sys/kernel/kexec_disabled
fi
info "CAPS_USERMODEHELPER_BSET=$CAPS_USERMODEHELPER_BSET"
if [ -e /proc/sys/kernel/usermodehelper/bset ]; then
info "Setting usermode helper bounding set."
echo $CAPS_USERMODEHELPER_BSET > /proc/sys/kernel/usermodehelper/bset
echo $CAPS_USERMODEHELPER_BSET > /proc/sys/kernel/usermodehelper/inheritable
fi
echo "CAPS_INIT_DROP=\"$CAPS_INIT_DROP\"" > /etc/capsdrop
info "Will drop capabilities $CAPS_INIT_DROP from init."
fi

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() {
type -P capsh >/dev/null 2>&1
}
depends() {
return 0
}
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 && ln -sf bash "${initdir}/bin/sh"
}

View File

@@ -0,0 +1,31 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
type -P busybox >/dev/null || return 1
return 255
}
depends() {
return 0
}
install() {
inst busybox /sbin/busybox
# List of shell programs that we use in other official dracut modules, that
# must be supported by the busybox installed on the host system
progs="echo grep usleep [ rmmod insmod mount uname umount setfont kbd_mode stty gzip bzip2 chvt readlink blkid dd losetup tr sed seq ps more cat rm free ping netstat vi ping6 fsck ip hostname basename mknod mkdir pidof sleep chroot ls cp mv dmesg mkfifo less ln modprobe"
# FIXME: switch_root should be in the above list, but busybox version hangs
# (using busybox-1.15.1-7.fc14.i686 at the time of writing)
for i in $progs; do
path=$(find_binary "$i")
ln -s /sbin/busybox "$initdir/$path"
done
}

View File

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

122
modules.d/10i18n/README Normal file
View File

@@ -0,0 +1,122 @@
Dracut i18n module
------------------
INDEX
0. Introduction
1. Hostonly vs Generic
2. Configuration
2.1. Variables
2.2. Setting up mappings
2.3. Additional settings
3. Kernel parameters
~
0. Introduction
i18n module provides internationalization for initramfs at runtime. It
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
create those for his/her distribution and it's appreciated to share it
with us, so we can include it in source package.
1. Hostonly vs Generic
If you invoke dracut with '-H' option, i18n module install script will
gather variables values from your configuration files using mappings
provided in "/etc/dracut.conf.d/<foo>.conf". Those variables will be
put in "etc/vconsole.conf" and "etc/locale.conf" files inside initramfs
image. Next it will install only declared font, keymaps and so.
When building generic image (dracut without '-H' option), install script
copies all content of directories: consolefonts, consoletrans, unimaps
and keymaps to image. Take into account that's about 4 MiB.
2. Configuration
2.1. Variables
The following variables are used by i18n install script and at initramfs
runtime:
KEYMAP - keyboard translation table loaded by loadkeys
EXT_KEYMAPS - list of extra keymaps to bo loaded (sep. by space)
UNICODE - boolean, indicating UTF-8 mode
FONT - console font
FONT_MAP - see description of '-m' parameter in setfont manual
FONT_UNIMAP - see description of '-u' parameter in setfont manual
The following are appended to EXT_KEYMAPS only during build time:
UNIKEYMAP
GRP_TOGGLE
They were used in 10redhat-i18n module, but not sure of its purpose.
I'm leaving it in case... The following are taken from the environment:
LANG
LC_ALL
If UNICODE variable is not provided, script indicates if UTF-8 should be
used on the basis of LANG value (if it ends with ".utf8" or similar).
2.2. Setting up mappings
Mappings between variables listed in 2.1. and the ones spread around
your system are set up in /etc/dracut.conf.d/<foo>.conf. You need to
assign mappings to i18n_vars. Here's an example:
i18n_vars="/etc/conf.d/keymaps:KEYMAP,EXTENDED_KEYMAPS-EXT_KEYMAPS /etc/conf.d/consolefont:CONSOLEFONT-FONT,CONSOLETRANSLATION-FONT_MAP /etc/rc.conf:UNICODE"
First we've got name of file in host file system tree. After colon
there's mapping: <from>-<to>. If both variables have the same name you
can enter just a single, but it's important to specify it! The module
will source only variables you've listed.
Below there's detailed description in BNF:
<list> ::= <element> | <element> " " <list>
<element> ::= <conf-file-name> ":" <map-list>
<map-list> ::= <mapping> | <mapping> "," <map-list>
<mapping> ::= <src-var> "-" <dst-var> | <src-var>
We assume no whitespace are allowed between symbols.
<conf-file-name> is a file holding <src-var> in your system.
<src-var> is a variable holding value of meaning the same as <dst-var>.
<dst-var> is a variable which will be set up inside initramfs.
If <dst-var> has the same name as <src-var> we can omit <dst-var>.
Example:
/etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
<list> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
<element> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
<conf-file-name> = /etc/conf.d/keymaps
<map-list> = KEYMAP,extended_keymaps-EXT_KEYMAPS
<mapping> = KEYMAP
<src-var> = KEYMAP
<mapping> = extended_keymaps-EXT_KEYMAPS
<src-var> = extended_keymaps
<dst-var> = EXT_KEYMAPS
2.3. Additional settings
If you encounter following error message: "Directories consolefonts,
consoletrans, keymaps, unimaps not found.", you can provide path where
those directories lie in your system by setting kbddir in configuration
file (the same where you put mappings).
3. Kernel parameters
If you create generic initramfs you can set up i18n by kernel
parameters using variables listed in 2.1. (except of UNIKEYMAP
and GRP_TOGGLE) The recommended minimum is: FONT and KEYMAP.

91
modules.d/10i18n/console_init Executable file
View File

@@ -0,0 +1,91 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
[ -e /etc/vconsole.conf ] && . /etc/vconsole.conf
DEFAULT_FONT=LatArCyrHeb-16
DEFAULT_KEYMAP=/etc/sysconfig/console/default.kmap
set_keyboard() {
local param
[ "${UNICODE}" = 1 ] && param=-u || param=-a
kbd_mode ${param}
}
set_terminal() {
local dev=$1
if [ "${UNICODE}" = 1 ]; then
printf '\033%%G' >&7
stty -F ${dev} iutf8
else
printf '\033%%@' >&7
fi
}
set_keymap() {
local utf_switch
if [ -z "${KEYMAP}" ]; then
[ -f "${DEFAULT_KEYMAP}" ] && KEYMAP=${DEFAULT_KEYMAP}
fi
[ -n "${KEYMAP}" ] || return 1
[ "${UNICODE}" = 1 ] && utf_switch=-u
loadkeys -q ${utf_switch} ${KEYMAP} ${EXT_KEYMAPS}
}
set_font() {
local dev=$1; local trans=''; local uni=''
[ -z "${FONT}" ] && FONT=${DEFAULT_FONT}
[ -n "${FONT_MAP}" ] && trans="-m ${FONT_MAP}"
[ -n "${FONT_UNIMAP}" ] && uni="-u ${FONT_UNIMAP}"
setfont ${FONT} -C ${dev} ${trans} ${uni}
}
dev_close() {
exec 6>&-
exec 7>&-
}
dev_open() {
local dev=$1
exec 6<${dev} && \
exec 7>>${dev}
}
dev=/dev/${1#/dev/}
devname=${dev#/dev/}
[ -c "${dev}" ] || {
echo "Usage: $0 device" >&2
exit 1
}
[ -e /tmp/console_init.${devname} ] && exit 0
dev_open ${dev}
for fd in 6 7; do
if ! [ -t ${fd} ]; then
echo "ERROR: File descriptor not opened: ${fd}" >&2
dev_close
exit 1
fi
done
set_keyboard
set_terminal ${dev}
set_font ${dev}
set_keymap
dev_close
>/tmp/console_init.${devname}

214
modules.d/10i18n/module-setup.sh Executable file
View File

@@ -0,0 +1,214 @@
#!/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 0
}
depends() {
return 0
}
install() {
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
DEFAULT_FONT=LatArCyrHeb-16
I18N_CONF="/etc/locale.conf"
VCONFIG_CONF="/etc/vconsole.conf"
# This is from 10redhat-i18n.
findkeymap () {
local MAP=$1
[[ ! -f $MAP ]] && \
MAP=$(find ${kbddir}/keymaps -type f -name $MAP -o -name $MAP.\* | head -n1)
[[ " $KEYMAPS " = *" $MAP "* ]] && return
KEYMAPS="$KEYMAPS $MAP"
case $MAP in
*.gz) cmd=zgrep;;
*.bz2) cmd=bzgrep;;
*) cmd=grep ;;
esac
for INCL in $($cmd "^include " $MAP | cut -d' ' -f2 | tr -d '"'); do
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
findkeymap $FN
done
done
}
# Function gathers variables from distributed files among the tree, maps to
# specified names and prints the result in format "new-name=value".
#
# $@ = list in format specified below (BNF notation)
#
# <list> ::= <element> | <element> " " <list>
# <element> ::= <conf-file-name> ":" <map-list>
# <map-list> ::= <mapping> | <mapping> "," <map-list>
# <mapping> ::= <src-var> "-" <dst-var> | <src-var>
#
# We assume no whitespace are allowed between symbols.
# <conf-file-name> is a file holding <src-var> in your system.
# <src-var> is a variable holding value of meaning the same as <dst-var>.
# <dst-var> is a variable which will be set up inside initramfs.
# If <dst-var> has the same name as <src-var> we can omit <dst-var>.
#
# Example:
# /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
# <list> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
# <element> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
# <conf-file-name> = /etc/conf.d/keymaps
# <map-list> = KEYMAP,extended_keymaps-EXT_KEYMAPS
# <mapping> = KEYMAP
# <src-var> = KEYMAP
# <mapping> = extended_keymaps-EXT_KEYMAPS
# <src-var> = extended_keymaps
# <dst-var> = EXT_KEYMAPS
gather_vars() {
local item map value
for item in $@
do
item=(${item/:/ })
for map in ${item[1]//,/ }
do
map=(${map//-/ })
value=$(grep "^${map[0]}=" "${item[0]}")
value=${value#*=}
echo "${map[1]:-${map[0]}}=${value}"
done
done
}
install_base() {
dracut_install setfont loadkeys kbd_mode stty
inst ${moddir}/console_init /lib/udev/console_init
inst_rules ${moddir}/10-console.rules
inst_hook cmdline 20 "${moddir}/parse-i18n.sh"
}
install_all_kbd() {
local rel f
for f in $(eval find ${kbddir}/{${KBDSUBDIRS}} -type f -print)
do
inst $f
done
# remove unnecessary files
rm -f "${initdir}${kbddir}/consoletrans/utflist"
find "${initdir}${kbddir}/" -name README\* -delete
dracut_install gzip bzip2
}
install_local_i18n() {
local map
eval $(gather_vars ${i18n_vars})
[ -f $I18N_CONF ] && . $I18N_CONF
[ -f $VCONFIG_CONF ] && . $VCONFIG_CONF
# Gentoo user may have KEYMAP set to something like "-u pl2",
KEYMAP=${KEYMAP#-* }
# I'm not sure of the purpose of UNIKEYMAP and GRP_TOGGLE. They were in
# original redhat-i18n module. Anyway it won't hurt.
EXT_KEYMAPS+=\ ${UNIKEYMAP}\ ${GRP_TOGGLE}
[[ ${KEYMAP} ]] || {
derror 'No KEYMAP.'
return 1
}
findkeymap ${KEYMAP}
for map in ${EXT_KEYMAPS}
do
ddebug "Adding extra map: ${map}"
findkeymap ${map}
done
inst_opt_decompress ${KEYMAPS}
inst_opt_decompress ${kbddir}/consolefonts/${DEFAULT_FONT}.*
if [[ ${FONT} ]]
then
FONT=${FONT%.psf*}
inst_opt_decompress ${kbddir}/consolefonts/${FONT}.*
fi
if [[ ${FONT_MAP} ]]
then
FONT_MAP=${FONT_MAP%.trans}
inst ${kbddir}/consoletrans/${FONT_MAP}.trans
fi
if [[ ${FONT_UNIMAP} ]]
then
FONT_UNIMAP=${FONT_UNIMAP%.uni}
inst ${kbddir}/unimaps/${FONT_UNIMAP}.uni
fi
if [[ ${UNICODE} ]]
then
if [[ ${UNICODE^^} = YES || ${UNICODE} = 1 ]]
then
UNICODE=1
elif [[ ${UNICODE^^} = NO || ${UNICODE} = 0 ]]
then
UNICODE=0
else
UNICODE=''
fi
fi
if [[ ! ${UNICODE} && ${LANG^^} =~ .*\.UTF-?8 ]]
then
UNICODE=1
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}
return 0
}
checks() {
for kbddir in ${kbddir} /usr/lib/kbd /lib/kbd /usr/share /usr/share/kbd
do
[[ -d "${kbddir}" ]] && \
for dir in ${KBDSUBDIRS//,/ }
do
[[ -d "${kbddir}/${dir}" ]] && continue
false
done && break
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 ' \
'configuration file.'
}
return 0
}
if checks
then
install_base
if [[ ${hostonly} ]]
then
install_local_i18n || install_all_kbd
else
install_all_kbd
fi
fi
}

37
modules.d/10i18n/parse-i18n.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
inst_key_val() {
local _value
local _file
local _default
_default=$1
shift
_file=$1
shift
_value=$(getarg $@)
[ -z "${_value}" ] && _value=$_default
if [ -n "${_value}" ]; then
printf '%s="%s"\n' $1 ${_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/locale.conf LANG locale.LANG
inst_key_val '' /etc/locale.conf LC_ALL locale.LC_ALL
if [ -f /etc/locale.conf ]; then
. /etc/locale.conf
export LANG
export LC_ALL
fi

View File

@@ -1,2 +0,0 @@
#!/bin/sh
[ -f /etc/redhat-release ]

View File

@@ -1,88 +0,0 @@
#!/bin/bash
findkeymap () {
local MAP=$1
[[ ! -f $MAP ]] && \
MAP=$(find /lib/kbd/keymaps -type f -name $MAP -o -name $MAP.\* | head -n1)
[[ " $KEYMAPS " = *" $MAP "* ]] && return
KEYMAPS="$KEYMAPS $MAP"
case $MAP in
*.gz) cmd=zgrep;;
*.bz2) cmd=bzgrep;;
*) cmd=grep ;;
esac
for INCL in $($cmd "^include " $MAP | cut -d' ' -f2 | tr -d '"'); do
for FN in $(find /lib/kbd/keymaps -type f -name $INCL\*); do
findkeymap $FN
done
done
}
install_local()
{
# FIXME: i18n stuff isn't really distro-independent :/
if [[ -f /etc/sysconfig/keyboard || -f /etc/sysconfig/console/default.kmap ]]; then
if [ -f /etc/sysconfig/console/default.kmap ]; then
KEYMAP=/etc/sysconfig/console/default.kmap
else
. /etc/sysconfig/keyboard
[[ $KEYTABLE && -d /lib/kbd/keymaps ]] && KEYMAP="$KEYTABLE.map"
fi
if [[ $KEYMAP ]]; then
[ -f /etc/sysconfig/keyboard ] && inst /etc/sysconfig/keyboard
inst loadkeys
findkeymap $KEYMAP
for FN in $KEYMAPS; do
if [ -L $FN ]; then
TARGET=$(readlink -f $FN)
TG=$(echo $TARGET | sed -e 's/\.gz$//' -e 's/\.bz2$//')
LN=$(echo $FN | sed -e 's/\.gz$//' -e 's/\.bz2$//')
mkdir -p "$initdir/$(dirname $LN)"
ln -s "$TG" "$initdir/$LN"
FN=$TARGET
fi
inst $FN
case $FN in
*.gz) gzip -d "$initdir$FN" ;;
*.bz2) bzip2 -d "$initdir$FN" ;;
esac
done
fi
fi
if [ -f /etc/sysconfig/i18n ]; then
. /etc/sysconfig/i18n
inst /etc/sysconfig/i18n
[[ $SYSFONT ]] || SYSFONT=latarcyrheb-sun16
inst setfont
for FN in /lib/kbd/consolefonts/$SYSFONT.* ; do
inst "$FN"
case $FN in
*.gz) gzip -d "$initdir$FN" ;;
*.bz2) bzip2 -d "$initdir$FN" ;;
esac
done
[[ $SYSFONTACM ]] && inst /lib/kbd/consoletrans/$SYSFONTACM
[[ $UNIMAP ]] && inst /lib/kbd/unimaps/$UNIMAP
fi
}
if [[ $hostonly ]]; then
install_local
else
for i in $(find /lib/kbd -type f -print); do
dracut_install $i
done
# remove unnecessary files
rm -f "$initdir/lib/kbd/consoletrans/utflist" 2>/dev/null
find "$initdir/lib/kbd/" -name README\* -exec rm -f '{}' \;
dracut_install gzip bzip2
fi
dracut_install /lib/udev/console_init
dracut_install setfont loadkeys
inst_rules 10-console.rules
inst_hook cmdline 20 "$moddir/parse-i18n.sh"

View File

@@ -1,21 +0,0 @@
inst_key_val()
{
local value
value=$(getarg $1)
[ -n "$value" ] && printf '%s="%s"\n' $1 $value >> $2
initrdargs="$initrdargs $1"
}
mkdir -p /etc/sysconfig
inst_key_val KEYBOARDTYPE /etc/sysconfig/keyboard
inst_key_val KEYTABLE /etc/sysconfig/keyboard
inst_key_val SYSFONT /etc/sysconfig/i18n
inst_key_val SYSFONTACM /etc/sysconfig/i18n
inst_key_val UNIMAP /etc/sysconfig/i18n
inst_key_val LANG /etc/sysconfig/i18n
if [ -f /etc/sysconfig/i18n ]; then
. /etc/sysconfig/i18n
export LANG
fi

View File

@@ -1,3 +0,0 @@
#!/bin/sh
[ -f /etc/redhat-release ]

View File

@@ -1,8 +0,0 @@
dracut_rpm_version=$(rpm -qf --qf '%{name}-%{version}-%{release}' $(which $0))
if [ $? -eq 0 ]; then
echo $dracut_rpm_version > $initdir/$dracut_rpm_version
fi
inst_hook cmdline 01 "$moddir/version.sh"

View File

@@ -0,0 +1,27 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
[ -f /etc/redhat-release ]
}
depends() {
return 0
}
install() {
if [ -e "$moddir/dracut-version" ]; then
dracut_rpm_version=$(cat "$moddir/dracut-version")
inst "$moddir/dracut-version" /lib/dracut/$dracut_rpm_version
else
if rpm -qf $(type -P $0) &>/dev/null; then
dracut_rpm_version=$(rpm -qf --qf '%{name}-%{version}-%{release}\n' $(type -P $0) | { ver="";while read line;do ver=$line;done;echo $ver;} )
mkdir -m 0755 -p $initdir/lib $initdir/lib/dracut
echo $dracut_rpm_version > $initdir/lib/dracut/$dracut_rpm_version
fi
fi
inst_hook cmdline 01 "$moddir/version.sh"
}

5
modules.d/10rpmversion/version.sh Normal file → Executable file
View File

@@ -1,4 +1,7 @@
for i in dracut-*; do
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
for i in lib/dracut/dracut-*; do
if [ -f $i ]; then
vinfo < $i
fi

View File

@@ -1,19 +0,0 @@
#!/bin/bash
. $dracutfunctions
for program in ip hostname; do
which $program >/dev/null 2>&1
if [ $? -ne 0 ]; then
dwarning "Could not find program \"$program\" required by network."
exit 1
fi
done
for program in dhclient brctl; do
which $program >/dev/null 2>&1
if [ $? -ne 0 ]; then
dwarning "Could not find program \"$program\" it might be required by network."
fi
done
exit 255

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
setup_interface() {
ip=$new_ip_address
@@ -13,35 +15,40 @@ setup_interface() {
[ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
if [ -n "$mtu" ] ; then
echo ip link set $netif down
echo ip link set $netif mtu $mtu
echo ip link set $netif up
# Taken from debian dhclient-script:
# The 576 MTU is only used for X.25 and dialup connections
# where the admin wants low latency. Such a low MTU can cause
# problems with UDP traffic, among other things. As such,
# disallow MTUs from 576 and below by default, so that broken
# MTUs are ignored, but higher stuff is allowed (1492, 1500, etc).
if [ -n "$mtu" ] && [ $mtu -gt 576 ] ; then
echo "if ! ip link set $netif mtu $mtu ; then"
echo "ip link set $netif down"
echo "ip link set $netif mtu $mtu"
echo "ip link set $netif up"
echo wait_for_if_up $netif
echo "fi"
fi > /tmp/net.$netif.up
echo ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif >> /tmp/net.$netif.up
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/resolv.conf
[ -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/resolv.conf
for s in $namesrv; do
echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf
[ -n "$hostname" ] && echo hostname $hostname > /tmp/net.$netif.hostname
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
}
PATH=$PATH:/sbin:/usr/sbin
. /lib/dracut-lib.sh
if getarg rdnetdebug ; then
exec >/tmp/dhclient.$interface.$$.out
exec 2>>/tmp/dhclient.$interface.$$.out
set -x
fi
export PS4="dhclient.$interface.$$ + "
exec >>/run/initramfs/initlog.pipe 2>>/run/initramfs/initlog.pipe
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
# We already need a set netif here
netif=$interface
@@ -51,17 +58,25 @@ netif=$interface
case $reason in
PREINIT)
ip link set $netif up
;;
echo "dhcp: PREINIT $netif up"
ip link set $netif up
wait_for_if_up $netif
;;
BOUND)
setup_interface
set | while read line; do
[ "${line#new_}" = "$line" ] && continue
echo "$line"
done >/tmp/dhclient.$netif.dhcpopts
echo online > /sys/class/net/$netif/uevent
;;
*) ;;
echo "dhcp: BOND setting $netif"
if ! arping -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
setup_interface
set | while read line; do
[ "${line#new_}" = "$line" ] && continue
echo "$line"
done >/tmp/dhclient.$netif.dhcpopts
echo online > /sys/class/net/$netif/uevent
/sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
;;
*) echo "dhcp: $reason";;
esac
exit 0

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# Don't continue if root is ok
[ -n "$rootok" ] && return
@@ -7,14 +9,17 @@
[ -z "$root" ] && root=$(getarg root=)
[ -z "$netroot" ] && netroot=$(getarg netroot=)
if [ "$root" = "dhcp" ] || [ "$netroot" = "dhcp" ] ; then
if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] ; then
# Tell ip= checker that we need dhcp
NEEDDHCP="1"
# Done, all good!
rootok=1
netroot=dhcp
if [ "$netroot" != "dhcp" ] ; then
netroot=$root
fi
# Shut up init error check
[ -z "$root" ] && root="dhcp"
echo '[ -d $NEWROOT/proc -o -e /dev/root ]' > $hookdir/initqueue/finished/dhcp.sh
fi

View File

@@ -0,0 +1,21 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# if there are no ifname parameters, just use NAME=KERNEL
if ! getarg ifname= >/dev/null ; then
return
fi
{
for p in $(getargs ifname=); do
parse_ifname_opts $p
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if"
done
# Rename non named interfaces out of the way for named ones.
for p in $(getargs ifname=); do
parse_ifname_opts $p
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="?*", ATTR{type}=="1", NAME!="?*", KERNEL=="%s", NAME="%%k-renamed"\n' "$ifname_if"
done
} > /etc/udev/rules.d/50-ifname.rules

View File

@@ -1,58 +1,90 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# We don't need to check for ip= errors here, that is handled by the
# cmdline parser script
#
PATH=$PATH:/sbin:/usr/sbin
# Sadly there's no easy way to split ':' separated lines into variables
ip_to_var() {
local v=${1}:
set --
while [ -n "$v" ]; do
set -- "$@" "${v%%:*}"
v=${v#*:}
done
unset ip srv gw mask hostname dev autoconf
case $# in
0) autoconf="error" ;;
1) autoconf=$1 ;;
2) dev=$1; autoconf=$2 ;;
*) ip=$1; srv=$2; gw=$3; mask=$4; hostname=$5; dev=$6; autoconf=$7 ;;
esac
}
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
# Run dhclient
do_dhcp() {
# /sbin/dhclient-script will mark the netif up and generate the online
# event for nfsroot
# XXX add -V vendor class and option parsing per kernel
dhclient -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif
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"
}
load_ipv6() {
modprobe ipv6
i=0
while [ ! -d /proc/sys/net/ipv6 ]; do
i=$(($i+1))
[ $i -gt 10 ] && break
sleep 0.1
done
}
do_ipv6auto() {
load_ipv6
{
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
echo ip link set $netif up
echo wait_for_if_up $netif
} > /tmp/net.$netif.up
[ -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
echo online > /sys/class/net/$netif/uevent
/sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
}
# Handle static ip configuration
do_static() {
{
echo ip link set $netif up
echo ip addr flush dev $netif
echo ip addr add $ip/$mask dev $netif
strstr $ip '*:*:*' && load_ipv6
{
echo ip link set $netif up
echo wait_for_if_up $netif
# do not flush addr for ipv6
strstr $ip '*:*:*' || \
echo ip addr flush dev $netif
echo ip addr add $ip/$mask dev $netif
} > /tmp/net.$netif.up
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
[ -n "$hostname" ] && echo hostname $hostname > /tmp/net.$netif.hostname
[ -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
echo online > /sys/class/net/$netif/uevent
/sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
}
PATH=$PATH:/sbin:/usr/sbin
. /lib/dracut-lib.sh
if getarg rdnetdebug ; then
exec >/tmp/ifup.$1.$$.out
exec 2>>/tmp/ifup.$1.$$.out
set -x
fi
export PS4="ifup.$1.$$ + "
exec >>/run/initramfs/initlog.pipe 2>>/run/initramfs/initlog.pipe
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
# Huh? No $1?
[ -z "$1" ] && exit 1
@@ -60,11 +92,25 @@ fi
# $netif reads easier than $1
netif=$1
# enslave this interface to bond?
if [ -e /tmp/bond.info ]; then
. /tmp/bond.info
for slave in $bondslaves ; do
if [ "$netif" = "$slave" ] ; then
netif=$bondname
fi
done
fi
# bridge this interface?
if [ -e /tmp/bridge.info ]; then
. /tmp/bridge.info
if [ "$netif" = "$ethname" ]; then
netif="$bridgename"
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
: # We need to really setup bond (recursive call)
else
netif="$bridgename"
fi
fi
fi
@@ -83,11 +129,63 @@ if [ "$netif" = "lo" ] ; then
exit 0
fi
# start bond if needed
if [ -e /tmp/bond.info ]; then
. /tmp/bond.info
if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.up ] ; then # We are master bond device
modprobe bonding
ip link set $netif down
# Stolen from ifup-eth
# add the bits to setup driver parameters here
for arg in $bondoptions ; do
key=${arg%%=*};
value=${arg##*=};
# %{value:0:1} is replaced with non-bash specific construct
if [ "${key}" = "arp_ip_target" -a "${#value}" != "0" -a "+${value%%+*}" != "+" ]; then
OLDIFS=$IFS;
IFS=',';
for arp_ip in $value; do
echo +$arp_ip > /sys/class/net/${netif}/bonding/$key
done
IFS=$OLDIFS;
else
echo $value > /sys/class/net/${netif}/bonding/$key
fi
done
ip link set $netif up
for slave in $bondslaves ; do
ip link set $slave down
ifenslave $bondname $slave
ip link set $slave up
wait_for_if_up $slave
done
# add the bits to setup the needed post enslavement parameters
for arg in $BONDING_OPTS ; do
key=${arg%%=*};
value=${arg##*=};
if [ "${key}" = "primary" ]; then
echo $value > /sys/class/net/${netif}/bonding/$key
fi
done
fi
fi
# XXX need error handling like dhclient-script
# start bridge if necessary
if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
ip link set $ethname up
if [ "$ethname" = "$bondname" ] ; then
DO_BOND_SETUP=yes /sbin/ifup $bondname
else
ip link set $ethname up
fi
wait_for_if_up $ethname
# Create bridge and add eth to bridge
brctl addbr $bridgename
brctl setfd $bridgename 0
@@ -96,25 +194,41 @@ fi
# No ip lines default to dhcp
ip=$(getarg ip)
[ -z "$ip" ] && do_dhcp;
if [ -z "$ip" ]; then
if [ "$netroot" = "dhcp6" ]; then
do_dhcp -6
else
do_dhcp -4
fi
fi
# Specific configuration, spin through the kernel command line
# looking for ip= lines
for p in $(getargs ip=); do
ip_to_var $p
# skip ibft
[ "$autoconf" = "ibft" ] && continue
# If this option isn't directed at our interface, skip it
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
# Store config for later use
for i in ip srv gw mask hostname; do
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
done > /tmp/net.$netif.override
case $autoconf in
dhcp|on|any) do_dhcp ;;
*) do_static ;;
dhcp|on|any)
do_dhcp -4 ;;
dhcp6)
do_dhcp -6 ;;
auto6)
do_ipv6auto ;;
*)
do_static ;;
esac
break
done
exit 0

View File

@@ -1,17 +0,0 @@
#!/bin/bash
dracut_install ip dhclient hostname brctl
inst "$moddir/ifup" "/sbin/ifup"
inst "$moddir/netroot" "/sbin/netroot"
inst "$moddir/dhclient-script" "/sbin/dhclient-script"
inst "$moddir/dhclient.conf" "/etc/dhclient.conf"
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
inst_hook cmdline 99 "$moddir/parse-ip-opts.sh"
inst_hook cmdline 98 "$moddir/parse-bridge.sh"
inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
# TODO ifcfg config style is redhat specific, this should probably
# go into its own module at one time
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
mkdir -p "${initdir}/var/run"

View File

@@ -1,16 +0,0 @@
#!/bin/bash
# Include wired net drivers, excluding wireless
net_module_test() {
local net_drivers='eth_type_trans|register_virtio_device'
local unwanted_drivers='/(wireless|isdn|uwb)/'
nm -uPA "$1" | egrep -q $net_drivers && \
nm -uPA "$1" | egrep -qv 'iw_handler_get_spy' && \
[[ ! $1 =~ $unwanted_drivers ]]
}
instmods $(filter_kernel_modules net_module_test)
instmods ecb arc4
# bridge modules
instmods bridge stp llc

View File

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

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
check() {
. $dracutfunctions
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
return 255
}
depends() {
[ -d /etc/sysconfig/network-scripts/ ] && echo ifcfg
return 0
}
installkernel() {
# Include wired net drivers, excluding wireless
net_module_test() {
local net_drivers='eth_type_trans|register_virtio_device'
local unwanted_drivers='/(wireless|isdn|uwb)/'
egrep -q $net_drivers "$1" && \
egrep -qv 'iw_handler_get_spy' "$1" && \
[[ ! $1 =~ $unwanted_drivers ]]
}
instmods $(filter_kernel_modules net_module_test)
instmods ecb arc4
# bridge modules
instmods bridge stp llc
instmods ipv6
# bonding
instmods bonding
}
install() {
dracut_install ip arping tr dhclient
dracut_install -o brctl ifenslave
inst "$moddir/ifup" "/sbin/ifup"
inst "$moddir/netroot" "/sbin/netroot"
inst "$moddir/dhclient-script" "/sbin/dhclient-script"
inst "$moddir/dhclient.conf" "/etc/dhclient.conf"
inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
inst_hook cmdline 96 "$moddir/parse-bond.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 pre-pivot 10 "$moddir/kill-dhclient.sh"
arch=$(uname -m)
for dir in "$usrlibdir/tls/$arch" "$usrlibdir/tls" "$usrlibdir/$arch" \
"$usrlibdir" "$libdir"; do
for i in "$dir"/libnss_dns.so.* "$dir"/libnss_mdns4_minimal.so.*; do
[ -e "$i" ] && dracut_install "$i"
done
done
}

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# pxelinux provides macaddr '-' separated, but we need ':'
fix_bootif() {
@@ -6,6 +8,8 @@ fix_bootif() {
local IFS='-'
macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
macaddr=${macaddr%:}
# strip hardware type field from pxelinux
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
echo $macaddr
}
@@ -20,24 +24,28 @@ fix_bootif() {
IFACES=$ethname
fi
# bond: attempt only the defined interface (override bridge defines)
if [ -e /tmp/bond.info ]; then
. /tmp/bond.info
# It is enough to fire up only one
IFACES=${bondslaves%% *}
fi
# 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+="/sbin/ifup $env{INTERFACE}"\n' "$BOOTIF"
BOOTIF=$(fix_bootif "$BOOTIF")
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$BOOTIF"
# If we have to handle multiple interfaces, handle only them.
elif [ -n "$IFACES" ] ; then
for iface in $IFACES ; do
printf 'ACTION=="add", SUBSYSTEM=="net", KERNEL=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
done
for iface in $IFACES ; do
printf 'ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
done
# Default: We don't know the interface to use, handle all
else
printf 'ACTION=="add", SUBSYSTEM=="net", RUN+="/sbin/ifup $env{INTERFACE}"\n'
printf 'ACTION=="add", SUBSYSTEM=="net", RUN+="/sbin/ifup $env{INTERFACE}"\n'
fi
# Udev event 'online' only gets fired from ifup/dhclient-script.
# No special rules required
printf 'ACTION=="online", SUBSYSTEM=="net", RUN+="/sbin/netroot $env{INTERFACE}"\n'
} > /etc/udev/rules.d/60-net.rules

View File

@@ -1,14 +1,10 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
PATH=$PATH:/sbin:/usr/sbin
. /lib/dracut-lib.sh
if getarg rdnetdebug ; then
exec >/tmp/netroot.$1.$$.out
exec 2>>/tmp/netroot.$1.$$.out
set -x
fi
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
# Huh? Empty $1?
[ -z "$1" ] && exit 1
@@ -16,15 +12,6 @@ fi
# Huh? No interface config?
[ ! -e /tmp/net.$1.up ] && exit 1
# Only try to configure from one network interface at a time
#
if [ -z "$NETROOT_LOCKED" ] ; then
NETROOT_LOCKED=true
export NETROOT_LOCKED
exec flock -xo /tmp/netroot.lock -c "$0 $*"
exit 1
fi
# There's no sense in doing something if no (net)root info is available
# or root is already there
[ -e /tmp/root.info ] || exit 1
@@ -46,7 +33,7 @@ netif=$1
# Figure out the handler for root=dhcp by recalling all netroot cmdline
# handlers
if [ "$netroot" = "dhcp" ] ; then
if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
# Unset root so we can check later
unset root
@@ -56,16 +43,17 @@ if [ "$netroot" = "dhcp" ] ; then
# If we have a specific bootdev with no dhcpoptions or empty root-path,
# we die. Otherwise we just warn
if [ -z "$new_root_path" ] ; then
[ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
warn "No dhcp root-path received for '$BOOTDEV' trying other interfaces if available"
exit 1
[ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
warn "No dhcp root-path received for '$BOOTDEV' trying other interfaces if available"
exit 1
fi
# Set netroot to new_root_path, so cmdline parsers don't call
netroot=$new_root_path
for f in ./cmdline/90*.sh; do
[ -f "$f" ] && . "$f";
# FIXME!
for f in $hookdir/cmdline/90*.sh; do
[ -f "$f" ] && . "$f";
done
else
rootok="1"
@@ -90,7 +78,49 @@ done
[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
[ -e /tmp/net.$netif.hostname ] && . /tmp/net.$netif.hostname
[ -e /tmp/resolv.conf ] && cp -f /tmp/resolv.conf /etc/resolv.conf
[ -e /tmp/net.$netif.resolv.conf ] && cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf
# Load interface options
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
# Handle STP Timeout: arping the default router if root server is
# unknown or not local, or if not available the root server.
# Note: This assumes that if no router is present the
# root server is on the same subnet.
#
# TODO There's some netroot variants that don't (yet) have their
# server-ip netroot
# Get router IP if set
[ -n "$new_routers" ] && gw_ip=${new_routers%%,*}
[ -n "$gw" ] && gw_ip=$gw
# Get root server IP if set
if [ -n "$netroot" ]; then
dummy=${netroot#*:}
dummy=${dummy%%:*}
case "$dummy" in
[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*) netroot_ip=$dummy;;
esac
fi
# Default arping dest to router
dest="$gw_ip"
# Change to arping root server if appropriate
if [ -n "$netroot_ip" ]; then
if [ -z "$dest" ]; then
# no gateway so check root server
dest="$netroot_ip"
else
r=$(ip route get "$netroot_ip")
if ! strstr "$r" ' via ' ; then
# local root server, so don't arping gateway
dest="$netroot_ip"
fi
fi
fi
if [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then
die "Resolving $dest via ARP on $netif failed"
fi
# Source netroot hooks before we start the handler
source_all netroot
@@ -100,8 +130,8 @@ source_all netroot
if $handler $netif $netroot $NEWROOT; then
# Network rootfs mount successful
for iface in $IFACES ; do
[ -f /tmp/dhclient.$iface.lease ] && cp /tmp/dhclient.$iface.lease /tmp/net.$iface.lease
[ -f /tmp/dhclient.$iface.dhcpopts ] && cp /tmp/dhclient.$iface.dhcpopts /tmp/net.$iface.dhcpopts
[ -f /tmp/dhclient.$iface.lease ] && cp /tmp/dhclient.$iface.lease /tmp/net.$iface.lease
[ -f /tmp/dhclient.$iface.dhcpopts ] && cp /tmp/dhclient.$iface.dhcpopts /tmp/net.$iface.dhcpopts
done
# Save used netif for later use
@@ -111,9 +141,9 @@ else
# If we're trying with multiple interfaces, put that one down.
# ip down/flush ensures that routeing info goes away as well
if [ -z "$BOOTDEV" ] ; then
ip link set $netif down
ip addr flush dev $netif
echo "#empty" > /etc/resolv.conf
ip link set $netif down
ip addr flush dev $netif
echo "#empty" > /etc/resolv.conf
fi
fi
exit 0

View File

@@ -0,0 +1,63 @@
#!/bin/sh
#
# Format:
# bond=<bondname>[:<bondslaves>:[:<options>]]
#
# bondslaves is a comma-separated list of physical (ethernet) interfaces
# options is a comma-separated list on bonding options (modinfo bonding for details) in format compatible with initscripts
# if options include multi-valued arp_ip_target option, then its values should be separated by semicolon.
#
# bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr
#
# return if bond already parsed
[ -n "$bondname" ] && return
# Check if bond parameter is valid
if getarg bond= >/dev/null ; then
if [ -z "$netroot" ] ; then
die "No netboot configured, bond is invalid"
fi
fi
# We translate list of slaves to space-separated here to mwke it easier to loop over them in ifup
# Ditto for bonding options
parsebond() {
local v=${1}:
set --
while [ -n "$v" ]; do
set -- "$@" "${v%%:*}"
v=${v#*:}
done
unset bondname bondslaves bondoptions
case $# in
0) bondname=bond0; bondslaves="eth0 eth1" ;;
1) bondname=$1; bondslaves="eth0 eth1" ;;
2) bondname=$1; bondslaves=$(echo $2|tr "," " ") ;;
3) bondname=$1; bondslaves=$(echo $2|tr "," " "); bondoptions=$(echo $3|tr "," " ") ;;
*) die "bond= requires zero to four parameters" ;;
esac
}
unset bondname bondslaves bondoptions
# Parse bond for bondname, bondslaves, bondmode and bondoptions
if getarg bond >/dev/null; then
# Read bond= parameters if they exist
bond="$(getarg bond=)"
if [ ! "$bond" = "bond" ]; then
parsebond "$(getarg bond=)"
fi
# Simple default bond
if [ -z "$bondname" ]; then
bondname=bond0
bondslaves="eth0 eth1"
fi
# Make it suitable for initscripts export
bondoptions=$(echo $bondoptions|tr ";" ",")
echo "bondname=$bondname" > /tmp/bond.info
echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.info
echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.info
return
fi

29
modules.d/40network/parse-bridge.sh Normal file → Executable file
View File

@@ -1,18 +1,20 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Format:
# bridge=<bridgename>:<ethname>
# bridge=<bridgename>:<ethname>
#
# bridge without parameters assumes bridge=br0:eth0
# bridge without parameters assumes bridge=br0:eth0
#
# return if bridge already parsed
[ -n "$bridgename" ] && return
# Check if bridge parameter is valid
if getarg ip= >/dev/null ; then
if getarg bridge= >/dev/null ; then
if [ -z "$netroot" ] ; then
die "No netboot configured, bridge is invalid"
die "No netboot configured, bridge is invalid"
fi
fi
@@ -26,18 +28,25 @@ parsebridge() {
unset bridgename ethname
case $# in
0) bridgename=br0; ethname=eth0 ;;
1) die "bridge= requires two parameters" ;;
2) bridgename=$1; ethname=$2 ;;
*) die "bridge= requires two parameters" ;;
0) bridgename=br0; ethname=$iface ;;
1) die "bridge= requires two parameters" ;;
2) bridgename=$1; ethname=$2 ;;
*) die "bridge= requires two parameters" ;;
esac
}
unset bridgename ethname
iface=eth0
if [ -e /tmp/bond.info ]; then
. /tmp/bond.info
if [ -n "$bondname" ] ; then
iface=$bondname
fi
fi
# Parse bridge for bridgename and ethname
if getarg bridge >/dev/null; then
initrdargs="$initrdargs bridge"
# Read bridge= parameters if they exist
bridge="$(getarg bridge=)"
if [ ! "$bridge" = "bridge" ]; then
@@ -46,7 +55,7 @@ if getarg bridge >/dev/null; then
# Simple default bridge
if [ -z "$bridgename" ]; then
bridgename=br0
ethname=eth0
ethname=$iface
fi
echo "bridgename=$bridgename" > /tmp/bridge.info
echo "ethname=$ethname" >> /tmp/bridge.info

View File

@@ -0,0 +1,39 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Format:
# ifname=<interface>:<mac>
#
# Note letters in the macaddress must be lowercase!
#
# Examples:
# ifname=eth0:4a:3f:4c:04:f8:d7
#
# Note when using ifname= to get persistent interface names, you must specify
# an ifname= argument for each interface used in an ip= or fcoe= argument
# check if there are any ifname parameters
if ! getarg ifname= >/dev/null ; then
return
fi
parse_ifname_opts() {
local IFS=:
set $1
case $# in
7)
ifname_if=$1
ifname_mac=$2:$3:$4:$5:$6:$7
;;
*)
die "Invalid arguments for ifname="
;;
esac
}
# Check ifname= lines
for p in $(getargs ifname=); do
parse_ifname_opts $p
done

View File

@@ -1,40 +1,26 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Format:
# ip=[dhcp|on|any]
# ip=[dhcp|on|any]
#
# ip=<interface>:[dhcp|on|any]
# ip=<interface>:[dhcp|on|any]
#
# ip=<client-IP-number>:<server-id>:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:[dhcp|on|any|none|off]
# ip=<client-IP-number>:<server-id>:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:[dhcp|on|any|none|off]
#
# When supplying more than only ip= line, <interface> is mandatory and
# bootdev= must contain the name of the primary interface to use for
# routing,dns,dhcp-options,etc.
#
# Sadly there's no easy way to split ':' separated lines into variables
ip_to_var() {
local v=${1}:
set --
while [ -n "$v" ]; do
set -- "$@" "${v%%:*}"
v=${v#*:}
done
unset ip srv gw mask hostname dev autoconf
case $# in
0) autoconf="error" ;;
1) autoconf=$1 ;;
2) dev=$1; autoconf=$2 ;;
*) ip=$1; srv=$2; gw=$3; mask=$4; hostname=$5; dev=$6; autoconf=$7 ;;
esac
}
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
# Check if ip= lines should be used
if getarg ip= >/dev/null ; then
if [ -z "$netroot" ] ; then
echo "Warning: No netboot configured, ignoring ip= lines"
return;
echo "Warning: No netboot configured, ignoring ip= lines"
return;
fi
fi
@@ -54,7 +40,7 @@ fi
if [ -z "$NEEDBOOTDEV" ] ; then
local count=0
for p in $(getargs ip=); do
count=$(( $count + 1 ))
count=$(( $count + 1 ))
done
[ $count -gt 1 ] && NEEDBOOTDEV=1
fi
@@ -65,48 +51,81 @@ if [ -n "$NEEDBOOTDEV" ] ; then
[ -z "$BOOTDEV" ] && die "Bootdev argument is empty"
fi
if [ "ibft" = "$(getarg ip=)" ]; then
modprobe ibft
num=0
(
for iface in /sys/firmware/ibft/ethernet*; do
[ -e ${iface}/mac ] || continue
ifname_mac=$(read a < ${iface}/mac; echo $a)
[ -z "$ifname_mac" ] || continue
ifname_if=ibft$num
num=$(( $num + 1 ))
echo "ifname=$ifname_if:$ifname_mac"
dev=$ifname_if
dhcp=$(read a < ${iface}/dhcp; echo $a)
if [ -n "$dhcp" ]; then
echo "ip=$dev:dhcp"
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"
fi
done
) >> /etc/cmdline
# reread cmdline
unset CMDLINE
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
# skip ibft
[ "$autoconf" = "ibft" ] && continue
# We need to have an ip= line for the specified bootdev
[ -n "$NEEDBOOTDEV" ] && [ "$dev" = "$BOOTDEV" ] && BOOTDEVOK=1
# Empty autoconf defaults to 'dhcp'
if [ -z "$autoconf" ] ; then
warn "Empty autoconf values default to dhcp"
autoconf="dhcp"
warn "Empty autoconf values default to dhcp"
autoconf="dhcp"
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"
;;
dhcp|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'";;
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
if [ -n "$dev" ] ; then
# We don't like duplicate device configs
if [ -n "$IFACES" ] ; then
for i in $IFACES ; do
[ "$dev" = "$i" ] && die "For argument 'ip=$p'\nDuplication configurations for '$dev'"
done
fi
# IFACES list for later use
IFACES="$IFACES $dev"
if [ -n "$IFACES" ] ; then
for i in $IFACES ; do
[ "$dev" = "$i" ] && die "For argument 'ip=$p'\nDuplication configurations for '$dev'"
done
fi
# IFACES list for later use
IFACES="$IFACES $dev"
fi
# Small optimization for udev rules
@@ -114,15 +133,15 @@ for p in $(getargs ip=); do
# Do we need to check for specific options?
if [ -n "$NEEDDHCP" ] || [ -n "$DHCPORSERVER" ] ; then
# Correct device? (Empty is ok as well)
[ "$dev" = "$BOOTDEV" ] || continue
# Server-ip is there?
[ -n "$DHCPORSERVER" ] && [ -n "$srv" ] && continue
# dhcp? (It's simpler to check for a set ip. Checks above ensure that if
# ip is there, we're static
[ -z "$ip" ] && continue
# Not good!
die "Server-ip or dhcp for netboot needed, but current arguments say otherwise"
# Correct device? (Empty is ok as well)
[ "$dev" = "$BOOTDEV" ] || continue
# Server-ip is there?
[ -n "$DHCPORSERVER" ] && [ -n "$srv" ] && continue
# dhcp? (It's simpler to check for a set ip. Checks above ensure that if
# ip is there, we're static
[ -z "$ip" ] && continue
# Not good!
die "Server-ip or dhcp for netboot needed, but current arguments say otherwise"
fi
done

View File

@@ -1,52 +0,0 @@
#!/bin/sh
# NFS root might have reached here before /tmp/net.ifaces was written
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
for netif in $IFACES ; do
mkdir -p /tmp/ifcfg/
# bridge?
unset bridge
if [ "$netif" = "$bridgename" ]; then
bridge=yes
fi
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
echo "# Generated by dracut initrd" > /tmp/ifcfg/ifcfg-$netif
echo "DEVICE=$netif" >> /tmp/ifcfg/ifcfg-$netif
echo "ONBOOT=yes" >> /tmp/ifcfg/ifcfg-$netif
echo "NETBOOT=yes" >> /tmp/ifcfg/ifcfg-$netif
if [ -f /tmp/net.$netif.lease ]; then
echo "BOOTPROTO=dhcp" >> /tmp/ifcfg/ifcfg-$netif
else
echo "BOOTPROTO=none" >> /tmp/ifcfg/ifcfg-$netif
# If we've booted with static ip= lines, the override file is there
. /tmp/net.$netif.override
echo "IPADDR=$ip" >> /tmp/ifcfg/ifcfg-$netif
echo "NETMASK=$mask" >> /tmp/ifcfg/ifcfg-$netif
[ -n "$gw" ] && echo "GATEWAY=$gw" >> /tmp/ifcfg/ifcfg-$netif
fi
# bridge needs differente things written to ifcfg
if [ -z "$bridge" ]; then
# standard interface
echo "HWADDR=$(cat /sys/class/net/$netif/address)" >> /tmp/ifcfg/ifcfg-$netif
echo "TYPE=Ethernet" >> /tmp/ifcfg/ifcfg-$netif
echo "NAME=\"Boot Disk\"" >> /tmp/ifcfg/ifcfg-$netif
else
# bridge
echo "TYPE=Bridge" >> /tmp/ifcfg/ifcfg-$netif
echo "NAME=\"Boot Disk\"" >> /tmp/ifcfg/ifcfg-$netif
# write separate ifcfg file for the raw eth interface
echo "DEVICE=$ethname" >> /tmp/ifcfg/ifcfg-$ethname
echo "TYPE=Ethernet" >> /tmp/ifcfg/ifcfg-$ethname
echo "ONBOOT=yes" >> /tmp/ifcfg/ifcfg-$ethname
echo "NETBOOT=yes" >> /tmp/ifcfg/ifcfg-$ethname
echo "HWADDR=$(cat /sys/class/net/$ethname/address)" >> /tmp/ifcfg/ifcfg-$ethname
echo "BRIDGE=$netif" >> /tmp/ifcfg/ifcfg-$ethname
echo "NAME=$ethname" >> /tmp/ifcfg/ifcfg-$ethname
fi
done

View File

@@ -0,0 +1,16 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
return 255
}
depends() {
return 0
}
install() {
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
}

142
modules.d/45ifcfg/write-ifcfg.sh Executable file
View File

@@ -0,0 +1,142 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# NFS root might have reached here before /tmp/net.ifaces was written
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
mkdir -p /tmp/ifcfg/
for netif in $IFACES ; do
# bridge?
unset bridge
unset bond
if [ "$netif" = "$bridgename" ]; then
bridge=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
{
echo "# Generated by dracut initrd"
echo "DEVICE=$netif"
echo "ONBOOT=yes"
echo "NETBOOT=yes"
if [ -f /tmp/net.$netif.lease ]; then
strstr "$ip" '*:*:*' &&
echo "DHCPV6C=yes"
echo "BOOTPROTO=dhcp"
else
echo "BOOTPROTO=none"
# If we've booted with static ip= lines, the override file is there
. /tmp/net.$netif.override
echo "IPADDR=$ip"
echo "NETMASK=$mask"
[ -n "$gw" ] && echo "GATEWAY=$gw"
fi
} > /tmp/ifcfg/ifcfg-$netif
# bridge needs different things written to ifcfg
if [ -z "$bridge" ] && [ -z "$bond" ]; then
# standard interface
{
echo "HWADDR=$(cat /sys/class/net/$netif/address)"
echo "TYPE=Ethernet"
echo "NAME=\"Boot Disk\""
} >> /tmp/ifcfg/ifcfg-$netif
fi
if [ -n "$bond" ] ; then
# bond interface
{
# This variable is an indicator of a bond interface for initscripts
echo "BONDING_OPTS=\"$bondoptions\""
echo "NAME=\"Boot Disk\""
} >> /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 "TYPE=Ethernet"
echo "ONBOOT=no"
echo "NETBOOT=yes"
echo "HWADDR=$(cat /sys/class/net/$slave/address)"
echo "SLAVE=yes"
echo "MASTER=$netif"
echo "NAME=$slave"
} >> /tmp/ifcfg/ifcfg-$slave
done
fi
if [ -n "$bridge" ] ; then
# bridge
{
echo "TYPE=Bridge"
echo "NAME=\"Boot Disk\""
} >> /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
# write separate ifcfg file for the raw eth interface
{
echo "# Generated by dracut initrd"
echo "DEVICE=$ethname"
echo "TYPE=Ethernet"
echo "ONBOOT=no"
echo "NETBOOT=yes"
echo "HWADDR=$(cat /sys/class/net/$ethname/address)"
echo "BRIDGE=$netif"
echo "NAME=$ethname"
} >> /tmp/ifcfg/ifcfg-$ethname
fi
fi
done
# Pass network opts
mkdir -p /run/initramfs
cp /tmp/net.* /run/initramfs/ >/dev/null 2>&1
mkdir -p /run/initramfs/state/etc/sysconfig/network-scripts/
cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/ >/dev/null 2>&1
echo "files /etc/sysconfig/network-scripts" > /run/initramfs/rwtab
cp -a /tmp/ifcfg/* /run/initramfs/state/etc/sysconfig/network-scripts/ >/dev/null 2>&1

View File

@@ -0,0 +1,42 @@
Dracut gensplash module
-----------------------
INDEX
0. Introduction
1. Hostonly vs Generic
2. Configuration and kernel parameters
~
0. Introduction
gensplash is based on Genkernel code and that's why it's Gentoo-specific. It
requires splashutils to work. To set up theme you may edit /etc/conf.d/splash
or set DRACUT_GENSPLASH_THEME and DRACUT_GENSPLASH_RES variables. Your theme
has to exist in /etc/splash and for every given resolution has to exist config
in theme's directory, e.g. there's 1024x768.cfg in /etc/splash/natural_gentoo.
List of resolutions is comma-separated.
NOTE: The module will be rewritten to be distro-neutral. Its name will change
to fbsplash.
1. Hostonly vs Generic
All available themes are installed only if no --hostonly is specified and no
DRACUT_GENSPLASH_THEME and DRACUT_GENSPLASH_RES are set. Otherwise those vars
are checked and if not set then config /etc/conf.d/splash is read.
2. Configuration and kernel parameters
Example set up by environment variables:
DRACUT_GENSPLASH_THEME=natural_gentoo
DRACUT_GENSPLASH_RES=1024x768,1024x600
Example kernel arguments:
splash=silent,theme:natural_gentoo console=tty1 quiet
You may easily set up the module using Genkernel with arguments:
--gensplash=<theme>:<res1>,<res2>,...

View File

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

View File

@@ -0,0 +1,7 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
CDROOT=0
. /lib/gensplash-lib.sh
splash set_msg 'Switching to new root'

View File

@@ -0,0 +1,16 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if getargbool 1 rd.splash -n rd_NO_SPLASH; then
[ -c /dev/null ] || mknod /dev/null c 1 3
[ -c /dev/console ] || mknod /dev/console c 5 1
[ -c /dev/tty0 ] || mknod /dev/tty0 c 4 0
info "Starting Gentoo Splash"
[ -x /lib/udev/console_init ] && /lib/udev/console_init tty0
CDROOT=0
. /lib/gensplash-lib.sh
splash init
fi

View File

@@ -0,0 +1,77 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
# TODO: splash_geninitramfs
# TODO: /usr/share/splashutils/initrd.splash
return 255
}
depends() {
return 0
}
install() {
call_splash_geninitramfs() {
local out ret
out=$(splash_geninitramfs -c "$1" ${@:2} 2>&1)
ret=$?
if [[ ${out} ]]; then
local IFS='
'
for line in ${out}; do
if [[ ${line} =~ ^Warning ]]; then
dwarn "${line}"
else
derror "${line}"
(( ret == 0 )) && ret=1
fi
done
fi
return ${ret}
}
type -P splash_geninitramfs >/dev/null || return 1
opts=''
if [[ ${DRACUT_GENSPLASH_THEME} ]]; then
# Variables from the environment
# They're supposed to be set up by e.g. Genkernel in basis of cmdline args.
# If user set them he/she would expect to be included only given theme
# rather then all even if we're building generic initramfs.
SPLASH_THEME=${DRACUT_GENSPLASH_THEME}
SPLASH_RES=${DRACUT_GENSPLASH_RES}
elif [[ ${hostonly} ]]; then
# Settings from config only in hostonly
[[ -e /etc/conf.d/splash ]] && source /etc/conf.d/splash
[[ ! ${SPLASH_THEME} ]] && SPLASH_THEME=default
[[ ${SPLASH_RES} ]] && opts+=" -r ${SPLASH_RES}"
else
# generic
SPLASH_THEME=--all
fi
dinfo "Installing Gentoo Splash (using the ${SPLASH_THEME} theme)"
pushd "${initdir}" >/dev/null
mv dev dev.old
call_splash_geninitramfs "${initdir}" ${opts} ${SPLASH_THEME} || {
derror "Could not build splash"
return 1
}
rm -rf dev
mv dev.old dev
popd >/dev/null
dracut_install 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
inst_hook emergency 50 "${moddir}"/gensplash-emergency.sh
}

View File

@@ -1,3 +0,0 @@
#!/bin/bash
[[ $1 = -d ]] && echo crypt
[[ -x /sbin/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]]

View File

@@ -1,45 +0,0 @@
#!/bin/sh
# do not ask, if we already have root
[ -f /sysroot/proc ] && exit 0
# check if destination already exists
[ -b /dev/mapper/$2 ] && exit 0
# we already asked for this device
[ -f /tmp/cryptroot-asked-$2 ] && exit 0
. /lib/dracut-lib.sh
LUKS=$(getargs rd_LUKS_UUID=)
ask=1
if [ -n "$LUKS" ]; then
ask=0
luuid=${2##luks-}
for luks in $LUKS; do
if [ "${luuid##$luks}" != "$2" ]; then
ask=1
fi
done
fi
if [ $ask -gt 0 ]; then
info "luksOpen $1 $2"
# flock against other interactive activities
{ flock -s 9;
/bin/plymouth ask-for-password \
--prompt "$1 is password protected" \
--command="/sbin/cryptsetup luksOpen -T1 $1 $2"
} 9>/.console.lock
fi
# mark device as asked
>> /tmp/cryptroot-asked-$2
udevsettle
unset LUKS
unset ask
unset luks
exit 0

View File

@@ -1,7 +0,0 @@
#!/bin/bash
. "$moddir"/plymouth-populate-initrd
inst_hook cmdline 30 "$moddir/parse-plymouth.sh"
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
inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask

View File

@@ -1,5 +0,0 @@
#!/bin/bash
# Include KMS capable drm drivers
for modname in $(find "$srcmods/kernel/drivers/gpu/drm" -name '*.ko'); do
nm -uPA $modname | grep -q drm_crtc_init && instmods $modname
done

View File

@@ -0,0 +1,35 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
[[ -x /sbin/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]]
}
depends() {
return 0
}
installkernel() {
# Include KMS capable drm drivers
for modname in $(find "$srcmods/kernel/drivers/gpu/drm" "$srcmods/extra" -name '*.ko' 2>/dev/null); do
grep -q drm_crtc_init $modname && instmods $modname
done
}
install() {
if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \
|| ! grep -q PLYMOUTH_POPULATE_SOURCE_FUNCTIONS /usr/libexec/plymouth/plymouth-populate-initrd \
|| [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
. "$moddir"/plymouth-populate-initrd
else
PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
/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
inst readlink
}

View File

@@ -1,19 +0,0 @@
initrdargs="$initrdargs rd_plytheme"
PLYMOUTH_THEMEDIR=/usr/share/plymouth/themes
PLYMOUTH_THEME=$(getarg rd_plytheme=)
if [ -n "$PLYMOUTH_THEME" ]; then
if [ -f "${PLYMOUTH_THEMEDIR}/${PLYMOUTH_THEME}/${PLYMOUTH_THEME}.plymouth" ]; then
info "Setting theme $PLYMOUTH_THEME"
(
cd $PLYMOUTH_THEMEDIR;
ln -fs "${PLYMOUTH_THEME}/${PLYMOUTH_THEME}.plymouth" default.plymouth 2>&1 | vinfo;
)
else
warn "Theme $PLYMOUTH_THEME not found!"
fi
fi
unset PLYMOUTH_THEME
unset PLYMOUTH_THEMEDIR

3
modules.d/50plymouth/plymouth-emergency.sh Normal file → Executable file
View File

@@ -1 +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

View File

@@ -1,5 +1,7 @@
#!/bin/sh
# -*- 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
/bin/plymouth --newroot=$NEWROOT
fi

View File

@@ -1,9 +1,6 @@
#!/bin/bash
if ldd /sbin/plymouthd |grep -q lib64; then
LIBDIR="/usr/lib64"
else
LIBDIR="/usr/lib"
fi
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
PLYMOUTH_LOGO_FILE="/usr/share/pixmaps/system-logo-white.png"
PLYMOUTH_THEME=$(plymouth-set-default-theme)
@@ -15,40 +12,38 @@ dracut_install /bin/plymouth \
mkdir -p "${initdir}/usr/share/plymouth"
if [[ $hostonly ]]; then
dracut_install "${LIBDIR}/plymouth/text.so" \
"${LIBDIR}/plymouth/details.so" \
"/usr/share/plymouth/themes/details/details.plymouth" \
"/usr/share/plymouth/themes/text/text.plymouth" \
dracut_install "${usrlibdir}/plymouth/text.so" \
"${usrlibdir}/plymouth/details.so" \
"/usr/share/plymouth/themes/details/details.plymouth" \
"/usr/share/plymouth/themes/text/text.plymouth" \
if [[ -d /usr/share/plymouth/themes/${PLYMOUTH_THEME} ]]; then
for x in "/usr/share/plymouth/themes/${PLYMOUTH_THEME}"/* ; do
for x in "/usr/share/plymouth/themes/${PLYMOUTH_THEME}"/* ; do
[[ -f "$x" ]] || break
inst $x
done
done
fi
if [ -L /usr/share/plymouth/themes/default.plymouth ]; then
inst /usr/share/plymouth/themes/default.plymouth
inst /usr/share/plymouth/themes/default.plymouth
# Install plugin for this theme
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth |awk -F= {'print $2'})
inst ${LIBDIR}/plymouth/${PLYMOUTH_PLUGIN}.so
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth | while read a b c; do echo $b; done;)
inst "${usrlibdir}/plymouth/${PLYMOUTH_PLUGIN}.so"
fi
else
for x in /usr/share/plymouth/themes/{text,details}/* ; do
[[ -f "$x" ]] || continue
THEME_DIR=$(dirname "$x")
mkdir -p "${initdir}/$THEME_DIR"
THEME_DIR=$(dirname "$x")
mkdir -p "${initdir}/$THEME_DIR"
dracut_install "$x"
done
for x in ${LIBDIR}/plymouth/{text,details}.so ; do
for x in "${usrlibdir}"/plymouth/{text,details}.so ; do
[[ -f "$x" ]] || continue
[[ "$x" != "${x%%/label.so}" ]] && continue
dracut_install "$x"
done
(
cd ${initdir}/usr/share/plymouth/themes;
ln -s text/text.plymouth default.plymouth 2>&1;
cd ${initdir}/usr/share/plymouth/themes;
ln -s text/text.plymouth default.plymouth 2>&1;
)
fi
# vim:ts=8:sw=4:sts=4:et

View File

@@ -1,18 +1,24 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
[ -c /dev/null ] || mknod /dev/null c 1 3
# first trigger graphics subsystem
udevadm trigger --attr-match=class=0x030000 >/dev/null 2>&1
# first trigger graphics and tty subsystem
udevadm trigger --subsystem-match=graphics --subsystem-match=drm --subsystem-match=tty >/dev/null 2>&1
if getargbool 1 rd.plymouth -n rd_NO_PLYMOUTH; then
[ -c /dev/null ] || mknod -m 0666 /dev/null c 1 3
# first trigger graphics subsystem
udevadm trigger --action=add --attr-match=class=0x030000 >/dev/null 2>&1
# first trigger graphics and tty subsystem
udevadm trigger --action=add --subsystem-match=graphics --subsystem-match=drm --subsystem-match=tty >/dev/null 2>&1
udevadm settle --timeout=30 2>&1 | vinfo
[ -c /dev/zero ] || mknod /dev/zero c 1 5
[ -c /dev/systty ] || mknod /dev/systty c 4 0
[ -c /dev/fb ] || mknod /dev/fb c 29 0
[ -c /dev/hvc0 ] || mknod /dev/hvc0 c 229 0
info "Starting plymouth daemon"
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session
/bin/plymouth --show-splash 2>&1 | vinfo
udevadm settle --timeout=30 2>&1 | vinfo
[ -c /dev/zero ] || mknod -m 0666 /dev/zero c 1 5
[ -c /dev/tty0 ] || mknod -m 0620 /dev/tty0 c 4 0
[ -e /dev/systty ] || ln -s tty0 /dev/systty
[ -c /dev/fb0 ] || mknod -m 0660 /dev/fb0 c 29 0
[ -e /dev/fb ] || ln -s fb0 /dev/fb
info "Starting plymouth daemon"
mkdir -m 0755 -p /run/plymouth
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session --pid-file /run/plymouth/pid
[ -x /lib/udev/console_init ] && /lib/udev/console_init tty0
/bin/plymouth --show-splash 2>&1 | vinfo
fi

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