Compare commits
237 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f046336c44 | ||
![]() |
665b7e58ba | ||
![]() |
1391a06d80 | ||
![]() |
404815eaf0 | ||
![]() |
6c128565b1 | ||
![]() |
e1cb85802b | ||
![]() |
cbd60fcaaf | ||
![]() |
28a88b6886 | ||
![]() |
7081e99735 | ||
![]() |
dc67eda6bf | ||
![]() |
b85f723535 | ||
![]() |
9ff9dde8d7 | ||
![]() |
8714280104 | ||
![]() |
6d70aa7836 | ||
![]() |
14986b9d58 | ||
![]() |
e5c9bc1198 | ||
![]() |
fc9bc6f8db | ||
![]() |
c62b94614d | ||
![]() |
833685ded5 | ||
![]() |
3cff5fb56f | ||
![]() |
3e6dad37c4 | ||
![]() |
600c876968 | ||
![]() |
cc68f78d92 | ||
![]() |
48ca487621 | ||
![]() |
13cb578a37 | ||
![]() |
df2afa9ff4 | ||
![]() |
76d5c79e9c | ||
![]() |
fdf2b152e5 | ||
![]() |
178c189b0b | ||
![]() |
14be3b16cd | ||
![]() |
2e111dd57a | ||
![]() |
06e9f8870a | ||
![]() |
7e0d508002 | ||
![]() |
585b3b37c0 | ||
![]() |
167a320e5f | ||
![]() |
2242cd92ee | ||
![]() |
d20fb951fa | ||
![]() |
e0a393361d | ||
![]() |
da9c518116 | ||
![]() |
4d51eff05f | ||
![]() |
a6c718ce8e | ||
![]() |
43a050e542 | ||
![]() |
25787f8071 | ||
![]() |
ecfa02bdc8 | ||
![]() |
080d1b718d | ||
![]() |
8ea8d6de80 | ||
![]() |
4dbc1d1bb3 | ||
![]() |
3b9669cff4 | ||
![]() |
a6332e6980 | ||
![]() |
9037b63eb2 | ||
![]() |
308015bc4d | ||
![]() |
2692a42231 | ||
![]() |
e064127729 | ||
![]() |
103281f3b6 | ||
![]() |
69ba546721 | ||
![]() |
d65638dacb | ||
![]() |
a0be1eddcf | ||
![]() |
e1b48995c2 | ||
![]() |
194e074764 | ||
![]() |
7f1d77d9fb | ||
![]() |
3722020071 | ||
![]() |
f7235c223d | ||
![]() |
868eba13f2 | ||
![]() |
2cae00be9e | ||
![]() |
69eba8c40a | ||
![]() |
17b01c5b13 | ||
![]() |
a0508937fc | ||
![]() |
bc07024624 | ||
![]() |
907f75447b | ||
![]() |
500d8e6002 | ||
![]() |
3d12d7a2cc | ||
![]() |
886b9afcc5 | ||
![]() |
f3f9777497 | ||
![]() |
5596b70bd0 | ||
![]() |
4211605000 | ||
![]() |
aa09b74a41 | ||
![]() |
d9a7ea5b43 | ||
![]() |
914f531f39 | ||
![]() |
0fc0dcff60 | ||
![]() |
0e32ce3219 | ||
![]() |
ff0636635a | ||
![]() |
ba111df2b9 | ||
![]() |
dff1671f8f | ||
![]() |
44f77ac1b0 | ||
![]() |
641a8558f4 | ||
![]() |
3bff70ef15 | ||
![]() |
d672bf167c | ||
![]() |
ea62729238 | ||
![]() |
32ec0a762d | ||
![]() |
ca121b1a5c | ||
![]() |
0db77f5a2b | ||
![]() |
cc4037d120 | ||
![]() |
a999414eaf | ||
![]() |
00083a0909 | ||
![]() |
8a7f561ee5 | ||
![]() |
32b2fb8a27 | ||
![]() |
104727ad6e | ||
![]() |
cce471c9ce | ||
![]() |
353e7a7ec3 | ||
![]() |
73088e46f7 | ||
![]() |
52f1b04183 | ||
![]() |
83e0dc7a3d | ||
![]() |
c4bb88715c | ||
![]() |
54c7ace145 | ||
![]() |
c1b8934faa | ||
![]() |
5746f04994 | ||
![]() |
f9452c94c0 | ||
![]() |
68c49db952 | ||
![]() |
f9c7788ba5 | ||
![]() |
68318328f1 | ||
![]() |
c9a9968dfc | ||
![]() |
48dba7f9ac | ||
![]() |
bdf1f472b4 | ||
![]() |
e4297a66b1 | ||
![]() |
ec6d8eab69 | ||
![]() |
dece5ee1f5 | ||
![]() |
a41dc8f969 | ||
![]() |
aa11b710ce | ||
![]() |
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 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
/Makefile.inc
|
||||
/dracut.8
|
||||
/dracut-catimages.8
|
||||
/dracut.conf.5
|
||||
@@ -11,3 +12,4 @@ test*.img
|
||||
/.buildpath
|
||||
/.project
|
||||
/dracut-version.sh
|
||||
/install/dracut-install
|
||||
|
38
AUTHORS
38
AUTHORS
@@ -1,67 +1,87 @@
|
||||
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>
|
||||
John Reiser <jreiser@bitwagon.com>
|
||||
Luca Berra <bluca@vodka.it>
|
||||
Daniel Drake <dsd@laptop.org>
|
||||
Leho Kraav <leho@kraav.com>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
Chao Wang <chaowang@redhat.com>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
Jesse Keating <jkeating@redhat.com>
|
||||
Milan Broz <mbroz@redhat.com>
|
||||
Roberto Sassu <roberto.sassu@polito.it>
|
||||
dyoung@redhat.com <dyoung@redhat.com>
|
||||
Anton Blanchard <anton@samba.org>
|
||||
Bill Nottingham <notting@redhat.com>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
David Cantrell <dcantrell@redhat.com>
|
||||
Frederic Crozat <fcrozat@suse.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>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Dennis Gilmore <dennis@ausil.us>
|
||||
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>
|
||||
Vivek Goyal <vgoyal@redhat.com>
|
||||
Vladislav Bogdanov <bubble@hoster-ok.com>
|
||||
Wim Muskee <wimmuskee@gmail.com>
|
||||
Alexander Todorov <atodorov@redhat.com>
|
||||
Andy Lutomirski <luto@mit.edu>
|
||||
Anssi Hannula <anssi@mageia.org>
|
||||
Canek Peláez Valdés <caneko@gmail.com>
|
||||
Chris Leech <cleech@redhat.com>
|
||||
Christian Heinz <christian.ch.heinz@gmail.com>
|
||||
Dave Jones <davej@redhat.com>
|
||||
Duane Griffin <duaneg@dghda.com>
|
||||
Frederic Crozat <fcrozat@mandriva.com>
|
||||
Frederick Grose <fgrose@gmail.com>
|
||||
Glen Gray <slaine@slaine.org>
|
||||
Hermann Gausterer <git-dracut-2012@mrq1.org>
|
||||
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>
|
||||
Mike Gorse <mgorse@suse.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>
|
||||
Radek Vykydal <rvykydal@redhat.com>
|
||||
Sergey Fionov <fionov@gmail.com>
|
||||
Srinivasa T N <seenutn@linux.vnet.ibm.com>
|
||||
Stefan Reimer <it@startux.de>
|
||||
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>
|
||||
|
42
COPYING
42
COPYING
@@ -1,12 +1,12 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
@@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
@@ -225,7 +225,7 @@ impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -303,16 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
@@ -335,5 +335,5 @@ necessary. Here is a sample; alter the names:
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
95
Makefile
95
Makefile
@@ -1,6 +1,8 @@
|
||||
VERSION=022
|
||||
VERSION=024
|
||||
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
|
||||
|
||||
-include Makefile.inc
|
||||
|
||||
prefix ?= /usr
|
||||
libdir ?= ${prefix}/lib
|
||||
datadir ?= ${prefix}/share
|
||||
@@ -8,38 +10,61 @@ 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 \
|
||||
lsinitrd.1 \
|
||||
mkinitrd.8
|
||||
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS doc
|
||||
|
||||
all: syncheck dracut-version.sh dracut-install
|
||||
|
||||
DRACUT_INSTALL_SOURCE = \
|
||||
install/dracut-install.c \
|
||||
install/hashmap.c\
|
||||
install/log.c \
|
||||
install/util.c
|
||||
DRACUT_INSTALL_OBJECTS = \
|
||||
install/dracut-install.o \
|
||||
install/hashmap.o\
|
||||
install/log.o \
|
||||
install/util.o
|
||||
|
||||
DRACUT_INSTALL_HEADER = \
|
||||
install/hashmap.h \
|
||||
install/log.h \
|
||||
install/macro.h \
|
||||
install/util.h
|
||||
# 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
|
||||
|
||||
dracut-install: $(DRACUT_INSTALL_SOURCE) $(DRACUT_INSTALL_HEADER)
|
||||
gcc -std=gnu99 -O2 -g -Wall -o dracut-install $(DRACUT_INSTALL_SOURCE)
|
||||
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
|
||||
|
||||
ifneq ($(enable_documentation),no)
|
||||
all: doc
|
||||
endif
|
||||
|
||||
%: %.xml
|
||||
xsltproc -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
|
||||
|
||||
@@ -49,13 +74,12 @@ doc: $(manpages) dracut.html
|
||||
dracut.html: dracut.asc $(manpages)
|
||||
asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc
|
||||
xsltproc -o dracut.html --xinclude -nonet \
|
||||
--stringparam draft.mode yes \
|
||||
--stringparam html.stylesheet \
|
||||
http://docs.redhat.com/docs/en-US/Common_Content/css/default.css \
|
||||
http://docs.fedoraproject.org/en-US/Common_Content/css/default.css \
|
||||
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
|
||||
rm dracut.xml
|
||||
|
||||
install: doc dracut-version.sh
|
||||
install: dracut-version.sh
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)
|
||||
mkdir -p $(DESTDIR)$(bindir)
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)
|
||||
@@ -69,18 +93,17 @@ 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 lsinitrd.1 $(DESTDIR)$(mandir)/man1/lsinitrd.1
|
||||
install -m 0644 mkinitrd.8 $(DESTDIR)$(mandir)/man8/mkinitrd.8
|
||||
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
|
||||
ifneq ($(enable_documentation),no)
|
||||
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
|
||||
endif
|
||||
if [ -n "$(systemdsystemunitdir)" ]; then \
|
||||
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
|
||||
install -m 0644 dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir); \
|
||||
@@ -88,7 +111,9 @@ install: doc dracut-version.sh
|
||||
ln -s ../dracut-shutdown.service \
|
||||
$(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants/dracut-shutdown.service; \
|
||||
fi
|
||||
install $(strip) -m 0755 dracut-install $(DESTDIR)$(pkglibdir)/dracut-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
|
||||
@@ -97,9 +122,10 @@ clean:
|
||||
$(RM) *~
|
||||
$(RM) */*~
|
||||
$(RM) */*/*~
|
||||
$(RM) $(manpages:%=%.xml) dracut.xml
|
||||
$(RM) test-*.img
|
||||
$(RM) dracut-*.rpm dracut-*.tar.bz2
|
||||
$(RM) dracut-install
|
||||
$(RM) dracut-install install/dracut-install $(DRACUT_INSTALL_OBJECTS)
|
||||
$(RM) $(manpages) dracut.html
|
||||
$(MAKE) -C test clean
|
||||
|
||||
@@ -138,7 +164,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)
|
||||
|
34
NEWS
34
NEWS
@@ -1,3 +1,37 @@
|
||||
dracut-024
|
||||
==========
|
||||
- new dracut option "--device"
|
||||
- new dracut kernel command line options "rd.auto"
|
||||
- new dracut kernel command line options "rd.noverifyssl"
|
||||
- new dracut option "--kernel-cmdline" and "kernel_cmdline" option for default parameters
|
||||
- fixes for systemd and crypto
|
||||
- fix for kexec in shutdown, if not included in initramfs
|
||||
- create the initramfs non-world readable
|
||||
- prelink/preunlink in the initramfs
|
||||
- strip binaries in the initramfs by default now
|
||||
- various FIPS fixes
|
||||
- various dracut-install fixes
|
||||
|
||||
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
|
||||
|
4
README
4
README
@@ -1,6 +1,6 @@
|
||||
Dracut
|
||||
dracut
|
||||
------
|
||||
Dracut is a new initramfs infrastructure.
|
||||
dracut is a new initramfs infrastructure.
|
||||
|
||||
Information about the initial goals and aims can be found at
|
||||
https://fedoraproject.org/wiki/Initrdrewrite
|
||||
|
@@ -1,5 +1,5 @@
|
||||
Most of the functionality that dracut implements are actually implemented
|
||||
by dracut modules. Dracut modules live in modules.d, and have the following
|
||||
by dracut modules. dracut modules live in modules.d, and have the following
|
||||
structure:
|
||||
|
||||
dracut_install_dir/modules.d/
|
||||
@@ -38,7 +38,7 @@ installkernel():
|
||||
|
||||
|
||||
check():
|
||||
Dracut calls this function to check and see if a module can be installed
|
||||
dracut calls this function to check and see if a module can be installed
|
||||
on the initrd.
|
||||
|
||||
When called without options, check should check to make sure that
|
||||
|
@@ -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
|
||||
|
11
TODO
11
TODO
@@ -6,12 +6,21 @@ Items are ordered in priority.
|
||||
|
||||
INITRAMFS TODO
|
||||
|
||||
- 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 / careful about resume!
|
||||
- the hard-coded list of udev rules that we care about is kind of lame.
|
||||
- panic fallback
|
||||
- bridging/bonding without "netroot=" https://bugzilla.redhat.com/show_bug.cgi?id=822750
|
||||
- progress indication for fsck https://bugzilla.redhat.com/show_bug.cgi?id=827118
|
||||
- domain, searchdomain https://bugzilla.redhat.com/show_bug.cgi?id=840778
|
||||
- disable write-ifcfg https://bugzilla.redhat.com/show_bug.cgi?id=840784
|
||||
- check for /var to be mounted in convertfs https://bugzilla.redhat.com/show_bug.cgi?id=848172
|
||||
- probably fix "--include" https://bugzilla.redhat.com/show_bug.cgi?id=849338
|
||||
- iscsi livecd boot
|
||||
|
||||
GENERATOR TODO
|
||||
|
||||
@@ -31,5 +40,5 @@ CODE TODO
|
||||
Future Enhancement Requests
|
||||
|
||||
- run ssh server to enter crypto password or perform debugging (supported by debian)
|
||||
- https://bugzilla.redhat.com/show_bug.cgi?id=524727 - Dracut + encrypted root + networking
|
||||
- https://bugzilla.redhat.com/show_bug.cgi?id=524727 - dracut + encrypted root + networking
|
||||
|
||||
|
53
configure
vendored
Executable file
53
configure
vendored
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# We don't support srcdir != builddir
|
||||
echo \#buildapi-variable-no-builddir >/dev/null
|
||||
|
||||
prefix=/usr
|
||||
|
||||
enable_documentation=yes
|
||||
|
||||
# Little helper function for reading args from the commandline.
|
||||
# it automatically handles -a b and -a=b variants, and returns 1 if
|
||||
# we need to shift $3.
|
||||
read_arg() {
|
||||
# $1 = arg name
|
||||
# $2 = arg value
|
||||
# $3 = arg parameter
|
||||
local rematch='^[^=]*=(.*)$'
|
||||
if [[ $2 =~ $rematch ]]; then
|
||||
read "$1" <<< "${BASH_REMATCH[1]}"
|
||||
else
|
||||
read "$1" <<< "$3"
|
||||
# There is no way to shift our callers args, so
|
||||
# return 1 to indicate they should do it instead.
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
while (($# > 0)); do
|
||||
case "${1%%=*}" in
|
||||
--prefix) read_arg prefix "$@" || shift;;
|
||||
--libdir) read_arg libdir "$@" || shift;;
|
||||
--datadir) read_arg datadir "$@" || shift;;
|
||||
--sysconfdir) read_arg sysconfdir "$@" || shift;;
|
||||
--sbindir) read_arg sbindir "$@" || shift;;
|
||||
--mandir) read_arg mandir "$@" || shift;;
|
||||
--disable-documentation) enable_documentation=no;;
|
||||
*) echo "Ignoring unknown option '$1'";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
cat > Makefile.inc.tmp <<EOF
|
||||
prefix ?= ${prefix}
|
||||
libdir ?= ${libdir:-${prefix}/lib}
|
||||
datadir ?= ${datadir:-${prefix}/share}
|
||||
sysconfdir ?= ${sysconfdir:-${prefix}/etc}
|
||||
sbindir ?= ${sbindir:-${prefix}/sbin}
|
||||
mandir ?= ${mandir:-${prefix}/share/man}
|
||||
enable_documentation ?= ${enable_documentation}
|
||||
EOF
|
||||
mv Makefile.inc.tmp Makefile.inc
|
@@ -45,7 +45,7 @@ find_binary() {
|
||||
fi
|
||||
fi
|
||||
|
||||
type -P $1
|
||||
type -P ${1##*/}
|
||||
}
|
||||
|
||||
if ! [[ $dracutbasedir ]]; then
|
||||
@@ -239,6 +239,21 @@ else
|
||||
}
|
||||
fi
|
||||
|
||||
get_persistent_dev() {
|
||||
local i _tmp _dev
|
||||
|
||||
_dev=$(udevadm info --query=name --name="$1" 2>/dev/null)
|
||||
[ -z "$_dev" ] && return
|
||||
|
||||
for i in /dev/mapper/* /dev/disk/by-uuid/* /dev/disk/by-id/*; do
|
||||
_tmp=$(udevadm info --query=name --name="$i" 2>/dev/null)
|
||||
if [ "$_tmp" = "$_dev" ]; then
|
||||
echo $i
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# get_fs_env <device>
|
||||
# Get and set the ID_FS_TYPE and ID_FS_UUID variable from udev for a device.
|
||||
# Example:
|
||||
@@ -357,6 +372,32 @@ 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 /; }
|
||||
|
||||
@@ -402,6 +443,51 @@ check_block_and_slaves() {
|
||||
return 1
|
||||
}
|
||||
|
||||
check_block_and_slaves_all() {
|
||||
local _x _ret=1
|
||||
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
|
||||
if "$1" $2; then
|
||||
_ret=0
|
||||
fi
|
||||
check_vol_slaves "$@" && return 0
|
||||
if [[ -f /sys/dev/block/$2/../dev ]]; then
|
||||
check_block_and_slaves_all $1 $(cat "/sys/dev/block/$2/../dev") && _ret=0
|
||||
fi
|
||||
[[ -d /sys/dev/block/$2/slaves ]] || return 1
|
||||
for _x in /sys/dev/block/$2/slaves/*/dev; do
|
||||
[[ -f $_x ]] || continue
|
||||
check_block_and_slaves_all $1 $(cat "$_x") && _ret=0
|
||||
done
|
||||
return $_ret
|
||||
}
|
||||
# for_each_host_dev_and_slaves <func>
|
||||
# Execute "<func> <dev>" for every "<dev>" found
|
||||
# in ${host_devs[@]} and their slaves
|
||||
for_each_host_dev_and_slaves_all()
|
||||
{
|
||||
local _func="$1"
|
||||
local _dev
|
||||
local _ret=1
|
||||
for _dev in ${host_devs[@]}; do
|
||||
[[ -b "$_dev" ]] || continue
|
||||
if check_block_and_slaves_all $_func $(get_maj_min $_dev); then
|
||||
_ret=0
|
||||
fi
|
||||
done
|
||||
return $_ret
|
||||
}
|
||||
|
||||
for_each_host_dev_and_slaves()
|
||||
{
|
||||
local _func="$1"
|
||||
local _dev
|
||||
for _dev in ${host_devs[@]}; do
|
||||
[[ -b "$_dev" ]] || continue
|
||||
check_block_and_slaves $_func $(get_maj_min $_dev) && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# ugly workaround for the lvm design
|
||||
# There is no volume group device,
|
||||
# so, there are no slave devices for volume groups.
|
||||
@@ -427,6 +513,26 @@ check_vol_slaves() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# 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() {
|
||||
@@ -457,9 +563,12 @@ if [[ $DRACUT_INSTALL ]]; then
|
||||
}
|
||||
|
||||
dracut_install() {
|
||||
local ret
|
||||
#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} "$@" || :
|
||||
ret=$?
|
||||
(($ret != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
return $ret
|
||||
}
|
||||
|
||||
inst_library() {
|
||||
@@ -529,6 +638,12 @@ else
|
||||
if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
|
||||
inst "${_src%/*}/.${_src##*/}.hmac" "${_target%/*}/.${_target##*/}.hmac"
|
||||
fi
|
||||
if [[ -e "/lib/fipscheck/${_src##*/}.hmac" ]]; then
|
||||
inst "/lib/fipscheck/${_src##*/}.hmac" "/lib/fipscheck/${_target##*/}.hmac"
|
||||
fi
|
||||
if [[ -e "/lib64/fipscheck/${_src##*/}.hmac" ]]; then
|
||||
inst "/lib64/fipscheck/${_src##*/}.hmac" "/lib64/fipscheck/${_target##*/}.hmac"
|
||||
fi
|
||||
fi
|
||||
ddebug "Installing $_src"
|
||||
cp --reflink=auto --sparse=auto -pfL "$_src" "${initdir}/$_target"
|
||||
@@ -566,6 +681,12 @@ else
|
||||
if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
|
||||
inst "${_src%/*}/.${_src##*/}.hmac" "${_dest%/*}/.${_dest##*/}.hmac"
|
||||
fi
|
||||
if [[ -e "/lib/fipscheck/${_src##*/}.hmac" ]]; then
|
||||
inst "/lib/fipscheck/${_src##*/}.hmac" "/lib/fipscheck/${_dest##*/}.hmac"
|
||||
fi
|
||||
if [[ -e "/lib64/fipscheck/${_src##*/}.hmac" ]]; then
|
||||
inst "/lib64/fipscheck/${_src##*/}.hmac" "/lib64/fipscheck/${_dest##*/}.hmac"
|
||||
fi
|
||||
fi
|
||||
_reallib=$(readlink -f "$_src")
|
||||
inst_simple "$_reallib" "$_reallib"
|
||||
@@ -706,47 +827,67 @@ inst_rule_programs() {
|
||||
|
||||
if grep -qE 'PROGRAM==?"[^ "]+' "$1"; then
|
||||
for _prog in $(grep -E 'PROGRAM==?"[^ "]+' "$1" | sed -r 's/.*PROGRAM==?"([^ "]+).*/\1/'); do
|
||||
_bin=""
|
||||
if [ -x ${udevdir}/$_prog ]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
else
|
||||
elif [[ "${_prog/\$\{/}" != "$_prog" ]]; then
|
||||
_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)"
|
||||
dracut_install "$_bin"
|
||||
[[ $_bin ]] && dracut_install "$_bin"
|
||||
done
|
||||
fi
|
||||
if grep -qE 'RUN==?"[^ "]+' "$1"; then
|
||||
for _prog in $(grep -E 'RUN==?"[^ "]+' "$1" | sed -r 's/.*RUN==?"([^ "]+).*/\1/'); do
|
||||
if grep -qE 'RUN[+=]=?"[^ "]+' "$1"; then
|
||||
for _prog in $(grep -E 'RUN[+=]=?"[^ "]+' "$1" | sed -r 's/.*RUN[+=]=?"([^ "]+).*/\1/'); do
|
||||
_bin=""
|
||||
if [ -x ${udevdir}/$_prog ]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
else
|
||||
elif [[ "${_prog/\$\{/}" != "$_prog" ]]; then
|
||||
_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)"
|
||||
dracut_install "$_bin"
|
||||
[[ $_bin ]] && 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
|
||||
_bin=""
|
||||
if [ -x ${udevdir}/$_prog ]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
else
|
||||
elif [[ "${_prog/\$\{/}" != "$_prog" ]]; then
|
||||
_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)"
|
||||
dracut_install "$_bin"
|
||||
[[ $_bin ]] && dracut_install "$_bin"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# attempt to install any programs specified in a udev rule
|
||||
inst_rule_group_owner() {
|
||||
local i
|
||||
|
||||
if grep -qE 'OWNER=?"[^ "]+' "$1"; then
|
||||
for i in $(grep -E 'OWNER=?"[^ "]+' "$1" | sed -r 's/.*OWNER=?"([^ "]+).*/\1/'); do
|
||||
if ! egrep -q "^$i:" "$initdir/etc/passwd" 2>/dev/null; then
|
||||
egrep "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if grep -qE 'GROUP=?"[^ "]+' "$1"; then
|
||||
for i in $(grep -E 'GROUP=?"[^ "]+' "$1" | sed -r 's/.*GROUP=?"([^ "]+).*/\1/'); do
|
||||
if ! egrep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then
|
||||
egrep "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
@@ -764,6 +905,7 @@ inst_rules() {
|
||||
if [[ -f $r/$_rule ]]; then
|
||||
_found="$r/$_rule"
|
||||
inst_rule_programs "$_found"
|
||||
inst_rule_group_owner "$_found"
|
||||
inst_simple "$_found"
|
||||
fi
|
||||
done
|
||||
@@ -772,6 +914,7 @@ inst_rules() {
|
||||
if [[ -f ${r}$_rule ]]; then
|
||||
_found="${r}$_rule"
|
||||
inst_rule_programs "$_found"
|
||||
inst_rule_group_owner "$_found"
|
||||
inst_simple "$_found" "$_target/${_found##*/}"
|
||||
fi
|
||||
done
|
||||
@@ -791,7 +934,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
|
||||
@@ -863,7 +1006,7 @@ inst_decompress() {
|
||||
for _src in $@
|
||||
do
|
||||
case ${_src} in
|
||||
*.gz) _cmd='gzip -d' ;;
|
||||
*.gz) _cmd='gzip -f -d' ;;
|
||||
*.bz2) _cmd='bzip2 -d' ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
@@ -1015,6 +1158,9 @@ check_mount() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _ret
|
||||
local _moddep
|
||||
|
||||
[ "${#host_fs_types[*]}" -le 0 ] && return 1
|
||||
|
||||
# If we are already scheduled to be loaded, no need to check again.
|
||||
strstr " $mods_to_load " " $_mod " && return 0
|
||||
strstr " $mods_checked_as_dep " " $_mod " && return 1
|
||||
@@ -1025,17 +1171,27 @@ check_mount() {
|
||||
[[ $2 ]] || mods_checked_as_dep+=" $_mod "
|
||||
|
||||
if strstr " $omit_dracutmodules " " $_mod "; then
|
||||
dinfo "Dracut module '$_mod' will not be installed, because it's in the list to be omitted!"
|
||||
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
|
||||
if strstr " $dracutmodules $add_dracutmodules $force_add_dracutmodules" " $_mod "; then
|
||||
module_check_mount $_mod; ret=$?
|
||||
|
||||
# explicit module, so also accept ret=255
|
||||
[[ $ret = 0 || $ret = 255 ]] || return 1
|
||||
else
|
||||
# skip this module
|
||||
return 1
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check_mount $_mod || return 1
|
||||
else
|
||||
# skip this module
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
for _moddep in $(module_depends $_mod); do
|
||||
# handle deps as if they were manually added
|
||||
strstr " $add_dracutmodules " " $_moddep " || \
|
||||
@@ -1044,7 +1200,7 @@ check_mount() {
|
||||
force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
if ! check_module $_moddep; then
|
||||
derror "Dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
||||
derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
@@ -1074,7 +1230,7 @@ check_module() {
|
||||
[[ $2 ]] || mods_checked_as_dep+=" $_mod "
|
||||
|
||||
if strstr " $omit_dracutmodules " " $_mod "; then
|
||||
dinfo "Dracut module '$_mod' will not be installed, because it's in the list to be omitted!"
|
||||
dinfo "dracut module '$_mod' will not be installed, because it's in the list to be omitted!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -1105,7 +1261,7 @@ check_module() {
|
||||
force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
if ! check_module $_moddep; then
|
||||
derror "Dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
||||
derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
@@ -1135,7 +1291,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
|
||||
}
|
||||
|
||||
@@ -1282,9 +1438,27 @@ dracut_kernel_post() {
|
||||
[[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && rm -fr "$DRACUT_KERNEL_LAZY_HASHDIR"
|
||||
}
|
||||
|
||||
module_is_host_only() (
|
||||
local _mod=$1
|
||||
_mod=${_mod##*/}
|
||||
_mod=${_mod%.ko}
|
||||
|
||||
[[ "$add_drivers" =~ " ${_mod} " ]] && return 0
|
||||
|
||||
# check if module is loaded
|
||||
[[ -d $(echo /sys/module/${_mod//-/_}|{ read a b; echo $a; }) ]] && return 0
|
||||
|
||||
# check if module is loadable on the current kernel
|
||||
# this covers the case, where a new module is introduced
|
||||
# or a module was renamed
|
||||
# or a module changed from builtin to a module
|
||||
modinfo -F filename "$_mod" &>/dev/null || return 0
|
||||
|
||||
return 1
|
||||
)
|
||||
|
||||
find_kernel_modules_by_path () (
|
||||
local _OLDIFS
|
||||
if ! [[ $hostonly ]]; then
|
||||
_OLDIFS=$IFS
|
||||
IFS=:
|
||||
while read a rest; do
|
||||
@@ -1292,14 +1466,6 @@ find_kernel_modules_by_path () (
|
||||
echo $srcmods/$a
|
||||
done < $srcmods/modules.dep
|
||||
IFS=$_OLDIFS
|
||||
else
|
||||
( cd /sys/module; echo *; ) \
|
||||
| xargs -r modinfo -F filename -k $kernel 2>/dev/null \
|
||||
| while read a; do
|
||||
[[ $a = */kernel*/$1/* ]] || continue
|
||||
echo $a
|
||||
done
|
||||
fi
|
||||
return 0
|
||||
)
|
||||
|
||||
@@ -1337,7 +1503,6 @@ instmods() {
|
||||
((_ret+=$?))
|
||||
;;
|
||||
--*) _mpargs+=" $_mod" ;;
|
||||
i2o_scsi) return 0;; # Do not load this diagnostic-only module
|
||||
*)
|
||||
_mod=${_mod##*/}
|
||||
# if we are already installed, skip this module and go on
|
||||
@@ -1352,16 +1517,16 @@ instmods() {
|
||||
dinfo "Omitting driver ${_mod##$srcmods}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# If we are building a host-specific initramfs and this
|
||||
# module is not already loaded, move on to the next one.
|
||||
[[ $hostonly ]] \
|
||||
&& ! [[ -d $(echo /sys/module/${_mod//-/_}|{ read a b; echo $a; }) ]] \
|
||||
&& ! [[ "$add_drivers" =~ " ${_mod} " ]] \
|
||||
&& ! module_is_host_only "$_mod" \
|
||||
&& return 0
|
||||
|
||||
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
|
||||
# differs from default '/'. This allows us to use dracut with
|
||||
# old version of modprobe which doesn't have '-d' option.
|
||||
local _moddirname=${srcmods%%/lib/modules/*}
|
||||
[[ -n ${_moddirname} ]] && _moddirname="-d ${_moddirname}/"
|
||||
|
@@ -23,7 +23,7 @@
|
||||
__DRACUT_LOGGER__=1
|
||||
|
||||
|
||||
## @brief Logging facility module for Dracut both at build- and boot-time.
|
||||
## @brief Logging facility module for dracut both at build- and boot-time.
|
||||
#
|
||||
# @section intro Introduction
|
||||
#
|
||||
@@ -89,7 +89,7 @@ __DRACUT_LOGGER__=1
|
||||
# @see dlog_init()
|
||||
|
||||
|
||||
## @brief Initializes Dracut Logger.
|
||||
## @brief Initializes dracut Logger.
|
||||
#
|
||||
# @retval 1 if something has gone wrong
|
||||
# @retval 0 on success.
|
||||
@@ -116,7 +116,7 @@ dlog_init() {
|
||||
|
||||
if [ -z "$fileloglvl" ]; then
|
||||
[ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
|
||||
elif (( $fileloglvl >= 0 )); then
|
||||
elif (( $fileloglvl > 0 )); then
|
||||
__oldumask=$(umask)
|
||||
umask 0377
|
||||
! [ -e "$logfile" ] && >"$logfile"
|
||||
@@ -138,7 +138,7 @@ dlog_init() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $sysloglvl >= 0 )); then
|
||||
if (( $sysloglvl > 0 )); then
|
||||
if ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null
|
||||
then
|
||||
# We cannot log to syslog, so turn this facility off.
|
||||
@@ -148,7 +148,7 @@ dlog_init() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if (($sysloglvl >= 0)) || (($kmsgloglvl >= 0 )); then
|
||||
if (($sysloglvl > 0)) || (($kmsgloglvl > 0 )); then
|
||||
if [ -n "$dracutbasedir" ]; then
|
||||
readonly syslogfacility=user
|
||||
else
|
||||
|
72
dracut.8.asc
72
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,7 +28,55 @@ 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
|
||||
-------
|
||||
@@ -154,6 +208,10 @@ example:
|
||||
specify additional directories, where to look for firmwares. This parameter
|
||||
can be specified multiple times.
|
||||
|
||||
**--kernel-cmdline <parameters>**::
|
||||
specify default kernel command line parameters
|
||||
|
||||
|
||||
**--kernel-only**::
|
||||
only install kernel drivers and firmware files
|
||||
|
||||
@@ -190,10 +248,10 @@ example:
|
||||
inhibit installation of any fsck tools
|
||||
|
||||
**--strip**::
|
||||
strip binaries in the initramfs
|
||||
strip binaries in the initramfs (default)
|
||||
|
||||
**--nostrip**::
|
||||
do not strip binaries in the initramfs (default)
|
||||
do not strip binaries in the initramfs
|
||||
|
||||
**--hardlink**::
|
||||
hardlink files in the initramfs (default)
|
||||
@@ -254,7 +312,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,6 +325,9 @@ provide a valid _/etc/fstab_.
|
||||
Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem
|
||||
options>_ in the initramfs
|
||||
|
||||
**--device** _<device>_ ::
|
||||
Bring up _<device>_ in initramfs, _<device>_ should be the device name
|
||||
|
||||
**-i, --include** _<SOURCE>_ _<TARGET>_::
|
||||
include the files in the SOURCE directory into the
|
||||
TARGET directory in the final initramfs. If SOURCE is a file, it will be
|
||||
@@ -361,6 +422,9 @@ _/etc/conf.d/_::
|
||||
set in the configuration files.
|
||||
|
||||
_/etc/cmdline_::
|
||||
Can contain additional command line options. Deprecated, better use /etc/cmdline.d/*.conf.
|
||||
|
||||
_/etc/cmdline.d/*.conf::
|
||||
Can contain additional command line options.
|
||||
|
||||
AVAILABILITY
|
||||
|
32
dracut.asc
32
dracut.asc
@@ -328,25 +328,28 @@ To add your own files to the initramfs image, you have several possibilities.
|
||||
|
||||
The --include option let you specify a source path and a target path. For example
|
||||
----
|
||||
# dracut --include cmdline-preset /etc/cmdline initramfs-cmdline-pre.img
|
||||
# dracut --include cmdline-preset /etc/cmdline.d/mycmdline.conf initramfs-cmdline-pre.img
|
||||
----
|
||||
will create an initramfs image, where the file cmdline-preset will be copied
|
||||
inside the initramfs to _/etc/cmdline_. --include can only be specified once.
|
||||
inside the initramfs to _/etc/cmdline.d/mycmdline.conf_. --include can only be specified once.
|
||||
|
||||
|
||||
----
|
||||
# mkdir rd.live.overlay
|
||||
# mkdir rd.live.overlay/etc
|
||||
# mkdir rd.live.overlay/etc/conf.d
|
||||
# echo "ip=auto" >> rd.live.overlay/etc/cmdline
|
||||
# echo export TESTVAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# echo export TESTVAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# mkdir rd.live.overlay/etc/cmdline.d
|
||||
# echo "ip=auto" >> rd.live.overlay/etc/cmdline.d/mycmdline.conf
|
||||
# echo export FOO=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# echo export BAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# tree rd.live.overlay/
|
||||
rd.live.overlay/
|
||||
└── etc
|
||||
├── cmdline
|
||||
└── conf.d
|
||||
└── testvar.conf
|
||||
├── cmdline.d
|
||||
│ └── mycmdline.conf
|
||||
└── conf.d
|
||||
└── testvar.conf
|
||||
|
||||
# dracut --include rd.live.overlay / initramfs-rd.live.overlay.img
|
||||
----
|
||||
|
||||
@@ -393,7 +396,7 @@ server about the ip adress for the machine. The dhcp server can also serve an
|
||||
additional root-path, which will set the root device for dracut. With this
|
||||
mechanism, you have static configuration on your client machine and a
|
||||
centralized boot configuration on your TFTP/DHCP server. If you can't pass a
|
||||
kernel command line, then you can inject _/etc/cmdline_, with a method described
|
||||
kernel command line, then you can inject _/etc/cmdline.d/mycmdline.conf_, with a method described
|
||||
in <<Injecting>>.
|
||||
|
||||
|
||||
@@ -459,6 +462,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 +482,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
|
||||
@@ -602,7 +612,7 @@ will put it out on the console when it reaches the kernel buffer by doing
|
||||
[[using-the-dracut-shell]]
|
||||
==== Using the dracut shell
|
||||
|
||||
Dracut offers a shell for interactive debugging in the event dracut fails to
|
||||
dracut offers a shell for interactive debugging in the event dracut fails to
|
||||
locate your root filesystem. To enable the shell:
|
||||
|
||||
. Add the boot parameter ''rd.shell'' to your bootloader configuration file
|
||||
|
@@ -61,6 +61,18 @@ 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.auto** **rd.auto=1**::
|
||||
enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or lvm.
|
||||
Default is off as of dracut version >= 024.
|
||||
|
||||
**rd.fstab=0**::
|
||||
do not honor special mount options for the root filesystem found in
|
||||
_/etc/fstab_ of the real root.
|
||||
@@ -81,10 +93,6 @@ resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
||||
the init system performs fsck before remount, you might want to use this
|
||||
option to avoid duplication.
|
||||
|
||||
**rd.usrmount.ro**:
|
||||
force mounting _/usr_ read-only. Use this option if your init system
|
||||
performs remount of _/usr_ the same as it does with rootfs.
|
||||
|
||||
|
||||
Misc
|
||||
~~~~
|
||||
@@ -100,6 +108,19 @@ 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.
|
||||
|
||||
**rd.noverifyssl**::
|
||||
accept self-signed certificates for ssl downloads.
|
||||
|
||||
**rd.ctty=**_<terminal device>_**::
|
||||
specify the controlling terminal for the console.
|
||||
This is useful, if you have multiple "console=" arguments.
|
||||
|
||||
[[dracutkerneldebug]]
|
||||
Debug
|
||||
~~~~~
|
||||
@@ -209,7 +230,7 @@ crypto LUKS
|
||||
LUKS UUID, so you don't have to specify the full UUID.
|
||||
This parameter can be specified multiple times.
|
||||
|
||||
**rd.luks.allow-discards::
|
||||
**rd.luks.allow-discards**::
|
||||
Allow using of discards (TRIM) requests on all LUKS partitions.
|
||||
|
||||
**rd.luks.crypttab=0**::
|
||||
@@ -229,6 +250,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
|
||||
~~~~~~~
|
||||
@@ -351,6 +395,9 @@ interface name. Better name it "bootnet" or "bluesocket".
|
||||
**biosdevname=0**::
|
||||
boolean, turn off biosdevname network interface renaming
|
||||
|
||||
**rd.neednet=1**::
|
||||
boolean, bring up network even without netroot set
|
||||
|
||||
**vlan=_<vlanname>_:_<phydevice>_**::
|
||||
Setup vlan device named <vlanname> on <phydeivce>.
|
||||
We support the four styles of vlan names: VLAN_PLUS_VID (vlan0005), VLAN_PLUS_VID_NO_PAD (vlan5),
|
||||
@@ -394,6 +441,31 @@ 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.
|
||||
+
|
||||
[WARNING]
|
||||
====
|
||||
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path.
|
||||
====
|
||||
|
||||
**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.
|
||||
+
|
||||
[WARNING]
|
||||
====
|
||||
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path.
|
||||
====
|
||||
|
||||
iSCSI
|
||||
~~~~~
|
||||
**root=**iscsi:[_<username>_:_<password>_[:_<reverse>_:_<password>_]@][_<servername>_]:[_<protocol>_]:[_<port>_][:[_<iscsi_iface_name>_]:[_<netdev_name>_]]:[_<LUN>_]:_<targetname>_::
|
||||
@@ -415,6 +487,11 @@ If servername is an IPv6 address, it has to be put in brackets. e.g.:
|
||||
----
|
||||
root=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
|
||||
----
|
||||
+
|
||||
[WARNING]
|
||||
====
|
||||
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path.
|
||||
====
|
||||
|
||||
**root=**_???_ **netroot=**iscsi:[_<username>_:_<password>_[:_<reverse>_:_<password>_]@][_<servername>_]:[_<protocol>_]:[_<port>_][:[_<iscsi_iface_name>_]:[_<netdev_name>_]]:[_<LUN>_]:_<targetname>_ ...::
|
||||
multiple netroot options allow setting up multiple iscsi disks. e.g.:
|
||||
@@ -430,9 +507,19 @@ If servername is an IPv6 address, it has to be put in brackets. e.g.:
|
||||
----
|
||||
netroot=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
|
||||
----
|
||||
+
|
||||
[WARNING]
|
||||
====
|
||||
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path. You may want to use rd.iscsi.firmware.
|
||||
====
|
||||
|
||||
**root=**_???_ **rd.iscsi.initiator=**_<initiator>_ **rd.iscsi.target.name=**_<target name>_ **rd.iscsi.target.ip=**_<target ip>_ **rd.iscsi.target.port=**_<target port>_ **rd.iscsi.target.group=**_<target group>_ **rd.iscsi.username=**_<username>_ **rd.iscsi.password=**_<password>_ **rd.iscsi.in.username=**_<in username>_ **rd.iscsi.in.password=**_<in password>_::
|
||||
manually specify all iscsistart parameter (see **+iscsistart --help+**)
|
||||
+
|
||||
[WARNING]
|
||||
====
|
||||
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path. You may want to use rd.iscsi.firmware.
|
||||
====
|
||||
|
||||
**root=**_???_ **netroot=**iscsi **rd.iscsi.firmware=1**::
|
||||
will read the iscsi parameter from the BIOS firmware
|
||||
@@ -443,7 +530,7 @@ netroot=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
|
||||
e.g.:
|
||||
+
|
||||
----
|
||||
"netroot=iscsi iscsi_firmware rd.iscsi.param=node.session.timeo.replacement_timeout=30"
|
||||
"netroot=iscsi rd.iscsi.firmware=1 rd.iscsi.param=node.session.timeo.replacement_timeout=30"
|
||||
----
|
||||
+
|
||||
will result in
|
||||
@@ -673,7 +760,7 @@ _/etc/conf.d/_::
|
||||
set in the configuration files.
|
||||
|
||||
_/etc/cmdline_::
|
||||
Can contain additional command line options.
|
||||
Can contain additional command line options. Deprecated, better use /etc/cmdline.d/*.conf.
|
||||
|
||||
_/etc/cmdline.d/*.conf_::
|
||||
Can contain additional command line options.
|
||||
|
@@ -12,10 +12,10 @@ fileloglvl=6
|
||||
# add_dracutmodules option instead.
|
||||
#dracutmodules+=""
|
||||
|
||||
# Dracut modules to omit
|
||||
# dracut modules to omit
|
||||
#omit_dracutmodules+=""
|
||||
|
||||
# Dracut modules to add to the default
|
||||
# dracut modules to add to the default
|
||||
#add_dracutmodules+=""
|
||||
|
||||
# additional kernel modules to the default
|
||||
@@ -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,12 @@ 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_cmdline=*"__parameters__"::
|
||||
Specify default kernel command line parameters
|
||||
|
||||
*kernel_only=*"__{yes|no}__"::
|
||||
Only install kernel drivers and firmware files. (default=no)
|
||||
|
||||
@@ -124,8 +130,8 @@ _/etc/dracut.conf_::
|
||||
Old configuration file. You better use your own file in
|
||||
_/etc/dracut/conf.d/_.
|
||||
|
||||
_/etc/dracut/conf.d/_::
|
||||
Any _/etc/dracut/conf.d/*.conf_ file can overwrite the values in
|
||||
_/etc/dracut.conf.d/_::
|
||||
Any _/etc/dracut.conf.d/*.conf_ file can overwrite the values in
|
||||
_/etc/dracut.conf_. The configuration files are read in alphanumerical
|
||||
order.
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# Dracut config file customized for RedHat/Fedora.
|
||||
# dracut config file customized for RedHat/Fedora.
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
|
||||
omit_drivers+=" .*/fs/ocfs/.* "
|
||||
omit_drivers+=" .*/fs/ocfs/.* i2o_scsi"
|
||||
stdloglvl=3
|
||||
install_items+=" vi /etc/virc ps grep cat rm "
|
||||
prefix="/"
|
||||
@@ -11,3 +11,4 @@ systemdsystemunitdir=/usr/lib/systemd/system
|
||||
udevdir=/usr/lib/udev
|
||||
add_dracutmodules+=" systemd "
|
||||
realinitpath="/usr/lib/systemd/systemd"
|
||||
kernelcmdline+=" rd.auto=1 "
|
@@ -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,14 @@
|
||||
# /etc/dracut.conf.d/gentoo.conf
|
||||
# Dracut config file customized for Gentoo Base System release 1
|
||||
# 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"
|
||||
|
||||
omit_drivers+=" i2o_scsi"
|
||||
|
@@ -1,2 +1,3 @@
|
||||
i18n_vars="/etc/sysconfig/language:RC_LANG-LANG,RC_LC_ALL-LC_ALL /etc/sysconfig/console:CONSOLE_UNICODEMAP-FONT_UNIMAP,CONSOLE_FONT-FONT,CONSOLE_SCREENMAP-FONT_MAP /etc/sysconfig/keyboard:KEYTABLE-KEYMAP"
|
||||
omit_drivers+=" i2o_scsi"
|
||||
|
||||
|
137
dracut.sh
137
dracut.sh
@@ -89,8 +89,9 @@ Creates initial ramdisk images for preloading modules
|
||||
firmwares, separated by :
|
||||
--kernel-only Only install kernel drivers and firmware files
|
||||
--no-kernel Do not install kernel drivers and firmware files
|
||||
--strip Strip binaries in the initramfs
|
||||
--nostrip Do not strip binaries in the initramfs (default)
|
||||
--kernel-cmdline [PARAMETERS] Specify default kernel command line parameters
|
||||
--strip Strip binaries in the initramfs (default)
|
||||
--nostrip Do not strip binaries in the initramfs
|
||||
--hardlink Hardlink files in the initramfs (default)
|
||||
--nohardlink Do not hardlink files in the initramfs
|
||||
--prefix [DIR] Prefix initramfs files with [DIR]
|
||||
@@ -101,6 +102,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
|
||||
@@ -126,12 +128,13 @@ 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]"
|
||||
Mount device [DEV] on mountpoint [MP] with filesystem
|
||||
[FSTYPE] and options [FSOPTS] in the initramfs
|
||||
--device "[DEV]" Bring up [DEV] in initramfs
|
||||
-i, --include [SOURCE] [TARGET]
|
||||
Include the files in the SOURCE directory into the
|
||||
Target directory in the final initramfs.
|
||||
@@ -244,7 +247,7 @@ set -- "${@/--include/++include}"
|
||||
set -- "${@/%-i/++include}"
|
||||
|
||||
TEMP=$(unset POSIXLY_CORRECT; getopt \
|
||||
-o "a:m:o:d:I:k:c:L:fvqlHhM" \
|
||||
-o "a:m:o:d:I:k:c:L:fvqlHhMN" \
|
||||
--long kver: \
|
||||
--long add: \
|
||||
--long force-add: \
|
||||
@@ -260,7 +263,9 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
|
||||
--long fscks: \
|
||||
--long add-fstab: \
|
||||
--long mount: \
|
||||
--long device: \
|
||||
--long nofscks: \
|
||||
--long ro-mnt \
|
||||
--long kmoddir: \
|
||||
--long conf: \
|
||||
--long confdir: \
|
||||
@@ -271,6 +276,7 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
|
||||
--long force \
|
||||
--long kernel-only \
|
||||
--long no-kernel \
|
||||
--long kernel-cmdline: \
|
||||
--long strip \
|
||||
--long nostrip \
|
||||
--long hardlink \
|
||||
@@ -325,7 +331,10 @@ while :; do
|
||||
--fscks) push fscks_l "$2"; shift;;
|
||||
--add-fstab) push add_fstab_l "$2"; shift;;
|
||||
--mount) push fstab_lines "$2"; shift;;
|
||||
--device) push host_devs "$2"; shift;;
|
||||
--kernel-cmdline) push kernel_cmdline_l "$2"; shift;;
|
||||
--nofscks) nofscks_l="yes";;
|
||||
--ro-mnt) ro_mnt_l="yes";;
|
||||
-k|--kmoddir) drivers_dir_l="$2"; shift;;
|
||||
-c|--conf) conffile="$2"; shift;;
|
||||
--confdir) confdir="$2"; shift;;
|
||||
@@ -356,7 +365,7 @@ while :; 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) long_usage; exit 1 ;;
|
||||
-i|--include) push include_src "$2"
|
||||
@@ -542,7 +551,7 @@ 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_strip ]] || do_strip=yes
|
||||
[[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l
|
||||
[[ $do_hardlink ]] || do_hardlink=yes
|
||||
[[ $prefix_l ]] && prefix=$prefix_l
|
||||
@@ -558,6 +567,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
[[ $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//:/ }
|
||||
|
||||
@@ -596,11 +606,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.'
|
||||
@@ -632,6 +649,12 @@ if (( ${#omit_drivers_l[@]} )); then
|
||||
fi
|
||||
omit_drivers=${omit_drivers/-/_}
|
||||
|
||||
if (( ${#kernel_cmdline_l[@]} )); then
|
||||
while pop kernel_cmdline_l val; do
|
||||
kernel_cmdline+=" $val "
|
||||
done
|
||||
fi
|
||||
|
||||
omit_drivers_corrected=""
|
||||
for d in $omit_drivers; do
|
||||
strstr " $drivers $add_drivers " " $d " && continue
|
||||
@@ -776,14 +799,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 \
|
||||
prefix
|
||||
prefix filesystems drivers
|
||||
|
||||
# Create some directory structure first
|
||||
[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
|
||||
@@ -799,7 +822,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"
|
||||
@@ -816,8 +839,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
|
||||
@@ -894,6 +917,18 @@ 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 ***"
|
||||
@@ -902,6 +937,8 @@ fi
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
(( ${#install_items[@]} > 0 )) && dracut_install ${install_items[@]}
|
||||
|
||||
echo "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
|
||||
|
||||
while pop fstab_lines line; do
|
||||
echo "$line 0 0" >> "${initdir}/etc/fstab"
|
||||
done
|
||||
@@ -965,6 +1002,31 @@ if (($maxloglvl >= 5)); then
|
||||
du -c "$initdir" | sort -n | ddebug
|
||||
fi
|
||||
|
||||
PRELINK_BIN=$(command -v prelink)
|
||||
if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
|
||||
if [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Pre-unlinking files ***"
|
||||
dracut_install -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
|
||||
chroot "$initdir" $PRELINK_BIN -u -a
|
||||
rm -f "$initdir"/$PRELINK_BIN
|
||||
rm -fr "$initdir"/etc/prelink.*
|
||||
dinfo "*** Pre-unlinking files done ***"
|
||||
else
|
||||
dinfo "*** Pre-linking files ***"
|
||||
dracut_install -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
|
||||
chroot "$initdir" $PRELINK_BIN -a
|
||||
rm -f "$initdir"/$PRELINK_BIN
|
||||
rm -fr "$initdir"/etc/prelink.*
|
||||
dinfo "*** Pre-linking files done ***"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $do_hardlink = yes ]] && command -v hardlink >/dev/null; then
|
||||
dinfo "*** Hardlinking files ***"
|
||||
hardlink "$initdir" 2>&1
|
||||
dinfo "*** Hardlinking files done ***"
|
||||
fi
|
||||
|
||||
# strip binaries
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
for p in strip xargs find; do
|
||||
@@ -975,40 +1037,31 @@ if [[ $do_strip = yes ]] ; then
|
||||
done
|
||||
fi
|
||||
|
||||
if strstr "$modules_loaded" " fips " && command -v prelink >/dev/null; then
|
||||
dinfo "*** pre-unlinking files ***"
|
||||
for dir in "$initdir/bin" \
|
||||
"$initdir/sbin" \
|
||||
"$initdir/usr/bin" \
|
||||
"$initdir/usr/sbin"; do
|
||||
[[ -L "$dir" ]] && continue
|
||||
for i in "$dir"/*; do
|
||||
[[ -L $i ]] && continue
|
||||
[[ -x $i ]] && prelink -u $i &>/dev/null
|
||||
done
|
||||
done
|
||||
dinfo "*** pre-unlinking files done ***"
|
||||
fi
|
||||
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
dinfo "*** Stripping files ***"
|
||||
find "$initdir" -type f \
|
||||
'(' -perm -0100 -or -perm -0010 -or -perm -0001 \
|
||||
-or -path '*/lib/modules/*.ko' ')' -print0 \
|
||||
| xargs -r -0 strip -g 2>/dev/null
|
||||
if [[ $DRACUT_FIPS_MODE ]]; then
|
||||
find "$initdir" -type f \
|
||||
'(' -perm -0100 -or -perm -0010 -or -perm -0001 \
|
||||
-or -path '*/lib/modules/*.ko' ')' -print0 \
|
||||
| while read -r -d $'\0' f; do
|
||||
if ! [[ -e "${f%/*}/.${f##*/}.hmac" ]] \
|
||||
&& ! [[ -e "/lib/fipscheck/${f##*/}.hmac" ]] \
|
||||
&& ! [[ -e "/lib64/fipscheck/${f##*/}.hmac" ]]; then
|
||||
echo -n "$f"; echo -n -e "\000"
|
||||
fi
|
||||
done |xargs -r -0 strip -g 2>/dev/null
|
||||
else
|
||||
find "$initdir" -type f \
|
||||
'(' -perm -0100 -or -perm -0010 -or -perm -0001 \
|
||||
-or -path '*/lib/modules/*.ko' ')' -print0 \
|
||||
| xargs -r -0 strip -g 2>/dev/null
|
||||
fi
|
||||
dinfo "*** Stripping files done ***"
|
||||
fi
|
||||
|
||||
if [[ $do_hardlink = yes ]] ; then
|
||||
type hardlink &>/dev/null && {
|
||||
dinfo "*** hardlinking files ***"
|
||||
hardlink "$initdir" 2>&1
|
||||
dinfo "*** hardlinking files done ***"
|
||||
}
|
||||
fi
|
||||
|
||||
rm -f "$outfile"
|
||||
dinfo "*** Creating image file ***"
|
||||
if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
|
||||
if ! ( umask 077; cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
|
||||
$compress > "$outfile"; ); then
|
||||
dfatal "dracut: creation of $outfile failed"
|
||||
exit 1
|
||||
|
19
dracut.spec
19
dracut.spec
@@ -81,7 +81,9 @@ 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
|
||||
Conflicts: systemd < 187
|
||||
@@ -95,14 +97,14 @@ Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
|
||||
%endif
|
||||
|
||||
%description
|
||||
Dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
|
||||
dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
|
||||
Unlike existing implementations, dracut does hard-code as little as possible
|
||||
into the initramfs. Dracut contains various modules which are driven by the
|
||||
into the initramfs. dracut contains various modules which are driven by the
|
||||
event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
|
||||
NFS, iSCSI, NBD, FCoE with the dracut-network package.
|
||||
|
||||
%package network
|
||||
Summary: Dracut modules to build a dracut initramfs with network support
|
||||
Summary: dracut modules to build a dracut initramfs with network support
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Obsoletes: dracut-generic < 008
|
||||
Provides: dracut-generic = %{version}-%{release}
|
||||
@@ -113,7 +115,7 @@ all purpose initramfs with network support with dracut.
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?suse_version}
|
||||
%package fips
|
||||
Summary: Dracut modules to build a dracut initramfs with an integrity check
|
||||
Summary: dracut modules to build a dracut initramfs with an integrity check
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: hmaccalc
|
||||
%if 0%{?rhel} > 5
|
||||
@@ -130,7 +132,7 @@ all purpose initramfs with dracut, which does an integrity check.
|
||||
%endif
|
||||
|
||||
%package fips-aesni
|
||||
Summary: Dracut modules to build a dracut initramfs with an integrity check with aesni-intel
|
||||
Summary: dracut modules to build a dracut initramfs with an integrity check with aesni-intel
|
||||
Requires: %{name}-fips = %{version}-%{release}
|
||||
|
||||
%description fips-aesni
|
||||
@@ -139,7 +141,7 @@ all purpose initramfs with dracut, which does an integrity check
|
||||
and adds the aesni-intel kernel module.
|
||||
|
||||
%package caps
|
||||
Summary: Dracut modules to build a dracut initramfs which drops capabilities
|
||||
Summary: dracut modules to build a dracut initramfs which drops capabilities
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: libcap
|
||||
|
||||
@@ -148,7 +150,7 @@ This package requires everything which is needed to build an
|
||||
all purpose initramfs with dracut, which drops capabilities.
|
||||
|
||||
%package tools
|
||||
Summary: Dracut tools to build the local initramfs
|
||||
Summary: dracut tools to build the local initramfs
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description tools
|
||||
@@ -258,6 +260,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%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*
|
||||
@@ -284,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
|
||||
@@ -325,6 +329,7 @@ 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
|
||||
|
@@ -63,8 +63,8 @@ static size_t dir_len(char const *file)
|
||||
{
|
||||
size_t length;
|
||||
/* Strip the basename and any redundant slashes before it. */
|
||||
for (length = strlen(file); 0 < length; length--)
|
||||
if (file[length] == '/')
|
||||
for (length = strlen(file)-1; 0 < length; length--)
|
||||
if (file[length] == '/' && file[length-1] != '/')
|
||||
break;
|
||||
return length;
|
||||
}
|
||||
@@ -91,7 +91,13 @@ static char *convert_abs_rel(const char *from, const char *target)
|
||||
return strdup(from);
|
||||
}
|
||||
|
||||
asprintf(&realtarget, "%s/%s", q, &p[dirlen + 1]);
|
||||
/* dir_len() skips double /'s e.g. //lib64, so we can't skip just one
|
||||
* character - need to skip all leading /'s */
|
||||
rl = strlen(target);
|
||||
for (i = dirlen+1; i < rl; ++i)
|
||||
if (p[i] != '/')
|
||||
break;
|
||||
asprintf(&realtarget, "%s/%s", q, &p[i]);
|
||||
free(p);
|
||||
free(q);
|
||||
|
||||
@@ -285,6 +291,9 @@ static int resolve_deps(const char *src)
|
||||
if (strstr(buf, "loader cannot load itself"))
|
||||
break;
|
||||
|
||||
if (strstr(buf, "not regular file"))
|
||||
break;
|
||||
|
||||
p = strstr(buf, "/");
|
||||
if (p) {
|
||||
int r;
|
||||
@@ -315,7 +324,7 @@ static int resolve_deps(const char *src)
|
||||
}
|
||||
|
||||
/* Install ".<filename>.hmac" file for FIPS self-checks */
|
||||
static int hmac_install(const char *src, const char *dst)
|
||||
static int hmac_install(const char *src, const char *dst, const char *hmacpath)
|
||||
{
|
||||
char *srcpath = strdup(src);
|
||||
char *dstpath = strdup(dst);
|
||||
@@ -326,10 +335,20 @@ static int hmac_install(const char *src, const char *dst)
|
||||
if (endswith(src, ".hmac"))
|
||||
return 0;
|
||||
|
||||
if (!hmacpath) {
|
||||
hmac_install(src, dst, "/lib/fipscheck");
|
||||
hmac_install(src, dst, "/lib64/fipscheck");
|
||||
}
|
||||
|
||||
srcpath[dlen] = '\0';
|
||||
dstpath[dir_len(dst)] = '\0';
|
||||
asprintf(&srchmacname, "%s/.%s.hmac", srcpath, &src[dlen + 1]);
|
||||
asprintf(&dsthmacname, "%s/.%s.hmac", dstpath, &src[dlen + 1]);
|
||||
if (hmacpath) {
|
||||
asprintf(&srchmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
|
||||
asprintf(&dsthmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
|
||||
} else {
|
||||
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, true);
|
||||
free(dsthmacname);
|
||||
@@ -392,10 +411,15 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
log_debug("'%s' already exists", fulldstpath);
|
||||
if (resolvedeps && S_ISREG(sb.st_mode) && (sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
|
||||
log_debug("'%s' already exists, but checking for any deps", fulldstpath);
|
||||
ret = resolve_deps(src);
|
||||
} else
|
||||
log_debug("'%s' already exists", fulldstpath);
|
||||
|
||||
free(fulldstpath);
|
||||
/* dst does already exist */
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* check destination directory */
|
||||
@@ -469,7 +493,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
free(abspath);
|
||||
if (arg_hmac) {
|
||||
/* copy .hmac files also */
|
||||
hmac_install(src, dst);
|
||||
hmac_install(src, dst, NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -480,7 +504,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
ret += resolve_deps(src);
|
||||
if (arg_hmac) {
|
||||
/* copy .hmac files also */
|
||||
hmac_install(src, dst);
|
||||
hmac_install(src, dst, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,13 +534,14 @@ Install SOURCE to DEST in DESTROOTDIR with all needed dependencies.\n\
|
||||
-d --dir SOURCE is a directory\n\
|
||||
-l --ldd Also install shebang executables and libraries\n\
|
||||
-R --resolvelazy Only install shebang executables and libraries for all SOURCE files\n\
|
||||
-f --fips Also install all '.SOURCE.hmac' files\n\
|
||||
-H --fips Also install all '.SOURCE.hmac' files\n\
|
||||
-v --verbose Show more output\n\
|
||||
--debug Show debug output\n\
|
||||
--version Show package version\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\
|
||||
@@ -644,6 +669,81 @@ static int resolve_lazy(int argc, char **argv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *find_binary(const char *src)
|
||||
{
|
||||
char *path;
|
||||
char *p, *q;
|
||||
bool end = false;
|
||||
char *newsrc = NULL;
|
||||
path = getenv("PATH");
|
||||
|
||||
if (path == NULL) {
|
||||
log_error("PATH is not set");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
path = strdup(path);
|
||||
p = path;
|
||||
log_debug("PATH=%s", path);
|
||||
|
||||
do {
|
||||
struct stat sb;
|
||||
|
||||
for (q = p; *q && *q != ':'; q++) ;
|
||||
|
||||
if (*q == '\0')
|
||||
end = true;
|
||||
else
|
||||
*q = '\0';
|
||||
|
||||
asprintf(&newsrc, "%s/%s", p, src);
|
||||
p = q + 1;
|
||||
|
||||
if (stat(newsrc, &sb) != 0) {
|
||||
log_debug("stat(%s) != 0", newsrc);
|
||||
free(newsrc);
|
||||
newsrc = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
end = true;
|
||||
|
||||
} while (!end);
|
||||
|
||||
free(path);
|
||||
if (newsrc)
|
||||
log_debug("find_binary(%s) == %s", src, newsrc);
|
||||
return newsrc;
|
||||
}
|
||||
|
||||
static int install_one(const char *src, const char *dst)
|
||||
{
|
||||
int r = 0;
|
||||
int ret;
|
||||
|
||||
if (strchr(src, '/') == NULL) {
|
||||
char *newsrc = find_binary(src);
|
||||
if (newsrc) {
|
||||
log_debug("dracut_install '%s' '%s'", newsrc, dst);
|
||||
ret = dracut_install(newsrc, dst, arg_createdir, arg_resolvedeps, true);
|
||||
if (ret == 0) {
|
||||
log_debug("dracut_install '%s' '%s' OK", newsrc, dst);
|
||||
}
|
||||
free(newsrc);
|
||||
} else {
|
||||
ret = -1;
|
||||
}
|
||||
} else {
|
||||
ret = dracut_install(src, dst, arg_createdir, arg_resolvedeps, true);
|
||||
}
|
||||
|
||||
if ((ret != 0) && (!arg_optional)) {
|
||||
log_error("ERROR: installing '%s' to '%s'", src, dst);
|
||||
r = EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static int install_all(int argc, char **argv)
|
||||
{
|
||||
int r = 0;
|
||||
@@ -653,50 +753,18 @@ static int install_all(int argc, char **argv)
|
||||
log_debug("Handle '%s'", argv[i]);
|
||||
|
||||
if (strchr(argv[i], '/') == NULL) {
|
||||
char *path;
|
||||
char *p, *q;
|
||||
bool end = false;
|
||||
path = getenv("PATH");
|
||||
if (path == NULL) {
|
||||
log_error("PATH is not set");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
path = strdup(path);
|
||||
p = path;
|
||||
log_debug("PATH=%s", path);
|
||||
do {
|
||||
char *newsrc = NULL;
|
||||
char *dest;
|
||||
struct stat sb;
|
||||
|
||||
for (q = p; *q && *q != ':'; q++) ;
|
||||
|
||||
if (*q == '\0')
|
||||
end = true;
|
||||
else
|
||||
*q = '\0';
|
||||
|
||||
asprintf(&newsrc, "%s/%s", p, argv[i]);
|
||||
p = q + 1;
|
||||
|
||||
if (stat(newsrc, &sb) != 0) {
|
||||
free(newsrc);
|
||||
ret = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
dest = strdup(newsrc);
|
||||
|
||||
char *newsrc = find_binary(argv[i]);
|
||||
if (newsrc) {
|
||||
log_debug("dracut_install '%s'", newsrc);
|
||||
ret = dracut_install(newsrc, dest, arg_createdir, arg_resolvedeps, true);
|
||||
ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true);
|
||||
if (ret == 0) {
|
||||
end = true;
|
||||
log_debug("dracut_install '%s' OK", newsrc);
|
||||
}
|
||||
free(newsrc);
|
||||
free(dest);
|
||||
} while (!end);
|
||||
free(path);
|
||||
} else {
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
} else {
|
||||
char *dest = strdup(argv[i]);
|
||||
ret = dracut_install(argv[i], dest, arg_createdir, arg_resolvedeps, true);
|
||||
@@ -742,9 +810,17 @@ int main(int argc, char **argv)
|
||||
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);
|
||||
|
||||
@@ -775,11 +851,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, true);
|
||||
if ((r != 0) && (!arg_optional)) {
|
||||
log_error("ERROR: installing '%s' to '%s'", argv[optind], argv[optind + 1]);
|
||||
r = EXIT_FAILURE;
|
||||
}
|
||||
r = install_one(argv[optind], argv[optind + 1]);
|
||||
}
|
||||
|
||||
if (arg_optional)
|
||||
|
Binary file not shown.
@@ -21,7 +21,7 @@
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "Usage: $(basename $0) [-s] [<initramfs file> [<filename>]]"
|
||||
echo "Usage: $(${0##*/}) [-s] [<initramfs file> [<filename>]]"
|
||||
}
|
||||
|
||||
[[ $# -le 2 ]] || { usage ; exit 1 ; }
|
||||
@@ -70,6 +70,6 @@ echo "========================================================================"
|
||||
if [ "$sorted" -eq 1 ]; then
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
else
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
|
||||
fi
|
||||
echo "========================================================================"
|
||||
|
@@ -32,8 +32,6 @@ mount_boot()
|
||||
udevadm settle --timeout=30
|
||||
fi
|
||||
[ -e $boot ] && break
|
||||
modprobe scsi_wait_scan && rmmod scsi_wait_scan
|
||||
[ -e $boot ] && break
|
||||
sleep 0.5
|
||||
i=$(($i+1))
|
||||
[ $i -gt 40 ] && break
|
||||
@@ -45,23 +43,23 @@ mount_boot()
|
||||
mkdir /boot
|
||||
info "Mounting $boot as /boot"
|
||||
mount -oro "$boot" /boot || return 1
|
||||
elif [ -d "$NEWROOT/boot" ]; then
|
||||
rm -fr /boot
|
||||
ln -sf "$NEWROOT/boot" /boot
|
||||
fi
|
||||
}
|
||||
|
||||
do_fips()
|
||||
{
|
||||
info "Checking integrity of kernel"
|
||||
newroot=$NEWROOT
|
||||
KERNEL=$(uname -r)
|
||||
|
||||
[ -e "$newroot/boot/.vmlinuz-${KERNEL}.hmac" ] || unset newroot
|
||||
|
||||
if ! [ -e "$newroot/boot/.vmlinuz-${KERNEL}.hmac" ]; then
|
||||
warn "$newroot/boot/.vmlinuz-${KERNEL}.hmac does not exist"
|
||||
if ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
|
||||
warn "/boot/.vmlinuz-${KERNEL}.hmac does not exist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
sha512hmac -c "$newroot/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
|
||||
|
@@ -24,7 +24,6 @@ installkernel() {
|
||||
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
fi
|
||||
done
|
||||
hostonly='' instmods scsi_wait_scan
|
||||
}
|
||||
|
||||
install() {
|
||||
@@ -33,11 +32,11 @@ install() {
|
||||
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
|
||||
inst_script "$moddir/fips.sh" /sbin/fips.sh
|
||||
|
||||
dracut_install sha512hmac rmmod insmod mount uname umount
|
||||
dracut_install sha512hmac rmmod insmod mount uname umount fipscheck
|
||||
|
||||
inst_libdir_file libsoftokn3.so libsoftokn3.so \
|
||||
libsoftokn3.chk libfreebl3.so libfreebl3.chk \
|
||||
'hmaccalc/sha512hmac.hmac'
|
||||
libssl.so 'hmaccalc/sha512hmac.hmac'
|
||||
|
||||
dracut_install -o prelink
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,12 @@
|
||||
#!/bin/sh
|
||||
if [ -e /dev/watchdog ]; then
|
||||
if [ ! -e /tmp/watchdog_timeout ]; then
|
||||
wdctl -s 60 /dev/watchdog >/dev/null 2>&1
|
||||
> /tmp/watchdog_timeout
|
||||
fi
|
||||
info "Triggering watchdog"
|
||||
>/dev/watchdog
|
||||
else
|
||||
modprobe ib700wdt
|
||||
modprobe i6300esb
|
||||
fi
|
||||
|
@@ -13,9 +13,10 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
local _i _progs _path
|
||||
inst busybox /usr/bin/busybox
|
||||
for _i in `/sbin/busybox | sed -ne '1,/Currently/!{s/,//g; s/busybox//g; p}'`
|
||||
local _i _progs _path _busybox
|
||||
_busybox=$(type -P busybox)
|
||||
inst $_busybox /usr/bin/busybox
|
||||
for _i in $($_busybox | sed -ne '1,/Currently/!{s/,//g; s/busybox//g; p}')
|
||||
do
|
||||
_progs="$_progs $_i"
|
||||
done
|
||||
@@ -26,11 +27,7 @@ install() {
|
||||
for _i in $_progs; do
|
||||
_path=$(find_binary "$_i")
|
||||
[ -z "$_path" ] && continue
|
||||
if [[ $_path != ${_path#/usr} ]]; then
|
||||
ln -sf ../../usr/bin/busybox "$initdir/$_path"
|
||||
else
|
||||
ln -sf ../usr/bin/busybox "$initdir/$_path"
|
||||
fi
|
||||
ln_r /usr/bin/busybox $_path
|
||||
done
|
||||
}
|
||||
|
||||
|
@@ -1,2 +1,2 @@
|
||||
# Console initialization - keyboard, font, etc.
|
||||
KERNEL=="tty0", RUN+="/lib/udev/console_init $root/$name"
|
||||
KERNEL=="tty0", RUN+="/sbin/initqueue --onetime --unique --name console_init_$name /lib/udev/console_init $root/$name"
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Dracut i18n module
|
||||
dracut i18n module
|
||||
------------------
|
||||
|
||||
INDEX
|
||||
@@ -21,7 +21,7 @@ is intended to be generic across different GNU/Linux distributions.
|
||||
i18n and keyboard settings are stored in different files among
|
||||
distributions. To deal with it avoiding hardcoding those differences in
|
||||
the installation script we handle it by mappings between variables used
|
||||
by Dracut and the ones in the system. Package maintainer is expected to
|
||||
by dracut and the ones in the system. Package maintainer is expected to
|
||||
create those for his/her distribution and it's appreciated to share it
|
||||
with us, so we can include it in source package.
|
||||
|
||||
|
@@ -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
|
||||
@@ -96,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
|
||||
@@ -173,7 +173,7 @@ install() {
|
||||
|
||||
inst_opt_decompress ${kbddir}/consolefonts/${DEFAULT_FONT}.*
|
||||
|
||||
if [[ ${FONT} ]]
|
||||
if [[ ${FONT} ]] && [[ ${FONT} != ${DEFAULT_FONT} ]]
|
||||
then
|
||||
FONT=${FONT%.psf*}
|
||||
inst_opt_decompress ${kbddir}/consolefonts/${FONT}.*
|
||||
|
@@ -13,18 +13,18 @@ inst_key_val() {
|
||||
_value=$(getarg $@)
|
||||
[ -z "${_value}" ] && _value=$_default
|
||||
if [ -n "${_value}" ]; then
|
||||
printf '%s="%s"\n' $1 ${_value} >> $_file
|
||||
printf '%s="%s"\n' $2 ${_value} >> $_file
|
||||
fi
|
||||
unset _file
|
||||
unset _value
|
||||
}
|
||||
|
||||
inst_key_val '' /etc/vconsole.conf KEYMAP vconsole.keymap KEYTABLE
|
||||
inst_key_val '' /etc/vconsole.conf FONT vconsole.font SYSFONT
|
||||
inst_key_val '' /etc/vconsole.conf FONT_MAP vconsole.font.map CONTRANS
|
||||
inst_key_val '' /etc/vconsole.conf FONT_UNIMAP vconsole.font.unimap UNIMAP
|
||||
inst_key_val 1 /etc/vconsole.conf UNICODE vconsole.unicode vconsole.font.unicode
|
||||
inst_key_val '' /etc/vconsole.conf EXT_KEYMAP vconsole.keymap.ext
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.keymap KEYMAP -d KEYTABLE
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.font FONT -d SYSFONT
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.font.map FONT_MAP -d CONTRANS
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.font.unimap FONT_UNIMAP -d UNIMAP
|
||||
inst_key_val 1 /etc/vconsole.conf vconsole.font.unicode UNICODE vconsole.unicode
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.keymap.ext EXT_KEYMAP
|
||||
|
||||
inst_key_val '' /etc/locale.conf LANG locale.LANG
|
||||
inst_key_val '' /etc/locale.conf LC_ALL locale.LC_ALL
|
||||
@@ -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
|
||||
|
@@ -73,13 +73,35 @@ if [[ ! -e "$testfile" ]]; then
|
||||
fi
|
||||
rm -f "$testfile"
|
||||
|
||||
ismounted() {
|
||||
while read a m a; do
|
||||
[[ "$m" = "$1" ]] && return 0
|
||||
find_mount() {
|
||||
local dev mnt etc wanted_dev
|
||||
wanted_dev="$(readlink -e -q $1)"
|
||||
while read dev mnt etc; do
|
||||
[ "$dev" = "$wanted_dev" ] && echo "$dev" && return 0
|
||||
done < /proc/mounts
|
||||
return 1
|
||||
}
|
||||
|
||||
# usage: ismounted <mountpoint>
|
||||
# usage: ismounted /dev/<device>
|
||||
if command -v findmnt >/dev/null; then
|
||||
ismounted() {
|
||||
findmnt "$1" > /dev/null 2>&1
|
||||
}
|
||||
else
|
||||
ismounted() {
|
||||
if [ -b "$1" ]; then
|
||||
find_mount "$1" > /dev/null && return 0
|
||||
return 1
|
||||
fi
|
||||
|
||||
while read a m a; do
|
||||
[ "$m" = "$1" ] && return 0
|
||||
done < /proc/mounts
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
|
||||
# clean up after ourselves no matter how we die.
|
||||
cleanup() {
|
||||
echo "Something failed. Move back to the original state"
|
||||
|
@@ -88,13 +88,6 @@ do_ipv6auto() {
|
||||
wait_for_if_up $netif
|
||||
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
|
||||
namesrv=$(getargs nameserver)
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
}
|
||||
|
||||
# Handle static ip configuration
|
||||
@@ -115,13 +108,6 @@ do_static() {
|
||||
|
||||
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
|
||||
namesrv=$(getargs nameserver)
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
}
|
||||
|
||||
# loopback is always handled the same way
|
||||
@@ -220,6 +206,14 @@ if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
|
||||
ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname; echo $?)"
|
||||
fi
|
||||
|
||||
# setup nameserver
|
||||
namesrv=$(getargs nameserver)
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
|
||||
# No ip lines default to dhcp
|
||||
ip=$(getarg ip)
|
||||
|
||||
|
@@ -64,20 +64,13 @@ installkernel() {
|
||||
{ find_kernel_modules_by_path drivers/net; if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then find_kernel_modules_by_path drivers/s390/net; fi; } \
|
||||
| net_module_filter | instmods
|
||||
|
||||
instmods =drivers/net/phy
|
||||
instmods ecb arc4
|
||||
# bridge modules
|
||||
instmods bridge stp llc
|
||||
instmods ipv6
|
||||
# bonding
|
||||
instmods bonding
|
||||
# vlan
|
||||
instmods 8021q
|
||||
instmods =drivers/net/phy ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net
|
||||
}
|
||||
|
||||
install() {
|
||||
local _arch _i _dir
|
||||
dracut_install ip arping dhclient sed
|
||||
dracut_install -o ping ping6
|
||||
dracut_install -o brctl
|
||||
inst_script "$moddir/ifup.sh" "/sbin/ifup"
|
||||
inst_script "$moddir/netroot.sh" "/sbin/netroot"
|
||||
|
@@ -15,7 +15,9 @@ fix_bootif() {
|
||||
}
|
||||
|
||||
# Don't continue if we don't need network
|
||||
[ -z "$netroot" ] && ! [ -e "/tmp/net.ifaces" ] && return;
|
||||
if [ -z "$netroot" ] && [ ! -e "/tmp/net.ifaces" ] && ! getargbool 0 rd.neednet >/dev/null; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Write udev rules
|
||||
{
|
||||
|
@@ -145,8 +145,8 @@ ibft_to_cmdline() {
|
||||
for iface in /sys/firmware/ibft/ethernet*; do
|
||||
[ -e ${iface}/mac ] || continue
|
||||
mac=$(read a < ${iface}/mac; echo $a)
|
||||
[ -z "$ifname_mac" ] && continue
|
||||
dev=$(set_ifname ibft $ifname_mac)
|
||||
[ -z "$mac" ] && continue
|
||||
dev=$(set_ifname ibft $mac)
|
||||
dhcp=$(read a < ${iface}/dhcp; echo $a)
|
||||
if [ -n "$dhcp" ]; then
|
||||
echo "ip=$dev:dhcp"
|
||||
|
@@ -40,9 +40,10 @@ fi
|
||||
unset count
|
||||
|
||||
# If needed, check if bootdev= contains anything usable
|
||||
BOOTDEV=$(getarg bootdev=)
|
||||
|
||||
if [ -n "$NEEDBOOTDEV" ] ; then
|
||||
BOOTDEV=$(getarg bootdev=) || die "Please supply bootdev argument for multiple ip= lines"
|
||||
[ -z "$BOOTDEV" ] && die "Bootdev argument is empty"
|
||||
[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
|
||||
fi
|
||||
|
||||
# If ibft is requested, read ibft vals and write ip=XXX cmdline args
|
||||
@@ -96,9 +97,6 @@ for p in $(getargs ip=); do
|
||||
IFACES="$IFACES $dev"
|
||||
fi
|
||||
|
||||
# Small optimization for udev rules
|
||||
[ -z "$NEEDBOOTDEV" ] && [ -n "$dev" ] && BOOTDEV=$dev
|
||||
|
||||
# Do we need to check for specific options?
|
||||
if [ -n "$NEEDDHCP" ] || [ -n "$DHCPORSERVER" ] ; then
|
||||
# Correct device? (Empty is ok as well)
|
||||
|
@@ -85,6 +85,7 @@ print_s390() {
|
||||
|
||||
|
||||
for netif in $IFACES ; do
|
||||
[ -e /tmp/ifcfg/ifcfg-$netif ] && continue
|
||||
# bridge?
|
||||
unset bridge
|
||||
unset bond
|
||||
@@ -105,6 +106,7 @@ for netif in $IFACES ; do
|
||||
[ -n "$mtu" ] && echo "MTU=$mtu"
|
||||
if [ -f /tmp/net.$netif.lease ]; then
|
||||
strstr "$ip" '*:*:*' &&
|
||||
echo "IPV6INIT=yes"
|
||||
echo "DHCPV6C=yes"
|
||||
echo "BOOTPROTO=dhcp"
|
||||
cp /tmp/net.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease
|
||||
@@ -112,6 +114,7 @@ for netif in $IFACES ; do
|
||||
# If we've booted with static ip= lines, the override file is there
|
||||
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
if strstr "$ip" '*:*:*'; then
|
||||
echo "IPV6INIT=yes"
|
||||
echo "IPV6_AUTOCONF=no"
|
||||
echo "IPV6ADDR=$ip/$mask"
|
||||
else
|
||||
|
@@ -14,6 +14,12 @@ depends() {
|
||||
install() {
|
||||
inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
|
||||
dracut_install curl
|
||||
# also install libs for curl https
|
||||
inst_libdir_file "libnsspem.so*"
|
||||
inst_libdir_file "libnsssysinit.so*"
|
||||
inst_libdir_file "libsoftokn3.so*"
|
||||
inst_libdir_file "libsqlite3.so*"
|
||||
|
||||
mkdir -m 0755 -p "$initdir/etc/ssl/certs"
|
||||
if ! inst_any -t /etc/ssl/certs/ca-bundle.crt \
|
||||
/etc/ssl/certs/ca-bundle.crt \
|
||||
|
@@ -55,6 +55,7 @@ add_url_handler() {
|
||||
export CURL_HOME="/run/initramfs/url-lib"
|
||||
mkdir -p $CURL_HOME
|
||||
curl_args="--location --retry 3 --fail --show-error"
|
||||
getargbool 0 rd.noverifyssl && curl_args+=" --insecure"
|
||||
|
||||
curl_fetch_url() {
|
||||
local url="$1" outloc="$2"
|
||||
@@ -66,7 +67,10 @@ curl_fetch_url() {
|
||||
( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
|
||||
outloc="$outdir/$(ls -A $outdir)"
|
||||
fi
|
||||
[ -f "$outloc" ] || return 253
|
||||
if ! [ -f "$outloc" ]; then
|
||||
warn "Downloading '$url' failed!"
|
||||
return 253
|
||||
fi
|
||||
if [ -z "$2" ]; then echo "$outloc" ; fi
|
||||
}
|
||||
add_url_handler curl_fetch_url http https ftp
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Dracut gensplash module
|
||||
dracut gensplash module
|
||||
-----------------------
|
||||
|
||||
INDEX
|
||||
|
@@ -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
|
||||
|
@@ -76,9 +76,5 @@ install() {
|
||||
inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
|
||||
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
|
||||
dracut_install readlink
|
||||
|
||||
if [[ -x $systemdutildir/systemd ]]; then
|
||||
dracut_install -o $systemdsystemunitdir/plymouth-quit-wait.service
|
||||
fi
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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"
|
||||
}
|
||||
|
31
modules.d/90crypt/crypt-run-generator.sh
Executable file
31
modules.d/90crypt/crypt-run-generator.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/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
|
||||
|
||||
# parse for allow-discards
|
||||
if strstr "$(cryptsetup --help)" "allow-discards"; then
|
||||
if discarduuids=$(getargs "rd.luks.allow-discards"); then
|
||||
if strstr " $discarduuids " " ${luks##luks-}"; then
|
||||
allowdiscards="allow-discards"
|
||||
fi
|
||||
elif getargbool rd.luks.allow-discards; then
|
||||
allowdiscards="allow-discards"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$luks $dev none $allowdiscards" >> /etc/crypttab
|
||||
|
||||
if command -v systemctl >/dev/null; then
|
||||
systemctl daemon-reload
|
||||
systemctl start cryptsetup.target
|
||||
fi
|
||||
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
|
||||
|
@@ -47,7 +47,17 @@ install() {
|
||||
inst_hook cmdline 10 "$moddir/parse-keydev.sh"
|
||||
inst_hook cmdline 30 "$moddir/parse-crypt.sh"
|
||||
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
|
||||
inst_simple /etc/crypttab
|
||||
[[ $hostonly ]] && 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
|
||||
@@ -34,12 +47,20 @@ else
|
||||
printf -- 'warn "crypto LUKS UUID "%s" not found"\n' $luksid
|
||||
} >> $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
|
||||
elif getargbool 0 rd.auto; then
|
||||
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
|
||||
|
@@ -13,6 +13,7 @@ depends() {
|
||||
|
||||
installkernel() {
|
||||
instmods =drivers/md
|
||||
instmods dm_mod
|
||||
}
|
||||
|
||||
install() {
|
||||
|
@@ -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,40 +4,44 @@
|
||||
|
||||
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"
|
||||
if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
|
||||
|
||||
# run dmraid if udev has settled
|
||||
info "Scanning for dmraid devices $DM_RAIDS"
|
||||
SETS=$(dmraid -c -s)
|
||||
DM_CLEANUP="no"
|
||||
|
||||
if [ "$SETS" = "no raid disks" -o "$SETS" = "no raid sets" ]; then
|
||||
return
|
||||
fi
|
||||
# run dmraid if udev has settled
|
||||
info "Scanning for dmraid devices $DM_RAIDS"
|
||||
SETS=$(dmraid -c -s)
|
||||
|
||||
info "Found dmraid sets:"
|
||||
echo $SETS|vinfo
|
||||
if [ "$SETS" = "no raid disks" -o "$SETS" = "no raid sets" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "$DM_RAIDS" ]; then
|
||||
info "Found dmraid sets:"
|
||||
echo $SETS|vinfo
|
||||
|
||||
if [ -n "$DM_RAIDS" ]; then
|
||||
# only activate specified DM RAIDS
|
||||
for r in $DM_RAIDS; do
|
||||
for s in $SETS; do
|
||||
if [ "${s##$r}" != "$s" ]; then
|
||||
info "Activating $s"
|
||||
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
|
||||
[ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" 2>&1 | vinfo
|
||||
udevsettle
|
||||
fi
|
||||
for r in $DM_RAIDS; do
|
||||
for s in $SETS; do
|
||||
if [ "${s##$r}" != "$s" ]; then
|
||||
info "Activating $s"
|
||||
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
|
||||
[ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" 2>&1 | vinfo
|
||||
udevsettle
|
||||
fi
|
||||
done
|
||||
done
|
||||
done
|
||||
else
|
||||
else
|
||||
# scan and activate all DM RAIDS
|
||||
for s in $SETS; do
|
||||
info "Activating $s"
|
||||
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
|
||||
[ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" 2>&1 | vinfo
|
||||
done
|
||||
fi
|
||||
for s in $SETS; do
|
||||
info "Activating $s"
|
||||
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
|
||||
[ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" 2>&1 | vinfo
|
||||
done
|
||||
fi
|
||||
|
||||
need_shutdown
|
||||
need_shutdown
|
||||
|
||||
fi
|
||||
|
@@ -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,23 @@
|
||||
# -*- 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
|
||||
|
||||
DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=)
|
||||
|
||||
if [ -z "$DM_RAIDS" ] && ! getargbool 0 rd.auto; then
|
||||
udevproperty rd_NO_DM=1
|
||||
fi
|
||||
|
@@ -2,14 +2,16 @@
|
||||
|
||||
if [ -b /dev/mapper/live-rw ] && [ -d /updates ]; then
|
||||
info "Applying updates to live image..."
|
||||
mount -o bind /run $NEWROOT/run
|
||||
# avoid overwriting symlinks (e.g. /lib -> /usr/lib) with directories
|
||||
(
|
||||
cd /updates
|
||||
find . -depth -type d | while read dir; do
|
||||
[ -d "$NEWROOT/$dir" ] || mkdir -p "$NEWROOT/$dir"
|
||||
mkdir -p "$NEWROOT/$dir"
|
||||
done
|
||||
find . -depth \! -type d | while read file; do
|
||||
cp -a "$file" "$NEWROOT/$file"
|
||||
done
|
||||
)
|
||||
umount $NEWROOT/run
|
||||
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
|
||||
@@ -98,7 +98,7 @@ do_live_overlay() {
|
||||
if [ -f /run/initramfs/overlayfs$pathspec -a -w /run/initramfs/overlayfs$pathspec ]; then
|
||||
losetup $OVERLAY_LOOPDEV /run/initramfs/overlayfs$pathspec
|
||||
if [ -n "$reset_overlay" ]; then
|
||||
dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k count=1 2>/dev/null
|
||||
dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k count=1 conv=fsync 2>/dev/null
|
||||
fi
|
||||
setup="yes"
|
||||
fi
|
||||
@@ -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
|
||||
|
@@ -35,24 +35,28 @@ installkernel() {
|
||||
return 0
|
||||
}
|
||||
|
||||
hostonly='' instmods sr_mod sd_mod scsi_dh scsi_dh_rdac scsi_dh_emc ata_piix
|
||||
hostonly='' instmods pcmcia firewire-ohci
|
||||
hostonly='' instmods usb_storage sdhci sdhci-pci
|
||||
hostonly='' instmods sr_mod sd_mod scsi_dh scsi_dh_rdac scsi_dh_emc ata_piix \
|
||||
pcmcia firewire-ohci yenta_socket \
|
||||
usb_storage sdhci sdhci-pci \
|
||||
sdhci_esdhc_imx mmci sdhci_tegra mvsdio \
|
||||
omap omapdrm omap_hsmmc sdhci_dove ahci_platform pata_imx sata_mv \
|
||||
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 \
|
||||
unix
|
||||
|
||||
# arm specific modules
|
||||
hostonly='' instmods sdhci_esdhc_imx mmci sdhci_tegra mvsdio omap omapdrm sdhci_dove ahci_platform pata_imx sata_mv
|
||||
# install virtual machine support
|
||||
instmods virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
|
||||
"=drivers/pcmcia" =ide "=drivers/usb/storage"
|
||||
|
||||
# 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 hid_generic
|
||||
# install unix socket support
|
||||
hostonly='' instmods unix
|
||||
instmods "=drivers/pcmcia" =ide "=drivers/usb/storage"
|
||||
find_kernel_modules | block_module_filter | instmods
|
||||
|
||||
# if not on hostonly mode, install all known filesystems,
|
||||
# if the required list is not set via the filesystems variable
|
||||
if ! [[ $hostonly ]]; then
|
||||
if [[ -z $filesystems ]]; then
|
||||
omit_drivers="$omit_drivers|kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd" omit_drivers="${omit_drivers##|}" instmods '=fs'
|
||||
omit_drivers="${omit_drivers}|kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd" \
|
||||
omit_drivers="${omit_drivers##|}" \
|
||||
instmods '=fs'
|
||||
fi
|
||||
else
|
||||
inst_fs() {
|
||||
@@ -61,23 +65,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,lib}/modprobe.d/ -maxdepth 1 -type f -name '*.conf')
|
||||
dracut_install -o /lib/modprobe.d/*.conf
|
||||
[[ $hostonly ]] && dracut_install -o /etc/modprobe.d/*.conf /etc/modprobe.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
|
||||
|
@@ -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
|
||||
|
@@ -9,7 +9,7 @@ check() {
|
||||
|
||||
check_lvm() {
|
||||
local DM_VG_NAME DM_LV_NAME DM_UDEV_DISABLE_DISK_RULES_FLAG
|
||||
eval $(udevadm info --query=property --name=$1|egrep '(DM_VG_NAME|DM_LV_NAME|DM_UDEV_DISABLE_DISK_RULES_FLAG)=')
|
||||
eval $(udevadm info --query=property --name=/dev/block/$1|egrep '(DM_VG_NAME|DM_LV_NAME|DM_UDEV_DISABLE_DISK_RULES_FLAG)=')
|
||||
[[ "$DM_UDEV_DISABLE_DISK_RULES_FLAG" = "1" ]] && return 1
|
||||
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
|
||||
if ! strstr " ${_activated[*]} " " ${DM_VG_NAME}/${DM_LV_NAME} "; then
|
||||
@@ -22,7 +22,7 @@ check() {
|
||||
}
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_fs check_lvm || return 1
|
||||
for_each_host_dev_and_slaves check_lvm || return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
|
@@ -1,15 +1,18 @@
|
||||
#!/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
|
||||
LV_DEVS="$(getargs rd.lvm.vg -d rd_LVM_VG=) $(getargs rd.lvm.lv -d rd_LVM_LV=)"
|
||||
|
||||
if ! getargbool 1 rd.lvm -d -n rd_NO_LVM \
|
||||
|| ( [ -z "$LV_DEVS" ] && ! getargbool 0 rd.auto ); 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 $LV_DEVS; do
|
||||
wait_for_dev "/dev/$dev"
|
||||
done
|
||||
fi
|
||||
|
@@ -5,7 +5,11 @@
|
||||
ACTION!="add|change", GOTO="md_end"
|
||||
SUBSYSTEM!="block", GOTO="md_end"
|
||||
ENV{rd_NO_MD}=="?*", GOTO="md_end"
|
||||
KERNEL=="md*", GOTO="md_end"
|
||||
KERNEL=="md*", ENV{ID_FS_TYPE}!="linux_raid_member", GOTO="md_end"
|
||||
KERNEL=="md*", ACTION!="change", 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"
|
||||
|
@@ -14,11 +14,11 @@ for md in /dev/md[0-9_]*; do
|
||||
containers="$containers $md"
|
||||
continue
|
||||
fi
|
||||
mdadm $_offroot -S "$md" >/dev/null 2>&1 || need_shutdown
|
||||
mdadm $_offroot -S "$md" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
for md in $containers; do
|
||||
mdadm $_offroot -S "$md" >/dev/null 2>&1 || need_shutdown
|
||||
mdadm $_offroot -S "$md" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
unset containers udevinfo _offroot
|
||||
|
11
modules.d/90mdraid/mdraid-needshutdown.sh
Executable file
11
modules.d/90mdraid/mdraid-needshutdown.sh
Executable file
@@ -0,0 +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
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
for md in /dev/md[0-9_]*; do
|
||||
[ -b "$md" ] || continue
|
||||
need_shutdown
|
||||
break
|
||||
done
|
@@ -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)
|
||||
@@ -64,10 +66,10 @@ install() {
|
||||
inst_rules "$moddir/65-md-incremental-imsm.rules"
|
||||
|
||||
# guard against pre-3.0 mdadm versions, that can't handle containers
|
||||
if ! mdadm -Q -e imsm /dev/null &> /dev/null; then
|
||||
if ! mdadm -Q -e imsm /dev/null >/dev/null 2>&1; then
|
||||
inst_hook pre-trigger 30 "$moddir/md-noimsm.sh"
|
||||
fi
|
||||
if ! mdadm -Q -e ddf /dev/null &> /dev/null; then
|
||||
if ! mdadm -Q -e ddf /dev/null >/dev/null 2>&1; then
|
||||
inst_hook pre-trigger 30 "$moddir/md-noddf.sh"
|
||||
fi
|
||||
|
||||
@@ -82,6 +84,7 @@ install() {
|
||||
inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh"
|
||||
inst_hook pre-trigger 30 "$moddir/parse-md.sh"
|
||||
inst_hook pre-mount 10 "$moddir/mdraid-waitclean.sh"
|
||||
inst_hook cleanup 99 "$moddir/mdraid-needshutdown.sh"
|
||||
inst_hook shutdown 30 "$moddir/md-shutdown.sh"
|
||||
inst_script "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
|
||||
inst_script "$moddir/mdraid_start.sh" /sbin/mdraid_start
|
||||
|
@@ -1,12 +1,13 @@
|
||||
#!/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
|
||||
|
||||
MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
|
||||
|
||||
if ( ! [ -n "$MD_UUID" ] && ! getargbool 0 rd.auto ) || ! 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=)
|
||||
|
||||
# rewrite the md rules to only process the specified raid array
|
||||
if [ -n "$MD_UUID" ]; then
|
||||
for f in /etc/udev/rules.d/65-md-incremental*.rules; do
|
||||
@@ -29,25 +30,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
|
||||
|
@@ -8,15 +8,14 @@ check() {
|
||||
type -P multipath >/dev/null || return 1
|
||||
|
||||
is_mpath() {
|
||||
local _dev
|
||||
_dev=$(get_maj_min $1)
|
||||
local _dev=$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
|
||||
}
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_fs is_mpath || return 1
|
||||
for_each_host_dev_and_slaves is_mpath || return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
@@ -24,6 +23,7 @@ check() {
|
||||
|
||||
depends() {
|
||||
echo rootfs-block
|
||||
echo dm
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -70,21 +70,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 2>&1; then
|
||||
vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
|
||||
(($? != 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 2>&1; then
|
||||
vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
|
||||
(($? != 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
|
||||
|
||||
|
@@ -42,6 +42,8 @@ elif [ "$netdriver" = "bnx2x" ]; then
|
||||
# If driver is bnx2x, do not use /sys/module/fcoe/parameters/create but fipvlan
|
||||
modprobe 8021q
|
||||
udevadm settle --timeout=30
|
||||
# Sleep for 3 s to allow dcb negotiation
|
||||
sleep 3
|
||||
fipvlan "$netif" -c -s
|
||||
else
|
||||
echo -n "$netif" > /sys/module/fcoe/parameters/create
|
||||
|
@@ -13,5 +13,4 @@ depends() {
|
||||
install() {
|
||||
[ -f /etc/fstab.sys ] && inst_simple /etc/fstab.sys
|
||||
inst_hook pre-pivot 00 "$moddir/mount-sys.sh"
|
||||
inst_hook cmdline 00 "$moddir/wait-mount-dev.sh"
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -1,22 +0,0 @@
|
||||
#!/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
|
||||
type det_fs >/dev/null 2>&1 || . /lib/fs-lib.sh
|
||||
|
||||
fstab_wait_dev() {
|
||||
local _dev _mp _fs _opts _dump _pass _rest
|
||||
test -e "$1" || return 1
|
||||
while read _dev _mp _fs _opts _dump _pass _rest; do
|
||||
[ -z "${_dev%%#*}" ] && continue # Skip comment lines
|
||||
case "$_dev" in
|
||||
/dev/?*)
|
||||
wait_for_dev $_dev;;
|
||||
*) ;;
|
||||
esac
|
||||
done < $1
|
||||
return 0
|
||||
}
|
||||
|
||||
[ -f /etc/fstab ] && fstab_wait_dev /etc/fstab
|
@@ -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??
|
||||
|
||||
|
@@ -11,8 +11,7 @@ check() {
|
||||
# booting from root.
|
||||
|
||||
is_iscsi() (
|
||||
local _dev
|
||||
_dev=$(get_maj_min $1)
|
||||
local _dev=$1
|
||||
|
||||
[[ -L /sys/dev/block/$_dev ]] || return
|
||||
cd "$(readlink -f /sys/dev/block/$_dev)"
|
||||
@@ -23,7 +22,7 @@ check() {
|
||||
)
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_fs is_iscsi || return 1
|
||||
for_each_host_dev_and_slaves is_iscsi || return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
@@ -53,12 +53,6 @@ if [ -n "$iscsiroot" ] ; then
|
||||
[ -z "$netroot" ] || [ "$netroot" = "iscsi" ] && netroot=iscsi:$iscsiroot
|
||||
fi
|
||||
|
||||
modprobe -q qla4xxx
|
||||
modprobe -q cxgb3i
|
||||
modprobe -q cxgb4i
|
||||
modprobe -q bnx2i
|
||||
modprobe -q be2iscsi
|
||||
|
||||
# iscsi_firmware does not need argument checking
|
||||
if [ -n "$iscsi_firmware" ] ; then
|
||||
netroot=${netroot:-iscsi}
|
||||
@@ -69,6 +63,12 @@ fi
|
||||
# If it's not iscsi we don't continue
|
||||
[ "${netroot%%:*}" = "iscsi" ] || return
|
||||
|
||||
modprobe -q qla4xxx
|
||||
modprobe -q cxgb3i
|
||||
modprobe -q cxgb4i
|
||||
modprobe -q bnx2i
|
||||
modprobe -q be2iscsi
|
||||
|
||||
if [ -z "$iscsi_firmware" ] ; then
|
||||
type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
parse_iscsi_root "$netroot" || return
|
||||
|
@@ -95,7 +95,7 @@ while [ ! -b /dev/nbd0 ]; do
|
||||
i=$(( $i + 1))
|
||||
done
|
||||
|
||||
nbd-client $preopts "$nbdserver" "$nbdport" /dev/nbd0 $opts || exit 1
|
||||
nbd-client $preopts "$nbdserver" $nbdport /dev/nbd0 $opts || exit 1
|
||||
|
||||
# If we didn't get a root= on the command line, then we need to
|
||||
# add the udev rules for mounting the nbd0 device
|
||||
|
@@ -25,7 +25,7 @@ depends() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods nfs sunrpc ipv6
|
||||
instmods nfs sunrpc ipv6 nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files
|
||||
}
|
||||
|
||||
install() {
|
||||
@@ -38,6 +38,7 @@ install() {
|
||||
if [ -f /lib/modprobe.d/nfs.conf ]; then
|
||||
dracut_install /lib/modprobe.d/nfs.conf
|
||||
else
|
||||
[ -d $initdir/etc/modprobe.d/ ] || mkdir $initdir/etc/modprobe.d
|
||||
echo "alias nfs4 nfs" > $initdir/etc/modprobe.d/nfs.conf
|
||||
fi
|
||||
|
||||
@@ -48,7 +49,7 @@ install() {
|
||||
_nsslibs=${_nsslibs#|}
|
||||
_nsslibs=${_nsslibs%|}
|
||||
|
||||
inst_libdir_file -n "$_nsslibs" 'libnss*.so*'
|
||||
inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'
|
||||
|
||||
inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
|
||||
inst_hook pre-udev 99 "$moddir/nfs-start-rpc.sh"
|
||||
@@ -71,6 +72,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" \
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user