Compare commits
369 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9a99c974a4 | ||
![]() |
bf84ee3c7c | ||
![]() |
f8545d04b7 | ||
![]() |
e73c975bad | ||
![]() |
0f7e10cef4 | ||
![]() |
689f9b8af7 | ||
![]() |
654cbf0687 | ||
![]() |
041b0d76ca | ||
![]() |
24bac034d1 | ||
![]() |
094097fab3 | ||
![]() |
26fbe9a101 | ||
![]() |
f8ddafcca2 | ||
![]() |
04a8f224c1 | ||
![]() |
597839331c | ||
![]() |
26b72485cf | ||
![]() |
7dbaf59ccf | ||
![]() |
95cf0a8803 | ||
![]() |
1dd5bc3fba | ||
![]() |
bf55e2c5d3 | ||
![]() |
4d92475240 | ||
![]() |
a52586e8ea | ||
![]() |
5759574b26 | ||
![]() |
56580efe68 | ||
![]() |
68f28d6976 | ||
![]() |
5c3f5746bb | ||
![]() |
54a73cbb2b | ||
![]() |
ab0f04844b | ||
![]() |
ad8f03af22 | ||
![]() |
3329f92136 | ||
![]() |
c27ec060da | ||
![]() |
82b2189d01 | ||
![]() |
4ce52970c0 | ||
![]() |
99433dd289 | ||
![]() |
b94c520660 | ||
![]() |
2f02ae9d45 | ||
![]() |
11fcc8c8f9 | ||
![]() |
e8cf498dcc | ||
![]() |
2178a00eea | ||
![]() |
33ff830c1b | ||
![]() |
5a8d8dfbb6 | ||
![]() |
8238850caa | ||
![]() |
fc3c64c8d4 | ||
![]() |
1888e57bf9 | ||
![]() |
94dcc5b8d8 | ||
![]() |
4839a7995e | ||
![]() |
1aca526cb4 | ||
![]() |
9541165d33 | ||
![]() |
600131fe85 | ||
![]() |
8c45b484ce | ||
![]() |
650da7bada | ||
![]() |
247c9f70bf | ||
![]() |
233f79df99 | ||
![]() |
236852c109 | ||
![]() |
6f0e469d79 | ||
![]() |
f9749f368f | ||
![]() |
f165864f09 | ||
![]() |
dc077a52c9 | ||
![]() |
0b2de1f895 | ||
![]() |
94eb3cf222 | ||
![]() |
cb47caf786 | ||
![]() |
d9f0633878 | ||
![]() |
71094bee63 | ||
![]() |
f5c4374d2c | ||
![]() |
aa297ca6b6 | ||
![]() |
4712e4ece6 | ||
![]() |
e51b607189 | ||
![]() |
fdf2a763d4 | ||
![]() |
f25c9697f8 | ||
![]() |
7e282f5df1 | ||
![]() |
0e9bb3f30c | ||
![]() |
3bb5b261c7 | ||
![]() |
273b197d75 | ||
![]() |
906dedf4d5 | ||
![]() |
4f4a79b1a1 | ||
![]() |
587b3497c1 | ||
![]() |
1753a63081 | ||
![]() |
96f3cf1d27 | ||
![]() |
e4dec3d6b6 | ||
![]() |
429aa1a2c2 | ||
![]() |
d889c019e7 | ||
![]() |
52168b7b9d | ||
![]() |
d6462323d6 | ||
![]() |
1d368457e3 | ||
![]() |
7c3fe07ac0 | ||
![]() |
194f7d125f | ||
![]() |
8ef0be5671 | ||
![]() |
b809e77f54 | ||
![]() |
780afa9876 | ||
![]() |
5ebc1acb7f | ||
![]() |
59580f28a1 | ||
![]() |
533d7dc4ab | ||
![]() |
ec74fa8789 | ||
![]() |
988061a5ee | ||
![]() |
c10d53bf0c | ||
![]() |
54b87586aa | ||
![]() |
461ff22cd5 | ||
![]() |
b1a4919cb2 | ||
![]() |
c1d670a893 | ||
![]() |
b6bf29b054 | ||
![]() |
5c6a593f2e | ||
![]() |
f4c36b28f6 | ||
![]() |
73e649b5f5 | ||
![]() |
ba72631039 | ||
![]() |
a89fb6daa5 | ||
![]() |
6568d86aec | ||
![]() |
3508cc816e | ||
![]() |
ffa264f077 | ||
![]() |
84c2266f1a | ||
![]() |
973c23b0d6 | ||
![]() |
9ede1929b2 | ||
![]() |
054e038512 | ||
![]() |
fb8923f681 | ||
![]() |
240cc7c480 | ||
![]() |
8d04a1287d | ||
![]() |
16df64ef1f | ||
![]() |
f76ef3aa3d | ||
![]() |
59c88f499f | ||
![]() |
afe25d0ccc | ||
![]() |
bdccc34e7e | ||
![]() |
495a964322 | ||
![]() |
9defc609e8 | ||
![]() |
68b26290f0 | ||
![]() |
d41f7ae750 | ||
![]() |
e15bc1f330 | ||
![]() |
a607b7d4b8 | ||
![]() |
1a4c4015bc | ||
![]() |
d7df77d172 | ||
![]() |
7e2b4f8367 | ||
![]() |
bc9ae19deb | ||
![]() |
17829e94aa | ||
![]() |
e0dca0e43c | ||
![]() |
4e207ec862 | ||
![]() |
b5ccf21d2b | ||
![]() |
62bde8ed7e | ||
![]() |
dc670134f8 | ||
![]() |
39d6cb5df4 | ||
![]() |
ddfd1d10a0 | ||
![]() |
0c1a8ebc37 | ||
![]() |
bd4c4bcb76 | ||
![]() |
161efa1f40 | ||
![]() |
ebdddd29d3 | ||
![]() |
2790d5b2ed | ||
![]() |
98adb06ea3 | ||
![]() |
0b90cfaa9f | ||
![]() |
ded38dbfbd | ||
![]() |
5d12f1a485 | ||
![]() |
7addf9d430 | ||
![]() |
6d0480426d | ||
![]() |
5a8b143888 | ||
![]() |
5bf0b329c9 | ||
![]() |
51123629d7 | ||
![]() |
0ad78ae8e7 | ||
![]() |
1c6e9e5c0a | ||
![]() |
0b610a002c | ||
![]() |
0f1361ee1c | ||
![]() |
b806825d2a | ||
![]() |
f905c1d7d6 | ||
![]() |
926b2c3337 | ||
![]() |
fc900b8be4 | ||
![]() |
88838bf238 | ||
![]() |
ed2de829e1 | ||
![]() |
ff34c9dcd4 | ||
![]() |
3d4641fd98 | ||
![]() |
860ace56f8 | ||
![]() |
ed6220fd25 | ||
![]() |
be9ca6c8a8 | ||
![]() |
148284ced6 | ||
![]() |
1def132d53 | ||
![]() |
0de910602c | ||
![]() |
3714170f33 | ||
![]() |
c6ca79eb4e | ||
![]() |
a15ad925e9 | ||
![]() |
13d5225fc8 | ||
![]() |
e3052553cf | ||
![]() |
cc0e7a369b | ||
![]() |
7f819d7041 | ||
![]() |
dfba82b3d3 | ||
![]() |
3ae2f09a04 | ||
![]() |
a2a2a956dd | ||
![]() |
fa9d7304bf | ||
![]() |
c56b63d1bd | ||
![]() |
2e44f115b9 | ||
![]() |
0c296f15b1 | ||
![]() |
345f573546 | ||
![]() |
69288348dd | ||
![]() |
9babe97e6f | ||
![]() |
863fa9c295 | ||
![]() |
766968bb6f | ||
![]() |
123e04b23e | ||
![]() |
9d2eb35d7a | ||
![]() |
67a38adacf | ||
![]() |
80aa303c29 | ||
![]() |
5ea16f2790 | ||
![]() |
2f24b79ddd | ||
![]() |
d9f8feb04a | ||
![]() |
bb57587b42 | ||
![]() |
b61ca28260 | ||
![]() |
a3f4e7709b | ||
![]() |
984a819b92 | ||
![]() |
edae4b5efb | ||
![]() |
2098ebf712 | ||
![]() |
f72c10f657 | ||
![]() |
645bde35d3 | ||
![]() |
0c39f9f6f6 | ||
![]() |
21007cb6ec | ||
![]() |
31f7db66a8 | ||
![]() |
4f18fe8296 | ||
![]() |
5494f08cc5 | ||
![]() |
c1a37d928f | ||
![]() |
0375106c78 | ||
![]() |
2b9dfbbeae | ||
![]() |
47b5c0f290 | ||
![]() |
4e6d8fd691 | ||
![]() |
34a369ed2d | ||
![]() |
3e6d2b31ea | ||
![]() |
13beb248bc | ||
![]() |
b03edf372f | ||
![]() |
e663608c40 | ||
![]() |
ef380e9de8 | ||
![]() |
39f3a51d65 | ||
![]() |
4809126378 | ||
![]() |
6c4b24afb0 | ||
![]() |
c1b2cc48d6 | ||
![]() |
fdb3d52d59 | ||
![]() |
d726d811f1 | ||
![]() |
2fe2945869 | ||
![]() |
f016dccc89 | ||
![]() |
c993cfb32f | ||
![]() |
9aaf7c3a33 | ||
![]() |
0e77eb3782 | ||
![]() |
93ce0a7a1c | ||
![]() |
a8b15b36bf | ||
![]() |
33ee031c4a | ||
![]() |
f24a2d46b7 | ||
![]() |
6a389cfca8 | ||
![]() |
26537a5b79 | ||
![]() |
aae88014c7 | ||
![]() |
441d31b927 | ||
![]() |
04db5fdc15 | ||
![]() |
0592128b1e | ||
![]() |
308b10311c | ||
![]() |
7045d15460 | ||
![]() |
6c034582d2 | ||
![]() |
57b965ef4b | ||
![]() |
f4785648fb | ||
![]() |
e368513370 | ||
![]() |
b54cac21c1 | ||
![]() |
acff0cc10c | ||
![]() |
a6f8c08347 | ||
![]() |
47e1402108 | ||
![]() |
1336db4f1c | ||
![]() |
6c1d16ad29 | ||
![]() |
0de01de409 | ||
![]() |
499befa692 | ||
![]() |
435185d7ab | ||
![]() |
e0fd2e2f74 | ||
![]() |
024cd021d4 | ||
![]() |
87194701de | ||
![]() |
4578763326 | ||
![]() |
7c00784e5c | ||
![]() |
53e1c5b996 | ||
![]() |
835d568916 | ||
![]() |
4f945a3932 | ||
![]() |
20cfd14f41 | ||
![]() |
376cfd1c27 | ||
![]() |
c0dc4c5d1e | ||
![]() |
532d7d9be4 | ||
![]() |
beb097d9f1 | ||
![]() |
44f1ab8285 | ||
![]() |
81f83dab0a | ||
![]() |
c3cd4c76d7 | ||
![]() |
1702e6c660 | ||
![]() |
e6df817525 | ||
![]() |
f4da80735a | ||
![]() |
d34a6d07c1 | ||
![]() |
f874872fc2 | ||
![]() |
2240d47fe5 | ||
![]() |
449adc611f | ||
![]() |
584e55654c | ||
![]() |
1adaf3372c | ||
![]() |
52c3715fd4 | ||
![]() |
dd1f72b3dd | ||
![]() |
3564cb7c2c | ||
![]() |
3d2a316013 | ||
![]() |
da1c03c8a0 | ||
![]() |
f47478b336 | ||
![]() |
6281504d33 | ||
![]() |
4a4c88236b | ||
![]() |
3e26772cde | ||
![]() |
b2543662a1 | ||
![]() |
3076b67917 | ||
![]() |
21e033f8ef | ||
![]() |
4fafddf78f | ||
![]() |
c81a97d1a7 | ||
![]() |
9a139a430a | ||
![]() |
e3b4125e83 | ||
![]() |
aceddbe8a4 | ||
![]() |
4286a25041 | ||
![]() |
00c5ab3e33 | ||
![]() |
c094baa0fb | ||
![]() |
1c709728ec | ||
![]() |
2a652c0b95 | ||
![]() |
89056045f5 | ||
![]() |
6aca2e0366 | ||
![]() |
07253f00ca | ||
![]() |
04f816de49 | ||
![]() |
14940c2a5c | ||
![]() |
4d06c74ea6 | ||
![]() |
d72eec354a | ||
![]() |
e60123c2ed | ||
![]() |
19c258b689 | ||
![]() |
dacba77805 | ||
![]() |
616f1557b1 | ||
![]() |
a75c29be45 | ||
![]() |
a3a3448d8c | ||
![]() |
58dbb43eac | ||
![]() |
5b2db7d177 | ||
![]() |
aa254c5596 | ||
![]() |
da04062e72 | ||
![]() |
3b51f4f30b | ||
![]() |
5cc26464e0 | ||
![]() |
9719024132 | ||
![]() |
83701d66f6 | ||
![]() |
f601799e94 | ||
![]() |
e2dbd86f09 | ||
![]() |
1b9cae5cb2 | ||
![]() |
259e58a904 | ||
![]() |
a55711cd86 | ||
![]() |
a8e47195dd | ||
![]() |
624b52c440 | ||
![]() |
4f4454b61f | ||
![]() |
e0364f95bc | ||
![]() |
970e646b00 | ||
![]() |
df328b6c36 | ||
![]() |
5b6e76c011 | ||
![]() |
eab677a216 | ||
![]() |
4ce1991856 | ||
![]() |
7e87a0bfa0 | ||
![]() |
7717b4433a | ||
![]() |
5db734030d | ||
![]() |
5966b1b15d | ||
![]() |
3e17f33b27 | ||
![]() |
bd81caa80a | ||
![]() |
f910f00627 | ||
![]() |
22a27a5023 | ||
![]() |
14f450cab2 | ||
![]() |
ada0bc3e5f | ||
![]() |
6fb586f3ef | ||
![]() |
5831685cdb | ||
![]() |
950086e987 | ||
![]() |
440d35d3c0 | ||
![]() |
0aaa523c82 | ||
![]() |
3473f5d938 | ||
![]() |
e7170fb717 | ||
![]() |
9d4c1799fe | ||
![]() |
6da2ee08a6 | ||
![]() |
297cb80bab | ||
![]() |
798d950651 | ||
![]() |
92798bf79b | ||
![]() |
696e68c643 | ||
![]() |
d8b3d672c3 | ||
![]() |
8af0a48521 | ||
![]() |
2d21db6def | ||
![]() |
3847431d3d | ||
![]() |
fb3d8cf7c2 | ||
![]() |
d0d1ea3d87 | ||
![]() |
0286b3b411 | ||
![]() |
5655a3ffbf | ||
![]() |
9794cf831b |
28
Makefile
28
Makefile
@@ -1,4 +1,4 @@
|
||||
VERSION=0.1
|
||||
VERSION=002
|
||||
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
|
||||
|
||||
prefix = /usr
|
||||
@@ -22,6 +22,8 @@ install:
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)/modules.d
|
||||
mkdir -p $(DESTDIR)$(mandir)/man8
|
||||
install -m 0755 dracut $(DESTDIR)$(sbindir)/dracut
|
||||
install -m 0755 dracut-gencmdline $(DESTDIR)$(sbindir)/dracut-gencmdline
|
||||
install -m 0755 dracut-catimages $(DESTDIR)$(sbindir)/dracut-catimages
|
||||
install -m 0755 modules.d/99base/switch_root $(DESTDIR)$(sbindir)/switch_root
|
||||
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
|
||||
install -m 0755 dracut-functions $(DESTDIR)$(pkglibdir)/dracut-functions
|
||||
@@ -33,6 +35,7 @@ clean:
|
||||
rm -f *~
|
||||
rm -f modules.d/99base/switch_root
|
||||
rm -f test-*.img
|
||||
rm -f dracut-*.rpm dracut-*.tar.bz2
|
||||
make -C test clean
|
||||
|
||||
archive: dracut-$(VERSION)-$(GITVERSION).tar.bz2
|
||||
@@ -46,12 +49,17 @@ dracut-$(VERSION)-$(GITVERSION).tar.bz2:
|
||||
git archive --format=tar HEAD --prefix=dracut-$(VERSION)-$(GITVERSION)/ |bzip2 > dracut-$(VERSION)-$(GITVERSION).tar.bz2
|
||||
|
||||
|
||||
rpm: dracut-$(VERSION).tar.bz2
|
||||
rpm: clean dracut-$(VERSION).tar.bz2
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" -ba dracut.spec
|
||||
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
|
||||
@@ -61,5 +69,17 @@ check: all
|
||||
make -C test check
|
||||
|
||||
testimage: all
|
||||
./dracut -l -f test-$(shell uname -r).img $(shell uname -r)
|
||||
./dracut -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
|
||||
testimages: all
|
||||
./dracut -l -a debug --kernel-only -f test-kernel-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
./dracut -l -a debug --no-kernel -f test-dracut.img $(shell uname -r)
|
||||
@echo wrote test-dracut.img
|
||||
|
||||
hostimage: all
|
||||
./dracut -H -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
|
||||
|
||||
|
200
NEWS
Normal file
200
NEWS
Normal 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
10
README
@@ -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 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
|
||||
|
@@ -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.)
|
6
README.kernel
Normal file
6
README.kernel
Normal file
@@ -0,0 +1,6 @@
|
||||
dracut-kernel is used to pull in all firmware files to build an initrd with
|
||||
only kernel modules and firmware files.
|
||||
|
||||
dracut --kernel-only only executes "installkernel" in the modules
|
||||
subdirectories.
|
||||
|
@@ -16,7 +16,7 @@ dracut_install_dir/modules.d/
|
||||
it easy for an earlier module to override the functionality of a
|
||||
later module, so that you can have a distro or system specific
|
||||
module override or modify the functionality of a generic module
|
||||
without having to patch the mode generic module.
|
||||
without having to patch the more generic module.
|
||||
|
||||
install: dracut sources this script to install the functionality that a
|
||||
module implements onto the initrd. For the most part, this amounts
|
||||
@@ -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,10 +43,57 @@ 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.
|
||||
|
||||
You are encouraged to provide a README that descrobes what the module is for.
|
||||
You are encouraged to provide a README that describes what the module is for.
|
||||
|
||||
|
||||
HOOKS
|
||||
=====
|
||||
|
||||
init has the following hook 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
|
||||
Network filesystems like NFS that do not use device files are an
|
||||
exception. Root can be mounted already at this point.
|
||||
|
||||
/mount/*.sh
|
||||
scripts to mount the root filesystem
|
||||
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.
|
||||
|
||||
|
134
dracut
134
dracut
@@ -5,8 +5,21 @@
|
||||
# of the various mkinitrd implementations out there
|
||||
#
|
||||
|
||||
# Copyright 2008, Red Hat, Inc. Jeremy Katz <katzj@redhat.com>
|
||||
# GPLv2 header here
|
||||
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
usage() {
|
||||
@@ -19,8 +32,21 @@ Creates initial ramdisk images for preloading modules
|
||||
call when building the initramfs. Modules are located
|
||||
in /usr/share/dracut/modules.d.
|
||||
-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
|
||||
firmwares, separated by :
|
||||
--kernel-only Only install kernel drivers and firmware files
|
||||
--no-kernel Do not install kernel drivers and firmware files
|
||||
--strip Strip binaries in the initramfs (default)
|
||||
--nostrip Do not strip binaries in the initramfs
|
||||
--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
|
||||
@@ -45,20 +71,34 @@ while (($# > 0)); do
|
||||
-f|--force) force=yes;;
|
||||
-m|--modules) dracutmodules_l="$2"; shift;;
|
||||
-o|--omit) omit_dracutmodules_l="$2"; shift;;
|
||||
-a|--add) add_dracutmodules_l="$2"; shift;;
|
||||
-d|--drivers) drivers_l="$2"; shift;;
|
||||
--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;;
|
||||
*) break ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export PATH
|
||||
|
||||
[[ $debug ]] && {
|
||||
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
|
||||
set -x
|
||||
@@ -73,10 +113,23 @@ done
|
||||
# these options override the stuff in the config file
|
||||
[[ $dracutmodules_l ]] && dracutmodules=$dracutmodules_l
|
||||
[[ $omit_dracutmodules_l ]] && omit_dracutmodules=$omit_dracutmodules_l
|
||||
[[ $add_dracutmodules_l ]] && add_dracutmodules="$add_dracutmodules $add_dracutmodules_l"
|
||||
[[ $drivers_l ]] && drivers=$drivers_l
|
||||
[[ $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
|
||||
@@ -97,6 +150,10 @@ esac
|
||||
[[ $2 ]] && kernel=$2 || kernel=$(uname -r)
|
||||
[[ $1 ]] && outfile=$(readlink -f $1) || outfile="/boot/initrd-$kernel.img"
|
||||
|
||||
srcmods="/lib/modules/$kernel/"
|
||||
[[ $drivers_dir ]] && srcmods="$drivers_dir"
|
||||
export srcmods
|
||||
|
||||
if [[ -f $outfile && ! $force ]]; then
|
||||
echo "Will not override existing initramfs ($outfile) without --force"
|
||||
exit 1
|
||||
@@ -110,12 +167,16 @@ trap 'rm -rf "$initdir"' 0 # clean up after ourselves no matter how we die.
|
||||
# Need to be able to have non-root users read stuff (rpcbind etc)
|
||||
chmod 755 "$initdir"
|
||||
|
||||
export initdir hookdirs dsrc dracutmodules drivers debug beverbose
|
||||
export initdir hookdirs dsrc dracutmodules drivers \
|
||||
fw_dir drivers_dir debug beverbose no_kernel kernel_only \
|
||||
add_drivers mdadmconf
|
||||
|
||||
# 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";
|
||||
done
|
||||
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";
|
||||
done
|
||||
fi
|
||||
|
||||
# check all our modules to see if they should be sourced.
|
||||
# This builds a list of modules that we will install next.
|
||||
@@ -125,19 +186,27 @@ 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
|
||||
. "$moddir/install"
|
||||
if [[ $kernel_only = yes ]]; then
|
||||
[[ -x $moddir/installkernel ]] && . "$moddir/installkernel"
|
||||
else
|
||||
. "$moddir/install"
|
||||
if [[ $no_kernel != yes && -x $moddir/installkernel ]]; then
|
||||
. "$moddir/installkernel"
|
||||
fi
|
||||
fi
|
||||
mods_to_load=${mods_to_load// $mod /}
|
||||
fi
|
||||
done
|
||||
unset moddir
|
||||
echo $mods_to_load
|
||||
|
||||
## final stuff that has to happen
|
||||
|
||||
# generate module dependencies for the initrd
|
||||
if ! /sbin/depmod -a -b "$initdir" $kernel; then
|
||||
echo "\"/sbin/depmod -a $kernel\" failed."
|
||||
exit 1
|
||||
if [[ -d $initdir/lib/modules/$kernel ]]; then
|
||||
if ! depmod -a -b "$initdir" $kernel; then
|
||||
echo "\"depmod -a $kernel\" failed."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# make sure that library links are correct and up to date
|
||||
@@ -153,11 +222,40 @@ for item in $install_items; do
|
||||
done
|
||||
unset item
|
||||
|
||||
[[ "$beverbose" = "yes" ]] && (du -c "$initdir" | sort -n)
|
||||
[[ $beverbose = yes ]] && (du -c "$initdir" | sort -n)
|
||||
|
||||
( cd "$initdir"; find . |cpio -H newc -o |gzip -9 > "$outfile"; )
|
||||
# strip binaries
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
for p in strip objdump sed grep find; do
|
||||
if ! which $p >/dev/null 2>&1; then
|
||||
derror "Could not find '$p'. You should run $0 with '--nostrip'."
|
||||
do_strip=no
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
[[ "$beverbose" = "yes" ]] && ls -lh "$outfile"
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
for f in $(find "$initdir" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; |
|
||||
grep -v ' shared object,' |
|
||||
sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'); do
|
||||
dinfo "Stripping $f"
|
||||
strip -g "$f" || :
|
||||
#
|
||||
# FIXME: only strip -g for now
|
||||
#
|
||||
#strip -g --strip-unneeded "$f" || :
|
||||
#note="-R .note"
|
||||
#if objdump -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \
|
||||
# grep -q ALLOC; then
|
||||
# note=
|
||||
#fi
|
||||
#strip -R .comment $note "$f" || :
|
||||
done
|
||||
fi
|
||||
|
||||
( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet |gzip -9 > "$outfile"; )
|
||||
|
||||
[[ $beverbose = yes ]] && ls -lh "$outfile"
|
||||
|
||||
exit 0
|
||||
|
||||
|
126
dracut-catimages
Executable file
126
dracut-catimages
Executable file
@@ -0,0 +1,126 @@
|
||||
#!/bin/bash --norc
|
||||
|
||||
# Copyright 2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
dwarning() {
|
||||
echo "Warning: $@" >&2
|
||||
}
|
||||
|
||||
dinfo() {
|
||||
[[ $beverbose ]] && echo "$@" >&2
|
||||
}
|
||||
|
||||
derror() {
|
||||
echo "Error: $@" >&2
|
||||
}
|
||||
|
||||
usage() {
|
||||
# 80x25 linebreak here ^
|
||||
echo "Usage: $0 [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
|
||||
"
|
||||
}
|
||||
|
||||
|
||||
imagedir=/boot/dracut/
|
||||
overlay=/var/lib/dracut/overlay
|
||||
|
||||
while (($# > 0)); do
|
||||
case $1 in
|
||||
-f|--force) force=yes;;
|
||||
-i|--imagedir) imagedir=$2;shift;;
|
||||
-o|--overlaydir) overlay=$2;shift;;
|
||||
--nooverlay) no_overlay=yes;shift;;
|
||||
--noimagedir) no_imagedir=yes;shift;;
|
||||
-h|--help) usage; exit 1 ;;
|
||||
--debug) debug="yes";;
|
||||
-v|--verbose) beverbose="yes";;
|
||||
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
|
||||
*) break ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
outfile=$1; shift
|
||||
|
||||
if [[ -z $outfile ]]; then
|
||||
derror "No output file specified."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
baseimage=$1; shift
|
||||
|
||||
if [[ -z $baseimage ]]; then
|
||||
derror "No base image specified."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -f $outfile && ! $force ]]; then
|
||||
derror "Will not override existing initramfs ($outfile) without --force"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! $no_imagedir && ! -d $imagedir ]]; then
|
||||
derror "Image directory $overlay is not a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! $no_overlay && ! -d $overlay ]]; then
|
||||
derror "Overlay $overlay is not a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! $no_overlay ]]; then
|
||||
ofile="$imagedir/90-overlay.img"
|
||||
dinfo "Creating image $ofile from directory $overlay"
|
||||
( cd "$overlay"; find . |cpio --quiet -H newc -o |gzip -9 > "$ofile"; )
|
||||
fi
|
||||
|
||||
if [[ ! $no_imagedir ]]; then
|
||||
for i in "$imagedir/"*.img; do
|
||||
[[ -f $i ]] && images+=("$i")
|
||||
done
|
||||
fi
|
||||
|
||||
images+=($@)
|
||||
|
||||
dinfo "Using base image $baseimage"
|
||||
cat "$baseimage" > "$outfile"
|
||||
|
||||
for i in "${images[@]}"; do
|
||||
dinfo "Appending $i"
|
||||
cat "$i" >> "$outfile"
|
||||
done
|
||||
|
||||
dinfo "Created $outfile"
|
||||
|
||||
exit 0
|
281
dracut-functions
281
dracut-functions
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# functions used by mkinitrd and other tools.
|
||||
# functions used by dracut and other tools.
|
||||
#
|
||||
# Copyright 2005-2008 Red Hat, Inc. All rights reserved.
|
||||
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,39 +17,118 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Authors:
|
||||
# Peter Jones <pjones@redhat.com>
|
||||
# Jeremy Katz <katzj@redhat.com>
|
||||
# Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
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
|
||||
@@ -59,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.
|
||||
@@ -73,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"
|
||||
@@ -87,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
|
||||
@@ -111,21 +190,23 @@ inst_binary() {
|
||||
derror "dracut cannot create an initrd."
|
||||
exit 1
|
||||
fi
|
||||
[[ $line =~ ([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*) ]] || continue
|
||||
so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
|
||||
[[ $line =~ $so_regex ]] || continue
|
||||
FILE=${BASH_REMATCH[1]}
|
||||
[[ -f ${initdir}$FILE ]] && continue
|
||||
# see if we are loading an optimized version of a shared lib.
|
||||
if [[ $FILE =~ ^(/lib[^/]*).* ]]; then
|
||||
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"
|
||||
@@ -141,7 +222,8 @@ inst_script() {
|
||||
read -r -n 80 line <"$1"
|
||||
# If debug is set, clean unprintable chars to prevent messing up the term
|
||||
[[ $debug ]] && line=$(echo -n "$line" | tr -c -d '[:print:][:space:]')
|
||||
[[ $line =~ (#! *)(/[^ ]+).* ]] || return 1
|
||||
shebang_regex='(#! *)(/[^ ]+).*'
|
||||
[[ $line =~ $shebang_regex ]] || return 1
|
||||
inst "${BASH_REMATCH[2]}" && inst_simple "$@"
|
||||
}
|
||||
|
||||
@@ -151,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"
|
||||
}
|
||||
|
||||
@@ -167,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
|
||||
}
|
||||
@@ -178,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
|
||||
@@ -204,19 +297,27 @@ inst_hook() {
|
||||
}
|
||||
|
||||
dracut_install() {
|
||||
if [[ $1 = '-o' ]]; then
|
||||
local optional=yes
|
||||
shift
|
||||
fi
|
||||
while (($# > 0)); do
|
||||
if inst "$1" ; then
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
derror "Failed to install $1"; exit 1
|
||||
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
|
||||
@@ -237,7 +338,11 @@ check_module_deps() {
|
||||
|
||||
should_source_module() {
|
||||
local dep
|
||||
[[ -x $1/install ]] || return 1
|
||||
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
|
||||
@@ -257,21 +362,79 @@ check_modules() {
|
||||
[[ $dracutmodules != all ]] && ! strstr "$dracutmodules" "$mod" && \
|
||||
continue
|
||||
strstr "$omit_dracutmodules" "$mod" && continue
|
||||
should_source_module "$moddir" || continue
|
||||
if ! strstr "$add_dracutmodules" "$mod"; then
|
||||
should_source_module "$moddir" || continue
|
||||
fi
|
||||
mods_to_load+=" $mod "
|
||||
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
|
||||
local mod mpargs modpath modname cmd
|
||||
local srcmods="/lib/modules/$kernel/"
|
||||
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#=} )
|
||||
@@ -279,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
|
||||
@@ -293,25 +459,10 @@ instmods() {
|
||||
[[ $hostonly ]] && ! grep -q "$mod" /proc/modules && {
|
||||
shift; continue;
|
||||
}
|
||||
modprobe $mpargs --ignore-install --set-version $kernel \
|
||||
--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"
|
||||
done
|
||||
for fw in $(/sbin/modinfo -F firmware $mod 2>/dev/null); do
|
||||
if [[ -f /lib/firmware/$fw ]]; then
|
||||
inst_simple "/lib/firmware/$fw"
|
||||
else
|
||||
dwarning "Possible missing firmware /lib/firmware/${fw} for module ${mod}.ko"
|
||||
fi
|
||||
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
|
||||
|
684
dracut-gencmdline
Executable file
684
dracut-gencmdline
Executable file
@@ -0,0 +1,684 @@
|
||||
#!/bin/bash --norc
|
||||
#
|
||||
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# code taken from mkinitrd
|
||||
#
|
||||
#. /usr/libexec/initrd-functions
|
||||
|
||||
|
||||
function error() {
|
||||
echo "$@" >&2
|
||||
}
|
||||
|
||||
function vecho() {
|
||||
is_verbose && echo "$@"
|
||||
}
|
||||
|
||||
# module dep finding and installation functions
|
||||
moduledep() {
|
||||
MPARGS=""
|
||||
if [ "$1" == "--ignore-install" ]; then
|
||||
MPARGS="$MPARGS --ignore-install"
|
||||
shift
|
||||
fi
|
||||
vecho -n "Looking for deps of module $1"
|
||||
deps=""
|
||||
deps=$(modprobe $MPARGS --set-version $kernel --show-depends $1 2>/dev/null| awk '/^insmod / { print gensub(".*/","","g",$2) }' | while read foo ; do [ "${foo%%.ko}" != "$1" ] && echo -n "${foo%%.ko} " ; done)
|
||||
[ -n "$deps" ] && vecho ": $deps" || vecho
|
||||
}
|
||||
|
||||
export MALLOC_PERTURB_=204
|
||||
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
|
||||
export PATH
|
||||
|
||||
# Set the umask. For iscsi, the initrd can contain plaintext
|
||||
# password (chap secret), so only allow read by owner.
|
||||
umask 077
|
||||
|
||||
VERSION=6.0.87
|
||||
|
||||
PROBE="yes"
|
||||
MODULES=""
|
||||
GRAPHICSMODS=""
|
||||
PREMODS=""
|
||||
DMRAIDS=""
|
||||
ncryptodevs=0
|
||||
ncryptoparts=0
|
||||
ncryptolvs=0
|
||||
ncryptoraids=0
|
||||
root=""
|
||||
scsi_wait_scan="no"
|
||||
|
||||
NET_LIST=""
|
||||
LD_SO_CONF=/etc/ld.so.conf
|
||||
LD_SO_CONF_D=/etc/ld.so.conf.d/
|
||||
|
||||
[ -e /etc/sysconfig/mkinitrd ] && . /etc/sysconfig/mkinitrd
|
||||
|
||||
CONFMODS="$MODULES"
|
||||
MODULES=""
|
||||
ARCH=$(uname -m | sed -e 's/s390x/s390/')
|
||||
|
||||
compress=1
|
||||
allowmissing=""
|
||||
target=""
|
||||
kernel=""
|
||||
force=""
|
||||
img_vers=""
|
||||
builtins=""
|
||||
modulefile=/etc/modules.conf
|
||||
[ "$ARCH" != "s390" ] && withusb=1
|
||||
rc=0
|
||||
nolvm=""
|
||||
nodmraid=""
|
||||
|
||||
IMAGESIZE=8000
|
||||
PRESCSIMODS=""
|
||||
fstab="/etc/fstab"
|
||||
|
||||
vg_list=""
|
||||
net_list="$NET_LIST"
|
||||
|
||||
usage () {
|
||||
if [ "$1" == "-n" ]; then
|
||||
cmd=echo
|
||||
else
|
||||
cmd=error
|
||||
fi
|
||||
|
||||
$cmd "usage: `basename $0` [--version] [--help] [-v] [-f]"
|
||||
|
||||
if [ "$1" == "-n" ]; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
qpushd() {
|
||||
pushd "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
qpopd() {
|
||||
popd >/dev/null 2>&1
|
||||
}
|
||||
|
||||
resolve_device_name() {
|
||||
echo "$1"
|
||||
# echo "resolve_device_name $1" 1>&2
|
||||
}
|
||||
|
||||
freadlink() {
|
||||
/usr/bin/readlink -f "$1"
|
||||
}
|
||||
|
||||
finddevnoinsys() {
|
||||
majmin="$1"
|
||||
if [ -n "$majmin" ]; then
|
||||
dev=$(for x in /sys/block/* ; do find $x/ -name dev ; done | while read device ; do \
|
||||
echo "$majmin" | cmp -s $device && echo $device ; done)
|
||||
if [ -n "$dev" ]; then
|
||||
dev=${dev%%/dev}
|
||||
dev=${dev%%/}
|
||||
echo "$dev"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
finddevicedriverinsys () {
|
||||
if is_iscsi $PWD; then
|
||||
handleiscsi "$PWD"
|
||||
return
|
||||
fi
|
||||
while [ "$PWD" != "/sys/devices" ]; do
|
||||
deps=
|
||||
if [ -f modalias ]; then
|
||||
MODALIAS=$(cat modalias)
|
||||
if [ "${MODALIAS::7}" == "scsi:t-" ]; then
|
||||
scsi_wait_scan=yes
|
||||
fi
|
||||
moduledep $MODALIAS
|
||||
unset MODALIAS
|
||||
fi
|
||||
|
||||
cd ..
|
||||
done
|
||||
}
|
||||
|
||||
findstoragedriverinsys () {
|
||||
local sysfs=$(freadlink "$1")
|
||||
|
||||
# if its a partition look at the device holding the partition
|
||||
if [ -f "$sysfs/start" ]; then
|
||||
sysfs=$(freadlink ${sysfs%/*})
|
||||
fi
|
||||
|
||||
if [[ ! "$sysfs" =~ '^/sys/.*block/.*$' ]]; then
|
||||
#error "WARNING: $sysfs is a not a block sysfs path, skipping"
|
||||
return
|
||||
fi
|
||||
|
||||
case " $handleddevices " in
|
||||
*" $sysfs "*)
|
||||
return ;;
|
||||
*) handleddevices="$handleddevices $sysfs" ;;
|
||||
esac
|
||||
|
||||
if [[ "$sysfs" =~ '^/sys/.*block/md[0-9]+$' ]]; then
|
||||
local raid=${sysfs##*/}
|
||||
vecho "Found MDRAID component $raid"
|
||||
handleraid $raid
|
||||
fi
|
||||
if [[ "$sysfs" =~ '^/sys/.*block/dm-[0-9]+$' ]]; then
|
||||
vecho "Found DeviceMapper component ${sysfs##*/}"
|
||||
handledm $(cat $sysfs/dev |cut -d : -f 1) $(cat $sysfs/dev |cut -d : -f 2)
|
||||
fi
|
||||
|
||||
for slave in $(ls -d "$sysfs"/slaves/* 2>/dev/null) ; do
|
||||
findstoragedriverinsys "$slave"
|
||||
done
|
||||
|
||||
if [ -L "$sysfs/device" ]; then
|
||||
qpushd $(freadlink "$sysfs/device")
|
||||
finddevicedriverinsys
|
||||
qpopd
|
||||
fi
|
||||
}
|
||||
|
||||
findstoragedriver () {
|
||||
local device="$1"
|
||||
|
||||
if [ ! -b "$device" ]; then
|
||||
#error "WARNING: $device is a not a block device, skipping"
|
||||
return
|
||||
fi
|
||||
|
||||
local majmin=$(get_numeric_dev dec "$device")
|
||||
local sysfs=$(finddevnoinsys "$majmin")
|
||||
|
||||
if [ -z "$sysfs" ]; then
|
||||
#error "WARNING: $device major:minor $majmin not found, skipping"
|
||||
return
|
||||
fi
|
||||
|
||||
vecho "Looking for driver for $device in $sysfs"
|
||||
findstoragedriverinsys "$sysfs"
|
||||
}
|
||||
|
||||
iscsi_get_rec_val() {
|
||||
|
||||
# The open-iscsi 742 release changed to using flat files in
|
||||
# /var/lib/iscsi.
|
||||
|
||||
result=$(grep "^${2} = " "$1" | sed -e s'/.* = //')
|
||||
}
|
||||
|
||||
iscsi_set_parameters() {
|
||||
path=$1
|
||||
vecho setting iscsi parameters
|
||||
|
||||
tmpfile=$(mktemp)
|
||||
|
||||
# Check once before getting explicit values, so we can output a decent
|
||||
# error message.
|
||||
/sbin/iscsiadm --show -m session -r $path > $tmpfile
|
||||
if [ ! -s $tmpfile ]; then
|
||||
echo Unable to find iscsi record for $path
|
||||
exit 1
|
||||
fi
|
||||
|
||||
nit_name=$(grep "^InitiatorName=" /etc/iscsi/initiatorname.iscsi | \
|
||||
sed -e "s/^InitiatorName=//")
|
||||
|
||||
iscsi_get_rec_val $tmpfile "node.name"
|
||||
tgt_name=${result}
|
||||
iscsi_get_rec_val $tmpfile "node.tpgt"
|
||||
tpgt=${result}
|
||||
# iscsistart wants node.conn[0].address / port
|
||||
iscsi_get_rec_val $tmpfile 'node.conn\[0\].address'
|
||||
tgt_ipaddr=${result}
|
||||
iscsi_get_rec_val $tmpfile 'node.conn\[0\].port'
|
||||
tgt_port=${result}
|
||||
|
||||
# Note: we get chap secrets (passwords) in plaintext, and also store
|
||||
# them in the initrd.
|
||||
|
||||
iscsi_get_rec_val $tmpfile "node.session.auth.username"
|
||||
chap=${result}
|
||||
if [ -n "${chap}" -a "${chap}" != "<empty>" ]; then
|
||||
chap="-u ${chap}"
|
||||
iscsi_get_rec_val $tmpfile "node.session.auth.password"
|
||||
chap_pw="-w ${result}"
|
||||
else
|
||||
chap=""
|
||||
fi
|
||||
|
||||
iscsi_get_rec_val $tmpfile "node.session.auth.username_in"
|
||||
chap_in=${result}
|
||||
if [ -n "${chap_in}" -a "${chap_in}" != "<empty>" ]; then
|
||||
chap_in="-U ${chap_in}"
|
||||
iscsi_get_rec_val $tmpfile "node.session.auth.password_in"
|
||||
chap_in_pw="-W ${result}"
|
||||
else
|
||||
chap_in=""
|
||||
fi
|
||||
|
||||
rm $tmpfile
|
||||
}
|
||||
|
||||
emit_iscsi () {
|
||||
if [ -n "${iscsi_devs}" ]; then
|
||||
for dev in ${iscsi_devs}; do
|
||||
iscsi_set_parameters $dev
|
||||
# recid is not really used, just use 0 for it
|
||||
echo "/bin/iscsistart -t ${tgt_name} -i ${nit_name} \
|
||||
-g ${tpgt} -a ${tgt_ipaddr} ${chap} ${chap_pw} \
|
||||
${chap_in} ${chap_in_pw}"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
is_iscsi() {
|
||||
path=$1
|
||||
if echo $path | grep -q "/platform/host[0-9]*/session[0-9]*/target[0-9]*:[0-9]*:[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*"; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
handledm() {
|
||||
major=$1
|
||||
minor=$2
|
||||
while read dmstart dmend dmtype r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 ; do
|
||||
case "$dmtype" in
|
||||
crypt)
|
||||
# this device is encrypted; find the slave device and see
|
||||
# whether the encryption is LUKS; if not, bail.
|
||||
slavedev=$(finddevnoinsys $r3)
|
||||
# get the basename, then s,!,/, in case it's a cciss device
|
||||
slavedev=$(echo ${slavedev##*/} | tr '!' '/')
|
||||
cryptsetup isLuks "/dev/$slavedev" 2>/dev/null || continue
|
||||
find_base_dm_mods
|
||||
dmname=$(dmsetup info -j $major -m $minor -c --noheadings -o name)
|
||||
# do the device resolution dance to get /dev/mapper/foo
|
||||
# since 'lvm lvs' doesn't like dm-X device nodes
|
||||
if [[ "$slavedev" =~ ^dm- ]]; then
|
||||
majmin=$(get_numeric_dev dec "/dev/$slavedev")
|
||||
for dmdev in /dev/mapper/* ; do
|
||||
dmnum=$(get_numeric_dev dev $dmdev)
|
||||
if [ $dmnum = $majmin ]; then
|
||||
slavedev=${dmdev#/dev/}
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# determine if $slavedev is an LV
|
||||
# if so, add the device to latecryptodevs
|
||||
# if not, add the device to cryptodevs
|
||||
local vg=$(lvshow /dev/$slavedev)
|
||||
if [ -n "$vg" ]; then
|
||||
eval cryptolv${ncryptolvs}='"'/dev/$slavedev $dmname'"'
|
||||
let ncryptolvs++
|
||||
elif grep -q "^$slavedev :" /proc/mdstat ; then
|
||||
eval cryptoraid${ncryptoraids}='"'/dev/$slavedev $dmname'"'
|
||||
let ncryptoraids++
|
||||
else
|
||||
eval cryptoparts${ncryptoparts}='"'/dev/$slavedev $dmname'"'
|
||||
let ncryptoparts++
|
||||
fi
|
||||
|
||||
let ncryptodevs++
|
||||
findstoragedriver "/dev/$slavedev"
|
||||
;;
|
||||
esac
|
||||
done << EOF
|
||||
$(dmsetup table -j $major -m $minor 2>/dev/null)
|
||||
EOF
|
||||
local name=$(dmsetup info --noheadings -c -j $major -m $minor -o name)
|
||||
local vg=$(lvshow "/dev/mapper/$name")
|
||||
local raids=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no raid disks")
|
||||
if [ -n "$vg" ]; then
|
||||
vg=`echo $vg` # strip whitespace
|
||||
case " $vg_list " in
|
||||
*" $vg "*) ;;
|
||||
*) vg_list="$vg_list $vg"
|
||||
[ -z "$nolvm" ] && find_base_dm_mods
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
for raid in $raids ; do
|
||||
if [ "$raid" == "$name" ]; then
|
||||
case " $DMRAIDS " in
|
||||
*" $raid "*) ;;
|
||||
*) DMRAIDS="$DMRAIDS $raid"
|
||||
[ -z "$nodmraid" ] && find_base_dm_mods
|
||||
;;
|
||||
esac
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
handleiscsi() {
|
||||
vecho "Found iscsi component $1"
|
||||
|
||||
# We call iscsi_set_parameters once here to figure out what network to
|
||||
# use (it sets tgt_ipaddr), and once again to emit iscsi values,
|
||||
# not very efficient.
|
||||
iscsi_set_parameters $1
|
||||
iscsi_devs="$iscsi_devs $1"
|
||||
netdev=$(/sbin/ip route get to $tgt_ipaddr | \
|
||||
sed 's|.*dev \(.*\).*|\1|g' | awk '{ print $1; exit }')
|
||||
addnetdev $netdev
|
||||
}
|
||||
|
||||
handleraid() {
|
||||
local start=0
|
||||
|
||||
if [ -n "$noraid" -o ! -f /proc/mdstat ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
levels=$(awk "/^$1[ ]*:/ { print\$4 }" /proc/mdstat)
|
||||
|
||||
for level in $levels ; do
|
||||
case $level in
|
||||
linear)
|
||||
start=1
|
||||
;;
|
||||
multipath)
|
||||
start=1
|
||||
;;
|
||||
raid[01] | raid10)
|
||||
start=1
|
||||
;;
|
||||
raid[456])
|
||||
start=1
|
||||
;;
|
||||
*)
|
||||
error "raid level $level (in /proc/mdstat) not recognized"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ "$start" = 1 ]; then
|
||||
raiddevices="$raiddevices $1"
|
||||
fi
|
||||
return $start
|
||||
}
|
||||
|
||||
lvshow() {
|
||||
lvm lvs --ignorelockingfailure --noheadings -o vg_name \
|
||||
$1 2>/dev/null | egrep -v '^ *(WARNING:|Volume Groups with)'
|
||||
}
|
||||
|
||||
vgdisplay() {
|
||||
lvm vgdisplay --ignorelockingfailure -v $1 2>/dev/null |
|
||||
sed -n 's/PV Name//p'
|
||||
}
|
||||
|
||||
dmmods_found="n"
|
||||
find_base_dm_mods()
|
||||
{
|
||||
[ "$dmmods_found" == "n" ] || return
|
||||
dmmods_found="y"
|
||||
}
|
||||
|
||||
savedargs=$*
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--fstab*)
|
||||
if [ "$1" != "${1##--fstab=}" ]; then
|
||||
fstab=${1##--fstab=}
|
||||
else
|
||||
fstab=$2
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
|
||||
|
||||
-v|--verbose)
|
||||
set_verbose true
|
||||
;;
|
||||
--net-dev*)
|
||||
if [ "$1" != "${1##--net-dev=}" ]; then
|
||||
net_list="$net_list ${1##--net-dev=}"
|
||||
else
|
||||
net_list="$net_list $2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--rootdev*)
|
||||
if [ "$1" != "${1##--rootdev=}" ]; then
|
||||
rootdev="${1##--rootdev=}"
|
||||
else
|
||||
rootdev="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--thawdev*)
|
||||
if [ "$1" != "${1##--thawdev=}" ]; then
|
||||
thawdev="${1##--thawdev=}"
|
||||
else
|
||||
thawdev="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--rootfs*)
|
||||
if [ "$1" != "${1##--rootfs=}" ]; then
|
||||
rootfs="${1##--rootfs=}"
|
||||
else
|
||||
rootfs="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--rootopts*)
|
||||
if [ "$1" != "${1##--rootopts=}" ]; then
|
||||
rootopts="${1##--rootopts=}"
|
||||
else
|
||||
rootopts="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--root*)
|
||||
if [ "$1" != "${1##--root=}" ]; then
|
||||
root="${1##--root=}"
|
||||
else
|
||||
root="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--loopdev*)
|
||||
if [ "$1" != "${1##--loopdev=}" ]; then
|
||||
loopdev="${1##--loopdev=}"
|
||||
else
|
||||
loopdev="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--loopfs*)
|
||||
if [ "$1" != "${1##--loopfs=}" ]; then
|
||||
loopfs="${1##--loopfs=}"
|
||||
else
|
||||
loopfs="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--loopopts*)
|
||||
if [ "$1" != "${1##--loopopts=}" ]; then
|
||||
loopopts="${1##--loopopts=}"
|
||||
else
|
||||
loopopts="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--looppath*)
|
||||
if [ "$1" != "${1##--looppath=}" ]; then
|
||||
looppath="${1##--looppath=}"
|
||||
else
|
||||
looppath="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--help)
|
||||
usage -n
|
||||
;;
|
||||
*)
|
||||
if [ -z "$target" ]; then
|
||||
target=$1
|
||||
elif [ -z "$kernel" ]; then
|
||||
kernel=$1
|
||||
else
|
||||
usage
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
[ -z "$rootfs" ] && rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' $fstab)
|
||||
[ -z "$rootopts" ] && rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' $fstab)
|
||||
[ -z "$rootopts" ] && rootopts="defaults"
|
||||
|
||||
|
||||
[ -z "$rootdev" ] && rootdev=$(awk '/^[ \t]*[^#]/ { if ($2 == "/") { print $1; }}' $fstab)
|
||||
# check if it's nfsroot
|
||||
physdev=""
|
||||
if [ "$rootfs" == "nfs" ]; then
|
||||
if [ "x$net_list" == "x" ]; then
|
||||
handlenfs $rootdev
|
||||
fi
|
||||
else
|
||||
# check if it's root by label
|
||||
rdev=$rootdev
|
||||
if [[ "$rdev" =~ ^(UUID=|LABEL=) ]]; then
|
||||
rdev=$(resolve_device_name "$rdev")
|
||||
fi
|
||||
rootopts=$(echo $rootopts | sed -e 's/^r[ow],//' -e 's/,_netdev//' -e 's/_netdev//' -e 's/,r[ow],$//' -e 's/,r[ow],/,/' -e 's/^r[ow]$/defaults/' -e 's/$/,ro/')
|
||||
findstoragedriver "$rdev"
|
||||
fi
|
||||
|
||||
# find the first swap dev which would get used for swsusp
|
||||
[ -z "$thawdev" ] && thawdev=$(awk '/^[ \t]*[^#]/ { if ($3 == "swap") { print $1; exit }}' $fstab)
|
||||
swsuspdev="$thawdev"
|
||||
if [ -n "$swsuspdev" ]; then
|
||||
if [[ "$swsuspdev" =~ ^(UUID=|LABEL=) ]]; then
|
||||
swsuspdev=$(resolve_device_name "$swsuspdev")
|
||||
fi
|
||||
findstoragedriver "$swsuspdev"
|
||||
fi
|
||||
|
||||
|
||||
cemit()
|
||||
{
|
||||
cat
|
||||
}
|
||||
|
||||
emit()
|
||||
{
|
||||
NONL=""
|
||||
if [ "$1" == "-n" ]; then
|
||||
NONL="-n"
|
||||
shift
|
||||
fi
|
||||
echo $NONL "$@"
|
||||
}
|
||||
|
||||
emitdmraids()
|
||||
{
|
||||
if [ -z "$nodmraid" -a -n "$DMRAIDS" ]; then
|
||||
for raid in $DMRAIDS; do
|
||||
echo -n "rd_DM_UUID=$raid "
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# HACK: module loading + device creation isn't necessarily synchronous...
|
||||
# this will make sure that we have all of our devices before trying
|
||||
# things like RAID or LVM
|
||||
emitdmraids
|
||||
|
||||
emitcrypto()
|
||||
{
|
||||
local luksuuid=$(grep "^$2 " /etc/crypttab 2>/dev/null| awk '{ print $2 }')
|
||||
if [ -z "$luksuuid" ]; then
|
||||
luksuuid="$2"
|
||||
fi
|
||||
luksuuid=${luksuuid##UUID=}
|
||||
echo -n "rd_LUKS_UUID=$luksuuid "
|
||||
}
|
||||
|
||||
for cryptdev in ${!cryptopart@} ; do
|
||||
emitcrypto `eval echo '$'$cryptdev`
|
||||
done
|
||||
|
||||
if [ -n "$raiddevices" ]; then
|
||||
for dev in $raiddevices; do
|
||||
uid=$(udevadm info --query=all --name=/dev/${dev}|grep MD_UUID)
|
||||
uid=$(IFS="=";set $uid;echo $2)
|
||||
echo -n "rd_MD_UUID=$uid "
|
||||
done
|
||||
fi
|
||||
|
||||
for cryptdev in ${!cryptoraid@} ; do
|
||||
emitcrypto `eval echo '$'$cryptdev`
|
||||
done
|
||||
|
||||
if [ -z "$nolvm" -a -n "$vg_list" ]; then
|
||||
for vg in $vg_list; do
|
||||
echo -n "rd_LVM_VG=$vg "
|
||||
done
|
||||
fi
|
||||
|
||||
for cryptdev in ${!cryptolv@} ; do
|
||||
emitcrypto `eval echo '$'$cryptdev`
|
||||
done
|
||||
|
||||
# output local keyboard/18n settings
|
||||
. /etc/sysconfig/keyboard
|
||||
. /etc/sysconfig/i18n
|
||||
|
||||
for i in KEYTABLE SYSFONT SYSFONTACM UNIMAP LANG; do
|
||||
val=$(eval echo \$$i)
|
||||
[[ $val ]] && echo -n "$i=$val "
|
||||
done
|
||||
|
||||
if [ -n "$KEYBOARDTYPE" -a "$KEYBOARDTYPE" != "pc" ]; then
|
||||
echo -n "KEYBOARDTYPE=$KEYBOARDTYPE "
|
||||
fi
|
||||
|
||||
if [ -n "$rootdev" ]; then
|
||||
echo -n "root=$rootdev "
|
||||
fi
|
||||
|
||||
if [ -L /usr/share/plymouth/themes/default.plymouth ]; then
|
||||
theme=$(basename \
|
||||
$(dirname \
|
||||
$(readlink -f \
|
||||
/usr/share/plymouth/themes/default.plymouth)))
|
||||
[ -n "$theme" ] && echo -n "rd_plytheme=$theme "
|
||||
fi
|
||||
|
||||
echo
|
||||
# vim:ts=8:sw=4:sts=4:et
|
173
dracut.8
173
dracut.8
@@ -24,8 +24,37 @@ Modules are located in
|
||||
.BR \-o ", " \-\-omit " \fILIST\fR"
|
||||
omit a space-separated list of dracut modules.
|
||||
.TP
|
||||
.BR \-a ", " \-\-add " \fILIST\fR"
|
||||
add a space-separated list of dracut modules.
|
||||
.TP
|
||||
.BR \-d ", " \-\-drivers " \fILIST\fR"
|
||||
specify a space-separated list of kernel modules to include in the initramfs.
|
||||
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
|
||||
.TP
|
||||
.BR " \-\-fwdir " \fI{DIR}\fR
|
||||
specify additional directory, where to look for firmwares
|
||||
.TP
|
||||
.BR \-\-kernel-only
|
||||
only install kernel drivers and firmware files
|
||||
.TP
|
||||
.BR \-\-no-kernel
|
||||
do not install kernel drivers and firmware files
|
||||
.TP
|
||||
.BR \-\-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
|
||||
.BR \-\-nostrip
|
||||
do not strip binaries in the initramfs
|
||||
.TP
|
||||
.BR \-h ", " \-\-help
|
||||
display help text and exit.
|
||||
@@ -74,6 +103,73 @@ 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
|
||||
.B KEYBOARDTYPE=sun|pc
|
||||
will be written to /etc/sysconfig/keyboard in the initramfs
|
||||
.TP
|
||||
.B KEYTABLE=<keytable filename>
|
||||
will be written to /etc/sysconfig/keyboard in the initramfs
|
||||
.TP
|
||||
.B SYSFONT= Console font
|
||||
will be written to /etc/sysconfig/i18n in the initramfs
|
||||
.TP
|
||||
.B SYSFONTACM= Unicode font map
|
||||
will be written to /etc/sysconfig/i18n in the initramfs
|
||||
.TP
|
||||
.B UNIMAP= Unicode font map
|
||||
will be written to /etc/sysconfig/i18n in the initramfs
|
||||
.TP
|
||||
.B LANG=<locale>
|
||||
will be written to /etc/sysconfig/i18n in the initramfs
|
||||
|
||||
.SH LVM
|
||||
.TP
|
||||
.B rd_NO_LVM
|
||||
disable LVM detection
|
||||
.TP
|
||||
.B rd_LVM_VG=<volume group name>
|
||||
only activate the volume groups with the given name
|
||||
|
||||
.SH crypto LUKS
|
||||
.TP
|
||||
.B rd_NO_LUKS
|
||||
disable crypto LUKS detection
|
||||
.TP
|
||||
.B rd_LUKS_UUID=<luks uuid>
|
||||
only activate the LUKS partitions with the given UUID
|
||||
|
||||
.SH MD
|
||||
.TP
|
||||
.B rd_NO_MD
|
||||
disable MD RAID detection
|
||||
.TP
|
||||
.B rd_NO_MDIMSM
|
||||
no MD RAID for imsm/isw raids, use dmraid instead
|
||||
.TP
|
||||
.B rd_NO_MDADMCONF
|
||||
ignore mdadm.conf included in initramfs
|
||||
.TP
|
||||
.B rd_MD_UUID=<md uuid>
|
||||
only activate the raid sets with the given UUID
|
||||
|
||||
.SH DMRAID
|
||||
.TP
|
||||
.B rd_NO_DM
|
||||
disable DM RAID detection
|
||||
.TP
|
||||
.B rd_DM_UUID=<dmraid uuid>
|
||||
only activate the raid sets with the given UUID
|
||||
|
||||
.SH DASD
|
||||
.TP
|
||||
.B dasd=....
|
||||
same syntax as the kernel module parameter (s390 only)
|
||||
|
||||
.SH DHCP
|
||||
.TP
|
||||
@@ -87,9 +183,16 @@ mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given,
|
||||
use dhcp next_server.
|
||||
NFS options can be appended with the prefix "." or ","
|
||||
.TP
|
||||
.B root=dhcp root-path=<server-ip>:<root-dir>[:<nfs-options>]
|
||||
.B root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>]
|
||||
.TP
|
||||
.B root=nfs4:[<server-ip>:]<root-dir>[:<nfs-options>]
|
||||
.TP
|
||||
.B root=dhcp
|
||||
root=dhcp alone directs initrd to look at the DHCP root-path where NFS
|
||||
options can be specified.
|
||||
root-path=<server-ip>:<root-dir>[,<nfs-options>]
|
||||
root-path=nfs:<server-ip>:<root-dir>[,<nfs-options>]
|
||||
root-path=nfs4:<server-ip>:<root-dir>[,<nfs-options>]
|
||||
.TP
|
||||
.B root=/dev/nfs nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
|
||||
\fBDeprecated!\fR kernel Documentation/filesystems/nfsroot.txt defines
|
||||
@@ -98,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
|
||||
@@ -110,27 +213,35 @@ associated fields.
|
||||
|
||||
http://tools.ietf.org/html/rfc4173
|
||||
|
||||
If the root partition is not specified using \fBroot=\fR, one of the partitions found
|
||||
with label \fBROOT\fR or \fB/\fR will be used to boot from.
|
||||
|
||||
.TP
|
||||
.B root=??? netroot=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
|
||||
e.g. root=LABEL=ROOT netroot=root=LABEL=ROOT netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
|
||||
|
||||
.B root=iscsi:[username:password[:reverse:password]@][<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
|
||||
e.g. root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
|
||||
.TP
|
||||
.B root=??? netroot=iscsi:[username:password[:reverse:password]@][<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname> ...
|
||||
multiple netroot options allow setting up multiple iscsi disks
|
||||
e.g.
|
||||
root=UUID=12424547 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1
|
||||
.B not yet implemented
|
||||
.TP
|
||||
.B root=??? iscsi_initiator= iscsi_target_name= iscsi_target_ip= iscsi_target_port= iscsi_target_group= iscsi_username= iscsi_password= iscsi_in_username= iscsi_in_password=
|
||||
these variables can also be put in a file in /conf/conf.d/, which will be sourced
|
||||
|
||||
.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>]
|
||||
mount nbd share from <server>
|
||||
.TP
|
||||
.B root=dhcp root-path=nbd:<server>:<port>[:<fstype>][:<mountopts>]
|
||||
.B root=dhcp
|
||||
with dhcp root-path=nbd:<server>:<port>[:<fstype>][:<mountopts>]
|
||||
root=dhcp alone directs initrd to look at the DHCP root-path where NBD options can be specified.
|
||||
This syntax is only usable in cases where you are directly mounting the volume as the rootfs.
|
||||
|
||||
@@ -138,27 +249,48 @@ This syntax is only usable in cases where you are directly mounting the volume a
|
||||
.TP bootdev=<interface>
|
||||
.B specify the network interface to boot from
|
||||
.TP
|
||||
.B ip=[dhcp|on|any]
|
||||
.B ip={dhcp|on|any}
|
||||
get ip from dhcp server from all interfaces. If root=dhcp, loop sequentially through all interfaces (eth0, eth1, ...) and use the first with a valid DHCP root-path.
|
||||
.TP
|
||||
.B ip=<interface>:[dhcp|on|any]
|
||||
.B ip=<interface>:{dhcp|on|any}
|
||||
get ip from dhcp server on a specific interface
|
||||
.TP
|
||||
.B ip=<client-IP-number>:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:[dhcp|on|any|]
|
||||
.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>
|
||||
TBD: do not load kernel drivername
|
||||
do not load kernel module <drivername>
|
||||
|
||||
.SH Debug
|
||||
.TP
|
||||
.B rdinfo
|
||||
print informational output though "quiet" is set
|
||||
.TP
|
||||
.B rdshell
|
||||
allow dropping to a shell, if root mounting fails
|
||||
.TP
|
||||
.B rdinitdebug
|
||||
set -x for the dracut shell
|
||||
.TP
|
||||
.B rdbreak=[pre-udev|pre-mount|mount|pre-pivot|]
|
||||
drop the shell on defined breakpoint
|
||||
.B rdbreak
|
||||
drop to a shell at the end
|
||||
.TP
|
||||
.B rdbreak={cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot}
|
||||
drop to a shell on defined breakpoint
|
||||
.TP
|
||||
.B rdudevinfo
|
||||
set udev to loglevel info
|
||||
@@ -169,13 +301,12 @@ set udev to loglevel debug
|
||||
.B rdnetdebug
|
||||
debug network scripts in dracut. Output is written to /tmp/
|
||||
|
||||
|
||||
.SH CONFIGURATION IN INITRAMFS
|
||||
.TP
|
||||
.B /conf/conf.d/
|
||||
Any files found in /conf/conf.d/ will be sourced in the initramfs to
|
||||
specify special variables.
|
||||
Command line options can override values set here.
|
||||
set initial values. Command line options will override these values
|
||||
set in the configuration files.
|
||||
|
||||
.SH AUTHORS
|
||||
.nf
|
||||
|
11
dracut.conf
11
dracut.conf
@@ -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"
|
||||
|
229
dracut.spec
229
dracut.spec
@@ -1,109 +1,264 @@
|
||||
# define gittag 2c02c831
|
||||
%define replace_mkinitrd 0
|
||||
%if 0%{?fedora} < 12
|
||||
%define with_switch_root 1
|
||||
%else
|
||||
%define with_switch_root 0
|
||||
Name: dracut
|
||||
Version: 0.1
|
||||
%endif
|
||||
|
||||
%if %{defined gittag}
|
||||
Release: 1.git%{gittag}%{?dist}
|
||||
%define rdist .git%{gittag}%{?dist}
|
||||
%define dashgittag -%{gittag}
|
||||
%else
|
||||
Release: 1%{?dist}
|
||||
%define rdist %{?dist}
|
||||
%endif
|
||||
|
||||
Name: dracut
|
||||
Version: 002
|
||||
Release: 1%{?rdist}
|
||||
Summary: Initramfs generator using udev
|
||||
Group: System Environment/Base
|
||||
License: GPLv2
|
||||
License: GPLv2+
|
||||
URL: http://apps.sourceforge.net/trac/dracut/wiki
|
||||
Source0: dracut-%{version}%{?dashgittag}.tar.bz2
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
Requires: udev
|
||||
Requires: util-linux-ng
|
||||
Requires: module-init-tools
|
||||
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
|
||||
|
||||
%if 0%{?replace_mkinitrd}
|
||||
Obsoletes: mkinitrd < 7.0
|
||||
Provides: mkinitrd = 7.0
|
||||
%endif
|
||||
Requires: dash
|
||||
Requires: /bin/sh
|
||||
Requires: fileutils, gzip, tar
|
||||
Requires: lvm2 >= 2.02.33-9, dhclient
|
||||
Requires: filesystem >= 2.1.0, cpio, device-mapper, initscripts >= 8.63-1
|
||||
Requires: e2fsprogs >= 1.38-12, libselinux, libsepol, coreutils
|
||||
Requires: mdadm, elfutils-libelf, plymouth >= 0.7.0
|
||||
Requires: cryptsetup-luks
|
||||
Requires: file
|
||||
Requires: bzip2
|
||||
Requires: dmraid
|
||||
Requires: kbd
|
||||
Requires: plymouth-scripts
|
||||
|
||||
%if ! 0%{?with_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
|
||||
%package network
|
||||
Summary: dracut modules to build a dracut initramfs with network support
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: device-mapper
|
||||
Requires: cryptsetup-luks
|
||||
Requires: rpcbind nfs-utils
|
||||
Requires: lvm2
|
||||
Requires: iscsi-initiator-utils
|
||||
Requires: nbd
|
||||
Requires: mdadm
|
||||
Requires: net-tools iproute
|
||||
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.
|
||||
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}
|
||||
Requires: ql2100-firmware
|
||||
Requires: ql2200-firmware
|
||||
Requires: ql23xx-firmware
|
||||
Requires: ql2400-firmware
|
||||
Requires: ql2500-firmware
|
||||
|
||||
%description kernel
|
||||
This package requires everything which is needed to build a initramfs with all
|
||||
kernel modules and firmware files needed by dracut modules.
|
||||
|
||||
%package tools
|
||||
Summary: dracut tools to build the local initramfs
|
||||
Requires: coreutils cryptsetup-luks device-mapper
|
||||
Requires: diffutils dmraid findutils gawk grep lvm2
|
||||
Requires: module-init-tools sed
|
||||
Requires: cpio gzip
|
||||
|
||||
%description tools
|
||||
This package contains tools to assemble the local initrd and host configuration.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}%{?dashgittag}
|
||||
|
||||
%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}
|
||||
|
||||
%if 0%{?replace_mkinitrd}
|
||||
ln -s dracut $RPM_BUILD_ROOT/sbin/mkinitrd
|
||||
ln -s dracut/dracut-functions $RPM_BUILD_ROOT/usr/libexec/initrd-functions
|
||||
%endif
|
||||
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
|
||||
%endif
|
||||
|
||||
#mkdir -p $RPM_BUILD_ROOT/sbin
|
||||
#mv $RPM_BUILD_ROOT/%{_prefix}/lib/dracut/modules.d/99base/switch_root $RPM_BUILD_ROOT/sbin
|
||||
mkdir -p $RPM_BUILD_ROOT/boot/dracut
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/dracut/overlay
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README HACKING TODO COPYING
|
||||
%doc README HACKING TODO COPYING AUTHORS NEWS
|
||||
/sbin/dracut
|
||||
%if 0%{?with_switch_root}
|
||||
/sbin/switch_root
|
||||
%endif
|
||||
%if 0%{?replace_mkinitrd}
|
||||
/sbin/mkinitrd
|
||||
/usr/libexec/initrd-functions
|
||||
%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 network
|
||||
%defattr(-,root,root,0755)
|
||||
%{_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 NEWS
|
||||
/sbin/dracut-gencmdline
|
||||
/sbin/dracut-catimages
|
||||
%dir /boot/dracut
|
||||
%dir /var/lib/dracut
|
||||
%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
|
||||
|
||||
* Fri Jun 19 2009 Harald Hoyer <harald@redhat.com> 0.1-1
|
||||
- first release
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
findkeymap () {
|
||||
local MAP=$1
|
||||
[[ ! -f $MAP ]] && \
|
||||
@@ -18,46 +19,70 @@ findkeymap () {
|
||||
done
|
||||
}
|
||||
|
||||
install_local()
|
||||
{
|
||||
# FIXME: i18n stuff isn't really distro-independent :/
|
||||
if [[ -f /etc/sysconfig/keyboard || -f /etc/sysconfig/console/default.kmap ]]; then
|
||||
if [ -f /etc/sysconfig/console/default.kmap ]; then
|
||||
KEYMAP=/etc/sysconfig/console/default.kmap
|
||||
else
|
||||
. /etc/sysconfig/keyboard
|
||||
[[ $KEYTABLE && -d /lib/kbd/keymaps ]] && KEYMAP="$KEYTABLE.map"
|
||||
fi
|
||||
if [[ $KEYMAP ]]; then
|
||||
[ -f /etc/sysconfig/keyboard ] && inst /etc/sysconfig/keyboard
|
||||
inst loadkeys
|
||||
findkeymap $KEYMAP
|
||||
if [[ -f /etc/sysconfig/keyboard || -f /etc/sysconfig/console/default.kmap ]]; then
|
||||
if [ -f /etc/sysconfig/console/default.kmap ]; then
|
||||
KEYMAP=/etc/sysconfig/console/default.kmap
|
||||
else
|
||||
. /etc/sysconfig/keyboard
|
||||
[[ $KEYTABLE && -d /lib/kbd/keymaps ]] && KEYMAP="$KEYTABLE.map"
|
||||
fi
|
||||
if [[ $KEYMAP ]]; then
|
||||
[ -f /etc/sysconfig/keyboard ] && inst /etc/sysconfig/keyboard
|
||||
inst loadkeys
|
||||
findkeymap $KEYMAP
|
||||
|
||||
for FN in $KEYMAPS; do
|
||||
inst $FN
|
||||
for FN in $KEYMAPS; do
|
||||
if [ -L $FN ]; then
|
||||
TARGET=$(readlink -f $FN)
|
||||
TG=$(echo $TARGET | sed -e 's/\.gz$//' -e 's/\.bz2$//')
|
||||
LN=$(echo $FN | sed -e 's/\.gz$//' -e 's/\.bz2$//')
|
||||
mkdir -p "$initdir/$(dirname $LN)"
|
||||
ln -s "$TG" "$initdir/$LN"
|
||||
FN=$TARGET
|
||||
fi
|
||||
inst $FN
|
||||
case $FN in
|
||||
*.gz) gzip -d "$initdir$FN" ;;
|
||||
*.bz2) bzip2 -d "$initdir$FN" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f /etc/sysconfig/i18n ]; then
|
||||
. /etc/sysconfig/i18n
|
||||
inst /etc/sysconfig/i18n
|
||||
[[ $SYSFONT ]] || SYSFONT=latarcyrheb-sun16
|
||||
inst setfont
|
||||
|
||||
for FN in /lib/kbd/consolefonts/$SYSFONT.* ; do
|
||||
inst "$FN"
|
||||
case $FN in
|
||||
*.gz) gzip -d "$initdir$FN" ;;
|
||||
*.bz2) bzip2 -d "$initdir$FN" ;;
|
||||
*.gz) gzip -d "$initdir$FN" ;;
|
||||
*.bz2) bzip2 -d "$initdir$FN" ;;
|
||||
esac
|
||||
done
|
||||
done
|
||||
[[ $SYSFONTACM ]] && inst /lib/kbd/consoletrans/$SYSFONTACM
|
||||
[[ $UNIMAP ]] && inst /lib/kbd/unimaps/$UNIMAP
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -f /etc/sysconfig/i18n ]; then
|
||||
. /etc/sysconfig/i18n
|
||||
inst /etc/sysconfig/i18n
|
||||
[[ $SYSFONT ]] || SYSFONT=latarcyrheb-sun16
|
||||
inst setfont
|
||||
|
||||
for FN in /lib/kbd/consolefonts/$SYSFONT.* ; do
|
||||
inst "$FN"
|
||||
case $FN in
|
||||
*.gz) gzip -d "$initdir$FN" ;;
|
||||
*.bz2) bzip2 -d "$initdir$FN" ;;
|
||||
esac
|
||||
if [[ $hostonly ]]; then
|
||||
install_local
|
||||
else
|
||||
for i in $(find /lib/kbd -type f -print); do
|
||||
dracut_install $i
|
||||
done
|
||||
[[ $SYSFONTACM ]] && inst /lib/kbd/consoletrans/$SYSFONTACM
|
||||
[[ $UNIMAP ]] && inst /lib/kbd/unimaps/$UNIMAP
|
||||
# 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"
|
||||
|
20
modules.d/10redhat-i18n/parse-i18n.sh
Normal file
20
modules.d/10redhat-i18n/parse-i18n.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
inst_key_val()
|
||||
{
|
||||
local value
|
||||
value=$(getarg $1)
|
||||
[ -n "$value" ] && printf '%s="%s"\n' $1 $value >> $2
|
||||
}
|
||||
|
||||
mkdir -p /etc/sysconfig
|
||||
inst_key_val KEYBOARDTYPE /etc/sysconfig/keyboard
|
||||
inst_key_val KEYTABLE /etc/sysconfig/keyboard
|
||||
inst_key_val SYSFONT /etc/sysconfig/i18n
|
||||
inst_key_val SYSFONTACM /etc/sysconfig/i18n
|
||||
inst_key_val UNIMAP /etc/sysconfig/i18n
|
||||
inst_key_val LANG /etc/sysconfig/i18n
|
||||
|
||||
if [ -f /etc/sysconfig/i18n ]; then
|
||||
. /etc/sysconfig/i18n
|
||||
export LANG
|
||||
fi
|
||||
|
3
modules.d/10rpmversion/check
Executable file
3
modules.d/10rpmversion/check
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
[ -f /etc/redhat-release ]
|
||||
|
11
modules.d/10rpmversion/install
Executable file
11
modules.d/10rpmversion/install
Executable 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"
|
||||
|
6
modules.d/10rpmversion/version.sh
Normal file
6
modules.d/10rpmversion/version.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
for i in dracut-*; do
|
||||
if [ -f $i ]; then
|
||||
vinfo < $i
|
||||
fi
|
||||
done
|
||||
unset i
|
@@ -1,4 +1,19 @@
|
||||
#!/bin/sh
|
||||
which ip dhclient hostname >/dev/null 2>&1 || exit 1
|
||||
#!/bin/bash
|
||||
|
||||
. $dracutfunctions
|
||||
|
||||
for program in ip hostname; do
|
||||
which $program >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
dwarning "Could not find program \"$program\" required by network."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
for program in dhclient brctl; do
|
||||
which $program >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
dwarning "Could not find program \"$program\" it might be required by network."
|
||||
fi
|
||||
done
|
||||
exit 255
|
||||
|
||||
|
@@ -7,7 +7,7 @@ setup_interface() {
|
||||
bcast=$new_broadcast_address
|
||||
gw=${new_routers%%,*}
|
||||
domain=$new_domain_name
|
||||
search=$new_domain_search
|
||||
search=$(printf "$new_domain_search")
|
||||
namesrv=$new_domain_name_servers
|
||||
hostname=$new_host_name
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
@@ -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
|
||||
|
21
modules.d/40network/ifname-genrules.sh
Normal file
21
modules.d/40network/ifname-genrules.sh
Normal 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
|
@@ -60,6 +60,14 @@ fi
|
||||
# $netif reads easier than $1
|
||||
netif=$1
|
||||
|
||||
# bridge this interface?
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
if [ "$netif" = "$ethname" ]; then
|
||||
netif="$bridgename"
|
||||
fi
|
||||
fi
|
||||
|
||||
# bail immediately if the interface is already up
|
||||
# or we don't need the network
|
||||
[ -f "/tmp/net.$netif.up" ] && exit 0
|
||||
@@ -77,16 +85,23 @@ fi
|
||||
|
||||
# XXX need error handling like dhclient-script
|
||||
|
||||
# start bridge if necessary
|
||||
if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
|
||||
ip link set $ethname up
|
||||
# Create bridge and add eth to bridge
|
||||
brctl addbr $bridgename
|
||||
brctl setfd $bridgename 0
|
||||
brctl addif $bridgename $ethname
|
||||
fi
|
||||
|
||||
# No ip lines default to dhcp
|
||||
ip=$(getarg ip)
|
||||
[ -z "$ip" ] && do_dhcp;
|
||||
|
||||
# Specific configuration, spin through the kernel command line
|
||||
# looking for ip= lines
|
||||
[ "$CMDLINE" ] || read CMDLINE </proc/cmdline;
|
||||
for p in $CMDLINE; do
|
||||
[ -n "${p%ip=*}" ] && continue
|
||||
ip_to_var ${p#ip=}
|
||||
for p in $(getargs ip=); do
|
||||
ip_to_var $p
|
||||
|
||||
# If this option isn't directed at our interface, skip it
|
||||
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
|
||||
|
@@ -1,27 +1,17 @@
|
||||
#!/bin/bash
|
||||
dracut_install ip dhclient hostname
|
||||
# Include wired net drivers, excluding wireless
|
||||
for modname in $(find "/lib/modules/$kernel/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
|
||||
dracut_install ip dhclient hostname brctl
|
||||
inst "$moddir/ifup" "/sbin/ifup"
|
||||
inst "$moddir/netroot" "/sbin/netroot"
|
||||
inst "$moddir/dhclient-script" "/sbin/dhclient-script"
|
||||
inst "$moddir/dhclient.conf" "/etc/dhclient.conf"
|
||||
instmods ecb arc4
|
||||
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 20 "$moddir/write-ifcfg.sh"
|
||||
|
||||
mkdir -p "${initdir}/var/run"
|
||||
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
|
||||
|
16
modules.d/40network/installkernel
Executable file
16
modules.d/40network/installkernel
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
# Include wired net drivers, excluding wireless
|
||||
|
||||
net_module_test() {
|
||||
local net_drivers='eth_type_trans|register_virtio_device'
|
||||
local unwanted_drivers='/(wireless|isdn|uwb)/'
|
||||
nm -uPA "$1" | egrep -q $net_drivers && \
|
||||
nm -uPA "$1" | egrep -qv 'iw_handler_get_spy' && \
|
||||
[[ ! $1 =~ $unwanted_drivers ]]
|
||||
}
|
||||
|
||||
instmods $(filter_kernel_modules net_module_test)
|
||||
|
||||
instmods ecb arc4
|
||||
# bridge modules
|
||||
instmods bridge stp llc
|
@@ -2,7 +2,7 @@
|
||||
|
||||
# pxelinux provides macaddr '-' separated, but we need ':'
|
||||
fix_bootif() {
|
||||
local macaddr=${1##??-}
|
||||
local macaddr=${1}
|
||||
local IFS='-'
|
||||
macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
|
||||
macaddr=${macaddr%:}
|
||||
@@ -14,6 +14,11 @@ fix_bootif() {
|
||||
|
||||
# Write udev rules
|
||||
{
|
||||
# bridge: attempt only the defined interface
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
IFACES=$ethname
|
||||
fi
|
||||
|
||||
# BOOTIF says everything, use only that one
|
||||
BOOTIF=$(getarg 'BOOTIF=')
|
||||
@@ -24,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
|
||||
|
@@ -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
|
||||
|
53
modules.d/40network/parse-bridge.sh
Normal file
53
modules.d/40network/parse-bridge.sh
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Format:
|
||||
# bridge=<bridgename>:<ethname>
|
||||
#
|
||||
# bridge without parameters assumes bridge=br0:eth0
|
||||
#
|
||||
|
||||
# return if bridge already parsed
|
||||
[ -n "$bridgename" ] && return
|
||||
|
||||
# Check if bridge parameter is valid
|
||||
if getarg ip= >/dev/null ; then
|
||||
if [ -z "$netroot" ] ; then
|
||||
die "No netboot configured, bridge is invalid"
|
||||
fi
|
||||
fi
|
||||
|
||||
parsebridge() {
|
||||
local v=${1}:
|
||||
set --
|
||||
while [ -n "$v" ]; do
|
||||
set -- "$@" "${v%%:*}"
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
unset bridgename ethname
|
||||
case $# in
|
||||
0) bridgename=br0; ethname=eth0 ;;
|
||||
1) die "bridge= requires two parameters" ;;
|
||||
2) bridgename=$1; ethname=$2 ;;
|
||||
*) die "bridge= requires two parameters" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
unset bridgename ethname
|
||||
|
||||
# Parse bridge for bridgename and ethname
|
||||
if getarg bridge >/dev/null; then
|
||||
# Read bridge= parameters if they exist
|
||||
bridge="$(getarg bridge=)"
|
||||
if [ ! "$bridge" = "bridge" ]; then
|
||||
parsebridge "$(getarg bridge=)"
|
||||
fi
|
||||
# Simple default bridge
|
||||
if [ -z "$bridgename" ]; then
|
||||
bridgename=br0
|
||||
ethname=eth0
|
||||
fi
|
||||
echo "bridgename=$bridgename" > /tmp/bridge.info
|
||||
echo "ethname=$ethname" >> /tmp/bridge.info
|
||||
return
|
||||
fi
|
37
modules.d/40network/parse-ifname.sh
Normal file
37
modules.d/40network/parse-ifname.sh
Normal 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
|
@@ -45,18 +45,16 @@ getarg ip= >/dev/null && getarg BOOTIF= >/dev/null && \
|
||||
# No more parsing stuff, BOOTIF says everything
|
||||
[ -n "$(getarg BOOTIF)" ] && return
|
||||
|
||||
# Warn if defaulting to ip=dhcp
|
||||
if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] ; then
|
||||
warn "No ip= argument(s) for netroot provided, defaulting to DHCP"
|
||||
# No ip= argument(s) for netroot provided, defaulting to DHCP
|
||||
return;
|
||||
fi
|
||||
|
||||
# Count ip= lines to decide whether we need bootdev= or not
|
||||
if [ -z "$NEEDBOOTDEV" ] ; then
|
||||
[ "$CMDLINE" ] || read CMDLINE < /proc/cmdline
|
||||
local count=0
|
||||
for p in $CMDLINE; do
|
||||
[ "${p%%=*}" = "ip" ] && count=$(( $count + 1 ))
|
||||
for p in $(getargs ip=); do
|
||||
count=$(( $count + 1 ))
|
||||
done
|
||||
[ $count -gt 1 ] && NEEDBOOTDEV=1
|
||||
fi
|
||||
@@ -69,11 +67,8 @@ fi
|
||||
|
||||
# Check ip= lines
|
||||
# XXX Would be nice if we could errorcheck ip addresses here as well
|
||||
[ "$CMDLINE" ] || read CMDLINE < /proc/cmdline
|
||||
for p in $CMDLINE; do
|
||||
[ -n "${p%ip=*}" ] && continue
|
||||
|
||||
ip_to_var ${p#ip=}
|
||||
for p in $(getargs ip=); do
|
||||
ip_to_var $p
|
||||
|
||||
# We need to have an ip= line for the specified bootdev
|
||||
[ -n "$NEEDBOOTDEV" ] && [ "$dev" = "$BOOTDEV" ] && BOOTDEVOK=1
|
||||
@@ -86,28 +81,28 @@ for p in $CMDLINE; do
|
||||
|
||||
# Error checking for autoconf in combination with other values
|
||||
case $autoconf in
|
||||
error) die "Error parsing option '$p'";;
|
||||
error) die "Error parsing option 'ip=$p'";;
|
||||
bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";;
|
||||
none|off) \
|
||||
[ -z "$ip" ] && \
|
||||
die "For argument '$p'\nValue '$autoconf' without static configuration does not make sense"
|
||||
die "For argument 'ip=$p'\nValue '$autoconf' without static configuration does not make sense"
|
||||
[ -z "$mask" ] && \
|
||||
die "Sorry, automatic calculation of netmask is not yet supported"
|
||||
;;
|
||||
dhcp|on|any) \
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
||||
die "Sorry, '$p' does not make sense for multiple interface configurations"
|
||||
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
|
||||
[ -n "$ip" ] && \
|
||||
die "For argument '$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
|
||||
die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
|
||||
;;
|
||||
*) die "For argument '$p'\nSorry, unknown value '$autoconf'";;
|
||||
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoconf'";;
|
||||
esac
|
||||
|
||||
if [ -n "$dev" ] ; then
|
||||
# We don't like duplicate device configs
|
||||
if [ -n "$IFACES" ] ; then
|
||||
for i in $IFACES ; do
|
||||
[ "$dev" = "$i" ] && die "For argument '$p'\nDuplication configurations for '$dev'"
|
||||
[ "$dev" = "$i" ] && die "For argument 'ip=$p'\nDuplication configurations for '$dev'"
|
||||
done
|
||||
fi
|
||||
# IFACES list for later use
|
||||
@@ -143,4 +138,4 @@ fi
|
||||
[ -n "$IFACES" ] && echo $IFACES > /tmp/net.ifaces
|
||||
|
||||
# We need a ip= line for the configured bootdev=
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$BOOTDEVOK" ] && die "Bootdev Argument '$BOOTDEV' not found"
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$BOOTDEVOK" ] && die "Bootdev Argument '$BOOTDEV' not found"
|
||||
|
@@ -1,25 +1,52 @@
|
||||
#!/bin/sh
|
||||
|
||||
# NFS root might have reached here before /tmp/net.ifaces was written
|
||||
udevadm settle --timeout=30
|
||||
# Don't write anything if we don't know our bootdev
|
||||
[ -f /tmp/net.ifaces ] || return 1
|
||||
|
||||
read IFACES < /tmp/net.ifaces
|
||||
|
||||
for netif in $IFACES ; do
|
||||
mkdir -p /tmp/ifcfg/
|
||||
# bridge?
|
||||
unset bridge
|
||||
if [ "$netif" = "$bridgename" ]; then
|
||||
bridge=yes
|
||||
fi
|
||||
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
|
||||
echo "# Generated by dracut initrd" > /tmp/net.$netif.ifcfg
|
||||
echo "DEVICE=$netif" >> /tmp/net.$netif.ifcfg
|
||||
echo "HWADDR=$(cat /sys/class/net/$netif/address)" >> /tmp/net.$netif.ifcfg
|
||||
echo "TYPE=Ethernet" >> /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/ifcfg/ifcfg-$netif
|
||||
echo "TYPE=Ethernet" >> /tmp/ifcfg/ifcfg-$netif
|
||||
echo "NAME=\"Boot Disk\"" >> /tmp/ifcfg/ifcfg-$netif
|
||||
else
|
||||
# bridge
|
||||
echo "TYPE=Bridge" >> /tmp/ifcfg/ifcfg-$netif
|
||||
echo "NAME=\"Boot Disk\"" >> /tmp/ifcfg/ifcfg-$netif
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
echo "DEVICE=$ethname" >> /tmp/ifcfg/ifcfg-$ethname
|
||||
echo "TYPE=Ethernet" >> /tmp/ifcfg/ifcfg-$ethname
|
||||
echo "ONBOOT=yes" >> /tmp/ifcfg/ifcfg-$ethname
|
||||
echo "NETBOOT=yes" >> /tmp/ifcfg/ifcfg-$ethname
|
||||
echo "HWADDR=$(cat /sys/class/net/$ethname/address)" >> /tmp/ifcfg/ifcfg-$ethname
|
||||
echo "BRIDGE=$netif" >> /tmp/ifcfg/ifcfg-$ethname
|
||||
echo "NAME=$ethname" >> /tmp/ifcfg/ifcfg-$ethname
|
||||
fi
|
||||
done
|
||||
|
@@ -1,11 +0,0 @@
|
||||
# hacky rules to try to try unlocking dm-crypt devs
|
||||
#
|
||||
# Copyright 2008, Red Hat, Inc.
|
||||
# Jeremy Katz <katzj@redhat.com>
|
||||
|
||||
|
||||
SUBSYSTEM!="block", GOTO="luks_end"
|
||||
ACTION!="add|change", GOTO="luks_end"
|
||||
ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
|
||||
|
||||
LABEL="luks_end"
|
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
[[ $1 = -d ]] && echo crypt
|
||||
[[ -x /sbin/plymouthd && -x /bin/plymouth && ! /usr/sbin/plymouth-set-default-theme ]]
|
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -b /dev/mapper/$2 ] || exec /bin/plymouth ask-for-password --command="/sbin/cryptsetup luksOpen -T1 $1 $2"
|
||||
|
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
. "$moddir"/plymouth-populate-initrd
|
||||
inst_hook pre-udev 10 "$moddir"/plymouth-start.sh
|
||||
inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
|
||||
inst_rules "$moddir/63-luks.rules"
|
||||
inst "$moddir"/cryptroot-ask.sh /lib/udev/cryptroot-ask
|
||||
inst cryptsetup
|
||||
|
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --newroot=$NEWROOT
|
||||
|
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
if ldd /sbin/plymouthd |grep -q lib64; then
|
||||
LIBDIR="/usr/lib64"
|
||||
else
|
||||
LIBDIR="/usr/lib"
|
||||
fi
|
||||
PLYMOUTH_LOGO_FILE="/usr/share/pixmaps/system-logo-white.png"
|
||||
PLYMOUTH_PLUGIN_NAME=$(plymouth-set-default-plugin)
|
||||
|
||||
inst /sbin/plymouthd /bin/plymouthd
|
||||
dracut_install /bin/plymouth "${LIBDIR}/plymouth/text.so" \
|
||||
"${LIBDIR}/plymouth/details.so" "${PLYMOUTH_LOGO_FILE}" \
|
||||
/etc/system-release "${LIBDIR}/plymouth/${PLYMOUTH_PLUGIN_NAME:=text}.so"
|
||||
mkdir -p "${initdir}/usr/share/plymouth"
|
||||
|
||||
[[ -f ${LIBDIR}/plymouth/default.so ]] && inst ${LIBDIR}/plymouth/default.so
|
||||
|
||||
if [[ -d /usr/share/plymouth/${PLYMOUTH_PLUGIN_NAME} ]]; then
|
||||
for x in "/usr/share/plymouth/${PLYMOUTH_PLUGIN_NAME}"/* ; do
|
||||
[[ -f "$x" ]] || break
|
||||
inst $x
|
||||
done
|
||||
fi
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
@@ -1,31 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -c /dev/null ] || mknod /dev/null c 1 3
|
||||
mknod /dev/zero c 1 5
|
||||
mknod /dev/systty c 4 0
|
||||
mknod /dev/tty c 5 0
|
||||
[ -c /dev/console ] || mknod /dev/console c 5 1
|
||||
[ -c /dev/ptmx ] || mknod /dev/ptmx c 5 2
|
||||
mknod /dev/fb c 29 0
|
||||
mknod /dev/tty0 c 4 0
|
||||
mknod /dev/tty1 c 4 1
|
||||
mknod /dev/tty2 c 4 2
|
||||
mknod /dev/tty3 c 4 3
|
||||
mknod /dev/tty4 c 4 4
|
||||
mknod /dev/tty5 c 4 5
|
||||
mknod /dev/tty6 c 4 6
|
||||
mknod /dev/tty7 c 4 7
|
||||
mknod /dev/tty8 c 4 8
|
||||
mknod /dev/tty9 c 4 9
|
||||
mknod /dev/tty10 c 4 10
|
||||
mknod /dev/tty11 c 4 11
|
||||
mknod /dev/tty12 c 4 12
|
||||
mknod /dev/ttyS0 c 4 64
|
||||
mknod /dev/ttyS1 c 4 65
|
||||
mknod /dev/ttyS2 c 4 66
|
||||
mknod /dev/ttyS3 c 4 67
|
||||
/lib/udev/console_init tty0
|
||||
|
||||
[ -x /bin/plymouthd ] && /bin/plymouthd
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --show-splash
|
||||
|
@@ -1,12 +0,0 @@
|
||||
# hacky rules to try to try unlocking dm-crypt devs
|
||||
#
|
||||
# Copyright 2008, Red Hat, Inc.
|
||||
# Jeremy Katz <katzj@redhat.com>
|
||||
|
||||
|
||||
SUBSYSTEM!="block", GOTO="luks_end"
|
||||
ACTION!="add|change", GOTO="luks_end"
|
||||
|
||||
ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
|
||||
|
||||
LABEL="luks_end"
|
@@ -1,4 +1,45 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -b /dev/mapper/$2 ] || exec /bin/plymouth ask-for-password --command="/sbin/cryptsetup luksOpen -T1 $1 $2"
|
||||
# do not ask, if we already have root
|
||||
[ -f /sysroot/proc ] && exit 0
|
||||
|
||||
# check if destination already exists
|
||||
[ -b /dev/mapper/$2 ] && exit 0
|
||||
|
||||
# we already asked for this device
|
||||
[ -f /tmp/cryptroot-asked-$2 ] && exit 0
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
LUKS=$(getargs rd_LUKS_UUID=)
|
||||
ask=1
|
||||
|
||||
if [ -n "$LUKS" ]; then
|
||||
ask=0
|
||||
luuid=${2##luks-}
|
||||
for luks in $LUKS; do
|
||||
if [ "${luuid##$luks}" != "$2" ]; then
|
||||
ask=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ $ask -gt 0 ]; then
|
||||
info "luksOpen $1 $2"
|
||||
# flock against other interactive activities
|
||||
{ flock -s 9;
|
||||
/bin/plymouth ask-for-password \
|
||||
--prompt "$1 is password protected" \
|
||||
--command="/sbin/cryptsetup luksOpen -T1 $1 $2"
|
||||
} 9>/.console.lock
|
||||
fi
|
||||
|
||||
# mark device as asked
|
||||
>> /tmp/cryptroot-asked-$2
|
||||
|
||||
udevsettle
|
||||
|
||||
unset LUKS
|
||||
unset ask
|
||||
unset luks
|
||||
exit 0
|
||||
|
||||
|
@@ -1,10 +1,15 @@
|
||||
#!/bin/bash
|
||||
. "$moddir"/plymouth-populate-initrd
|
||||
|
||||
if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \
|
||||
|| ! grep -q PLYMOUTH_POPULATE_SOURCE_FUNCTIONS /usr/libexec/plymouth/plymouth-populate-initrd \
|
||||
|| [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
|
||||
. "$moddir"/plymouth-populate-initrd
|
||||
else
|
||||
PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
|
||||
/usr/libexec/plymouth/plymouth-populate-initrd -t $initdir
|
||||
fi
|
||||
|
||||
inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
|
||||
inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
|
||||
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
|
||||
inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
|
||||
# Include KMS capable drm drivers
|
||||
for modname in $(find "/lib/modules/$kernel/kernel/drivers/gpu/drm" -name '*.ko'); do
|
||||
nm -uPA $modname | grep -q drm_crtc_init && instmods $modname
|
||||
done
|
||||
|
5
modules.d/50plymouth/installkernel
Executable file
5
modules.d/50plymouth/installkernel
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Include KMS capable drm drivers
|
||||
for modname in $(find "$srcmods/kernel/drivers/gpu/drm" -name '*.ko'); do
|
||||
nm -uPA $modname | grep -q drm_crtc_init && instmods $modname
|
||||
done
|
@@ -8,31 +8,47 @@ PLYMOUTH_LOGO_FILE="/usr/share/pixmaps/system-logo-white.png"
|
||||
PLYMOUTH_THEME=$(plymouth-set-default-theme)
|
||||
|
||||
inst /sbin/plymouthd /bin/plymouthd
|
||||
dracut_install /bin/plymouth "${LIBDIR}/plymouth/text.so" \
|
||||
"${LIBDIR}/plymouth/details.so" \
|
||||
"/usr/share/plymouth/themes/details/details.plymouth" \
|
||||
"/usr/share/plymouth/themes/text/text.plymouth" \
|
||||
dracut_install /bin/plymouth \
|
||||
"${PLYMOUTH_LOGO_FILE}" \
|
||||
/etc/system-release
|
||||
|
||||
if [[ -f "${LIBDIR}/plymouth/${PLYMOUTH_THEME:=text}.so" ]]; then
|
||||
dracut_install "${LIBDIR}/plymouth/${PLYMOUTH_THEME:=text}.so"
|
||||
fi
|
||||
|
||||
mkdir -p "${initdir}/usr/share/plymouth"
|
||||
|
||||
if [[ -d /usr/share/plymouth/themes/${PLYMOUTH_THEME} ]]; then
|
||||
for x in "/usr/share/plymouth/themes/${PLYMOUTH_THEME}"/* ; do
|
||||
[[ -f "$x" ]] || break
|
||||
inst $x
|
||||
done
|
||||
fi
|
||||
if [[ $hostonly ]]; then
|
||||
dracut_install "${LIBDIR}/plymouth/text.so" \
|
||||
"${LIBDIR}/plymouth/details.so" \
|
||||
"/usr/share/plymouth/themes/details/details.plymouth" \
|
||||
"/usr/share/plymouth/themes/text/text.plymouth" \
|
||||
|
||||
if [ -L /usr/share/plymouth/themes/default.plymouth ]; then
|
||||
inst /usr/share/plymouth/themes/default.plymouth
|
||||
# Install plugin for this theme
|
||||
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth |awk -F= {'print $2'})
|
||||
inst ${LIBDIR}/plymouth/${PLYMOUTH_PLUGIN}.so
|
||||
if [[ -d /usr/share/plymouth/themes/${PLYMOUTH_THEME} ]]; then
|
||||
for x in "/usr/share/plymouth/themes/${PLYMOUTH_THEME}"/* ; do
|
||||
[[ -f "$x" ]] || break
|
||||
inst $x
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -L /usr/share/plymouth/themes/default.plymouth ]; then
|
||||
inst /usr/share/plymouth/themes/default.plymouth
|
||||
# Install plugin for this theme
|
||||
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth |awk -F= {'print $2'})
|
||||
inst ${LIBDIR}/plymouth/${PLYMOUTH_PLUGIN}.so
|
||||
fi
|
||||
else
|
||||
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/{text,details}.so ; do
|
||||
[[ -f "$x" ]] || continue
|
||||
[[ "$x" != "${x%%/label.so}" ]] && continue
|
||||
dracut_install "$x"
|
||||
done
|
||||
(
|
||||
cd ${initdir}/usr/share/plymouth/themes;
|
||||
ln -s text/text.plymouth default.plymouth 2>&1;
|
||||
)
|
||||
fi
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
||||
|
@@ -1,21 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
# first trigger graphics subsystem
|
||||
udevadm trigger --attr-match=class=0x030000
|
||||
# first trigger graphics and tty subsystem
|
||||
udevadm trigger --subsystem-match=graphics --subsystem-match=tty >/dev/null 2>&1
|
||||
# add nomatch for full trigger
|
||||
udevtriggeropts="$udevtriggeropts --subsystem-nomatch=graphics --subsystem-nomatch=tty"
|
||||
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 >/dev/null 2>&1
|
||||
[ -c /dev/null ] || mknod /dev/null c 1 3
|
||||
[ -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
|
||||
|
||||
[ -x /bin/plymouthd ] && /bin/plymouthd
|
||||
info "Starting plymouth daemon"
|
||||
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session
|
||||
/bin/plymouth --show-splash 2>&1 | vinfo
|
||||
fi
|
||||
|
||||
/lib/udev/console_init tty0
|
||||
/bin/plymouth --show-splash
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
||||
|
@@ -7,6 +7,6 @@
|
||||
SUBSYSTEM!="block", GOTO="luks_end"
|
||||
ACTION!="add|change", GOTO="luks_end"
|
||||
|
||||
ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/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"
|
||||
|
@@ -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
|
||||
|
4
modules.d/90crypt/crypt-cleanup.sh
Executable file
4
modules.d/90crypt/crypt-cleanup.sh
Executable 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
|
@@ -1,7 +1,38 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -b /dev/mapper/$2 ] && exit 0
|
||||
{ flock -s 9;
|
||||
/sbin/cryptsetup luksOpen -T1 $1 $2 </dev/console >/dev/console 2>&1
|
||||
} 9>/.console.lock
|
||||
# do not ask, if we already have root
|
||||
[ -f /sysroot/proc ] && exit 0
|
||||
|
||||
# check if destination already exists
|
||||
[ -b /dev/mapper/$2 ] && exit 0
|
||||
|
||||
# we already asked for this device
|
||||
[ -f /tmp/cryptroot-asked-$2 ] && exit 0
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
LUKS=$(getargs rd_LUKS_UUID=)
|
||||
ask=1
|
||||
|
||||
if [ -n "$LUKS" ]; then
|
||||
ask=0
|
||||
luuid=${2##luks-}
|
||||
for luks in $LUKS; do
|
||||
if [ "${luuid##$luks}" != "$2" ]; then
|
||||
ask=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ $ask -gt 0 ]; then
|
||||
info "luksOpen $1 $2"
|
||||
# flock against other interactive activities
|
||||
{ flock -s 9;
|
||||
echo -n "$1 is password protected "
|
||||
/sbin/cryptsetup luksOpen -T1 $1 $2
|
||||
} 9>/.console.lock
|
||||
fi
|
||||
|
||||
# mark device as asked
|
||||
>> /tmp/cryptroot-asked-$2
|
||||
|
||||
exit 0
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
inst cryptsetup
|
||||
instmods dm_crypt cbc aes sha256 xts
|
||||
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"
|
||||
|
2
modules.d/90crypt/installkernel
Executable file
2
modules.d/90crypt/installkernel
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
instmods dm_crypt cbc aes sha256 xts
|
5
modules.d/90crypt/parse-crypt.sh
Executable file
5
modules.d/90crypt/parse-crypt.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
if getarg rd_NO_LUKS; then
|
||||
info "rd_NO_LUKS: removing cryptoluks activation"
|
||||
rm -f /etc/udev/rules.d/70-luks.rules
|
||||
fi
|
||||
|
24
modules.d/90dmraid/61-dmraid-imsm.rules
Normal file
24
modules.d/90dmraid/61-dmraid-imsm.rules
Normal file
@@ -0,0 +1,24 @@
|
||||
# This file causes block devices with RAID (dmraid) signatures to
|
||||
# automatically cause dmraid_scan to be run.
|
||||
# See udev(8) for syntax
|
||||
|
||||
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}!="*_raid_member", , GOTO="dm_end"
|
||||
|
||||
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"
|
@@ -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
|
||||
|
2
modules.d/90dmraid/dmraid-cleanup.sh
Executable file
2
modules.d/90dmraid/dmraid-cleanup.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
# close everything which is not busy
|
||||
dmraid -an >/dev/null 2>&1
|
38
modules.d/90dmraid/dmraid.sh
Normal file → Executable file
38
modules.d/90dmraid/dmraid.sh
Normal file → Executable file
@@ -1,3 +1,37 @@
|
||||
dmraid -ay
|
||||
udevadm settle --timeout=30 >/dev/null 2>&1
|
||||
#!/bin/sh
|
||||
|
||||
. /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
|
||||
|
@@ -1,4 +1,13 @@
|
||||
#!/bin/bash
|
||||
dracut_install dmraid
|
||||
inst_hook pre-mount 10 "$moddir/dmraid.sh"
|
||||
inst_rules 64-md-raid.rules
|
||||
dracut_install dmraid partx kpartx
|
||||
inst "$moddir/dmraid.sh" /sbin/dmraid_scan
|
||||
|
||||
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"
|
||||
|
||||
|
4
modules.d/90dmraid/parse-dm.sh
Normal file
4
modules.d/90dmraid/parse-dm.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
if getarg rd_NO_DM; then
|
||||
info "rd_NO_DM: removing DM RAID activation"
|
||||
udevproperty rd_NO_DM=1
|
||||
fi
|
@@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -x /lib/udev/devkit-disks-dm-export ] || exit 1
|
||||
|
||||
exit 0
|
@@ -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
12
modules.d/90dmsquash-live/check
Executable 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
|
13
modules.d/90dmsquash-live/dmsquash-live-genrules.sh
Normal file
13
modules.d/90dmsquash-live/dmsquash-live-genrules.sh
Normal 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
|
177
modules.d/90dmsquash-live/dmsquash-live-root
Executable file
177
modules.d/90dmsquash-live/dmsquash-live-root
Executable 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
|
21
modules.d/90dmsquash-live/install
Executable file
21
modules.d/90dmsquash-live/install
Executable 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
|
40
modules.d/90dmsquash-live/parse-dmsquash-live.sh
Executable file
40
modules.d/90dmsquash-live/parse-dmsquash-live.sh
Executable 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"
|
@@ -1,7 +1,3 @@
|
||||
#!/bin/bash
|
||||
# FIXME: hard-coded module list of doom.
|
||||
[[ $drivers ]] || drivers="=block sd_mod =fs"
|
||||
instmods $drivers
|
||||
|
||||
[ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf
|
||||
dracut_install $(find /etc/modprobe.d/ -type f -name '*.conf')
|
||||
|
23
modules.d/90kernel-modules/installkernel
Executable file
23
modules.d/90kernel-modules/installkernel
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
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
|
||||
# hardcoded list of exceptions
|
||||
rm -fr ${initdir}/lib/modules/*/kernel/fs/ocfs2
|
||||
else
|
||||
instmods $drivers
|
||||
fi
|
||||
|
||||
[[ $add_drivers ]] && instmods $add_drivers
|
||||
|
||||
instmods scsi_wait_scan
|
@@ -1,20 +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-*", GOTO="lvm_end"
|
||||
|
||||
IMPORT{program}="vol_id --export $tempnode"
|
||||
|
||||
ENV{ID_FS_TYPE}=="LVM2_member", RUN+="/bin/sh -c '/sbin/lvm vgscan; /sbin/lvm vgchange -ay'"
|
||||
|
||||
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"
|
@@ -6,15 +6,14 @@
|
||||
|
||||
SUBSYSTEM!="block", GOTO="lvm_end"
|
||||
ACTION!="add|change", GOTO="lvm_end"
|
||||
KERNEL!="dm-*", GOTO="lvm_end"
|
||||
KERNEL=="dm-[0-9]*", ACTION=="add", GOTO="lvm_end"
|
||||
ENV{ID_FS_TYPE}!="LVM2_member", GOTO="lvm_end"
|
||||
|
||||
IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
|
||||
|
||||
ENV{ID_FS_TYPE}=="LVM2_member", RUN+="/bin/sh -c '/sbin/lvm vgscan; /sbin/lvm vgchange -ay'"
|
||||
|
||||
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"
|
||||
|
@@ -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
|
||||
|
@@ -1,7 +1,13 @@
|
||||
#!/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
|
||||
|
||||
inst_rules "$moddir/64-lvm.rules" 64-lvm.rules
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
[ -f /etc/lvm/lvm.conf ] && inst /etc/lvm/lvm.conf
|
||||
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
2
modules.d/90lvm/lvm-cleanup.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
# stop everything which is not busy
|
||||
lvm vgchange -a n >/dev/null 2>&1
|
35
modules.d/90lvm/lvm_scan.sh
Executable file
35
modules.d/90lvm/lvm_scan.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
# run lvm scan if udev has settled
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
VGS=$(getargs rd_LVM_VG=)
|
||||
|
||||
[ -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
|
5
modules.d/90lvm/parse-lvm.sh
Normal file
5
modules.d/90lvm/parse-lvm.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
if getarg rd_NO_LVM; then
|
||||
info "rd_NO_LVM: removing LVM activation"
|
||||
rm -f /etc/udev/rules.d/64-lvm*.rules
|
||||
fi
|
||||
|
@@ -1,12 +0,0 @@
|
||||
# This file causes block devices with Linux RAID (mdadm) signatures to
|
||||
# automatically cause mdadm to be run.
|
||||
# See udev(8) for syntax
|
||||
|
||||
SUBSYSTEM!="block", GOTO="raid_end"
|
||||
ACTION!="add|change", GOTO="raid_end"
|
||||
KERNEL=="md/*", GOTO="raid_end"
|
||||
|
||||
KERNEL=="md*", IMPORT{program}="vol_id --export $tempnode"
|
||||
ENV{ID_FS_TYPE}=="linux_raid_member", RUN+="/sbin/mdadm -IR $root/%k"
|
||||
|
||||
LABEL="raid_end"
|
85
modules.d/90mdraid/65-md-incremental-imsm.rules
Normal file
85
modules.d/90mdraid/65-md-incremental-imsm.rules
Normal file
@@ -0,0 +1,85 @@
|
||||
# This file causes block devices with Linux RAID (mdadm) signatures to
|
||||
# automatically cause mdadm to be run.
|
||||
# See udev(8) for syntax
|
||||
|
||||
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"
|
||||
|
||||
ENV{rd_NO_MD}=="?*", GOTO="md_inc_end"
|
||||
|
||||
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"
|
||||
|
||||
#
|
||||
# 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/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"
|
@@ -1,8 +0,0 @@
|
||||
# This file causes block devices with Linux RAID (mdadm) signatures to
|
||||
# automatically cause mdadm to be run.
|
||||
# See udev(8) for syntax
|
||||
|
||||
SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="linux_raid_member", \
|
||||
IMPORT{program}="/sbin/mdadm --examine --export $tempnode", \
|
||||
RUN+="/bin/bash -c '[ ! -f /dev/.in_sysinit ] && /sbin/mdadm -I $env{DEVNAME}'"
|
||||
|
@@ -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
|
||||
|
@@ -1,20 +1,40 @@
|
||||
#!/bin/bash
|
||||
dracut_install mdadm
|
||||
inst /etc/passwd
|
||||
inst /etc/group
|
||||
instmods =drivers/md
|
||||
|
||||
if [ -x /lib/udev/vol_id ]; then
|
||||
inst_rules "$moddir/61-mdadm.rules"
|
||||
else
|
||||
inst_rules "$moddir/65-md-incremental.rules"
|
||||
dracut_install mdadm partx
|
||||
|
||||
|
||||
# XXX: mdmon really needs to run as non-root?
|
||||
# If so, write only the user it needs in the initrd's /etc/passwd (and maybe /etc/group)
|
||||
# in a similar fashion to modules.d/95nfs. Do not copy /etc/passwd and /etc/group from
|
||||
# the system into the initrd.
|
||||
# dledford has hardware to test this, so he should be able to clean this up.
|
||||
# inst /etc/passwd
|
||||
# inst /etc/group
|
||||
|
||||
if [ ! -x /lib/udev/vol_id ]; then
|
||||
inst_rules 64-md-raid.rules
|
||||
fi
|
||||
|
||||
[ -f /etc/mdadm/mdadm.conf ] && inst /etc/mdadm/mdadm.conf /etc/mdadm.conf
|
||||
[ -f /etc/mdadm.conf ] && inst /etc/mdadm.conf
|
||||
inst_rules "$moddir/65-md-incremental-imsm.rules"
|
||||
|
||||
if ! mdadm -Q -e imsm /dev/null &> /dev/null; then
|
||||
inst_hook pre-trigger 30 "$moddir/md-noimsm.sh"
|
||||
fi
|
||||
|
||||
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"
|
||||
|
3
modules.d/90mdraid/installkernel
Executable file
3
modules.d/90mdraid/installkernel
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
instmods =drivers/md
|
||||
|
2
modules.d/90mdraid/md-noimsm.sh
Normal file
2
modules.d/90mdraid/md-noimsm.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
info "rd_NO_MDIMSM: no MD RAID for imsm/isw raids"
|
||||
udevproperty rd_NO_MDIMSM=1
|
7
modules.d/90mdraid/md_finished.sh
Normal file
7
modules.d/90mdraid/md_finished.sh
Normal 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
|
7
modules.d/90mdraid/mdadm_auto.sh
Executable file
7
modules.d/90mdraid/mdadm_auto.sh
Executable 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
|
8
modules.d/90mdraid/mdcontainer_start.sh
Executable file
8
modules.d/90mdraid/mdcontainer_start.sh
Executable 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
|
@@ -1,3 +0,0 @@
|
||||
# switch any mdmon instances to newroot
|
||||
[ -f /etc/mdadm.conf ] && /sbin/mdmon /proc/mdstat $NEWROOT
|
||||
|
4
modules.d/90mdraid/mdmon-pre-udev.sh
Normal file
4
modules.d/90mdraid/mdmon-pre-udev.sh
Normal 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
|
15
modules.d/90mdraid/mdraid-cleanup.sh
Executable file
15
modules.d/90mdraid/mdraid-cleanup.sh
Executable 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
|
8
modules.d/90mdraid/mdraid_start.sh
Executable file
8
modules.d/90mdraid/mdraid_start.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /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
|
36
modules.d/90mdraid/parse-md.sh
Normal file
36
modules.d/90mdraid/parse-md.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
if getarg rd_NO_MD; then
|
||||
info "rd_NO_MD: removing MD RAID activation"
|
||||
udevproperty rd_NO_MD=1
|
||||
else
|
||||
MD_UUID=$(getargs rd_MD_UUID=)
|
||||
|
||||
# rewrite the md rules to only process the specified raid array
|
||||
if [ -n "$MD_UUID" ]; then
|
||||
for f in /etc/udev/rules.d/65-md-incremental*.rules; do
|
||||
[ -e "$f" ] || continue
|
||||
mv $f ${f}.bak
|
||||
while read line; do
|
||||
if [ "${line%%UUID CHECK}" != "$line" ]; then
|
||||
for uuid in $MD_UUID; do
|
||||
printf 'ENV{MD_UUID}=="%s", GOTO="do_md_inc"\n' $uuid
|
||||
done;
|
||||
printf 'GOTO="md_inc_end"\n';
|
||||
else
|
||||
echo $line;
|
||||
fi
|
||||
done < ${f}.bak > $f
|
||||
rm ${f}.bak
|
||||
done
|
||||
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"
|
||||
udevproperty rd_NO_MDIMSM=1
|
||||
fi
|
4
modules.d/95debug/check
Executable file
4
modules.d/95debug/check
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
# do not add this module by default
|
||||
exit 1
|
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
dracut_install ln ps grep more dmesg cat rm strace free showmount
|
||||
dracut_install ping netstat rpcinfo
|
||||
dracut_install -o ps grep more cat rm strace free showmount
|
||||
dracut_install -o ping netstat rpcinfo vi scp
|
||||
|
11
modules.d/95fcoe/check
Executable file
11
modules.d/95fcoe/check
Executable 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
|
14
modules.d/95fcoe/fcoe-genrules.sh
Executable file
14
modules.d/95fcoe/fcoe-genrules.sh
Executable 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
16
modules.d/95fcoe/fcoe-up
Executable 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
7
modules.d/95fcoe/install
Executable 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
2
modules.d/95fcoe/installkernel
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
instmods fcoe
|
48
modules.d/95fcoe/parse-fcoe.sh
Executable file
48
modules.d/95fcoe/parse-fcoe.sh
Executable 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"
|
@@ -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
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
dracut_install umount
|
||||
inst iscsistart
|
||||
inst hostname
|
||||
inst iscsi-iname
|
||||
inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
|
||||
inst "$moddir/iscsiroot" "/sbin/iscsiroot"
|
||||
instmods iscsi_tcp crc32c
|
||||
inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
|
||||
|
2
modules.d/95iscsi/installkernel
Executable file
2
modules.d/95iscsi/installkernel
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
instmods iscsi_tcp crc32c iscsi_ibft
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user