Compare commits
227 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6af5a4accf | ||
![]() |
ec8974914f | ||
![]() |
b9775297cd | ||
![]() |
4a6b33f1ee | ||
![]() |
7dd7ff0f33 | ||
![]() |
126732bcc1 | ||
![]() |
23d6dcd125 | ||
![]() |
9fd9e96130 | ||
![]() |
f0a7fc5b43 | ||
![]() |
d82e0d7dd8 | ||
![]() |
5545fc3046 | ||
![]() |
a638056838 | ||
![]() |
1f524c4544 | ||
![]() |
47b8f66ced | ||
![]() |
52da8a514a | ||
![]() |
5cd7c104bd | ||
![]() |
173edca09e | ||
![]() |
506b219237 | ||
![]() |
6c83d7d5bf | ||
![]() |
a059f72b09 | ||
![]() |
afcebd136f | ||
![]() |
3d3c192621 | ||
![]() |
92b3ee855f | ||
![]() |
650ab3b077 | ||
![]() |
474cca1e9d | ||
![]() |
c0cae7f702 | ||
![]() |
3f7e5358e5 | ||
![]() |
3d352f5228 | ||
![]() |
540eca9d9d | ||
![]() |
19cd47fd26 | ||
![]() |
cf62cc435f | ||
![]() |
8b6bdafc39 | ||
![]() |
27790828d1 | ||
![]() |
d782ffb822 | ||
![]() |
5a84ac3fe3 | ||
![]() |
343b7d7488 | ||
![]() |
aefea76cf8 | ||
![]() |
4976edb1a6 | ||
![]() |
171ba532bc | ||
![]() |
bfd2e8c25f | ||
![]() |
b2d225a669 | ||
![]() |
a5f01bbfb5 | ||
![]() |
7e2285a48a | ||
![]() |
3e964eeb96 | ||
![]() |
aec9f902f0 | ||
![]() |
764eb40cc9 | ||
![]() |
95a5b23a38 | ||
![]() |
5d833a9f5b | ||
![]() |
3e51b2f6fc | ||
![]() |
852105dc44 | ||
![]() |
a7473ef379 | ||
![]() |
f7f3792390 | ||
![]() |
2d674a9336 | ||
![]() |
24a38bc1cb | ||
![]() |
82b1739dce | ||
![]() |
fc6b272f41 | ||
![]() |
c9baff669d | ||
![]() |
72ee74b9be | ||
![]() |
cc21808764 | ||
![]() |
78021eace1 | ||
![]() |
65d1a8a4ae | ||
![]() |
187a8e08d5 | ||
![]() |
c9a81c1f91 | ||
![]() |
d580636e97 | ||
![]() |
6ca264a151 | ||
![]() |
aa505d588f | ||
![]() |
96c6fa9202 | ||
![]() |
25706eafac | ||
![]() |
8aa9926839 | ||
![]() |
ff3953efe1 | ||
![]() |
ec5e5ae27a | ||
![]() |
3cc4c8ba9b | ||
![]() |
81672479af | ||
![]() |
6a5170a15f | ||
![]() |
1f4aaaeb5e | ||
![]() |
79148c2945 | ||
![]() |
5767201eaf | ||
![]() |
221c342d50 | ||
![]() |
b56e174322 | ||
![]() |
5afa957915 | ||
![]() |
af3b67b213 | ||
![]() |
93d7b823b4 | ||
![]() |
4a1255bc38 | ||
![]() |
15976a0670 | ||
![]() |
24ba78cb77 | ||
![]() |
15f0b1f624 | ||
![]() |
823311ea3b | ||
![]() |
f67a1f7f64 | ||
![]() |
e625eea4f9 | ||
![]() |
f6297ebe73 | ||
![]() |
372c9b9647 | ||
![]() |
63c65b984a | ||
![]() |
06c6ea654f | ||
![]() |
ab8bfca794 | ||
![]() |
386579a45a | ||
![]() |
f1040fc470 | ||
![]() |
585fd00624 | ||
![]() |
e045e1f386 | ||
![]() |
bf7883ebca | ||
![]() |
a844fb1552 | ||
![]() |
35022f987c | ||
![]() |
8a240aca9e | ||
![]() |
68e7661ca7 | ||
![]() |
e88e3b2797 | ||
![]() |
df68781fca | ||
![]() |
f855f9daaf | ||
![]() |
c5758f2090 | ||
![]() |
3e9b4330a9 | ||
![]() |
c072e13162 | ||
![]() |
f2271428d4 | ||
![]() |
cef379bb03 | ||
![]() |
3e624cd9dc | ||
![]() |
5297d4f5b2 | ||
![]() |
b7c8f59fef | ||
![]() |
13f77e9fd5 | ||
![]() |
472189da15 | ||
![]() |
e5ec81a354 | ||
![]() |
4c3be42cdf | ||
![]() |
24450a5ab7 | ||
![]() |
df7be11b38 | ||
![]() |
52f74c8010 | ||
![]() |
ddf818dad5 | ||
![]() |
e65caf3696 | ||
![]() |
a0af318a8d | ||
![]() |
c008b0ce10 | ||
![]() |
258de82819 | ||
![]() |
c243105e6b | ||
![]() |
3bb4700f98 | ||
![]() |
6bd4ca5644 | ||
![]() |
a01cf5d782 | ||
![]() |
7292a59593 | ||
![]() |
765d8408e9 | ||
![]() |
6da9cb4ba7 | ||
![]() |
3780d7e449 | ||
![]() |
a43f97c4e3 | ||
![]() |
4ee59ab3ed | ||
![]() |
0f283709c9 | ||
![]() |
7a1f355fb5 | ||
![]() |
030ade7590 | ||
![]() |
1ddc789f5a | ||
![]() |
3d115217e4 | ||
![]() |
f31049c17f | ||
![]() |
e6bec9b793 | ||
![]() |
982032fd26 | ||
![]() |
2499c305f9 | ||
![]() |
f6c2faebfa | ||
![]() |
98eb6d57df | ||
![]() |
f60cd2593f | ||
![]() |
2723ebba9a | ||
![]() |
badda27f61 | ||
![]() |
0d57270395 | ||
![]() |
3e1d48fd12 | ||
![]() |
83a420674b | ||
![]() |
9f5c98a76a | ||
![]() |
fc5b6b0328 | ||
![]() |
4dda0095a1 | ||
![]() |
bef2fd9722 | ||
![]() |
ad401d1eaf | ||
![]() |
a92311074b | ||
![]() |
9ede75b1ce | ||
![]() |
fe5f8d0074 | ||
![]() |
0028ffac74 | ||
![]() |
792b189317 | ||
![]() |
43bac63e33 | ||
![]() |
450b5f336d | ||
![]() |
4eafdbdbe8 | ||
![]() |
27fa604418 | ||
![]() |
3c1feedfd1 | ||
![]() |
2023d8eb5b | ||
![]() |
a17fc9902e | ||
![]() |
d6e8280cd8 | ||
![]() |
cbefa47006 | ||
![]() |
b4e20a898e | ||
![]() |
6795dcc4fc | ||
![]() |
fbf658fece | ||
![]() |
593b315c70 | ||
![]() |
56ed92922e | ||
![]() |
9954876417 | ||
![]() |
d96c3254e8 | ||
![]() |
e1619ee151 | ||
![]() |
e09048aaf5 | ||
![]() |
a421016671 | ||
![]() |
f1e7add2bf | ||
![]() |
528864e460 | ||
![]() |
1760dfc051 | ||
![]() |
5d0404e3b3 | ||
![]() |
18595cede8 | ||
![]() |
e5efb6a798 | ||
![]() |
f1e9f613d9 | ||
![]() |
e7dc1e42cd | ||
![]() |
d04f16f600 | ||
![]() |
338b43cd6a | ||
![]() |
394ffc1d97 | ||
![]() |
0251fcd400 | ||
![]() |
eaf4cb6bbb | ||
![]() |
a85ee030ab | ||
![]() |
d8caa679e0 | ||
![]() |
f7bccf3724 | ||
![]() |
38bbec3731 | ||
![]() |
a128f03b30 | ||
![]() |
f0e10d9351 | ||
![]() |
ffa71b4afa | ||
![]() |
9f355169f4 | ||
![]() |
0e14946a20 | ||
![]() |
c204501e3e | ||
![]() |
194b80f974 | ||
![]() |
ec61f0a3af | ||
![]() |
f225f180e3 | ||
![]() |
e74944eee5 | ||
![]() |
eaa924b69e | ||
![]() |
1d59e3e592 | ||
![]() |
5113a3efff | ||
![]() |
1594d0bf9c | ||
![]() |
47057875e7 | ||
![]() |
ef9b54cfe6 | ||
![]() |
04d18f5587 | ||
![]() |
73575f11a9 | ||
![]() |
998bf6e088 | ||
![]() |
34e43ceb0d | ||
![]() |
7209df9e91 | ||
![]() |
0e95d84892 | ||
![]() |
965c2d8760 | ||
![]() |
9fb01d49d6 | ||
![]() |
e42b6f9e15 | ||
![]() |
2ee48b4b4b | ||
![]() |
f4031e8a9a | ||
![]() |
85854b245e |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -11,3 +11,4 @@ test*.img
|
||||
/.buildpath
|
||||
/.project
|
||||
/dracut-version.sh
|
||||
/install/dracut-install
|
||||
|
26
AUTHORS
26
AUTHORS
@@ -1,16 +1,16 @@
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
Victor Lowther <victor.lowther@gmail.com>
|
||||
Amadeusz Żołnowski <aidecoe@aidecoe.name>
|
||||
Philippe Seewer <philippe.seewer@bfh.ch>
|
||||
Warren Togami <wtogami@redhat.com>
|
||||
Amadeusz Żołnowski <aidecoe@aidecoe.name>
|
||||
Will Woods <wwoods@redhat.com>
|
||||
Jeremy Katz <katzj@redhat.com>
|
||||
David Dillow <dave@thedillows.org>
|
||||
Will Woods <wwoods@redhat.com>
|
||||
Michal Soltys <soltys@ziu.info>
|
||||
Dave Young <dyoung@redhat.com>
|
||||
Amerigo Wang <amwang@redhat.com>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Dave Young <dyoung@redhat.com>
|
||||
Colin Guthrie <colin@mageia.org>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
@@ -18,30 +18,34 @@ John Reiser <jreiser@bitwagon.com>
|
||||
Luca Berra <bluca@vodka.it>
|
||||
Daniel Drake <dsd@laptop.org>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
Jesse Keating <jkeating@redhat.com>
|
||||
Roberto Sassu <roberto.sassu@polito.it>
|
||||
Anton Blanchard <anton@samba.org>
|
||||
Bill Nottingham <notting@redhat.com>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
David Cantrell <dcantrell@redhat.com>
|
||||
Jon Ander Hernandez <jonan.h@gmail.com>
|
||||
Juan RP <xtraeme@gmail.com>
|
||||
Lance Albertson <lance@osuosl.org>
|
||||
Marian Ganisin <mganisin@redhat.com>
|
||||
Michael Ploujnikov <plouj@somanetworks.com>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
||||
Alan Pevec <apevec@redhat.com>
|
||||
Ian Dall <ian@beware.dropbear.id.au>
|
||||
James Buren <ryuo@frugalware.org>
|
||||
Joey Boggs <jboggs@redhat.com>
|
||||
Jon Ander Hernandez <jonan.h@gmail.com>
|
||||
Mike Snitzer <snitzer@redhat.com>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Przemysław Rudy <prudy1@o2.pl>
|
||||
Thomas Lange <lange@informatik.uni-koeln.de>
|
||||
Vladislav Bogdanov <bubble@hoster-ok.com>
|
||||
Alexander Todorov <atodorov@redhat.com>
|
||||
Andy Lutomirski <luto@mit.edu>
|
||||
Anssi Hannula <anssi@mageia.org>
|
||||
Christian Heinz <christian.ch.heinz@gmail.com>
|
||||
Dave Jones <davej@redhat.com>
|
||||
Dennis Gilmore <dennis@ausil.us>
|
||||
Duane Griffin <duaneg@dghda.com>
|
||||
Frederic Crozat <fcrozat@mandriva.com>
|
||||
Glen Gray <slaine@slaine.org>
|
||||
@@ -50,20 +54,26 @@ James Laska <jlaska@redhat.com>
|
||||
Jan Stodola <jstodola@redhat.com>
|
||||
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Leho Kraav <leho@kraav.com>
|
||||
Lennert Buytenhek <buytenh@wantstofly.org>
|
||||
Lubomir Rintel <lkundrak@v3.sk>
|
||||
Matt <smoothsailing72@hotmail.com>
|
||||
Matt Smith <shadowfax@gmx.com>
|
||||
Michal Schmidt <mschmidt@redhat.com>
|
||||
Milan Broz <mbroz@redhat.com>
|
||||
Munehiro Matsuda <haro@kgt.co.jp>
|
||||
Nikoli <nikoli@lavabit.com>
|
||||
Olivier Blin <dev@blino.org>
|
||||
Paolo Bonzini <pbonzini@redhat.com>
|
||||
Peter Robinson <pbrobinson@fedoraproject.org>
|
||||
Pádraig Brady <P@draigBrady.com>
|
||||
Quentin Armitage <quentin@armitage.org.uk>
|
||||
Sergey Fionov <fionov@gmail.com>
|
||||
Srinivasa T N <seenutn@linux.vnet.ibm.com>
|
||||
Thilo Bangert <thilo.bangert@gmx.net>
|
||||
Thomas Lange <lange@informatik.uni-koeln.de>
|
||||
Tomasz Torcz <tomek@pipebreaker.pl>
|
||||
Vadim Kuznetsov <vadimk@gentoo.org>
|
||||
Ville Skyttä <ville.skytta@iki.fi>
|
||||
Vivek Goyal <vgoyal@redhat.com>
|
||||
Wim Muskee <wimmuskee@gmail.com>
|
||||
Yanko Kaneti <yaneti@declera.com>
|
||||
maximilian attems <max@stro.at>
|
||||
|
92
Makefile
92
Makefile
@@ -1,4 +1,4 @@
|
||||
VERSION=020
|
||||
VERSION=023
|
||||
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
|
||||
|
||||
prefix ?= /usr
|
||||
@@ -8,15 +8,54 @@ pkglibdir ?= ${libdir}/dracut
|
||||
sysconfdir ?= ${prefix}/etc
|
||||
bindir ?= ${prefix}/bin
|
||||
mandir ?= ${prefix}/share/man
|
||||
CFLAGS ?= -O2 -g -Wall
|
||||
CFLAGS += -std=gnu99
|
||||
|
||||
man1pages = lsinitrd.1
|
||||
|
||||
man5pages = dracut.conf.5
|
||||
|
||||
man7pages = dracut.cmdline.7
|
||||
|
||||
man8pages = dracut.8 \
|
||||
dracut-catimages.8 \
|
||||
mkinitrd.8 \
|
||||
modules.d/98systemd/dracut-cmdline.service.8 \
|
||||
modules.d/98systemd/dracut-initqueue.service.8 \
|
||||
modules.d/98systemd/dracut-pre-pivot.service.8 \
|
||||
modules.d/98systemd/dracut-pre-trigger.service.8 \
|
||||
modules.d/98systemd/dracut-pre-udev.service.8 \
|
||||
modules.d/98systemd/initrd-switch-root.service.8 \
|
||||
modules.d/98systemd/udevadm-cleanup-db.service.8
|
||||
|
||||
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
|
||||
|
||||
manpages = dracut.8 dracut.cmdline.7 dracut.conf.5 dracut-catimages.8
|
||||
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS doc
|
||||
|
||||
all: syncheck dracut-version.sh install/dracut-install
|
||||
all: syncheck dracut-version.sh dracut-install
|
||||
|
||||
install/dracut-install:
|
||||
$(MAKE) -C install dracut-install
|
||||
DRACUT_INSTALL_OBJECTS = \
|
||||
install/dracut-install.o \
|
||||
install/hashmap.o\
|
||||
install/log.o \
|
||||
install/util.o
|
||||
|
||||
# deps generated with gcc -MM
|
||||
install/dracut-install.o: install/dracut-install.c install/log.h install/macro.h \
|
||||
install/hashmap.h install/util.h
|
||||
install/hashmap.o: install/hashmap.c install/util.h install/macro.h install/log.h \
|
||||
install/hashmap.h
|
||||
install/log.o: install/log.c install/log.h install/macro.h install/util.h
|
||||
install/util.o: install/util.c install/util.h install/macro.h install/log.h
|
||||
|
||||
install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
|
||||
|
||||
dracut-install: install/dracut-install
|
||||
ln -fs $< $@
|
||||
|
||||
indent:
|
||||
indent -i8 -nut -br -linux -l120 install/dracut-install.c
|
||||
|
||||
doc: $(manpages) dracut.html
|
||||
|
||||
@@ -40,7 +79,7 @@ install: doc dracut-version.sh
|
||||
mkdir -p $(DESTDIR)$(bindir)
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)/modules.d
|
||||
mkdir -p $(DESTDIR)$(mandir)/man5 $(DESTDIR)$(mandir)/man7 $(DESTDIR)$(mandir)/man8
|
||||
mkdir -p $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man5 $(DESTDIR)$(mandir)/man7 $(DESTDIR)$(mandir)/man8
|
||||
install -m 0755 dracut.sh $(DESTDIR)$(bindir)/dracut
|
||||
install -m 0755 dracut-catimages.sh $(DESTDIR)$(bindir)/dracut-catimages
|
||||
install -m 0755 mkinitrd-dracut.sh $(DESTDIR)$(bindir)/mkinitrd
|
||||
@@ -49,32 +88,25 @@ install: doc dracut-version.sh
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
|
||||
install -m 0755 dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions.sh
|
||||
install -m 0755 dracut-version.sh $(DESTDIR)$(pkglibdir)/dracut-version.sh
|
||||
ln -s dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
|
||||
ln -fs dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
|
||||
install -m 0755 dracut-logger.sh $(DESTDIR)$(pkglibdir)/dracut-logger.sh
|
||||
install -m 0755 dracut-initramfs-restore.sh $(DESTDIR)$(pkglibdir)/dracut-initramfs-restore
|
||||
cp -arx modules.d $(DESTDIR)$(pkglibdir)
|
||||
install -m 0644 dracut.8 $(DESTDIR)$(mandir)/man8/dracut.8
|
||||
install -m 0644 dracut-catimages.8 $(DESTDIR)$(mandir)/man8/dracut-catimages.8
|
||||
install -m 0644 dracut.conf.5 $(DESTDIR)$(mandir)/man5/dracut.conf.5
|
||||
install -m 0644 dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.cmdline.7
|
||||
ln -s dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.kernel.7
|
||||
for i in $(man1pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man1/$${i##*/}; done
|
||||
for i in $(man5pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man5/$${i##*/}; done
|
||||
for i in $(man7pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man7/$${i##*/}; done
|
||||
for i in $(man8pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man8/$${i##*/}; done
|
||||
ln -fs dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.kernel.7
|
||||
if [ -n "$(systemdsystemunitdir)" ]; then \
|
||||
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
|
||||
for i in \
|
||||
modules.d/98systemd/dracut-initqueue.service \
|
||||
modules.d/98systemd/dracut-pre-pivot.service \
|
||||
modules.d/98systemd/dracut-pre-trigger.service \
|
||||
modules.d/98systemd/dracut-pre-udev.service \
|
||||
modules.d/98systemd/initrd-switch-root.service \
|
||||
modules.d/98systemd/initrd-switch-root.target \
|
||||
dracut-shutdown.service; do \
|
||||
install -m 0644 $$i $(DESTDIR)$(systemdsystemunitdir); \
|
||||
done; \
|
||||
install -m 0644 dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir); \
|
||||
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants; \
|
||||
ln -s ../dracut-shutdown.service \
|
||||
$(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants/dracut-shutdown.service; \
|
||||
fi
|
||||
$(MAKE) -C install install
|
||||
if [ -f install/dracut-install ]; then \
|
||||
install -m 0755 install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
|
||||
fi
|
||||
|
||||
dracut-version.sh:
|
||||
@echo "DRACUT_VERSION=$(VERSION)-$(GITVERSION)" > dracut-version.sh
|
||||
@@ -85,9 +117,9 @@ clean:
|
||||
$(RM) */*/*~
|
||||
$(RM) test-*.img
|
||||
$(RM) dracut-*.rpm dracut-*.tar.bz2
|
||||
$(RM) dracut-install install/dracut-install $(DRACUT_INSTALL_OBJECTS)
|
||||
$(RM) $(manpages) dracut.html
|
||||
$(MAKE) -C test clean
|
||||
$(MAKE) -C install clean
|
||||
|
||||
archive: dracut-$(VERSION)-$(GITVERSION).tar.bz2
|
||||
|
||||
@@ -105,7 +137,7 @@ dracut-$(VERSION).tar.bz2: doc
|
||||
rpm: dracut-$(VERSION).tar.bz2
|
||||
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
|
||||
cp dracut-$(VERSION).tar.bz2 "$$rpmbuild"; \
|
||||
LANG=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
(cd "$$rpmbuild"; rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
|
||||
--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
|
||||
@@ -124,7 +156,8 @@ syncheck:
|
||||
done;exit $$ret
|
||||
|
||||
check: all syncheck
|
||||
$(MAKE) -C test check
|
||||
@[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; }
|
||||
@$(MAKE) -C test check
|
||||
|
||||
testimage: all
|
||||
./dracut.sh -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@@ -142,3 +175,10 @@ hostimage: all
|
||||
|
||||
AUTHORS:
|
||||
git shortlog --numbered --summary -e |while read a rest; do echo $$rest;done > AUTHORS
|
||||
|
||||
dracut.html.sign: dracut-$(VERSION).tar.bz2
|
||||
gpg-sign-all dracut-$(VERSION).tar.bz2 dracut.html
|
||||
|
||||
upload: dracut.html.sign
|
||||
kup put dracut-$(VERSION).tar.bz2 dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/
|
||||
kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/
|
||||
|
54
NEWS
54
NEWS
@@ -1,3 +1,57 @@
|
||||
dracut-023
|
||||
==========
|
||||
- resume from hibernate fixes
|
||||
- -N option for --no-hostonly
|
||||
- support for systemd crypto handling
|
||||
- new dracut module "crypt-loop"
|
||||
- deprecate the old kernel command line options
|
||||
- more documentation
|
||||
- honor CFLAGS for dracut-install build
|
||||
- multipath fixes
|
||||
- / is mounted according to rootflags parameter but forced ro at first.
|
||||
Later it is remounted according to /etc/fstab + rootflags parameter
|
||||
and "ro"/"rw".
|
||||
- support for xfs / reiserfs separate journal device
|
||||
- new "ro_mnt" option to force ro mount of / and /usr
|
||||
- root on cifs support
|
||||
- dracut-install: fixed issue for /var/tmp containing a symlink
|
||||
- only lazy resolve with ldd, if the /var/tmp partition is not mounted with "noexec"
|
||||
- i18n: fixed inclusion of "include" keymaps
|
||||
|
||||
dracut-022
|
||||
==========
|
||||
- fixed host-only kernel module bug
|
||||
|
||||
dracut-021
|
||||
==========
|
||||
- fixed systemd in the initramfs (requires systemd >= 187)
|
||||
- dracut-install: massive speedup with /var on the same filesystem with COW copy
|
||||
- dracut-install: moved to /usr/lib/dracut until it becomes a general purpose tool
|
||||
- new options: "rd.usrmount.ro" and "rd.skipfsck"
|
||||
- less mount/umount
|
||||
- apply "ro" on the kernel command line also to /usr
|
||||
- mount according to fstab, if neither "ro" or "rw" is specified
|
||||
- skip fsck for xfs and btrfs. remount is enough
|
||||
- give emergency_shell if /usr mount failed
|
||||
- dracut now uses getopt:
|
||||
* options can be position independent now!!
|
||||
* we can now use --option=<arg>
|
||||
- added option "--kver=<kernel-version>", and the image location can be omitted
|
||||
# dracut --kver 3.5.0-0.rc7.git1.2.fc18.x86_64
|
||||
- dracut.sh: for --include copy also the symbolic links
|
||||
- man pages: lsinitrd and mkinitrd added
|
||||
- network: We do not support renaming in the kernel namespace anymore (as udev does
|
||||
that not anymore). So, if a user wants to use ifname, he has to rename
|
||||
to a custom namespace. "eth[0-9]+" is not allowed anymore. !!!!!
|
||||
- resume: moved the resume process to the initqueue.
|
||||
This should prevent accidently mounting the root file system.
|
||||
- testsuite: add support for: make V=1 TESTS="01 20 40" check
|
||||
$ sudo make V=1 clean check
|
||||
now runs the testsuite in verbose mode
|
||||
|
||||
$ sudo make TESTS="01 20 40" clean check
|
||||
now only runs the 01, 20 and 40 tests.
|
||||
|
||||
dracut-020
|
||||
==========
|
||||
- changed rd.dasd kernel parameter
|
||||
|
@@ -7,5 +7,24 @@ cryptsetup
|
||||
nfs-utils
|
||||
netbsd-iscsi
|
||||
nbd
|
||||
dhcp
|
||||
dhcp (dhcp-server on openSUSE)
|
||||
iscsi-initiator-utils
|
||||
TEST-04-FULL-SYSTEMD: systemd >= 187
|
||||
|
||||
How to run the testsuite:
|
||||
|
||||
$ sudo make clean check
|
||||
|
||||
in verbose mode:
|
||||
$ sudo make V=1 clean check
|
||||
|
||||
only specific test:
|
||||
$ sudo make TESTS="01 20 40" clean check
|
||||
only runs the 01, 20 and 40 tests.
|
||||
|
||||
debug a specific test case:
|
||||
$ cd TEST-01-BASIC
|
||||
$ sudo make clean setup run
|
||||
... change some kernel parameters ...
|
||||
$ sudo make run
|
||||
to run the test without doing the setup
|
||||
|
6
TODO
6
TODO
@@ -6,13 +6,13 @@ Items are ordered in priority.
|
||||
|
||||
INITRAMFS TODO
|
||||
|
||||
- fix btrfs subvolume mounting for /usr (fsck)
|
||||
- use info and warn prefix
|
||||
- add sosreport
|
||||
- generate systemd unit dracut-initramfs-restore in /run/systemd dynamically
|
||||
- put "root=" parsing hooks in separate hook dir
|
||||
- call "root=" parsing hooks after getting new rootpath from dhcp
|
||||
- put mount hook in main initqueue loop
|
||||
- put mount hook in main initqueue loop / careful about resume!
|
||||
- the hard-coded list of udev rules that we care about is kind of lame.
|
||||
- automatic kexec fallback
|
||||
- panic fallback
|
||||
|
||||
GENERATOR TODO
|
||||
|
@@ -19,12 +19,35 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
export LC_MESSAGES=C
|
||||
|
||||
[[ -d "$initdir/.kernelmodseen" ]] || mkdir -p "$initdir/.kernelmodseen"
|
||||
if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
|
||||
if ! [[ -d "$initdir/.kernelmodseen" ]]; then
|
||||
mkdir -p "$initdir/.kernelmodseen"
|
||||
fi
|
||||
DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
|
||||
fi
|
||||
|
||||
if [[ $initdir ]] && ! [[ -d $initdir ]]; then
|
||||
mkdir -p "$initdir"
|
||||
fi
|
||||
|
||||
# Generic substring function. If $2 is in $1, return 0.
|
||||
strstr() { [[ $1 = *$2* ]]; }
|
||||
|
||||
# find a binary. If we were not passed the full path directly,
|
||||
# search in the usual places to find the binary.
|
||||
find_binary() {
|
||||
if [[ -z ${1##/*} ]]; then
|
||||
if [[ -x $1 ]] || { strstr "$1" ".so" && ldd $1 &>/dev/null; }; then
|
||||
echo $1
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
type -P $1
|
||||
}
|
||||
|
||||
if ! [[ $dracutbasedir ]]; then
|
||||
dracutbasedir=${BASH_SOURCE[0]%/*}
|
||||
[[ $dracutbasedir = "dracut-functions" ]] && dracutbasedir="."
|
||||
@@ -32,6 +55,14 @@ if ! [[ $dracutbasedir ]]; then
|
||||
dracutbasedir="$(readlink -f $dracutbasedir)"
|
||||
fi
|
||||
|
||||
if ! [[ $DRACUT_INSTALL ]]; then
|
||||
DRACUT_INSTALL=$(find_binary dracut-install)
|
||||
fi
|
||||
|
||||
if ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/dracut-install ]]; then
|
||||
DRACUT_INSTALL=$dracutbasedir/dracut-install
|
||||
fi
|
||||
|
||||
# Detect lib paths
|
||||
if ! [[ $libdirs ]] ; then
|
||||
if strstr "$(ldd /bin/sh)" "/lib64/" &>/dev/null \
|
||||
@@ -65,6 +96,11 @@ if ! type dinfo >/dev/null 2>&1; then
|
||||
dlog_init
|
||||
fi
|
||||
|
||||
if ! [[ $initdir ]]; then
|
||||
dfatal "initdir not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# export standard hookdirs
|
||||
[[ $hookdirs ]] || {
|
||||
hookdirs="cmdline pre-udev pre-trigger netroot "
|
||||
@@ -321,6 +357,33 @@ find_dev_fstype() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# find_mp_fstype <mountpoint>
|
||||
# Echo the filesystem type for a given mountpoint.
|
||||
# /proc/self/mountinfo is taken as the primary source of information
|
||||
# and /etc/fstab is used as a fallback.
|
||||
# No newline is appended!
|
||||
# Example:
|
||||
# $ find_mp_fstype /;echo
|
||||
# ext4
|
||||
find_mp_fstype() {
|
||||
local _x _mpt _majmin _dev _fs _maj _min
|
||||
while read _x _x _majmin _x _mpt _x _x _fs _dev _x; do
|
||||
[[ $_mpt = $1 ]] || continue
|
||||
echo -n $_fs;
|
||||
return 0;
|
||||
done < /proc/self/mountinfo
|
||||
|
||||
# fall back to /etc/fstab
|
||||
while read _dev _mpt _fs _x; do
|
||||
[[ $_mpt = $1 ]] || continue
|
||||
echo -n $_fs;
|
||||
return 0;
|
||||
done < /etc/fstab
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
# finds the major:minor of the block device backing the root filesystem.
|
||||
find_root_block_device() { find_block_device /; }
|
||||
|
||||
@@ -391,56 +454,76 @@ check_vol_slaves() {
|
||||
return 1
|
||||
}
|
||||
|
||||
if [[ -x /usr/bin/dracut-install ]]; then
|
||||
# fs_get_option <filesystem options> <search for option>
|
||||
# search for a specific option in a bunch of filesystem options
|
||||
# and return the value
|
||||
fs_get_option() {
|
||||
local _fsopts=$1
|
||||
local _option=$2
|
||||
local OLDIFS="$IFS"
|
||||
IFS=,
|
||||
set -- $_fsopts
|
||||
IFS="$OLDIFS"
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
$_option=*)
|
||||
echo ${1#${_option}=}
|
||||
break
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
if [[ $DRACUT_INSTALL ]]; then
|
||||
[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
|
||||
inst_dir() {
|
||||
[[ -e ${initdir}/"$1" ]] && return 0 # already there
|
||||
dracut-install ${initdir+-D "$initdir"} -d "$@"
|
||||
(($? != 0)) && derror dracut-install ${initdir+-D "$initdir"} -d "$@" || :
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@" || :
|
||||
}
|
||||
|
||||
inst() {
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
#dinfo "dracut-install -l $@"
|
||||
dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
#dinfo "$DRACUT_INSTALL -l $@"
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_simple() {
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -e $1 ]] || return 1 # no source
|
||||
dracut-install ${initdir+-D "$initdir"} "$@"
|
||||
(($? != 0)) && derror dracut-install ${initdir+-D "$initdir"} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} "$@" || :
|
||||
}
|
||||
|
||||
inst_symlink() {
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -L $1 ]] || return 1
|
||||
dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
}
|
||||
|
||||
dracut_install() {
|
||||
#dinfo "initdir=$initdir dracut-install -l $@"
|
||||
dracut-install ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror dracut-install ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
#dinfo "initdir=$initdir $DRACUT_INSTALL -l $@"
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_library() {
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -e $1 ]] || return 1 # no source
|
||||
dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_binary() {
|
||||
dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_script() {
|
||||
dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror dracut-install ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
}
|
||||
|
||||
else
|
||||
@@ -664,19 +747,6 @@ rev_lib_symlinks() {
|
||||
echo "${links}"
|
||||
}
|
||||
|
||||
# find a binary. If we were not passed the full path directly,
|
||||
# search in the usual places to find the binary.
|
||||
find_binary() {
|
||||
if [[ -z ${1##/*} ]]; then
|
||||
if [[ -x $1 ]] || { strstr "$1" ".so" && ldd $1 &>/dev/null; }; then
|
||||
echo $1
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
type -P $1
|
||||
}
|
||||
|
||||
# attempt to install any programs specified in a udev rule
|
||||
inst_rule_programs() {
|
||||
local _prog _bin
|
||||
@@ -687,12 +757,12 @@ inst_rule_programs() {
|
||||
_bin=${udevdir}/$_prog
|
||||
else
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule $(basename $1) as it cannot be found"
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue;
|
||||
}
|
||||
fi
|
||||
|
||||
#dinfo "Installing $_bin due to it's use in the udev rule $(basename $1)"
|
||||
#dinfo "Installing $_bin due to it's use in the udev rule $(${1##*/})"
|
||||
dracut_install "$_bin"
|
||||
done
|
||||
fi
|
||||
@@ -702,27 +772,27 @@ inst_rule_programs() {
|
||||
_bin=${udevdir}/$_prog
|
||||
else
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule $(basename $1) as it cannot be found"
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue;
|
||||
}
|
||||
fi
|
||||
|
||||
#dinfo "Installing $_bin due to it's use in the udev rule $(basename $1)"
|
||||
#dinfo "Installing $_bin due to it's use in the udev rule $(${1##*/})"
|
||||
dracut_install "$_bin"
|
||||
done
|
||||
fi
|
||||
if grep -qE 'PROGRAM==?"[^ "]+' "$1"; then
|
||||
for _prog in $(grep -E 'IMPORT==?"[^ "]+' "$1" | sed -r 's/.*IMPORT==?"([^ "]+).*/\1/'); do
|
||||
if grep -qE 'IMPORT\{program\}==?"[^ "]+' "$1"; then
|
||||
for _prog in $(grep -E 'IMPORT\{program\}==?"[^ "]+' "$1" | sed -r 's/.*IMPORT\{program\}==?"([^ "]+).*/\1/'); do
|
||||
if [ -x ${udevdir}/$_prog ]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
else
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule $(basename $1) as it cannot be found"
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue;
|
||||
}
|
||||
fi
|
||||
|
||||
#dinfo "Installing $_bin due to it's use in the udev rule $(basename $1)"
|
||||
#dinfo "Installing $_bin due to it's use in the udev rule $(${1##*/})"
|
||||
dracut_install "$_bin"
|
||||
done
|
||||
fi
|
||||
@@ -768,7 +838,7 @@ inst_hook() {
|
||||
dfatal "No such hook type $1. Aborting initrd creation."
|
||||
exit 1
|
||||
fi
|
||||
inst_simple "$3" "/lib/dracut/hooks/${1}/${2}${3##*/}"
|
||||
inst_simple "$3" "/lib/dracut/hooks/${1}/${2}-${3##*/}"
|
||||
}
|
||||
|
||||
# install any of listed files
|
||||
@@ -1001,7 +1071,10 @@ check_mount() {
|
||||
|
||||
[[ $2 ]] || mods_checked_as_dep+=" $_mod "
|
||||
|
||||
strstr " $omit_dracutmodules " " $_mod " && return 1
|
||||
if strstr " $omit_dracutmodules " " $_mod "; then
|
||||
dinfo "Dracut module '$_mod' will not be installed, because it's in the list to be omitted!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "${#host_fs_types[*]}" -gt 0 ]; then
|
||||
module_check_mount $_mod || return 1
|
||||
@@ -1017,7 +1090,10 @@ check_mount() {
|
||||
strstr " $force_add_dracutmodules " " $_moddep " || \
|
||||
force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
check_module $_moddep || return 1
|
||||
if ! check_module $_moddep; then
|
||||
derror "Dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
strstr " $mods_to_load " " $_mod " || \
|
||||
@@ -1044,7 +1120,10 @@ check_module() {
|
||||
|
||||
[[ $2 ]] || mods_checked_as_dep+=" $_mod "
|
||||
|
||||
strstr " $omit_dracutmodules " " $_mod " && return 1
|
||||
if strstr " $omit_dracutmodules " " $_mod "; then
|
||||
dinfo "Dracut module '$_mod' will not be installed, because it's in the list to be omitted!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if strstr " $dracutmodules $add_dracutmodules $force_add_dracutmodules" " $_mod "; then
|
||||
if strstr " $force_add_dracutmodules" " $_mod"; then
|
||||
@@ -1072,7 +1151,10 @@ check_module() {
|
||||
strstr " $force_add_dracutmodules " " $_moddep " || \
|
||||
force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
check_module $_moddep || return 1
|
||||
if ! check_module $_moddep; then
|
||||
derror "Dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
strstr " $mods_to_load " " $_mod " || \
|
||||
@@ -1100,7 +1182,7 @@ for_each_module_dir() {
|
||||
for _mod in $_modcheck; do
|
||||
strstr "$mods_to_load" "$_mod" && continue
|
||||
strstr "$omit_dracutmodules" "$_mod" && continue
|
||||
derror "Dracut module \"$_mod\" cannot be found or installed."
|
||||
derror "Dracut module '$_mod' cannot be found or installed."
|
||||
done
|
||||
}
|
||||
|
||||
@@ -1112,8 +1194,8 @@ install_kmod_with_fw() {
|
||||
[[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \
|
||||
&& return 0
|
||||
|
||||
if [[ -e "$initdir/.kernelmodseen/${1##*/}" ]]; then
|
||||
read ret < "$initdir/.kernelmodseen/${1##*/}"
|
||||
if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && [[ -e "$DRACUT_KERNEL_LAZY_HASHDIR/${1##*/}" ]]; then
|
||||
read ret < "$DRACUT_KERNEL_LAZY_HASHDIR/${1##*/}"
|
||||
return $ret
|
||||
fi
|
||||
|
||||
@@ -1133,8 +1215,9 @@ install_kmod_with_fw() {
|
||||
|
||||
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}"
|
||||
ret=$?
|
||||
[ -d "$initdir/.kernelmodseen" ] && \
|
||||
echo $ret > "$initdir/.kernelmodseen/${1##*/}"
|
||||
[[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \
|
||||
[[ -d "$DRACUT_KERNEL_LAZY_HASHDIR" ]] && \
|
||||
echo $ret > "$DRACUT_KERNEL_LAZY_HASHDIR/${1##*/}"
|
||||
(($ret != 0)) && return $ret
|
||||
|
||||
local _modname=${1##*/} _fwdir _found _fw
|
||||
@@ -1181,38 +1264,38 @@ for_each_kmod_dep() {
|
||||
dracut_kernel_post() {
|
||||
local _moddirname=${srcmods%%/lib/modules/*}
|
||||
|
||||
if [[ -f "$initdir/.kernelmodseen/lazylist" ]]; then
|
||||
xargs modprobe -a ${_moddirname+-d ${_moddirname}/} --ignore-install --show-depends \
|
||||
< "$initdir/.kernelmodseen/lazylist" 2>/dev/null \
|
||||
if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && [[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" ]]; then
|
||||
xargs -r modprobe -a ${_moddirname+-d ${_moddirname}/} \
|
||||
--ignore-install --show-depends --set-version $kernel \
|
||||
< "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" 2>/dev/null \
|
||||
| sort -u \
|
||||
| while read _cmd _modpath _options; do
|
||||
[[ $_cmd = insmod ]] || continue
|
||||
echo "$_modpath"
|
||||
done > "$initdir/.kernelmodseen/lazylist.dep"
|
||||
done > "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
|
||||
|
||||
(
|
||||
if [[ -x /usr/bin/dracut-install ]] && [[ -z $_moddirname ]]; then
|
||||
xargs dracut-install ${initdir+-D "$initdir"} -a < "$initdir/.kernelmodseen/lazylist.dep"
|
||||
if [[ $DRACUT_INSTALL ]] && [[ -z $_moddirname ]]; then
|
||||
xargs -r $DRACUT_INSTALL ${initdir+-D "$initdir"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
|
||||
else
|
||||
while read _modpath; do
|
||||
local _destpath=$_modpath
|
||||
[[ $_moddirname ]] && _destpath=${_destpath##$_moddirname/}
|
||||
_destpath=${_destpath##*/lib/modules/$kernel/}
|
||||
inst_simple "$_modpath" "/lib/modules/$kernel/${_destpath}" || exit $?
|
||||
done < "$initdir/.kernelmodseen/lazylist.dep"
|
||||
done < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
|
||||
fi
|
||||
) &
|
||||
|
||||
|
||||
if [[ -x /usr/bin/dracut-install ]]; then
|
||||
xargs modinfo -k $kernel -F firmware < "$initdir/.kernelmodseen/lazylist.dep" \
|
||||
if [[ $DRACUT_INSTALL ]]; then
|
||||
xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" \
|
||||
| while read line; do
|
||||
for _fwdir in $fw_dir; do
|
||||
echo $_fwdir/$line;
|
||||
done;
|
||||
done |xargs dracut-install ${initdir+-D "$initdir"} -a -o
|
||||
done | xargs -r $DRACUT_INSTALL ${initdir+-D "$initdir"} -a -o
|
||||
else
|
||||
for _fw in $(xargs modinfo -k $kernel -F firmware < "$initdir/.kernelmodseen/lazylist.dep"); do
|
||||
for _fw in $(xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"); do
|
||||
for _fwdir in $fw_dir; do
|
||||
if [[ -d $_fwdir && -f $_fwdir/$_fw ]]; then
|
||||
inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw"
|
||||
@@ -1243,7 +1326,7 @@ dracut_kernel_post() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -fr "$initdir/.kernelmodseen"
|
||||
[[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && rm -fr "$DRACUT_KERNEL_LAZY_HASHDIR"
|
||||
}
|
||||
|
||||
find_kernel_modules_by_path () (
|
||||
@@ -1258,7 +1341,11 @@ find_kernel_modules_by_path () (
|
||||
IFS=$_OLDIFS
|
||||
else
|
||||
( cd /sys/module; echo *; ) \
|
||||
| xargs modinfo -F filename -k $kernel 2>/dev/null
|
||||
| xargs -r modinfo -F filename -k $kernel 2>/dev/null \
|
||||
| while read a; do
|
||||
[[ $a = */kernel*/$1/* ]] || continue
|
||||
echo $a
|
||||
done
|
||||
fi
|
||||
return 0
|
||||
)
|
||||
@@ -1267,8 +1354,8 @@ find_kernel_modules () {
|
||||
find_kernel_modules_by_path drivers
|
||||
}
|
||||
|
||||
# instmods [-c] <kernel module> [<kernel module> ... ]
|
||||
# instmods [-c] <kernel subsystem>
|
||||
# instmods [-c [-s]] <kernel module> [<kernel module> ... ]
|
||||
# instmods [-c [-s]] <kernel subsystem>
|
||||
# install kernel modules along with all their dependencies.
|
||||
# <kernel subsystem> can be e.g. "=block" or "=drivers/usb/storage"
|
||||
instmods() {
|
||||
@@ -1276,11 +1363,17 @@ instmods() {
|
||||
# called [sub]functions inherit _fderr
|
||||
local _fderr=9
|
||||
local _check=no
|
||||
local _silent=no
|
||||
if [[ $1 = '-c' ]]; then
|
||||
_check=yes
|
||||
shift
|
||||
fi
|
||||
|
||||
if [[ $1 = '-s' ]]; then
|
||||
_silent=yes
|
||||
shift
|
||||
fi
|
||||
|
||||
function inst1mod() {
|
||||
local _ret=0 _mod="$1"
|
||||
case $_mod in
|
||||
@@ -1296,8 +1389,9 @@ instmods() {
|
||||
_mod=${_mod##*/}
|
||||
# if we are already installed, skip this module and go on
|
||||
# to the next one.
|
||||
if [[ -f "$initdir/.kernelmodseen/${_mod%.ko}.ko" ]]; then
|
||||
read _ret <"$initdir/.kernelmodseen/${_mod%.ko}.ko"
|
||||
if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \
|
||||
[[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko}.ko" ]]; then
|
||||
read _ret <"$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko}.ko"
|
||||
return $_ret
|
||||
fi
|
||||
|
||||
@@ -1312,7 +1406,7 @@ instmods() {
|
||||
&& ! [[ "$add_drivers" =~ " ${_mod} " ]] \
|
||||
&& return 0
|
||||
|
||||
if [[ "$_check" = "yes" ]] || ! [[ $DRACUT_KERNEL_LAZY ]]; then
|
||||
if [[ "$_check" = "yes" ]] || ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
|
||||
# We use '-d' option in modprobe only if modules prefix path
|
||||
# differs from default '/'. This allows us to use Dracut with
|
||||
# old version of modprobe which doesn't have '-d' option.
|
||||
@@ -1325,7 +1419,8 @@ instmods() {
|
||||
--set-version $kernel ${_moddirname} $_mpargs
|
||||
((_ret+=$?))
|
||||
else
|
||||
echo $_mod >> "$initdir/.kernelmodseen/lazylist"
|
||||
[[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \
|
||||
echo $_mod >> "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -1337,8 +1432,8 @@ instmods() {
|
||||
if (($# == 0)); then # filenames from stdin
|
||||
while read _mod; do
|
||||
inst1mod "${_mod%.ko*}" || {
|
||||
if [ "$_check" = "yes" ]; then
|
||||
dfatal "Failed to install $_mod"
|
||||
if [[ "$_check" == "yes" ]]; then
|
||||
[[ "$_silent" == "no" ]] && dfatal "Failed to install $_mod"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -1346,8 +1441,8 @@ instmods() {
|
||||
fi
|
||||
while (($# > 0)); do # filenames as arguments
|
||||
inst1mod ${1%.ko*} || {
|
||||
if [ "$_check" = "yes" ]; then
|
||||
dfatal "Failed to install $1"
|
||||
if [[ "$_check" == "yes" ]]; then
|
||||
[[ "$_silent" == "no" ]] && dfatal "Failed to install $1"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
[Unit]
|
||||
Description=Restore /run/initramfs
|
||||
After=getty@tty1.service prefdm.service
|
||||
Before=reboot.service shutdown.target
|
||||
Before=systemd-reboot.service shutdown.target
|
||||
DefaultDependencies=no
|
||||
ConditionPathExists=/run/initramfs/.need_shutdown
|
||||
ConditionPathExists=!/run/initramfs/bin/sh
|
||||
|
104
dracut.8.asc
104
dracut.8.asc
@@ -14,6 +14,12 @@ SYNOPSIS
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
Create an initramfs <image> for the kernel with the version <kernel version>.
|
||||
If <kernel version> is omitted, then the version of the actual running
|
||||
kernel is used. If <image> is omitted or empty, then the default location
|
||||
/boot/initramfs-<kernel version>.img is used.
|
||||
|
||||
dracut creates an initial image used by the kernel for preloading the block
|
||||
device modules (such as IDE, SCSI or RAID) which are needed to access the root
|
||||
filesystem, mounting the root filesystem and booting into the real system.
|
||||
@@ -22,10 +28,65 @@ At boot time, the kernel unpacks that archive into RAM disk, mounts and uses it
|
||||
as initial root file system. All finding of the root device happens in this
|
||||
early userspace.
|
||||
|
||||
For a complete list of kernel command line options see *dracut.cmdline*(7)
|
||||
For a complete list of kernel command line options see *dracut.cmdline*(7).
|
||||
|
||||
EXAMPLE
|
||||
-------
|
||||
|
||||
To create a initramfs image, the most simple command is:
|
||||
----
|
||||
# dracut
|
||||
----
|
||||
|
||||
This will generate a general purpose initramfs image, with all possible
|
||||
functionality resulting of the combination of the installed dracut modules and
|
||||
system tools. The image is /boot/initramfs-_++<kernel version>++_.img and
|
||||
contains the kernel modules of the currently active kernel with version
|
||||
_++<kernel version>++_.
|
||||
|
||||
If the initramfs image already exists, dracut will display an error message, and
|
||||
to overwrite the existing image, you have to use the --force option.
|
||||
----
|
||||
# dracut --force
|
||||
----
|
||||
|
||||
If you want to specify another filename for the resulting image you would issue
|
||||
a command like:
|
||||
----
|
||||
# dracut foobar.img
|
||||
----
|
||||
|
||||
To generate an image for a specific kernel version, the command would be:
|
||||
----
|
||||
# dracut foobar.img 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
A shortcut to generate the image at the default location for a specific kernel
|
||||
version is:
|
||||
----
|
||||
# dracut --kver 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
If you want to create lighter, smaller initramfs images, you may want to specify
|
||||
the --host-only or -H option. Using this option, the resulting image will
|
||||
contain only those dracut modules, kernel modules and filesystems, which are
|
||||
needed to boot this specific machine. This has the drawback, that you can't put
|
||||
the disk on another controller or machine, and that you can't switch to another
|
||||
root filesystem, without recreating the initramfs image. The usage of the
|
||||
--host-only option is only for experts and you will have to keep the broken
|
||||
pieces. At least keep a copy of a general purpose image (and corresponding
|
||||
kernel) as a fallback to rescue your system.
|
||||
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
**--kver** _<kernel version>_::
|
||||
set the kernel version. This enables to specify the kernel version, without
|
||||
specifying the location of the initramfs image. For example:
|
||||
----
|
||||
# dracut --kver 3.5.0-0.rc7.git1.2.fc18.x86_64
|
||||
----
|
||||
|
||||
**-f, --force**::
|
||||
overwrite existing initramfs file.
|
||||
|
||||
@@ -46,7 +107,7 @@ example:
|
||||
**-o, --omit** _<list of dracut modules>_::
|
||||
omit a space-separated list of dracut modules. This parameter can be
|
||||
specified multiple times.
|
||||
|
||||
+
|
||||
[NOTE]
|
||||
===============================
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes. For
|
||||
@@ -130,7 +191,7 @@ example:
|
||||
specify a space-separated list of kernel filesystem modules to exclusively
|
||||
include in the generic initramfs. This parameter can be specified multiple
|
||||
times.
|
||||
|
||||
+
|
||||
[NOTE]
|
||||
===============================
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes. For
|
||||
@@ -183,10 +244,16 @@ example:
|
||||
inhibit installation of any fsck tools
|
||||
|
||||
**--strip**::
|
||||
strip binaries in the initramfs (default)
|
||||
strip binaries in the initramfs
|
||||
|
||||
**--nostrip**::
|
||||
do not strip binaries in the initramfs
|
||||
do not strip binaries in the initramfs (default)
|
||||
|
||||
**--hardlink**::
|
||||
hardlink files in the initramfs (default)
|
||||
|
||||
**--nohardlink**::
|
||||
do not hardlink files in the initramfs
|
||||
|
||||
**--prefix** _<dir>_::
|
||||
prefix initramfs files with the specified directory
|
||||
@@ -241,7 +308,7 @@ If chrooted to another root other than the real root device, use "--fstab" and
|
||||
provide a valid _/etc/fstab_.
|
||||
====
|
||||
|
||||
**--no-hostonly**::
|
||||
**-N, --no-hostonly**::
|
||||
Disable Host-Only mode
|
||||
|
||||
**--fstab**::
|
||||
@@ -267,7 +334,6 @@ provide a valid _/etc/fstab_.
|
||||
===============================
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes. For
|
||||
example:
|
||||
+
|
||||
----
|
||||
# dracut --install "/bin/foo /sbin/bar" ...
|
||||
----
|
||||
@@ -358,29 +424,21 @@ link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
|
||||
|
||||
AUTHORS
|
||||
-------
|
||||
*Harald Hoyer*::
|
||||
Project Leader and Developer
|
||||
Harald Hoyer
|
||||
|
||||
*Victor Lowther*::
|
||||
Developer
|
||||
Victor Lowther
|
||||
|
||||
*Philippe Seewer*::
|
||||
Developer
|
||||
Philippe Seewer
|
||||
|
||||
*Warren Togami*::
|
||||
Developer
|
||||
Warren Togami
|
||||
|
||||
*Amadeusz Żołnowski*::
|
||||
Developer
|
||||
Amadeusz Żołnowski
|
||||
|
||||
*Jeremy Katz*::
|
||||
Developer
|
||||
Jeremy Katz
|
||||
|
||||
*David Dillow*::
|
||||
Developer
|
||||
David Dillow
|
||||
|
||||
*Will Woods*::
|
||||
Developer
|
||||
Will Woods
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
|
17
dracut.asc
17
dracut.asc
@@ -154,7 +154,7 @@ To generate an image for a specific kernel version, the command would be:
|
||||
A shortcut to generate the image at the default location for a specific kernel
|
||||
version is:
|
||||
----
|
||||
# dracut '' 2.6.40-1.rc5.f20
|
||||
# dracut --kver 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
If you want to create lighter, smaller initramfs images, you may want to specify
|
||||
@@ -459,6 +459,13 @@ dracut shell commands are printed as they are executed
|
||||
# less /run/initramfs/init.log
|
||||
# dmesg | less
|
||||
----
|
||||
. With dracut >= 022 and systemd, you can inspect the rd.debug output with:
|
||||
----
|
||||
# journalctl -ab
|
||||
----
|
||||
|
||||
If you want to save that output, simply mount /boot by hand or insert an USB stick and mount that.
|
||||
Then you can store the output for later inspection.
|
||||
|
||||
[[information-to-include-in-your-report]]
|
||||
=== Information to include in your report
|
||||
@@ -472,7 +479,7 @@ configuration file (e.g. _/etc/grub.conf_) or from _/proc/cmdline_.
|
||||
* A copy of your disk partition information from _/etc/fstab_, which might be
|
||||
obtained booting an old working initramfs or a rescue medium.
|
||||
* A device listing from device-mapper. This can be obtained by running the
|
||||
command
|
||||
command
|
||||
+
|
||||
----
|
||||
# dmsetup ls --tree
|
||||
@@ -1022,6 +1029,12 @@ include::dracut.conf.5.asc[]
|
||||
[[dracutcmdline7]]
|
||||
include::dracut.cmdline.7.asc[]
|
||||
|
||||
[[lsinitrd1]]
|
||||
include::lsinitrd.1.asc[]
|
||||
|
||||
[[mkinitrd8]]
|
||||
include::mkinitrd.8.asc[]
|
||||
|
||||
:leveloffset: 0
|
||||
[appendix]
|
||||
License
|
||||
|
@@ -61,11 +61,20 @@ rootfstype=ext3
|
||||
_/etc/fstab_ of the real root will be parsed for special mount options and
|
||||
mounted accordingly.
|
||||
|
||||
**ro**::
|
||||
force mounting _/_ and _/usr_ (if it is a separate device) read-only. If
|
||||
none of ro and rw is present, both are mounted according to _/etc/fstab_.
|
||||
|
||||
**rw**::
|
||||
force mounting _/_ and _/usr_ (if it is a separate device) read-write.
|
||||
See also ro option.
|
||||
|
||||
**rd.fstab=0**::
|
||||
do not honor special mount options for the root filesystem found in
|
||||
_/etc/fstab_ of the real root.
|
||||
|
||||
**resume=**_<path to resume partition>_
|
||||
**resume=**_<path to resume partition>_::
|
||||
resume from a swap partition
|
||||
+
|
||||
E.g.:
|
||||
+
|
||||
@@ -75,6 +84,11 @@ resume=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
||||
resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
||||
----
|
||||
|
||||
**rd.skipfsck**::
|
||||
skip fsck for rootfs and _/usr_. If you're mounting _/usr_ read-only and
|
||||
the init system performs fsck before remount, you might want to use this
|
||||
option to avoid duplication.
|
||||
|
||||
|
||||
Misc
|
||||
~~~~
|
||||
@@ -90,6 +104,12 @@ Misc
|
||||
force loading kernel module <drivername> after all automatic loading modules
|
||||
have been loaded. This parameter can be specified multiple times.
|
||||
|
||||
**rd.retry=**_<seconds>_::
|
||||
specify how long dracut should wait for devices to appear.
|
||||
The default is 30 seconds. After 2/3 of the time, degraded raids are force
|
||||
started. If you have hardware, which takes a very long time to announce its
|
||||
drives, you might want to extend this value.
|
||||
|
||||
[[dracutkerneldebug]]
|
||||
Debug
|
||||
~~~~~
|
||||
@@ -219,6 +239,29 @@ rd.luks.key=/foo/bar.key
|
||||
----
|
||||
+
|
||||
As you see, you can skip colons in such a case.
|
||||
+
|
||||
[NOTE]
|
||||
===============================
|
||||
Dracut pipes key to cryptsetup with _-d -_ argument, therefore you need to pipe
|
||||
to crypsetup luksFormat with _-d -_, too!
|
||||
|
||||
Here follows example for key encrypted with GPG:
|
||||
|
||||
----
|
||||
gpg --quiet --decrypt rootkey.gpg \
|
||||
| cryptsetup -d - -v \
|
||||
--cipher serpent-cbc-essiv:sha256 \
|
||||
--key-size 256 luksFormat /dev/sda3
|
||||
----
|
||||
|
||||
If you use plain keys, just add path to _-d_ option:
|
||||
|
||||
----
|
||||
cryptsetup -d rootkey.key -v \
|
||||
--cipher serpent-cbc-essiv:sha256 \
|
||||
--key-size 256 luksFormat /dev/sda3
|
||||
----
|
||||
===============================
|
||||
|
||||
MD RAID
|
||||
~~~~~~~
|
||||
@@ -285,24 +328,51 @@ Network
|
||||
**ip=**_<interface>_:_{dhcp|on|any|dhcp6|auto6}_[:[_<mtu>_][:_<macaddr>_]]::
|
||||
This parameter can be specified multiple times.
|
||||
+
|
||||
=====================
|
||||
dhcp|on|any|dhcp6::: get ip from dhcp server on a specific interface
|
||||
auto6::: do IPv6 autoconfiguration
|
||||
<macaddr>::: optionally set <macaddr> on the <interface>
|
||||
<macaddr>::: optionally **set** <macaddr> on the <interface>. This
|
||||
cannot be used in conjunction with the **ifname** argument for the
|
||||
same <interface>.
|
||||
=====================
|
||||
|
||||
[IMPORTANT]
|
||||
=====================
|
||||
It is recommended to either bind <interface> to a MAC with the **ifname**
|
||||
argument. Or use biosdevname to name your interfaces, which will then have names according to their hardware location.
|
||||
|
||||
em<port>::: for embedded NICs
|
||||
p<slot>#<port>_<virtual instance>::: for cards in PCI slots
|
||||
=====================
|
||||
|
||||
**ip=**_<client-IP>_:_<server-IP>_:_<gateway-IP>_:_<netmask>_:_<client_hostname>_:_<interface>_:_{none|off|dhcp|on|any|dhcp6|auto6|ibft}_[:[_<mtu>_][:_<macaddr>_]]::
|
||||
explicit network configuration. If you want do define a IPv6 address, put it
|
||||
in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple
|
||||
times.
|
||||
+
|
||||
<macaddr>::: optionally set <macaddr> on the <interface>
|
||||
=====================
|
||||
<macaddr>::: optionally **set** <macaddr> on the <interface>. This
|
||||
cannot be used in conjunction with the **ifname** argument for the
|
||||
same <interface>.
|
||||
=====================
|
||||
|
||||
[IMPORTANT]
|
||||
=====================
|
||||
It is recommended to either bind <interface> to a MAC with the **ifname**
|
||||
argument. Or use biosdevname to name your interfaces, which will then have names according to their hardware location.
|
||||
|
||||
em<port>::: for embedded NICs
|
||||
p<slot>#<port>_<virtual instance>::: for cards in PCI slots
|
||||
=====================
|
||||
|
||||
**ifname=**_<interface>_:_<MAC>_::
|
||||
Assign network device name <interface> (ie eth0) to the NIC with MAC <MAC>.
|
||||
Note: If you use this option you _must_ specify an ifname= argument for all
|
||||
interfaces used in ip= or fcoe= arguments. However, if the interface in
|
||||
ip= or fcoe= is a bridge, bonding or vlan interface, you should specify
|
||||
an ifname= for _each_ of its underlying interfaces. This parameter can be
|
||||
specified multiple times.
|
||||
Assign network device name <interface> (ie "bootnet") to the NIC with MAC <MAC>.
|
||||
+
|
||||
[IMPORTANT]
|
||||
|
||||
Do **not** use the default kernel naming scheme for the interface name,
|
||||
as it can conflict with the kernel names. So, don't use "eth[0-9]+" for the
|
||||
interface name. Better name it "bootnet" or "bluesocket".
|
||||
|
||||
**bootdev=**_<interface>_::
|
||||
specify network interface to use routing and netroot information from.
|
||||
@@ -357,6 +427,21 @@ NFS
|
||||
**rd.nfs.domain=**_<NFSv4 domain name>_::
|
||||
Set the NFSv4 domain name. Will overwrite the settings in _/etc/idmap.conf_.
|
||||
|
||||
CIFS
|
||||
~~~
|
||||
**root=**cifs://[_<username>_[:_<password>_]@]_<server-ip>_:_<root-dir>_::
|
||||
mount cifs share from <server-ip>:/<root-dir>, if no server-ip is given, use
|
||||
dhcp next_server. if server-ip is an IPv6 address it has to be put in
|
||||
brackets, e.g. [2001:DB8::1]. If a username or password are not specified
|
||||
as part of the root, then they must be passed on the command line through
|
||||
cifsuser/cifspass.
|
||||
|
||||
**cifsuser=_<username>_::
|
||||
Set the cifs username, if not specified as part of the root.
|
||||
|
||||
**cifspass=_<password>_::
|
||||
Set the cifs password, if not specified as part of the root.
|
||||
|
||||
iSCSI
|
||||
~~~~~
|
||||
**root=**iscsi:[_<username>_:_<password>_[:_<reverse>_:_<password>_]@][_<servername>_]:[_<protocol>_]:[_<port>_][:[_<iscsi_iface_name>_]:[_<netdev_name>_]]:[_<LUN>_]:_<targetname>_::
|
||||
@@ -420,8 +505,10 @@ FCoE
|
||||
**fcoe=**_<edd|interface|MAC>_:_{dcb|nodcb}_::
|
||||
Try to connect to a FCoE SAN through the NIC specified by _<interface>_ or
|
||||
_<MAC>_ or EDD settings. For the second argument, currently only nodcb is
|
||||
supported. This parameter can be specified multiple times. Note: letters in
|
||||
the MAC-address must be lowercase!
|
||||
supported. This parameter can be specified multiple times.
|
||||
+
|
||||
[NOTE]
|
||||
letters in the MAC-address must be lowercase!
|
||||
|
||||
NBD
|
||||
~~~
|
||||
@@ -641,8 +728,7 @@ _/etc/cmdline.d/*.conf_::
|
||||
|
||||
AUTHOR
|
||||
------
|
||||
*Harald Hoyer*::
|
||||
Project Leader and Developer
|
||||
Harald Hoyer
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
|
@@ -43,6 +43,9 @@ lvmconf="yes"
|
||||
# inhibit installation of any fsck tools
|
||||
#nofscks="yes"
|
||||
|
||||
# mount / and /usr read-only by default
|
||||
#ro_mnt="no"
|
||||
|
||||
# set the directory for temporary files
|
||||
# default: /var/tmp
|
||||
#tmpdir=/tmp
|
||||
|
@@ -97,6 +97,9 @@ If chrooted to another root other than the real root device, use --fstab and pro
|
||||
*nofscks=*"__{yes|no}__"::
|
||||
If specified, inhibit installation of any fsck tools.
|
||||
|
||||
*ro_mnt*
|
||||
Mount _/_ and _/usr_ read-only by default.
|
||||
|
||||
*kernel_only=*"__{yes|no}__"::
|
||||
Only install kernel drivers and firmware files. (default=no)
|
||||
|
||||
|
@@ -2,13 +2,12 @@
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
|
||||
omit_dracutmodules+=" dash "
|
||||
omit_drivers+=" .*/fs/ocfs/.* "
|
||||
add_dracutmodules+=" systemd "
|
||||
stdloglvl=3
|
||||
realinitpath="/usr/lib/systemd/systemd"
|
||||
install_items+=" vi /etc/virc ps grep cat rm "
|
||||
prefix="/"
|
||||
systemdutildir=/usr/lib/systemd
|
||||
systemdsystemunitdir=/usr/lib/systemd/system
|
||||
udevdir=/usr/lib/udev
|
||||
add_dracutmodules+=" systemd "
|
||||
realinitpath="/usr/lib/systemd/systemd"
|
||||
|
@@ -1,9 +0,0 @@
|
||||
# /etc/dracut.conf.d/gentoo-openrc.conf
|
||||
# Dracut config file customized for Gentoo Base System release 2
|
||||
|
||||
#
|
||||
# Modules
|
||||
#
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE"
|
5
dracut.conf.d/gentoo-systemd.conf.example
Normal file
5
dracut.conf.d/gentoo-systemd.conf.example
Normal file
@@ -0,0 +1,5 @@
|
||||
# /etc/dracut.conf.d/gentoo-systemd.conf
|
||||
|
||||
# Paths of systemd dirs on Gentoo
|
||||
systemdutildir=/usr/lib/systemd
|
||||
systemdsystemunitdir=/usr/lib/systemd/system
|
@@ -1,9 +1,12 @@
|
||||
# /etc/dracut.conf.d/gentoo.conf
|
||||
# Dracut config file customized for Gentoo Base System release 1
|
||||
# /etc/dracut.conf.d/gentoo-openrc.conf
|
||||
# Dracut config file customized for Gentoo Base System release 2
|
||||
|
||||
udevdir=/lib/udev
|
||||
ro_mnt=yes
|
||||
|
||||
#
|
||||
# Modules
|
||||
#
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/conf.d/keymaps:KEYMAP,EXTENDED_KEYMAPS-EXT_KEYMAPS /etc/conf.d/consolefont:CONSOLEFONT-FONT,CONSOLETRANSLATION-FONT_MAP /etc/rc.conf:UNICODE"
|
||||
i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE"
|
||||
|
349
dracut.sh
349
dracut.sh
@@ -24,7 +24,7 @@
|
||||
#
|
||||
|
||||
# store for logging
|
||||
dracut_args="$@"
|
||||
dracut_args=( "$@" )
|
||||
|
||||
set -o pipefail
|
||||
|
||||
@@ -36,12 +36,38 @@ usage() {
|
||||
|
||||
# 80x25 linebreak here ^
|
||||
cat << EOF
|
||||
Usage: $0 [OPTION]... <initramfs> <kernel-version>
|
||||
Usage: $0 [OPTION]... [<initramfs> [<kernel-version>]]
|
||||
|
||||
Version: $DRACUT_VERSION
|
||||
|
||||
Creates initial ramdisk images for preloading modules
|
||||
|
||||
-h, --help Display all options
|
||||
|
||||
If a [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
|
||||
For example:
|
||||
|
||||
# dracut --add-drivers "module1 module2" ...
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
long_usage() {
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
|
||||
. $dracutbasedir/dracut-version.sh
|
||||
fi
|
||||
|
||||
# 80x25 linebreak here ^
|
||||
cat << EOF
|
||||
Usage: $0 [OPTION]... [<initramfs> [<kernel-version>]]
|
||||
|
||||
Version: $DRACUT_VERSION
|
||||
|
||||
Creates initial ramdisk images for preloading modules
|
||||
|
||||
--kver [VERSION] Set kernel version to [VERSION].
|
||||
-f, --force Overwrite existing initramfs file.
|
||||
-m, --modules [LIST] Specify a space-separated list of dracut modules to
|
||||
call when building the initramfs. Modules are located
|
||||
@@ -65,6 +91,8 @@ Creates initial ramdisk images for preloading modules
|
||||
--no-kernel Do not install kernel drivers and firmware files
|
||||
--strip Strip binaries in the initramfs
|
||||
--nostrip Do not strip binaries in the initramfs (default)
|
||||
--hardlink Hardlink files in the initramfs (default)
|
||||
--nohardlink Do not hardlink files in the initramfs
|
||||
--prefix [DIR] Prefix initramfs files with [DIR]
|
||||
--noprefix Do not prefix initramfs files (default)
|
||||
--mdadmconf Include local /etc/mdadm.conf
|
||||
@@ -73,6 +101,7 @@ Creates initial ramdisk images for preloading modules
|
||||
--nolvmconf Do not include local /etc/lvm/lvm.conf
|
||||
--fscks [LIST] Add a space-separated list of fsck helpers.
|
||||
--nofscks Inhibit installation of any fsck helpers.
|
||||
--ro-mnt Mount / and /usr read-only by default.
|
||||
-h, --help This message
|
||||
--debug Output debug information of the build process
|
||||
--profile Output profile information of the build process
|
||||
@@ -98,7 +127,7 @@ Creates initial ramdisk images for preloading modules
|
||||
Useful when running dracut from a git checkout.
|
||||
-H, --hostonly Host-Only mode: Install only what is needed for
|
||||
booting the local host instead of a generic host.
|
||||
--no-hostonly Disables Host-Only mode
|
||||
-N, --no-hostonly Disables Host-Only mode
|
||||
--fstab Use /etc/fstab to determine the root device.
|
||||
--add-fstab [FILE] Add file to the initramfs fstab
|
||||
--mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
|
||||
@@ -137,8 +166,11 @@ Creates initial ramdisk images for preloading modules
|
||||
--sshkey [SSHKEY] Add ssh key to initramfs (use with ssh-client module)
|
||||
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
|
||||
For example:
|
||||
# dracut --add-drivers "module1 module2" ...
|
||||
|
||||
# dracut --add-drivers "module1 module2" ...
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -149,9 +181,10 @@ EOF
|
||||
# example:
|
||||
# push stack 1 2 "3 4"
|
||||
push() {
|
||||
local _i
|
||||
local __stack=$1; shift
|
||||
for i in "$@"; do
|
||||
eval ${__stack}'[${#'${__stack}'[@]}]="$i"'
|
||||
for _i in "$@"; do
|
||||
eval ${__stack}'[${#'${__stack}'[@]}]="$_i"'
|
||||
done
|
||||
}
|
||||
|
||||
@@ -167,16 +200,16 @@ push() {
|
||||
pop() {
|
||||
local __stack=$1; shift
|
||||
local __resultvar=$1
|
||||
local myresult;
|
||||
local _value;
|
||||
# check for empty stack
|
||||
eval '[[ ${#'${__stack}'[@]} -eq 0 ]] && return 1'
|
||||
|
||||
eval myresult='${'${__stack}'[${#'${__stack}'[@]}-1]}'
|
||||
eval _value='${'${__stack}'[${#'${__stack}'[@]}-1]}'
|
||||
|
||||
if [[ "$__resultvar" ]]; then
|
||||
eval $__resultvar="'$myresult'"
|
||||
eval $__resultvar="'$_value'"
|
||||
else
|
||||
echo "$myresult"
|
||||
echo "$_value"
|
||||
fi
|
||||
eval unset ${__stack}'[${#'${__stack}'[@]}-1]'
|
||||
return 0
|
||||
@@ -200,57 +233,116 @@ read_arg() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Little helper function for reading args from the commandline to a stack.
|
||||
# it automatically handles -a b and -a=b variants, and returns 1 if
|
||||
# we need to shift $3.
|
||||
push_arg() {
|
||||
# $1 = arg name
|
||||
# $2 = arg value
|
||||
# $3 = arg parameter
|
||||
local rematch='^[^=]*=(.*)$'
|
||||
if [[ $2 =~ $rematch ]]; then
|
||||
push "$1" "${BASH_REMATCH[1]}"
|
||||
else
|
||||
push "$1" "$3"
|
||||
# There is no way to shift our callers args, so
|
||||
# return 1 to indicate they should do it instead.
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
verbosity_mod_l=0
|
||||
unset kernel
|
||||
unset outfile
|
||||
|
||||
while (($# > 0)); do
|
||||
case ${1%%=*} in
|
||||
-a|--add) push_arg add_dracutmodules_l "$@" || shift;;
|
||||
--force-add) push_arg force_add_dracutmodules_l "$@" || shift;;
|
||||
--add-drivers) push_arg add_drivers_l "$@" || shift;;
|
||||
--omit-drivers) push_arg omit_drivers_l "$@" || shift;;
|
||||
-m|--modules) push_arg dracutmodules_l "$@" || shift;;
|
||||
-o|--omit) push_arg omit_dracutmodules_l "$@" || shift;;
|
||||
-d|--drivers) push_arg drivers_l "$@" || shift;;
|
||||
--filesystems) push_arg filesystems_l "$@" || shift;;
|
||||
-I|--install) push_arg install_items_l "$@" || shift;;
|
||||
--fwdir) push_arg fw_dir_l "$@" || shift;;
|
||||
--libdirs) push_arg libdirs_l "$@" || shift;;
|
||||
--fscks) push_arg fscks_l "$@" || shift;;
|
||||
--add-fstab) push_arg add_fstab_l "$@" || shift;;
|
||||
--mount) push_arg fstab_lines "$@" || shift;;
|
||||
# Workaround -i, --include taking 2 arguments
|
||||
set -- "${@/--include/++include}"
|
||||
|
||||
# This prevents any long argument ending with "-i"
|
||||
# -i, like --opt-i but I think we can just prevent that
|
||||
set -- "${@/%-i/++include}"
|
||||
|
||||
TEMP=$(unset POSIXLY_CORRECT; getopt \
|
||||
-o "a:m:o:d:I:k:c:L:fvqlHhMN" \
|
||||
--long kver: \
|
||||
--long add: \
|
||||
--long force-add: \
|
||||
--long add-drivers: \
|
||||
--long omit-drivers: \
|
||||
--long modules: \
|
||||
--long omit: \
|
||||
--long drivers: \
|
||||
--long filesystems: \
|
||||
--long install: \
|
||||
--long fwdir: \
|
||||
--long libdirs: \
|
||||
--long fscks: \
|
||||
--long add-fstab: \
|
||||
--long mount: \
|
||||
--long nofscks: \
|
||||
--long ro-mnt \
|
||||
--long kmoddir: \
|
||||
--long conf: \
|
||||
--long confdir: \
|
||||
--long tmpdir: \
|
||||
--long stdlog: \
|
||||
--long compress: \
|
||||
--long prefix: \
|
||||
--long force \
|
||||
--long kernel-only \
|
||||
--long no-kernel \
|
||||
--long strip \
|
||||
--long nostrip \
|
||||
--long hardlink \
|
||||
--long nohardlink \
|
||||
--long noprefix \
|
||||
--long mdadmconf \
|
||||
--long nomdadmconf \
|
||||
--long lvmconf \
|
||||
--long nolvmconf \
|
||||
--long debug \
|
||||
--long profile \
|
||||
--long sshkey: \
|
||||
--long verbose \
|
||||
--long quiet \
|
||||
--long local \
|
||||
--long hostonly \
|
||||
--long no-hostonly \
|
||||
--long fstab \
|
||||
--long help \
|
||||
--long bzip2 \
|
||||
--long lzma \
|
||||
--long xz \
|
||||
--long no-compress \
|
||||
--long gzip \
|
||||
--long list-modules \
|
||||
--long show-modules \
|
||||
--long keep \
|
||||
--long printsize \
|
||||
-- "$@")
|
||||
|
||||
if (( $? != 0 )); then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval set -- "$TEMP"
|
||||
|
||||
while :; do
|
||||
case $1 in
|
||||
--kver) kernel="$2"; shift;;
|
||||
-a|--add) push add_dracutmodules_l "$2"; shift;;
|
||||
--force-add) push force_add_dracutmodules_l "$2"; shift;;
|
||||
--add-drivers) push add_drivers_l "$2"; shift;;
|
||||
--omit-drivers) push omit_drivers_l "$2"; shift;;
|
||||
-m|--modules) push dracutmodules_l "$2"; shift;;
|
||||
-o|--omit) push omit_dracutmodules_l "$2"; shift;;
|
||||
-d|--drivers) push drivers_l "$2"; shift;;
|
||||
--filesystems) push filesystems_l "$2"; shift;;
|
||||
-I|--install) push install_items_l "$2"; shift;;
|
||||
--fwdir) push fw_dir_l "$2"; shift;;
|
||||
--libdirs) push libdirs_l "$2"; shift;;
|
||||
--fscks) push fscks_l "$2"; shift;;
|
||||
--add-fstab) push add_fstab_l "$2"; shift;;
|
||||
--mount) push fstab_lines "$2"; shift;;
|
||||
--nofscks) nofscks_l="yes";;
|
||||
-k|--kmoddir) read_arg drivers_dir_l "$@" || shift;;
|
||||
-c|--conf) read_arg conffile "$@" || shift;;
|
||||
--confdir) read_arg confdir "$@" || shift;;
|
||||
--tmpdir) read_arg tmpdir_l "$@" || shift;;
|
||||
-L|--stdlog) read_arg stdloglvl_l "$@" || shift;;
|
||||
--compress) read_arg compress_l "$@" || shift;;
|
||||
--prefix) read_arg prefix_l "$@" || shift;;
|
||||
--ro-mnt) ro_mnt_l="yes";;
|
||||
-k|--kmoddir) drivers_dir_l="$2"; shift;;
|
||||
-c|--conf) conffile="$2"; shift;;
|
||||
--confdir) confdir="$2"; shift;;
|
||||
--tmpdir) tmpdir_l="$2"; shift;;
|
||||
-L|--stdlog) stdloglvl_l="$2"; shift;;
|
||||
--compress) compress_l="$2"; shift;;
|
||||
--prefix) prefix_l="$2"; shift;;
|
||||
-f|--force) force=yes;;
|
||||
--kernel-only) kernel_only="yes"; no_kernel="no";;
|
||||
--no-kernel) kernel_only="no"; no_kernel="yes";;
|
||||
--strip) do_strip_l="yes";;
|
||||
--nostrip) do_strip_l="no";;
|
||||
--hardlink) do_hardlink_l="yes";;
|
||||
--nohardlink) do_hardlink_l="no";;
|
||||
--noprefix) prefix_l="/";;
|
||||
--mdadmconf) mdadmconf_l="yes";;
|
||||
--nomdadmconf) mdadmconf_l="no";;
|
||||
@@ -258,7 +350,7 @@ while (($# > 0)); do
|
||||
--nolvmconf) lvmconf_l="no";;
|
||||
--debug) debug="yes";;
|
||||
--profile) profile="yes";;
|
||||
--sshkey) read_arg sshkey "$@" || shift;;
|
||||
--sshkey) sshkey="$2"; shift;;
|
||||
-v|--verbose) ((verbosity_mod_l++));;
|
||||
-q|--quiet) ((verbosity_mod_l--));;
|
||||
-l|--local)
|
||||
@@ -267,50 +359,69 @@ while (($# > 0)); do
|
||||
&& dracutbasedir="$(readlink -f ${0%/*})"
|
||||
;;
|
||||
-H|--hostonly) hostonly_l="yes" ;;
|
||||
--no-hostonly) hostonly_l="no" ;;
|
||||
-N|--no-hostonly) hostonly_l="no" ;;
|
||||
--fstab) use_fstab_l="yes" ;;
|
||||
-h|--help) usage; exit 1 ;;
|
||||
-h|--help) long_usage; exit 1 ;;
|
||||
-i|--include) push include_src "$2"
|
||||
push include_target "$3"
|
||||
shift 2;;
|
||||
shift;;
|
||||
--bzip2) compress_l="bzip2";;
|
||||
--lzma) compress_l="lzma";;
|
||||
--xz) compress_l="xz";;
|
||||
--no-compress) _no_compress_l="cat";;
|
||||
--gzip) compress_l="gzip";;
|
||||
--list-modules)
|
||||
do_list="yes";
|
||||
;;
|
||||
--list-modules) do_list="yes";;
|
||||
-M|--show-modules)
|
||||
show_modules_l="yes"
|
||||
;;
|
||||
--keep) keep="yes";;
|
||||
--printsize) printsize="yes";;
|
||||
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
|
||||
|
||||
--) shift; break;;
|
||||
|
||||
*) # should not even reach this point
|
||||
printf "\n!Unknown option: '%s'\n\n" "$1" >&2; usage; exit 1;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# getopt cannot handle multiple arguments, so just handle "-I,--include"
|
||||
# the old fashioned way
|
||||
|
||||
while (($# > 0)); do
|
||||
case ${1%%=*} in
|
||||
++include) push include_src "$2"
|
||||
push include_target "$3"
|
||||
shift 2;;
|
||||
*)
|
||||
if ! [[ ${outfile+x} ]]; then
|
||||
outfile=$1
|
||||
elif ! [[ ${kernel+x} ]]; then
|
||||
kernel=$1
|
||||
else
|
||||
echo "Unknown argument: $1"
|
||||
printf "\nUnknown arguments: %s\n\n" "$*" >&2
|
||||
usage; exit 1;
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if ! [[ $kernel ]]; then
|
||||
kernel=$(uname -r)
|
||||
fi
|
||||
[[ $outfile ]] || outfile="/boot/initramfs-$kernel.img"
|
||||
|
||||
if ! [[ $outfile ]]; then
|
||||
outfile="/boot/initramfs-$kernel.img"
|
||||
fi
|
||||
|
||||
for i in /usr/sbin /sbin /usr/bin /bin; do
|
||||
rl=$i
|
||||
if [ -L "$i" ]; then
|
||||
rl=$(readlink -f $i)
|
||||
fi
|
||||
NPATH+=":$rl"
|
||||
if [[ "$NPATH" != "*:$rl*" ]] ; then
|
||||
NPATH+=":$rl"
|
||||
fi
|
||||
done
|
||||
export PATH="${NPATH#:}"
|
||||
unset NPATH
|
||||
@@ -434,6 +545,9 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
|
||||
[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
|
||||
[[ $do_strip_l ]] && do_strip=$do_strip_l
|
||||
[[ $do_strip ]] || do_strip=no
|
||||
[[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l
|
||||
[[ $do_hardlink ]] || do_hardlink=yes
|
||||
[[ $prefix_l ]] && prefix=$prefix_l
|
||||
[[ $prefix = "/" ]] && unset prefix
|
||||
[[ $hostonly_l ]] && hostonly=$hostonly_l
|
||||
@@ -444,10 +558,10 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware"
|
||||
[[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
|
||||
[[ $tmpdir ]] || tmpdir=/var/tmp
|
||||
[[ $do_strip ]] || do_strip=no
|
||||
[[ $compress_l ]] && compress=$compress_l
|
||||
[[ $show_modules_l ]] && show_modules=$show_modules_l
|
||||
[[ $nofscks_l ]] && nofscks="yes"
|
||||
[[ $ro_mnt_l ]] && ro_mnt="yes"
|
||||
# eliminate IFS hackery when messing with fw_dir
|
||||
fw_dir=${fw_dir//:/ }
|
||||
|
||||
@@ -470,7 +584,7 @@ fi
|
||||
readonly TMPDIR="$tmpdir"
|
||||
readonly initdir=$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)
|
||||
[ -d "$initdir" ] || {
|
||||
echo "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t initramfs.XXXXXXfailed." >&2
|
||||
echo "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t initramfs.XXXXXX failed." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -486,11 +600,18 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
inst /bin/sh
|
||||
if ! $DRACUT_INSTALL ${initdir+-D "$initdir"} -R "$initdir/bin/sh" &>/dev/null; then
|
||||
unset DRACUT_RESOLVE_LAZY
|
||||
export DRACUT_RESOLVE_DEPS=1
|
||||
fi
|
||||
rm -fr ${initdir}/*
|
||||
|
||||
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
|
||||
. $dracutbasedir/dracut-version.sh
|
||||
fi
|
||||
|
||||
# Verify bash version, curret minimum is 3.1
|
||||
# Verify bash version, current minimum is 3.1
|
||||
if (( ${BASH_VERSINFO[0]} < 3 ||
|
||||
( ${BASH_VERSINFO[0]} == 3 && ${BASH_VERSINFO[1]} < 1 ) )); then
|
||||
dfatal 'You need at least Bash 3.1 to use dracut, sorry.'
|
||||
@@ -530,8 +651,13 @@ done
|
||||
omit_drivers="${omit_drivers_corrected%|}"
|
||||
unset omit_drivers_corrected
|
||||
|
||||
|
||||
ddebug "Executing $0 $dracut_args"
|
||||
# prepare args for logging
|
||||
for ((i=0; i < ${#dracut_args[@]}; i++)); do
|
||||
strstr "${dracut_args[$i]}" " " && \
|
||||
dracut_args[$i]="\"${dracut_args[$i]}\""
|
||||
#" keep vim happy
|
||||
done
|
||||
ddebug "Executing: $0 ${dracut_args[@]}"
|
||||
|
||||
[[ $do_list = yes ]] && {
|
||||
for mod in $dracutbasedir/modules.d/*; do
|
||||
@@ -567,7 +693,7 @@ if [[ ! -d "$outdir" ]]; then
|
||||
dfatal "Can't write $outfile: Directory $outdir does not exist."
|
||||
exit 1
|
||||
elif [[ ! -w "$outdir" ]]; then
|
||||
dfatal "No permission to write $outdir."
|
||||
dfatal "No permission to write to $outdir."
|
||||
exit 1
|
||||
elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
|
||||
dfatal "No permission to write $outfile."
|
||||
@@ -661,13 +787,14 @@ if ! [[ -d "$systemdutildir" ]]; then
|
||||
fi
|
||||
[[ -d "$systemdsystemunitdir" ]] || systemdsystemunitdir=${systemdutildir}/system
|
||||
|
||||
export initdir dracutbasedir dracutmodules drivers \
|
||||
export initdir dracutbasedir dracutmodules \
|
||||
fw_dir drivers_dir debug no_kernel kernel_only \
|
||||
add_drivers omit_drivers mdadmconf lvmconf filesystems \
|
||||
use_fstab fstab_lines libdirs fscks nofscks \
|
||||
omit_drivers mdadmconf lvmconf \
|
||||
use_fstab fstab_lines libdirs fscks nofscks ro_mnt \
|
||||
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
|
||||
debug host_fs_types host_devs sshkey add_fstab \
|
||||
DRACUT_VERSION udevdir systemdutildir systemdsystemunitdir
|
||||
DRACUT_VERSION udevdir systemdutildir systemdsystemunitdir \
|
||||
prefix filesystems drivers
|
||||
|
||||
# Create some directory structure first
|
||||
[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
|
||||
@@ -683,7 +810,7 @@ if [[ $prefix ]]; then
|
||||
fi
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
for d in usr/bin usr/sbin bin etc lib sbin tmp usr var var/log var/run var/lock $libdirs; do
|
||||
for d in usr/bin usr/sbin bin etc lib sbin tmp usr var var/log $libdirs; do
|
||||
[[ -e "${initdir}${prefix}/$d" ]] && continue
|
||||
if [ -L "/$d" ]; then
|
||||
inst_symlink "/$d" "${prefix}/$d"
|
||||
@@ -700,8 +827,8 @@ if [[ $kernel_only != yes ]]; then
|
||||
fi
|
||||
done
|
||||
|
||||
ln -sfn /run "$initdir/var/run"
|
||||
ln -sfn /run/lock "$initdir/var/lock"
|
||||
ln -sfn ../run "$initdir/var/run"
|
||||
ln -sfn ../run/lock "$initdir/var/lock"
|
||||
else
|
||||
for d in lib "$libdir"; do
|
||||
[[ -e "${initdir}${prefix}/$d" ]] && continue
|
||||
@@ -778,11 +905,44 @@ dinfo "*** Including modules done ***"
|
||||
|
||||
## final stuff that has to happen
|
||||
if [[ $no_kernel != yes ]]; then
|
||||
|
||||
if [[ $drivers ]]; then
|
||||
hostonly='' instmods $drivers
|
||||
fi
|
||||
|
||||
if [[ $add_drivers ]]; then
|
||||
hostonly='' instmods -c $add_drivers
|
||||
fi
|
||||
if [[ $filesystems ]]; then
|
||||
hostonly='' instmods -c $filesystems
|
||||
fi
|
||||
|
||||
dinfo "*** Installing kernel module dependencies and firmware ***"
|
||||
dracut_kernel_post
|
||||
dinfo "*** Installing kernel module dependencies and firmware done ***"
|
||||
fi
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
(( ${#install_items[@]} > 0 )) && dracut_install ${install_items[@]}
|
||||
|
||||
while pop fstab_lines line; do
|
||||
echo "$line 0 0" >> "${initdir}/etc/fstab"
|
||||
done
|
||||
|
||||
for f in $add_fstab; do
|
||||
cat $f >> "${initdir}/etc/fstab"
|
||||
done
|
||||
|
||||
if [[ $DRACUT_RESOLVE_LAZY ]] && [[ $DRACUT_INSTALL ]]; then
|
||||
dinfo "*** Resolving executable dependencies ***"
|
||||
find "$initdir" -type f \
|
||||
'(' -perm -0100 -or -perm -0010 -or -perm -0001 ')' \
|
||||
-not -path '*.ko' -print0 \
|
||||
| xargs -r -0 $DRACUT_INSTALL ${initdir+-D "$initdir"} -R ${DRACUT_FIPS_MODE+-H}
|
||||
dinfo "*** Resolving executable dependencies done***"
|
||||
fi
|
||||
fi
|
||||
|
||||
while pop include_src src && pop include_target tgt; do
|
||||
if [[ $src && $tgt ]]; then
|
||||
if [[ -f $src ]]; then
|
||||
@@ -800,9 +960,9 @@ while pop include_src src && pop include_target tgt; do
|
||||
mkdir -m 0755 -p "$s"
|
||||
chmod --reference="$i" "$s"
|
||||
fi
|
||||
cp --reflink=auto --sparse=auto -pfLr -t "$s" "$i"/*
|
||||
cp --reflink=auto --sparse=auto -fa -t "$s" "$i"/*
|
||||
else
|
||||
cp --reflink=auto --sparse=auto -pfLr -t "$s" "$i"
|
||||
cp --reflink=auto --sparse=auto -fa -t "$s" "$i"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@@ -810,25 +970,6 @@ while pop include_src src && pop include_target tgt; do
|
||||
done
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
(( ${#install_items[@]} > 0 )) && dracut_install ${install_items[@]}
|
||||
|
||||
while pop fstab_lines line; do
|
||||
echo "$line 0 0" >> "${initdir}/etc/fstab"
|
||||
done
|
||||
|
||||
for f in $add_fstab; do
|
||||
cat $f >> "${initdir}/etc/fstab"
|
||||
done
|
||||
|
||||
if [[ $DRACUT_RESOLVE_LAZY ]] && [[ -x /usr/bin/dracut-install ]]; then
|
||||
dinfo "*** Resolving executable dependencies ***"
|
||||
find "$initdir" -type f \
|
||||
'(' -perm -0100 -or -perm -0010 -or -perm -0001 ')' \
|
||||
-not -path '*.ko' -print0 \
|
||||
| xargs -0 dracut-install ${initdir+-D "$initdir"} -R ${DRACUT_FIPS_MODE+-H}
|
||||
dinfo "*** Resolving executable dependencies done***"
|
||||
fi
|
||||
|
||||
# make sure that library links are correct and up to date
|
||||
for f in /etc/ld.so.conf /etc/ld.so.conf.d/*; do
|
||||
[[ -f $f ]] && inst_simple "$f"
|
||||
@@ -877,15 +1018,17 @@ if [[ $do_strip = yes ]] ; then
|
||||
find "$initdir" -type f \
|
||||
'(' -perm -0100 -or -perm -0010 -or -perm -0001 \
|
||||
-or -path '*/lib/modules/*.ko' ')' -print0 \
|
||||
| xargs -0 strip -g 2>/dev/null
|
||||
| xargs -r -0 strip -g 2>/dev/null
|
||||
dinfo "*** Stripping files done ***"
|
||||
fi
|
||||
|
||||
type hardlink &>/dev/null && {
|
||||
dinfo "*** hardlinking files ***"
|
||||
hardlink "$initdir" 2>&1
|
||||
dinfo "*** hardlinking files done ***"
|
||||
}
|
||||
if [[ $do_hardlink = yes ]] ; then
|
||||
type hardlink &>/dev/null && {
|
||||
dinfo "*** hardlinking files ***"
|
||||
hardlink "$initdir" 2>&1
|
||||
dinfo "*** hardlinking files done ***"
|
||||
}
|
||||
fi
|
||||
|
||||
dinfo "*** Creating image file ***"
|
||||
if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
|
||||
|
37
dracut.spec
37
dracut.spec
@@ -19,8 +19,13 @@ Group: System Environment/Base
|
||||
%if 0%{?suse_version}
|
||||
Group: System/Base
|
||||
%endif
|
||||
License: GPLv2+
|
||||
|
||||
# The entire source code is GPLv2+
|
||||
# except install/* which is LGPLv2.1+
|
||||
License: GPLv2+ and LGPLv2.1+
|
||||
|
||||
URL: https://dracut.wiki.kernel.org/
|
||||
|
||||
# Source can be generated by
|
||||
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz
|
||||
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
|
||||
@@ -76,10 +81,12 @@ Requires: gzip xz
|
||||
Requires: module-init-tools >= 3.7-9
|
||||
Requires: sed
|
||||
Requires: file
|
||||
Requires: kpartx
|
||||
Requires: udev > 166
|
||||
Requires: kbd kbd-misc
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
Requires: util-linux >= 2.21
|
||||
Requires: systemd >= 44-15
|
||||
Conflicts: systemd < 187
|
||||
%else
|
||||
Requires: util-linux-ng >= 2.21
|
||||
%endif
|
||||
@@ -106,7 +113,7 @@ Provides: dracut-generic = %{version}-%{release}
|
||||
This package requires everything which is needed to build a generic
|
||||
all purpose initramfs with network support with dracut.
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} >= 6
|
||||
%if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?suse_version}
|
||||
%package fips
|
||||
Summary: Dracut modules to build a dracut initramfs with an integrity check
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
@@ -180,11 +187,14 @@ make install DESTDIR=$RPM_BUILD_ROOT \
|
||||
|
||||
echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh
|
||||
|
||||
%if 0%{?fedora} == 0 && 0%{?rhel} == 0
|
||||
%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} == 0
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
|
||||
%endif
|
||||
|
||||
# we do not support dash in the initramfs
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
|
||||
|
||||
# remove gentoo specific modules
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
|
||||
|
||||
@@ -202,7 +212,7 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log
|
||||
touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
|
||||
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/40-fips.conf
|
||||
%endif
|
||||
@@ -235,7 +245,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
%{_bindir}/mkinitrd
|
||||
%{_bindir}/lsinitrd
|
||||
%{_bindir}/dracut-install
|
||||
%endif
|
||||
%dir %{dracutlibdir}
|
||||
%dir %{dracutlibdir}/modules.d
|
||||
@@ -244,17 +253,22 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/dracut-version.sh
|
||||
%{dracutlibdir}/dracut-logger.sh
|
||||
%{dracutlibdir}/dracut-initramfs-restore
|
||||
%{dracutlibdir}/dracut-install
|
||||
%config(noreplace) /etc/dracut.conf
|
||||
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
|
||||
%config /etc/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
%dir /etc/dracut.conf.d
|
||||
%{_mandir}/man8/dracut.8*
|
||||
%{_mandir}/man8/*service.8*
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
%{_mandir}/man8/mkinitrd.8*
|
||||
%{_mandir}/man1/lsinitrd.1*
|
||||
%endif
|
||||
%{_mandir}/man7/dracut.kernel.7*
|
||||
%{_mandir}/man7/dracut.cmdline.7*
|
||||
%{_mandir}/man5/dracut.conf.5*
|
||||
%{dracutlibdir}/modules.d/00bootchart
|
||||
%{dracutlibdir}/modules.d/00dash
|
||||
%{dracutlibdir}/modules.d/04watchdog
|
||||
%{dracutlibdir}/modules.d/05busybox
|
||||
%{dracutlibdir}/modules.d/10i18n
|
||||
@@ -273,6 +287,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/90multipath
|
||||
%{dracutlibdir}/modules.d/90qemu
|
||||
%{dracutlibdir}/modules.d/91crypt-gpg
|
||||
%{dracutlibdir}/modules.d/91crypt-loop
|
||||
%{dracutlibdir}/modules.d/95debug
|
||||
%{dracutlibdir}/modules.d/95resume
|
||||
%{dracutlibdir}/modules.d/95rootfs-block
|
||||
@@ -303,9 +318,8 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
|
||||
%dir %{_sharedstatedir}/initramfs
|
||||
%if %{defined _unitdir}
|
||||
%{_unitdir}/*.service
|
||||
%{_unitdir}/*.target
|
||||
%{_unitdir}/*/*.service
|
||||
%{_unitdir}/dracut-shutdown.service
|
||||
%{_unitdir}/shutdown.target.wants/dracut-shutdown.service
|
||||
%endif
|
||||
|
||||
%files network
|
||||
@@ -315,13 +329,14 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/95iscsi
|
||||
%{dracutlibdir}/modules.d/90livenet
|
||||
%{dracutlibdir}/modules.d/90qemu-net
|
||||
%{dracutlibdir}/modules.d/95cifs
|
||||
%{dracutlibdir}/modules.d/95nbd
|
||||
%{dracutlibdir}/modules.d/95nfs
|
||||
%{dracutlibdir}/modules.d/95ssh-client
|
||||
%{dracutlibdir}/modules.d/45ifcfg
|
||||
%{dracutlibdir}/modules.d/95znet
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
%files fips
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/01fips
|
||||
|
@@ -1,17 +1,7 @@
|
||||
prefix ?= /usr
|
||||
bindir ?= ${prefix}/bin
|
||||
strip ?= -s
|
||||
|
||||
all: dracut-install
|
||||
|
||||
dracut-install: dracut-install.c hashmap.c log.c util.c
|
||||
gcc -std=gnu99 -O2 -g -Wall -o dracut-install dracut-install.c hashmap.c log.c util.c
|
||||
|
||||
install: dracut-install
|
||||
install $(strip) -m 0755 dracut-install $(DESTDIR)$(bindir)/dracut-install
|
||||
all:
|
||||
$(MAKE) -C ..
|
||||
|
||||
clean:
|
||||
rm -f dracut-install *~
|
||||
$(MAKE) -C .. clean
|
||||
|
||||
indent:
|
||||
indent -i8 -nut -br -linux -l120 dracut-install.c
|
||||
.PHONY: all clean
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "hashmap.h"
|
||||
@@ -56,7 +57,7 @@ static char *destrootdir = NULL;
|
||||
static Hashmap *items = NULL;
|
||||
static Hashmap *items_failed = NULL;
|
||||
|
||||
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps);
|
||||
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst);
|
||||
|
||||
static size_t dir_len(char const *file)
|
||||
{
|
||||
@@ -163,25 +164,78 @@ static int ln_r(const char *src, const char *dst)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Perform the O(1) btrfs clone operation, if possible.
|
||||
Upon success, return 0. Otherwise, return -1 and set errno. */
|
||||
static inline int clone_file(int dest_fd, int src_fd)
|
||||
{
|
||||
#undef BTRFS_IOCTL_MAGIC
|
||||
#define BTRFS_IOCTL_MAGIC 0x94
|
||||
#undef BTRFS_IOC_CLONE
|
||||
#define BTRFS_IOC_CLONE _IOW (BTRFS_IOCTL_MAGIC, 9, int)
|
||||
return ioctl(dest_fd, BTRFS_IOC_CLONE, src_fd);
|
||||
}
|
||||
|
||||
static bool use_clone = true;
|
||||
|
||||
static int cp(const char *src, const char *dst)
|
||||
{
|
||||
int pid;
|
||||
int status;
|
||||
int ret;
|
||||
|
||||
if (use_clone) {
|
||||
struct stat sb;
|
||||
int dest_desc, source_desc;
|
||||
|
||||
if (lstat(src, &sb) != 0)
|
||||
goto normal_copy;
|
||||
|
||||
if (S_ISLNK(sb.st_mode))
|
||||
goto normal_copy;
|
||||
|
||||
source_desc = open(src, O_RDONLY | O_CLOEXEC);
|
||||
if (source_desc < 0)
|
||||
goto normal_copy;
|
||||
|
||||
dest_desc =
|
||||
open(dst, O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC,
|
||||
(sb.st_mode) & (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO));
|
||||
|
||||
if (dest_desc < 0) {
|
||||
close(source_desc);
|
||||
goto normal_copy;
|
||||
}
|
||||
|
||||
ret = clone_file(dest_desc, source_desc);
|
||||
close(source_desc);
|
||||
if (ret == 0) {
|
||||
if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0)
|
||||
fchown(dest_desc, -1, sb.st_gid);
|
||||
close(dest_desc);
|
||||
return ret;
|
||||
}
|
||||
close(dest_desc);
|
||||
|
||||
/* clone did not work, remove the file */
|
||||
unlink(dst);
|
||||
/* do not try clone again */
|
||||
use_clone = false;
|
||||
}
|
||||
|
||||
normal_copy:
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode", "-fL", src, dst, NULL);
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
while (waitpid(pid, &status, 0) < 0) {
|
||||
while (waitpid(pid, &ret, 0) < 0) {
|
||||
if (errno != EINTR) {
|
||||
status = -1;
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int resolve_deps(const char *src)
|
||||
@@ -206,7 +260,7 @@ static int resolve_deps(const char *src)
|
||||
for (q = p; *q && (!isspace(*q)); q++) ;
|
||||
*q = '\0';
|
||||
log_debug("Script install: '%s'", p);
|
||||
ret = dracut_install(p, p, false, true);
|
||||
ret = dracut_install(p, p, false, true, false);
|
||||
if (ret != 0)
|
||||
log_error("ERROR: failed to install '%s'", p);
|
||||
return ret;
|
||||
@@ -214,7 +268,7 @@ static int resolve_deps(const char *src)
|
||||
}
|
||||
|
||||
/* run ldd */
|
||||
asprintf(&cmd, "ldd %s", src);
|
||||
asprintf(&cmd, "ldd %s 2>&1", src);
|
||||
fptr = popen(cmd, "r");
|
||||
|
||||
while (!feof(fptr)) {
|
||||
@@ -228,12 +282,15 @@ static int resolve_deps(const char *src)
|
||||
if (strstr(buf, "not a dynamic executable"))
|
||||
break;
|
||||
|
||||
if (strstr(buf, "loader cannot load itself"))
|
||||
break;
|
||||
|
||||
p = strstr(buf, "/");
|
||||
if (p) {
|
||||
int r;
|
||||
for (q = p; *q && *q != ' ' && *q != '\n'; q++) ;
|
||||
*q = '\0';
|
||||
r = dracut_install(p, p, false, false);
|
||||
r = dracut_install(p, p, false, false, true);
|
||||
if (r != 0)
|
||||
log_error("ERROR: failed to install '%s' for '%s'", p, src);
|
||||
else
|
||||
@@ -247,7 +304,7 @@ static int resolve_deps(const char *src)
|
||||
*q = '\0';
|
||||
|
||||
/* ignore errors for base lib symlink */
|
||||
if (dracut_install(p, p, false, false) == 0)
|
||||
if (dracut_install(p, p, false, false, true) == 0)
|
||||
log_debug("Lib install: '%s'", p);
|
||||
}
|
||||
}
|
||||
@@ -274,7 +331,7 @@ static int hmac_install(const char *src, const char *dst)
|
||||
asprintf(&srchmacname, "%s/.%s.hmac", srcpath, &src[dlen + 1]);
|
||||
asprintf(&dsthmacname, "%s/.%s.hmac", dstpath, &src[dlen + 1]);
|
||||
log_debug("hmac cp '%s' '%s')", srchmacname, dsthmacname);
|
||||
dracut_install(srchmacname, dsthmacname, false, false);
|
||||
dracut_install(srchmacname, dsthmacname, false, false, true);
|
||||
free(dsthmacname);
|
||||
free(srchmacname);
|
||||
free(srcpath);
|
||||
@@ -282,7 +339,7 @@ static int hmac_install(const char *src, const char *dst)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps)
|
||||
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst)
|
||||
{
|
||||
struct stat sb, db;
|
||||
char *dname = NULL;
|
||||
@@ -302,11 +359,13 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
}
|
||||
}
|
||||
|
||||
existing = hashmap_get(items, dst);
|
||||
if (existing) {
|
||||
if (strcmp(existing, dst) == 0) {
|
||||
log_debug("hash hit items for '%s'", dst);
|
||||
return 0;
|
||||
if (hashdst) {
|
||||
existing = hashmap_get(items, dst);
|
||||
if (existing) {
|
||||
if (strcmp(existing, dst) == 0) {
|
||||
log_debug("hash hit items for '%s'", dst);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,7 +413,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
log_debug("dest dir '%s' does not exist", fulldstdir);
|
||||
dname = strdup(dst);
|
||||
dname[dir_len(dname)] = '\0';
|
||||
ret = dracut_install(dname, dname, true, false);
|
||||
ret = dracut_install(dname, dname, true, false, true);
|
||||
|
||||
free(dname);
|
||||
|
||||
@@ -388,7 +447,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
if (abspath == NULL)
|
||||
return 1;
|
||||
|
||||
if (dracut_install(abspath, abspath, false, resolvedeps)) {
|
||||
if (dracut_install(abspath, abspath, false, resolvedeps, hashdst)) {
|
||||
log_debug("'%s' install error", abspath);
|
||||
return 1;
|
||||
}
|
||||
@@ -458,6 +517,7 @@ Install SOURCE to DEST in DESTROOTDIR with all needed dependencies.\n\
|
||||
-h --help Show this help\n\
|
||||
\n\
|
||||
Example:\n\
|
||||
# mkdir -p /var/tmp/test-root\n\
|
||||
# %s -D /var/tmp/test-root --ldd -a sh tr\n\
|
||||
# tree /var/tmp/test-root\n\
|
||||
/var/tmp/test-root\n\
|
||||
@@ -547,6 +607,7 @@ static int parse_argv(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (!optind || optind == argc) {
|
||||
log_error("No SOURCE argument given");
|
||||
usage(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -628,7 +689,7 @@ static int install_all(int argc, char **argv)
|
||||
dest = strdup(newsrc);
|
||||
|
||||
log_debug("dracut_install '%s'", newsrc);
|
||||
ret = dracut_install(newsrc, dest, arg_createdir, arg_resolvedeps);
|
||||
ret = dracut_install(newsrc, dest, arg_createdir, arg_resolvedeps, true);
|
||||
if (ret == 0) {
|
||||
end = true;
|
||||
log_debug("dracut_install '%s' OK", newsrc);
|
||||
@@ -639,11 +700,11 @@ static int install_all(int argc, char **argv)
|
||||
free(path);
|
||||
} else {
|
||||
char *dest = strdup(argv[i]);
|
||||
ret = dracut_install(argv[i], dest, arg_createdir, arg_resolvedeps);
|
||||
ret = dracut_install(argv[i], dest, arg_createdir, arg_resolvedeps, true);
|
||||
free(dest);
|
||||
}
|
||||
|
||||
if ((ret != 0) && (!arg_optional)) {
|
||||
if ((ret != 0) && (!arg_optional)) {
|
||||
log_error("ERROR: installing '%s'", argv[i]);
|
||||
r = EXIT_FAILURE;
|
||||
}
|
||||
@@ -670,15 +731,29 @@ int main(int argc, char **argv)
|
||||
|
||||
umask(0022);
|
||||
|
||||
if (destrootdir == NULL) {
|
||||
if (destrootdir == NULL || strlen(destrootdir) == 0) {
|
||||
destrootdir = getenv("DESTROOTDIR");
|
||||
if (destrootdir == NULL) {
|
||||
if (destrootdir == NULL || strlen(destrootdir) == 0) {
|
||||
log_error("Environment DESTROOTDIR or argument -D is not set!");
|
||||
usage(EXIT_FAILURE);
|
||||
}
|
||||
destrootdir = strdup(destrootdir);
|
||||
}
|
||||
|
||||
if (strcmp(destrootdir, "/") == 0) {
|
||||
log_error("Environment DESTROOTDIR or argument -D is set to '/'!");
|
||||
usage(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
i = destrootdir;
|
||||
destrootdir = realpath(destrootdir, NULL);
|
||||
if (!destrootdir) {
|
||||
log_error("Environment DESTROOTDIR or argument -D is set to '%s': %m", i);
|
||||
r = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
free(i);
|
||||
|
||||
items = hashmap_new(string_hash_func, string_compare_func);
|
||||
items_failed = hashmap_new(string_hash_func, string_compare_func);
|
||||
|
||||
@@ -709,7 +784,7 @@ int main(int argc, char **argv)
|
||||
r = install_all(argc - optind, &argv[optind]);
|
||||
} else {
|
||||
/* simple "inst src dst" */
|
||||
r = dracut_install(argv[optind], argv[optind + 1], arg_createdir, arg_resolvedeps);
|
||||
r = dracut_install(argv[optind], argv[optind + 1], arg_createdir, arg_resolvedeps, true);
|
||||
if ((r != 0) && (!arg_optional)) {
|
||||
log_error("ERROR: installing '%s' to '%s'", argv[optind], argv[optind + 1]);
|
||||
r = EXIT_FAILURE;
|
||||
|
Binary file not shown.
43
lsinitrd.1.asc
Normal file
43
lsinitrd.1.asc
Normal file
@@ -0,0 +1,43 @@
|
||||
LSINITRD(1)
|
||||
=========
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
|
||||
NAME
|
||||
----
|
||||
lsinitrd - tool to show the contents of an initramfs image
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
*lsinit* ['OPTION...'] [<image>]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
lsinitrd shows the contents of an initramfs image. if <image> is omitted, then
|
||||
lsinitrd uses the default image /boot/initramfs-<kernel version>.img.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
**-h, --help**::
|
||||
print a help message and exit.
|
||||
|
||||
**-s, --size**::
|
||||
sort the contents of the initramfs by size.
|
||||
|
||||
AVAILABILITY
|
||||
------------
|
||||
The lsinitrd command is part of the dracut package and is available from
|
||||
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
|
||||
|
||||
AUTHORS
|
||||
-------
|
||||
Harald Hoyer
|
||||
|
||||
Amerigo Wang
|
||||
|
||||
Nikoli
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
*dracut*(8)
|
14
lsinitrd.sh
14
lsinitrd.sh
@@ -19,13 +19,19 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
[[ $# -le 2 ]] || { echo "Usage: $(basename $0) [-s] [<initramfs file> [<filename>]]" ; exit 1 ; }
|
||||
usage()
|
||||
{
|
||||
echo "Usage: $(${0##*/}) [-s] [<initramfs file> [<filename>]]"
|
||||
}
|
||||
|
||||
[[ $# -le 2 ]] || { usage ; exit 1 ; }
|
||||
|
||||
sorted=0
|
||||
while getopts "s" opt; do
|
||||
case $opt in
|
||||
s) sorted=1;;
|
||||
\?) exit 1;;
|
||||
h) usage; exit 0;;
|
||||
\?) usage; exit 1;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
@@ -57,9 +63,9 @@ if [[ $# -eq 2 ]]; then
|
||||
exit $?
|
||||
fi
|
||||
|
||||
echo "$image: $(du -h $image | awk '{print $1}')"
|
||||
echo "$image: $(du -h $image | while read a b; do echo $a;done)"
|
||||
echo "========================================================================"
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout 'lib/dracut/dracut-*' 2>/dev/null
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout '*lib/dracut/dracut-*' 2>/dev/null
|
||||
echo "========================================================================"
|
||||
if [ "$sorted" -eq 1 ]; then
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
|
65
mkinitrd.8.asc
Normal file
65
mkinitrd.8.asc
Normal file
@@ -0,0 +1,65 @@
|
||||
MKINITRD(8)
|
||||
=========
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
|
||||
NAME
|
||||
----
|
||||
mkinitrd - is a compat wrapper, which calls dracut to generate an initramfs
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
*mkinitrd* ['OPTION...'] [<initrd-image>] <kernel-version>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
mkinitrd creates an initramfs image <initrd-image> for the kernel with
|
||||
version <kernel-version> by calling "dracut".
|
||||
|
||||
[IMPORTANT]
|
||||
If a more fine grained control over the resulting image is needed,
|
||||
"dracut" should be called directly.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
**--version**::
|
||||
print info about the version
|
||||
|
||||
**-v, --verbose**::
|
||||
increase verbosity level
|
||||
|
||||
**-f, --force**::
|
||||
overwrite existing initramfs file.
|
||||
|
||||
**--image-version*::
|
||||
append the kernel version to the target image
|
||||
<initrd-image>-<kernel-version>.
|
||||
|
||||
**--with=<module>**::
|
||||
add the kernel module <module> to the initramfs.
|
||||
|
||||
**--preload=<module>**::
|
||||
preload the kernel module <module> in the initramfs before any other kernel
|
||||
modules are loaded. This can be used to ensure a certain device naming, which
|
||||
should in theory be avoided and the use of symbolic links in /dev is
|
||||
encouraged.
|
||||
|
||||
**--nocompress**::
|
||||
do not compress the resulting image.
|
||||
|
||||
**--help**::
|
||||
print a help message and exit.
|
||||
|
||||
AVAILABILITY
|
||||
------------
|
||||
The mkinitrd command is part of the dracut package and is available from
|
||||
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
|
||||
|
||||
AUTHORS
|
||||
-------
|
||||
Harald Hoyer
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
*dracut*(8)
|
@@ -12,14 +12,14 @@ depends() {
|
||||
|
||||
installkernel() {
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aead aes_generic xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr"
|
||||
_fipsmodules+=" des deflate ecb eseqiv hmac seqiv sha256 sha512"
|
||||
_fipsmodules="aead aes_generic xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr gcm ghash_generic"
|
||||
_fipsmodules+=" des deflate ecb eseqiv hmac seqiv sha256 sha256_generic sha512 sha512_generic"
|
||||
_fipsmodules+=" cryptomgr crypto_null tcrypt dm-mod dm-crypt"
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
for _mod in $_fipsmodules; do
|
||||
if hostonly='' instmods $_mod; then
|
||||
if hostonly='' instmods -c -s $_mod; then
|
||||
echo $_mod >> "${initdir}/etc/fipsmodules"
|
||||
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
fi
|
||||
|
@@ -14,6 +14,6 @@ install() {
|
||||
inst_hook pre-pivot 00 "$moddir/caps.sh"
|
||||
inst $(type -P capsh 2>/dev/null) /usr/sbin/capsh
|
||||
# capsh wants bash and we need bash also
|
||||
inst /bin/bash && ln -sf bash "${initdir}/bin/sh"
|
||||
inst /bin/bash
|
||||
}
|
||||
|
||||
|
@@ -12,7 +12,7 @@ depends() {
|
||||
|
||||
installkernel() {
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aesni-intel"
|
||||
_fipsmodules="aesni-intel ghash_clmulni_intel"
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
|
@@ -23,5 +23,6 @@ install() {
|
||||
inst_hook cleanup 00 "$moddir/watchdog.sh"
|
||||
inst_hook cleanup 99 "$moddir/watchdog.sh"
|
||||
inst_hook emergency 02 "$moddir/watchdog-stop.sh"
|
||||
dracut_install -o wdctl
|
||||
}
|
||||
|
||||
|
2
modules.d/04watchdog/watchdog-stop.sh
Executable file
2
modules.d/04watchdog/watchdog-stop.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
[ -c /dev/watchdog ] && echo -n 'V' > /dev/watchdog
|
@@ -1,7 +1,12 @@
|
||||
#!/bin/sh
|
||||
if [ -e /dev/watchdog ]; then
|
||||
if [ ! -e /tmp/watchdog_timeout ]; then
|
||||
wdctl -s 60 /dev/watchdog &>/dev/null
|
||||
> /tmp/watchdog_timeout
|
||||
fi
|
||||
info "Triggering watchdog"
|
||||
>/dev/watchdog
|
||||
else
|
||||
modprobe ib700wdt
|
||||
modprobe i6300esb
|
||||
fi
|
||||
|
@@ -1,2 +1,2 @@
|
||||
# Console initialization - keyboard, font, etc.
|
||||
KERNEL=="tty0", RUN+="/lib/udev/console_init $root/$name"
|
||||
KERNEL=="tty0", RUN+="/sbin/initqueue --unique --name console_init_$name /lib/udev/console_init $root/$name"
|
||||
|
@@ -2,7 +2,11 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
[ -x /lib/systemd/systemd-vconsole-setup ] && exit 0
|
||||
[ -n "$DRACUT_SYSTEMD" ] && exit 0
|
||||
|
||||
if [ -x /lib/systemd/systemd-vconsole-setup ]; then
|
||||
/lib/systemd/systemd-vconsole-setup "$@"
|
||||
fi
|
||||
|
||||
[ -e /etc/vconsole.conf ] && . /etc/vconsole.conf
|
||||
|
||||
|
@@ -31,7 +31,7 @@ install() {
|
||||
*) cmd=grep ;;
|
||||
esac
|
||||
|
||||
for INCL in $($cmd "^include " $MAP | while read a a b; do echo ${a/\"/}; done); do
|
||||
for INCL in $($cmd "^include " $MAP | while read a a b; do echo ${a//\"/}; done); do
|
||||
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
|
||||
findkeymap $FN
|
||||
done
|
||||
@@ -74,9 +74,11 @@ install() {
|
||||
for map in ${item[1]//,/ }
|
||||
do
|
||||
map=(${map//-/ })
|
||||
value=$(grep "^${map[0]}=" "${item[0]}")
|
||||
value=${value#*=}
|
||||
echo "${map[1]:-${map[0]}}=${value}"
|
||||
if [[ -f "${item[0]}" ]]; then
|
||||
value=$(grep "^${map[0]}=" "${item[0]}")
|
||||
value=${value#*=}
|
||||
echo "${map[1]:-${map[0]}}=${value}"
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
@@ -94,7 +96,7 @@ install() {
|
||||
|
||||
for _src in $(eval echo ${kbddir}/{${KBDSUBDIRS}}); do
|
||||
inst_dir "$_src"
|
||||
cp --reflink=auto --sparse=auto -prfL -t "${initdir}/${_src%/*}" "$_src"
|
||||
cp --reflink=auto --sparse=auto -prfL -t "${initdir}/${_src}" "$_src"/*
|
||||
done
|
||||
|
||||
# remove unnecessary files
|
||||
@@ -155,9 +157,10 @@ install() {
|
||||
EXT_KEYMAPS+=\ ${UNIKEYMAP}\ ${GRP_TOGGLE}
|
||||
|
||||
[[ ${KEYMAP} ]] || {
|
||||
derror 'No KEYMAP.'
|
||||
dinfo 'No KEYMAP configured.'
|
||||
return 1
|
||||
}
|
||||
|
||||
findkeymap ${KEYMAP}
|
||||
|
||||
for map in ${EXT_KEYMAPS}
|
||||
|
@@ -19,10 +19,10 @@ inst_key_val() {
|
||||
unset _value
|
||||
}
|
||||
|
||||
inst_key_val '' /etc/vconsole.conf KEYMAP vconsole.keymap KEYTABLE
|
||||
inst_key_val '' /etc/vconsole.conf FONT vconsole.font SYSFONT
|
||||
inst_key_val '' /etc/vconsole.conf FONT_MAP vconsole.font.map CONTRANS
|
||||
inst_key_val '' /etc/vconsole.conf FONT_UNIMAP vconsole.font.unimap UNIMAP
|
||||
inst_key_val '' /etc/vconsole.conf KEYMAP vconsole.keymap -d KEYTABLE
|
||||
inst_key_val '' /etc/vconsole.conf FONT vconsole.font -d SYSFONT
|
||||
inst_key_val '' /etc/vconsole.conf FONT_MAP vconsole.font.map -d CONTRANS
|
||||
inst_key_val '' /etc/vconsole.conf FONT_UNIMAP vconsole.font.unimap -d UNIMAP
|
||||
inst_key_val 1 /etc/vconsole.conf UNICODE vconsole.unicode vconsole.font.unicode
|
||||
inst_key_val '' /etc/vconsole.conf EXT_KEYMAP vconsole.keymap.ext
|
||||
|
||||
@@ -35,10 +35,8 @@ if [ -f /etc/locale.conf ]; then
|
||||
export LC_ALL
|
||||
fi
|
||||
|
||||
# FIXME: fix systemd-vconsole-setup
|
||||
#if [ -x /lib/systemd/systemd-vconsole-setup ]; then
|
||||
# /lib/systemd/systemd-vconsole-setup
|
||||
# rm -f /{etc,lib}/udev/rules.d/10-console.rules
|
||||
# rm -f /lib/udev/console_init
|
||||
# ln -s /lib/systemd/systemd-vconsole-setup /lib/udev/console_init
|
||||
#fi
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
rm -f /etc/udev/rules.d/10-console.rules
|
||||
rm -f /lib/udev/rules.d/10-console.rules
|
||||
rm -f /lib/udev/console_init
|
||||
fi
|
||||
|
@@ -88,9 +88,11 @@ case $reason in
|
||||
echo "setup_net $netif"
|
||||
echo "source_hook initqueue/online $netif"
|
||||
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
|
||||
echo "> /tmp/setup_net_$netif.ok"
|
||||
echo "rm -f $hookdir/initqueue/setup_net_$netif.sh"
|
||||
} > $hookdir/initqueue/setup_net_$netif.sh
|
||||
|
||||
echo "[ -f /tmp/setup_net_$netif.ok ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
|
||||
>/tmp/net.$netif.up
|
||||
;;
|
||||
*) echo "dhcp: $reason";;
|
||||
|
@@ -7,15 +7,28 @@ if ! getarg ifname= >/dev/null ; then
|
||||
return
|
||||
fi
|
||||
|
||||
command -v parse_ifname_opts >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
{
|
||||
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"
|
||||
if [ -f /tmp/ifname-$ifname_mac ]; then
|
||||
read oldif < /tmp/ifname-$ifname_mac
|
||||
fi
|
||||
if [ -f /tmp/ifname-$ifname_if ]; then
|
||||
read oldmac < /tmp/ifname-$ifname_if
|
||||
fi
|
||||
if [ -n "$oldif" -a -n "$oldmac" -a "$oldif" = "$ifname_if" -a "$oldmac" = "$ifname_mac" ]; then
|
||||
# skip same ifname= declaration
|
||||
continue
|
||||
fi
|
||||
|
||||
[ -n "$oldif" ] && warn "Multiple interface names specified for MAC $ifname_mac: $oldif"
|
||||
[ -n "$oldmac" ] && warn "Multiple MAC specified for $ifname_if: $oldmac"
|
||||
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if"
|
||||
echo $ifname_if > /tmp/ifname-$ifname_mac
|
||||
echo $ifname_mac > /tmp/ifname-$ifname_if
|
||||
done
|
||||
} > /etc/udev/rules.d/50-ifname.rules
|
||||
} >> /etc/udev/rules.d/80-ifname.rules
|
||||
|
@@ -73,6 +73,7 @@ installkernel() {
|
||||
instmods bonding
|
||||
# vlan
|
||||
instmods 8021q
|
||||
instmods af_packet
|
||||
}
|
||||
|
||||
install() {
|
||||
|
@@ -54,7 +54,7 @@ fix_bootif() {
|
||||
|
||||
# Default: We don't know the interface to use, handle all
|
||||
else
|
||||
printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup" > /etc/udev/rules.d/61-default-net.rules
|
||||
printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup" > /etc/udev/rules.d/91-default-net.rules
|
||||
fi
|
||||
|
||||
} > /etc/udev/rules.d/60-net.rules
|
||||
} > /etc/udev/rules.d/90-net.rules
|
||||
|
@@ -289,3 +289,29 @@ ip_to_var() {
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
parse_ifname_opts() {
|
||||
local IFS=:
|
||||
set $1
|
||||
|
||||
case $# in
|
||||
7)
|
||||
ifname_if=$1
|
||||
# udev requires MAC addresses to be lower case
|
||||
ifname_mac=$(echo $2:$3:$4:$5:$6:$7 | sed 'y/ABCDEF/abcdef/')
|
||||
;;
|
||||
*)
|
||||
die "Invalid arguments for ifname="
|
||||
;;
|
||||
esac
|
||||
|
||||
case $ifname_if in
|
||||
eth[0-9]|eth[0-9][0-9]|eth[0-9][0-9][0-9]|eth[0-9][0-9][0-9][0-9])
|
||||
warn "ifname=$ifname_if uses the kernel name space for interfaces"
|
||||
warn "This can fail for multiple network interfaces and is discouraged!"
|
||||
warn "Please use a custom name like \"netboot\" or \"bluesocket\""
|
||||
warn "or use biosdevname and no ifname= at all."
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
@@ -18,21 +18,7 @@ if ! getarg ifname= >/dev/null ; then
|
||||
return
|
||||
fi
|
||||
|
||||
parse_ifname_opts() {
|
||||
local IFS=:
|
||||
set $1
|
||||
|
||||
case $# in
|
||||
7)
|
||||
ifname_if=$1
|
||||
# udev requires MAC addresses to be lower case
|
||||
ifname_mac=$(echo $2:$3:$4:$5:$6:$7 | sed 'y/ABCDEF/abcdef/')
|
||||
;;
|
||||
*)
|
||||
die "Invalid arguments for ifname="
|
||||
;;
|
||||
esac
|
||||
}
|
||||
command -v parse_ifname_opts >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
# Check ifname= lines
|
||||
for p in $(getargs ifname=); do
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if getargbool 1 rd.splash -n rd_NO_SPLASH; then
|
||||
if getargbool 1 rd.splash -d -n rd_NO_SPLASH; then
|
||||
info "Starting Gentoo Splash"
|
||||
|
||||
[ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
|
||||
|
@@ -65,7 +65,6 @@ installkernel() {
|
||||
|
||||
install() {
|
||||
if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \
|
||||
|| ! grep -q PLYMOUTH_POPULATE_SOURCE_FUNCTIONS /usr/libexec/plymouth/plymouth-populate-initrd \
|
||||
|| [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
|
||||
. "$moddir"/plymouth-populate-initrd.sh
|
||||
else
|
||||
|
@@ -2,6 +2,6 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if [ -x /bin/plymouth ]; then
|
||||
if [ -x /bin/plymouth -a -z "$DRACUT_SYSTEMD" ]; then
|
||||
/bin/plymouth --newroot=$NEWROOT
|
||||
fi
|
||||
|
@@ -2,8 +2,8 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if [ -x /bin/plymouthd ]; then
|
||||
if getargbool 1 plymouth.enable && getargbool 1 rd.plymouth -n rd_NO_PLYMOUTH; then
|
||||
if [ -x /bin/plymouthd -a -z "$DRACUT_SYSTEMD" ]; then
|
||||
if getargbool 1 plymouth.enable && getargbool 1 rd.plymouth -d -n rd_NO_PLYMOUTH; then
|
||||
# first trigger graphics subsystem
|
||||
udevadm trigger --action=add --attr-match=class=0x030000 >/dev/null 2>&1
|
||||
# first trigger graphics and tty subsystem
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
|
@@ -33,6 +33,7 @@ install() {
|
||||
inst_rules "$moddir/80-btrfs.rules"
|
||||
inst_script "$moddir/btrfs_finished.sh" /sbin/btrfs_finished
|
||||
inst_script "$moddir/btrfs_timeout.sh" /sbin/btrfs_timeout
|
||||
dracut_install btrfs btrfsck
|
||||
dracut_install btrfsck
|
||||
inst $(command -v btrfs) /sbin/btrfs
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# close everything which is not busy
|
||||
rm -f /etc/udev/rules.d/70-luks.rules >/dev/null 2>&1
|
||||
|
||||
if ! getarg rd.luks.uuid rd_LUKS_UUID >/dev/null 2>&1 && getargbool 1 rd.luks -n rd_NO_LUKS >/dev/null 2>&1; then
|
||||
if ! getarg rd.luks.uuid -d rd_LUKS_UUID >/dev/null 2>&1 && getargbool 1 rd.luks -d -n rd_NO_LUKS >/dev/null 2>&1; then
|
||||
while true; do
|
||||
local do_break="y"
|
||||
for i in /dev/mapper/luks-*; do
|
||||
|
@@ -165,8 +165,15 @@ readkey() {
|
||||
local keydev="$2"
|
||||
local device="$3"
|
||||
|
||||
local mntp=$(mkuniqdir /mnt keydev)
|
||||
mount -r "$keydev" "$mntp" || die 'Mounting rem. dev. failed!'
|
||||
# This creates a unique single mountpoint for *, or several for explicitly
|
||||
# given LUKS devices. It accomplishes unlocking multiple LUKS devices with
|
||||
# a single password entry.
|
||||
local mntp="/mnt/$(str_replace "keydev-$keydev-$keypath" '/' '-')"
|
||||
|
||||
if [ ! -d "$mntp" ]; then
|
||||
mkdir "$mntp"
|
||||
mount -r "$keydev" "$mntp" || die 'Mounting rem. dev. failed!'
|
||||
fi
|
||||
|
||||
case "${keypath##*.}" in
|
||||
gpg)
|
||||
@@ -177,9 +184,22 @@ readkey() {
|
||||
die "No GPG support to decrypt '$keypath' on '$keydev'."
|
||||
fi
|
||||
;;
|
||||
img)
|
||||
if [ -f /lib/dracut-crypt-loop-lib.sh ]; then
|
||||
. /lib/dracut-crypt-loop-lib.sh
|
||||
loop_decrypt "$mntp" "$keypath" "$keydev" "$device"
|
||||
initqueue --onetime --finished --unique --name "crypt-loop-cleanup-99-${mntp##*/}" \
|
||||
$(command -v umount) "$mntp; " $(command -v rmdir) "$mntp"
|
||||
return 0
|
||||
else
|
||||
die "No loop file support to decrypt '$keypath' on '$keydev'."
|
||||
fi
|
||||
;;
|
||||
*) cat "$mntp/$keypath" ;;
|
||||
esac
|
||||
|
||||
# General unmounting mechanism, modules doing custom cleanup should return earlier
|
||||
# and install a pre-pivot cleanup hook
|
||||
umount "$mntp"
|
||||
rmdir "$mntp"
|
||||
}
|
||||
|
18
modules.d/90crypt/crypt-run-generator.sh
Executable file
18
modules.d/90crypt/crypt-run-generator.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
dev=$1
|
||||
luks=$2
|
||||
|
||||
if [ -f /etc/crypttab ]; then
|
||||
while read l rest; do
|
||||
strstr "${l##luks-}" "${luks##luks-}" && exit 0
|
||||
done < /etc/crypttab
|
||||
fi
|
||||
|
||||
echo "$luks $dev" >> /etc/crypttab
|
||||
/lib/systemd/system-generators/systemd-cryptsetup-generator
|
||||
systemctl daemon-reload
|
||||
systemctl start cryptsetup.target
|
||||
exit 0
|
@@ -36,7 +36,7 @@ fi
|
||||
numtries=${3:-10}
|
||||
|
||||
# TODO: improve to support what cmdline does
|
||||
if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -n rd_NO_CRYPTTAB; then
|
||||
if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -d -n rd_NO_CRYPTTAB; then
|
||||
while read name dev luksfile luksoptions; do
|
||||
# ignore blank lines and comments
|
||||
if [ -z "$name" -o "${name#\#}" != "$name" ]; then
|
||||
|
@@ -49,5 +49,15 @@ install() {
|
||||
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
|
||||
inst_simple /etc/crypttab
|
||||
inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
|
||||
}
|
||||
|
||||
dracut_install -o \
|
||||
$systemdutildir/system-generators/systemd-cryptsetup-generator \
|
||||
$systemdutildir/system-generators/systemd-cryptsetup-generator \
|
||||
$systemdutildir/systemd-cryptsetup \
|
||||
$systemdsystemunitdir/systemd-ask-password-console.path \
|
||||
$systemdsystemunitdir/systemd-ask-password-console.service \
|
||||
$systemdsystemunitdir/cryptsetup.target \
|
||||
$systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \
|
||||
systemd-ask-password systemd-tty-ask-password-agent
|
||||
inst_script "$moddir"/crypt-run-generator.sh /sbin/crypt-run-generator
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
if ! getargbool 1 rd.luks -n rd_NO_LUKS; then
|
||||
|
||||
if ! getargbool 1 rd.luks -d -n rd_NO_LUKS; then
|
||||
info "rd.luks=0: removing cryptoluks activation"
|
||||
rm -f /etc/udev/rules.d/70-luks.rules
|
||||
else
|
||||
@@ -10,19 +11,31 @@ else
|
||||
echo 'ACTION!="add|change", GOTO="luks_end"'
|
||||
} > /etc/udev/rules.d/70-luks.rules.new
|
||||
|
||||
LUKS=$(getargs rd.luks.uuid rd_LUKS_UUID)
|
||||
LUKS=$(getargs rd.luks.uuid -d rd_LUKS_UUID)
|
||||
tout=$(getarg rd.luks.key.tout)
|
||||
|
||||
if [ -n "$LUKS" ]; then
|
||||
for luksid in $LUKS; do
|
||||
|
||||
luksid=${luksid##luks-}
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
||||
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
||||
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
|
||||
printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
|
||||
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
||||
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
||||
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
|
||||
printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
|
||||
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
else
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
||||
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
||||
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
|
||||
printf -- '--name crypt-run-generator-%%k %s ' $(command -v crypt-run-generator)
|
||||
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID}"\n'
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
fi
|
||||
|
||||
uuid=$luksid
|
||||
while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done
|
||||
@@ -35,11 +48,19 @@ else
|
||||
} >> $hookdir/emergency/90-crypt.sh
|
||||
done
|
||||
else
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
|
||||
printf -- '--unique --onetime --name cryptroot-ask-%%k '
|
||||
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $(command -v cryptroot-ask) $tout
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
|
||||
printf -- '--unique --onetime --name cryptroot-ask-%%k '
|
||||
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $(command -v cryptroot-ask) $tout
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
else
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
|
||||
printf -- '--unique --onetime --name crypt-run-generator-%%k '
|
||||
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $(command -v crypt-run-generator)
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
fi
|
||||
fi
|
||||
|
||||
echo 'LABEL="luks_end"' >> /etc/udev/rules.d/70-luks.rules.new
|
||||
|
@@ -4,6 +4,8 @@
|
||||
|
||||
SUBSYSTEM!="block", GOTO="dm_end"
|
||||
ACTION!="add|change", GOTO="dm_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="dm_end"
|
||||
|
||||
ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="dm_end"
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
DM_RAIDS=$(getargs rd.dm.uuid rd_DM_UUID=)
|
||||
DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=)
|
||||
|
||||
DM_CLEANUP="no"
|
||||
|
||||
|
@@ -51,7 +51,9 @@ depends() {
|
||||
|
||||
install() {
|
||||
local _i
|
||||
dracut_install dmraid partx kpartx
|
||||
dracut_install dmraid
|
||||
dracut_install -o kpartx
|
||||
inst $(command -v partx) /sbin/partx
|
||||
|
||||
inst "$moddir/dmraid.sh" /sbin/dmraid_scan
|
||||
|
||||
|
@@ -2,17 +2,17 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
# nodmraid for anaconda / rc.sysinit compatibility
|
||||
if ! getargbool 1 rd.dm -n rd_NO_DM || getarg nodmraid; then
|
||||
if ! getargbool 1 rd.dm -d -n rd_NO_DM || getarg "rd.dm=0" -d nodmraid; then
|
||||
info "rd.dm=0: removing DM RAID activation"
|
||||
udevproperty rd_NO_DM=1
|
||||
fi
|
||||
|
||||
if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.imsm -n rd_NO_MDIMSM || getarg noiswmd; then
|
||||
if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.imsm -d -n rd_NO_MDIMSM -n noiswmd; then
|
||||
info "rd.md.imsm=0: no MD RAID for imsm/isw raids"
|
||||
udevproperty rd_NO_MDIMSM=1
|
||||
fi
|
||||
|
||||
if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF || getarg noddfmd; then
|
||||
if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd; then
|
||||
info "rd.md.ddf=0: no MD RAID for SNIA ddf raids"
|
||||
udevproperty rd_NO_MDDDF=1
|
||||
fi
|
||||
|
@@ -6,7 +6,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
if getargbool 0 rd.live.debug -y rdlivedebug; then
|
||||
if getargbool 0 rd.live.debug -n -y rdlivedebug; then
|
||||
exec > /tmp/liveroot.$$.out
|
||||
exec 2>> /tmp/liveroot.$$.out
|
||||
set -x
|
||||
@@ -17,19 +17,19 @@ livedev="$1"
|
||||
|
||||
# parse various live image specific options that make sense to be
|
||||
# specified as their own things
|
||||
live_dir=$(getarg rd.live.dir live_dir)
|
||||
live_dir=$(getarg rd.live.dir -d live_dir)
|
||||
[ -z "$live_dir" ] && live_dir="LiveOS"
|
||||
getargbool 0 rd.live.ram -y live_ram && live_ram="yes"
|
||||
getargbool 0 rd.live.overlay.reset -y reset_overlay && reset_overlay="yes"
|
||||
getargbool 0 rd.live.overlay.readonly -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
|
||||
overlay=$(getarg rd.live.overlay overlay)
|
||||
getargbool 0 rd.live.ram -d -y live_ram && live_ram="yes"
|
||||
getargbool 0 rd.live.overlay.reset -d -y reset_overlay && reset_overlay="yes"
|
||||
getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
|
||||
overlay=$(getarg rd.live.overlay -d overlay)
|
||||
|
||||
# CD/DVD media check
|
||||
[ -b $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
|
||||
if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
|
||||
check="yes"
|
||||
fi
|
||||
getarg rd.live.check check || check=""
|
||||
getarg rd.live.check -d check || check=""
|
||||
if [ -n "$check" ]; then
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --hide-splash
|
||||
checkisomd5 --verbose $livedev
|
||||
@@ -167,7 +167,6 @@ if [ -e "$SQUASHED" ] ; then
|
||||
dd if=$SQUASHED of=/squashed.img bs=512 2> /dev/null
|
||||
umount -n /run/initramfs/live
|
||||
echo "Done copying live image to RAM."
|
||||
eject -p $livedev || :
|
||||
SQUASHED="/squashed.img"
|
||||
fi
|
||||
|
||||
|
@@ -21,7 +21,7 @@ installkernel() {
|
||||
|
||||
install() {
|
||||
dracut_install umount dmsetup blkid dd losetup grep blockdev
|
||||
dracut_install -o eject checkisomd5
|
||||
dracut_install -o checkisomd5
|
||||
inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
|
||||
inst_hook pre-udev 30 "$moddir/dmsquash-live-genrules.sh"
|
||||
inst_hook pre-udev 30 "$moddir/dmsquash-liveiso-genrules.sh"
|
||||
|
@@ -7,7 +7,7 @@
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
|
||||
# support legacy syntax of passing liveimg and then just the base root
|
||||
if getargbool 0 rd.live.image -y liveimg; then
|
||||
if getargbool 0 rd.live.image -d -y liveimg; then
|
||||
liveroot="live:$root"
|
||||
fi
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
for modlist in $(getargs rd.driver.post rdinsmodpost=); do
|
||||
for modlist in $(getargs rd.driver.post -d rdinsmodpost=); do
|
||||
(
|
||||
IFS=,
|
||||
for m in $modlist; do
|
||||
|
@@ -43,7 +43,7 @@ installkernel() {
|
||||
hostonly='' instmods sdhci_esdhc_imx mmci sdhci_tegra mvsdio omap omapdrm sdhci_dove ahci_platform pata_imx sata_mv
|
||||
|
||||
# install keyboard support
|
||||
hostonly='' instmods atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech hid-logitech-dj hid-microsoft ehci-hcd ohci-hcd uhci-hcd xhci-hcd
|
||||
hostonly='' instmods atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech hid-logitech-dj hid-microsoft ehci-hcd ohci-hcd uhci-hcd xhci-hcd hid_generic
|
||||
# install unix socket support
|
||||
hostonly='' instmods unix
|
||||
instmods "=drivers/pcmcia" =ide "=drivers/usb/storage"
|
||||
@@ -61,23 +61,12 @@ installkernel() {
|
||||
}
|
||||
for_each_host_dev_fs inst_fs
|
||||
fi
|
||||
else
|
||||
hostonly='' instmods $drivers
|
||||
fi
|
||||
|
||||
if [[ $add_drivers ]]; then
|
||||
hostonly='' instmods -c $add_drivers || return 1
|
||||
fi
|
||||
if [[ $filesystems ]]; then
|
||||
hostonly='' instmods -c $filesystems || return 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
install() {
|
||||
local _f i
|
||||
[ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf
|
||||
dracut_install $(find -L /etc/modprobe.d/ -maxdepth 1 -type f -name '*.conf')
|
||||
dracut_install -o /{etc,lib}/modprobe.d/*.conf
|
||||
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
|
||||
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
for i in $(getargs rd.driver.pre rdloaddriver=); do
|
||||
for i in $(getargs rd.driver.pre -d rdloaddriver=); do
|
||||
(
|
||||
IFS=,
|
||||
for p in $i; do
|
||||
@@ -11,7 +11,7 @@ for i in $(getargs rd.driver.pre rdloaddriver=); do
|
||||
)
|
||||
done
|
||||
|
||||
for i in $(getargs rd.driver.blacklist rdblacklist=); do
|
||||
for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
|
||||
(
|
||||
IFS=,
|
||||
for p in $i; do
|
||||
@@ -20,7 +20,7 @@ for i in $(getargs rd.driver.blacklist rdblacklist=); do
|
||||
)
|
||||
done
|
||||
|
||||
for p in $(getargs rd.driver.post rdinsmodpost=); do
|
||||
for p in $(getargs rd.driver.post -d rdinsmodpost=); do
|
||||
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
|
||||
_do_insmodpost=1
|
||||
done
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# fetch-liveupdate - fetch an update image for dmsquash-live media.
|
||||
# this gets called by the "initqueue/online" hook for each network interface
|
||||
# that comes online.
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
# livenetroot - fetch a live image from the network and run it
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
@@ -6,7 +6,7 @@ check() {
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo network url-lib dmsquash-live
|
||||
echo network url-lib dmsquash-live img-lib
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@@ -6,6 +6,8 @@
|
||||
|
||||
SUBSYSTEM!="block", GOTO="lvm_end"
|
||||
ACTION!="add|change", GOTO="lvm_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="lvm_end"
|
||||
KERNEL=="dm-[0-9]*", ACTION=="add", GOTO="lvm_end"
|
||||
ENV{ID_FS_TYPE}!="LVM?_member", GOTO="lvm_end"
|
||||
|
||||
|
@@ -7,10 +7,10 @@
|
||||
extraargs="$@"
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
VGS=$(getargs rd.lvm.vg rd_LVM_VG=)
|
||||
LVS=$(getargs rd.lvm.lv rd_LVM_LV=)
|
||||
SNAPSHOT=$(getargs rd.lvm.snapshot rd_LVM_SNAPSHOT=)
|
||||
SNAPSIZE=$(getargs rd.lvm.snapsize rd_LVM_SNAPSIZE=)
|
||||
VGS=$(getargs rd.lvm.vg -d rd_LVM_VG=)
|
||||
LVS=$(getargs rd.lvm.lv -d rd_LVM_LV=)
|
||||
SNAPSHOT=$(getargs rd.lvm.snapshot -d rd_LVM_SNAPSHOT=)
|
||||
SNAPSIZE=$(getargs rd.lvm.snapsize -d rd_LVM_SNAPSIZE=)
|
||||
|
||||
[ -d /etc/lvm ] || mkdir -m 0755 -p /etc/lvm
|
||||
# build a list of devices to scan
|
||||
@@ -129,4 +129,6 @@ if [ "$lvmwritten" ]; then
|
||||
fi
|
||||
unset lvmwritten
|
||||
|
||||
udevadm settle
|
||||
|
||||
need_shutdown
|
||||
|
@@ -1,15 +1,15 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
if [ -e /etc/lvm/lvm.conf ] && ! getargbool 1 rd.lvm.conf -n rd_NO_LVMCONF; then
|
||||
if [ -e /etc/lvm/lvm.conf ] && ! getargbool 1 rd.lvm.conf -d -n rd_NO_LVMCONF; then
|
||||
rm -f /etc/lvm/lvm.conf
|
||||
fi
|
||||
|
||||
if ! getargbool 1 rd.lvm -n rd_NO_LVM; then
|
||||
if ! getargbool 1 rd.lvm -d -n rd_NO_LVM; then
|
||||
info "rd.lvm=0: removing LVM activation"
|
||||
rm -f /etc/udev/rules.d/64-lvm*.rules
|
||||
else
|
||||
for dev in $(getargs rd.lvm.vg rd_LVM_VG=) $(getargs rd.lvm.lv rd_LVM_LV=); do
|
||||
for dev in $(getargs rd.lvm.vg -d rd_LVM_VG=) $(getargs rd.lvm.lv -d rd_LVM_LV=); do
|
||||
wait_for_dev "/dev/$dev"
|
||||
done
|
||||
fi
|
||||
|
@@ -6,6 +6,8 @@ ACTION!="add|change", GOTO="md_end"
|
||||
SUBSYSTEM!="block", GOTO="md_end"
|
||||
ENV{rd_NO_MD}=="?*", GOTO="md_end"
|
||||
KERNEL=="md*", GOTO="md_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="md_end"
|
||||
|
||||
ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_raid_member", GOTO="md_try"
|
||||
GOTO="md_end"
|
||||
|
@@ -43,8 +43,10 @@ installkernel() {
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install mdadm partx cat
|
||||
dracut_install cat
|
||||
dracut_install -o mdmon
|
||||
inst $(command -v partx) /sbin/partx
|
||||
inst $(command -v mdadm) /sbin/mdadm
|
||||
|
||||
# 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)
|
||||
|
@@ -1,11 +1,11 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
if ! getargbool 1 rd.md -n rd_NO_MD; then
|
||||
if ! getargbool 1 rd.md -d -n rd_NO_MD; then
|
||||
info "rd.md=0: removing MD RAID activation"
|
||||
udevproperty rd_NO_MD=1
|
||||
else
|
||||
MD_UUID=$(getargs rd.md.uuid rd_MD_UUID=)
|
||||
MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
|
||||
|
||||
# rewrite the md rules to only process the specified raid array
|
||||
if [ -n "$MD_UUID" ]; then
|
||||
@@ -29,25 +29,25 @@ else
|
||||
fi
|
||||
|
||||
|
||||
if [ -e /etc/mdadm.conf ] && getargbool 1 rd.md.conf -n rd_NO_MDADMCONF; then
|
||||
if [ -e /etc/mdadm.conf ] && getargbool 1 rd.md.conf -d -n rd_NO_MDADMCONF; then
|
||||
udevproperty rd_MDADMCONF=1
|
||||
rm -f $hookdir/pre-pivot/*mdraid-cleanup.sh
|
||||
fi
|
||||
|
||||
if ! getargbool 1 rd.md.conf -n rd_NO_MDADMCONF; then
|
||||
if ! getargbool 1 rd.md.conf -d -n rd_NO_MDADMCONF; then
|
||||
rm -f /etc/mdadm/mdadm.conf /etc/mdadm.conf
|
||||
ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
|
||||
fi
|
||||
|
||||
# noiswmd nodmraid for anaconda / rc.sysinit compatibility
|
||||
# note nodmraid really means nobiosraid, so we don't want MDIMSM then either
|
||||
if ! getargbool 1 rd.md.imsm -n rd_NO_MDIMSM || getarg noiswmd || getarg nodmraid; then
|
||||
if ! getargbool 1 rd.md.imsm -d -n rd_NO_MDIMSM -n noiswmd -n nodmraid; then
|
||||
info "no MD RAID for imsm/isw raids"
|
||||
udevproperty rd_NO_MDIMSM=1
|
||||
fi
|
||||
|
||||
# same thing with ddf containers
|
||||
if ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF || getarg noddfmd || getarg nodmraid; then
|
||||
if ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd -n nodmraid; then
|
||||
info "no MD RAID for SNIA ddf raids"
|
||||
udevproperty rd_NO_MDDDF=1
|
||||
fi
|
||||
|
@@ -11,7 +11,7 @@ check() {
|
||||
local _dev
|
||||
_dev=$(get_maj_min $1)
|
||||
[ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
|
||||
[[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ ^mpath- ]] && return 0
|
||||
[[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ check() {
|
||||
|
||||
depends() {
|
||||
echo rootfs-block
|
||||
echo dm
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -70,21 +71,23 @@ installkernel() {
|
||||
install() {
|
||||
local _f
|
||||
dracut_install -o \
|
||||
/sbin/dmsetup \
|
||||
/sbin/kpartx \
|
||||
/sbin/mpath_wait \
|
||||
/sbin/multipath \
|
||||
/sbin/multipathd \
|
||||
/sbin/xdrgetuid \
|
||||
/sbin/xdrgetprio \
|
||||
dmsetup \
|
||||
kpartx \
|
||||
mpath_wait \
|
||||
multipath \
|
||||
multipathd \
|
||||
xdrgetuid \
|
||||
xdrgetprio \
|
||||
/etc/xdrdevices.conf \
|
||||
/etc/multipath.conf \
|
||||
/etc/multipath/*
|
||||
|
||||
inst $(command -v partx) /sbin/partx
|
||||
|
||||
inst_libdir_file "libmultipath*" "multipath/*"
|
||||
|
||||
inst_hook pre-trigger 02 "$moddir/multipathd.sh"
|
||||
inst_hook cleanup 02 "$moddir/multipathd-stop.sh"
|
||||
inst_rules 40-multipath.rules
|
||||
inst_rules 40-multipath.rules 62-multipath.rules 65-multipath.rules 66-kpartx.rules
|
||||
}
|
||||
|
||||
|
@@ -3,10 +3,21 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
vm=$(systemd-detect-virt --vm &>/dev/null)
|
||||
(($? != 0)) && return 255
|
||||
[[ $vm = "qemu" ]] && return 0
|
||||
[[ $vm = "kvm" ]] && return 0
|
||||
if type -P systemd-detect-virt &>/dev/null; then
|
||||
vm=$(systemd-detect-virt --vm &>/dev/null)
|
||||
(($? != 0)) && return 255
|
||||
[[ $vm = "qemu" ]] && return 0
|
||||
[[ $vm = "kvm" ]] && return 0
|
||||
[[ $vm = "bochs" ]] && return 0
|
||||
fi
|
||||
|
||||
for i in /sys/class/dmi/id/*_vendor; do
|
||||
[[ -f $i ]] || continue
|
||||
read vendor < $i
|
||||
[[ "$vendor" == "QEMU" ]] && return 0
|
||||
[[ "$vendor" == "Bochs" ]] && return 0
|
||||
done
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
|
@@ -3,10 +3,20 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
vm=$(systemd-detect-virt --vm &>/dev/null)
|
||||
(($? != 0)) && return 255
|
||||
[[ $vm = "qemu" ]] && return 0
|
||||
[[ $vm = "kvm" ]] && return 0
|
||||
if type -P systemd-detect-virt &>/dev/null; then
|
||||
vm=$(systemd-detect-virt --vm &>/dev/null)
|
||||
(($? != 0)) && return 255
|
||||
[[ $vm = "qemu" ]] && return 0
|
||||
[[ $vm = "kvm" ]] && return 0
|
||||
[[ $vm = "bochs" ]] && return 0
|
||||
fi
|
||||
|
||||
for i in /sys/class/dmi/id/*_vendor; do
|
||||
[[ -f $i ]] || continue
|
||||
read vendor < $i
|
||||
[[ "$vendor" == "QEMU" ]] && return 0
|
||||
[[ "$vendor" == "Bochs" ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
|
||||
|
45
modules.d/91crypt-loop/crypt-loop-lib.sh
Normal file
45
modules.d/91crypt-loop/crypt-loop-lib.sh
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=4 sw=4 sts=0 et filetype=sh
|
||||
|
||||
command -v ask_for_password >/dev/null || . /lib/dracut-crypt-lib.sh
|
||||
|
||||
# loop_decrypt mnt_point keypath keydev device
|
||||
#
|
||||
# Decrypts symmetrically encrypted key to standard output.
|
||||
#
|
||||
# mnt_point - mount point where <keydev> is already mounted
|
||||
# keypath - LUKS encrypted loop file path relative to <mnt_point>
|
||||
# keydev - device on which key resides; only to display in prompt
|
||||
# device - device to be opened by cryptsetup; only to display in prompt
|
||||
loop_decrypt() {
|
||||
local mntp="$1"
|
||||
local keypath="$2"
|
||||
local keydev="$3"
|
||||
local device="$4"
|
||||
|
||||
local key="/dev/mapper/${mntp##*/}"
|
||||
|
||||
if [ ! -b $key ]; then
|
||||
info "Keyfile has .img suffix, treating it as LUKS-encrypted loop keyfile container to unlock $device"
|
||||
|
||||
local loopdev=$(losetup -f "${mntp}/${keypath}" --show)
|
||||
local opts="-d - luksOpen $loopdev ${key##*/}"
|
||||
|
||||
ask_for_password \
|
||||
--cmd "cryptsetup $opts" \
|
||||
--prompt "Password ($keypath on $keydev for $device)" \
|
||||
--tty-echo-off
|
||||
|
||||
[ -b $key ] || die "Tried setting it up, but keyfile block device was still not found!"
|
||||
|
||||
initqueue --onetime --finished --unique --name "crypt-loop-cleanup-10-${key##*/}" \
|
||||
$(command -v cryptsetup) "luksClose $key"
|
||||
initqueue --onetime --finished --unique --name "crypt-loop-cleanup-20-${loopdev##*/}" \
|
||||
$(command -v losetup) "-d $loopdev"
|
||||
else
|
||||
info "Existing keyfile found, re-using it for $device"
|
||||
fi
|
||||
|
||||
cat $key
|
||||
}
|
14
modules.d/91crypt-loop/module-setup.sh
Normal file
14
modules.d/91crypt-loop/module-setup.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
check() {
|
||||
type -P losetup >/dev/null || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo crypt
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install losetup
|
||||
inst "$moddir/crypt-loop-lib.sh" "/lib/dracut-crypt-loop-lib.sh"
|
||||
}
|
36
modules.d/95cifs/cifs-lib.sh
Executable file
36
modules.d/95cifs/cifs-lib.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# cifs_to_var CIFSROOT
|
||||
# use CIFSROOT to set $server, $path, and $options.
|
||||
# CIFSROOT is something like: cifs://[<username>[:<password>]]@<host>/<path>
|
||||
# NETIF is used to get information from DHCP options, if needed.
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
cifs_to_var() {
|
||||
local cifsuser; local cifspass
|
||||
# Check required arguments
|
||||
server=${1##cifs://}
|
||||
cifsuser=${server%@*}
|
||||
cifspass=${cifsuser#*:}
|
||||
if [ "$cifspass" != "$cifsuser" ]; then
|
||||
cifsuser=${cifsuser%:*}
|
||||
else
|
||||
cifspass=$(getarg cifspass)
|
||||
fi
|
||||
if [ "$cifsuser" != "$server" ]; then
|
||||
server="${server#*@}"
|
||||
else
|
||||
cifsuser=$(getarg cifsuser)
|
||||
fi
|
||||
|
||||
path=${server#*/}
|
||||
server=${server%/*}
|
||||
|
||||
if [ ! "$cifsuser" -o ! "$cifspass" ]; then
|
||||
die "For CIFS support you need to specify a cifsuser and cifspass either in the cifsuser and cifspass commandline parameters or in the root= CIFS URL."
|
||||
fi
|
||||
options="user=$cifsuser,pass=$cifspass"
|
||||
}
|
26
modules.d/95cifs/cifsroot.sh
Executable file
26
modules.d/95cifs/cifsroot.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
. /lib/cifs-lib.sh
|
||||
|
||||
[ "$#" = 3 ] || exit 1
|
||||
|
||||
# root is in the form root=cifs://user:pass@[server]/[folder] either from
|
||||
# cmdline or dhcp root-path
|
||||
netif="$1"
|
||||
root="$2"
|
||||
NEWROOT="$3"
|
||||
|
||||
cifs_to_var $root
|
||||
echo server: $server
|
||||
echo path: $path
|
||||
echo options: $options
|
||||
|
||||
mount.cifs //$server/$path $NEWROOT -o $options && { [ -e /dev/root ] || >/dev/root ; }
|
||||
|
||||
# inject new exit_if_exists
|
||||
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/cifs.sh
|
||||
# force udevsettle to break
|
||||
> $hookdir/initqueue/work
|
46
modules.d/95cifs/module-setup.sh
Executable file
46
modules.d/95cifs/module-setup.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
# If our prerequisites are not met, fail anyways.
|
||||
type -P mount.cifs >/dev/null || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in ${host_fs_types[@]}; do
|
||||
strstr "$fs" "\|cifs" && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
depends() {
|
||||
# We depend on network modules being loaded
|
||||
echo network
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods cifs ipv6
|
||||
}
|
||||
|
||||
install() {
|
||||
local _i
|
||||
local _nsslibs
|
||||
dracut_install -o mount.cifs
|
||||
dracut_install /etc/services /etc/nsswitch.conf /etc/protocols
|
||||
|
||||
inst_libdir_file 'libcap-ng.so*'
|
||||
|
||||
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
|
||||
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
|
||||
_nsslibs=${_nsslibs#|}
|
||||
_nsslibs=${_nsslibs%|}
|
||||
|
||||
inst_libdir_file -n "$_nsslibs" 'libnss*.so*'
|
||||
|
||||
inst_hook cmdline 90 "$moddir/parse-cifsroot.sh"
|
||||
inst "$moddir/cifsroot.sh" "/sbin/cifsroot"
|
||||
inst "$moddir/cifs-lib.sh" "/lib/cifs-lib.sh"
|
||||
}
|
52
modules.d/95cifs/parse-cifsroot.sh
Executable file
52
modules.d/95cifs/parse-cifsroot.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# root=cifs://[user:pass@]<server>/<folder>
|
||||
#
|
||||
# This syntax can come from DHCP root-path as well.
|
||||
#
|
||||
# If a username or password are not specified as part of the root, then they
|
||||
# will be pulled from cifsuser and cifspass on the kernel command line,
|
||||
# respectively.
|
||||
#
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
. /lib/cifs-lib.sh
|
||||
|
||||
#Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
|
||||
# This script is sourced, so root should be set. But let's be paranoid
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
[ -z "$netroot" ] && netroot=$(getarg netroot=)
|
||||
|
||||
# Root takes precedence over netroot
|
||||
if [ "${root%%:*}" = "cifs" ] ; then
|
||||
|
||||
# Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
|
||||
if [ -n "$netroot" ] ; then
|
||||
warn "root takes precedence over netroot. Ignoring netroot"
|
||||
|
||||
fi
|
||||
netroot=$root
|
||||
unset root
|
||||
fi
|
||||
|
||||
# If it's not cifs we don't continue
|
||||
[ "${netroot%%:*}" = "cifs" ] || return
|
||||
|
||||
# Check required arguments
|
||||
cifs_to_var $netroot
|
||||
|
||||
# If we don't have a server, we need dhcp
|
||||
if [ -z "$server" ] ; then
|
||||
DHCPORSERVER="1"
|
||||
fi;
|
||||
|
||||
# Done, all good!
|
||||
rootok=1
|
||||
|
||||
echo '[ -e $NEWROOT/proc ]' > $hookdir/initqueue/finished/cifsroot.sh
|
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
for dasd_arg in $(getargs rd.dasd= rd_DASD= DASD=); do
|
||||
for dasd_arg in $(getargs rd.dasd= -d rd_DASD= DASD=); do
|
||||
(
|
||||
IFS=","
|
||||
set $dasd_arg
|
||||
|
@@ -3,7 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
mod_args=""
|
||||
|
||||
for dasd_arg in $(getargs rd.dasd= rd_DASD= DASD=); do
|
||||
for dasd_arg in $(getargs rd.dasd= -d rd_DASD= DASD=); do
|
||||
mod_args="$mod_args,$dasd_arg"
|
||||
done
|
||||
|
||||
|
@@ -13,4 +13,4 @@
|
||||
else
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/initqueue --onetime --unique --name fcoe-up-$env{INTERFACE} /sbin/fcoe-up $env{INTERFACE} %s"\n' "$fcoe_interface" "$fcoe_dcb"
|
||||
fi
|
||||
} > /etc/udev/rules.d/60-fcoe.rules
|
||||
} > /etc/udev/rules.d/92-fcoe.rules
|
||||
|
@@ -11,6 +11,7 @@ fstab_mount() {
|
||||
info "Mounting from $1"
|
||||
while read _dev _mp _fs _opts _dump _pass _rest; do
|
||||
[ -z "${_dev%%#*}" ] && continue # Skip comment lines
|
||||
ismounted $_mp && continue # Skip mounted filesystem
|
||||
if [ "$_pass" -gt 0 ] && ! strstr "$_opts" _netdev; then
|
||||
fsck_single "$_dev" "$_fs" "$_opts"
|
||||
fi
|
||||
|
@@ -27,8 +27,6 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
netif="$1"
|
||||
iroot="$2"
|
||||
|
||||
source_all /etc/conf.d
|
||||
|
||||
# If it's not iscsi we don't continue
|
||||
[ "${iroot%%:*}" = "iscsi" ] || exit 1
|
||||
|
||||
@@ -40,14 +38,14 @@ modprobe crc32c 2>/dev/null
|
||||
|
||||
[ -e /sys/module/bnx2i ] && iscsiuio
|
||||
|
||||
if getargbool 0 rd.iscsi.firmware -y iscsi_firmware ; then
|
||||
if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
|
||||
if [ -z "$root" -o -n "${root%%block:*}" ]; then
|
||||
# if root is not specified try to mount the whole iSCSI LUN
|
||||
printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
|
||||
udevadm control --reload
|
||||
fi
|
||||
|
||||
for p in $(getargs rd.iscsi.param iscsi_param); do
|
||||
for p in $(getargs rd.iscsi.param -d iscsi_param); do
|
||||
iscsi_param="$iscsi_param --param $p"
|
||||
done
|
||||
|
||||
@@ -66,25 +64,25 @@ handle_netroot()
|
||||
local p
|
||||
|
||||
# override conf settings by command line options
|
||||
arg=$(getargs rd.iscsi.initiator iscsi_initiator=)
|
||||
arg=$(getargs rd.iscsi.initiator -d iscsi_initiator=)
|
||||
[ -n "$arg" ] && iscsi_initiator=$arg
|
||||
arg=$(getargs rd.iscsi.target.name iscsi_target_name=)
|
||||
arg=$(getargs rd.iscsi.target.name -d iscsi_target_name=)
|
||||
[ -n "$arg" ] && iscsi_target_name=$arg
|
||||
arg=$(getargs rd.iscsi.target.ip iscsi_target_ip)
|
||||
arg=$(getargs rd.iscsi.target.ip -d iscsi_target_ip)
|
||||
[ -n "$arg" ] && iscsi_target_ip=$arg
|
||||
arg=$(getargs rd.iscsi.target.port iscsi_target_port=)
|
||||
arg=$(getargs rd.iscsi.target.port -d iscsi_target_port=)
|
||||
[ -n "$arg" ] && iscsi_target_port=$arg
|
||||
arg=$(getargs rd.iscsi.target.group iscsi_target_group=)
|
||||
arg=$(getargs rd.iscsi.target.group -d iscsi_target_group=)
|
||||
[ -n "$arg" ] && iscsi_target_group=$arg
|
||||
arg=$(getargs rd.iscsi.username iscsi_username=)
|
||||
arg=$(getargs rd.iscsi.username -d iscsi_username=)
|
||||
[ -n "$arg" ] && iscsi_username=$arg
|
||||
arg=$(getargs rd.iscsi.password iscsi_password)
|
||||
arg=$(getargs rd.iscsi.password -d iscsi_password)
|
||||
[ -n "$arg" ] && iscsi_password=$arg
|
||||
arg=$(getargs rd.iscsi.in.username iscsi_in_username=)
|
||||
arg=$(getargs rd.iscsi.in.username -d iscsi_in_username=)
|
||||
[ -n "$arg" ] && iscsi_in_username=$arg
|
||||
arg=$(getargs rd.iscsi.in.password iscsi_in_password=)
|
||||
arg=$(getargs rd.iscsi.in.password -d iscsi_in_password=)
|
||||
[ -n "$arg" ] && iscsi_in_password=$arg
|
||||
for p in $(getargs rd.iscsi.param iscsi_param); do
|
||||
for p in $(getargs rd.iscsi.param -d iscsi_param); do
|
||||
iscsi_param="$iscsi_param --param $p"
|
||||
done
|
||||
|
||||
@@ -130,7 +128,7 @@ handle_netroot()
|
||||
fi
|
||||
|
||||
echo "InitiatorName='$iscsi_initiator'" > /run/initiatorname.iscsi
|
||||
ln -s /run/initiatorname.iscsi /dev/.initiatorname.iscsi
|
||||
ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi
|
||||
|
||||
# FIXME $iscsi_protocol??
|
||||
|
||||
|
@@ -35,6 +35,12 @@ install() {
|
||||
mount.nfs4 umount rpc.idmapd sed /etc/netconfig
|
||||
dracut_install /etc/services /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/idmapd.conf
|
||||
|
||||
if [ -f /lib/modprobe.d/nfs.conf ]; then
|
||||
dracut_install /lib/modprobe.d/nfs.conf
|
||||
else
|
||||
echo "alias nfs4 nfs" > $initdir/etc/modprobe.d/nfs.conf
|
||||
fi
|
||||
|
||||
inst_libdir_file 'libnfsidmap_nsswitch.so*' 'libnfsidmap/*.so' 'libnfsidmap*.so*'
|
||||
|
||||
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
|
||||
@@ -65,6 +71,8 @@ install() {
|
||||
# rpc user needs to be able to write to this directory to save the warmstart
|
||||
# file
|
||||
chmod 770 "$initdir/var/lib/rpcbind"
|
||||
chown rpc.rpc "$initdir/var/lib/rpcbind"
|
||||
egrep -q '^rpc:' /etc/passwd \
|
||||
&& egrep -q '^rpc:' /etc/group \
|
||||
&& chown rpc.rpc "$initdir/var/lib/rpcbind"
|
||||
}
|
||||
|
||||
|
@@ -72,7 +72,7 @@ esac
|
||||
|
||||
# Check required arguments
|
||||
|
||||
if nfsdomain=$(getarg rd.nfs.domain rd_NFS_DOMAIN); then
|
||||
if nfsdomain=$(getarg rd.nfs.domain -d rd_NFS_DOMAIN); then
|
||||
if [ -f /etc/idmapd.conf ]; then
|
||||
sed -i -e \
|
||||
"s/^[[:space:]#]*Domain[[:space:]]*=.*/Domain = $nfsdomain/g" \
|
||||
@@ -88,13 +88,6 @@ nfsroot_to_var $netroot
|
||||
# Set fstype, might help somewhere
|
||||
fstype=${nfs#/dev/}
|
||||
|
||||
# NFS actually supported? Some more uglyness here: nfs3 or nfs4 might not
|
||||
# be in the module...
|
||||
if ! incol2 /proc/filesystems $fstype ; then
|
||||
modprobe nfs
|
||||
incol2 /proc/filesystems $fstype || die "nfsroot type $fstype requested but kernel/initrd does not support nfs"
|
||||
fi
|
||||
|
||||
# Rewrite root so we don't have to parse this uglyness later on again
|
||||
netroot="$fstype:$server:$path:$options"
|
||||
|
||||
|
@@ -15,6 +15,8 @@ case "$resume" in
|
||||
resume="/dev/disk/by-label/${resume#LABEL=}" ;;
|
||||
UUID=*) \
|
||||
resume="/dev/disk/by-uuid/${resume#UUID=}" ;;
|
||||
PARTUUID=*) \
|
||||
resume="/dev/disk/by-partuuid/${resume#PARTUUID=}" ;;
|
||||
esac
|
||||
|
||||
if splash=$(getarg splash=); then
|
||||
|
@@ -21,18 +21,18 @@ if [ -n "$resume" ]; then
|
||||
|
||||
{
|
||||
if [ -x /usr/sbin/resume ]; then
|
||||
printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/usr/sbin/resume %s '%s'\"\n" \
|
||||
printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \
|
||||
${resume#/dev/} "$a_splash" "$resume";
|
||||
printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/usr/sbin/resume %s '%s'\"\n" \
|
||||
printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \
|
||||
${resume#/dev/} "$a_splash" "$resume";
|
||||
fi
|
||||
printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/bin/sh -c 'echo %%M:%%m > /sys/power/resume'\"\n" \
|
||||
printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %%M:%%m > /sys/power/resume\"\n" \
|
||||
${resume#/dev/};
|
||||
printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/bin/sh -c 'echo %%M:%%m > /sys/power/resume'\"\n" \
|
||||
printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %%M:%%m > /sys/power/resume\"\n" \
|
||||
${resume#/dev/};
|
||||
} >> /etc/udev/rules.d/99-resume.rules
|
||||
|
||||
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm "$job"; }\n' \
|
||||
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm "$job"; udevadm settle; }\n' \
|
||||
"$resume" "$resume" >> $hookdir/initqueue/settled/resume.sh
|
||||
|
||||
printf 'warn "Cancelling resume operation. Device not found."; cancel_wait_for_dev /dev/resume; rm "$job" "%s/initqueue/settled/resume.sh";' \
|
||||
@@ -43,9 +43,9 @@ if [ -n "$resume" ]; then
|
||||
elif ! getarg noresume; then
|
||||
{
|
||||
if [ -x /usr/sbin/resume ]; then
|
||||
printf "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/usr/sbin/resume %s '\$tempnode'\"\n" "$a_splash"
|
||||
printf "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \$tempnode\"\n" "$a_splash"
|
||||
fi
|
||||
echo "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\"," \
|
||||
" RUN+=\"/bin/sh -c 'echo %M:%m > /sys/power/resume'\"";
|
||||
" RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %M:%m > /sys/power/resume\"";
|
||||
} >> /etc/udev/rules.d/99-resume.rules
|
||||
fi
|
||||
|
@@ -13,22 +13,22 @@ if [ "${root%%:*}" = "block" ]; then
|
||||
printf '[ -e "%s" ] && { ln -s "%s" /dev/root 2>/dev/null; rm "$job"; }\n' \
|
||||
"${root#block:}" "${root#block:}" > $hookdir/initqueue/settled/blocksymlink.sh
|
||||
|
||||
if [ -d /lib/systemd/system/ ]; then
|
||||
echo "${root#block:} $NEWROOT ${fstype:-auto} ${rflags:-defaults} 1 1" >> /etc/fstab
|
||||
{
|
||||
echo '[Unit]'
|
||||
echo 'Description=New Root File System'
|
||||
echo 'DefaultDependencies=no'
|
||||
echo 'Before=switch-root.service'
|
||||
echo '[Mount]'
|
||||
echo "What=${root#block:}"
|
||||
echo "Where=$NEWROOT"
|
||||
# if [ -d /lib/systemd/system/ ]; then
|
||||
# echo "${root#block:} $NEWROOT ${fstype:-auto} ${rflags:-defaults} 1 1" >> /etc/fstab
|
||||
# {
|
||||
# echo '[Unit]'
|
||||
# echo 'Description=New Root File System'
|
||||
# echo 'DefaultDependencies=no'
|
||||
# echo 'Before=initrd-switch-root.service'
|
||||
# echo '[Mount]'
|
||||
# echo "What=${root#block:}"
|
||||
# echo "Where=$NEWROOT"
|
||||
|
||||
} >/lib/systemd/system/${NEWROOT#/}.mount
|
||||
# } >/lib/systemd/system/${NEWROOT#/}.mount
|
||||
|
||||
mkdir -p /lib/systemd/system/switch-root.target.wants
|
||||
ln -s ../${NEWROOT#/}.mount /lib/systemd/system/switch-root.target.wants/${NEWROOT#/}.mount
|
||||
fi
|
||||
# mkdir -p /lib/systemd/system/initrd-switch-root.target.requires
|
||||
# ln -s ../${NEWROOT#/}.mount /lib/systemd/system/initrd-switch-root.target.requires/${NEWROOT#/}.mount
|
||||
# fi
|
||||
|
||||
wait_for_dev "${root#block:}"
|
||||
fi
|
||||
|
@@ -2,6 +2,30 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
rootopts="defaults"
|
||||
while read dev mp fs opts dump fsck; do
|
||||
# skip comments
|
||||
[ "${dev%%#*}" != "$dev" ] && continue
|
||||
|
||||
if [ "$mp" = "/" ]; then
|
||||
# sanity - determine/fix fstype
|
||||
rootfs=$(find_mp_fstype /)
|
||||
rootfs=${rootfs:-$fs}
|
||||
rootopts=$opts
|
||||
break
|
||||
fi
|
||||
done < "$NEWROOT/etc/fstab"
|
||||
|
||||
[ "$rootfs" = "reiserfs" ] && journaldev=$(fs_get_option $rootopts "jdev")
|
||||
[ "$rootfs" = "xfs" ] && journaldev=$(fs_get_option $rootopts "logdev")
|
||||
if [ -n "$journaldev" ]; then
|
||||
echo "root.journaldev=$journaldev" >> "${initdir}/etc/cmdline.d/95root-jurnaldev.conf"
|
||||
fi
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo fs-lib
|
||||
}
|
||||
|
@@ -5,32 +5,32 @@
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
type det_fs >/dev/null 2>&1 || . /lib/fs-lib.sh
|
||||
|
||||
filter_rootopts() {
|
||||
rootopts=$1
|
||||
# strip ro and rw options
|
||||
local OLDIFS="$IFS"
|
||||
IFS=,
|
||||
set -- $rootopts
|
||||
IFS="$OLDIFS"
|
||||
local v
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
rw|ro);;
|
||||
defaults);;
|
||||
*)
|
||||
v="$v,${1}";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
rootopts=${v#,}
|
||||
echo $rootopts
|
||||
}
|
||||
|
||||
mount_root() {
|
||||
local _ret
|
||||
local _rflags_ro
|
||||
# sanity - determine/fix fstype
|
||||
rootfs=$(det_fs "${root#block:}" "$fstype")
|
||||
mount -t ${rootfs} -o "$rflags",ro "${root#block:}" "$NEWROOT"
|
||||
|
||||
journaldev=$(getarg "root.journaldev=")
|
||||
if [ -n "$journaldev" ]; then
|
||||
case "$rootfs" in
|
||||
xfs)
|
||||
rflags="${rflags:+${rflags},}logdev=$journaldev"
|
||||
;;
|
||||
reiserfs)
|
||||
fsckoptions="-j $journaldev $fsckoptions"
|
||||
rflags="${rflags:+${rflags},}jdev=$journaldev"
|
||||
;;
|
||||
*);;
|
||||
esac
|
||||
fi
|
||||
|
||||
_rflags_ro="$rflags,ro"
|
||||
|
||||
while ! mount -t ${rootfs} -o "$_rflags_ro" "${root#block:}" "$NEWROOT"; do
|
||||
warn "Failed to mount -t ${rootfs} -o $_rflags_ro ${root#block:} $NEWROOT"
|
||||
fsck_ask_err
|
||||
done
|
||||
|
||||
READONLY=
|
||||
fsckoptions=
|
||||
@@ -50,28 +50,31 @@ mount_root() {
|
||||
fastboot=yes
|
||||
fi
|
||||
|
||||
if [ -f "$NEWROOT"/fsckoptions ]; then
|
||||
fsckoptions=$(cat "$NEWROOT"/fsckoptions)
|
||||
fi
|
||||
if ! getargbool 0 rd.skipfsck; then
|
||||
if [ -f "$NEWROOT"/fsckoptions ]; then
|
||||
fsckoptions=$(cat "$NEWROOT"/fsckoptions)
|
||||
fi
|
||||
|
||||
if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck ; then
|
||||
fsckoptions="-f $fsckoptions"
|
||||
elif [ -f "$NEWROOT"/.autofsck ]; then
|
||||
[ -f "$NEWROOT"/etc/sysconfig/autofsck ] && . "$NEWROOT"/etc/sysconfig/autofsck
|
||||
if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
|
||||
AUTOFSCK_OPT="$AUTOFSCK_OPT -f"
|
||||
if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck ; then
|
||||
fsckoptions="-f $fsckoptions"
|
||||
elif [ -f "$NEWROOT"/.autofsck ]; then
|
||||
[ -f "$NEWROOT"/etc/sysconfig/autofsck ] && \
|
||||
. "$NEWROOT"/etc/sysconfig/autofsck
|
||||
if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
|
||||
AUTOFSCK_OPT="$AUTOFSCK_OPT -f"
|
||||
fi
|
||||
if [ -n "$AUTOFSCK_SINGLEUSER" ]; then
|
||||
warn "*** Warning -- the system did not shut down cleanly. "
|
||||
warn "*** Dropping you to a shell; the system will continue"
|
||||
warn "*** when you leave the shell."
|
||||
emergency_shell
|
||||
fi
|
||||
fsckoptions="$AUTOFSCK_OPT $fsckoptions"
|
||||
fi
|
||||
if [ -n "$AUTOFSCK_SINGLEUSER" ]; then
|
||||
warn "*** Warning -- the system did not shut down cleanly. "
|
||||
warn "*** Dropping you to a shell; the system will continue"
|
||||
warn "*** when you leave the shell."
|
||||
emergency_shell
|
||||
fi
|
||||
fsckoptions="$AUTOFSCK_OPT $fsckoptions"
|
||||
fi
|
||||
|
||||
rootopts=
|
||||
if getargbool 1 rd.fstab -n rd_NO_FSTAB \
|
||||
if getargbool 1 rd.fstab -d -n rd_NO_FSTAB \
|
||||
&& ! getarg rootflags \
|
||||
&& [ -f "$NEWROOT/etc/fstab" ] \
|
||||
&& ! [ -L "$NEWROOT/etc/fstab" ]; then
|
||||
@@ -79,7 +82,7 @@ mount_root() {
|
||||
# the root filesystem,
|
||||
# remount it with the proper options
|
||||
rootopts="defaults"
|
||||
while read dev mp fs opts rest; do
|
||||
while read dev mp fs opts dump fsck; do
|
||||
# skip comments
|
||||
[ "${dev%%#*}" != "$dev" ] && continue
|
||||
|
||||
@@ -87,23 +90,27 @@ mount_root() {
|
||||
# sanity - determine/fix fstype
|
||||
rootfs=$(det_fs "${root#block:}" "$fs")
|
||||
rootopts=$opts
|
||||
rootfsck=$fsck
|
||||
break
|
||||
fi
|
||||
done < "$NEWROOT/etc/fstab"
|
||||
|
||||
rootopts=$(filter_rootopts $rootopts)
|
||||
fi
|
||||
|
||||
# we want rootflags (rflags) to take precedence so prepend rootopts to
|
||||
# them; rflags is guaranteed to not be empty
|
||||
rflags="${rootopts:+"${rootopts},"}${rflags}"
|
||||
# them
|
||||
rflags="${rootopts},${rflags}"
|
||||
rflags="${rflags#,}"
|
||||
rflags="${rflags%,}"
|
||||
|
||||
# backslashes are treated as escape character in fstab
|
||||
# esc_root=$(echo ${root#block:} | sed 's,\\,\\\\,g')
|
||||
# printf '%s %s %s %s 1 1 \n' "$esc_root" "$NEWROOT" "$rootfs" "$rflags" >/etc/fstab
|
||||
|
||||
ran_fsck=0
|
||||
if [ -z "$fastboot" -a "$READONLY" != "yes" ] && ! strstr "${rflags},${rootopts}" _netdev; then
|
||||
if fsck_able "$rootfs" && \
|
||||
[ "$rootfsck" != "0" -a -z "$fastboot" -a "$READONLY" != "yes" ] && \
|
||||
! strstr "${rflags}" _netdev && \
|
||||
! getargbool 0 rd.skipfsck; then
|
||||
umount "$NEWROOT"
|
||||
fsck_single "${root#block:}" "$rootfs" "$rflags" "$fsckoptions"
|
||||
_ret=$?
|
||||
@@ -111,14 +118,20 @@ mount_root() {
|
||||
ran_fsck=1
|
||||
fi
|
||||
|
||||
if [ -n "$rootopts" -o "$ran_fsck" = "1" ]; then
|
||||
echo "${root#block:} $NEWROOT $rootfs ${rflags:-defaults} 0 $rootfsck" >> /etc/fstab
|
||||
|
||||
if ! ismounted "$NEWROOT"; then
|
||||
info "Mounting ${root#block:} with -o ${rflags}"
|
||||
mount "$NEWROOT" 2>&1 | vinfo
|
||||
elif ! are_lists_eq , "$rflags" "$_rflags_ro" defaults; then
|
||||
info "Remounting ${root#block:} with -o ${rflags}"
|
||||
umount "$NEWROOT" &>/dev/null
|
||||
mount -t "$rootfs" -o "$rflags" "${root#block:}" "$NEWROOT" 2>&1 | vinfo
|
||||
mount -o remount "$NEWROOT" 2>&1 | vinfo
|
||||
fi
|
||||
|
||||
[ -f "$NEWROOT"/forcefsck ] && rm -f "$NEWROOT"/forcefsck 2>/dev/null
|
||||
[ -f "$NEWROOT"/.autofsck ] && rm -f "$NEWROOT"/.autofsck 2>/dev/null
|
||||
if ! getargbool 0 rd.skipfsck; then
|
||||
[ -f "$NEWROOT"/forcefsck ] && rm -f "$NEWROOT"/forcefsck 2>/dev/null
|
||||
[ -f "$NEWROOT"/.autofsck ] && rm -f "$NEWROOT"/.autofsck 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -n "$root" -a -z "${root%%block:*}" ]; then
|
||||
|
@@ -11,6 +11,6 @@ install() {
|
||||
|
||||
if [ -d ${_terminfodir} ]; then
|
||||
inst_dir "$_terminfodir"
|
||||
cp --reflink=auto --sparse=auto -prfL -t "${initdir}/${_terminfodir%/*}" "$_terminfodir"
|
||||
cp --reflink=auto --sparse=auto -prfL -t "${initdir}/${_terminfodir}" "$_terminfodir"/*
|
||||
fi
|
||||
}
|
||||
|
@@ -1,8 +1,10 @@
|
||||
SUBSYSTEM!="block", GOTO="ps_end"
|
||||
ACTION!="add|change", GOTO="ps_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="ps_end"
|
||||
|
||||
KERNEL=="cciss[0-9]*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
|
||||
KERNEL=="nbd[0-9]*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
|
||||
KERNEL=="cciss[0-9]*", IMPORT{builtin}="blkid"
|
||||
KERNEL=="nbd[0-9]*", IMPORT{builtin}="blkid"
|
||||
|
||||
|
||||
KERNEL!="md[0-9]*|md_d[0-9]*|md/*", KERNEL!="md*", GOTO="md_end"
|
||||
@@ -19,7 +21,7 @@ ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
|
||||
LABEL="md_ignore_state"
|
||||
|
||||
IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
|
||||
IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
|
||||
IMPORT{builtin}="blkid"
|
||||
OPTIONS+="link_priority=100"
|
||||
OPTIONS+="watch"
|
||||
LABEL="md_end"
|
||||
@@ -32,7 +34,7 @@ ENV{DM_NAME}!="?*", GOTO="ps_end"
|
||||
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="ps_end"
|
||||
ENV{DM_UUID}=="CRYPT-TEMP-?*", GOTO="ps_end"
|
||||
ENV{DM_UUID}!="?*", ENV{DM_NAME}=="temporary-cryptsetup-?*", GOTO="ps_end"
|
||||
IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
|
||||
IMPORT{builtin}="blkid"
|
||||
|
||||
|
||||
LABEL="ps_end"
|
||||
|
@@ -1,5 +1,7 @@
|
||||
SUBSYSTEM!="block", GOTO="pss_end"
|
||||
ACTION!="add|change", GOTO="pss_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="pss_end"
|
||||
|
||||
ACTION=="change", KERNEL=="dm-[0-9]*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}!="1", GOTO="do_pss"
|
||||
KERNEL=="cciss[0-9]*", GOTO="do_pss"
|
||||
@@ -10,7 +12,7 @@ GOTO="pss_end"
|
||||
|
||||
LABEL="do_pss"
|
||||
# by-path (parent device path)
|
||||
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT{program}="path_id %p"
|
||||
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id"
|
||||
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}"
|
||||
ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
|
||||
|
||||
|
@@ -8,7 +8,7 @@ install() {
|
||||
# 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 udevadm cat uname basename blkid \
|
||||
dracut_install udevadm cat uname blkid \
|
||||
/etc/udev/udev.conf /etc/group
|
||||
|
||||
[ -d ${initdir}/lib/systemd ] || mkdir -p ${initdir}/lib/systemd
|
||||
|
@@ -73,3 +73,4 @@ mount_root() {
|
||||
if [ -n "$root" -a -z "${root%%virtfs:*}" ]; then
|
||||
mount_root
|
||||
fi
|
||||
:
|
||||
|
@@ -2,9 +2,9 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
getargbool 1 rd.zfcp.conf -n rd_NO_ZFCPCONF || rm /etc/zfcp.conf
|
||||
getargbool 1 rd.zfcp.conf -d -n rd_NO_ZFCPCONF || rm /etc/zfcp.conf
|
||||
|
||||
for zfcp_arg in $(getargs rd.zfcp 'rd_ZFCP='); do
|
||||
for zfcp_arg in $(getargs rd.zfcp -d 'rd_ZFCP='); do
|
||||
(
|
||||
IFS=","
|
||||
set $zfcp_arg
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user