Compare commits

..

204 Commits
0.7 ... 002

Author SHA1 Message Date
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
Harald Hoyer
194f7d125f 90*/*cleanup.sh: fixed redirection to /dev/null 2009-09-01 15:59:31 +02:00
Harald Hoyer
8ef0be5671 dracut-lib: try to set UDEVVERSION, if not set 2009-09-01 15:51:51 +02:00
Harald Hoyer
b809e77f54 plymouth: in the generic case, only install text and details themes 2009-09-01 15:51:51 +02:00
Harald Hoyer
780afa9876 release any raid/crypt/lvm device assembled, but not in use 2009-09-01 15:51:51 +02:00
Harald Hoyer
5ebc1acb7f selinux-loadpolicy.sh: redirect output of selinux load_policy 2009-09-01 15:51:50 +02:00
Harald Hoyer
59580f28a1 dracut-functions: do not try to clear logfile, if not writable 2009-09-01 15:42:28 +02:00
Harald Hoyer
533d7dc4ab dracut-function: add check for volume group members
see https://bugzilla.redhat.com/show_bug.cgi?id=506189

not all members of a linear volume group are listed in /sys slaves
2009-09-01 15:42:28 +02:00
Harald Hoyer
ec74fa8789 split dracut in network / non-network 2009-09-01 15:42:28 +02:00
Harald Hoyer
988061a5ee dracut.spec: removed s390 conditionals 2009-09-01 15:42:28 +02:00
Harald Hoyer
c10d53bf0c dracut.spec: fixed gittag 2009-09-01 15:42:28 +02:00
Harald Hoyer
54b87586aa fixed gitrpm 2009-09-01 15:42:27 +02:00
Harald Hoyer
461ff22cd5 new test/TEST-13-ENC-RAID-LVM 2009-09-01 15:42:27 +02:00
Harald Hoyer
b1a4919cb2 TEST-12-RAID-DEG/test.sh: add rdinfo 2009-09-01 15:42:27 +02:00
Harald Hoyer
c1d670a893 65-md-incremental-imsm.rules: also check on "change" 2009-09-01 15:42:27 +02:00
Harald Hoyer
b6bf29b054 lvm.rules: blkid for cciss devices 2009-09-01 15:42:27 +02:00
Harald Hoyer
5c6a593f2e add udevsettle function and settle after raid/lvm/crypto activities 2009-09-01 15:42:27 +02:00
Harald Hoyer
f4c36b28f6 mdraid_start: check if raid is already active before trying to run it 2009-09-01 15:42:27 +02:00
Harald Hoyer
73e649b5f5 dracut.spec: require policycoreutils 2009-09-01 15:42:26 +02:00
Harald Hoyer
ba72631039 add hostonly to dracut.conf 2009-09-01 15:42:26 +02:00
Warren Togami
a89fb6daa5 Write netboot config for passing to OS as requested in https://bugzilla.redhat.com/show_bug.cgi?id=515771#c18 2009-08-31 19:34:27 -04:00
Harald Hoyer
6568d86aec instmods(): fixed "instmods =drivers/md" 2009-08-28 13:33:57 +02:00
Hans de Goede
3508cc816e Add fcoe booting support
Supported cmdline formats:
fcoe=<networkdevice>:<dcb|nodcb>
fcoe=<macaddress>:<dcb|nodcb>

Note currently only nodcb is supported, the dcb option is reserved for
future use.

Note letters in the macaddress must be lowercase!

Examples:
fcoe=eth0:nodcb
fcoe=4A:3F:4C:04:F8:D7:nodcb
2009-08-28 12:53:56 +02:00
Harald Hoyer
ffa264f077 dracut.8: document rootfstype and rootflags 2009-08-28 12:53:03 +02:00
Harald Hoyer
84c2266f1a network/installkernel: it's eth_type_trans and not eth_type_transfer 2009-08-27 13:06:46 +02:00
Harald Hoyer
973c23b0d6 should_source_module(): refined check
Do not bail out early if no install exists.
Check also for installkernel.
2009-08-27 12:53:38 +02:00
Victor Lowther
9ede1929b2 Oops, clean up broken get_fs_type implementation.
While we are at it, make a couple of other fixups.
2009-08-22 12:04:11 -05:00
Victor Lowther
054e038512 Add accurate --hostonly checking for 95iscsi 2009-08-21 22:22:40 -05:00
Victor Lowther
fb8923f681 Minor fixups to kernel module loading
Also rewrite filter_kernel_modules to make it a little easier to read.
2009-08-20 22:21:33 -05:00
Victor Lowther
240cc7c480 Abstract out hostonly vs. generic module installation differences.
This introduces filter_kernel_modules, which should be used to install
all kernel modules that match whatever criteria you want.

If running in --hostonly, filter_kernel_modules will only consider
modules that are loaded in the kernel, otherwise it will consider
all the modules installed on the system for the appropriate kernel.

This drastically reduces initramfs generation time when using --hostonly
by eliminating lots of unneeded filesystem activity.
2009-08-20 15:52:45 -05:00
Victor Lowther
8d04a1287d Some updates to the README files 2009-08-20 14:14:21 -05:00
Victor Lowther
16df64ef1f Abstract out vol_id vs. blkid usage.
vol_id seems to be going away, and blkid can be used as a drop-in replacement
for it.
2009-08-20 07:28:04 -05:00
Victor Lowther
f76ef3aa3d Speed up loading block drivers when running with --hostonly
Instead of grovelling through all the modules available for the
kernel looking for block devices, only look at the modules that are
actually loaded. This speeds things up by a rather large amount
when generating the initramfs with --hostonly.

While we are at it, only load the filesystem module that will actually
be used for the root filesystem when running in --hostonly instead
of all the filesystem modules that happen to be loaded at the time.
2009-08-19 22:21:29 -05:00
Victor Lowther
59c88f499f Abstract out vol_id vs. blkid usage
Since different distros may or may not use vol_id in udev, and blkid
is generally replacing vol_id, abstract them out into a function which
tries to use vol_id first and blkid second, on the assumption that
blkid can take over for vol_id if vol_id is no longer there.
2009-08-19 22:21:07 -05:00
Harald Hoyer
afe25d0ccc {crypt,dmraid,,lvm,mdraid}/check use blkid if no vol_id found 2009-08-19 17:11:29 +02:00
Harald Hoyer
bdccc34e7e Makefile: add hostimage target for a hostonly image
call it with root priviledges
2009-08-19 17:10:38 +02:00
Harald Hoyer
495a964322 nbd/check: moved host-only checks and added ";" 2009-08-19 17:09:53 +02:00
Harald Hoyer
9defc609e8 dracut-functions: check for existance of slave devices before opening it 2009-08-19 17:08:57 +02:00
Harald Hoyer
68b26290f0 udev-rules: install vol_id 2009-08-19 11:12:42 +02:00
Harald Hoyer
d41f7ae750 rsyslogd-start.sh: read correct filters file 2009-08-19 10:59:37 +02:00
Marc Grimme
e15bc1f330 Syslog support for dracut
This module provides syslog functionality in the initrd.
This is especially interesting when complex configuration being
used to provide access to the device the rootfs resides on.

When this module is installed into the ramfs it is triggered by
the udev event from the nic being setup (online).

Then if syslog is configured it is started and will forward all
kernel messages to the given syslog server.

The syslog implementation is detected automatically by finding the
apropriate binary with the following order:
rsyslogd
syslogd
syslog-ng
Then if detected the syslog.conf is generated and syslog is started.

Bootparameters:
syslogserver=ip    Where to syslog to
sysloglevel=level  What level has to be logged
syslogtype=rsyslog|syslog|syslogng
                   Don't auto detect syslog but set it
2009-08-19 10:40:02 +02:00
Jeremy Katz
a607b7d4b8 Fix syntax error in conditional
Fix a typo in the conditionals.  Not sure how I didn't notice these
before
2009-08-19 10:34:06 +02:00
Victor Lowther
1a4c4015bc Modify nbd hostonly checking to use check_block_and_slaves.
This allows hostonly nbd checking to work in more exotic situations,
such as mdraid/dmraid/lvm/crypt on top of nbd.
2009-08-16 18:22:21 -05:00
Victor Lowther
d7df77d172 Modified lvm hostonly checking to use dracut-functions 2009-08-16 15:29:59 -05:00
Victor Lowther
7e2b4f8367 Make mdraid checking use common functionality in dracut-functions 2009-08-16 15:29:59 -05:00
Victor Lowther
bc9ae19deb Make dmraid checking use common functionality in dracut-functions 2009-08-16 15:29:50 -05:00
Victor Lowther
17829e94aa Move common rootfs finding and backing store tree checking to dracut-functions 2009-08-16 15:29:50 -05:00
Victor Lowther
e0dca0e43c Minor spacing fixups in dracut-finctions 2009-08-16 15:29:49 -05:00
Victor Lowther
4e207ec862 The network check script sources , so it must use /bin/bash 2009-08-16 15:29:49 -05:00
Victor Lowther
b5ccf21d2b Make the lvm check script really check to see if root is on an lvm device
somehow when run in hostonly mode.
2009-08-16 15:29:42 -05:00
Victor Lowther
62bde8ed7e make mdraid check script really check to see of the rootfs is on an
mdraid block device when run in hostonly mode.
2009-08-16 15:29:27 -05:00
Victor Lowther
dc670134f8 Make hostonly check for dmraid only pass if root is really on
a dmraid volume somehow.
2009-08-16 15:29:18 -05:00
Victor Lowther
39d6cb5df4 Make hostonly checking in 90crypt only pass if root is really on an
encrypted block device somewhere along the chain.
2009-08-16 15:28:56 -05:00
Victor Lowther
ddfd1d10a0 Split kernel module loading into smaller chunks.
This prepares to more tightly integrate dracut-gencmdline with the
rest of the dracut scripts
2009-08-16 15:28:45 -05:00
Victor Lowther
0c1a8ebc37 More quotation fixups in dracut-functions 2009-08-15 10:56:36 -05:00
Victor Lowther
bd4c4bcb76 Simplify dracut_install a bit, an make a minor fixup to check_module_deps 2009-08-15 07:55:59 -05:00
Victor Lowther
161efa1f40 Some quotation cleanups in dracut-functions.
Quotes are generally not needed in when assigning one variable to another,
and are also not needed inside [[ ]] comaprisons, as word splitting and
pathname expansion are not performed in these cases.
2009-08-15 07:38:26 -05:00
Victor Lowther
ebdddd29d3 Get rid of redundant NONL stuff in dracut-gencmdline 2009-08-14 22:54:38 -05:00
Victor Lowther
2790d5b2ed Update dracut-catimages to make it much more robust in the face of
image filenames with spaces, carriage returns, and other such nasty
characters in them.  Bash arrays are very useful for these sorts of things.
2009-08-14 22:51:25 -05:00
Victor Lowther
98adb06ea3 No need to quote variable expansion in [[ ]] 2009-08-14 22:36:41 -05:00
Victor Lowther
0b90cfaa9f Bashify drivers_dir check 2009-08-14 22:31:04 -05:00
Harald Hoyer
ded38dbfbd dracut.spec add NEWS to dracut and dracut-tools 2009-08-14 18:03:33 +02:00
Harald Hoyer
5d12f1a485 version 0.9 2009-08-14 17:59:43 +02:00
Harald Hoyer
7addf9d430 rpmversion: dash does not want as I do 2009-08-14 17:47:07 +02:00
Harald Hoyer
6d0480426d rpmversion: fixed rpm query 2009-08-14 17:37:00 +02:00
Harald Hoyer
5a8b143888 TEST-10-RAID: new mdadm is picky about partitions 2009-08-14 17:27:50 +02:00
Michael Ploujnikov
5bf0b329c9 update the rdbreak breakpoint list 2009-08-14 17:27:50 +02:00
Harald Hoyer
51123629d7 dracut.spec: add more plymouth themes 2009-08-14 17:27:50 +02:00
Harald Hoyer
0ad78ae8e7 dracut.spec: requieres dash
how could we forget to add that?? :-)
2009-08-14 17:27:50 +02:00
Harald Hoyer
1c6e9e5c0a new module 10rpmversion
outputs rpm version of dracut
2009-08-14 17:27:50 +02:00
Harald Hoyer
0b610a002c removed 90dmsetup 2009-08-14 17:27:49 +02:00
Harald Hoyer
0f1361ee1c udev-rules: hardcode helper binaries 2009-08-14 17:27:49 +02:00
Harald Hoyer
b806825d2a nfs: only install libnfsidmap_nsswitch.so of all libnfsidmap_*.so 2009-08-14 17:27:49 +02:00
Harald Hoyer
f905c1d7d6 dmsquash-live: install the "real" eject
eject might be a symlink to consolehelper
2009-08-14 17:27:49 +02:00
Harald Hoyer
926b2c3337 dracut: set ownership to root.root for all files 2009-08-14 17:27:49 +02:00
Harald Hoyer
fc900b8be4 dracut-gencmdline: fix LUKS_UUID and MD_UUID output 2009-08-14 16:21:03 +02:00
Harald Hoyer
88838bf238 network: exclude kernel modules, which need iw_handler_get_spy 2009-08-14 16:21:03 +02:00
Harald Hoyer
ed2de829e1 cryptroot-ask.sh: fix rd_LUKS_UUID handling 2009-08-14 16:21:03 +02:00
Harald Hoyer
ff34c9dcd4 10redhat-i18n: remove unnecessary files 2009-08-14 16:21:03 +02:00
Harald Hoyer
3d4641fd98 add rdinfo command line parameter
print informational output though "quiet" is set
2009-08-14 16:21:03 +02:00
Harald Hoyer
860ace56f8 inst_simple(): add -p flag to cp 2009-08-13 14:22:54 +02:00
Harald Hoyer
ed6220fd25 plymouth: make the daemon attach to the session/terminal
https://bugzilla.redhat.com/show_bug.cgi?id=516104

it can be so simple :-)
2009-08-07 12:08:31 +02:00
Harald Hoyer
be9ca6c8a8 dracut.spec: require versioned util-linux-ng instead of switch_root 2009-08-07 12:08:04 +02:00
Warren Togami
148284ced6 Remove ugly hack 2009-08-06 11:07:43 -04:00
Harald Hoyer
1def132d53 version 0.8 2009-08-06 15:10:59 +02:00
Harald Hoyer
0de910602c add NEWS 2009-08-06 15:01:24 +02:00
Harald Hoyer
3714170f33 plymouth-populate-initrd: do not install label.so
https://bugzilla.redhat.com/show_bug.cgi?id=515589

It ends up installing the label.so control plugin which isn't supposed
to get installed into the initrd.  this makes cairo and libX11 and all sorts of
things move into the initrd that aren't supposed to.
2009-08-06 14:43:13 +02:00
Harald Hoyer
c6ca79eb4e dracut.spec: version for module-init-tools requirement
https://bugzilla.redhat.com/show_bug.cgi?id=515630

dracut-0.7-1 uses a modprobe option (-d) that exists only in
module-init-tools >= 3.7-9, but the 'Requires: module-init-tools'
of dracut is not version-specific.
2009-08-06 14:43:13 +02:00
Thilo Bangert
a15ad925e9 support for unusual terminfo location
the following patch makes the 95terminfo module work on gentoo.
2009-08-06 14:43:12 +02:00
Warren Togami
13d5225fc8 Temporary hack to provide ifcfg files to OS in a way that might work with existing initscripts.
I am not happy about this.  It shouldn't be the job of dracut to do this.  The initscripts should
deal with the plain /dev/.initramfs/ifcfg/ directory accordingly.  Doing this for now because
notting insists upon it.  We need to clean this up after we network option passing working.
2009-08-04 17:15:39 -04:00
Harald Hoyer
e3052553cf dracut.spec: fixed requirements for dracut-tools 2009-08-04 16:36:18 +02:00
Jeremy Katz
cc0e7a369b Parse options earlier for live root 2009-08-04 16:25:43 +02:00
Jeremy Katz
7f819d7041 Support resetting the live overlay
If you're using a persistent overlay, you might want to reset it
at boot time if it has become corrupted somehow.  Support using
reset_overlay as a command line optino to do so
2009-08-04 16:25:43 +02:00
Jeremy Katz
dfba82b3d3 And support passing in the persistent overlay
The persistent overlay can be specified with an overlay= argument
on the command line.  We'll probably try to move this into the
root= syntax soon, but this is the old way that works
2009-08-04 16:25:43 +02:00
Jeremy Katz
3ae2f09a04 Support passing live_ram
live_ram allows you to load the entirety of the live image into
RAM and run it from there rather than off of the block device
2009-08-04 16:25:43 +02:00
Jeremy Katz
a2a2a956dd Support passing the live_dir with live_dir=
The live image is assumed to be under LiveOS/ unless live_dir
is passed specifying otherwise
2009-08-04 16:25:43 +02:00
Jeremy Katz
fa9d7304bf Support old syntax
livecd-creator previously added 'liveimg' and used root=CDLABEL=;
it's easy enough to support that old syntax for now at least
and it will make it easier to get people testing
2009-08-04 16:25:43 +02:00
Jeremy Katz
c56b63d1bd Support checking the iso
Support checking the iso image with checkisomd5 if available
2009-08-04 16:25:43 +02:00
Jeremy Katz
2e44f115b9 Add basic support for dmsquashed live images
Fedora/Red Hat live images are implemented as an ext3fs inside of
a squashfs.  Writability is achieved with a device-mapper snapshot
on top of that.

This gives the basic support without a lot of things like persistent
overlays, iso md5sum checking, etc and also with a new basic syntax
that has to be specified as root=live:LABEL=...
2009-08-04 16:25:42 +02:00
Sergey Fionov
0c296f15b1 Fix full pathname condition in find_library
Hello,

Now a fact that the path is full is checked by
[[ -x $1 ]]

But if the working directory is /bin or a directory with a file named
"mount",
this condition will be met for "inst mount", and "mount" will not be copied
into initrd at all.
2009-08-04 16:21:58 +02:00
Harald Hoyer
345f573546 90mdraid/parse-md.sh: removed bashism 2009-08-04 11:36:06 +02:00
Warren Togami
69288348dd dracut requires bzip2 2009-08-03 14:26:26 -04:00
Harald Hoyer
9babe97e6f iscsiroot: check real root if it is block:... 2009-07-31 14:43:14 +02:00
Harald Hoyer
863fa9c295 dracut.8: fixed iscsi username/pw documentation 2009-07-31 13:22:58 +02:00
Hans de Goede
766968bb6f Implement extended iscsi: rfc4173 syntax which allows specifying credentials
As discussed before, it would be nice to be able to specify
the iscsi chap credentials inside the netroot=iscsi:.....
syntax, this patch implements this in a backwards compatible way, like
this:
iscsi:username:pass@127.0.0.1::3260::iqn.2009-01.com.example:testdisk
iscsi:username:pass:reverse:pass@127.0.0.1::3260::iqn.2009-01.com.example:test

The only downside is that the backwards compatibility is broken when there
is an @ in the iscsi target name (very unlikely), that can still be used,
but only like this:
iscsi:@192.168.1.100::3260::iqn.2009-01.com.example:testdi@sk
2009-07-31 12:44:18 +02:00
Harald Hoyer
123e04b23e 40network/installkernel: do not install isdn and uwb modules 2009-07-31 12:40:53 +02:00
Harald Hoyer
9d2eb35d7a 90kernel-modules/installkernel: do not install fs/ocfs2 filesystems 2009-07-31 12:40:53 +02:00
Harald Hoyer
67a38adacf nfs: only install libnss_*.so which are used by nsswitch.conf 2009-07-31 12:40:53 +02:00
Harald Hoyer
80aa303c29 dracut.spec: removed duplicate requirements 2009-07-31 12:40:53 +02:00
Harald Hoyer
5ea16f2790 kernel-modules: add modules for virtio devices 2009-07-31 12:40:53 +02:00
Harald Hoyer
2f24b79ddd iscsi: manually load the iscsi_ibft kernel module 2009-07-31 10:58:03 +02:00
Harald Hoyer
d9f8feb04a iscsi: install iscsi_ibft kernel module 2009-07-30 16:57:30 +02:00
Harald Hoyer
bb57587b42 iscsiroot: fixed udev rules for iscsi_firmware 2009-07-30 16:14:09 +02:00
Harald Hoyer
b61ca28260 dracut.spec: no more switch_root for >= F12 and Require "which" 2009-07-30 16:12:52 +02:00
Harald Hoyer
a3f4e7709b add udev rules for iscsi_firmware 2009-07-30 16:12:52 +02:00
Warren Togami
984a819b92 There is only one resolv.conf. 2009-07-30 09:27:09 -04:00
Warren Togami
edae4b5efb Mark the other ifcfg file when bridges are used. 2009-07-29 16:54:53 -04:00
Warren Togami
2098ebf712 Need some way of differentiating these interfaces as being netboot. 2009-07-29 14:07:08 -04:00
Harald Hoyer
f72c10f657 getarg()/getargs(): check existance of /etc/cmdline before reading it 2009-07-28 18:29:40 +02:00
Warren Togami
645bde35d3 Use standard ifcfg filenames, put them into an ifcfg directory. 2009-07-27 15:54:21 -04:00
Warren Togami
0c39f9f6f6 --strip requires file 2009-07-27 13:16:51 -04:00
134 changed files with 2413 additions and 575 deletions

View File

@@ -1,4 +1,4 @@
VERSION=0.7
VERSION=002
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
prefix = /usr
@@ -54,7 +54,12 @@ rpm: clean dracut-$(VERSION).tar.bz2
rm -fr BUILD BUILDROOT
gitrpm: dracut-$(VERSION)-$(GITVERSION).tar.bz2
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" --define "gittag $(GITVERSION)" -ba dracut.spec
echo "%define gittag $(GITVERSION)" > dracut.spec.git
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
mv dracut.spec.bak dracut.spec
rm -fr BUILD BUILDROOT
check: all
@@ -73,5 +78,8 @@ testimages: all
./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

200
NEWS Normal file
View File

@@ -0,0 +1,200 @@
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
- better lvm/mdraid/dmraid handling
- fcoe booting support
Supported cmdline formats:
fcoe=<networkdevice>:<dcb|nodcb>
fcoe=<macaddress>:<dcb|nodcb>
Note currently only nodcb is supported, the dcb option is reserved for
future use.
Note letters in the macaddress must be lowercase!
Examples:
fcoe=eth0:nodcb
fcoe=4A:3F:4C:04:F8:D7:nodcb
- Syslog support for dracut
This module provides syslog functionality in the initrd.
This is especially interesting when complex configuration being
used to provide access to the device the rootfs resides on.
dracut-0.9
==========
- let plymouth attach to the terminal (nice text output now)
- new kernel command line parameter "rdinfo" show dracut output, even when
"quiet" is specified
- rd_LUKS_UUID is now handled correctly
- dracut-gencmdline: rd_LUKS_UUID and rd_MD_UUID is now correctly generated
- now generates initrd-generic with around 15MB
- smaller bugfixes
dracut-0.8
==========
- iSCSI with username and password
- support for live images (dmsquashed live images)
- iscsi_firmware fixes
- smaller images
- bugfixes
dracut-0.7
==========
- dracut: strip binaries in initramfs
--strip
strip binaries in the initramfs (default)
--nostrip
do not strip binaries in the initramfs
- dracut-catimages
Usage: ./dracut-catimages [OPTION]... <initramfs> <base image>
[<image>...]
Creates initial ramdisk image by concatenating several images from the
command
line and /boot/dracut/
-f, --force Overwrite existing initramfs file.
-i, --imagedir Directory with additional images to add
(default: /boot/dracut/)
-o, --overlaydir Overlay directory, which contains files that
will be used to create an additional image
--nooverlay Do not use the overlay directory
--noimagedir Do not use the additional image directory
-h, --help This message
--debug Output debug information of the build process
-v, --verbose Verbose output during the build process
- s390 dasd support
dracut-0.6
==========
- dracut: add --kernel-only and --no-kernel arguments
--kernel-only
only install kernel drivers and firmware files
--no-kernel
do not install kernel drivers and firmware files
All kernel module related install commands moved from "install"
to "installkernel".
For "--kernel-only" all installkernel scripts of the specified
modules are used, regardless of any checks, so that all modules
which might be needed by any dracut generic image are in.
The basic idea is to create two images. One image with the kernel
modules and one without. So if the kernel changes, you only have
to replace one image.
Grub and the kernel can handle multiple images, so grub entry can
look like this:
title Fedora (2.6.29.5-191.fc11.i586)
root (hd0,0)
kernel /vmlinuz-2.6.29.5-191.fc11.i586 ro rhgb quiet
initrd /initrd-20090722.img /initrd-kernel-2.6.29.5-191.fc11.i586.img /initrd-config.img
initrd-20090722.img
the image provided by the initrd rpm
one old backup version is kept like with the kernel
initrd-kernel-2.6.29.5-191.fc11.i586.img
the image provided by the kernel rpm
initrd-config.img
optional image with local configuration files
- dracut: add --kmoddir directory, where to look for kernel modules
-k, --kmoddir [DIR]
specify the directory, where to look for kernel modules
dracut-0.5
==========
- more generic (all plymouth modules, all keyboards, all console fonts)
- more kernel command line parameters (see also man dracut(8))
- a helper tool, which generates the kernel command line (dracut-gencmdline)
- bridged network boot
- a lot of new command line parameter
dracut-0.4
==========
- bugfixes
- firmware loading support
- new internal queue (initqueue)
initqueue now loops until /dev/root exists or root is mounted
init now has the following points to inject scripts:
/cmdline/*.sh
scripts for command line parsing
/pre-udev/*.sh
scripts to run before udev is started
/pre-trigger/*.sh
scripts to run before the main udev trigger is pulled
/initqueue/*.sh
runs in parallel to the udev trigger
Udev events can add scripts here with /sbin/initqueue.
If /sbin/initqueue is called with the "--onetime" option, the script
will be removed after it was run.
If /initqueue/work is created and udev >= 143 then this loop can
process the jobs in parallel to the udevtrigger.
If the udev queue is empty and no root device is found or no root
filesystem was mounted, the user will be dropped to a shell after
a timeout.
Scripts can remove themselves from the initqueue by "rm $job".
/pre-mount/*.sh
scripts to run before the root filesystem is mounted
NFS is an exception, because it has no device node to be created
and mounts in the udev events
/mount/*.sh
scripts to mount the root filesystem
NFS is an exception, because it has no device node to be created
and mounts in the udev events
If the udev queue is empty and no root device is found or no root
filesystem was mounted, the user will be dropped to a shell after
a timeout.
/pre-pivot/*.sh
scripts to run before the real init is executed and the initramfs
disappears
All processes started before should be killed here.
The behaviour of the dmraid module demonstrates how to use the new
mechanism. If it detects a device which is part of a raidmember from a
udev rule, it installs a job to scan for dmraid devices, if the udev
queue is empty. After a scan, it removes itsself from the queue.
dracut-0.3
==========
- first public version

10
README
View File

@@ -21,8 +21,10 @@ as hooks are guaranteed to be the path to slow-down.
Most of the initrd generation functionality in dracut is provided by a bunch
of generator modules that are sourced by the main dracut script to install
specific functionality into the initrd. They live in the modules.d subdirectory,
and use functionality provided by dracut-functions to do their work.
specific functionality into the initrd. They live in the modules.d
subdirectory, and use functionality provided by dracut-functions to do their
work.
Some general rules for writing modules:
* Use one of the inst family of functions to actually install files
on to the initrd. They handle mangling the pathnames and (for binaries,
@@ -59,13 +61,13 @@ the documentation, git access, etc.
Git Repository:
http://dracut.git.sourceforge.net/
git://dracut.git.sourceforge.net/gitroot/dracut
git://dracut.git.sourceforge.net/gitroot/dracut/dracut
Trac Instance:
http://apps.sourceforge.net/trac/dracut/
The git tree can be found at
git://dracut.git.sourceforge.net/gitroot/dracut for now. See the TODO
git://dracut.git.sourceforge.net/gitroot/dracut/dracut for now. See the TODO
file for things which still need to be done and HACKING for some
instructions on how to get started. There is also a mailing list that
is being used for the discussion -- initramfs@vger.kernel.org. It is

View File

@@ -8,3 +8,6 @@ To build a generic initramfs, you have to install the following software package
* mdadm
* net-tools iproute
Generic initramfs'es are huge (usually over 10 megs in size uncompressed), but
should be able to automatically boot any bootable configuration with appropriate
boot flags (root device, network configuration information, etc.)

View File

@@ -35,7 +35,7 @@ check: Dracut calls this program to check and see if a module can be installed
are present. It should exit with a 0 if they are, and a 1 if they are
not.
When called with -H, it should perform the same check that it would
When called with -h, it should perform the same check that it would
without any options, and it should also check to see if the
functionality the module implements is being used on the host system.
For example, if this module handles installing support for LUKS
@@ -43,9 +43,12 @@ check: Dracut calls this program to check and see if a module can be installed
encrpted volumes are available and the host system has the root
partition on an encrypted volume, 1 otherwise.
When called with -d, it should output a list of dracut modules
that it relies upon. An example would be the nfs and iscsi modules,
which rely on the network module to detect and configure network
interfaces.
Check may take additional options in the future.
We will most likely grow a module dependency checking system in the
near future, and check will need to handle a -d option when we do.
Any other files in the module will not be touched by dracut directly.

49
dracut
View File

@@ -34,7 +34,9 @@ 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.
-k, --kmoddir [DIR] Specify the directory, where to look for kernel
modules
--fwdir [DIR] Specify additional directories, where to look for
@@ -43,6 +45,8 @@ Creates initial ramdisk images for preloading modules
--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
--mdadmconf Include local /etc/mdadm.conf
--nomdadmconf Do not include local /etc/mdadm.conf
-h, --help This message
--debug Output debug information of the build process
-v, --verbose Verbose output during the build process
@@ -69,18 +73,21 @@ while (($# > 0)); do
-o|--omit) omit_dracutmodules_l="$2"; shift;;
-a|--add) add_dracutmodules_l="$2"; shift;;
-d|--drivers) drivers_l="$2"; shift;;
--add-drivers) add_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";;
--mdadmconf) mdadmconf_l="yes";;
--nomdadmconf) mdadmconf_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="-h" ;;
-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;;
@@ -89,7 +96,8 @@ while (($# > 0)); do
shift
done
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]}): ';
@@ -107,14 +115,21 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
[[ $omit_dracutmodules_l ]] && omit_dracutmodules=$omit_dracutmodules_l
[[ $add_dracutmodules_l ]] && add_dracutmodules="$add_dracutmodules $add_dracutmodules_l"
[[ $drivers_l ]] && drivers=$drivers_l
[[ $add_drivers_l ]] && add_drivers=$add_drivers_l
[[ $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
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
[[ $fw_dir ]] || fw_dir=/lib/firmware
[[ $do_strip ]] || do_strip=yes
# eliminate IFS hackery when messing with fw_dir
fw_dir=${fw_dir//:/ }
[[ $allowlocal && -f "$(dirname $0)/dracut-functions" ]] && dsrc="$(dirname $0)" || dsrc=$dracutbasedir
[[ $hostonly = yes ]] && hostonly="-h"
[[ $allowlocal && -f "$(readlink -f $(dirname $0))/dracut-functions" ]] && dsrc="$(dirname $0)" || dsrc=$dracutbasedir
if [[ -f $dsrc/dracut-functions ]]; then
. $dsrc/dracut-functions
@@ -136,7 +151,7 @@ esac
[[ $1 ]] && outfile=$(readlink -f $1) || outfile="/boot/initrd-$kernel.img"
srcmods="/lib/modules/$kernel/"
[ -n "$drivers_dir" ] && srcmods="$drivers_dir"
[[ $drivers_dir ]] && srcmods="$drivers_dir"
export srcmods
if [[ -f $outfile && ! $force ]]; then
@@ -153,9 +168,10 @@ trap 'rm -rf "$initdir"' 0 # clean up after ourselves no matter how we die.
chmod 755 "$initdir"
export initdir hookdirs dsrc dracutmodules drivers \
fw_dir drivers_dir debug beverbose no_kernel kernel_only
fw_dir drivers_dir debug beverbose no_kernel kernel_only \
add_drivers mdadmconf
if [[ "$kernel_only" != "yes" ]]; then
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";
@@ -170,11 +186,11 @@ check_modules
for moddir in "$dsrc/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"
if [[ $kernel_only = yes ]]; then
[[ -x $moddir/installkernel ]] && . "$moddir/installkernel"
else
. "$moddir/install"
if [[ "$no_kernel" != "yes" && -x "$moddir/installkernel" ]]; then
if [[ $no_kernel != yes && -x $moddir/installkernel ]]; then
. "$moddir/installkernel"
fi
fi
@@ -182,12 +198,11 @@ for moddir in "$dsrc/modules.d"/[0-9][0-9]*; do
fi
done
unset moddir
echo $mods_to_load
## final stuff that has to happen
# generate module dependencies for the initrd
if [ -d "$initdir/lib/modules/$kernel" ]; then
if [[ -d $initdir/lib/modules/$kernel ]]; then
if ! depmod -a -b "$initdir" $kernel; then
echo "\"depmod -a $kernel\" failed."
exit 1
@@ -207,10 +222,10 @@ for item in $install_items; do
done
unset item
[[ "$beverbose" = "yes" ]] && (du -c "$initdir" | sort -n)
[[ $beverbose = yes ]] && (du -c "$initdir" | sort -n)
# strip binaries
if [ "$do_strip" = "yes" ] ; then
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'."
@@ -219,7 +234,7 @@ if [ "$do_strip" = "yes" ] ; then
done
fi
if [ "$do_strip" = "yes" ] ; then
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
@@ -238,9 +253,9 @@ if [ "$do_strip" = "yes" ] ; then
done
fi
( cd "$initdir"; find . |cpio -H newc -o |gzip -9 > "$outfile"; )
( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet |gzip -9 > "$outfile"; )
[[ "$beverbose" = "yes" ]] && ls -lh "$outfile"
[[ $beverbose = yes ]] && ls -lh "$outfile"
exit 0

View File

@@ -70,7 +70,7 @@ done
outfile=$1; shift
if [ -z "$outfile" ]; then
if [[ -z $outfile ]]; then
derror "No output file specified."
usage
exit 1
@@ -78,45 +78,47 @@ fi
baseimage=$1; shift
if [ -z "$baseimage" ]; then
if [[ -z $baseimage ]]; then
derror "No base image specified."
usage
exit 1
fi
if [ -f $outfile -a -z "$force" ]; then
if [[ -f $outfile && ! $force ]]; then
derror "Will not override existing initramfs ($outfile) without --force"
exit 1
fi
if [ -z "$no_imagedir" -a ! -d "$imagedir" ]; then
if [[ ! $no_imagedir && ! -d $imagedir ]]; then
derror "Image directory $overlay is not a directory"
exit 1
fi
if [ -z "$no_overlay" -a ! -d "$overlay" ]; then
if [[ ! $no_overlay && ! -d $overlay ]]; then
derror "Overlay $overlay is not a directory"
exit 1
fi
if [ -z "$no_overlay" ]; then
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"; )
fi
if [ -z "$no_imagedir" ]; then
images=$(for i in $imagedir/*.img;do [ -f $i ] || continue; echo $i; done)
if [[ ! $no_imagedir ]]; then
for i in "$imagedir/"*.img; do
[[ -f $i ]] && images+=("$i")
done
fi
images="$images $@"
images+=($@)
dinfo "Using base image $baseimage"
cat $baseimage > $outfile
cat "$baseimage" > "$outfile"
for i in $images; do
for i in "${images[@]}"; do
dinfo "Appending $i"
cat $i >> $outfile
cat "$i" >> "$outfile"
done
dinfo "Created $outfile"

View File

@@ -22,30 +22,113 @@ IF_RTLD=""
IF_dynamic=""
# Generic substring function. If $2 is in $1, return 0.
strstr() { [[ ! ${1#*$2*} = $1 ]]; }
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
>"$dracutlogfile"
dracutlogfile=/var/log/dracut.log || \
dracutlogfile=/tmp/dracut.log
# [[ -w $dracutlogfile ]] || dracutlogfile=/tmp/dracut.log
if [[ -w $dracutlogfile ]]; then
>"$dracutlogfile"
fi
fi
dwarning() {
echo "W: $@" >&2
[[ -w "$dracutlogfile" ]] && echo "W: $@" >>"$dracutlogfile"
[[ -w $dracutlogfile ]] && echo "W: $@" >>"$dracutlogfile"
}
dinfo() {
[[ $beverbose ]] && echo "I: $@" >&2
[[ -w "$dracutlogfile" ]] && echo "I: $@" >>"$dracutlogfile"
[[ -w $dracutlogfile ]] && echo "I: $@" >>"$dracutlogfile"
}
derror() {
echo "E: $@" >&2
[[ -w "$dracutlogfile" ]] && echo "E: $@" >>"$dracutlogfile"
[[ -w $dracutlogfile ]] && echo "E: $@" >>"$dracutlogfile"
}
get_fs_env() {
if [[ -x /lib/udev/vol_id ]]; then
eval $(/lib/udev/vol_id --export $1)
elif find_binary blkid >/dev/null; then
eval $(blkid -o udev $1)
else
return 1
fi
}
get_fs_type() (
get_fs_env $1 || return
echo $ID_FS_TYPE
)
get_fs_uuid() (
get_fs_env $1 || return
echo $ID_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)
}
find_root_block_device() { find_block_device /; }
# Walk all the slave relationships for a given 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
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
"$1" $2 && return
check_vol_slaves "$@" && return 0
[[ -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
done
return 1
}
get_numeric_dev() {
ls -lH "$1" | { read a b c d maj min rest; printf "%d:%d" ${maj%%,} $min;}
}
# ugly workaround for the lvm design
# There is no volume group device,
# 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.
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
done
return 1
}
# $1 = file to copy to ramdisk
@@ -55,11 +138,11 @@ derror() {
inst_simple() {
local src target
[[ -f $1 ]] || return 1
src=$1 target="${initdir}${2:-$1}"
src=$1 target=${initdir}${2:-$1}
[[ -f $target ]] && return 0
mkdir -p "${target%/*}"
dinfo "Installing $src"
cp -fL "$src" "$target"
cp -pfL "$src" "$target"
}
# Same as above, but specialzed to handle dynamic libraries.
@@ -69,10 +152,10 @@ inst_library() {
local src=$1 dest=${2:-$1}
[[ -f $initdir$dest ]] && return 0
if [[ -L $src ]]; then
reallib="$(readlink -f "$src")"
reallib=$(readlink -f "$src")
lib=${src##*/}
inst_simple "$reallib" "$reallib"
mkdir -p ${initdir}${dest%/*}
mkdir -p "${initdir}${dest%/*}"
(cd "${initdir}${dest%/*}" && ln -s "$reallib" "$lib")
else
inst_simple "$src" "$dest"
@@ -83,7 +166,7 @@ inst_library() {
# search in the usual places to find the binary.
find_binary() {
local binpath="/bin /sbin /usr/bin /usr/sbin" p
[[ -x $1 ]] && { echo $1; return 0; }
[[ -z ${1##/*} && -x $1 ]] && { echo $1; return 0; }
for p in $binpath; do
[[ -x $p/$1 ]] && { echo "$p/$1"; return 0; }
done
@@ -115,15 +198,15 @@ inst_binary() {
lib_regex='^(/lib[^/]*).*'
if [[ $FILE =~ $lib_regex ]]; then
TLIBDIR=${BASH_REMATCH[1]}
BASE="${FILE##*/}"
BASE=${FILE##*/}
# prefer nosegneg libs, then unoptimized ones.
for f in "$TLIBDIR/i686/nosegneg" "$TLIBDIR"; do
[[ -f $f/$BASE ]] || continue
FILE="$f/$BASE"
FILE=$f/$BASE
break
done
inst_library "$FILE" "$TLIBDIR/$BASE"
IF_dynamic="yes"
IF_dynamic=yes
continue
fi
inst_library "$FILE"
@@ -150,7 +233,7 @@ inst_symlink() {
[[ -L $1 ]] || return 1
[[ -L $target ]] && return 0
realsrc=$(readlink -f "$src")
[[ $realsrc = ${realsrc##*/} ]] && realsrc="${src%/*}/$realsrc"
[[ $realsrc = ${realsrc##*/} ]] && realsrc=${src%/*}/$realsrc
inst "$realsrc" && ln -s "$realsrc" "$target"
}
@@ -166,10 +249,10 @@ find_rule() {
# 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"
local target=/etc/udev/rules.d
mkdir -p "$initdir/lib/udev/rules.d" "$initdir$target"
for rule in "$@"; do
rule=$(find_rule $rule) && \
rule=$(find_rule "$rule") && \
inst_simple "$rule" "$target/${rule##*/}"
done
}
@@ -177,10 +260,21 @@ inst_rules() {
# 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)
[[ -z $initdir ]] && [[ -d $2 ]] && export initdir=$2
[[ $initdir = $2 ]] && set $1
;;
3)
[[ -z $initdir ]] && export initdir=$2
set $1 $3
;;
*)
derror "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
done
@@ -203,32 +297,27 @@ inst_hook() {
}
dracut_install() {
local optional=
if [[ $1 = '-o' ]]; then
local optional=yes
shift
fi
while (($# > 0)); do
# Might be nice to optionally install a binary
if [ "$1" == "-o" ]; then
optional="yes"
shift
continue
fi
if inst "$1" ; then
shift
continue
fi
if [ "$optional" == "yes" ]; then
dwarning "Skipping program $1 as it cannot be found and is flagged to be optional"
shift
continue
else
derror "Failed to install $1"; exit 1
fi
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
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 "
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
@@ -249,11 +338,11 @@ check_module_deps() {
should_source_module() {
local dep
[[ -x $1/install ]] || return 1
if [[ "$kernel_only" = "yes" ]]; then
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
@@ -280,16 +369,72 @@ check_modules() {
done
}
# install kernel modules, and handle installing all their dependencies as well.
# Install a single kernel module along with any firmware it may require.
# $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
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
done
}
# 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
# $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
}
# filter kernel modules to install certian 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.
# The behaviour of this function can vary depending on whether $hostonly is set.
# If it is, we will only look at modules that are already in memory.
# 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"'
else
filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename -k $kernel'
fi
for modname in $(eval $filtercmd); do
"$1" "$modname" && echo "$modname"
done
)
# install kernel modules along with all their dependencies.
instmods() {
[[ "$no_kernel" = "yes" ]] && return
[[ $no_kernel = yes ]] && return
local mod mpargs modpath modname cmd
while (($# > 0)); do
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" -a -f $srcmods/modules.block ] ; then
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#=} )
@@ -297,13 +442,16 @@ instmods() {
instmods $mpargs $(find "$srcmods" -path "*/${mod#=}/*")
fi
;;
--*) mpargs+=" $mod";;
--*)
mod=${mod##*/}
mpargs+=" $mod";;
i2o_scsi)
# Must never run this diagnostic-only module
shift; continue;
;;
*) mod=${mod##*/}
# if we are already installed, skip this module and go on
*)
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
@@ -311,31 +459,10 @@ instmods() {
[[ $hostonly ]] && ! grep -q "$mod" /proc/modules && {
shift; continue;
}
modprobe $mpargs --ignore-install --set-version $kernel -d ${srcmods%%/lib/modules/*}/ \
--show-depends $mod 2>/dev/null | \
while read cmd modpath options; do
[[ $cmd = insmod ]] || continue
modname=${modpath##*/}
modname=${modname%.ko}
if [[ ${mod/-/_} != ${modname/-/_} ]]; then
dinfo "Installing dependencies for $mod ($modpath)"
instmods $mpargs $modname
fi
inst_simple "$modpath" "/lib/modules/$kernel/${modpath##*/lib/modules/$kernel/}"
for fw in $(modinfo -k $kernel -F firmware $modpath 2>/dev/null); do
unset found
IFS=:
for fwdir in $fw_dir; do
if [ -d "$fwdir" -a -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
done
done
# 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

View File

@@ -21,22 +21,11 @@
function error() {
local NONL=""
if [ "$1" == "-n" ]; then
NONL="-n"
shift
fi
echo $NONL "$@" >&2
echo "$@" >&2
}
function vecho() {
return
local NONL=""
if [ "$1" == "-n" ]; then
NONL="-n"
shift
fi
is_verbose && echo $NONL "$@"
is_verbose && echo "$@"
}
# module dep finding and installation functions
@@ -52,18 +41,11 @@ moduledep() {
[ -n "$deps" ] && vecho ": $deps" || vecho
}
if [ $UID != 0 ]; then
error "$0 must be run as root."
exit 1
fi
export MALLOC_PERTURB_=204
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
export PATH
. /etc/rc.d/init.d/functions
# Set the umask. For iscsi, the initrd can contain plaintext
# password (chap secret), so only allow read by owner.
umask 077
@@ -643,6 +625,7 @@ emitcrypto()
if [ -z "$luksuuid" ]; then
luksuuid="$2"
fi
luksuuid=${luksuuid##UUID=}
echo -n "rd_LUKS_UUID=$luksuuid "
}
@@ -652,7 +635,9 @@ done
if [ -n "$raiddevices" ]; then
for dev in $raiddevices; do
echo -n "rd_MD_UUID=${dev} "
uid=$(udevadm info --query=all --name=/dev/${dev}|grep MD_UUID)
uid=$(IFS="=";set $uid;echo $2)
echo -n "rd_MD_UUID=$uid "
done
fi

View File

@@ -28,7 +28,9 @@ omit a space-separated list of dracut modules.
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.
specify a space-separated list of kernel modules to exclusively include in the initramfs.
.BR \-\-add-drivers " \fILIST\fR"
specify a space-separated list of kernel modules to add to the initramfs.
.TP
.BR \-k ", " \-\-kmoddir " \fI{DIR}\fR
specify the directory, where to look for kernel modules
@@ -42,6 +44,12 @@ only install kernel drivers and firmware files
.BR \-\-no-kernel
do not install kernel drivers and firmware files
.TP
.BR \-\-mdadmconf
include local /etc/mdadm.conf
.TP
.BR \-\-nomdadmconf
do not include local /etc/mdadm.conf
.TP
.BR \-\-strip
strip binaries in the initramfs (default)
.TP
@@ -95,7 +103,10 @@ root filesystem.
.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
@@ -117,11 +128,6 @@ will be written to /etc/sysconfig/i18n in the initramfs
.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
@@ -146,6 +152,9 @@ disable MD RAID detection
.B rd_NO_MDIMSM
no MD RAID for imsm/isw raids, use dmraid instead
.TP
.B rd_NO_MDADMCONF
ignore mdadm.conf included in initramfs
.TP
.B rd_MD_UUID=<md uuid>
only activate the raid sets with the given UUID
@@ -192,7 +201,7 @@ This is supported by dracut but not recommended.
.SH iSCSI
.TP
.B root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
.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
@@ -205,22 +214,27 @@ associated fields.
http://tools.ietf.org/html/rfc4173
.TP
.B root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
.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:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname> ...
.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 FCoE
.TP
.B netroot=fcoe:<interface|MAC>:<dcb|nodcb>
Try to connect to a FCoE SAN through the NIC specified by <interface> or <MAC>,
for the second argument, currently only nodcb is supported. Note letters in
the MAC-address must be lowercase!
.SH NBD
.TP
.B root=nbd:<server>:<port>[:<fstype>][:<mountopts>]
@@ -244,6 +258,18 @@ get ip from dhcp server on a specific interface
.B ip=<client-IP-number>:[<server-id>]:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:{none|off}
explicit network configuration
.SH Plymouth Boot Splash
.TP
.B rd_NO_PLYMOUTH
do not start plymouth. This will not work with encrypted partitions.
.TP
.B ifname=<interface>:<MAC>
Assign network device name <interface> (ie eth0) to the NIC with MAC <MAC>.
Note letters in the MAC-address must be lowercase!
Note that if you use this option you \fBmust\fR specify an ifname= argument
for all interfaces used in ip= or fcoe= arguments
.SH Misc
.TP
.B rdblacklist=<drivername>
@@ -251,6 +277,9 @@ 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
@@ -260,7 +289,7 @@ set -x for the dracut shell
.B rdbreak
drop to a shell at the end
.TP
.B rdbreak={pre-udev|pre-mount|mount|pre-pivot|commandline|initqueue}
.B rdbreak={cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot}
drop to a shell on defined breakpoint
.TP
.B rdudevinfo

View File

@@ -6,5 +6,12 @@
# Dracut modules to omit
#omit_dracutmodules=""
# Additional kernel modules to install
#drivers=""
# additional kernel modules to the default
#add_drivers=""
# build initrd only to boot current hardware
#hostonly="-h"
#
# install local /etc/mdadm.conf
mdadmconf="yes"

View File

@@ -1,18 +1,18 @@
%if 0%{?fedora} < 12
%define with_switch_root 1
%else
%define with_switch_root 1
%define with_switch_root 0
%endif
%if %{defined gittag}
%define rdist 1.git%{gittag}%{?dist}
%define rdist .git%{gittag}%{?dist}
%define dashgittag -%{gittag}
%else
%define rdist %{?dist}
%endif
Name: dracut
Version: 0.7
Version: 002
Release: 1%{?rdist}
Summary: Initramfs generator using udev
Group: System Environment/Base
@@ -22,49 +22,61 @@ 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
Requires: module-init-tools >= 3.7-9
Requires: cpio
Requires: coreutils
Requires: findutils
Requires: binutils
Requires: grep
Requires: mktemp
Requires: which
Requires: mktemp >= 1.5-5
Requires: mount
Requires: bash
Requires: dash
Requires: /bin/sh
Requires: fileutils, grep, mount, gzip, tar, mktemp >= 1.5-5, findutils
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: bridge-utils
%ifnarch s390 s390x
Requires: file
Requires: bzip2
Requires: dmraid
Requires: kbd
%endif
Requires: plymouth-scripts
%if ! 0%{?with_switch_root}
Requires: /sbin/switch_root
Requires: util-linux-ng >= 2.16
BuildArch: noarch
%endif
%description
dracut is a new, event-driven initramfs infrastructure based around udev.
%package generic
Summary: Metapackage to build a generic initramfs with dracut
%package network
Summary: dracut modules to build a dracut initramfs with network support
Requires: %{name} = %{version}-%{release}
Requires: rpcbind nfs-utils
Requires: iscsi-initiator-utils
Requires: nbd
Requires: net-tools iproute
Requires: plymouth-system-theme plymouth-theme-charge plymouth-theme-solar
Requires: bridge-utils
%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
Requires: %{name} = %{version}-%{release}
Requires: %{name}-network = %{version}-%{release}
%description generic
This package requires everything which is needed to build a generic
all purpose initramfs with dracut.
%package kernel
Summary: Metapackage to build generic initramfs with dracut with only kernel modules
Requires: %{name} = %{version}-%{release}
@@ -80,12 +92,10 @@ kernel modules and firmware files needed by dracut modules.
%package tools
Summary: dracut tools to build the local initramfs
Requires: %{name} = %{version}-%{release}
Requires: ql2100-firmware
Requires: ql2200-firmware
Requires: ql23xx-firmware
Requires: ql2400-firmware
Requires: ql2500-firmware
Requires: coreutils cryptsetup-luks device-mapper
Requires: diffutils dmraid findutils gawk grep lvm2
Requires: module-init-tools sed
Requires: cpio gzip
%description tools
This package contains tools to assemble the local initrd and host configuration.
@@ -96,10 +106,12 @@ This package contains tools to assemble the local initrd and host configuration.
%build
make
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin sysconfdir=/etc mandir=%{_mandir}
make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin \
sysconfdir=/etc mandir=%{_mandir}
echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/10rpmversion/dracut-version
%if ! 0%{?with_switch_root}
rm -f $RPM_BUILD_ROOT/sbin/switch_root
@@ -113,28 +125,54 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,0755)
%doc README HACKING TODO COPYING AUTHORS
%doc README HACKING TODO COPYING AUTHORS NEWS
/sbin/dracut
%if 0%{?with_switch_root}
/sbin/switch_root
%endif
%dir %{_datadir}/dracut
%{_datadir}/dracut/dracut-functions
%{_datadir}/dracut/modules.d
%config(noreplace) /etc/dracut.conf
%{_mandir}/man8/dracut.8*
%{_datadir}/dracut/modules.d/00dash
%{_datadir}/dracut/modules.d/10redhat-i18n
%{_datadir}/dracut/modules.d/10rpmversion
%{_datadir}/dracut/modules.d/50plymouth
%{_datadir}/dracut/modules.d/90crypt
%{_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/95debug
%{_datadir}/dracut/modules.d/95resume
%{_datadir}/dracut/modules.d/95rootfs-block
%{_datadir}/dracut/modules.d/95s390
%{_datadir}/dracut/modules.d/95terminfo
%{_datadir}/dracut/modules.d/95udev-rules
%{_datadir}/dracut/modules.d/95udev-rules.ub810
%{_datadir}/dracut/modules.d/98syslog
%{_datadir}/dracut/modules.d/99base
%files generic
%files network
%defattr(-,root,root,0755)
%doc README.generic
%{_datadir}/dracut/modules.d/40network
%{_datadir}/dracut/modules.d/95fcoe
%{_datadir}/dracut/modules.d/95iscsi
%{_datadir}/dracut/modules.d/95nbd
%{_datadir}/dracut/modules.d/95nfs
%files kernel
%defattr(-,root,root,0755)
%doc README.kernel
%files generic
%defattr(-,root,root,0755)
%doc README.generic
%files tools
%defattr(-,root,root,0755)
%doc COPYING
%doc COPYING NEWS
/sbin/dracut-gencmdline
/sbin/dracut-catimages
%dir /boot/dracut
@@ -142,20 +180,81 @@ rm -rf $RPM_BUILD_ROOT
%dir /var/lib/dracut/overlay
%changelog
* Thu Sep 17 2009 Harald Hoyer <harald@redhat.com> 002-1
- version 002
- set correct PATH
- workaround for broken mdmon implementation
* Wed Sep 16 2009 Harald Hoyer <harald@redhat.com> 001-12
- removed lvm/mdraid/dmraid lock files
- add missing ifname= files
* Wed Sep 16 2009 Harald Hoyer <harald@redhat.com> 001-11
- generate dracut-version during rpm build time
* Tue Sep 15 2009 Harald Hoyer <harald@redhat.com> 001-10
- 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
* Wed Sep 09 2009 Harald Hoyer <harald@redhat.com> 001-9
- added Requires: plymouth-scripts
* Wed Sep 09 2009 Harald Hoyer <harald@redhat.com> 001-8
- plymouth: use plymouth-populate-initrd
- add add_drivers for dracut and dracut.conf
- do not mount /proc and /selinux manually in selinux-load-policy
* Wed Sep 09 2009 Harald Hoyer <harald@redhat.com> 001-7
- add scsi_wait_scan to be sure everything was scanned
* Tue Sep 08 2009 Harald Hoyer <harald@redhat.com> 001-6
- fixed several problems with md raid containers
- fixed selinux policy loading
* Tue Sep 08 2009 Harald Hoyer <harald@redhat.com> 001-5
- patch does not honor file modes, fixed them manually
* Mon Sep 07 2009 Harald Hoyer <harald@redhat.com> 001-4
- fixed mdraid for IMSM
* Mon Sep 07 2009 Harald Hoyer <harald@redhat.com> 001-3
- fixed bug, which prevents installing 61-persistent-storage.rules (bug #520109)
* Thu Sep 03 2009 Harald Hoyer <harald@redhat.com> 001-2
- fixed missing grep for md
- reorder cleanup
* 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

View File

@@ -76,10 +76,13 @@ 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_*
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

@@ -3,7 +3,6 @@ inst_key_val()
local value
value=$(getarg $1)
[ -n "$value" ] && printf '%s="%s"\n' $1 $value >> $2
initrdargs="$initrdargs $1"
}
mkdir -p /etc/sysconfig

3
modules.d/10rpmversion/check Executable file
View File

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

11
modules.d/10rpmversion/install Executable file
View File

@@ -0,0 +1,11 @@
if [ -e "$moddir/dracut-version" ]; then
dracut_rpm_version=$(cat "$moddir/dracut-version")
inst "$moddir/dracut-version" /$dracut_rpm_version
else
if rpm -qf $(which $0) &>/dev/null; then
dracut_rpm_version=$(rpm -qf --qf '%{name}-%{version}-%{release}\n' $(which $0) | { ver="";while read line;do ver=$line;done;echo $ver;} )
echo $dracut_rpm_version > $initdir/$dracut_rpm_version
fi
fi
inst_hook cmdline 01 "$moddir/version.sh"

View File

@@ -0,0 +1,6 @@
for i in dracut-*; do
if [ -f $i ]; then
vinfo < $i
fi
done
unset i

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. $dracutfunctions

View File

@@ -23,12 +23,12 @@ setup_interface() {
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/resolv.conf
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf
fi >> /tmp/resolv.conf
[ -n "$hostname" ] && echo hostname $hostname > /tmp/net.$netif.hostname
}

View File

@@ -17,4 +17,5 @@ if [ "$root" = "dhcp" ] || [ "$netroot" = "dhcp" ] ; then
# Shut up init error check
[ -z "$root" ] && root="dhcp"
echo '[ -d $NEWROOT/proc -o -e /dev/root ]' > /initqueue-finished/dhcp.sh
fi

View File

@@ -0,0 +1,21 @@
#!/bin/sh
# if there are no ifname parameters, just use NAME=KERNEL
if ! getarg ifname= >/dev/null ; then
echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="?*", ATTR{type}=="1", NAME="%k"' \
> /etc/udev/rules.d/50-ifname.rules
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

@@ -4,14 +4,14 @@ 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 99 "$moddir/parse-ip-opts.sh"
inst_hook cmdline 98 "$moddir/parse-bridge.sh"
inst_hook cmdline 99 "$moddir/parse-ifname.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,14 +1,16 @@
#!/bin/bash
# Include wired net drivers, excluding wireless
for modname in $(find "$srcmods/kernel/drivers" -name '*.ko'); do
if nm -uPA $modname | grep -q eth_type_trans; then
if echo "$modname" | grep -q wireless; then
continue
else
instmods $modname
fi
fi
done
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

@@ -29,7 +29,7 @@ fix_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"
printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
done
# Default: We don't know the interface to use, handle all

View File

@@ -90,7 +90,7 @@ done
[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
[ -e /tmp/net.$netif.hostname ] && . /tmp/net.$netif.hostname
[ -e /tmp/net.$netif.resolv.conf ] && cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf
[ -e /tmp/resolv.conf ] && cp -f /tmp/resolv.conf /etc/resolv.conf
# Source netroot hooks before we start the handler
source_all netroot

View File

@@ -37,7 +37,6 @@ unset bridgename ethname
# 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

View File

@@ -0,0 +1,37 @@
#!/bin/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

@@ -8,42 +8,45 @@ udevadm settle --timeout=30
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/net.$netif.ifcfg
echo "DEVICE=$netif" >> /tmp/net.$netif.ifcfg
echo "ONBOOT=yes" >> /tmp/net.$netif.ifcfg
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/net.$netif.ifcfg
echo "BOOTPROTO=dhcp" >> /tmp/ifcfg/ifcfg-$netif
else
echo "BOOTPROTO=none" >> /tmp/net.$netif.ifcfg
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/net.$netif.ifcfg
echo "NETMASK=$mask" >> /tmp/net.$netif.ifcfg
[ -n "$gw" ] && echo "GATEWAY=$gw" >> /tmp/net.$netif.ifcfg
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/net.$netif.ifcfg
echo "TYPE=Ethernet" >> /tmp/net.$netif.ifcfg
echo "NAME=\"Boot Disk\"" >> /tmp/net.$netif.ifcfg
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/net.$netif.ifcfg
echo "NAME=\"Boot Disk\"" >> /tmp/net.$netif.ifcfg
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/net.$ethname.ifcfg
echo "TYPE=Ethernet" >> /tmp/net.$ethname.ifcfg
echo "ONBOOT=yes" >> /tmp/net.$ethname.ifcfg
echo "HWADDR=$(cat /sys/class/net/$ethname/address)" >> /tmp/net.$ethname.ifcfg
echo "BRIDGE=$netif" >> /tmp/net.$ethname.ifcfg
echo "NAME=$ethname" >> /tmp/net.$ethname.ifcfg
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

@@ -15,14 +15,16 @@ ask=1
if [ -n "$LUKS" ]; then
ask=0
luuid=${2##luks-}
for luks in $LUKS; do
if [ "${2##$luks}" != "$2" ]; then
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 \
@@ -34,6 +36,8 @@ fi
# mark device as asked
>> /tmp/cryptroot-asked-$2
udevsettle
unset LUKS
unset ask
unset luks

View File

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

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

View File

@@ -34,14 +34,15 @@ if [[ $hostonly ]]; then
inst ${LIBDIR}/plymouth/${PLYMOUTH_PLUGIN}.so
fi
else
for x in /usr/share/plymouth/themes/*/* ; do
for x in /usr/share/plymouth/themes/{text,details}/* ; do
[[ -f "$x" ]] || continue
THEME_DIR=$(dirname "$x")
mkdir -p "${initdir}/$THEME_DIR"
dracut_install "$x"
done
for x in ${LIBDIR}/plymouth/*.so ; do
for x in ${LIBDIR}/plymouth/{text,details}.so ; do
[[ -f "$x" ]] || continue
[[ "$x" != "${x%%/label.so}" ]] && continue
dracut_install "$x"
done
(

View File

@@ -1,18 +1,22 @@
#!/bin/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 ! getarg rd_NO_PLYMOUTH; then
[ -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
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
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
/bin/plymouth --show-splash 2>&1 | vinfo
info "Starting plymouth daemon"
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session
/bin/plymouth --show-splash 2>&1 | vinfo
fi
# vim:ts=8:sw=4:sts=4:et

View File

@@ -7,6 +7,6 @@
SUBSYSTEM!="block", GOTO="luks_end"
ACTION!="add|change", GOTO="luks_end"
ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue --onetime /sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue --unique --onetime --name cryptroot-ask-%k /sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
LABEL="luks_end"

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# if cryptsetup is not installed, then we cannot support encrypted devices.
which cryptsetup >/dev/null 2>&1 || exit 1
@@ -6,8 +6,21 @@ which cryptsetup >/dev/null 2>&1 || exit 1
# hostonly checking should only return true if root is on a LUKS device
# in some way, but I am too lazy to figure out how to do that.
# Instead, fail if we do not have a LUKS device in use somewhere.
if [ "$1" = "-h" ] ; then
blkid | grep -q crypt_LUKS || exit 1
fi
. $dracutfunctions
is_crypt() { [[ $(get_fs_type /dev/block/$1) = crypto_LUKS ]]; }
[[ $1 = '-h' ]] && {
rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
# root lives on a block device, so we can be more precise about
# hostonly checking
check_block_and_slaves is_crypt "$rootdev" || exit 1
else
# root is not on a block device, use the shotgun approach
blkid | grep -q crypt_LUKS || exit 1
fi
}
exit 0

View File

@@ -0,0 +1,4 @@
# close everything which is not busy
for i in /dev/mapper/luks-*; do
cryptsetup luksClose $i >/dev/null 2>&1
done

View File

@@ -15,22 +15,24 @@ ask=1
if [ -n "$LUKS" ]; then
ask=0
luuid=${2##luks-}
for luks in $LUKS; do
if [ "${2##$luks}" != "$2" ]; then
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;
echo -n "$1 is password protected "
/sbin/cryptsetup luksOpen -T1 $1 $2
/sbin/cryptsetup luksOpen -T1 $1 $2
} 9>/.console.lock
fi
# mark device as asked
>> /tmp/cryptroot-asked-$2
exit 0
exit 0

View File

@@ -3,3 +3,5 @@ inst cryptsetup
inst_rules "$moddir/70-luks.rules"
inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
inst_hook cmdline 30 "$moddir/parse-crypt.sh"
inst_hook pre-pivot 30 "$moddir/crypt-cleanup.sh"
inst_hook pre-pivot 31 "$moddir/crypt-cleanup.sh"

View File

@@ -1,5 +1,3 @@
initrdargs="$initrdargs rd_NO_LUKS rd_LUKS_UUID"
if getarg rd_NO_LUKS; then
info "rd_NO_LUKS: removing cryptoluks activation"
rm -f /etc/udev/rules.d/70-luks.rules

View File

@@ -6,14 +6,19 @@ SUBSYSTEM!="block", GOTO="dm_end"
ACTION!="add|change", GOTO="dm_end"
ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="dm_end"
ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}!="?*", GOTO="dm_end"
ENV{ID_FS_TYPE}!="*_raid_member", , GOTO="dm_end"
TEST=="/tmp/.dmraid_scan-%k", GOTO="dm_end"
RUN+="/bin/sh -c '>/tmp/.dmraid_scan-%k; /bin/ln -fs /sbin/dmraid_scan /initqueue/dmraid_scan.sh'"
ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}!="?*", GOTO="dm_end"
ENV{rd_NO_DM}=="?*", GOTO="dm_end"
PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/dm-[0-9]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
GOTO="dm_end"
ENV{DEVTYPE}!="partition", \
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
RUN+="/sbin/initqueue --onetime --unique --settled /sbin/dmraid_scan"
LABEL="dm_end"

View File

@@ -4,11 +4,22 @@
# in trying to support it in the initramfs.
which dmraid >/dev/null 2>&1 || exit 1
# Hostonly checking should really fail if the root device is not on a
# dmraid volume. I am lazy. Therefore, fail the hostonly check only
# if we are not using dmraid right now.
if [[ $1 = -h ]]; then
dmraid -r | grep -q ok || exit 1
fi
. $dracutfunctions
[[ $debug ]] && set -x
is_dmraid() { get_fs_type /dev/block/$1 |grep -v linux_raid_member | \
grep -q _raid_member; }
[[ $1 = '-h' ]] && {
rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
# root lives on a block device, so we can be more precise about
# hostonly checking
check_block_and_slaves is_dmraid "$rootdev" || exit 1
else
# root is not on a block device, use the shotgun approach
dmraid -r | grep -q ok || exit 1
fi
}
exit 0

View File

@@ -0,0 +1,2 @@
# close everything which is not busy
dmraid -an >/dev/null 2>&1

View File

@@ -1,26 +1,37 @@
#!/bin/sh
if $UDEV_QUEUE_EMPTY >/dev/null 2>&1; then
[ -h "$job" ] && rm -f "$job"
DM_RAIDS=$(getargs rd_DM_UUID=)
# run dmraid if udev has settled
info "Scanning for dmraid devices $DM_RAIDS"
if [ -n "$DM_RAIDS" ]; then
# only activate specified DM RAIDS
SETS=$(dmraid -c -s)
info "Found dmraid sets:"
echo $SETS|vinfo
for r in $DM_RAIDS; do
for s in $SETS; do
if [ "${s##$r}" != "$s" ]; then
info "Activating $s"
dmraid -ay $s 2>&1 | vinfo
fi
done
done
else
# scan and activate all DM RAIDS
dmraid -ay 2>&1 | vinfo
fi
. /lib/dracut-lib.sh
DM_RAIDS=$(getargs rd_DM_UUID=)
# run dmraid if udev has settled
info "Scanning for dmraid devices $DM_RAIDS"
SETS=$(dmraid -c -s)
if [ "$SETS" = "no raid disks" ]; then
return
fi
info "Found dmraid sets:"
echo $SETS|vinfo
if [ -n "$DM_RAIDS" ]; then
# only activate specified DM RAIDS
for r in $DM_RAIDS; do
for s in $SETS; do
if [ "${s##$r}" != "$s" ]; then
info "Activating $s"
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
[ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" 2>&1 | vinfo
udevsettle
fi
done
done
else
# scan and activate all DM RAIDS
for s in $SETS; do
info "Activating $s"
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
[ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" 2>&1 | vinfo
done
fi

View File

@@ -1,5 +1,13 @@
#!/bin/bash
dracut_install dmraid partx
dracut_install dmraid partx kpartx
inst "$moddir/dmraid.sh" /sbin/dmraid_scan
inst_rules 64-md-raid.rules
if [ ! -x /lib/udev/vol_id ]; then
inst_rules 64-md-raid.rules
fi
inst_rules "$moddir/61-dmraid-imsm.rules"
inst_hook pre-pivot 30 "$moddir/dmraid-cleanup.sh"
inst_hook pre-pivot 31 "$moddir/dmraid-cleanup.sh"
inst_hook pre-trigger 30 "$moddir/parse-dm.sh"

View File

@@ -1,6 +1,4 @@
initrdargs="$initrdargs rd_DM_UUID rd_NO_DM"
if getarg rd_NO_DM; then
info "rd_NO_DM: removing DM RAID activation"
rm /etc/udev/rules.d/61-dmraid*.rules
fi
udevproperty rd_NO_DM=1
fi

View File

@@ -1,5 +0,0 @@
#!/bin/sh
[ -x /lib/udev/devkit-disks-dm-export ] || exit 1
exit 0

View File

@@ -1,8 +0,0 @@
#!/bin/bash
# FIXME: would be nice if we didn't have to know which rules to grab....
# ultimately, /lib/initramfs/rules.d or somesuch which includes links/copies
# of the rules we want so that we just copy those in would be best
dracut_install /lib/udev/devkit-disks-dm-export /lib/udev/devkit-disks-part-id
inst_rules 95-devkit-disks.rules

12
modules.d/90dmsquash-live/check Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
# if dmsetup is not installed, then we cannot support fedora/red hat
# style live images
which dmsetup >/dev/null 2>&1 || exit 1
# a live host-only image doesn't really make a lot of sense
if [ "$1" = "-h" ] ; then
exit 1
fi
exit 0

View File

@@ -0,0 +1,13 @@
if [ "${root%%:*}" = "live" ]; then
(
printf 'KERNEL=="%s", SYMLINK+="live"\n' \
${root#live:/dev/}
printf 'SYMLINK=="%s", SYMLINK+="live"\n' \
${root#live:/dev/}
printf 'KERNEL=="%s", RUN+="/sbin/initqueue --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
${root#live:/dev/}
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
${root#live:/dev/}
) >> /etc/udev/rules.d/99-live-mount.rules
fi

View File

@@ -0,0 +1,177 @@
#!/bin/sh
. /lib/dracut-lib.sh
[ -f /tmp/root.info ] && . /tmp/root.info
PATH=$PATH:/sbin:/usr/sbin
if getarg rdlivedebug; then
exec > /tmp/liveroot.$$.out
exec 2>> /tmp/liveroot.$$.out
set -x
fi
[ -z "$1" ] && exit 1
livedev="$1"
# parse various live image specific options that make sense to be
# specified as their own things
live_dir=$(getarg live_dir)
[ -z "$live_dir" ] && live_dir="LiveOS"
getarg live_ram && live_ram="yes"
getarg reset_overlay && reset_overlay="yes"
overlay=$(getarg overlay)
# FIXME: we need to be able to hide the plymouth splash for the check really
[ -e $livedev ] & fs=$(blkid -s TYPE -o value $livedev)
if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
check="yes"
fi
getarg check || check=""
if [ -n "$check" ]; then
checkisomd5 --verbose $livedev || :
if [ $? -ne 0 ]; then
echo "CD check failed!"
exit 1
fi
fi
getarg ro && liverw=ro
getarg rw && liverw=rw
[ -z "$liverw" ] && liverw=ro
# mount the backing of the live image first
mount -n -t $fstype -o $liverw $livedev $NEWROOT
RES=$?
if [ "$RES" != "0" ]; then
echo "Failed to mount block device of live image"
exit 1
fi
# overlay setup helper function
do_live_overlay() {
# create a sparse file for the overlay
# overlay: if non-ram overlay searching is desired, do it,
# otherwise, create traditional overlay in ram
OVERLAY_LOOPDEV=$( losetup -f )
l=$(blkid -s LABEL -o value $livedev) || l=""
u=$(blkid -s UUID -o value $livedev) || u=""
if [ -z "$overlay" ]; then
pathspec="/${live_dir}/overlay-$l-$u"
elif ( echo $overlay | grep -q ":" ); then
# pathspec specified, extract
pathspec=$( echo $overlay | sed -e 's/^.*://' )
fi
if [ -z "$pathspec" -o "$pathspec" = "auto" ]; then
pathspec="/${live_dir}/overlay-$l-$u"
fi
devspec=$( echo $overlay | sed -e 's/:.*$//' )
# need to know where to look for the overlay
setup=""
if [ -n "$devspec" -a -n "$pathspec" -a -n "$overlay" ]; then
mkdir /overlayfs
mount -n -t auto $devspec /overlayfs || :
if [ -f /overlayfs$pathspec -a -w /overlayfs$pathspec ]; then
losetup $OVERLAY_LOOPDEV /overlayfs$pathspec
if [ -n "$reset_overlay" ]; then
dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k count=1 2>/dev/null
fi
setup="yes"
fi
umount -l /overlayfs || :
fi
if [ -z "$setup" ]; then
if [ -n "$devspec" -a -n "$pathspec" ]; then
echo "Unable to find persistent overlay; using temporary"
sleep 5
fi
dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((512*1024)) 2> /dev/null
losetup $OVERLAY_LOOPDEV /overlay
fi
# set up the snapshot
echo 0 `blockdev --getsize $BASE_LOOPDEV` snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create live-rw
}
# live cd helper function
do_live_from_base_loop() {
do_live_overlay
}
# we might have a genMinInstDelta delta file for anaconda to take advantage of
if [ -e $NEWROOT/${live_dir}/osmin.img ]; then
OSMINSQFS=$NEWROOT/${live_dir}/osmin.img
fi
if [ -n "$OSMINSQFS" ]; then
# decompress the delta data
dd if=$OSMINSQFS of=/osmin.img 2> /dev/null
OSMIN_SQUASHED_LOOPDEV=$( losetup -f )
losetup -r $OSMIN_SQUASHED_LOOPDEV /osmin.img
mkdir -p /squashfs.osmin
mount -n -t squashfs -o ro $OSMIN_SQUASHED_LOOPDEV /squashfs.osmin
OSMIN_LOOPDEV=$( losetup -f )
losetup -r $OSMIN_LOOPDEV /squashfs.osmin/osmin
umount -l /squashfs.osmin
fi
# we might have just an embedded ext3 to use as rootfs (uncompressed live)
if [ -e $NEWROOT/${live_dir}/ext3fs.img ]; then
EXT3FS="$NEWROOT/${live_dir}/ext3fs.img"
fi
if [ -n "$EXT3FS" ] ; then
BASE_LOOPDEV=$( losetup -f )
losetup -r $BASE_LOOPDEV $EXT3FS
umount -l $NEWROOT
do_live_from_base_loop
fi
# we might have an embedded ext3 on squashfs to use as rootfs (compressed live)
if [ -e $NEWROOT/${live_dir}/squashfs.img ]; then
SQUASHED="$NEWROOT/${live_dir}/squashfs.img"
fi
if [ -e "$SQUASHED" ] ; then
if [ -n "$live_ram" ] ; then
echo "Copying live image to RAM..."
echo "(this may take a few minutes)"
dd if=$SQUASHED of=/squashed.img bs=512 2> /dev/null
umount -n $NEWROOT
echo "Done copying live image to RAM."
eject -p $livedev || :
SQUASHED="/squashed.img"
fi
SQUASHED_LOOPDEV=$( losetup -f )
losetup -r $SQUASHED_LOOPDEV $SQUASHED
mkdir -p /squashfs
mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /squashfs
BASE_LOOPDEV=$( losetup -f )
losetup -r $BASE_LOOPDEV /squashfs/LiveOS/ext3fs.img
umount -l /squashfs
if [ -z "$live_ram" ] ; then
umount -l $NEWROOT
fi
do_live_from_base_loop
fi
if [ -b "$OSMIN_LOOPDEV" ]; then
# set up the devicemapper snapshot device, which will merge
# the normal live fs image, and the delta, into a minimzied fs image
echo "0 $( blockdev --getsize $BASE_LOOPDEV ) snapshot $BASE_LOOPDEV $OSMIN_LOOPDEV p 8" | dmsetup create --readonly live-osimg-min
fi
ln -s /dev/mapper/live-rw /dev/root
printf '/bin/mount /dev/mapper/live-rw %s\n' "$NEWROOT" > /mount/01-$$-live.sh
exit 0

View File

@@ -0,0 +1,21 @@
#!/bin/bash
dracut_install umount
inst dmsetup
inst blkid
inst dd
inst losetup
# eject might be a symlink to consolehelper
if [ -L /usr/bin/eject ]; then
dracut_install /usr/sbin/eject
else
inst eject
fi
inst blockdev
which checkisomd5 >/dev/null 2>&1 && inst checkisomd5
inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
inst_hook pre-udev 30 "$moddir/dmsquash-live-genrules.sh"
inst "$moddir/dmsquash-live-root" "/sbin/dmsquash-live-root"
# should probably just be generally included
inst_rules 60-cdrom_id.rules

View File

@@ -0,0 +1,40 @@
# live images are specified with
# root=live:backingdev
[ -z "$root" ] && root=$(getarg root=)
# support legacy syntax of passing liveimg and then just the base root
if getarg liveimg; then
liveroot="live:$root"
fi
if [ "${root%%:*}" = "live" ] ; then
liveroot=$root
fi
[ "${liveroot%%:*}" = "live" ] || return
case "$liveroot" in
live:LABEL=*|LABEL=*)
root="${root#live:}"
root="$(echo $root | sed 's,/,\\x2f,g')"
root="live:/dev/disk/by-label/${root#LABEL=}"
rootok=1 ;;
live:CDLABEL=*|CDLABEL=*)
root="${root#live:}"
root="$(echo $root | sed 's,/,\\x2f,g')"
root="live:/dev/disk/by-label/${root#CDLABEL=}"
rootok=1 ;;
live:UUID=*|UUID=*)
root="${root#live:}"
root="live:/dev/disk/by-uuid/${root#UUID=}"
rootok=1 ;;
/dev/*)
root="live:${root}"
rootok=1 ;;
esac
echo "root was $root, liveroot is now $liveroot"
# make sure that init doesn't complain
[ -z "$root" ] && root="live"

View File

@@ -1,11 +1,23 @@
#!/bin/bash
if [ -z "$drivers" ]; then
drivers="sd_mod =fs"
# Include block controller drivers
for modname in $(find "$srcmods/kernel/drivers" -name '*.ko'); do
if nm -uPA $modname | egrep -q 'ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register'; then
drivers="${drivers} $modname"
if [[ -z $drivers ]]; then
block_module_test() {
local blockfuncs='ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device'
nm -uPA "$1" | egrep -q "$blockfuncs"
}
instmods pcmcia sd_mod $(filter_kernel_modules block_module_test) "=drivers/pcmcia"
# if not on hostonly mode, install all known filesystems.
if [[ $hostonly = '' ]]; then
instmods '=fs'
else
instmods $(get_fs_type "/dev/block/$(find_root_block_device)")
fi
done
# hardcoded list of exceptions
rm -fr ${initdir}/lib/modules/*/kernel/fs/ocfs2
else
instmods $drivers
fi
instmods $drivers
[[ $add_drivers ]] && instmods $add_drivers
instmods scsi_wait_scan

View File

@@ -1,22 +0,0 @@
# hacky rules to try to activate lvm when we get new block devs...
#
# Copyright 2008, Red Hat, Inc.
# Jeremy Katz <katzj@redhat.com>
SUBSYSTEM!="block", GOTO="lvm_end"
ACTION!="add|change", GOTO="lvm_end"
KERNEL=="dm-[0-9]*", IMPORT{program}="vol_id --export $tempnode"
KERNEL=="md[0-9]*|md/*", IMPORT{program}="vol_id --export $tempnode"
ENV{ID_FS_TYPE}=="LVM2_member", \
TEST!="/tmp/.lvm_scan-%k", \
RUN+="/bin/sh -c '>/tmp/.lvm_scan-%k; /bin/ln -fs /sbin/lvm_scan /initqueue/lvm_scan.sh'"
OPTIONS="link_priority=-100"
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
LABEL="lvm_end"

View File

@@ -6,17 +6,14 @@
SUBSYSTEM!="block", GOTO="lvm_end"
ACTION!="add|change", GOTO="lvm_end"
KERNEL=="dm-[0-9]*", ACTION=="add", GOTO="lvm_end"
ENV{ID_FS_TYPE}!="LVM2_member", GOTO="lvm_end"
KERNEL=="dm-[0-9]*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
KERNEL=="md[0-9]*|md/*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
ENV{ID_FS_TYPE}=="LVM2_member", \
TEST!="/tmp/.lvm_scan-%k", \
RUN+="/bin/sh -c '>/tmp/.lvm_scan-%k; /bin/ln -fs /sbin/lvm_scan /initqueue/lvm_scan.sh'"
OPTIONS="link_priority=-100"
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/dm-[0-9]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
GOTO="lvm_end"
RUN+="/sbin/initqueue --settled --onetime --unique /sbin/lvm_scan"
RUN+="/bin/sh -c '>/tmp/.lvm_scan-%k;'"
LABEL="lvm_end"

View File

@@ -1,13 +1,23 @@
#!/bin/sh
#!/bin/bash
# No point trying to support lvm if the binaries are missing
which lvm >/dev/null 2>&1 || exit 1
# We should really just check to see if root is on a logical volume
# when running in hostonly mode. I am lazy. Therefore, fail the hostonly
# check unless there is a logical volume in use somewhere.
if [ "$1" = "-H" ] || [ "$1" = "--hostonly" ]; then
blkid | grep -q lvm2pv || exit 1
fi
. $dracutfunctions
[[ $debug ]] && set -x
is_lvm() { [[ $(get_fs_type /dev/block/$1) = LVM2_member ]]; }
[[ $1 = '-h' ]] && {
rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
# root lives on a block device, so we can be more precise about
# hostonly checking
check_block_and_slaves is_lvm "$rootdev" || exit 1
else
# root is not on a block device, use the shotgun approach
blkid | grep -q LVM2_member || exit 1
fi
}
exit 0

View File

@@ -1,10 +1,7 @@
#!/bin/bash
inst lvm
if [ -x /lib/udev/vol_id ]; then
inst_rules "$moddir/64-lvm-vol_id.rules" 64-device-mapper.rules
else
inst_rules "$moddir/64-lvm.rules" 64-device-mapper.rules
fi
inst_rules "$moddir/64-lvm.rules" 64-lvm.rules
if [[ $hostonly ]]; then
[ -f /etc/lvm/lvm.conf ] && inst /etc/lvm/lvm.conf
@@ -12,3 +9,5 @@ fi
inst "$moddir/lvm_scan.sh" /sbin/lvm_scan
inst_hook cmdline 30 "$moddir/parse-lvm.sh"
inst_hook pre-pivot 30 "$moddir/lvm-cleanup.sh"
inst_hook pre-pivot 31 "$moddir/lvm-cleanup.sh"

2
modules.d/90lvm/lvm-cleanup.sh Executable file
View File

@@ -0,0 +1,2 @@
# stop everything which is not busy
lvm vgchange -a n >/dev/null 2>&1

View File

@@ -1,37 +1,35 @@
#!/bin/sh
if $UDEV_QUEUE_EMPTY >/dev/null 2>&1; then
[ -h "$job" ] && rm -f "$job"
# run lvm scan if udev has settled
# run lvm scan if udev has settled
VGS=$(getargs rd_LVM_VG=)
. /lib/dracut-lib.sh
[ -d /etc/lvm ] || mkdir -p /etc/lvm
# build a list of devices to scan
lvmdevs=$(
for f in /tmp/.lvm_scan-*; do
[ -e "$f" ] || continue
echo -n "${f##/tmp/.lvm_scan-} "
done
)
VGS=$(getargs rd_LVM_VG=)
if [ ! -e /etc/lvm/lvm.conf ]; then
{
echo 'devices {';
echo -n ' filter = [ '
for dev in $lvmdevs; do
printf '"a|^/dev/%s$|", ' $dev;
done;
echo '"r/.*/" ]';
echo 'types = [ "blkext", 1024 ]'
echo '}';
} > /etc/lvm/lvm.conf
lvmwritten=1
fi
info "Scanning devices $lvmdevs for LVM volume groups $VGS"
lvm vgscan 2>&1 | vinfo
lvm vgchange -ay $VGS 2>&1 | vinfo
[ "$lvmwritten" ] && rm -f /etc/lvm/lvm.conf
unset lvmwritten
[ -d /etc/lvm ] || mkdir -p /etc/lvm
# build a list of devices to scan
lvmdevs=$(
for f in /tmp/.lvm_scan-*; do
[ -e "$f" ] || continue
echo -n "${f##/tmp/.lvm_scan-} "
done
)
if [ ! -e /etc/lvm/lvm.conf ]; then
{
echo 'devices {';
echo -n ' filter = [ '
for dev in $lvmdevs; do
printf '"a|^/dev/%s$|", ' $dev;
done;
echo '"r/.*/" ]';
echo 'types = [ "blkext", 1024 , "cciss0", 1024 ]'
echo '}';
} > /etc/lvm/lvm.conf
lvmwritten=1
fi
info "Scanning devices $lvmdevs for LVM volume groups $VGS"
lvm vgscan 2>&1 | vinfo
lvm vgchange -ay $VGS 2>&1 | vinfo
[ "$lvmwritten" ] && rm -f /etc/lvm/lvm.conf
unset lvmwritten

View File

@@ -1,5 +1,3 @@
initrdargs="$initrdargs rd_NO_LVM rd_LVM_VG"
if getarg rd_NO_LVM; then
info "rd_NO_LVM: removing LVM activation"
rm -f /etc/udev/rules.d/64-lvm*.rules

View File

@@ -1 +0,0 @@
SUBSYSTEM=="block", ACTION=="add|change", KERNEL=="md[0-9]*|md_d[0-9]*|md/*", IMPORT{program}="vol_id --export $tempnode"

View File

@@ -2,24 +2,84 @@
# automatically cause mdadm to be run.
# See udev(8) for syntax
ACTION!="add", GOTO="md_inc_end"
ACTION!="add|change", GOTO="md_inc_end"
SUBSYSTEM!="block", GOTO="md_inc_end"
ENV{ID_FS_TYPE}!="linux_raid_member|isw_raid_member", GOTO="md_inc_end"
ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}=="?*", GOTO="md_inc_end"
TEST=="/tmp/.mdraid_start-%k", GOTO="md_inc_end"
ENV{rd_NO_MD}=="?*", GOTO="md_inc_end"
IMPORT{program}="/sbin/mdadm --examine --export $tempnode"
PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/md[0-9]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
GOTO="md_inc_end"
ENV{DEVTYPE}!="partition", \
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
KERNEL!="md*", IMPORT{program}="/sbin/mdadm --examine --export $tempnode"
# UUID CHECK
LABEL="do_md_inc"
ENV{DEVTYPE}!="partition", \
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
#
# if rd_MDADMCONF do not assemble incrementally
# defer auto assembly until the udev queue is settled
#
ENV{rd_MDADMCONF}!="?*", GOTO="md_auto_end"
RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdadm_auto'"
GOTO="md_inc_end"
LABEL="md_auto_end"
#
# Incrementally build the md array
#
RUN+="/sbin/mdadm -I --no-degraded $env{DEVNAME}"
RUN+="/bin/sh -c '>/tmp/.mdraid_start-%k; /bin/ln -s /sbin/mdraid_start /initqueue/mdraid_start.sh'"
RUN+="/bin/ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh"
LABEL="md_inc_end"
#
# Handle non-container raid arrays
#
ACTION=="add|change", \
KERNEL=="md[0-9]*|md/*", \
ENV{MD_LEVEL}!="container", \
ENV{MD_CONTAINER}!="?*", \
ENV{rd_MDADMCONF}!="?*", \
ENV{rd_NO_MD}!="?*", \
GOTO="do_raidstart"
GOTO="end_raidstart"
LABEL="do_raidstart"
# check if array is not inactive anymore
TEST=="md/array_state", ATTR{md/array_state}!="|inactive", GOTO="end_raidstart"
RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdraid_start'"
LABEL="end_raidstart"
#
# Handle container raid arrays
#
ACTION=="add|change", \
KERNEL=="md[0-9]*|md/*", \
ENV{DEVTYPE}!="partition", \
ENV{MD_LEVEL}=="container", \
ENV{rd_MDADMCONF}!="?*", \
ENV{rd_NO_MD}!="?*", \
GOTO="do_container"
GOTO="end_container"
LABEL="do_container"
RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique --name mdcontainer_start-%k /sbin/mdcontainer_start $env{DEVNAME}'"
LABEL="end_container"

View File

@@ -3,11 +3,21 @@
# No mdadm? No mdraid support.
which mdadm >/dev/null 2>&1 || exit 1
# We were asked to run in hostonly mode, so pass the check only if there
# is an mdraid volume in use somewhere. This should really check to see if
# root is on an mdraid volume only, but I am lazy.
if [[ $1 = -h ]]; then
blkid | grep -q linux_raid || exit 1
fi
. $dracutfunctions
[[ $debug ]] && set -x
is_mdraid() { get_fs_type /dev/block/$1 |egrep -q '(linux|isw)_raid'; }
[[ $1 = '-h' ]] && {
rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
# root lives on a block device, so we can be more precise about
# hostonly checking
check_block_and_slaves is_mdraid "$rootdev" || exit 1
else
# root is not on a block device, use the shotgun approach
blkid | grep -q linux_raid || exit 1
fi
}
exit 0

View File

@@ -1,6 +1,6 @@
#!/bin/bash
dracut_install mdadm partx
dracut_install mdadm partx
# XXX: mdmon really needs to run as non-root?
@@ -11,9 +11,7 @@ dracut_install mdadm partx
# inst /etc/passwd
# inst /etc/group
if [ -x /lib/udev/vol_id ]; then
inst_rules "$moddir/61-mdadm.rules"
else
if [ ! -x /lib/udev/vol_id ]; then
inst_rules 64-md-raid.rules
fi
@@ -23,15 +21,20 @@ if ! mdadm -Q -e imsm /dev/null &> /dev/null; then
inst_hook pre-trigger 30 "$moddir/md-noimsm.sh"
fi
if [[ $hostonly ]]; then
if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then
[ -f /etc/mdadm/mdadm.conf ] && inst /etc/mdadm/mdadm.conf /etc/mdadm.conf
[ -f /etc/mdadm.conf ] && inst /etc/mdadm.conf
fi
if [ -x /sbin/mdmon ] ; then
dracut_install mdmon
inst_hook pre-pivot 30 "$moddir/mdmon-pre-pivot.sh"
fi
inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh"
inst "$moddir/mdraid_start.sh" /sbin/mdraid_start
inst "$moddir/mdcontainer_start.sh" /sbin/mdcontainer_start
inst "$moddir/mdadm_auto.sh" /sbin/mdadm_auto
inst "$moddir/md_finished.sh" /sbin/md_finished.sh
inst_hook pre-trigger 30 "$moddir/parse-md.sh"
inst_hook pre-pivot 30 "$moddir/mdraid-cleanup.sh"
inst_hook pre-pivot 31 "$moddir/mdraid-cleanup.sh"

View File

@@ -1,2 +1,2 @@
info "rd_NO_MDIMSM: no MD RAID for imsm/isw raids"
udevadm control --property=rd_NO_MDIMSM=1
udevproperty rd_NO_MDIMSM=1

View File

@@ -0,0 +1,7 @@
for f in /initqueue-settled/mdcontainer_start* /initqueue-settled/mdraid_start* /initqueue-settled/mdadm_auto*; do
[ -e $f ] && return 1
done
$UDEV_QUEUE_EMPTY >/dev/null 2>&1 || return 1
return 0

View File

@@ -0,0 +1,7 @@
#!/bin/sh
. /lib/dracut-lib.sh
info "Autoassembling MD Raid"
udevadm control --stop-exec-queue
/sbin/mdadm -As --auto=yes --run 2>&1 | vinfo
udevadm control --start-exec-queue

View File

@@ -0,0 +1,8 @@
#!/bin/sh
. /lib/dracut-lib.sh
md=$1
udevadm control --stop-exec-queue
# and activate any containers
mdadm -IR $md 2>&1 | vinfo
udevadm control --start-exec-queue

View File

@@ -1,3 +0,0 @@
# switch any mdmon instances to newroot
[ -f /etc/mdadm.conf ] && /sbin/mdmon /proc/mdstat $NEWROOT

View File

@@ -0,0 +1,4 @@
# save state dir for mdmon/mdadm for the real root
mkdir /dev/.mdadm
[ -e /var/run/mdadm ] && rm -fr /var/run/mdadm
ln -s /dev/.mdadm /var/run/mdadm

View File

@@ -0,0 +1,15 @@
# stop everything which is not busy
for i in /dev/md* /dev/md/*; do
[ -b $i ] || continue
mddetail=$(udevadm info --query=property --name=$i)
case "$mddetail" in
*MD_LEVEL=container*)
;;
*DEVTYPE=partition*)
;;
*)
mdadm --stop $i >/dev/null 2>&1
;;
esac
done

View File

@@ -1,18 +1,8 @@
#!/bin/sh
if $UDEV_QUEUE_EMPTY >/dev/null 2>&1; then
[ -h "$job" ] && rm -f "$job"
# run mdadm if udev has settled
info "Assembling MD RAID arrays"
# and activate any containers
for md in /dev/md?*; do
case $md in
/dev/md*p*) ;;
*)
info "Starting MD RAID array $md"
mdadm -R $md 2>&1 | vinfo
mdadm -IR $md 2>&1 | vinfo
esac
done
fi
. /lib/dracut-lib.sh
# run mdadm if udev has settled
info "Assembling MD RAID arrays"
udevadm control --stop-exec-queue
mdadm -IRs 2>&1 | vinfo
udevadm control --start-exec-queue

View File

@@ -1,8 +1,6 @@
initrdargs="$initrdargs rd_MD_UUID rd_NO_MD rd_NO_MDIMSM"
if getarg rd_NO_MD; then
info "rd_NO_MD: removing MD RAID activation"
rm /etc/udev/rules.d/65-md-incremental*.rules
udevproperty rd_NO_MD=1
else
MD_UUID=$(getargs rd_MD_UUID=)
@@ -12,7 +10,7 @@ else
[ -e "$f" ] || continue
mv $f ${f}.bak
while read line; do
if [ "${line/UUID CHECK//}" != "$line" ]; then
if [ "${line%%UUID CHECK}" != "$line" ]; then
for uuid in $MD_UUID; do
printf 'ENV{MD_UUID}=="%s", GOTO="do_md_inc"\n' $uuid
done;
@@ -26,7 +24,13 @@ else
fi
fi
if [ -e /etc/mdadm.conf ] && ! getarg rd_NO_MDADMCONF; then
udevproperty rd_MDADMCONF=1
rm -f /pre-pivot/*mdraid-cleanup.sh
fi
if getarg rd_NO_MDIMSM; then
info "rd_NO_MDIMSM: no MD RAID for imsm/isw raids"
udevadm control --property=rd_NO_MDIMSM=1
fi
udevproperty rd_NO_MDIMSM=1
fi

View File

@@ -1,3 +1,3 @@
#!/bin/bash
dracut_install -o ps grep more cat rm strace free showmount
dracut_install -o ping netstat rpcinfo
dracut_install -o ping netstat rpcinfo vi scp

11
modules.d/95fcoe/check Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
# We depend on network modules being loaded
[ "$1" = "-d" ] && echo network
# FIXME
# If hostonly was requested, fail the check until we have some way of
# knowing we are booting from FCoE
[ "$1" = "-h" ] && exit 1
exit 0

View File

@@ -0,0 +1,14 @@
#!/bin/sh
# We use (fcoe_interface or fcoe_mac) and fcoe_dcb as set by parse-fcoe.sh
# If neither mac nor interface are set we don't continue
[ -z "$fcoe_interface" -a -z "$fcoe_mac" ] && return
# Write udev rules
{
if [ -n "$fcoe_mac" ] ; then
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/fcoe-up $env{INTERFACE} %s"\n' "$fcoe_mac" "$fcoe_dcb"
else
printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/fcoe-up $env{INTERFACE} %s"\n' "$fcoe_interface" "$fcoe_dcb"
fi
} > /etc/udev/rules.d/60-fcoe.rules

16
modules.d/95fcoe/fcoe-up Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/sh
#
# We get called like this:
# /sbin/fcoe-up <network-device> <dcb|nodcb>
#
# Note currently only nodcb is supported, the dcb option is reserved for
# future use.
# Huh? Missing arguments ??
[ -z "$1" -o -z "$2" ] && exit 1
netif=$1
dcb=$2
/sbin/ip link set "$netif" up
echo -n "$netif" > /sys/module/fcoe/parameters/create

7
modules.d/95fcoe/install Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
dracut_install ip
inst "$moddir/fcoe-up" "/sbin/fcoe-up"
inst_hook pre-udev 60 "$moddir/fcoe-genrules.sh"
inst_hook cmdline 99 "$moddir/parse-fcoe.sh"

2
modules.d/95fcoe/installkernel Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
instmods fcoe

48
modules.d/95fcoe/parse-fcoe.sh Executable file
View File

@@ -0,0 +1,48 @@
#!/bin/sh
#
# Supported formats:
# fcoe=<networkdevice>:<dcb|nodcb>
# fcoe=<macaddress>:<dcb|nodcb>
#
# Note currently only nodcb is supported, the dcb option is reserved for
# future use.
#
# Note letters in the macaddress must be lowercase!
#
# Examples:
# fcoe=eth0:nodcb
# fcoe=4a:3f:4c:04:f8:d7:nodcb
[ -z "$fcoe" ] && fcoe=$(getarg fcoe=)
# If it's not set we don't continue
[ -z "$fcoe" ] && return
parse_fcoe_opts() {
local IFS=:
set $fcoe
case $# in
2)
fcoe_interface=$1
fcoe_dcb=$2
;;
7)
fcoe_mac=$1:$2:$3:$4:$5:$6
fcoe_dcb=$7
;;
*)
die "Invalid arguments for fcoe="
;;
esac
}
parse_fcoe_opts
# currently only nodcb is supported
if [ "$fcoe_dcb" != "nodcb" ] ; then
die "Invalid FCoE DCB option: $fcoe_dcb"
fi
# FCoE actually supported?
[ -e /sys/module/fcoe/parameters/create ] || modprobe fcoe || die "FCoE requested but kernel/initrd does not support FCoE"

View File

@@ -1,11 +1,35 @@
#!/bin/sh
#!/bin/bash
# We depend on network modules being loaded
[ "$1" = "-d" ] && echo network
# If hostonly was requested, fail the check if we are not actually
# booting from root.
#[ "$1" = "-h" ] && ! egrep -q '/ /dev/nbd[0-9]*' /proc/mounts && exit 1
# If our prerequisites are not met, fail anyways.
which iscsistart hostname iscsi-iname >/dev/null 2>&1 || exit 1
# If hostonly was requested, fail the check if we are not actually
# booting from root.
. $dracutfunctions
[[ $debug ]] && set -x
is_iscsi() (
[[ -L /sys/dev/block/$1 ]] || return
cd "$(readlink -f /sys/dev/block/$1)"
until [[ -d sys || -d iscsi_session ]]; do
cd ..
done
[[ -d iscsi_session ]]
)
case $1 in
-h) rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
# root lives on a block device, so we can be more precise about
# hostonly checking
check_block_and_slaves is_iscsi "$rootdev" || exit 1
else
exit 1
fi ;;
esac
exit 0

View File

@@ -1,2 +1,2 @@
#!/bin/bash
instmods iscsi_tcp crc32c
instmods iscsi_tcp crc32c iscsi_ibft

View File

@@ -28,20 +28,29 @@ fi
# root is in the form root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
netif="$1"
root="$2"
iroot="$2"
source_all /etc/conf.d
# If it's not iscsi we don't continue
[ "${root%%:*}" = "iscsi" ] || exit 1
[ "${iroot%%:*}" = "iscsi" ] || exit 1
iroot=${iroot#iscsi:}
# XXX modprobe crc32c should go in the cmdline parser, but I haven't yet
# figured out a way how to check whether this is built-in or not
modprobe crc32c
[ -e /tmp/root.info ] && . /tmp/root.info
if getarg iscsi_firmware ; then
iscsistart -b
exit 0
if [ -n "${root%%block:*}" ]; then
# if root is not specified try to mount the whole iSCSI LUN
printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
fi
iscsistart -b
exit 0
fi
# override conf settings by command line options
@@ -64,15 +73,27 @@ arg=$(getarg iscsi_in_username)
arg=$(getarg iscsi_in_password)
[ -n "$arg" ] && iscsi_in_password=$arg
if [ $root = ${root#iscsi:} ]; then
iroot=$(getarg iscsiroot)
else
iroot=${root#iscsi:}
fi
# override conf/commandline options by dhcp root_path
# FIXME this assumes that all values have been provided
OLDIFS="$IFS"
IFS=@
set $iroot
if [ $# -gt 1 ]; then
authinfo=$1; shift
iroot=$*
# allow empty authinfo to allow having an @ in iscsi_target_name like this:
# netroot=iscsi:@192.168.1.100::3260::iqn.2009-01.com.example:testdi@sk
if [ -n "$authinfo" ]; then
IFS=:
set $authinfo
iscsi_username=$1
iscsi_password=$2
if [ $# -gt 2 ]; then
iscsi_in_username=$3
iscsi_in_password=$4
fi
fi
fi
IFS=:
set $iroot
iscsi_target_ip=$1; shift
@@ -124,6 +145,12 @@ if [ -n "${root%%block:*}" ]; then
printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' $iscsi_lun >> /etc/udev/rules.d/99-iscsi-root.rules
fi
# inject new exit_if_exists
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > /initqueue/iscsi-settle.sh
# force udevsettle to break
> /initqueue/work
iscsistart -i $iscsi_initiator -t $iscsi_target_name \
-g $iscsi_target_group -a $iscsi_target_ip \
-p $iscsi_target_port \

View File

@@ -53,6 +53,7 @@ fi
# iscsi_firmware does not need argument checking
if [ -n "$iscsi_firmware" ] ; then
netroot=${netroot:-iscsi}
modprobe iscsi_ibft
fi
# If it's not iscsi we don't continue
@@ -73,3 +74,6 @@ rootok=1
# Shut up init error check
[ -z "$root" ] && root="iscsi"
echo '[ -e /dev/root ]' > /initqueue-finished/iscsi.sh

View File

@@ -1,7 +0,0 @@
SUBSYSTEM!="block", GOTO="nbd_end"
ACTION!="change", GOTO="nbd_end"
KERNEL=="nbd[0-9]*", IMPORT{program}="vol_id --export $tempnode"
KERNEL=="nbd[0-9]*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
LABEL="nbd_end"

View File

@@ -1,6 +0,0 @@
SUBSYSTEM!="block", GOTO="nbd_end"
ACTION!="change", GOTO="nbd_end"
KERNEL=="nbd[0-9]*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
LABEL="nbd_end"

View File

@@ -1,11 +1,19 @@
#!/bin/sh
#!/bin/bash
# We depend on network modules being loaded
[ "$1" = "-d" ] && echo network
# If hostonly was requested, fail the check if we are not actually
# booting from root.
[ "$1" = "-h" ] && ! egrep -q '/ /dev/nbd[0-9]*' /proc/mounts && exit 1
# If our prerequisites are not met, fail anyways.
# If our prerequisites are not met, fail.
which nbd-client >/dev/null 2>&1 || exit 1
# if an nbd device is not somewhere in the chain of devices root is mounted on,
# fail the hostonly check.
[ "$1" = "-h" ] && {
is_nbd() { [[ -b /dev/block/$1 && $1 == 43:* ]] ;}
. $dracutfunctions
rootdev=$(find_root_block_device)
[[ -b /dev/block/$rootdev ]] || exit 1
check_block_and_slaves is_nbd "$rootdev" || exit 1
}
exit 0

View File

@@ -2,10 +2,4 @@
inst nbd-client
inst_hook cmdline 90 "$moddir/parse-nbdroot.sh"
if [ -x /lib/udev/vol_id ]; then
inst_rules "$moddir/61-nbd-vol_id.rules"
else
inst_rules "$moddir/61-nbd.rules"
fi
inst "$moddir/nbdroot" "/sbin/nbdroot"

View File

@@ -95,7 +95,11 @@ nbd-client $preopts "$nbdserver" "$nbdport" /dev/nbd0 $opts || exit 1
# If we didn't get a root= on the command line, then we need to
# add the udev rules for mounting the nbd0 device
if [ ! -e /etc/udev/rules.d/99-mount.rules ]; then
ln -s /dev/nbd0 /dev/root
echo 'settle_exit_if_exists="--exit-if-exists=/dev/nbd0"; [ -e /dev/nbd0 ] && { ln -s /dev/nbd0 /dev/root 2>/dev/null; rm "$job"; }' \
>> /initqueue/nbd.sh
echo '[ -e /dev/root ]' > /initqueue-finished/nbd.sh
printf '/bin/mount -t %s -o %s %s %s\n' \
"$nbdfstype" "$fsopts" /dev/nbd0 "$NEWROOT" \
> /mount/01-$$-nbd.sh
@@ -103,4 +107,6 @@ fi
# NBD doesn't emit uevents when it gets connected, so kick it
echo change > /sys/block/nbd0/uevent
# force udevsettle to break
> /initqueue/work
exit 0

View File

@@ -54,3 +54,6 @@ rootok=1
# Shut up init error check
[ -z "$root" ] && root="nbd"
echo '[ -e /dev/nbd0 ]' > /initqueue-finished/nbd.sh

View File

@@ -13,8 +13,19 @@ else
LIBDIR="/lib"
fi
dracut_install $(ls {/usr,}$LIBDIR/libnfsidmap*.so* 2>/dev/null )
dracut_install $(ls {/usr,}$LIBDIR/libnss*.so 2>/dev/null)
dracut_install $(ls {/usr,}$LIBDIR/libnfsidmap_nsswitch.so* 2>/dev/null )
#dracut_install $(ls {/usr,}$LIBDIR/libnfsidmap*.so* 2>/dev/null )
nsslibs=$(for j in $(for i in \
$(egrep -v '^#.*' /etc/nsswitch.conf|cut -f2 -d :\
|fgrep -v NOTFOUND); do \
echo "libnss_${i}.so";\
done|sort -u); do \
echo -n "|$j";\
done)
nsslibs=${nsslibs##|}
dracut_install $(for i in $(ls {/usr,}$LIBDIR/libnss*.so 2>/dev/null); do echo $i;done | egrep "$nsslibs")
inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
inst_hook pre-pivot 70 "$moddir/nfsroot-cleanup.sh"

View File

@@ -155,3 +155,10 @@ else
mount -t nfs -o$options${options:+,}nolock $server:$path $NEWROOT \
&& { [ -e /dev/root ] || >/dev/root ; }
fi
# inject new exit_if_exists
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > /initqueue/nfs.sh
# force udevsettle to break
> /initqueue/work

View File

@@ -132,3 +132,5 @@ rootok=1
# Shut up init error check or make sure that block parser wont get
# confused by having /dev/nfs[4]
root="$fstype"
echo '[ -e $NEWROOT/proc ]' > /initqueue-finished/nfsroot.sh

View File

@@ -1,4 +1,4 @@
#!/bin/bash
inst_hook cmdline 10 "$moddir/parse-resume.sh"
inst_hook pre-udev 30 "$moddir/resume-genrules.sh"
inst_hook mount 90 "$moddir/resume.sh"
inst_hook mount 10 "$moddir/resume.sh"

View File

@@ -1,15 +1,23 @@
if [ -n "$resume" ]; then
{
printf "KERNEL==\"%s\", RUN+=\"/bin/sh -c 'echo %%M:%%m > /sys/power/resume'\"\n" \
printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/bin/sh -c 'echo %%M:%%m > /sys/power/resume'\"\n" \
${resume#/dev/};
printf "SYMLINK==\"%s\", RUN+=\"/bin/sh -c 'echo %%M:%%m > /sys/power/resume'\"\n" \
printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/bin/sh -c 'echo %%M:%%m > /sys/power/resume'\"\n" \
${resume#/dev/};
printf "KERNEL==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \
${resume#/dev/};
printf "SYMLINK==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \
${resume#/dev/};
} >> /etc/udev/rules.d/99-resume.rules
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm "$job"; }\n' \
"$resume" "$resume" >> /initqueue-settled/resume.sh
echo '[ -e /dev/resume ]' > /initqueue-finished/resume.sh
elif ! getarg noresume; then
{
echo "SUBSYSTEM==\"block\", ACTION==\"add\", ENV{ID_FS_TYPE}==\"suspend\"," \
" RUN+=\"/bin/sh -c 'echo %M:%m > /sys/power/resume'\"";
echo "SUBSYSTEM==\"block\", ACTION==\"add\", ENV{ID_FS_TYPE}==\"swsuspend\"," \
echo "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\"," \
" RUN+=\"/bin/sh -c 'echo %M:%m > /sys/power/resume'\"";
} >> /etc/udev/rules.d/99-resume.rules
fi

View File

@@ -5,8 +5,9 @@ if [ "${root%%:*}" = "block" ]; then
printf 'SYMLINK=="%s", SYMLINK+="root"\n' \
${root#block:/dev/}
) >> /etc/udev/rules.d/99-mount.rules
(
printf '[ -e "%s" ] && { ln -s "%s" /dev/root; rm "$job"; }\n' \
"${root#block:}" "${root#block:}"
) >> /initqueue/blocksymlink.sh
printf '[ -e "%s" ] && { ln -s "%s" /dev/root 2>/dev/null; rm "$job"; }\n' \
"${root#block:}" "${root#block:}" >> /initqueue-settled/blocksymlink.sh
echo '[ -e /dev/root ]' > /initqueue-finished/block.sh
fi

View File

@@ -1,4 +1,5 @@
#!/bin/sh
if [ ! -s /.resume -a -n "$root" -a -z "${root%%block:*}" ]; then
if [ -n "$root" -a -z "${root%%block:*}" ]; then
mount -t ${fstype:-auto} -o "$rflags" "${root#block:}" "$NEWROOT" && ROOTFS_MOUNTED=yes
fi

View File

@@ -1,5 +1,3 @@
initrdargs="$initrdargs dasd"
[ -d /etc/modprobe.d ] || mkdir /etc/modprobe.d
dasd_arg=$(getarg dasd=)

View File

@@ -1,3 +1,8 @@
#!/bin/bash
# terminfo bits make things work better if you fall into interactive mode
dracut_install $(find /lib/terminfo -type f)
TERMINFODIR="/lib/terminfo"
[ ! -d ${TERMINFODIR} -a -d "/etc/terminfo" ] && \
TERMINFODIR="/etc/terminfo"
dracut_install $(find ${TERMINFODIR} -type f)

View File

@@ -0,0 +1,7 @@
SUBSYSTEM!="block", GOTO="psv_end"
ACTION!="add|change", GOTO="psv_end"
ACTION=="change", KERNEL=="dm-[0-9]*", IMPORT{program}="vol_id --export $tempnode"
KERNEL=="cciss[0-9]*", IMPORT{program}="vol_id --export $tempnode"
KERNEL=="nbd[0-9]*", IMPORT{program}="vol_id --export $tempnode"
KERNEL=="md[0-9]*|md_d[0-9]*|md/*", IMPORT{program}="vol_id --export $tempnode"
LABEL="psv_end"

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