Compare commits
330 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2f6ed29d04 | ||
![]() |
a3044aba53 | ||
![]() |
50f5bbbbaf | ||
![]() |
c4c1c4f456 | ||
![]() |
46cc29261f | ||
![]() |
7f5701eb8d | ||
![]() |
b7d1b6f904 | ||
![]() |
58ef91ff50 | ||
![]() |
fbf338ff98 | ||
![]() |
40db1daf00 | ||
![]() |
cbd1b385a2 | ||
![]() |
6470e0a12b | ||
![]() |
da5ef1737e | ||
![]() |
ecc13ef17e | ||
![]() |
5bcf262d59 | ||
![]() |
d97eb42593 | ||
![]() |
63330a89fc | ||
![]() |
49268028b9 | ||
![]() |
b874d4b5be | ||
![]() |
283d385fbd | ||
![]() |
96cf7270da | ||
![]() |
b19bdcbea7 | ||
![]() |
4e93c3f707 | ||
![]() |
f3b14c2b6a | ||
![]() |
d8b04dc184 | ||
![]() |
b5b608e44a | ||
![]() |
78d5cf7cb4 | ||
![]() |
f4a942783a | ||
![]() |
3b9aaaab42 | ||
![]() |
fc68c87afa | ||
![]() |
63f3bcd852 | ||
![]() |
57f90974f9 | ||
![]() |
d8cc8c0499 | ||
![]() |
36b2e5e2c2 | ||
![]() |
3c4315fa13 | ||
![]() |
d97d130da9 | ||
![]() |
e0aa98a1df | ||
![]() |
84bc192946 | ||
![]() |
e684eab878 | ||
![]() |
debf483d4d | ||
![]() |
d681df8e5f | ||
![]() |
540a5169b9 | ||
![]() |
12beb05a73 | ||
![]() |
e6aafacb23 | ||
![]() |
8d3d72a68c | ||
![]() |
b2fab575dc | ||
![]() |
de74e1ef41 | ||
![]() |
f2cbd4cbd6 | ||
![]() |
5ecc117a25 | ||
![]() |
00ed3ccfd9 | ||
![]() |
6a877a79c4 | ||
![]() |
cb73315dd6 | ||
![]() |
8552a3270c | ||
![]() |
281327f72c | ||
![]() |
da119ab18c | ||
![]() |
87bd8907a6 | ||
![]() |
a242ef13e0 | ||
![]() |
2b9d8f65a6 | ||
![]() |
ffc68f357e | ||
![]() |
ace51ef520 | ||
![]() |
93b02f502e | ||
![]() |
49c062821a | ||
![]() |
c504d8b435 | ||
![]() |
39fe00ef60 | ||
![]() |
bae44febb5 | ||
![]() |
5c274467d6 | ||
![]() |
c82a11334d | ||
![]() |
f34e1d6b0e | ||
![]() |
a073aa5a26 | ||
![]() |
575733aa25 | ||
![]() |
546d5dacf5 | ||
![]() |
3411ad661a | ||
![]() |
a2b64e30b8 | ||
![]() |
50411d30d5 | ||
![]() |
88c86ac7f0 | ||
![]() |
55c912ae40 | ||
![]() |
b7c770e186 | ||
![]() |
324ea606da | ||
![]() |
df478eee75 | ||
![]() |
8f53670cc5 | ||
![]() |
f071d5574c | ||
![]() |
1743473b2b | ||
![]() |
0d6d85b494 | ||
![]() |
bbc9bfe16e | ||
![]() |
466a59984a | ||
![]() |
8df0b654dc | ||
![]() |
97af51db9d | ||
![]() |
69f7ed9610 | ||
![]() |
67b4a9ea17 | ||
![]() |
dc63e65419 | ||
![]() |
62cdced342 | ||
![]() |
919a7c4d6e | ||
![]() |
f06c2b5852 | ||
![]() |
613ed5cd76 | ||
![]() |
3605b48508 | ||
![]() |
4fe1bdd406 | ||
![]() |
a13bf117d5 | ||
![]() |
730b9b8b77 | ||
![]() |
5e264a5d3e | ||
![]() |
4baac4b291 | ||
![]() |
1f4f8fb9e3 | ||
![]() |
af75a298c1 | ||
![]() |
9fc144451d | ||
![]() |
861d9430c0 | ||
![]() |
e8b9702c0a | ||
![]() |
109283a883 | ||
![]() |
e95b672376 | ||
![]() |
dadd2b698e | ||
![]() |
3e70a25bcf | ||
![]() |
3e6c9011d0 | ||
![]() |
d93fe0fa35 | ||
![]() |
beb26a0847 | ||
![]() |
e84d115b93 | ||
![]() |
7929ec198f | ||
![]() |
0b11ea7199 | ||
![]() |
7deba0428a | ||
![]() |
aacdba2bdb | ||
![]() |
5ae33613ab | ||
![]() |
8652d5493d | ||
![]() |
af11946054 | ||
![]() |
55a0b3abc7 | ||
![]() |
a4f7b50471 | ||
![]() |
226e3710b4 | ||
![]() |
89f7217954 | ||
![]() |
283c34fc2b | ||
![]() |
1cb6524918 | ||
![]() |
ff66b6dad3 | ||
![]() |
64a7eace88 | ||
![]() |
051de5aadc | ||
![]() |
d2765b5175 | ||
![]() |
d27cd4dfdd | ||
![]() |
030b00b8a5 | ||
![]() |
de50e9c002 | ||
![]() |
868f935e23 | ||
![]() |
4ba662ff90 | ||
![]() |
dc7085ceeb | ||
![]() |
9444bf6161 | ||
![]() |
06ca27cdf5 | ||
![]() |
dd82da4e27 | ||
![]() |
190047f161 | ||
![]() |
748867d177 | ||
![]() |
b806625d41 | ||
![]() |
dba2055979 | ||
![]() |
aa23dcd8ae | ||
![]() |
5bbbfeaf19 | ||
![]() |
9b6c5fd7c7 | ||
![]() |
904a76376f | ||
![]() |
52814c0ee3 | ||
![]() |
d124904f2b | ||
![]() |
7fd850d58e | ||
![]() |
71bb2ecd79 | ||
![]() |
6e0348f33b | ||
![]() |
27458b10ff | ||
![]() |
bf27e473cb | ||
![]() |
549442cc2a | ||
![]() |
98836432c1 | ||
![]() |
d988dc30df | ||
![]() |
c5f8b69ad7 | ||
![]() |
2beee35d5e | ||
![]() |
1ae8b8aa02 | ||
![]() |
8f092d0dda | ||
![]() |
d624f60682 | ||
![]() |
5decf6d813 | ||
![]() |
1a1c80febe | ||
![]() |
7b3ff4e055 | ||
![]() |
56b58c0a94 | ||
![]() |
ad2565c8ff | ||
![]() |
9f3d191fce | ||
![]() |
f17c5fa573 | ||
![]() |
99369bea1c | ||
![]() |
45ef8eb723 | ||
![]() |
bc6eae15ab | ||
![]() |
475f3a8128 | ||
![]() |
6b1e7a6ca4 | ||
![]() |
bbaa0d5917 | ||
![]() |
3c4bfd685a | ||
![]() |
9dde7a66b5 | ||
![]() |
34b56de12a | ||
![]() |
951cedf8cb | ||
![]() |
0baf97618d | ||
![]() |
8642792c3e | ||
![]() |
5bbfd48475 | ||
![]() |
c33488feb1 | ||
![]() |
18e61d3d41 | ||
![]() |
fbf717086e | ||
![]() |
5a6a98f875 | ||
![]() |
35857f556c | ||
![]() |
a6865e6897 | ||
![]() |
55068924f7 | ||
![]() |
16addb86fc | ||
![]() |
5f2c30d9bc | ||
![]() |
c00f8e05a6 | ||
![]() |
85231e1ff3 | ||
![]() |
88396c383c | ||
![]() |
df03141dbc | ||
![]() |
bf9cdc472c | ||
![]() |
02b5c8e3a3 | ||
![]() |
f734347ae7 | ||
![]() |
4aca0017e8 | ||
![]() |
1e057b352a | ||
![]() |
431b86c8e9 | ||
![]() |
b093aa2dc7 | ||
![]() |
32bd2fbb4c | ||
![]() |
1d84d6940e | ||
![]() |
87ae968810 | ||
![]() |
f13deabd22 | ||
![]() |
0d59a84b53 | ||
![]() |
68cb510f18 | ||
![]() |
5e60145449 | ||
![]() |
282e0583b0 | ||
![]() |
32d115f385 | ||
![]() |
416d3d6390 | ||
![]() |
8a9a5838f3 | ||
![]() |
a94cd56d6f | ||
![]() |
b819f519cb | ||
![]() |
44d832c5ad | ||
![]() |
4961910fe3 | ||
![]() |
3d0da653f0 | ||
![]() |
4ef0e2d92a | ||
![]() |
bd0f2c034a | ||
![]() |
d8a698713e | ||
![]() |
57f2579281 | ||
![]() |
215ff169db | ||
![]() |
85b458d90d | ||
![]() |
268ae2841b | ||
![]() |
638cad7c97 | ||
![]() |
0fbb79d54f | ||
![]() |
36c34f4e71 | ||
![]() |
373efa4427 | ||
![]() |
cee4599131 | ||
![]() |
c6011f2add | ||
![]() |
f8b958dc62 | ||
![]() |
036712546b | ||
![]() |
391d605790 | ||
![]() |
aef0f55791 | ||
![]() |
66ed711ccf | ||
![]() |
960b1e48e8 | ||
![]() |
437a56dc6b | ||
![]() |
630aed8b66 | ||
![]() |
af6292f0fc | ||
![]() |
b710520a3d | ||
![]() |
66e092bb53 | ||
![]() |
fdc1037b19 | ||
![]() |
76df206685 | ||
![]() |
77364fd6bb | ||
![]() |
41b0e41a09 | ||
![]() |
791532b0ce | ||
![]() |
ad45024416 | ||
![]() |
3ae5ac28af | ||
![]() |
fd28794bbc | ||
![]() |
d18fd0235b | ||
![]() |
15c5c072f4 | ||
![]() |
caf207afa7 | ||
![]() |
57937cf480 | ||
![]() |
feaf30ffaa | ||
![]() |
dcae873414 | ||
![]() |
32214acb3a | ||
![]() |
e64bcf5a99 | ||
![]() |
62cb52f431 | ||
![]() |
cf8b1b7853 | ||
![]() |
bc97e005fa | ||
![]() |
679fa7ed3c | ||
![]() |
4f084f3ab5 | ||
![]() |
af2716626a | ||
![]() |
6625c085ae | ||
![]() |
af2578562c | ||
![]() |
8099e7b1ba | ||
![]() |
0a3e348225 | ||
![]() |
b78e6ac2c3 | ||
![]() |
cbfe65c2fe | ||
![]() |
284d62da81 | ||
![]() |
c6df70fb48 | ||
![]() |
1b8616adee | ||
![]() |
639bd4873b | ||
![]() |
e0904b27ff | ||
![]() |
d9eff33ce2 | ||
![]() |
8974102f6b | ||
![]() |
599182b108 | ||
![]() |
6a736cc129 | ||
![]() |
15b93069bb | ||
![]() |
19b5c10963 | ||
![]() |
bcfbddefe1 | ||
![]() |
780cb33741 | ||
![]() |
8d7c07f191 | ||
![]() |
fefd3f66f9 | ||
![]() |
d57b8833c4 | ||
![]() |
9584c6ae90 | ||
![]() |
021b2fddff | ||
![]() |
b6f2e05819 | ||
![]() |
3ed08d1e4d | ||
![]() |
26a077fc7e | ||
![]() |
8461734ee4 | ||
![]() |
6f4c2dada4 | ||
![]() |
ab42fe38fd | ||
![]() |
3be5d63c2f | ||
![]() |
b4dc22cab7 | ||
![]() |
2b125c69cc | ||
![]() |
9268366cad | ||
![]() |
d0eedc4a5f | ||
![]() |
4460416abc | ||
![]() |
884e1cda7c | ||
![]() |
46a885bf9f | ||
![]() |
7dbca9be86 | ||
![]() |
7d9bb76ac7 | ||
![]() |
26ab7b07a6 | ||
![]() |
14499534ba | ||
![]() |
1540df0e79 | ||
![]() |
5d68c80b16 | ||
![]() |
5f8cd1a4be | ||
![]() |
14201d23e7 | ||
![]() |
a229b17434 | ||
![]() |
ca2c693679 | ||
![]() |
cdcb27a4fe | ||
![]() |
0c5ccb35c7 | ||
![]() |
9d787df196 | ||
![]() |
0290e98271 | ||
![]() |
d136ca4eeb | ||
![]() |
a55f910cf6 | ||
![]() |
96efbc51ac | ||
![]() |
9d36d4fb1d | ||
![]() |
41bfa5dad1 | ||
![]() |
db9fbaf9b8 | ||
![]() |
56fb5c4dbf | ||
![]() |
a8986425a4 | ||
![]() |
ea3c4e8273 | ||
![]() |
6db8c5a5fe | ||
![]() |
ab9b04f55b | ||
![]() |
c4b572b5ca | ||
![]() |
cc6f0925df | ||
![]() |
d50cf62d62 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -13,3 +13,7 @@ test*.img
|
||||
/.project
|
||||
/dracut-version.sh
|
||||
/install/dracut-install
|
||||
/*.rpm
|
||||
/*.[0-9]
|
||||
/modules.d/98systemd/*.service.8
|
||||
/*.sign
|
||||
|
27
.mailmap
27
.mailmap
@@ -1,12 +1,15 @@
|
||||
Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer-omB+W0Dpw2o@public.gmane.org>
|
||||
Seewer Philippe <philippe.seewer@bfh.ch> <philippe.seewer@bfh.ch>
|
||||
Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer@bfh.ch>
|
||||
Victor Lowther <victor.lowther@gmail.com> <victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
|
||||
Harald Hoyer <harald@redhat.com> <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
|
||||
Harald Hoyer <harald@redhat.com> <harald@eeepc.(none)>
|
||||
Mike Snitzer <snitzer@redhat.com> <msnitzer@redhat.com>
|
||||
Amerigo Wang <amwang@redhat.com> <xiyou.wangcong@gmail.com>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com> <arvidjaar@mail.ru>
|
||||
Dan Horák <dhorak@redhat.com> <dan@danny.cz>
|
||||
John Reiser <jreiser@bitwagon.com> <jreiser@BitWagon.com>
|
||||
Luca Berra <bluca@vodka.it> <bluca@comedia.it>
|
||||
Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer-omB+W0Dpw2o@public.gmane.org>
|
||||
Seewer Philippe <philippe.seewer@bfh.ch> <philippe.seewer@bfh.ch>
|
||||
Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer@bfh.ch>
|
||||
Victor Lowther <victor.lowther@gmail.com> <victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
|
||||
Harald Hoyer <harald@redhat.com> <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
|
||||
Harald Hoyer <harald@redhat.com> <harald@eeepc.(none)>
|
||||
Mike Snitzer <snitzer@redhat.com> <msnitzer@redhat.com>
|
||||
Amerigo Wang <amwang@redhat.com> <xiyou.wangcong@gmail.com>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com> <arvidjaar@mail.ru>
|
||||
Dan Horák <dhorak@redhat.com> <dan@danny.cz>
|
||||
John Reiser <jreiser@bitwagon.com> <jreiser@BitWagon.com>
|
||||
Luca Berra <bluca@vodka.it> <bluca@comedia.it>
|
||||
Dave Young <dyoung@redhat.com> dyoung@redhat.com
|
||||
Frederick Grose <fgrose@sugarlabs.org> <fgrose@gmail.com>
|
||||
Frederic Crozat <fcrozat@suse.com> <fcrozat@mandriva.com>
|
||||
|
@@ -22,11 +22,11 @@ done
|
||||
ret=0
|
||||
case "$1" in
|
||||
add)
|
||||
dracut ${noimageifnotneeded+--noimageifnotneeded} "$3"/initrd "$2"
|
||||
dracut ${noimageifnotneeded:+--noimageifnotneeded} "$3"/initrd "$2"
|
||||
ret=$?
|
||||
;;
|
||||
remove)
|
||||
rm -f "$3"/initrd
|
||||
rm -f -- "$3"/initrd
|
||||
ret=$?
|
||||
;;
|
||||
esac
|
||||
|
@@ -6,6 +6,9 @@ export LANG=C
|
||||
|
||||
COMMAND="$1"
|
||||
KERNEL_VERSION="$2"
|
||||
BOOT_DIR_ABS="${3%/*}/0-rescue"
|
||||
KERNEL_IMAGE="$4"
|
||||
|
||||
|
||||
dropindirs_sort()
|
||||
{
|
||||
@@ -50,7 +53,6 @@ fi
|
||||
|
||||
LOADER_ENTRY="/boot/loader/entries/${MACHINE_ID}-0-rescue.conf"
|
||||
BOOT_DIR="/${MACHINE_ID}/0-rescue"
|
||||
BOOT_DIR_ABS="/boot${BOOT_DIR}"
|
||||
|
||||
ret=0
|
||||
|
||||
|
48
AUTHORS
48
AUTHORS
@@ -1,69 +1,86 @@
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
Victor Lowther <victor.lowther@gmail.com>
|
||||
Amadeusz Żołnowski <aidecoe@aidecoe.name>
|
||||
Will Woods <wwoods@redhat.com>
|
||||
Philippe Seewer <philippe.seewer@bfh.ch>
|
||||
Warren Togami <wtogami@redhat.com>
|
||||
Will Woods <wwoods@redhat.com>
|
||||
Jeremy Katz <katzj@redhat.com>
|
||||
Dave Young <dyoung@redhat.com>
|
||||
David Dillow <dave@thedillows.org>
|
||||
Michal Soltys <soltys@ziu.info>
|
||||
Amerigo Wang <amwang@redhat.com>
|
||||
Dave Young <dyoung@redhat.com>
|
||||
Colin Guthrie <colin@mageia.org>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
WANG Chao <chaowang@redhat.com>
|
||||
John Reiser <jreiser@bitwagon.com>
|
||||
Luca Berra <bluca@vodka.it>
|
||||
Thomas Renninger <trenn@suse.de>
|
||||
Daniel Drake <dsd@laptop.org>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
Baoquan He <bhe@redhat.com>
|
||||
Leho Kraav <leho@kraav.com>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
Kamil Rytarowski <n54@gmx.com>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
Chao Wang <chaowang@redhat.com>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Frederic Crozat <fcrozat@suse.com>
|
||||
Jesse Keating <jkeating@redhat.com>
|
||||
Milan Broz <mbroz@redhat.com>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Radek Vykydal <rvykydal@redhat.com>
|
||||
Roberto Sassu <roberto.sassu@polito.it>
|
||||
dyoung@redhat.com <dyoung@redhat.com>
|
||||
Anton Blanchard <anton@samba.org>
|
||||
Bill Nottingham <notting@redhat.com>
|
||||
David Cantrell <dcantrell@redhat.com>
|
||||
Frederic Crozat <fcrozat@suse.com>
|
||||
Dennis Gilmore <dennis@ausil.us>
|
||||
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>
|
||||
Wim Muskee <wimmuskee@gmail.com>
|
||||
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
||||
Alan Pevec <apevec@redhat.com>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Dennis Gilmore <dennis@ausil.us>
|
||||
Alexander Tsoy <alexander@tsoy.me>
|
||||
Frederick Grose <fgrose@sugarlabs.org>
|
||||
Ian Dall <ian@beware.dropbear.id.au>
|
||||
James Buren <ryuo@frugalware.org>
|
||||
James Lee <jlee@thestaticvoid.com>
|
||||
Joey Boggs <jboggs@redhat.com>
|
||||
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Mike Snitzer <snitzer@redhat.com>
|
||||
Przemysław Rudy <prudy1@o2.pl>
|
||||
Stefan Reimer <it@startux.de>
|
||||
Thomas Lange <lange@informatik.uni-koeln.de>
|
||||
Vivek Goyal <vgoyal@redhat.com>
|
||||
Vladislav Bogdanov <bubble@hoster-ok.com>
|
||||
Wim Muskee <wimmuskee@gmail.com>
|
||||
Adam Williamson <awilliam@redhat.com>
|
||||
Alexander Todorov <atodorov@redhat.com>
|
||||
Andy Lutomirski <luto@mit.edu>
|
||||
Anssi Hannula <anssi@mageia.org>
|
||||
Brandon Philips <brandon@ifup.co>
|
||||
Canek Peláez Valdés <caneko@gmail.com>
|
||||
Chris Leech <cleech@redhat.com>
|
||||
Christian Heinz <christian.ch.heinz@gmail.com>
|
||||
Cong Wang <amwang@redhat.com>
|
||||
Daniel Schaal <farbing@web.de>
|
||||
Dave Jones <davej@redhat.com>
|
||||
Dave Young <dave@redhat.com>
|
||||
Dennis Schridde <devurandom@gmx.net>
|
||||
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>
|
||||
Jiri Pirko <jiri@resnulli.us>
|
||||
Joe Lawrence <Joe.Lawrence@stratus.com>
|
||||
Kevin Yung <Kevin.Yung@myob.com>
|
||||
Kyle McMartin <kyle@redhat.com>
|
||||
Lars R. Damerow <lars@pixar.com>
|
||||
Lennert Buytenhek <buytenh@wantstofly.org>
|
||||
Lubomir Rintel <lkundrak@v3.sk>
|
||||
Matt <smoothsailing72@hotmail.com>
|
||||
@@ -71,17 +88,18 @@ Matt Smith <shadowfax@gmx.com>
|
||||
Michal Schmidt <mschmidt@redhat.com>
|
||||
Mike Gorse <mgorse@suse.com>
|
||||
Munehiro Matsuda <haro@kgt.co.jp>
|
||||
Nicolas Chauvet <kwizart@gmail.com>
|
||||
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>
|
||||
Robert Buchholz <rbu@goodpoint.de>
|
||||
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 Backlund <tmb@mageia.org>
|
||||
Tomasz Torcz <tomek@pipebreaker.pl>
|
||||
Vadim Kuznetsov <vadimk@gentoo.org>
|
||||
Ville Skyttä <ville.skytta@iki.fi>
|
||||
|
58
Makefile
58
Makefile
@@ -1,5 +1,7 @@
|
||||
VERSION=027
|
||||
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
|
||||
-include dracut-version.sh
|
||||
|
||||
VERSION = $(shell [ -d .git ] && git describe --abbrev=0 --tags 2>/dev/null || echo $(DRACUT_VERSION))
|
||||
GITVERSION = $(shell [ -d .git ] && { v=$$(git describe --tags 2>/dev/null); [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
|
||||
|
||||
-include Makefile.inc
|
||||
|
||||
@@ -27,6 +29,7 @@ man8pages = dracut.8 \
|
||||
modules.d/98systemd/dracut-cmdline.service.8 \
|
||||
modules.d/98systemd/dracut-initqueue.service.8 \
|
||||
modules.d/98systemd/dracut-mount.service.8 \
|
||||
modules.d/98systemd/dracut-shutdown.service.8 \
|
||||
modules.d/98systemd/dracut-pre-mount.service.8 \
|
||||
modules.d/98systemd/dracut-pre-pivot.service.8 \
|
||||
modules.d/98systemd/dracut-pre-trigger.service.8 \
|
||||
@@ -35,9 +38,9 @@ man8pages = dracut.8 \
|
||||
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
|
||||
|
||||
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS doc
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
|
||||
|
||||
all: syncheck dracut-version.sh dracut-install
|
||||
all: dracut-version.sh dracut-install
|
||||
|
||||
DRACUT_INSTALL_OBJECTS = \
|
||||
install/dracut-install.o \
|
||||
@@ -73,13 +76,13 @@ endif
|
||||
%.xml: %.asc
|
||||
asciidoc -d manpage -b docbook -o $@ $<
|
||||
|
||||
dracut.html: dracut.asc $(manpages)
|
||||
dracut.html: dracut.asc $(manpages) dracut.css
|
||||
asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc
|
||||
xsltproc -o dracut.html --xinclude -nonet \
|
||||
--stringparam html.stylesheet \
|
||||
http://docs.fedoraproject.org/en-US/Common_Content/css/default.css \
|
||||
--stringparam custom.css.source dracut.css \
|
||||
--stringparam generate.css.header 1 \
|
||||
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
|
||||
rm dracut.xml
|
||||
rm -f -- dracut.xml
|
||||
|
||||
install: dracut-version.sh
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)
|
||||
@@ -109,7 +112,7 @@ ifneq ($(enable_documentation),no)
|
||||
endif
|
||||
if [ -n "$(systemdsystemunitdir)" ]; then \
|
||||
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
|
||||
install -m 0644 dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir); \
|
||||
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98systemd/dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown.service; \
|
||||
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants; \
|
||||
ln -s ../dracut-shutdown.service \
|
||||
$(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants/dracut-shutdown.service; \
|
||||
@@ -123,9 +126,9 @@ endif
|
||||
dracut-pre-trigger.service \
|
||||
dracut-pre-udev.service \
|
||||
; do \
|
||||
install -m 0644 modules.d/98systemd/$$i $(DESTDIR)$(systemdsystemunitdir); \
|
||||
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98systemd/$$i $(DESTDIR)$(systemdsystemunitdir); \
|
||||
ln -s ../$$i \
|
||||
$(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants/$i; \
|
||||
$(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants/$$i; \
|
||||
done \
|
||||
fi
|
||||
if [ -f install/dracut-install ]; then \
|
||||
@@ -136,9 +139,10 @@ endif
|
||||
install -m 0755 51-dracut-rescue.install $(DESTDIR)${prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
mkdir -p $(DESTDIR)${bashcompletiondir}
|
||||
install -m 0644 dracut-bash-completion.sh $(DESTDIR)${bashcompletiondir}/dracut
|
||||
install -m 0644 lsinitrd-bash-completion.sh $(DESTDIR)${bashcompletiondir}/lsinitrd
|
||||
|
||||
dracut-version.sh:
|
||||
@echo "DRACUT_VERSION=$(VERSION)-$(GITVERSION)" > dracut-version.sh
|
||||
@echo "DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh
|
||||
|
||||
clean:
|
||||
$(RM) *~
|
||||
@@ -147,45 +151,45 @@ clean:
|
||||
$(RM) $(manpages:%=%.xml) dracut.xml
|
||||
$(RM) test-*.img
|
||||
$(RM) dracut-*.rpm dracut-*.tar.bz2
|
||||
$(RM) dracut-version.sh
|
||||
$(RM) dracut-install install/dracut-install $(DRACUT_INSTALL_OBJECTS)
|
||||
$(RM) $(manpages) dracut.html
|
||||
$(MAKE) -C test clean
|
||||
|
||||
archive: dracut-$(VERSION)-$(GITVERSION).tar.bz2
|
||||
|
||||
dist: dracut-$(VERSION).tar.bz2
|
||||
|
||||
dracut-$(VERSION).tar.bz2: doc
|
||||
dracut-$(VERSION).tar.bz2: doc syncheck
|
||||
@echo "DRACUT_VERSION=$(VERSION)" > dracut-version.sh
|
||||
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ > dracut-$(VERSION).tar
|
||||
mkdir -p dracut-$(VERSION)
|
||||
cp $(manpages) dracut.html dracut-$(VERSION)
|
||||
tar -rf dracut-$(VERSION).tar dracut-$(VERSION)/*.[0-9] dracut-$(VERSION)/dracut.html
|
||||
rm -fr dracut-$(VERSION).tar.bz2 dracut-$(VERSION)
|
||||
for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(VERSION)/$${i%/*}"; cp "$$i" "dracut-$(VERSION)/$$i"; done
|
||||
tar --owner=root --group=root -rf dracut-$(VERSION).tar $$(find dracut-$(VERSION) -type f)
|
||||
rm -fr -- dracut-$(VERSION).tar.bz2 dracut-$(VERSION)
|
||||
bzip2 -9 dracut-$(VERSION).tar
|
||||
rm -f dracut-$(VERSION).tar
|
||||
rm -f -- dracut-$(VERSION).tar
|
||||
|
||||
rpm: dracut-$(VERSION).tar.bz2
|
||||
rpm: dracut-$(VERSION).tar.bz2 syncheck
|
||||
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
|
||||
cp dracut-$(VERSION).tar.bz2 "$$rpmbuild"; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
(cd "$$rpmbuild"; rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
|
||||
--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
|
||||
( mv "$$rpmbuild"/$$(arch)/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr "$$rpmbuild"; ls *.rpm )
|
||||
( mv "$$rpmbuild"/$$(arch)/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr -- "$$rpmbuild"; ls *.rpm )
|
||||
|
||||
syncheck:
|
||||
@ret=0;for i in dracut-initramfs-restore.sh dracut-logger.sh \
|
||||
modules.d/99base/init.sh modules.d/*/*.sh; do \
|
||||
@ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \
|
||||
[ "$${i##*/}" = "module-setup.sh" ] && continue; \
|
||||
read line < "$$i"; [ "$${line#*bash*}" != "$$line" ] && continue; \
|
||||
dash -n "$$i" ; ret=$$(($$ret+$$?)); \
|
||||
[ $$V ] && echo "posix syntax check: $$i"; bash --posix -n "$$i" ; ret=$$(($$ret+$$?)); \
|
||||
[ $$V ] && echo "checking for [[: $$i"; if grep -Fq '[[ ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains [["; fi \
|
||||
done;exit $$ret
|
||||
@ret=0;for i in *.sh mkinitrd-dracut.sh modules.d/*/*.sh \
|
||||
modules.d/*/module-setup.sh; do \
|
||||
bash -n "$$i" ; ret=$$(($$ret+$$?)); \
|
||||
[ $$V ] && echo "bash syntax check: $$i"; bash -n "$$i" ; ret=$$(($$ret+$$?)); \
|
||||
done;exit $$ret
|
||||
|
||||
check: all syncheck
|
||||
check: all syncheck rpm
|
||||
@[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; }
|
||||
@$(MAKE) -C test check
|
||||
|
||||
@@ -200,7 +204,7 @@ testimages: all
|
||||
@echo wrote test-dracut.img
|
||||
|
||||
hostimage: all
|
||||
./dracut.sh -H -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
|
||||
./dracut.sh -H -l -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
|
||||
AUTHORS:
|
||||
|
198
NEWS
198
NEWS
@@ -1,3 +1,201 @@
|
||||
dracut-034
|
||||
==========
|
||||
- do not run dhcp on parts of assembled network interfaces (bond, bridge)
|
||||
- add option to turn on/off prelinking
|
||||
--prelink, --noprelink
|
||||
do_prelink=[yes|no]
|
||||
- add ACPI table overriding
|
||||
- do not log to syslog/kmsg/journal for UID != 0
|
||||
- lvm/mdraid: Fix LVM on MD activation
|
||||
- bcache module removed (now in bcache-tools upstream)
|
||||
- mdadm: also install configs from /etc/mdadm.conf.d
|
||||
- fixes for mdadm-3.2.6+
|
||||
- mkinitrd: better compat support for SUSE
|
||||
- fcoe: add FCoE UEFI boot device support
|
||||
- rootfs-block: add support for the rootfallback= kernel cmdline option
|
||||
|
||||
Contributions from:
|
||||
Thomas Renninger
|
||||
Alexander Tsoy
|
||||
Peter Rajnoha
|
||||
WANG Chao
|
||||
Harald Hoyer
|
||||
|
||||
|
||||
dracut-033
|
||||
==========
|
||||
- improved hostonly device recognition
|
||||
- improved hostonly module recognition
|
||||
- add dracut.css for dracut.html
|
||||
- do not install udev rules from /etc in generic mode
|
||||
- fixed LABEL= parsing for swap devices
|
||||
- fixed iBFT network setup
|
||||
- url-lib.sh: handle 0-size files with curl
|
||||
- dracut.asc: document debugging dracut on shutdown
|
||||
- if rd.md=0, use dmraid for imsm and ddf
|
||||
- skip empty dracut modules
|
||||
- removed caching of kernel cmdline
|
||||
- fixed iso-scan, if the loop device driver is a kernel module
|
||||
- bcache: support new blkid
|
||||
- fixed ifup udev rules
|
||||
- ifup with dhcp, if no "ip=" specified for the interface
|
||||
|
||||
Contributions from:
|
||||
WANG Chao
|
||||
Colin Walters
|
||||
Harald Hoyer
|
||||
|
||||
|
||||
dracut-032
|
||||
==========
|
||||
- add parameter --print-cmdline
|
||||
This prints the kernel command line parameters for the current disk
|
||||
layout.
|
||||
$ dracut --print-cmdline
|
||||
rd.luks.uuid=luks-e68c8906-6542-4a26-83c4-91b4dd9f0471
|
||||
rd.lvm.lv=debian/root rd.lvm.lv=debian/usr root=/dev/mapper/debian-root
|
||||
rootflags=rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered
|
||||
rootfstype=ext4
|
||||
- dracut.sh: add --persistent-policy option and persistent_policy conf option
|
||||
--persistent-policy <policy>:
|
||||
Use <policy> to address disks and partitions.
|
||||
<policy> can be any directory name found in /dev/disk.
|
||||
E.g. "by-uuid", "by-label"
|
||||
- dracut now creates the initramfs without udevadm
|
||||
that means the udev database does not have to populated
|
||||
and the initramfs can be built in a chroot with
|
||||
/sys /dev /proc mounted
|
||||
- renamed dracut_install() to inst_multiple() for consistent naming
|
||||
- if $libdirs is unset, fall back to ld.so.cache paths
|
||||
- always assemble /usr device in initramfs
|
||||
- bash module added (disable it, if you really want dash)
|
||||
- continue to boot, if the main loop times out, in systemd mode
|
||||
- removed inst*() shell pure versions, dracut-install binary is in charge now
|
||||
- fixed ifcfg file generation for vlan
|
||||
- do not include adjtime and localtime anymore
|
||||
- fixed generation of zfcp.conf of CMS setups
|
||||
- install vt102 terminfo
|
||||
dracut_install() is still there for backwards compat
|
||||
- do not strip files in FIPS mode
|
||||
- fixed iBFT interface configuration
|
||||
- fs-lib: install fsck and fsck.ext*
|
||||
- shutdown: fixed killall_proc_mountpoint()
|
||||
- network: also wait for ethernet interfaces to setup
|
||||
- fixed checking for FIPS mode
|
||||
|
||||
Contributions from:
|
||||
Harald Hoyer
|
||||
WANG Chao
|
||||
Baoquan He
|
||||
Daniel Schaal
|
||||
Dave Young
|
||||
James Lee
|
||||
Radek Vykydal
|
||||
|
||||
|
||||
dracut-031
|
||||
==========
|
||||
- do not include the resume dracut module in hostonly mode,
|
||||
if no swap is present
|
||||
- don't warn twice about omitted modules
|
||||
- use systemd-cat for logging on systemd systems, if logfile is unset
|
||||
- fixed PARTUUID parsing
|
||||
- support kernel module signing keys
|
||||
- do not install the usrmount dracut module in hostonly mode,
|
||||
if /sbin/init does not live in /usr
|
||||
- add debian udev rule files
|
||||
- add support for bcache
|
||||
- network: handle bootif style interfaces
|
||||
e.g. ip=77-77-6f-6f-64-73:dhcp
|
||||
- add support for kmod static devnodes
|
||||
- add vlan support for iBFT
|
||||
|
||||
Contributions from:
|
||||
Harald Hoyer
|
||||
Amadeusz Żołnowski
|
||||
Brandon Philips
|
||||
Colin Walters
|
||||
James Lee
|
||||
Kyle McMartin
|
||||
Peter Jones
|
||||
|
||||
dracut-030
|
||||
==========
|
||||
- support new persistent network interface names
|
||||
- fix findmnt calls, prevents hang on stale NFS mounts
|
||||
- add systemd.slice and slice.target units
|
||||
- major shell cleanup
|
||||
- support root=PARTLABEL= and root=PARTUUID=
|
||||
- terminfo: only install l/linux v/vt100 and v/vt220
|
||||
- unset all LC_* and LANG, 10% faster
|
||||
- fixed dependency loop for dracut-cmdline.service
|
||||
- do not wait_for_dev for the root devices
|
||||
- do not wait_for_dev for devices, if dracut-initqueue is not needed
|
||||
- support early microcode loading with --early-microcode
|
||||
- dmraid, let dmraid setup its own partitions
|
||||
- sosreport renamed to rdsosreport
|
||||
|
||||
Contributions from:
|
||||
Harald Hoyer
|
||||
Konrad Rzeszutek Wilk
|
||||
WANG Chao
|
||||
|
||||
dracut-029
|
||||
==========
|
||||
- wait for IPv6 autoconfiguration
|
||||
- i18n: make the default font configurable
|
||||
To set the default font for your distribution, add
|
||||
i18n_default_font="latarcyrheb-sun16"
|
||||
to your /lib/dracut/dracut.conf.d/01-dist.conf distribution config.
|
||||
- proper handle "rd.break" in systemd mode before switch-root
|
||||
- systemd: make unit files symlinks
|
||||
- build without dash requirement
|
||||
- add dracut-shutdown.service.8 manpage
|
||||
- handle MACs for "ip="
|
||||
"ip=77-77-6f-6f-64-73:dhcp"
|
||||
- don't explode when mixing BOOTIF and ip=
|
||||
- 90lvm/module-setup.sh: redirect error message of lvs to /dev/null
|
||||
|
||||
Contributions from:
|
||||
Harald Hoyer
|
||||
Will Woods
|
||||
Baoquan He
|
||||
|
||||
dracut-028
|
||||
==========
|
||||
- full integration of crypto devs in systemd logic
|
||||
- support for bridge over team and vlan tagged team
|
||||
- support multiple bonding interfaces
|
||||
- new kernel command line param "rd.action_on_fail"
|
||||
to control the emergency action
|
||||
- support for bridge over a vlan tagged interface
|
||||
- support for "iso-scan/filename" kernel parameter
|
||||
- lsinitrd got some love and does not use "file" anymore
|
||||
- fixed issue with noexec mounted tmp dirs
|
||||
- FIPS mode fixed
|
||||
- dracut_install got some love
|
||||
- fixed some /usr mounting problems
|
||||
- ifcfg dracut module got some love and fixes
|
||||
- default installed font is now latarcyrheb-sun16
|
||||
- new parameters rd.live.dir and rd.live.squashimg
|
||||
- lvm: add tools for thin provisioning
|
||||
- also install non-hwcap libs
|
||||
- setup correct system time and time zone in initrd
|
||||
- s390: fixed cms setup
|
||||
- add systemd-udevd persistent network interface naming
|
||||
|
||||
Contributions from:
|
||||
Harald Hoyer
|
||||
Kamil Rytarowski
|
||||
WANG Chao
|
||||
Baoquan He
|
||||
Adam Williamson
|
||||
Colin Guthrie
|
||||
Dan Horák
|
||||
Dave Young
|
||||
Dennis Gilmore
|
||||
Dennis Schridde
|
||||
|
||||
dracut-027
|
||||
==========
|
||||
- dracut now has bash-completion
|
||||
|
3
TODO
3
TODO
@@ -22,6 +22,7 @@ INITRAMFS TODO
|
||||
|
||||
GENERATOR TODO
|
||||
|
||||
- remove wait for swap devs, if no "resume=" is given on the kernel command line
|
||||
- add presets (predefined set of modules)
|
||||
- add interpreter/plugin-scripts to be sourced at the beginning or end (can use dracut-functions)
|
||||
- add mechanism for module specific command line options
|
||||
@@ -29,6 +30,8 @@ GENERATOR TODO
|
||||
- default module specification could use some work
|
||||
- udev rule copying, as mentioned above, is a bit too hard-coded
|
||||
|
||||
- dracut-install parse LD_SHOW_AUXV="" AT_PLATFORM for lib install
|
||||
|
||||
CODE TODO
|
||||
|
||||
- document more functions
|
||||
|
@@ -33,26 +33,34 @@ _dracut() {
|
||||
--lvmconf --nolvmconf --debug --profile --verbose --quiet
|
||||
--local --hostonly --no-hostonly --fstab --help --bzip2 --lzma
|
||||
--xz --no-compress --gzip --list-modules --show-modules --keep
|
||||
--printsize --regenerate-all --noimageifnotneeded'
|
||||
--printsize --regenerate-all --noimageifnotneeded --early-microcode
|
||||
--no-early-microcode --print-cmdline --prelink --noprelink'
|
||||
|
||||
[ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers
|
||||
--omit-drivers --modules --omit --drivers --filesystems --install
|
||||
--fwdir --libdirs --fscks --add-fstab --mount --device --nofscks
|
||||
--kmoddir --conf --confdir --tmpdir --stdlog --compress --prefix
|
||||
--kernel-cmdline --sshkey'
|
||||
--kernel-cmdline --sshkey --persistent-policy'
|
||||
)
|
||||
|
||||
if __contains_word "$prev" ${OPTS[ARG]}; then
|
||||
case $prev in
|
||||
--kmoddir|-k|--fwdir|-c|--conf|--confdir|--tmpdir|--sshkey|--add-fstab|--add-device|-I|--install)
|
||||
--kmoddir|-k|--fwdir|--confdir|--tmpdir)
|
||||
comps=$(compgen -d -- "$cur")
|
||||
compopt -o filenames
|
||||
;;
|
||||
-c|--conf|--sshkey|--add-fstab|--add-device|-I|--install)
|
||||
comps=$(compgen -f -- "$cur")
|
||||
compopt -o filenames
|
||||
;;
|
||||
-a|-m|-o|--add|--modules|--omit)
|
||||
comps=$(dracut --list-modules 2>/dev/null)
|
||||
;;
|
||||
--persistent-policy)
|
||||
comps=$(cd /dev/disk/; echo *)
|
||||
;;
|
||||
--kver)
|
||||
comps=$(cd /lib/modules; echo *)
|
||||
comps=$(cd /lib/modules; echo [0-9]*)
|
||||
;;
|
||||
*)
|
||||
return 0
|
||||
|
@@ -118,11 +118,11 @@ fi
|
||||
images+=($@)
|
||||
|
||||
dinfo "Using base image $baseimage"
|
||||
cat "$baseimage" > "$outfile"
|
||||
cat -- "$baseimage" > "$outfile"
|
||||
|
||||
for i in "${images[@]}"; do
|
||||
dinfo "Appending $i"
|
||||
cat "$i" >> "$outfile"
|
||||
cat -- "$i" >> "$outfile"
|
||||
done
|
||||
|
||||
dinfo "Created $outfile"
|
||||
|
1055
dracut-functions.sh
1055
dracut-functions.sh
File diff suppressed because it is too large
Load Diff
@@ -17,13 +17,13 @@ cd /run/initramfs
|
||||
|
||||
[ -f .need_shutdown -a -f "$IMG" ] || exit 1
|
||||
if zcat "$IMG" | cpio -id --quiet >/dev/null; then
|
||||
rm .need_shutdown
|
||||
rm -f -- .need_shutdown
|
||||
elif xzcat "$IMG" | cpio -id --quiet >/dev/null; then
|
||||
rm .need_shutdown
|
||||
rm -f -- .need_shutdown
|
||||
else
|
||||
# something failed, so we clean up
|
||||
echo "Unpacking of $IMG to /run/initramfs failed" >&2
|
||||
rm -f /run/initramfs/shutdown
|
||||
rm -f -- /run/initramfs/shutdown
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 et filetype=sh
|
||||
#
|
||||
@@ -117,31 +117,48 @@ dlog_init() {
|
||||
if [ -z "$fileloglvl" ]; then
|
||||
[ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
|
||||
elif (( $fileloglvl > 0 )); then
|
||||
__oldumask=$(umask)
|
||||
umask 0377
|
||||
! [ -e "$logfile" ] && >"$logfile"
|
||||
umask $__oldumask
|
||||
if [ -w "$logfile" -a -f "$logfile" ]; then
|
||||
if [[ $logfile ]]; then
|
||||
__oldumask=$(umask)
|
||||
umask 0377
|
||||
! [ -e "$logfile" ] && >"$logfile"
|
||||
umask $__oldumask
|
||||
if [ -w "$logfile" -a -f "$logfile" ]; then
|
||||
# Mark new run in the log file
|
||||
echo >>"$logfile"
|
||||
if command -v date >/dev/null; then
|
||||
echo "=== $(date) ===" >>"$logfile"
|
||||
echo >>"$logfile"
|
||||
if command -v date >/dev/null; then
|
||||
echo "=== $(date) ===" >>"$logfile"
|
||||
else
|
||||
echo "===============================================" >>"$logfile"
|
||||
fi
|
||||
echo >>"$logfile"
|
||||
else
|
||||
echo "===============================================" >>"$logfile"
|
||||
fi
|
||||
echo >>"$logfile"
|
||||
else
|
||||
# We cannot log to file, so turn this facility off.
|
||||
fileloglvl=0
|
||||
ret=1
|
||||
errmsg="'$logfile' is not a writable file"
|
||||
fileloglvl=0
|
||||
ret=1
|
||||
errmsg="'$logfile' is not a writable file"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $UID != 0 )); then
|
||||
kmsgloglvl=0
|
||||
sysloglvl=0
|
||||
fi
|
||||
|
||||
if (( $sysloglvl > 0 )); then
|
||||
if ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null
|
||||
then
|
||||
if [[ -d /run/systemd/journal ]] \
|
||||
&& type -P systemd-cat &>/dev/null \
|
||||
&& systemctl --quiet is-active systemd-journald.socket &>/dev/null \
|
||||
&& { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &>/dev/null; } ; then
|
||||
readonly _dlogdir="$(mktemp --tmpdir="$TMPDIR/" -d -t dracut-log.XXXXXX)"
|
||||
readonly _systemdcatfile="$_dlogdir/systemd-cat"
|
||||
mkfifo "$_systemdcatfile"
|
||||
readonly _dlogfd=15
|
||||
systemd-cat -t 'dracut' <"$_systemdcatfile" &
|
||||
exec 15>"$_systemdcatfile"
|
||||
elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then
|
||||
# We cannot log to syslog, so turn this facility off.
|
||||
kmsgloglvl=$sysloglvl
|
||||
sysloglvl=0
|
||||
ret=1
|
||||
errmsg="No '/dev/log' or 'logger' included for syslog logging"
|
||||
@@ -165,34 +182,34 @@ dlog_init() {
|
||||
export maxloglvl
|
||||
|
||||
|
||||
if (($stdloglvl < 6)) && (($kmsgloglvl < 6)) && (($fileloglvl < 6)); then
|
||||
if (($stdloglvl < 6)) && (($kmsgloglvl < 6)) && (($fileloglvl < 6)) && (($sysloglvl < 6)); then
|
||||
unset dtrace
|
||||
dtrace() { :; };
|
||||
fi
|
||||
|
||||
if (($stdloglvl < 5)) && (($kmsgloglvl < 5)) && (($fileloglvl < 5)); then
|
||||
if (($stdloglvl < 5)) && (($kmsgloglvl < 5)) && (($fileloglvl < 5)) && (($sysloglvl < 5)); then
|
||||
unset ddebug
|
||||
ddebug() { :; };
|
||||
fi
|
||||
|
||||
if (($stdloglvl < 4)) && (($kmsgloglvl < 4)) && (($fileloglvl < 4)); then
|
||||
if (($stdloglvl < 4)) && (($kmsgloglvl < 4)) && (($fileloglvl < 4)) && (($sysloglvl < 4)); then
|
||||
unset dinfo
|
||||
dinfo() { :; };
|
||||
fi
|
||||
|
||||
if (($stdloglvl < 3)) && (($kmsgloglvl < 3)) && (($fileloglvl < 3)); then
|
||||
if (($stdloglvl < 3)) && (($kmsgloglvl < 3)) && (($fileloglvl < 3)) && (($sysloglvl < 3)); then
|
||||
unset dwarn
|
||||
dwarn() { :; };
|
||||
unset dwarning
|
||||
dwarning() { :; };
|
||||
fi
|
||||
|
||||
if (($stdloglvl < 2)) && (($kmsgloglvl < 2)) && (($fileloglvl < 2)); then
|
||||
if (($stdloglvl < 2)) && (($kmsgloglvl < 2)) && (($fileloglvl < 2)) && (($sysloglvl < 2)); then
|
||||
unset derror
|
||||
derror() { :; };
|
||||
fi
|
||||
|
||||
if (($stdloglvl < 1)) && (($kmsgloglvl < 1)) && (($fileloglvl < 1)); then
|
||||
if (($stdloglvl < 1)) && (($kmsgloglvl < 1)) && (($fileloglvl < 1)) && (($sysloglvl < 1)); then
|
||||
unset dfatal
|
||||
dfatal() { :; };
|
||||
fi
|
||||
@@ -306,15 +323,23 @@ _dlvl2syslvl() {
|
||||
_do_dlog() {
|
||||
local lvl="$1"; shift
|
||||
local lvlc=$(_lvl2char "$lvl") || return 0
|
||||
local msg="$lvlc: $*"
|
||||
local msg="$*"
|
||||
local lmsg="$lvlc: $*"
|
||||
|
||||
(( $lvl <= $stdloglvl )) && echo "$msg" >&2
|
||||
|
||||
if (( $lvl <= $sysloglvl )); then
|
||||
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) "$msg"
|
||||
if [[ "$_dlogfd" ]]; then
|
||||
echo "<$(_dlvl2syslvl $lvl)>$msg" >&$_dlogfd
|
||||
else
|
||||
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) -- "$msg"
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $lvl <= $fileloglvl )) && [[ -w "$logfile" ]] && [[ -f "$logfile" ]]; then
|
||||
echo "$msg" >>"$logfile"
|
||||
echo "$lmsg" >>"$logfile"
|
||||
fi
|
||||
|
||||
(( $lvl <= $kmsgloglvl )) && \
|
||||
echo "<$(_dlvl2syslvl $lvl)>dracut[$$] $msg" >/dev/kmsg
|
||||
}
|
||||
|
54
dracut.8.asc
54
dracut.8.asc
@@ -31,10 +31,10 @@ early userspace.
|
||||
For a complete list of kernel command line options see *dracut.cmdline*(7).
|
||||
|
||||
If you are dropped to an emergency shell, while booting your initramfs,
|
||||
the file _/run/initramfs/sosreport.txt_ is created, which can be safed to a
|
||||
the file _/run/initramfs/rdsosreport.txt_ is created, which can be safed to a
|
||||
(to be mounted by hand) partition (usually /boot) or a USB stick.
|
||||
Additional debugging info can be produced by adding **rd.debug** to the kernel command line.
|
||||
_/run/initramfs/sosreport.txt_ contains all logs and the output of some tools.
|
||||
_/run/initramfs/rdsosreport.txt_ contains all logs and the output of some tools.
|
||||
It should be attached to any report about dracut problems.
|
||||
|
||||
EXAMPLE
|
||||
@@ -75,12 +75,12 @@ version is:
|
||||
----
|
||||
|
||||
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
|
||||
the --hostonly 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
|
||||
--hostonly 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.
|
||||
|
||||
@@ -225,6 +225,15 @@ example:
|
||||
**--no-kernel**::
|
||||
do not install kernel drivers and firmware files
|
||||
|
||||
**--early-microcode**::
|
||||
Combine early microcode with ramdisk
|
||||
|
||||
**--no-early-microcode**::
|
||||
Do not combine early microcode with ramdisk
|
||||
|
||||
**--print-cmdline**::
|
||||
print the kernel command line for the current disk layout
|
||||
|
||||
**--mdadmconf**::
|
||||
include local _/etc/mdadm.conf_
|
||||
|
||||
@@ -260,6 +269,12 @@ example:
|
||||
**--nostrip**::
|
||||
do not strip binaries in the initramfs
|
||||
|
||||
**--prelink**::
|
||||
prelink binaries in the initramfs (default)
|
||||
|
||||
**--noprelink**::
|
||||
do not prelink binaries in the initramfs
|
||||
|
||||
**--hardlink**::
|
||||
hardlink files in the initramfs (default)
|
||||
|
||||
@@ -322,6 +337,11 @@ provide a valid _/etc/fstab_.
|
||||
**-N, --no-hostonly**::
|
||||
Disable Host-Only mode
|
||||
|
||||
**--persistent-policy** _<policy>_::
|
||||
Use _<policy>_ to address disks and partitions.
|
||||
_<policy>_ can be any directory name found in /dev/disk.
|
||||
E.g. "by-uuid", "by-label"
|
||||
|
||||
**--fstab**::
|
||||
Use _/etc/fstab_ instead of _/proc/self/mountinfo_.
|
||||
|
||||
@@ -376,7 +396,7 @@ will not be able to boot. Equivalent to "--compress=bzip2"
|
||||
[WARNING]
|
||||
====
|
||||
Make sure your kernel has lzma decompression support compiled in, otherwise you
|
||||
will not be able to boot. Equivalent to "--compress=lzma -9"
|
||||
will not be able to boot. Equivalent to "lzma --compress=lzma -9"
|
||||
====
|
||||
|
||||
**--xz**::
|
||||
@@ -385,8 +405,7 @@ will not be able to boot. Equivalent to "--compress=lzma -9"
|
||||
[WARNING]
|
||||
====
|
||||
Make sure your kernel has xz decompression support compiled in, otherwise you
|
||||
will not be able to boot. Equivalent to "--compress=xz --check=crc32
|
||||
--lzma2=dict=1MiB"
|
||||
will not be able to boot. Equivalent to "lzma --compress=xz --check=crc32 --lzma2=dict=1MiB"
|
||||
====
|
||||
|
||||
**--compress** _<compressor>_::
|
||||
@@ -409,6 +428,27 @@ will not be able to boot. Equivalent to "--compress=xz --check=crc32
|
||||
**--keep**::
|
||||
Keep the initramfs temporary directory for debugging purposes.
|
||||
|
||||
**--printsize**::
|
||||
Print out the module install size
|
||||
|
||||
**--profile**:
|
||||
Output profile information of the build process
|
||||
|
||||
**--ro-mnt**:
|
||||
Mount / and /usr read-only by default.
|
||||
|
||||
**-L, --stdlog** _<level>_::
|
||||
[0-6] Specify logging level (to standard error)
|
||||
----
|
||||
0 - suppress any messages
|
||||
1 - only fatal errors
|
||||
2 - all errors
|
||||
3 - warnings
|
||||
4 - info
|
||||
5 - debug info (here starts lots of output)
|
||||
6 - trace info (and even more)
|
||||
----
|
||||
|
||||
**--regenerate-all**::
|
||||
Regenerate all initramfs images at the default location with the kernel versions found on the system.
|
||||
Additional parameters are passed through.
|
||||
|
96
dracut.asc
96
dracut.asc
@@ -489,7 +489,7 @@ dracut shell commands are printed as they are executed
|
||||
----
|
||||
# journalctl -ab
|
||||
----
|
||||
. With dracut >= 025 the file /run/initramfs/sosreport.txt is generated, which contains all the logs and the output of all significant tools, which are mentioned later.
|
||||
. With dracut >= 025 the file /run/initramfs/rdsosreport.txt is generated, which contains all the logs and the output of all significant tools, which are mentioned later.
|
||||
|
||||
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.
|
||||
@@ -744,6 +744,23 @@ the dracut shell
|
||||
==== Additional dracut boot parameters
|
||||
For more debugging options, see <<dracutkerneldebug>> in <<dracutcmdline7>>.
|
||||
|
||||
|
||||
[[debugging-dracut-on-shutdown]]
|
||||
==== Debugging dracut on shutdown
|
||||
|
||||
To debug the shutdown sequence on systemd systems, you can _rd.break_
|
||||
on _pre-shutdown_ or _shutdown_.
|
||||
|
||||
To do this from an already booted system:
|
||||
----
|
||||
# mkdir -p /run/initramfs/etc/cmdline.d
|
||||
# echo "rd.break=pre-shutdown" > /run/initramfs/etc/cmdline.d/debug.conf
|
||||
# touch /run/initramfs/.need_shutdown
|
||||
----
|
||||
|
||||
This will give you a dracut shell after the system pivot'ed back in the initramfs.
|
||||
|
||||
|
||||
= Developer Manual
|
||||
|
||||
== dracut Components
|
||||
@@ -777,25 +794,12 @@ scripts and udev rules.
|
||||
[[stages]]
|
||||
== Boot Process Stages
|
||||
|
||||
The init script in _99base_ is the main script, which prepares the root file
|
||||
system for usage, runs udev, mounts the real root device, kills the remaining
|
||||
processes, and switches to the real root device for further booting. dracut
|
||||
modules can insert custom script at various points, to control the boot process.
|
||||
dracut modules can insert custom script at various points, to control the boot
|
||||
process.
|
||||
These hooks are plain directories containing shell scripts ending with ".sh",
|
||||
which are sourced by init.
|
||||
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
|
||||
|
||||
|
||||
|
||||
=== Basic Setup
|
||||
|
||||
The first thing init does, is to mount _/proc_ and _/sys_ and manually create
|
||||
the basic device nodes and symbolic links in _/dev_ needed to execute basic
|
||||
commands. Then logging is setup according to kernel command line arguments.
|
||||
_/dev/pts_ and _/dev/shm_ are mounted and the first hook is sourced.
|
||||
|
||||
|
||||
|
||||
=== Hook: cmdline
|
||||
|
||||
The _cmdline_ hook is a place to insert scripts to parse the kernel command line
|
||||
@@ -813,63 +817,49 @@ This hook is executed right after the cmdline hook and a check if root and
|
||||
rootok were set. Here modules can take action with the final root, and before
|
||||
udev has been run.
|
||||
|
||||
|
||||
|
||||
=== Start Udev
|
||||
|
||||
Now udev is started and the logging for udev is setup.
|
||||
|
||||
|
||||
|
||||
=== Hook: pre-trigger
|
||||
|
||||
In this hook, you can set udev environment variables with **udevadm control
|
||||
--property=KEY=_value_** or control the further execution of udev with
|
||||
udevadm.
|
||||
|
||||
|
||||
|
||||
=== Trigger Udev
|
||||
|
||||
udev is triggered by calling udevadm trigger, which sends add events for all
|
||||
devices and subsystems.
|
||||
|
||||
|
||||
|
||||
=== Main Loop
|
||||
|
||||
Now the main loop of 99base/init begins. Here we loop until udev has settled and
|
||||
all scripts in _initqueue/finished_ returned true. In this loop there are three
|
||||
hooks, where scripts can be inserted by calling /sbin/initqueue.
|
||||
|
||||
|
||||
In the main loop of dracut loops until udev has settled and
|
||||
all scripts in _initqueue/finished_ returned true.
|
||||
In this loop there are three hooks, where scripts can be inserted
|
||||
by calling /sbin/initqueue.
|
||||
|
||||
==== Initqueue
|
||||
|
||||
This hook gets executed every time a script is inserted here, regardless of the
|
||||
udev state.
|
||||
|
||||
|
||||
|
||||
==== Initqueue settled
|
||||
|
||||
This hooks gets executed every time udev has settled.
|
||||
|
||||
This hooks (initqueue/settled) gets executed every time udev has settled.
|
||||
|
||||
|
||||
==== Initqueue timeout
|
||||
|
||||
This hooks gets executed, when the main loop counter becomes half of the
|
||||
This hooks (initqueue/timeout) gets executed, when the main loop counter becomes half of the
|
||||
rd.retry counter.
|
||||
|
||||
|
||||
|
||||
==== Initqueue finished
|
||||
|
||||
This hook is called after udev has settled and if all scripts herein return 0
|
||||
the main loop will be ended.
|
||||
|
||||
|
||||
This hook (initqueue/finished) is called after udev has settled and
|
||||
if all scripts herein return 0 the main loop will be ended.
|
||||
Abritary scripts can be added here, to loop in the
|
||||
initqueue until something happens, which a dracut module wants to wait for.
|
||||
|
||||
=== Hook: pre-mount
|
||||
|
||||
@@ -877,20 +867,15 @@ Before the root device is mounted all scripts in the hook pre-mount are
|
||||
executed. In some cases (e.g. NFS) the real root device is already mounted,
|
||||
though.
|
||||
|
||||
|
||||
|
||||
=== Hook: mount
|
||||
|
||||
This hook is mainly to mount the real root device.
|
||||
|
||||
|
||||
|
||||
=== Hook: pre-pivot
|
||||
|
||||
This hook is called before cleanup hook, This is a good place for
|
||||
actions other than cleanups which need to be called before pivot.
|
||||
|
||||
|
||||
=== Hook: cleanup
|
||||
|
||||
This hook is the last hook and is called before init finally switches root to
|
||||
@@ -900,21 +885,18 @@ needed anymore.
|
||||
|
||||
=== Cleanup and switch_root
|
||||
|
||||
Init kills all udev processes, cleans up the environment, sets up the arguments
|
||||
for the real init process and finally calls switch_root. switch_root removes the
|
||||
whole filesystem hierarchy of the initramfs, chroot()s to the real root device
|
||||
and calls /sbin/init with the specified arguments.
|
||||
Init (or systemd) kills all udev processes, cleans up the environment,
|
||||
sets up the arguments for the real init process and finally calls switch_root.
|
||||
switch_root removes the whole filesystem hierarchy of the initramfs,
|
||||
chroot()s to the real root device and calls /sbin/init with the specified arguments.
|
||||
|
||||
To ensure all files in the initramfs hierarchy can be removed, all processes
|
||||
still running from the initramfs should not have any open file descriptors left.
|
||||
|
||||
|
||||
|
||||
== Network Infrastructure
|
||||
|
||||
FIXME
|
||||
|
||||
|
||||
== Writing a Module
|
||||
|
||||
A simple example module is _96insmodpost_, which modprobes a kernel module after
|
||||
@@ -926,8 +908,6 @@ First we create a check() function, which just exits with 0 indicating that this
|
||||
module should be included by default.
|
||||
|
||||
check():
|
||||
|
||||
|
||||
----
|
||||
return 0
|
||||
----
|
||||
@@ -937,8 +917,6 @@ priority number 20 called _parse-insmodpost.sh_. It also installs the
|
||||
_insmodpost.sh_ script in _/sbin_.
|
||||
|
||||
install():
|
||||
|
||||
|
||||
----
|
||||
inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
|
||||
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
|
||||
@@ -949,8 +927,6 @@ rd.driver.post, blacklists the module from being autoloaded and installs the
|
||||
hook _insmodpost.sh_ in the _initqueue/settled_.
|
||||
|
||||
_parse-insmodpost.sh_:
|
||||
|
||||
|
||||
----
|
||||
for p in $(getargs rd.driver.post=); do
|
||||
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
|
||||
@@ -967,8 +943,6 @@ modprobe the kernel modules specified in all rd.driver.post kernel command line
|
||||
parameters. It runs after udev has settled and is only called once (--onetime).
|
||||
|
||||
_insmodpost.sh_:
|
||||
|
||||
|
||||
----
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
@@ -1010,7 +984,7 @@ depends on.
|
||||
|
||||
=== install()
|
||||
|
||||
dracut_install
|
||||
inst_multiple
|
||||
|
||||
inst
|
||||
|
||||
|
@@ -69,6 +69,12 @@ rootfstype=ext3
|
||||
force mounting _/_ and _/usr_ (if it is a separate device) read-write.
|
||||
See also ro option.
|
||||
|
||||
**rootfallback=**_<path to blockdevice>_::
|
||||
specify the block device to use as the root filesystem, if the normal root cannot be found.
|
||||
This can only be a simple block device with a simple file system, for which the filesystem
|
||||
driver is either compiled in, or added manually to the initramfs.
|
||||
This parameter can be specified multiple times.
|
||||
|
||||
**rd.auto** **rd.auto=1**::
|
||||
enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or lvm.
|
||||
Default is off as of dracut version >= 024.
|
||||
@@ -124,10 +130,10 @@ Misc
|
||||
[[dracutkerneldebug]]
|
||||
Debug
|
||||
~~~~~
|
||||
If you are dropped to an emergency shell, the file _/run/initramfs/sosreport.txt_ is created,
|
||||
If you are dropped to an emergency shell, the file _/run/initramfs/rdsosreport.txt_ is created,
|
||||
which can be safed to a (to be mounted by hand) partition (usually /boot) or a USB stick.
|
||||
Additional debugging info can be produced by adding **rd.debug** to the kernel command line.
|
||||
_/run/initramfs/sosreport.txt_ contains all logs and the output of some tools.
|
||||
_/run/initramfs/rdsosreport.txt_ contains all logs and the output of some tools.
|
||||
It should be attached to any report about dracut problems.
|
||||
|
||||
**rd.info**::
|
||||
|
@@ -67,10 +67,18 @@ Configuration files must have the extension .conf; other extensions are ignored.
|
||||
*do_strip=*"__{yes|no}__"::
|
||||
Strip binaries in the initramfs (default=yes)
|
||||
|
||||
*do_prelink=*"__{yes|no}__"::
|
||||
Prelink binaries in the initramfs (default=yes)
|
||||
|
||||
*hostonly=*"__{yes|no}__"::
|
||||
Host-Only mode: Install only what is needed for booting the local host
|
||||
instead of a generic host and generate host-specific configuration.
|
||||
|
||||
*persistent_policy=*"__<policy>__"::
|
||||
Use _<policy>_ to address disks and partitions.
|
||||
_<policy>_ can be any directory name found in /dev/disk.
|
||||
E.g. "by-uuid", "by-label"
|
||||
|
||||
*tmpdir=*"__<temporary directory>__"::
|
||||
Specify temporary directory to use.
|
||||
|
||||
@@ -105,7 +113,7 @@ 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*
|
||||
*ro_mnt=*"__{yes|no}__"::
|
||||
Mount _/_ and _/usr_ read-only by default.
|
||||
|
||||
*kernel_cmdline=*"__parameters__"::
|
||||
@@ -117,6 +125,24 @@ If chrooted to another root other than the real root device, use --fstab and pro
|
||||
*no_kernel=*"{yes|no}"::
|
||||
Do not install kernel drivers and firmware files (default=no)
|
||||
|
||||
*acpi_override=*"{yes|no}"::
|
||||
[WARNING] ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING! +
|
||||
Override BIOS provided ACPI tables. For further documentation read
|
||||
Documentation/acpi/initrd_table_override.txt in the kernel sources.
|
||||
Search for ACPI table files (must have .aml suffix) in acpi_table_dir=
|
||||
directory (see below) and add them to a separate uncompressed cpio
|
||||
archive. This cpio archive gets glued (concatenated, uncompressed one
|
||||
must be the first one) to the compressed cpio archive. The first,
|
||||
uncompressed cpio archive is for data which the kernel must be able
|
||||
to access very early (and cannot make use of uncompress alogrithms yet)
|
||||
like microcode or ACPI tables (default=no).
|
||||
|
||||
*acpi_table_dir=*"__<dir>__"::
|
||||
Directory to search for ACPI tables if acpi_override= is set to yes.
|
||||
|
||||
*early_microcode=*"{yes|no}"::
|
||||
Combine early microcode with ramdisk (default=no)
|
||||
|
||||
*stdloglvl*="__\{0-6\}__"::
|
||||
Set logging to standard error level.
|
||||
|
||||
|
@@ -2,16 +2,13 @@
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
|
||||
omit_drivers+=' .*/fs/ocfs/.* i2o_scsi'
|
||||
i18n_default_font="latarcyrheb-sun16"
|
||||
stdloglvl=3
|
||||
logfile=/var/log/dracut.log
|
||||
fileloglvl=6
|
||||
sysloglvl=5
|
||||
install_items+=" vi /etc/virc ps grep cat rm "
|
||||
prefix="/"
|
||||
systemdutildir=/usr/lib/systemd
|
||||
systemdsystemunitdir=/usr/lib/systemd/system
|
||||
systemdsystemconfdir=/etc/systemd/system
|
||||
udevdir=/usr/lib/udev
|
||||
add_dracutmodules+=" systemd "
|
||||
hostonly="yes"
|
||||
dracut_rescue_image="yes"
|
||||
|
@@ -10,5 +10,6 @@ ro_mnt=yes
|
||||
|
||||
# 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"
|
||||
i18n_default_font="LatArCyrHeb-16"
|
||||
|
||||
omit_drivers+=" i2o_scsi"
|
||||
|
1550
dracut.css
Normal file
1550
dracut.css
Normal file
File diff suppressed because it is too large
Load Diff
550
dracut.sh
550
dracut.sh
@@ -74,24 +74,31 @@ Creates initial ramdisk images for preloading modules
|
||||
call when building the initramfs. Modules are located
|
||||
in /usr/lib/dracut/modules.d.
|
||||
-o, --omit [LIST] Omit a space-separated list of dracut modules.
|
||||
--force-add [LIST] Force to add a space-separated list of dracut modules
|
||||
to the default set of modules, when -H is specified.
|
||||
-d, --drivers [LIST] Specify a space-separated list of kernel modules to
|
||||
exclusively include in the initramfs.
|
||||
--add-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules to add to the initramfs.
|
||||
exclusively include in the initramfs.
|
||||
--add-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules to add to the initramfs.
|
||||
--omit-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules not to add to the initramfs.
|
||||
modules not to add to the initramfs.
|
||||
--filesystems [LIST] Specify a space-separated list of kernel filesystem
|
||||
modules to exclusively include in the generic
|
||||
initramfs.
|
||||
modules to exclusively include in the generic
|
||||
initramfs.
|
||||
-k, --kmoddir [DIR] Specify the directory, where to look for kernel
|
||||
modules
|
||||
modules
|
||||
--fwdir [DIR] Specify additional directories, where to look for
|
||||
firmwares, separated by :
|
||||
firmwares, separated by :
|
||||
--kernel-only Only install kernel drivers and firmware files
|
||||
--no-kernel Do not install kernel drivers and firmware files
|
||||
--print-cmdline Print the kernel command line for the given disk layout
|
||||
--early-microcode Combine early microcode with ramdisk
|
||||
--no-early-microcode Do not combine early microcode with ramdisk
|
||||
--kernel-cmdline [PARAMETERS] Specify default kernel command line parameters
|
||||
--strip Strip binaries in the initramfs
|
||||
--nostrip Do not strip binaries in the initramfs
|
||||
--prelink Prelink binaries in the initramfs
|
||||
--noprelink Do not prelink binaries in the initramfs
|
||||
--hardlink Hardlink files in the initramfs
|
||||
--nohardlink Do not hardlink files in the initramfs
|
||||
--prefix [DIR] Prefix initramfs files with [DIR]
|
||||
@@ -127,8 +134,12 @@ Creates initial ramdisk images for preloading modules
|
||||
/usr/lib/dracut/modules.d.
|
||||
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.
|
||||
booting the local host instead of a generic host.
|
||||
-N, --no-hostonly Disables Host-Only mode
|
||||
--persistent-policy [POLICY]
|
||||
Use [POLICY] to address disks and partitions.
|
||||
POLICY can be any directory name found in /dev/disk.
|
||||
E.g. "by-uuid", "by-label"
|
||||
--fstab Use /etc/fstab to determine the root device.
|
||||
--add-fstab [FILE] Add file to the initramfs fstab
|
||||
--mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
|
||||
@@ -211,7 +222,7 @@ pop() {
|
||||
if [[ "$__resultvar" ]]; then
|
||||
eval $__resultvar="'$_value'"
|
||||
else
|
||||
echo "$_value"
|
||||
printf "%s" "$_value"
|
||||
fi
|
||||
eval unset ${__stack}'[${#'${__stack}'[@]}-1]'
|
||||
return 0
|
||||
@@ -235,28 +246,30 @@ read_arg() {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
dropindirs_sort()
|
||||
{
|
||||
suffix=$1; shift
|
||||
args=("$@")
|
||||
files=$(
|
||||
while (( $# > 0 )); do
|
||||
for i in ${1}/*${suffix}; do
|
||||
[[ -f $i ]] && echo ${i##*/}
|
||||
done
|
||||
shift
|
||||
done | sort -Vu
|
||||
)
|
||||
local suffix=$1; shift
|
||||
local -a files
|
||||
local f d
|
||||
|
||||
for f in $files; do
|
||||
for d in "${args[@]}"; do
|
||||
if [[ -f "$d/$f" ]]; then
|
||||
echo "$d/$f"
|
||||
continue 2
|
||||
for d in "$@"; do
|
||||
for i in "$d/"*"$suffix"; do
|
||||
if [[ -e "$i" ]]; then
|
||||
printf "%s\n" "${i##*/}"
|
||||
fi
|
||||
done
|
||||
done
|
||||
done | sort -Vu | {
|
||||
readarray -t files
|
||||
|
||||
for f in "${files[@]}"; do
|
||||
for d in "$@"; do
|
||||
if [[ -e "$d/$f" ]]; then
|
||||
printf "%s\n" "$d/$f"
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
}
|
||||
|
||||
verbosity_mod_l=0
|
||||
@@ -300,9 +313,12 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
|
||||
--long force \
|
||||
--long kernel-only \
|
||||
--long no-kernel \
|
||||
--long print-cmdline \
|
||||
--long kernel-cmdline: \
|
||||
--long strip \
|
||||
--long nostrip \
|
||||
--long prelink \
|
||||
--long noprelink \
|
||||
--long hardlink \
|
||||
--long nohardlink \
|
||||
--long noprefix \
|
||||
@@ -317,7 +333,10 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
|
||||
--long quiet \
|
||||
--long local \
|
||||
--long hostonly \
|
||||
--long host-only \
|
||||
--long no-hostonly \
|
||||
--long no-host-only \
|
||||
--long persistent-policy: \
|
||||
--long fstab \
|
||||
--long help \
|
||||
--long bzip2 \
|
||||
@@ -331,6 +350,8 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
|
||||
--long printsize \
|
||||
--long regenerate-all \
|
||||
--long noimageifnotneeded \
|
||||
--long early-microcode \
|
||||
--long no-early-microcode \
|
||||
-- "$@")
|
||||
|
||||
if (( $? != 0 )); then
|
||||
@@ -372,8 +393,13 @@ while :; do
|
||||
-f|--force) force=yes;;
|
||||
--kernel-only) kernel_only="yes"; no_kernel="no";;
|
||||
--no-kernel) kernel_only="no"; no_kernel="yes";;
|
||||
--print-cmdline) print_cmdline="yes"; hostonly_l="yes"; kernel_only="yes"; no_kernel="yes";;
|
||||
--early-microcode) early_microcode_l="yes";;
|
||||
--no-early-microcode) early_microcode_l="no";;
|
||||
--strip) do_strip_l="yes";;
|
||||
--nostrip) do_strip_l="no";;
|
||||
--prelink) do_prelink_l="yes";;
|
||||
--noprelink) do_prelink_l="no";;
|
||||
--hardlink) do_hardlink_l="yes";;
|
||||
--nohardlink) do_hardlink_l="no";;
|
||||
--noprefix) prefix_l="/";;
|
||||
@@ -388,11 +414,15 @@ while :; do
|
||||
-q|--quiet) ((verbosity_mod_l--));;
|
||||
-l|--local)
|
||||
allowlocal="yes"
|
||||
[[ -f "$(readlink -f ${0%/*})/dracut-functions.sh" ]] \
|
||||
&& dracutbasedir="$(readlink -f ${0%/*})"
|
||||
[[ -f "$(readlink -f "${0%/*}")/dracut-functions.sh" ]] \
|
||||
&& dracutbasedir="$(readlink -f "${0%/*}")"
|
||||
;;
|
||||
-H|--hostonly) hostonly_l="yes" ;;
|
||||
-N|--no-hostonly) hostonly_l="no" ;;
|
||||
-H|--hostonly|--host-only)
|
||||
hostonly_l="yes" ;;
|
||||
-N|--no-hostonly|--no-host-only)
|
||||
hostonly_l="no" ;;
|
||||
--persistent-policy)
|
||||
persistent_policy_l="$2"; shift;;
|
||||
--fstab) use_fstab_l="yes" ;;
|
||||
-h|--help) long_usage; exit 1 ;;
|
||||
-i|--include) push include_src "$2"
|
||||
@@ -444,12 +474,12 @@ done
|
||||
if [[ $regenerate_all == "yes" ]]; then
|
||||
ret=0
|
||||
if [[ $kernel ]]; then
|
||||
echo "--regenerate-all cannot be called with a kernel version" >&2
|
||||
printf -- "--regenerate-all cannot be called with a kernel version\n" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $outfile ]]; then
|
||||
echo "--regenerate-all cannot be called with a image file" >&2
|
||||
printf -- "--regenerate-all cannot be called with a image file\n" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -462,10 +492,15 @@ if [[ $regenerate_all == "yes" ]]; then
|
||||
cd /lib/modules
|
||||
for i in *; do
|
||||
[[ -f $i/modules.builtin ]] || continue
|
||||
dracut --kver=$i "${dracut_args[@]}"
|
||||
dracut --kver="$i" "${dracut_args[@]}"
|
||||
((ret+=$?))
|
||||
done
|
||||
exit $ret
|
||||
elif [[ $kernel ]]; then
|
||||
if ! [[ -d /lib/modules/$kernel ]] && [[ $no_kernel != yes ]]; then
|
||||
printf -- "Kernel version $kernel has no modules in /lib/modules/$kernel\n" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! [[ $kernel ]]; then
|
||||
@@ -492,6 +527,10 @@ for i in /usr/sbin /sbin /usr/bin /bin; do
|
||||
fi
|
||||
done
|
||||
export PATH="${NPATH#:}"
|
||||
unset LC_MESSAGES
|
||||
unset LC_CTYPE
|
||||
export LC_ALL=C
|
||||
export LANG=C
|
||||
unset NPATH
|
||||
unset LD_LIBRARY_PATH
|
||||
unset GREP_OPTIONS
|
||||
@@ -513,13 +552,19 @@ export DRACUT_LOG_LEVEL=warning
|
||||
|
||||
# if we were not passed a config file, try the default one
|
||||
if [[ ! -f $conffile ]]; then
|
||||
[[ $allowlocal ]] && conffile="$dracutbasedir/dracut.conf" || \
|
||||
if [[ $allowlocal ]]; then
|
||||
conffile="$dracutbasedir/dracut.conf"
|
||||
else
|
||||
conffile="/etc/dracut.conf"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -d $confdir ]]; then
|
||||
[[ $allowlocal ]] && confdir="$dracutbasedir/dracut.conf.d" || \
|
||||
if [[ $allowlocal ]]; then
|
||||
confdir="$dracutbasedir/dracut.conf.d"
|
||||
else
|
||||
confdir="/etc/dracut.conf.d"
|
||||
fi
|
||||
fi
|
||||
|
||||
# source our config file
|
||||
@@ -612,11 +657,14 @@ 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=yes
|
||||
[[ $do_prelink_l ]] && do_prelink=$do_prelink_l
|
||||
[[ $do_prelink ]] || do_prelink=yes
|
||||
[[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l
|
||||
[[ $do_hardlink ]] || do_hardlink=yes
|
||||
[[ $prefix_l ]] && prefix=$prefix_l
|
||||
[[ $prefix = "/" ]] && unset prefix
|
||||
[[ $hostonly_l ]] && hostonly=$hostonly_l
|
||||
[[ $persistent_policy_l ]] && persistent_policy=$persistent_policy_l
|
||||
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
|
||||
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
|
||||
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
|
||||
@@ -628,6 +676,8 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
[[ $show_modules_l ]] && show_modules=$show_modules_l
|
||||
[[ $nofscks_l ]] && nofscks="yes"
|
||||
[[ $ro_mnt_l ]] && ro_mnt="yes"
|
||||
[[ $early_microcode_l ]] && early_microcode=$early_microcode_l
|
||||
[[ $early_microcode ]] || early_microcode=no
|
||||
# eliminate IFS hackery when messing with fw_dir
|
||||
fw_dir=${fw_dir//:/ }
|
||||
|
||||
@@ -637,8 +687,7 @@ case $compress in
|
||||
bzip2) compress="bzip2 -9";;
|
||||
lzma) compress="lzma -9";;
|
||||
xz) compress="xz --check=crc32 --lzma2=dict=1MiB";;
|
||||
gzip) command -v pigz > /dev/null 2>&1 && compress="pigz -9" || \
|
||||
compress="gzip -9";;
|
||||
gzip) compress="gzip -9"; command -v pigz > /dev/null 2>&1 && compress="pigz -9";;
|
||||
esac
|
||||
if [[ $_no_compress_l = "cat" ]]; then
|
||||
compress="cat"
|
||||
@@ -648,14 +697,29 @@ fi
|
||||
[[ $hostonly != "-h" ]] && unset hostonly
|
||||
|
||||
readonly TMPDIR="$tmpdir"
|
||||
readonly initdir=$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)
|
||||
readonly initdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)"
|
||||
[ -d "$initdir" ] || {
|
||||
echo "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t initramfs.XXXXXX failed." >&2
|
||||
printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t initramfs.XXXXXX failed." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ $early_microcode = yes ]]; then
|
||||
readonly early_cpio_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_cpio.XXXXXX)"
|
||||
[ -d "$early_cpio_dir" ] || {
|
||||
printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t early_cpio.XXXXXX failed." >&2
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'ret=$?;[[ $outfile ]] && [[ -f $outfile.$$ ]] && rm -f "$outfile.$$";[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf "$initdir";exit $ret; };' EXIT
|
||||
trap '
|
||||
ret=$?;
|
||||
[[ $outfile ]] && [[ -f $outfile.$$ ]] && rm -f -- "$outfile.$$";
|
||||
[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf -- "$initdir"; };
|
||||
[[ $keep ]] && echo "Not removing $early_cpio_dir." >&2 || { [[ $early_cpio_dir ]] && rm -Rf -- "$early_cpio_dir"; };
|
||||
[[ $_dlogdir ]] && rm -Rf -- "$_dlogdir";
|
||||
exit $ret;
|
||||
' EXIT
|
||||
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'exit 1;' SIGINT
|
||||
|
||||
@@ -665,27 +729,28 @@ export DRACUT_RESOLVE_LAZY="1"
|
||||
if [[ -f $dracutbasedir/dracut-functions.sh ]]; then
|
||||
. $dracutbasedir/dracut-functions.sh
|
||||
else
|
||||
echo "dracut: Cannot find $dracutbasedir/dracut-functions.sh." >&2
|
||||
echo "dracut: Are you running from a git checkout?" >&2
|
||||
echo "dracut: Try passing -l as an argument to $0" >&2
|
||||
printf "%s\n" "dracut: Cannot find $dracutbasedir/dracut-functions.sh." >&2
|
||||
printf "%s\n" "dracut: Are you running from a git checkout?" >&2
|
||||
printf "%s\n" "dracut: Try passing -l as an argument to $0" >&2
|
||||
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
|
||||
if ! [[ $print_cmdline ]]; then
|
||||
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}/*
|
||||
fi
|
||||
rm -fr ${initdir}/*
|
||||
|
||||
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
|
||||
. $dracutbasedir/dracut-version.sh
|
||||
fi
|
||||
|
||||
# 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.'
|
||||
if (( BASH_VERSINFO[0] < 4 )); then
|
||||
dfatal 'You need at least Bash 4 to use dracut, sorry.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -722,7 +787,7 @@ fi
|
||||
|
||||
omit_drivers_corrected=""
|
||||
for d in $omit_drivers; do
|
||||
strstr " $drivers $add_drivers " " $d " && continue
|
||||
[[ " $drivers $add_drivers " == *\ $d\ * ]] && continue
|
||||
omit_drivers_corrected+="$d|"
|
||||
done
|
||||
omit_drivers="${omit_drivers_corrected%|}"
|
||||
@@ -730,18 +795,18 @@ unset omit_drivers_corrected
|
||||
|
||||
# prepare args for logging
|
||||
for ((i=0; i < ${#dracut_args[@]}; i++)); do
|
||||
strstr "${dracut_args[$i]}" " " && \
|
||||
[[ "${dracut_args[$i]}" == *\ * ]] && \
|
||||
dracut_args[$i]="\"${dracut_args[$i]}\""
|
||||
#" keep vim happy
|
||||
done
|
||||
ddebug "Executing: $0 ${dracut_args[@]}"
|
||||
dinfo "Executing: $0 ${dracut_args[@]}"
|
||||
|
||||
[[ $do_list = yes ]] && {
|
||||
for mod in $dracutbasedir/modules.d/*; do
|
||||
[[ -d $mod ]] || continue;
|
||||
[[ -e $mod/install || -e $mod/installkernel || \
|
||||
-e $mod/module-setup.sh ]] || continue
|
||||
echo ${mod##*/??}
|
||||
printf "%s\n" "${mod##*/??}"
|
||||
done
|
||||
exit 0
|
||||
}
|
||||
@@ -759,23 +824,25 @@ if [[ -d $srcmods ]]; then
|
||||
}
|
||||
fi
|
||||
|
||||
if [[ -f $outfile && ! $force ]]; then
|
||||
dfatal "Will not override existing initramfs ($outfile) without --force"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! $print_cmdline ]]; then
|
||||
if [[ -f $outfile && ! $force ]]; then
|
||||
dfatal "Will not override existing initramfs ($outfile) without --force"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
outdir=${outfile%/*}
|
||||
[[ $outdir ]] || outdir="/"
|
||||
outdir=${outfile%/*}
|
||||
[[ $outdir ]] || outdir="/"
|
||||
|
||||
if [[ ! -d "$outdir" ]]; then
|
||||
dfatal "Can't write to $outdir: Directory $outdir does not exist or is not accessible."
|
||||
exit 1
|
||||
elif [[ ! -w "$outdir" ]]; then
|
||||
dfatal "No permission to write to $outdir."
|
||||
exit 1
|
||||
elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
|
||||
dfatal "No permission to write $outfile."
|
||||
exit 1
|
||||
if [[ ! -d "$outdir" ]]; then
|
||||
dfatal "Can't write to $outdir: Directory $outdir does not exist or is not accessible."
|
||||
exit 1
|
||||
elif [[ ! -w "$outdir" ]]; then
|
||||
dfatal "No permission to write to $outdir."
|
||||
exit 1
|
||||
elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
|
||||
dfatal "No permission to write $outfile."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Need to be able to have non-root users read stuff (rpcbind etc)
|
||||
@@ -783,15 +850,11 @@ chmod 755 "$initdir"
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
for i in /sys /proc /run /dev; do
|
||||
if ! findmnt "$i" &>/dev/null; then
|
||||
if ! findmnt --target "$i" &>/dev/null; then
|
||||
dwarning "Turning off host-only mode: '$i' is not mounted!"
|
||||
unset hostonly
|
||||
fi
|
||||
done
|
||||
if ! [[ -d /run/udev/data ]]; then
|
||||
dwarning "Turning off host-only mode: udev database not found!"
|
||||
unset hostonly
|
||||
fi
|
||||
fi
|
||||
|
||||
declare -A host_fs_types
|
||||
@@ -804,87 +867,143 @@ for line in "${fstab_lines[@]}"; do
|
||||
done
|
||||
|
||||
for f in $add_fstab; do
|
||||
[ -e $f ] || continue
|
||||
[[ -e $f ]] || continue
|
||||
while read dev rest; do
|
||||
push host_devs $dev
|
||||
done < $f
|
||||
push host_devs "$dev"
|
||||
done < "$f"
|
||||
done
|
||||
|
||||
for dev in $add_device; do
|
||||
push host_devs "$dev"
|
||||
done
|
||||
|
||||
if (( ${#add_device_l[@]} )); then
|
||||
while pop add_device_l val; do
|
||||
add_device+=" $val "
|
||||
push host_devs "$val"
|
||||
done
|
||||
fi
|
||||
|
||||
for dev in $add_device; do
|
||||
push host_devs $dev
|
||||
done
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
# in hostonly mode, determine all devices, which have to be accessed
|
||||
# and examine them for filesystem types
|
||||
|
||||
push host_mp \
|
||||
for mp in \
|
||||
"/" \
|
||||
"/etc" \
|
||||
"/bin" \
|
||||
"/sbin" \
|
||||
"/lib" \
|
||||
"/lib64" \
|
||||
"/usr" \
|
||||
"/usr/bin" \
|
||||
"/usr/sbin" \
|
||||
"/usr/lib" \
|
||||
"/usr/lib64" \
|
||||
"/boot"
|
||||
|
||||
for mp in "${host_mp[@]}"; do
|
||||
"/boot";
|
||||
do
|
||||
mp=$(readlink -f "$mp")
|
||||
mountpoint "$mp" >/dev/null 2>&1 || continue
|
||||
push host_devs $(readlink -f "/dev/block/$(find_block_device "$mp")")
|
||||
_dev=$(find_block_device "$mp")
|
||||
_bdev=$(readlink -f "/dev/block/$_dev")
|
||||
[[ -b $_bdev ]] && _dev=$_bdev
|
||||
push host_devs $_dev
|
||||
[[ "$_mp" == "/" ]] && root_dev="$_dev"
|
||||
push host_devs "$_dev"
|
||||
done
|
||||
|
||||
while read dev type rest; do
|
||||
[[ -b $dev ]] || continue
|
||||
[[ "$type" == "partition" ]] || continue
|
||||
while read _d _m _t _o _r; do
|
||||
[[ "$_d" == \#* ]] && continue
|
||||
[[ $_d ]] || continue
|
||||
[[ $_t != "swap" ]] || [[ $_m != "swap" ]] && continue
|
||||
[[ "$_o" == *noauto* ]] && continue
|
||||
[[ "$_d" == UUID\=* ]] && _d="/dev/disk/by-uuid/${_d#UUID=}"
|
||||
[[ "$_d" == LABEL\=* ]] && _d="/dev/disk/by-label/$_d#LABEL=}"
|
||||
[[ "$_d" -ef "$dev" ]] || continue
|
||||
push host_devs $(readlink -f $dev)
|
||||
break
|
||||
done < /etc/fstab
|
||||
done < /proc/swaps
|
||||
if [[ -f /proc/swaps ]] && [[ -f /etc/fstab ]]; then
|
||||
while read dev type rest; do
|
||||
[[ -b $dev ]] || continue
|
||||
[[ "$type" == "partition" ]] || continue
|
||||
|
||||
while read _d _m _t _o _r; do
|
||||
[[ "$_d" == \#* ]] && continue
|
||||
[[ $_d ]] || continue
|
||||
[[ $_t != "swap" ]] && continue
|
||||
[[ $_m != "swap" ]] && [[ $_m != "none" ]] && continue
|
||||
[[ "$_o" == *noauto* ]] && continue
|
||||
_d=$(expand_persistent_dev "$_d")
|
||||
[[ "$_d" -ef "$dev" ]] || continue
|
||||
|
||||
if [[ -f /etc/crypttab ]]; then
|
||||
while read _mapper _a _p _o; do
|
||||
[[ $_mapper = \#* ]] && continue
|
||||
[[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
|
||||
[[ "$_o" ]] || _o="$_p"
|
||||
# skip mkswap swap
|
||||
[[ $_o == *swap* ]] && continue 2
|
||||
done < /etc/crypttab
|
||||
fi
|
||||
|
||||
push host_devs "$(readlink -f "$dev")"
|
||||
break
|
||||
done < /etc/fstab
|
||||
done < /proc/swaps
|
||||
fi
|
||||
# record all host modaliases
|
||||
declare -A host_modalias
|
||||
find /sys/devices/ -name uevent -print > "$initdir/.modalias"
|
||||
while read m; do
|
||||
while read line; do
|
||||
[[ "$line" != MODALIAS\=* ]] && continue
|
||||
modalias="${line##MODALIAS=}" && [[ $modalias ]] && host_modalias["$modalias"]=1
|
||||
break
|
||||
done < "$m"
|
||||
done < "$initdir/.modalias"
|
||||
|
||||
rm -f -- "$initdir/.modalias"
|
||||
|
||||
# check /proc/modules
|
||||
declare -A host_modules
|
||||
while read m rest; do
|
||||
host_modules["$m"]=1
|
||||
done </proc/modules
|
||||
fi
|
||||
|
||||
_get_fs_type() (
|
||||
unset m
|
||||
unset rest
|
||||
|
||||
_get_fs_type() {
|
||||
[[ $1 ]] || return
|
||||
if [[ -b $1 ]] && get_fs_env $1; then
|
||||
echo "$(readlink -f $1) $ID_FS_TYPE"
|
||||
if [[ -b /dev/block/$1 ]] && ID_FS_TYPE=$(get_fs_env "/dev/block/$1"); then
|
||||
host_fs_types["$(readlink -f "/dev/block/$1")"]="$ID_FS_TYPE"
|
||||
return 1
|
||||
fi
|
||||
if [[ -b /dev/block/$1 ]] && get_fs_env /dev/block/$1; then
|
||||
echo "$(readlink -f /dev/block/$1) $ID_FS_TYPE"
|
||||
if [[ -b $1 ]] && ID_FS_TYPE=$(get_fs_env "$1"); then
|
||||
host_fs_types["$(readlink -f "$1")"]="$ID_FS_TYPE"
|
||||
return 1
|
||||
fi
|
||||
if fstype=$(find_dev_fstype $1); then
|
||||
echo "$1 $fstype"
|
||||
if fstype=$(find_dev_fstype "$1"); then
|
||||
host_fs_types["$1"]="$fstype"
|
||||
return 1
|
||||
fi
|
||||
return 1
|
||||
)
|
||||
}
|
||||
|
||||
for dev in "${host_devs[@]}"; do
|
||||
while read key val; do
|
||||
host_fs_types["$key"]="$val"
|
||||
done < <(
|
||||
_get_fs_type $dev
|
||||
check_block_and_slaves_all _get_fs_type $(get_maj_min $dev)
|
||||
)
|
||||
for dev in ${host_devs[@]}; do
|
||||
_get_fs_type "$dev"
|
||||
check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
|
||||
done
|
||||
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[[ ${host_fs_types[$dev]} = "reiserfs" ]] || [[ ${host_fs_types[$dev]} = "xfs" ]] || continue
|
||||
rootopts=$(find_dev_fsopts "$dev")
|
||||
if [[ ${host_fs_types[$dev]} = "reiserfs" ]]; then
|
||||
journaldev=$(fs_get_option $rootopts "jdev")
|
||||
elif [[ ${host_fs_types[$dev]} = "xfs" ]]; then
|
||||
journaldev=$(fs_get_option $rootopts "logdev")
|
||||
fi
|
||||
if [[ $journaldev ]]; then
|
||||
dev="$(readlink -f "$dev")"
|
||||
push host_devs "$dev"
|
||||
_get_fs_type "$dev"
|
||||
check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
|
||||
fi
|
||||
done
|
||||
|
||||
[[ -d $udevdir ]] \
|
||||
|| udevdir=$(pkg-config udev --variable=udevdir 2>/dev/null)
|
||||
|| udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
|
||||
if ! [[ -d "$udevdir" ]]; then
|
||||
[[ -d /lib/udev ]] && udevdir=/lib/udev
|
||||
[[ -d /usr/lib/udev ]] && udevdir=/usr/lib/udev
|
||||
@@ -910,12 +1029,33 @@ fi
|
||||
|
||||
export initdir dracutbasedir dracutmodules \
|
||||
fw_dir drivers_dir debug no_kernel kernel_only \
|
||||
omit_drivers mdadmconf lvmconf \
|
||||
omit_drivers mdadmconf lvmconf root_dev \
|
||||
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 prefix filesystems drivers \
|
||||
systemdutildir systemdsystemunitdir systemdsystemconfdir
|
||||
systemdutildir systemdsystemunitdir systemdsystemconfdir \
|
||||
host_modalias host_modules
|
||||
|
||||
mods_to_load=""
|
||||
# check all our modules to see if they should be sourced.
|
||||
# This builds a list of modules that we will install next.
|
||||
for_each_module_dir check_module
|
||||
for_each_module_dir check_mount
|
||||
|
||||
dracut_module_included "fips" && export DRACUT_FIPS_MODE=1
|
||||
|
||||
if [[ $print_cmdline ]]; then
|
||||
modules_loaded=" "
|
||||
# source our modules.
|
||||
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
_d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
|
||||
module_cmdline "$_d_mod"
|
||||
done
|
||||
unset moddir
|
||||
printf "\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Create some directory structure first
|
||||
[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
|
||||
@@ -925,7 +1065,7 @@ export initdir dracutbasedir dracutmodules \
|
||||
|
||||
if [[ $prefix ]]; then
|
||||
for d in bin etc lib sbin tmp usr var $libdirs; do
|
||||
strstr "$d" "/" && continue
|
||||
[[ "$d" == */* ]] && continue
|
||||
ln -sfn "${prefix#/}/${d#/}" "$initdir/$d"
|
||||
done
|
||||
fi
|
||||
@@ -974,31 +1114,26 @@ if [[ $kernel_only != yes ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
mods_to_load=""
|
||||
# check all our modules to see if they should be sourced.
|
||||
# This builds a list of modules that we will install next.
|
||||
for_each_module_dir check_module
|
||||
for_each_module_dir check_mount
|
||||
|
||||
strstr "$mods_to_load" "fips" && export DRACUT_FIPS_MODE=1
|
||||
|
||||
_isize=0 #initramfs size
|
||||
modules_loaded=" "
|
||||
# source our modules.
|
||||
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
_d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
|
||||
if strstr "$mods_to_load" " $_d_mod "; then
|
||||
[[ $show_modules = yes ]] && echo "$_d_mod" || \
|
||||
if [[ "$mods_to_load" == *\ $_d_mod\ * ]]; then
|
||||
if [[ $show_modules = yes ]]; then
|
||||
printf "%s\n" "$_d_mod"
|
||||
else
|
||||
dinfo "*** Including module: $_d_mod ***"
|
||||
if [[ $kernel_only = yes ]]; then
|
||||
module_installkernel $_d_mod || {
|
||||
fi
|
||||
if [[ $kernel_only == yes ]]; then
|
||||
module_installkernel "$_d_mod" || {
|
||||
dfatal "installkernel failed in module $_d_mod"
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
module_install $_d_mod
|
||||
module_install "$_d_mod"
|
||||
if [[ $no_kernel != yes ]]; then
|
||||
module_installkernel $_d_mod || {
|
||||
module_installkernel "$_d_mod" || {
|
||||
dfatal "installkernel failed in module $_d_mod"
|
||||
exit 1
|
||||
}
|
||||
@@ -1010,8 +1145,8 @@ for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
#print the module install size
|
||||
if [ -n "$printsize" ]; then
|
||||
_isize_new=$(du -sk ${initdir}|cut -f1)
|
||||
_isize_delta=$(($_isize_new - $_isize))
|
||||
echo "$_d_mod install size: ${_isize_delta}k"
|
||||
_isize_delta=$((_isize_new - _isize))
|
||||
printf "%s\n" "$_d_mod install size: ${_isize_delta}k"
|
||||
_isize=$_isize_new
|
||||
fi
|
||||
fi
|
||||
@@ -1020,7 +1155,7 @@ unset moddir
|
||||
|
||||
for i in $modules_loaded; do
|
||||
mkdir -p $initdir/lib/dracut
|
||||
echo "$i" >> $initdir/lib/dracut/modules.txt
|
||||
printf "%s\n" "$i" >> $initdir/lib/dracut/modules.txt
|
||||
done
|
||||
|
||||
dinfo "*** Including modules done ***"
|
||||
@@ -1055,24 +1190,24 @@ if [[ $no_kernel != yes ]]; then
|
||||
fi
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
(( ${#install_items[@]} > 0 )) && dracut_install ${install_items[@]}
|
||||
(( ${#install_items[@]} > 0 )) && inst_multiple ${install_items[@]}
|
||||
|
||||
[[ $kernel_cmdline ]] && echo "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
|
||||
[[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
|
||||
|
||||
while pop fstab_lines line; do
|
||||
echo "$line 0 0" >> "${initdir}/etc/fstab"
|
||||
printf "%s\n" "$line 0 0" >> "${initdir}/etc/fstab"
|
||||
done
|
||||
|
||||
for f in $add_fstab; do
|
||||
cat $f >> "${initdir}/etc/fstab"
|
||||
cat "$f" >> "${initdir}/etc/fstab"
|
||||
done
|
||||
|
||||
if [ -d ${initdir}/$systemdutildir ]; then
|
||||
mkdir -p ${initdir}/etc/conf.d
|
||||
{
|
||||
echo "systemdutildir=\"$systemdutildir\""
|
||||
echo "systemdsystemunitdir=\"$systemdsystemunitdir\""
|
||||
echo "systemdsystemconfdir=\"$systemdsystemconfdir\""
|
||||
printf "%s\n" "systemdutildir=\"$systemdutildir\""
|
||||
printf "%s\n" "systemdsystemunitdir=\"$systemdsystemunitdir\""
|
||||
printf "%s\n" "systemdsystemconfdir=\"$systemdsystemconfdir\""
|
||||
} > ${initdir}/etc/conf.d/systemd.conf
|
||||
fi
|
||||
|
||||
@@ -1081,7 +1216,7 @@ if [[ $kernel_only != yes ]]; then
|
||||
find "$initdir" -type f \
|
||||
'(' -perm -0100 -or -perm -0010 -or -perm -0001 ')' \
|
||||
-not -path '*.ko' -print0 \
|
||||
| xargs -r -0 $DRACUT_INSTALL ${initdir+-D "$initdir"} -R ${DRACUT_FIPS_MODE+-H}
|
||||
| xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R ${DRACUT_FIPS_MODE:+-H} --
|
||||
dinfo "*** Resolving executable dependencies done***"
|
||||
fi
|
||||
fi
|
||||
@@ -1126,27 +1261,20 @@ if [[ $kernel_only != yes ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if (($maxloglvl >= 5)); then
|
||||
ddebug "Listing sizes of included files:"
|
||||
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 ***"
|
||||
if [[ $do_prelink == yes ]]; then
|
||||
PRELINK_BIN="$(command -v prelink)"
|
||||
if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
|
||||
if [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Installing prelink files ***"
|
||||
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
|
||||
else
|
||||
dinfo "*** Pre-linking files ***"
|
||||
inst_multiple -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
|
||||
fi
|
||||
|
||||
@@ -1160,51 +1288,89 @@ fi
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
for p in strip xargs find; do
|
||||
if ! type -P $p >/dev/null; then
|
||||
dwarn "Could not find '$p'. Not stripping the initramfs."
|
||||
dinfo "Could not find '$p'. Not stripping the initramfs."
|
||||
do_strip=no
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Stripping files ***"
|
||||
if [[ $DRACUT_FIPS_MODE ]]; then
|
||||
find "$initdir" -type f \
|
||||
-executable -not -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 \
|
||||
-executable -not -path '*/lib/modules/*.ko' -print0 \
|
||||
| xargs -r -0 strip -g 2>/dev/null
|
||||
fi
|
||||
find "$initdir" -type f \
|
||||
-executable -not -path '*/lib/modules/*.ko' -print0 \
|
||||
| xargs -r -0 strip -g 2>/dev/null
|
||||
|
||||
# strip kernel modules, but do not touch signed modules
|
||||
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
|
||||
| while read -r -d $'\0' f; do
|
||||
SIG=$(tail -c 28 "$f")
|
||||
[[ $SIG == '~Module signature appended~' ]] || { echo -n "$f"; echo -n -e "\000"; }
|
||||
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
|
||||
done | xargs -r -0 strip -g
|
||||
|
||||
dinfo "*** Stripping files done ***"
|
||||
fi
|
||||
if [[ $early_microcode = yes ]]; then
|
||||
dinfo "*** Generating early-microcode cpio image ***"
|
||||
ucode_dir=(amd-ucode intel-ucode)
|
||||
ucode_dest=(AuthenticAMD.bin GenuineIntel.bin)
|
||||
_dest_dir="$early_cpio_dir/d/kernel/x86/microcode"
|
||||
_dest_idx="0 1"
|
||||
mkdir -p $_dest_dir
|
||||
if [[ $hostonly ]]; then
|
||||
[[ $(get_cpu_vendor) == "AMD" ]] && _dest_idx="0"
|
||||
[[ $(get_cpu_vendor) == "Intel" ]] && _dest_idx="1"
|
||||
fi
|
||||
for idx in $_dest_idx; do
|
||||
_fw=${ucode_dir[$idx]}
|
||||
for _fwdir in $fw_dir; do
|
||||
if [[ -d $_fwdir && -d $_fwdir/$_fw ]]; then
|
||||
_src="*"
|
||||
dinfo "*** Constructing ${ucode_dest[$idx]} ****"
|
||||
if [[ $hostonly ]]; then
|
||||
_src=$(get_ucode_file)
|
||||
if ! [[ -r $_fwdir/$_fw/$_src ]];then
|
||||
break;
|
||||
fi
|
||||
fi
|
||||
cat $_fwdir/$_fw/$_src > $_dest_dir/${ucode_dest[$idx]}
|
||||
create_early_cpio="yes"
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
rm -f "$outfile"
|
||||
if [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; then
|
||||
dinfo "*** Packaging ACPI tables to override BIOS provided ones ***"
|
||||
_dest_dir="$early_cpio_dir/d/kernel/firmware/acpi"
|
||||
mkdir -p $_dest_dir
|
||||
for table in $acpi_table_dir/*.aml; do
|
||||
dinfo " Adding ACPI table: $table"
|
||||
cp $table $_dest_dir
|
||||
create_early_cpio="yes"
|
||||
done
|
||||
fi
|
||||
|
||||
rm -f -- "$outfile"
|
||||
dinfo "*** Creating image file ***"
|
||||
if ! ( umask 077; cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
|
||||
$compress > "$outfile.$$"; ); then
|
||||
if [[ $create_early_cpio = yes ]]; then
|
||||
# The microcode blob is _before_ the initramfs blob, not after
|
||||
(cd "$early_cpio_dir/d"; find . -print0 | cpio --null -o -H newc --quiet >../early.cpio)
|
||||
mv $early_cpio_dir/early.cpio $outfile.$$
|
||||
fi
|
||||
if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null -R 0:0 -H newc -o --quiet| \
|
||||
$compress >> "$outfile.$$"; ); then
|
||||
dfatal "dracut: creation of $outfile.$$ failed"
|
||||
exit 1
|
||||
fi
|
||||
mv $outfile.$$ $outfile
|
||||
mv -- "$outfile.$$" "$outfile"
|
||||
dinfo "*** Creating image file done ***"
|
||||
|
||||
dinfo "Wrote $outfile:"
|
||||
dinfo "$(ls -l "$outfile")"
|
||||
if (( maxloglvl >= 5 )); then
|
||||
if [[ $allowlocal ]]; then
|
||||
"$dracutbasedir/lsinitrd.sh" "$outfile"| ddebug
|
||||
else
|
||||
lsinitrd "$outfile"| ddebug
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
98
dracut.spec
98
dracut.spec
@@ -21,8 +21,8 @@ Group: System/Base
|
||||
%endif
|
||||
|
||||
# The entire source code is GPLv2+
|
||||
# except install/* which is LGPLv2.1+
|
||||
License: GPLv2+ and LGPLv2.1+
|
||||
# except install/* which is LGPLv2+
|
||||
License: GPLv2+ and LGPLv2+
|
||||
|
||||
URL: https://dracut.wiki.kernel.org/
|
||||
|
||||
@@ -30,7 +30,7 @@ URL: https://dracut.wiki.kernel.org/
|
||||
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz
|
||||
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
|
||||
|
||||
BuildRequires: dash bash git
|
||||
BuildRequires: bash git
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
@@ -76,6 +76,10 @@ Provides: mkinitrd = 2.6.1
|
||||
Obsoletes: dracut-kernel < 005
|
||||
Provides: dracut-kernel = %{version}-%{release}
|
||||
|
||||
Obsoletes: dracut <= 029
|
||||
Obsoletes: dracut-norescue
|
||||
Provides: dracut-norescue
|
||||
|
||||
Requires: bash >= 4
|
||||
Requires: coreutils
|
||||
Requires: cpio
|
||||
@@ -84,26 +88,23 @@ Requires: findutils
|
||||
Requires: grep
|
||||
Requires: hardlink
|
||||
Requires: gzip xz
|
||||
Requires: module-init-tools >= 3.7-9
|
||||
Requires: kmod
|
||||
Requires: sed
|
||||
Requires: file
|
||||
Requires: kpartx
|
||||
Requires: kbd kbd-misc
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
Requires: util-linux >= 2.21
|
||||
Requires: systemd >= 198-5
|
||||
Requires: systemd >= 199
|
||||
Requires: procps-ng
|
||||
Conflicts: grubby < 8.23
|
||||
Conflicts: initscripts < 8.63-1
|
||||
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
|
||||
Conflicts: bcache-tools < 0-0.14.20130909git
|
||||
%else
|
||||
Requires: udev > 166
|
||||
Requires: util-linux-ng >= 2.21
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
Conflicts: initscripts < 8.63-1
|
||||
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
|
||||
%endif
|
||||
|
||||
Conflicts: mdadm < 3.2.6-14
|
||||
|
||||
%description
|
||||
@@ -118,6 +119,7 @@ Summary: dracut modules to build a dracut initramfs with network support
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: iputils
|
||||
Requires: iproute
|
||||
Requires: dhclient
|
||||
Obsoletes: dracut-generic < 008
|
||||
Provides: dracut-generic = %{version}-%{release}
|
||||
|
||||
@@ -160,20 +162,23 @@ Requires: libcap
|
||||
This package requires everything which is needed to build an
|
||||
initramfs with dracut, which drops capabilities.
|
||||
|
||||
%package nohostonly
|
||||
%package config-generic
|
||||
Summary: dracut configuration to turn off hostonly image generation
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Obsoletes: dracut-nohostonly
|
||||
Provides: dracut-nohostonly
|
||||
|
||||
%description nohostonly
|
||||
%description config-generic
|
||||
This package provides the configuration to turn off the host specific initramfs
|
||||
generation with dracut.
|
||||
generation with dracut and generates a generic image by default.
|
||||
|
||||
%package norescue
|
||||
Summary: dracut configuration to turn off rescue image generation
|
||||
%package config-rescue
|
||||
Summary: dracut configuration to turn on rescue image generation
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Obsoletes: dracut <= 029
|
||||
|
||||
%description norescue
|
||||
This package provides the configuration to turn off the rescue initramfs
|
||||
%description config-rescue
|
||||
This package provides the configuration to turn on the rescue initramfs
|
||||
generation with dracut.
|
||||
|
||||
%package tools
|
||||
@@ -204,7 +209,7 @@ make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
rm -rf -- $RPM_BUILD_ROOT
|
||||
%endif
|
||||
make %{?_smp_mflags} install \
|
||||
DESTDIR=$RPM_BUILD_ROOT \
|
||||
@@ -213,27 +218,26 @@ make %{?_smp_mflags} install \
|
||||
echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh
|
||||
|
||||
%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} == 0
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
|
||||
%endif
|
||||
|
||||
%if %{defined _unitdir}
|
||||
# for systemd, better use systemd-bootchart
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00bootchart
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00bootchart
|
||||
%endif
|
||||
|
||||
# we do not support dash in the initramfs
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
|
||||
|
||||
# remove gentoo specific modules
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
|
||||
|
||||
%if %{defined _unitdir}
|
||||
# with systemd IMA and selinux modules do not make sense
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/96securityfs
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/97masterkey
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98integrity
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98selinux
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/96securityfs
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/97masterkey
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98integrity
|
||||
%endif
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/boot/dracut
|
||||
@@ -252,8 +256,8 @@ install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
|
||||
rm $RPM_BUILD_ROOT%{_bindir}/mkinitrd
|
||||
rm $RPM_BUILD_ROOT%{_bindir}/lsinitrd
|
||||
rm -f -- $RPM_BUILD_ROOT%{_bindir}/mkinitrd
|
||||
rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
@@ -261,19 +265,20 @@ rm $RPM_BUILD_ROOT%{_bindir}/lsinitrd
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
|
||||
install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
|
||||
|
||||
echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-nohostonly.conf
|
||||
echo 'dracut_rescue_image="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-norescue.conf
|
||||
echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
|
||||
echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf
|
||||
%endif
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
|
||||
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/dracut_log
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
> $RPM_BUILD_ROOT/etc/system-fips
|
||||
%endif
|
||||
|
||||
# create compat symlink
|
||||
mkdir -p $RPM_BUILD_ROOT/sbin
|
||||
ln -s /usr/bin/dracut $RPM_BUILD_ROOT/sbin/dracut
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
rm -rf -- $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,0755)
|
||||
@@ -282,6 +287,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
# compat symlink
|
||||
/sbin/dracut
|
||||
%{_datadir}/bash-completion/completions/dracut
|
||||
%{_datadir}/bash-completion/completions/lsinitrd
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
%{_bindir}/mkinitrd
|
||||
%{_bindir}/lsinitrd
|
||||
@@ -315,6 +321,8 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%else
|
||||
%{dracutlibdir}/modules.d/00bootchart
|
||||
%endif
|
||||
%{dracutlibdir}/modules.d/00bash
|
||||
%{dracutlibdir}/modules.d/03modsign
|
||||
%{dracutlibdir}/modules.d/03rescue
|
||||
%{dracutlibdir}/modules.d/04watchdog
|
||||
%{dracutlibdir}/modules.d/05busybox
|
||||
@@ -349,12 +357,12 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%if %{undefined _unitdir}
|
||||
%{dracutlibdir}/modules.d/96securityfs
|
||||
%{dracutlibdir}/modules.d/97masterkey
|
||||
%{dracutlibdir}/modules.d/98selinux
|
||||
%{dracutlibdir}/modules.d/98integrity
|
||||
%endif
|
||||
%{dracutlibdir}/modules.d/97biosdevname
|
||||
%{dracutlibdir}/modules.d/98ecryptfs
|
||||
%{dracutlibdir}/modules.d/98pollcdrom
|
||||
%{dracutlibdir}/modules.d/98selinux
|
||||
%{dracutlibdir}/modules.d/98syslog
|
||||
%{dracutlibdir}/modules.d/98systemd
|
||||
%{dracutlibdir}/modules.d/98usrmount
|
||||
@@ -362,7 +370,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/99fs-lib
|
||||
%{dracutlibdir}/modules.d/99img-lib
|
||||
%{dracutlibdir}/modules.d/99shutdown
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/dracut_log
|
||||
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
|
||||
%dir %{_sharedstatedir}/initramfs
|
||||
%if %{defined _unitdir}
|
||||
@@ -386,8 +393,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%endif
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
%{_prefix}/lib/kernel/install.d/50-dracut.install
|
||||
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
|
||||
%endif
|
||||
|
||||
%files network
|
||||
@@ -409,6 +414,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/01fips
|
||||
%{dracutlibdir}/dracut.conf.d/40-fips.conf
|
||||
%config(missingok) /etc/system-fips
|
||||
%endif
|
||||
|
||||
%files fips-aesni
|
||||
@@ -428,12 +434,16 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%dir /var/lib/dracut
|
||||
%dir /var/lib/dracut/overlay
|
||||
|
||||
%files nohostonly
|
||||
%files config-generic
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/dracut.conf.d/02-nohostonly.conf
|
||||
%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
|
||||
|
||||
%files norescue
|
||||
%files config-rescue
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/dracut.conf.d/02-norescue.conf
|
||||
%{dracutlibdir}/dracut.conf.d/02-rescue.conf
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
|
19
git2spec.pl
19
git2spec.pl
@@ -1,21 +1,5 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
sub last_tag {
|
||||
open( GIT, 'git log --pretty=format:%H |');
|
||||
LINE: while( <GIT> ) {
|
||||
open( GIT2, "git tag --contains $_ |");
|
||||
while( <GIT2> ) {
|
||||
chomp;
|
||||
last LINE if /..*/;
|
||||
}
|
||||
close GIT2;
|
||||
}
|
||||
$tag=$_;
|
||||
close GIT2;
|
||||
close GIT; # be done
|
||||
return $tag;
|
||||
};
|
||||
|
||||
sub create_patches {
|
||||
my $tag=shift;
|
||||
my $pdir=shift;
|
||||
@@ -31,7 +15,8 @@ my $datestr = strftime "%Y%m%d", gmtime;
|
||||
|
||||
my $tag=shift;
|
||||
my $pdir=shift;
|
||||
$tag=&last_tag if not defined $tag;
|
||||
$tag=`git describe --abbrev=0 --tags` if not defined $tag;
|
||||
chomp($tag);
|
||||
my @patches=&create_patches($tag, $pdir);
|
||||
my $num=$#patches + 2;
|
||||
$tag=~s/[^0-9]+?([0-9]+)/$1/;
|
||||
|
@@ -62,6 +62,10 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
static size_t dir_len(char const *file)
|
||||
{
|
||||
size_t length;
|
||||
|
||||
if(!file)
|
||||
return 0;
|
||||
|
||||
/* Strip the basename and any redundant slashes before it. */
|
||||
for (length = strlen(file)-1; 0 < length; length--)
|
||||
if (file[length] == '/' && file[length-1] != '/')
|
||||
@@ -73,20 +77,23 @@ static char *convert_abs_rel(const char *from, const char *target)
|
||||
{
|
||||
/* we use the 4*MAXPATHLEN, which should not overrun */
|
||||
char relative_from[MAXPATHLEN * 4];
|
||||
char *realtarget = NULL;
|
||||
char *p, *q;
|
||||
_cleanup_free_ char *realtarget = NULL;
|
||||
_cleanup_free_ char *target_dir_p = NULL, *realpath_p = NULL;
|
||||
const char *realfrom = from;
|
||||
int level = 0, fromlevel = 0, targetlevel = 0;
|
||||
int l, i, rl;
|
||||
int dirlen;
|
||||
size_t level = 0, fromlevel = 0, targetlevel = 0;
|
||||
int l;
|
||||
size_t i, rl, dirlen;
|
||||
int ret;
|
||||
|
||||
p = strdup(target);
|
||||
dirlen = dir_len(p);
|
||||
p[dirlen] = '\0';
|
||||
q = realpath(p, NULL);
|
||||
target_dir_p = strdup(target);
|
||||
if (!target_dir_p)
|
||||
return strdup(from);
|
||||
|
||||
if (q == NULL) {
|
||||
free(p);
|
||||
dirlen = dir_len(target_dir_p);
|
||||
target_dir_p[dirlen] = '\0';
|
||||
realpath_p = realpath(target_dir_p, NULL);
|
||||
|
||||
if (realpath_p == NULL) {
|
||||
log_warning("convert_abs_rel(): target '%s' directory has no realpath.", target);
|
||||
return strdup(from);
|
||||
}
|
||||
@@ -95,11 +102,13 @@ static char *convert_abs_rel(const char *from, const char *target)
|
||||
* character - need to skip all leading /'s */
|
||||
rl = strlen(target);
|
||||
for (i = dirlen+1; i < rl; ++i)
|
||||
if (p[i] != '/')
|
||||
if (target_dir_p[i] != '/')
|
||||
break;
|
||||
asprintf(&realtarget, "%s/%s", q, &p[i]);
|
||||
free(p);
|
||||
free(q);
|
||||
ret = asprintf(&realtarget, "%s/%s", realpath_p, &target_dir_p[i]);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* now calculate the relative path from <from> to <target> and
|
||||
store it in <relative_from>
|
||||
@@ -122,8 +131,6 @@ static char *convert_abs_rel(const char *from, const char *target)
|
||||
if (realtarget[i] == '/')
|
||||
level++;
|
||||
|
||||
free(realtarget);
|
||||
|
||||
/* add "../" to the relative_from path, until the common pathname is
|
||||
reached */
|
||||
for (i = level; i < targetlevel; i++) {
|
||||
@@ -155,18 +162,16 @@ static char *convert_abs_rel(const char *from, const char *target)
|
||||
static int ln_r(const char *src, const char *dst)
|
||||
{
|
||||
int ret;
|
||||
const char *points_to = convert_abs_rel(src, dst);
|
||||
_cleanup_free_ const char *points_to = convert_abs_rel(src, dst);
|
||||
|
||||
log_info("ln -s '%s' '%s'", points_to, dst);
|
||||
ret = symlink(points_to, dst);
|
||||
|
||||
if (ret != 0) {
|
||||
log_error("ERROR: ln -s '%s' '%s': %m", points_to, dst);
|
||||
free((char *)points_to);
|
||||
return 1;
|
||||
}
|
||||
|
||||
free((char *)points_to);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -186,11 +191,11 @@ static bool use_clone = true;
|
||||
static int cp(const char *src, const char *dst)
|
||||
{
|
||||
int pid;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
if (use_clone) {
|
||||
struct stat sb;
|
||||
int dest_desc, source_desc;
|
||||
_cleanup_close_ int dest_desc = -1, source_desc = -1;
|
||||
|
||||
if (lstat(src, &sb) != 0)
|
||||
goto normal_copy;
|
||||
@@ -207,20 +212,24 @@ static int cp(const char *src, const char *dst)
|
||||
(sb.st_mode) & (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO));
|
||||
|
||||
if (dest_desc < 0) {
|
||||
close(source_desc);
|
||||
goto normal_copy;
|
||||
}
|
||||
|
||||
ret = clone_file(dest_desc, source_desc);
|
||||
close(source_desc);
|
||||
|
||||
if (ret == 0) {
|
||||
struct timeval tv[2];
|
||||
if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0)
|
||||
fchown(dest_desc, -1, sb.st_gid);
|
||||
close(dest_desc);
|
||||
fchown(dest_desc, (__uid_t)-1, sb.st_gid);
|
||||
tv[0].tv_sec = sb.st_atime;
|
||||
tv[0].tv_usec = 0;
|
||||
tv[1].tv_sec = sb.st_mtime;
|
||||
tv[1].tv_usec = 0;
|
||||
futimes(dest_desc, tv);
|
||||
return ret;
|
||||
}
|
||||
close(dest_desc);
|
||||
|
||||
dest_desc = -1;
|
||||
/* clone did not work, remove the file */
|
||||
unlink(dst);
|
||||
/* do not try clone again */
|
||||
@@ -230,16 +239,83 @@ static int cp(const char *src, const char *dst)
|
||||
normal_copy:
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode", "-fL", src, dst, NULL);
|
||||
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,timestamps", "-fL", src, dst, NULL);
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
while (waitpid(pid, &ret, 0) < 0) {
|
||||
if (errno != EINTR) {
|
||||
ret = -1;
|
||||
log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,timestamps -fL %s %s", src, dst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
log_debug("cp ret = %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int library_install(const char *src, const char *lib)
|
||||
{
|
||||
_cleanup_free_ char *p = NULL;
|
||||
_cleanup_free_ char *pdir = NULL, *ppdir = NULL, *clib = NULL;
|
||||
char *q;
|
||||
int r, ret = 0;
|
||||
|
||||
p = strdup(lib);
|
||||
|
||||
r = dracut_install(p, p, false, false, true);
|
||||
if (r != 0)
|
||||
log_error("ERROR: failed to install '%s' for '%s'", p, src);
|
||||
else
|
||||
log_debug("Lib install: '%s'", p);
|
||||
ret += r;
|
||||
|
||||
/* also install lib.so for lib.so.* files */
|
||||
q = strstr(p, ".so.");
|
||||
if (q) {
|
||||
q[3] = '\0';
|
||||
|
||||
/* ignore errors for base lib symlink */
|
||||
if (dracut_install(p, p, false, false, true) == 0)
|
||||
log_debug("Lib install: '%s'", p);
|
||||
}
|
||||
|
||||
/* Also try to install the same library from one directory above.
|
||||
This fixes the case, where only the HWCAP lib would be installed
|
||||
# ldconfig -p|fgrep libc.so
|
||||
libc.so.6 (libc6,64bit, hwcap: 0x0000001000000000, OS ABI: Linux 2.6.32) => /lib64/power6/libc.so.6
|
||||
libc.so.6 (libc6,64bit, hwcap: 0x0000000000000200, OS ABI: Linux 2.6.32) => /lib64/power6x/libc.so.6
|
||||
libc.so.6 (libc6,64bit, OS ABI: Linux 2.6.32) => /lib64/libc.so.6
|
||||
*/
|
||||
|
||||
free(p);
|
||||
p = strdup(lib);
|
||||
|
||||
pdir = dirname(p);
|
||||
if (!pdir)
|
||||
return ret;
|
||||
|
||||
pdir = strdup(pdir);
|
||||
ppdir = dirname(pdir);
|
||||
if (!ppdir)
|
||||
return ret;
|
||||
|
||||
ppdir = strdup(ppdir);
|
||||
|
||||
strcpy(p, lib);
|
||||
|
||||
clib = strjoin(ppdir, "/", basename(p), NULL);
|
||||
if (dracut_install(clib, clib, false, false, true) == 0)
|
||||
log_debug("Lib install: '%s'", clib);
|
||||
/* also install lib.so for lib.so.* files */
|
||||
q = strstr(clib, ".so.");
|
||||
if (q) {
|
||||
q[3] = '\0';
|
||||
|
||||
/* ignore errors for base lib symlink */
|
||||
if (dracut_install(clib, clib, false, false, true) == 0)
|
||||
log_debug("Lib install: '%s'", p);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -248,17 +324,19 @@ static int resolve_deps(const char *src)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
char *buf = malloc(LINE_MAX);
|
||||
_cleanup_free_ char *buf = malloc(LINE_MAX);
|
||||
size_t linesize = LINE_MAX;
|
||||
FILE *fptr;
|
||||
char *cmd;
|
||||
_cleanup_pclose_ FILE *fptr = NULL;
|
||||
_cleanup_free_ char *cmd = NULL;
|
||||
|
||||
if (strstr(src, ".so") == 0) {
|
||||
int fd;
|
||||
_cleanup_close_ int fd = -1;
|
||||
fd = open(src, O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0)
|
||||
return -errno;
|
||||
|
||||
read(fd, buf, LINE_MAX);
|
||||
buf[LINE_MAX - 1] = '\0';
|
||||
close(fd);
|
||||
if (buf[0] == '#' && buf[1] == '!') {
|
||||
/* we have a shebang */
|
||||
char *p, *q;
|
||||
@@ -274,7 +352,14 @@ static int resolve_deps(const char *src)
|
||||
}
|
||||
|
||||
/* run ldd */
|
||||
asprintf(&cmd, "ldd %s 2>&1", src);
|
||||
ret = asprintf(&cmd, "ldd %s 2>&1", src);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
fptr = popen(cmd, "r");
|
||||
|
||||
while (!feof(fptr)) {
|
||||
@@ -285,6 +370,12 @@ static int resolve_deps(const char *src)
|
||||
|
||||
log_debug("ldd: '%s'", buf);
|
||||
|
||||
if (strstr(buf, "you do not have execution permission")) {
|
||||
log_error("%s", buf);
|
||||
ret+=1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (strstr(buf, "not a dynamic executable"))
|
||||
break;
|
||||
|
||||
@@ -300,31 +391,15 @@ static int resolve_deps(const char *src)
|
||||
if (strstr(buf, destrootdir))
|
||||
break;
|
||||
|
||||
p = strstr(buf, "/");
|
||||
p = strchr(buf, '/');
|
||||
if (p) {
|
||||
int r;
|
||||
for (q = p; *q && *q != ' ' && *q != '\n'; q++) ;
|
||||
*q = '\0';
|
||||
r = dracut_install(p, p, false, false, true);
|
||||
if (r != 0)
|
||||
log_error("ERROR: failed to install '%s' for '%s'", p, src);
|
||||
else
|
||||
log_debug("Lib install: '%s'", p);
|
||||
ret += r;
|
||||
|
||||
/* also install lib.so for lib.so.* files */
|
||||
q = strstr(p, ".so.");
|
||||
if (q) {
|
||||
q += 3;
|
||||
*q = '\0';
|
||||
ret += library_install(src, p);
|
||||
|
||||
/* ignore errors for base lib symlink */
|
||||
if (dracut_install(p, p, false, false, true) == 0)
|
||||
log_debug("Lib install: '%s'", p);
|
||||
}
|
||||
}
|
||||
}
|
||||
pclose(fptr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -332,10 +407,15 @@ 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, const char *hmacpath)
|
||||
{
|
||||
char *srcpath = strdup(src);
|
||||
char *dstpath = strdup(dst);
|
||||
char *srchmacname = NULL;
|
||||
char *dsthmacname = NULL;
|
||||
_cleanup_free_ char *srcpath = strdup(src);
|
||||
_cleanup_free_ char *dstpath = strdup(dst);
|
||||
_cleanup_free_ char *srchmacname = NULL;
|
||||
_cleanup_free_ char *dsthmacname = NULL;
|
||||
int ret;
|
||||
|
||||
if (!(srcpath && dstpath))
|
||||
return -ENOMEM;
|
||||
|
||||
size_t dlen = dir_len(src);
|
||||
|
||||
if (endswith(src, ".hmac"))
|
||||
@@ -344,35 +424,51 @@ static int hmac_install(const char *src, const char *dst, const char *hmacpath)
|
||||
if (!hmacpath) {
|
||||
hmac_install(src, dst, "/lib/fipscheck");
|
||||
hmac_install(src, dst, "/lib64/fipscheck");
|
||||
hmac_install(src, dst, "/lib/hmaccalc");
|
||||
hmac_install(src, dst, "/lib64/hmaccalc");
|
||||
}
|
||||
|
||||
srcpath[dlen] = '\0';
|
||||
dstpath[dir_len(dst)] = '\0';
|
||||
if (hmacpath) {
|
||||
asprintf(&srchmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
|
||||
asprintf(&dsthmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
|
||||
ret = asprintf(&srchmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ret = asprintf(&dsthmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
asprintf(&srchmacname, "%s/.%s.hmac", srcpath, &src[dlen + 1]);
|
||||
asprintf(&dsthmacname, "%s/.%s.hmac", dstpath, &src[dlen + 1]);
|
||||
ret = asprintf(&srchmacname, "%s/.%s.hmac", srcpath, &src[dlen + 1]);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ret = asprintf(&dsthmacname, "%s/.%s.hmac", dstpath, &src[dlen + 1]);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
log_debug("hmac cp '%s' '%s')", srchmacname, dsthmacname);
|
||||
dracut_install(srchmacname, dsthmacname, false, false, true);
|
||||
free(dsthmacname);
|
||||
free(srchmacname);
|
||||
free(srcpath);
|
||||
free(dstpath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst)
|
||||
{
|
||||
struct stat sb, db;
|
||||
char *dname = NULL;
|
||||
char *fulldstpath = NULL;
|
||||
char *fulldstdir = NULL;
|
||||
_cleanup_free_ char *fulldstpath = NULL;
|
||||
_cleanup_free_ char *fulldstdir = NULL;
|
||||
int ret;
|
||||
bool src_exists = true;
|
||||
char *i, *existing;
|
||||
char *i = NULL;
|
||||
char *existing;
|
||||
|
||||
log_debug("dracut_install('%s', '%s')", src, dst);
|
||||
|
||||
@@ -405,9 +501,16 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
}
|
||||
|
||||
i = strdup(dst);
|
||||
if (!i)
|
||||
return -ENOMEM;
|
||||
|
||||
hashmap_put(items, i, i);
|
||||
|
||||
asprintf(&fulldstpath, "%s%s", destrootdir, dst);
|
||||
ret = asprintf(&fulldstpath, "%s%s", destrootdir, dst);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ret = stat(fulldstpath, &sb);
|
||||
|
||||
@@ -423,7 +526,6 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
} else
|
||||
log_debug("'%s' already exists", fulldstpath);
|
||||
|
||||
free(fulldstpath);
|
||||
/* dst does already exist */
|
||||
return ret;
|
||||
}
|
||||
@@ -435,6 +537,8 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
ret = stat(fulldstdir, &db);
|
||||
|
||||
if (ret < 0) {
|
||||
_cleanup_free_ char *dname = NULL;
|
||||
|
||||
if (errno != ENOENT) {
|
||||
log_error("ERROR: stat '%s': %m", fulldstdir);
|
||||
return 1;
|
||||
@@ -442,35 +546,34 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
/* create destination directory */
|
||||
log_debug("dest dir '%s' does not exist", fulldstdir);
|
||||
dname = strdup(dst);
|
||||
if (!dname)
|
||||
return 1;
|
||||
|
||||
dname[dir_len(dname)] = '\0';
|
||||
ret = dracut_install(dname, dname, true, false, true);
|
||||
|
||||
free(dname);
|
||||
|
||||
if (ret != 0) {
|
||||
log_error("ERROR: failed to create directory '%s'", fulldstdir);
|
||||
free(fulldstdir);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
free(fulldstdir);
|
||||
|
||||
if (isdir && !src_exists) {
|
||||
log_info("mkdir '%s'", fulldstpath);
|
||||
return mkdir(fulldstpath, 0755);
|
||||
ret = mkdir(fulldstpath, 0755);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ready to install src */
|
||||
|
||||
if (S_ISDIR(sb.st_mode)) {
|
||||
log_info("mkdir '%s'", fulldstpath);
|
||||
return mkdir(fulldstpath, sb.st_mode | S_IWUSR);
|
||||
ret = mkdir(fulldstpath, sb.st_mode | S_IWUSR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (S_ISLNK(sb.st_mode)) {
|
||||
char *abspath;
|
||||
char *absdestpath = NULL;
|
||||
_cleanup_free_ char *abspath = NULL;
|
||||
|
||||
abspath = realpath(src, NULL);
|
||||
|
||||
@@ -488,15 +591,17 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
}
|
||||
|
||||
if (lstat(fulldstpath, &sb) != 0) {
|
||||
_cleanup_free_ char *absdestpath = NULL;
|
||||
|
||||
asprintf(&absdestpath, "%s%s", destrootdir, abspath);
|
||||
ret = asprintf(&absdestpath, "%s%s", destrootdir, abspath);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ln_r(absdestpath, fulldstpath);
|
||||
|
||||
free(absdestpath);
|
||||
}
|
||||
|
||||
free(abspath);
|
||||
if (arg_hmac) {
|
||||
/* copy .hmac files also */
|
||||
hmac_install(src, dst, NULL);
|
||||
@@ -514,8 +619,12 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
}
|
||||
}
|
||||
|
||||
log_debug("dracut_install ret = %d", ret);
|
||||
log_info("cp '%s' '%s'", src, fulldstpath);
|
||||
ret += cp(src, fulldstpath);
|
||||
|
||||
log_debug("dracut_install ret = %d", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -526,49 +635,49 @@ static void item_free(char *i)
|
||||
}
|
||||
|
||||
static void usage(int status)
|
||||
{
|
||||
/* */
|
||||
printf("\
|
||||
Usage: %s -D DESTROOTDIR [OPTION]... -a SOURCE...\n\
|
||||
or: %s -D DESTROOTDIR [OPTION]... SOURCE DEST\n\
|
||||
\n\
|
||||
Install SOURCE to DEST in DESTROOTDIR with all needed dependencies.\n\
|
||||
\n\
|
||||
-D --destrootdir Install all files to DESTROOTDIR as the root\n\
|
||||
-a --all Install all SOURCE arguments to DESTROOTDIR\n\
|
||||
-o --optional If SOURCE does not exist, do not fail\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\
|
||||
-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\
|
||||
|-- lib64 -> usr/lib64\n\
|
||||
`-- usr\n\
|
||||
|-- bin\n\
|
||||
| |-- bash\n\
|
||||
| |-- sh -> bash\n\
|
||||
| `-- tr\n\
|
||||
`-- lib64\n\
|
||||
|-- ld-2.15.90.so\n\
|
||||
|-- ld-linux-x86-64.so.2 -> ld-2.15.90.so\n\
|
||||
|-- libc-2.15.90.so\n\
|
||||
|-- libc.so\n\
|
||||
|-- libc.so.6 -> libc-2.15.90.so\n\
|
||||
|-- libdl-2.15.90.so\n\
|
||||
|-- libdl.so -> libdl-2.15.90.so\n\
|
||||
|-- libdl.so.2 -> libdl-2.15.90.so\n\
|
||||
|-- libtinfo.so.5 -> libtinfo.so.5.9\n\
|
||||
`-- libtinfo.so.5.9\n\
|
||||
", program_invocation_short_name, program_invocation_short_name, program_invocation_short_name);
|
||||
{
|
||||
/* */
|
||||
printf("Usage: %s -D DESTROOTDIR [OPTION]... -a SOURCE...\n"
|
||||
"or: %s -D DESTROOTDIR [OPTION]... SOURCE DEST\n"
|
||||
"\n"
|
||||
"Install SOURCE to DEST in DESTROOTDIR with all needed dependencies.\n"
|
||||
"\n"
|
||||
" -D --destrootdir Install all files to DESTROOTDIR as the root\n"
|
||||
" -a --all Install all SOURCE arguments to DESTROOTDIR\n"
|
||||
" -o --optional If SOURCE does not exist, do not fail\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\n"
|
||||
" for all SOURCE 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"
|
||||
"|-- lib64 -> usr/lib64\n"
|
||||
"`-- usr\n"
|
||||
" |-- bin\n"
|
||||
" | |-- bash\n"
|
||||
" | |-- sh -> bash\n"
|
||||
" | `-- tr\n"
|
||||
" `-- lib64\n"
|
||||
" |-- ld-2.15.90.so\n"
|
||||
" |-- ld-linux-x86-64.so.2 -> ld-2.15.90.so\n"
|
||||
" |-- libc-2.15.90.so\n"
|
||||
" |-- libc.so\n"
|
||||
" |-- libc.so.6 -> libc-2.15.90.so\n"
|
||||
" |-- libdl-2.15.90.so\n"
|
||||
" |-- libdl.so -> libdl-2.15.90.so\n"
|
||||
" |-- libdl.so.2 -> libdl-2.15.90.so\n"
|
||||
" |-- libtinfo.so.5 -> libtinfo.so.5.9\n"
|
||||
" `-- libtinfo.so.5.9\n"
|
||||
, program_invocation_short_name, program_invocation_short_name, program_invocation_short_name);
|
||||
exit(status);
|
||||
}
|
||||
|
||||
@@ -581,7 +690,7 @@ static int parse_argv(int argc, char *argv[])
|
||||
ARG_DEBUG
|
||||
};
|
||||
|
||||
static const struct option const options[] = {
|
||||
static struct option const options[] = {
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"version", no_argument, NULL, ARG_VERSION},
|
||||
{"dir", no_argument, NULL, 'd'},
|
||||
@@ -596,7 +705,7 @@ static int parse_argv(int argc, char *argv[])
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
while ((c = getopt_long(argc, argv, "adhloD:DHILR", options, NULL)) != -1) {
|
||||
while ((c = getopt_long(argc, argv, "adhloD:HR", options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case ARG_VERSION:
|
||||
puts(PROGRAM_VERSION_STRING);
|
||||
@@ -647,7 +756,7 @@ static int parse_argv(int argc, char *argv[])
|
||||
static int resolve_lazy(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
int destrootdirlen = strlen(destrootdir);
|
||||
size_t destrootdirlen = strlen(destrootdir);
|
||||
int ret = 0;
|
||||
char *item;
|
||||
for (i = 0; i < argc; i++) {
|
||||
@@ -677,10 +786,12 @@ static int resolve_lazy(int argc, char **argv)
|
||||
|
||||
static char *find_binary(const char *src)
|
||||
{
|
||||
char *path;
|
||||
_cleanup_free_ char *path = NULL;
|
||||
char *p, *q;
|
||||
bool end = false;
|
||||
char *newsrc = NULL;
|
||||
int ret;
|
||||
|
||||
path = getenv("PATH");
|
||||
|
||||
if (path == NULL) {
|
||||
@@ -689,6 +800,12 @@ static char *find_binary(const char *src)
|
||||
}
|
||||
path = strdup(path);
|
||||
p = path;
|
||||
|
||||
if (path == NULL) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
log_debug("PATH=%s", path);
|
||||
|
||||
do {
|
||||
@@ -701,7 +818,12 @@ static char *find_binary(const char *src)
|
||||
else
|
||||
*q = '\0';
|
||||
|
||||
asprintf(&newsrc, "%s/%s", p, src);
|
||||
ret = asprintf(&newsrc, "%s/%s", p, src);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
p = q + 1;
|
||||
|
||||
if (stat(newsrc, &sb) != 0) {
|
||||
@@ -715,15 +837,15 @@ static char *find_binary(const char *src)
|
||||
|
||||
} 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 r = EXIT_SUCCESS;
|
||||
int ret;
|
||||
|
||||
if (strchr(src, '/') == NULL) {
|
||||
@@ -752,29 +874,27 @@ static int install_one(const char *src, const char *dst)
|
||||
|
||||
static int install_all(int argc, char **argv)
|
||||
{
|
||||
int r = 0;
|
||||
int r = EXIT_SUCCESS;
|
||||
int i;
|
||||
for (i = 0; i < argc; i++) {
|
||||
int ret;
|
||||
log_debug("Handle '%s'", argv[i]);
|
||||
|
||||
if (strchr(argv[i], '/') == NULL) {
|
||||
char *newsrc = find_binary(argv[i]);
|
||||
_cleanup_free_ char *newsrc = find_binary(argv[i]);
|
||||
if (newsrc) {
|
||||
log_debug("dracut_install '%s'", newsrc);
|
||||
ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true);
|
||||
if (ret == 0) {
|
||||
log_debug("dracut_install '%s' OK", newsrc);
|
||||
}
|
||||
free(newsrc);
|
||||
} else {
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
} else {
|
||||
char *dest = strdup(argv[i]);
|
||||
_cleanup_free_ char *dest = strdup(argv[i]);
|
||||
ret = dracut_install(argv[i], dest, arg_createdir, arg_resolvedeps, true);
|
||||
free(dest);
|
||||
}
|
||||
|
||||
if ((ret != 0) && (!arg_optional)) {
|
||||
|
152
install/macro.h
152
install/macro.h
@@ -1,7 +1,6 @@
|
||||
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
|
||||
#ifndef foomacrohfoo
|
||||
#define foomacrohfoo
|
||||
#pragma once
|
||||
|
||||
/***
|
||||
This file is part of systemd.
|
||||
@@ -45,16 +44,38 @@
|
||||
#define _hidden_ __attribute__ ((visibility("hidden")))
|
||||
#define _weakref_(x) __attribute__((weakref(#x)))
|
||||
#define _introspect_(x) __attribute__((section("introspect." x)))
|
||||
#define _alignas_(x) __attribute__((aligned(__alignof(x))))
|
||||
#define _cleanup_(x) __attribute__((cleanup(x)))
|
||||
|
||||
/* automake test harness */
|
||||
#define EXIT_TEST_SKIP 77
|
||||
|
||||
#define XSTRINGIFY(x) #x
|
||||
#define STRINGIFY(x) XSTRINGIFY(x)
|
||||
|
||||
/* Rounds up */
|
||||
#define ALIGN(l) ALIGN_TO((l), sizeof(void*))
|
||||
|
||||
#define ALIGN4(l) (((l) + 3) & ~3)
|
||||
#define ALIGN8(l) (((l) + 7) & ~7)
|
||||
|
||||
#if __SIZEOF_POINTER__ == 8
|
||||
#define ALIGN(l) ALIGN8(l)
|
||||
#elif __SIZEOF_POINTER__ == 4
|
||||
#define ALIGN(l) ALIGN4(l)
|
||||
#else
|
||||
#error "Wut? Pointers are neither 4 nor 8 bytes long?"
|
||||
#endif
|
||||
|
||||
#define ALIGN_PTR(p) ((void*) ALIGN((unsigned long) p))
|
||||
#define ALIGN4_PTR(p) ((void*) ALIGN4((unsigned long) p))
|
||||
#define ALIGN8_PTR(p) ((void*) ALIGN8((unsigned long) p))
|
||||
|
||||
static inline size_t ALIGN_TO(size_t l, size_t ali) {
|
||||
return ((l + ali - 1) & ~(ali - 1));
|
||||
}
|
||||
|
||||
#define ALIGN_TO_PTR(p, ali) ((void*) ALIGN_TO((unsigned long) p))
|
||||
|
||||
#define ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
/*
|
||||
@@ -64,34 +85,35 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) {
|
||||
* @member: the name of the member within the struct.
|
||||
*
|
||||
*/
|
||||
#define container_of(ptr, type, member) ({ \
|
||||
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
||||
(type *)( (char *)__mptr - offsetof(type,member) );})
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) \
|
||||
__extension__ ({ \
|
||||
typeof(a) _a = (a); \
|
||||
typeof(b) _b = (b); \
|
||||
_a > _b ? _a : _b; \
|
||||
#define container_of(ptr, type, member) \
|
||||
__extension__ ({ \
|
||||
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
||||
(type *)( (char *)__mptr - offsetof(type,member) ); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#define MAX3(a,b,c) \
|
||||
MAX(MAX(a,b),c)
|
||||
#undef MAX
|
||||
#define MAX(a,b) \
|
||||
__extension__ ({ \
|
||||
typeof(a) _a = (a); \
|
||||
typeof(b) _b = (b); \
|
||||
_a > _b ? _a : _b; \
|
||||
})
|
||||
|
||||
#ifndef MIN
|
||||
#define MAX3(x,y,z) \
|
||||
__extension__ ({ \
|
||||
typeof(x) _c = MAX(x,y); \
|
||||
MAX(_c, z); \
|
||||
})
|
||||
|
||||
#undef MIN
|
||||
#define MIN(a,b) \
|
||||
__extension__ ({ \
|
||||
typeof(a) _a = (a); \
|
||||
typeof(b) _b = (b); \
|
||||
_a < _b ? _a : _b; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#define MIN3(a,b,c) \
|
||||
MIN(MIN(a,b),c)
|
||||
|
||||
#ifndef CLAMP
|
||||
#define CLAMP(x, low, high) \
|
||||
__extension__ ({ \
|
||||
typeof(x) _x = (x); \
|
||||
@@ -99,6 +121,7 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) {
|
||||
typeof(high) _high = (high); \
|
||||
((_x > _high) ? _high : ((_x < _low) ? _low : _x)); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#define assert_se(expr) \
|
||||
do { \
|
||||
@@ -119,14 +142,21 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) {
|
||||
log_assert_failed_unreachable(t, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
|
||||
} while (false)
|
||||
|
||||
#define assert_cc(expr) \
|
||||
do { \
|
||||
switch (0) { \
|
||||
case 0: \
|
||||
case !!(expr): \
|
||||
; \
|
||||
} \
|
||||
#if defined(static_assert)
|
||||
#define assert_cc(expr) \
|
||||
do { \
|
||||
static_assert(expr, #expr); \
|
||||
} while (false)
|
||||
#else
|
||||
#define assert_cc(expr) \
|
||||
do { \
|
||||
switch (0) { \
|
||||
case 0: \
|
||||
case !!(expr): \
|
||||
; \
|
||||
} \
|
||||
} while (false)
|
||||
#endif
|
||||
|
||||
#define PTR_TO_UINT(p) ((unsigned int) ((uintptr_t) (p)))
|
||||
#define UINT_TO_PTR(u) ((void*) ((uintptr_t) (u)))
|
||||
@@ -149,6 +179,8 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) {
|
||||
#define memzero(x,l) (memset((x), 0, (l)))
|
||||
#define zero(x) (memzero(&(x), sizeof(x)))
|
||||
|
||||
#define CHAR_TO_STR(x) ((char[2]) { x, 0 })
|
||||
|
||||
#define char_array_0(x) x[sizeof(x)-1] = 0;
|
||||
|
||||
#define IOVEC_SET_STRING(i, s) \
|
||||
@@ -187,6 +219,66 @@ static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) {
|
||||
return k;
|
||||
}
|
||||
|
||||
#include "log.h"
|
||||
#define VA_FORMAT_ADVANCE(format, ap) \
|
||||
do { \
|
||||
int _argtypes[128]; \
|
||||
size_t _i, _k; \
|
||||
_k = parse_printf_format((format), ELEMENTSOF(_argtypes), _argtypes); \
|
||||
assert(_k < ELEMENTSOF(_argtypes)); \
|
||||
for (_i = 0; _i < _k; _i++) { \
|
||||
if (_argtypes[_i] & PA_FLAG_PTR) { \
|
||||
(void) va_arg(ap, void*); \
|
||||
continue; \
|
||||
} \
|
||||
\
|
||||
switch (_argtypes[_i]) { \
|
||||
case PA_INT: \
|
||||
case PA_INT|PA_FLAG_SHORT: \
|
||||
case PA_CHAR: \
|
||||
(void) va_arg(ap, int); \
|
||||
break; \
|
||||
case PA_INT|PA_FLAG_LONG: \
|
||||
(void) va_arg(ap, long int); \
|
||||
break; \
|
||||
case PA_INT|PA_FLAG_LONG_LONG: \
|
||||
(void) va_arg(ap, long long int); \
|
||||
break; \
|
||||
case PA_WCHAR: \
|
||||
(void) va_arg(ap, wchar_t); \
|
||||
break; \
|
||||
case PA_WSTRING: \
|
||||
case PA_STRING: \
|
||||
case PA_POINTER: \
|
||||
(void) va_arg(ap, void*); \
|
||||
break; \
|
||||
case PA_FLOAT: \
|
||||
case PA_DOUBLE: \
|
||||
(void) va_arg(ap, double); \
|
||||
break; \
|
||||
case PA_DOUBLE|PA_FLAG_LONG_DOUBLE: \
|
||||
(void) va_arg(ap, long double); \
|
||||
break; \
|
||||
default: \
|
||||
assert_not_reached("Unknown format string argument."); \
|
||||
} \
|
||||
} \
|
||||
} while(false)
|
||||
|
||||
#endif
|
||||
/* Because statfs.t_type can be int on some architecures, we have to cast
|
||||
* the const magic to the type, otherwise the compiler warns about
|
||||
* signed/unsigned comparison, because the magic can be 32 bit unsigned.
|
||||
*/
|
||||
#define F_TYPE_CMP(a, b) (a == (typeof(a)) b)
|
||||
|
||||
|
||||
/* Returns the number of chars needed to format variables of the
|
||||
* specified type as a decimal string. Adds in extra space for a
|
||||
* negative '-' prefix. */
|
||||
|
||||
#define DECIMAL_STR_MAX(type) \
|
||||
(1+(sizeof(type) <= 1 ? 3 : \
|
||||
sizeof(type) <= 2 ? 5 : \
|
||||
sizeof(type) <= 4 ? 10 : \
|
||||
sizeof(type) <= 8 ? 20 : sizeof(int[-2*(sizeof(type) > 8)])))
|
||||
|
||||
#include "log.h"
|
||||
|
@@ -185,3 +185,95 @@ static const char *const log_level_table[] = {
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(log_level, int);
|
||||
|
||||
char *strnappend(const char *s, const char *suffix, size_t b) {
|
||||
size_t a;
|
||||
char *r;
|
||||
|
||||
if (!s && !suffix)
|
||||
return strdup("");
|
||||
|
||||
if (!s)
|
||||
return strndup(suffix, b);
|
||||
|
||||
if (!suffix)
|
||||
return strdup(s);
|
||||
|
||||
assert(s);
|
||||
assert(suffix);
|
||||
|
||||
a = strlen(s);
|
||||
if (b > ((size_t) -1) - a)
|
||||
return NULL;
|
||||
|
||||
r = new(char, a+b+1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
memcpy(r, s, a);
|
||||
memcpy(r+a, suffix, b);
|
||||
r[a+b] = 0;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
char *strappend(const char *s, const char *suffix) {
|
||||
return strnappend(s, suffix, suffix ? strlen(suffix) : 0);
|
||||
}
|
||||
|
||||
char *strjoin(const char *x, ...) {
|
||||
va_list ap;
|
||||
size_t l;
|
||||
char *r, *p;
|
||||
|
||||
va_start(ap, x);
|
||||
|
||||
if (x) {
|
||||
l = strlen(x);
|
||||
|
||||
for (;;) {
|
||||
const char *t;
|
||||
size_t n;
|
||||
|
||||
t = va_arg(ap, const char *);
|
||||
if (!t)
|
||||
break;
|
||||
|
||||
n = strlen(t);
|
||||
if (n > ((size_t) -1) - l) {
|
||||
va_end(ap);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
l += n;
|
||||
}
|
||||
} else
|
||||
l = 0;
|
||||
|
||||
va_end(ap);
|
||||
|
||||
r = new(char, l+1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
if (x) {
|
||||
p = stpcpy(r, x);
|
||||
|
||||
va_start(ap, x);
|
||||
|
||||
for (;;) {
|
||||
const char *t;
|
||||
|
||||
t = va_arg(ap, const char *);
|
||||
if (!t)
|
||||
break;
|
||||
|
||||
p = stpcpy(p, t);
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
} else
|
||||
r[0] = 0;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@@ -507,6 +507,42 @@ void* memdup(const void *p, size_t l);
|
||||
|
||||
int is_kernel_thread(pid_t pid);
|
||||
|
||||
static inline void freep(void *p) {
|
||||
free(*(void**) p);
|
||||
}
|
||||
|
||||
static inline void fclosep(FILE **f) {
|
||||
if (*f)
|
||||
fclose(*f);
|
||||
}
|
||||
|
||||
static inline void pclosep(FILE **f) {
|
||||
if (*f)
|
||||
pclose(*f);
|
||||
}
|
||||
|
||||
static inline void closep(int *fd) {
|
||||
if (*fd >= 0)
|
||||
close_nointr_nofail(*fd);
|
||||
}
|
||||
|
||||
static inline void closedirp(DIR **d) {
|
||||
if (*d)
|
||||
closedir(*d);
|
||||
}
|
||||
|
||||
static inline void umaskp(mode_t *u) {
|
||||
umask(*u);
|
||||
}
|
||||
|
||||
#define _cleanup_free_ _cleanup_(freep)
|
||||
#define _cleanup_fclose_ _cleanup_(fclosep)
|
||||
#define _cleanup_pclose_ _cleanup_(pclosep)
|
||||
#define _cleanup_close_ _cleanup_(closep)
|
||||
#define _cleanup_closedir_ _cleanup_(closedirp)
|
||||
#define _cleanup_umask_ _cleanup_(umaskp)
|
||||
#define _cleanup_globfree_ _cleanup_(globfree)
|
||||
|
||||
int fd_inc_sndbuf(int fd, size_t n);
|
||||
int fd_inc_rcvbuf(int fd, size_t n);
|
||||
|
||||
@@ -524,4 +560,6 @@ bool in_initrd(void);
|
||||
|
||||
void warn_melody(void);
|
||||
|
||||
char *strjoin(const char *x, ...) _sentinel_;
|
||||
|
||||
#endif
|
||||
|
63
lsinitrd-bash-completion.sh
Normal file
63
lsinitrd-bash-completion.sh
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Copyright 2013 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
__contains_word () {
|
||||
local word=$1; shift
|
||||
for w in $*; do [[ $w = $word ]] && return 0; done
|
||||
return 1
|
||||
}
|
||||
|
||||
_lsinitrd() {
|
||||
local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local -A OPTS=(
|
||||
[STANDALONE]='-s --size -h --help'
|
||||
|
||||
[ARG]='-f --file -k --kver'
|
||||
)
|
||||
|
||||
if __contains_word "$prev" ${OPTS[ARG]}; then
|
||||
case $prev in
|
||||
--file|-f)
|
||||
comps=$(compgen -f -- "$cur")
|
||||
compopt -o filenames
|
||||
;;
|
||||
--kver|-k)
|
||||
comps=$(cd /lib/modules; echo [0-9]*)
|
||||
;;
|
||||
*)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ $cur = -* ]]; then
|
||||
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
comps=$(compgen -f -- "$cur")
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -F _lsinitrd lsinitrd
|
@@ -10,7 +10,9 @@ lsinitrd - tool to show the contents of an initramfs image
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
*lsinitrd* ['OPTION...'] [<image>]
|
||||
*lsinitrd* ['OPTION...'] [<image> [<filename> [<filename> [...] ]]]
|
||||
|
||||
*lsinitrd* ['OPTION...'] -k <kernel-version>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
@@ -26,6 +28,12 @@ OPTIONS
|
||||
**-s, --size**::
|
||||
sort the contents of the initramfs by size.
|
||||
|
||||
**-f, --file** _<filename>_::
|
||||
print the contents of <filename>.
|
||||
|
||||
**-k, --kver** _<kernel version>_::
|
||||
inspect the initramfs of <kernel version>.
|
||||
|
||||
AVAILABILITY
|
||||
------------
|
||||
The lsinitrd command is part of the dracut package and is available from
|
||||
|
130
lsinitrd.sh
130
lsinitrd.sh
@@ -22,29 +22,51 @@
|
||||
usage()
|
||||
{
|
||||
{
|
||||
echo "Usage: ${0##*/} [-s] [<initramfs file> [<filename>]]"
|
||||
echo "Usage: ${0##*/} [options] [<initramfs file> [<filename> [<filename> [...] ]]]"
|
||||
echo "Usage: ${0##*/} [options] -k <kernel version>"
|
||||
echo
|
||||
echo "-h, --help print a help message and exit."
|
||||
echo "-s, --size sort the contents of the initramfs by size."
|
||||
echo "-h, --help print a help message and exit."
|
||||
echo "-s, --size sort the contents of the initramfs by size."
|
||||
echo "-f, --file <filename> print the contents of <filename>."
|
||||
echo "-k, --kver <kernel version> inspect the initramfs of <kernel version>."
|
||||
echo
|
||||
} >&2
|
||||
}
|
||||
|
||||
[[ $# -le 2 ]] || { usage ; exit 1 ; }
|
||||
|
||||
sorted=0
|
||||
while getopts "s" opt; do
|
||||
case $opt in
|
||||
s) sorted=1;;
|
||||
h) usage; exit 0;;
|
||||
\?) usage; exit 1;;
|
||||
declare -A filenames
|
||||
|
||||
unset POSIXLY_CORRECT
|
||||
TEMP=$(getopt \
|
||||
-o "shf:k:" \
|
||||
--long kver: \
|
||||
--long file: \
|
||||
--long help \
|
||||
--long size \
|
||||
-- "$@")
|
||||
|
||||
if (( $? != 0 )); then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval set -- "$TEMP"
|
||||
|
||||
while (($# > 0)); do
|
||||
case $1 in
|
||||
-k|--kver) KERNEL_VERSION="$2"; shift;;
|
||||
-f|--file) filenames[${2#/}]=1; shift;;
|
||||
-s|--size) sorted=1;;
|
||||
-h|--help) usage; exit 0;;
|
||||
--) shift;break;;
|
||||
*) usage; exit 1;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
KERNEL_VERSION="$(uname -r)"
|
||||
[[ $KERNEL_VERSION ]] || KERNEL_VERSION="$(uname -r)"
|
||||
|
||||
if [[ "$1" ]]; then
|
||||
if [[ $1 ]]; then
|
||||
image="$1"
|
||||
if ! [[ -f "$image" ]]; then
|
||||
{
|
||||
@@ -57,13 +79,20 @@ if [[ "$1" ]]; then
|
||||
else
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
|
||||
if [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
|
||||
&& [[ $MACHINE_ID ]] \
|
||||
&& [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
|
||||
image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
|
||||
else
|
||||
image="/boot/initramfs-${KERNEL_VERSION}.img"
|
||||
fi
|
||||
fi
|
||||
|
||||
shift
|
||||
while (($# > 0)); do
|
||||
filenames[${1#/}]=1;
|
||||
shift
|
||||
done
|
||||
|
||||
if ! [[ -f "$image" ]]; then
|
||||
{
|
||||
@@ -74,37 +103,50 @@ if ! [[ -f "$image" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CAT=zcat
|
||||
FILE_T=$(file --dereference "$image")
|
||||
read -N 6 bin < "$image"
|
||||
case $bin in
|
||||
$'\x1f\x8b'*)
|
||||
CAT="zcat";;
|
||||
BZh*)
|
||||
CAT="bzcat";;
|
||||
$'\x71\xc7'*|070701)
|
||||
CAT="cat";;
|
||||
*)
|
||||
CAT="xzcat";
|
||||
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
|
||||
CAT="xzcat --single-stream"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if echo "test"|xz|xz -dc --single-stream >/dev/null 2>&1; then
|
||||
XZ_SINGLE_STREAM="--single-stream"
|
||||
fi
|
||||
ret=0
|
||||
|
||||
if [[ "$FILE_T" =~ :\ gzip\ compressed\ data ]]; then
|
||||
CAT=zcat
|
||||
elif [[ "$FILE_T" =~ :\ xz\ compressed\ data ]]; then
|
||||
CAT="xzcat $XZ_SINGLE_STREAM"
|
||||
elif [[ "$FILE_T" =~ :\ XZ\ compressed\ data ]]; then
|
||||
CAT="xzcat $XZ_SINGLE_STREAM"
|
||||
elif [[ "$FILE_T" =~ :\ LZMA ]]; then
|
||||
CAT="xzcat $XZ_SINGLE_STREAM"
|
||||
elif [[ "$FILE_T" =~ :\ data ]]; then
|
||||
CAT="xzcat $XZ_SINGLE_STREAM"
|
||||
fi
|
||||
|
||||
if [[ $# -eq 2 ]]; then
|
||||
$CAT $image | cpio --extract --verbose --quiet --to-stdout ${2#/} 2>/dev/null
|
||||
exit $?
|
||||
fi
|
||||
|
||||
echo "$image: $(du -h $image | while read a b; do echo $a;done)"
|
||||
echo "========================================================================"
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout '*lib/dracut/dracut-*' 2>/dev/null
|
||||
echo "========================================================================"
|
||||
if [ "$sorted" -eq 1 ]; then
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
(( ${#filenames[@]} == 1 )) && nofileinfo=1
|
||||
for f in ${!filenames[@]}; do
|
||||
[[ $nofileinfo ]] || echo "initramfs:/$f"
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
$CAT -- $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
|
||||
((ret+=$?))
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
[[ $nofileinfo ]] || echo
|
||||
done
|
||||
else
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
|
||||
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
|
||||
echo "========================================================================"
|
||||
version=$($CAT -- "$image" | cpio --extract --verbose --quiet --to-stdout -- '*lib/dracut/dracut-*' 2>/dev/null)
|
||||
((ret+=$?))
|
||||
echo "$version with dracut modules:"
|
||||
$CAT -- "$image" | cpio --extract --verbose --quiet --to-stdout -- '*lib/dracut/modules.txt' 2>/dev/null
|
||||
((ret+=$?))
|
||||
echo "========================================================================"
|
||||
if [ "$sorted" -eq 1 ]; then
|
||||
$CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
else
|
||||
$CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -k9
|
||||
fi
|
||||
((ret+=$?))
|
||||
echo "========================================================================"
|
||||
fi
|
||||
echo "========================================================================"
|
||||
|
||||
exit $ret
|
||||
|
175
mkinitrd-dracut.sh
Normal file → Executable file
175
mkinitrd-dracut.sh
Normal file → Executable file
@@ -1,6 +1,11 @@
|
||||
#!/bin/bash --norc
|
||||
kver=$(uname -r)
|
||||
|
||||
boot_dir="/boot"
|
||||
quiet=0
|
||||
host_only=0
|
||||
force=0
|
||||
|
||||
error() { echo "$@" >&2; }
|
||||
|
||||
usage () {
|
||||
@@ -24,36 +29,105 @@ read_arg() {
|
||||
# $1 = arg name
|
||||
# $2 = arg value
|
||||
# $3 = arg parameter
|
||||
local rematch='^[^=]*=(.*)$'
|
||||
param="$1"
|
||||
local rematch='^[^=]*=(.*)$' result
|
||||
if [[ $2 =~ $rematch ]]; then
|
||||
read "$1" <<< "${BASH_REMATCH[1]}"
|
||||
elif [[ $3 != -* ]]; then
|
||||
# Only read next arg if it not an arg itself.
|
||||
read "$1" <<< "$3"
|
||||
# There is no way to shift our callers args, so
|
||||
# return 1 to indicate they should do it instead.
|
||||
return 1
|
||||
read "$param" <<< "${BASH_REMATCH[1]}"
|
||||
else
|
||||
for ((i=3; $i <= $#; i++)); do
|
||||
# Only read next arg if it not an arg itself.
|
||||
if [[ ${@:$i:1} = -* ]];then
|
||||
break
|
||||
fi
|
||||
result="$result ${@:$i:1}"
|
||||
# There is no way to shift our callers args, so
|
||||
# return "no of args" to indicate they should do it instead.
|
||||
done
|
||||
read "$1" <<< "$result"
|
||||
return $(($i - 3))
|
||||
fi
|
||||
}
|
||||
|
||||
# Taken over from SUSE mkinitrd
|
||||
default_kernel_images() {
|
||||
local regex kernel_image kernel_version version_version initrd_image
|
||||
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
|
||||
|
||||
case "$(uname -m)" in
|
||||
s390|s390x)
|
||||
regex='image'
|
||||
;;
|
||||
ppc|ppc64)
|
||||
regex='vmlinux'
|
||||
;;
|
||||
i386|x86_64)
|
||||
regex='vmlinuz'
|
||||
;;
|
||||
arm*)
|
||||
regex='[uz]Image'
|
||||
;;
|
||||
aarch64)
|
||||
regex='Image'
|
||||
;;
|
||||
*) regex='vmlinu.'
|
||||
;;
|
||||
esac
|
||||
|
||||
# user mode linux
|
||||
if grep -q UML /proc/cpuinfo; then
|
||||
regex='linux'
|
||||
fi
|
||||
|
||||
kernel_images=""
|
||||
initrd_images=""
|
||||
for kernel_image in $(ls $boot_dir \
|
||||
| sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
|
||||
| grep -v kdump$ ) ; do
|
||||
|
||||
# Note that we cannot check the RPM database here -- this
|
||||
# script is itself called from within the binary kernel
|
||||
# packages, and rpm does not allow recursive calls.
|
||||
|
||||
[ -L "$boot_dir/$kernel_image" ] && continue
|
||||
[ "${kernel_image%%.gz}" != "$kernel_image" ] && continue
|
||||
kernel_version=$(/usr/bin/get_kernel_version \
|
||||
$boot_dir/$kernel_image 2> /dev/null)
|
||||
initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
|
||||
if [ "$kernel_image" != "$initrd_image" -a \
|
||||
-n "$kernel_version" -a \
|
||||
-d "/lib/modules/$kernel_version" ]; then
|
||||
kernel_images="$kernel_images $boot_dir/$kernel_image"
|
||||
initrd_images="$initrd_images $boot_dir/$initrd_image"
|
||||
fi
|
||||
done
|
||||
for kernel_image in $kernel_images;do
|
||||
kernels="$kernels ${kernel_image#*-}"
|
||||
done
|
||||
for initrd_image in $initrd_images;do
|
||||
targets="$targets $initrd_image"
|
||||
done
|
||||
host_only=1
|
||||
force=1
|
||||
}
|
||||
|
||||
while (($# > 0)); do
|
||||
case ${1%%=*} in
|
||||
--with-usb) read_arg usbmodule "$@" || shift
|
||||
--with-usb) read_arg usbmodule "$@" || shift $?
|
||||
basicmodules="$basicmodules ${usbmodule:-usb-storage}"
|
||||
unset usbmodule;;
|
||||
--with-avail) read_arg modname "$@" || shift
|
||||
--with-avail) read_arg modname "$@" || shift $?
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--with) read_arg modname "$@" || shift
|
||||
--with) read_arg modname "$@" || shift $?
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--version)
|
||||
echo "mkinitrd: dracut compatibility wrapper"
|
||||
exit 0;;
|
||||
-v|--verbose) dracut_args="${dracut_args} -v";;
|
||||
-f|--force) dracut_args="${dracut_args} -f";;
|
||||
--preload) read_arg modname "$@" || shift
|
||||
-f|--force) force=1;;
|
||||
--preload) read_arg modname "$@" || shift $?
|
||||
basicmodules="$basicmodules $modname";;
|
||||
--image-version) img_vers=yes;;
|
||||
--rootfs) read_arg rootfs "$@" || shift
|
||||
--rootfs|-d) read_arg rootfs "$@" || shift $?
|
||||
dracut_args="${dracut_args} --filesystems $rootfs";;
|
||||
--nocompress) dracut_args="$dracut_args --no-compress";;
|
||||
--help) usage -n;;
|
||||
@@ -80,10 +154,31 @@ while (($# > 0)); do
|
||||
--looppath*) ;;
|
||||
--dsdt*) ;;
|
||||
--bootchart) ;;
|
||||
*) if [[ ! $target ]]; then
|
||||
target=$1
|
||||
elif [[ ! $kernel ]]; then
|
||||
kernel=$1
|
||||
-s) ;;
|
||||
--quiet|-q) quiet=1;;
|
||||
-b) read_arg boot_dir "$@" || shift $?
|
||||
if [ ! -d $boot_dir ];then
|
||||
error "Boot directory $boot_dir does not exist"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-k) # Would be nice to get a list of images here
|
||||
read_arg kernel_images "$@" || shift $?
|
||||
for kernel_image in $kernel_images;do
|
||||
kernels="$kernels ${kernel_image#*-}"
|
||||
done
|
||||
host_only=1
|
||||
force=1
|
||||
;;
|
||||
-i) read_arg initrd_images "$@" || shift $?
|
||||
for initrd_image in $initrd_images;do
|
||||
targets="$targets $boot_dir/$initrd_image"
|
||||
done
|
||||
;;
|
||||
*) if [[ ! $targets ]]; then
|
||||
targets=$1
|
||||
elif [[ ! $kernels ]]; then
|
||||
kernels=$1
|
||||
else
|
||||
usage
|
||||
fi;;
|
||||
@@ -91,11 +186,41 @@ while (($# > 0)); do
|
||||
shift
|
||||
done
|
||||
|
||||
[[ $target && $kernel ]] || usage
|
||||
[[ $img_vers ]] && target="$target-$kernel"
|
||||
[[ $targets && $kernels ]] || default_kernel_images
|
||||
[[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage)
|
||||
|
||||
if [[ $basicmodules ]]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
|
||||
else
|
||||
dracut $dracut_args "$target" "$kernel"
|
||||
fi
|
||||
# We can have several targets/kernels, transform the list to an array
|
||||
targets=( $targets )
|
||||
[[ $kernels ]] && kernels=( $kernels )
|
||||
|
||||
[[ $host_only == 1 ]] && dracut_args="${dracut_args} -H"
|
||||
[[ $force == 1 ]] && dracut_args="${dracut_args} -f"
|
||||
|
||||
echo "Creating: target|kernel|dracut args|basicmodules "
|
||||
for ((i=0 ; $i<${#targets[@]} ; i++)); do
|
||||
|
||||
if [[ $img_vers ]];then
|
||||
target="${targets[$i]}-${kernels[$i]}"
|
||||
else
|
||||
target="${targets[$i]}"
|
||||
fi
|
||||
kernel="${kernels[$i]}"
|
||||
|
||||
# Duplicate code: No way found how to redirect output based on $quiet
|
||||
if [[ $quiet == 1 ]];then
|
||||
echo "$target|$kernel|$dracut_args|$basicmodules"
|
||||
if [[ $basicmodules ]]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" \
|
||||
"$kernel" &>/dev/null
|
||||
else
|
||||
dracut $dracut_args "$target" "$kernel" &>/dev/null
|
||||
fi
|
||||
else
|
||||
if [[ $basicmodules ]]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" \
|
||||
"$kernel"
|
||||
else
|
||||
dracut $dracut_args "$target" "$kernel"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
20
modules.d/00bash/module-setup.sh
Executable file
20
modules.d/00bash/module-setup.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
[ -x /bin/bash ]
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
# If another shell is already installed, do not use bash
|
||||
[[ -x $initdir/bin/sh ]] && return
|
||||
|
||||
# Prefer bash as /bin/sh if it is available.
|
||||
inst /bin/bash && ln -sf bash "${initdir}/bin/sh"
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ install() {
|
||||
inst_symlink /init /sbin/init
|
||||
inst_dir /lib/bootchart/tmpfs
|
||||
|
||||
dracut_install bootchartd bash \
|
||||
inst_multiple bootchartd bash \
|
||||
/lib/bootchart/bootchart-collector /etc/bootchartd.conf \
|
||||
accton \
|
||||
echo \
|
||||
|
@@ -14,5 +14,5 @@ depends() {
|
||||
|
||||
install() {
|
||||
inst_symlink /init /sbin/init
|
||||
dracut_install $systemdutildir/systemd-bootchart
|
||||
inst_multiple $systemdutildir/systemd-bootchart
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
elif getarg boot= >/dev/null; then
|
||||
. /sbin/fips.sh
|
||||
if mount_boot; then
|
||||
|
@@ -3,7 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
elif ! [ -f /tmp/fipsdone ]; then
|
||||
. /sbin/fips.sh
|
||||
mount_boot
|
||||
|
@@ -15,6 +15,12 @@ mount_boot()
|
||||
UUID=*)
|
||||
boot="/dev/disk/by-uuid/${boot#UUID=}"
|
||||
;;
|
||||
PARTUUID=*)
|
||||
boot="/dev/disk/by-partuuid/${boot#PARTUUID=}"
|
||||
;;
|
||||
PARTLABEL=*)
|
||||
boot="/dev/disk/by-partlabel/${boot#PARTLABEL=}"
|
||||
;;
|
||||
/dev/*)
|
||||
;;
|
||||
*)
|
||||
@@ -44,14 +50,34 @@ mount_boot()
|
||||
info "Mounting $boot as /boot"
|
||||
mount -oro "$boot" /boot || return 1
|
||||
elif [ -d "$NEWROOT/boot" ]; then
|
||||
rm -fr /boot
|
||||
rm -fr -- /boot
|
||||
ln -sf "$NEWROOT/boot" /boot
|
||||
fi
|
||||
}
|
||||
|
||||
do_rhevh_check()
|
||||
{
|
||||
KERNEL=$(uname -r)
|
||||
kpath=${1}
|
||||
|
||||
# If we're on RHEV-H, the kernel is in /dev/.initramfs/live/vmlinuz0
|
||||
HMAC_SUM_ORIG=$(cat /boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done)
|
||||
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b; do printf "%s\n" $a; done || return 1)
|
||||
if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
|
||||
warn "HMAC sum mismatch"
|
||||
return 1
|
||||
fi
|
||||
info "rhevh_check OK"
|
||||
return 0
|
||||
}
|
||||
|
||||
do_fips()
|
||||
{
|
||||
info "Checking integrity of kernel"
|
||||
local _v
|
||||
local _s
|
||||
local _v
|
||||
local _module
|
||||
|
||||
KERNEL=$(uname -r)
|
||||
|
||||
if ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
|
||||
@@ -59,19 +85,41 @@ do_fips()
|
||||
return 1
|
||||
fi
|
||||
|
||||
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
|
||||
info "Loading and integrity checking all crypto modules"
|
||||
for module in $FIPSMODULES; do
|
||||
if [ "$module" != "tcrypt" ]; then
|
||||
modprobe ${module} || return 1
|
||||
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
|
||||
for _module in $FIPSMODULES; do
|
||||
if [ "$_module" != "tcrypt" ]; then
|
||||
if ! modprobe "${_module}"; then
|
||||
# check if kernel provides generic algo
|
||||
_found=0
|
||||
while read _k _s _v; do
|
||||
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
|
||||
[ "$_k" = "driver" ] && _v=$(str_replace "$_v" "_" "-")
|
||||
[ "$_v" != "$_module" ] && continue
|
||||
_found=1
|
||||
break
|
||||
done </proc/crypto
|
||||
[ "$_found" = "0" ] && return 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
mv /etc/modprobe.d/fips.conf.bak /etc/modprobe.d/fips.conf
|
||||
|
||||
info "Self testing crypto algorithms"
|
||||
modprobe tcrypt || return 1
|
||||
rmmod tcrypt
|
||||
|
||||
info "Checking integrity of kernel"
|
||||
if [ -e "$NEWROOT/dev/.initramfs/live/vmlinuz0" ]; then
|
||||
do_rhevh_check "$NEWROOT/dev/.initramfs/live/vmlinuz0" || return 1
|
||||
elif [ -e "$NEWROOT/dev/.initramfs/live/isolinux/vmlinuz0" ]; then
|
||||
do_rhevh_check "$NEWROOT/dev/.initramfs/live/isolinux/vmlinuz0" || return 1
|
||||
else
|
||||
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
fi
|
||||
|
||||
info "All initrd crypto checks done"
|
||||
|
||||
> /tmp/fipsdone
|
||||
|
@@ -12,9 +12,11 @@ depends() {
|
||||
|
||||
installkernel() {
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aead aes_generic xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr gcm ghash_generic"
|
||||
_fipsmodules+=" des deflate ecb eseqiv hmac seqiv sha256 sha256_generic sha512 sha512_generic"
|
||||
_fipsmodules+=" cryptomgr crypto_null tcrypt dm-mod dm-crypt lzo"
|
||||
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
|
||||
_fipsmodules+="chainiv crc32c cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod "
|
||||
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
|
||||
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
|
||||
_fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib"
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
@@ -32,12 +34,12 @@ 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 fipscheck
|
||||
inst_multiple sha512hmac rmmod insmod mount uname umount fipscheck
|
||||
|
||||
inst_libdir_file libsoftokn3.so libsoftokn3.so \
|
||||
libsoftokn3.chk libfreebl3.so libfreebl3.chk \
|
||||
libssl.so 'hmaccalc/sha512hmac.hmac'
|
||||
libssl.so 'hmaccalc/sha512hmac.hmac' libssl.so.10
|
||||
|
||||
dracut_install -o prelink
|
||||
inst_multiple -o prelink
|
||||
}
|
||||
|
||||
|
13
modules.d/03modsign/load-modsign-keys.sh
Normal file
13
modules.d/03modsign/load-modsign-keys.sh
Normal file
@@ -0,0 +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
|
||||
#
|
||||
# Licensed under the GPLv2
|
||||
#
|
||||
# Copyright 2013 Red Hat, Inc.
|
||||
# Peter Jones <pjones@redhat.com>
|
||||
|
||||
for x in /lib/modules/keys/* ; do
|
||||
[ "${x}" = "/lib/modules/keys/*" ] && break
|
||||
keyctl padd asymmetric "" @s < ${x}
|
||||
done
|
37
modules.d/03modsign/module-setup.sh
Normal file
37
modules.d/03modsign/module-setup.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Licensed under the GPLv2
|
||||
#
|
||||
# Copyright 2013 Red Hat, Inc.
|
||||
# Peter Jones <pjones@redhat.com>
|
||||
|
||||
check() {
|
||||
[[ -x /usr/bin/keyctl ]] || return 1
|
||||
|
||||
# do not include module in hostonly mode,
|
||||
# if no keys are present
|
||||
if [[ $hostonly ]]; then
|
||||
x=$(echo /lib/modules/keys/*)
|
||||
[[ "${x}" = "/lib/modules/keys/*" ]] && return 255
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_dir /lib/modules/keys
|
||||
inst_binary /usr/bin/keyctl
|
||||
|
||||
inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"
|
||||
|
||||
for x in /lib/modules/keys/* ; do
|
||||
[[ "${x}" = "/lib/modules/keys/*" ]] && break
|
||||
inst_simple "${x}"
|
||||
done
|
||||
}
|
@@ -12,7 +12,7 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install -o ps grep more cat rm strace free showmount \
|
||||
inst_multiple -o ps grep more cat rm strace free showmount \
|
||||
ping netstat rpcinfo vi scp ping6 ssh \
|
||||
fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck
|
||||
}
|
||||
|
@@ -23,6 +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
|
||||
inst_multiple -o wdctl
|
||||
}
|
||||
|
||||
|
@@ -4,6 +4,11 @@
|
||||
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
|
||||
for i in setfont loadkeys kbd_mode; do
|
||||
type -P "$i" >/dev/null || return 1
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -12,9 +17,18 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install -o $systemdutildir/systemd-vconsole-setup
|
||||
if dracut_module_included "systemd"; then
|
||||
[[ -f /etc/vconsole.conf ]] || return 0
|
||||
unset FONT
|
||||
unset KEYMAP
|
||||
. /etc/vconsole.conf
|
||||
# if vconsole.conf has no settings, do not include anything
|
||||
[[ $FONT ]] || [[ $KEYMAP ]] || return 0
|
||||
fi
|
||||
|
||||
inst_multiple -o $systemdutildir/systemd-vconsole-setup
|
||||
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
|
||||
DEFAULT_FONT=LatArCyrHeb-16
|
||||
DEFAULT_FONT="${i18n_default_font:-LatArCyrHeb-16}"
|
||||
I18N_CONF="/etc/locale.conf"
|
||||
VCONFIG_CONF="/etc/vconsole.conf"
|
||||
|
||||
@@ -84,7 +98,7 @@ install() {
|
||||
}
|
||||
|
||||
install_base() {
|
||||
dracut_install setfont loadkeys kbd_mode stty
|
||||
inst_multiple setfont loadkeys kbd_mode stty
|
||||
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst ${moddir}/console_init.sh /lib/udev/console_init
|
||||
@@ -102,16 +116,16 @@ install() {
|
||||
done
|
||||
|
||||
# remove unnecessary files
|
||||
rm -f "${initdir}${kbddir}/consoletrans/utflist"
|
||||
rm -f -- "${initdir}${kbddir}/consoletrans/utflist"
|
||||
find "${initdir}${kbddir}/" -name README\* -delete
|
||||
find "${initdir}${kbddir}/" -name '*.gz' -print -quit \
|
||||
| while read line; do
|
||||
dracut_install gzip
|
||||
inst_multiple gzip
|
||||
done
|
||||
|
||||
find "${initdir}${kbddir}/" -name '*.bz2' -print -quit \
|
||||
| while read line; do
|
||||
dracut_install bzip2
|
||||
inst_multiple bzip2
|
||||
done
|
||||
}
|
||||
|
||||
@@ -212,12 +226,6 @@ install() {
|
||||
kbddir=''
|
||||
done
|
||||
|
||||
[[ ${kbddir} ]] || {
|
||||
derror "Directories ${KBDSUBDIRS//,/, } not found. Please" \
|
||||
"inform us about the issue including your OS name and version."
|
||||
return 1
|
||||
}
|
||||
|
||||
[[ -f $I18N_CONF && -f $VCONFIG_CONF ]] || \
|
||||
[[ ! ${hostonly} || ${i18n_vars} ]] || {
|
||||
derror 'i18n_vars not set! Please set up i18n_vars in ' \
|
||||
|
@@ -36,7 +36,7 @@ if [ -f /etc/locale.conf ]; then
|
||||
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
|
||||
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
|
||||
|
@@ -56,22 +56,22 @@ if ! needconvert; then
|
||||
fi
|
||||
|
||||
testfile="$ROOT/.usrmovecheck$$"
|
||||
rm -f "$testfile"
|
||||
rm -f -- "$testfile"
|
||||
> "$testfile"
|
||||
if [[ ! -e "$testfile" ]]; then
|
||||
echo "Cannot write to $ROOT/"
|
||||
exit 1
|
||||
fi
|
||||
rm -f "$testfile"
|
||||
rm -f -- "$testfile"
|
||||
|
||||
testfile="$ROOT/usr/.usrmovecheck$$"
|
||||
rm -f "$testfile"
|
||||
rm -f -- "$testfile"
|
||||
> "$testfile"
|
||||
if [[ ! -e "$testfile" ]]; then
|
||||
echo "Cannot write to $ROOT/usr/"
|
||||
exit 1
|
||||
fi
|
||||
rm -f "$testfile"
|
||||
rm -f -- "$testfile"
|
||||
|
||||
find_mount() {
|
||||
local dev mnt etc wanted_dev
|
||||
@@ -108,11 +108,11 @@ cleanup() {
|
||||
for dir in "$ROOT/bin" "$ROOT/sbin" "$ROOT/lib" "$ROOT/lib64" \
|
||||
"$ROOT/usr/bin" "$ROOT/usr/sbin" "$ROOT/usr/lib" \
|
||||
"$ROOT/usr/lib64"; do
|
||||
[[ -d "${dir}.usrmove-new" ]] && rm -fr "${dir}.usrmove-new"
|
||||
[[ -d "${dir}.usrmove-new" ]] && rm -fr -- "${dir}.usrmove-new"
|
||||
if [[ -d "${dir}.usrmove-old" ]]; then
|
||||
mv "$dir" "${dir}.del~"
|
||||
mv "${dir}.usrmove-old" "$dir"
|
||||
rm -fr "${dir}.del~"
|
||||
rm -fr -- "${dir}.del~"
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -126,7 +126,7 @@ set -e
|
||||
|
||||
# merge / and /usr in new dir in /usr
|
||||
for dir in bin sbin lib lib64; do
|
||||
rm -rf "$ROOT/usr/${dir}.usrmove-new"
|
||||
rm -rf -- "$ROOT/usr/${dir}.usrmove-new"
|
||||
[[ -L "$ROOT/$dir" ]] && continue
|
||||
[[ -d "$ROOT/$dir" ]] || continue
|
||||
echo "Make a copy of \`$ROOT/usr/$dir'."
|
||||
@@ -150,7 +150,7 @@ done
|
||||
for dir in bin sbin lib lib64; do
|
||||
[[ -d "$ROOT/usr/${dir}.usrmove-new" ]] || continue
|
||||
echo "Switch to new \`$ROOT/usr/$dir'."
|
||||
rm -fr "$ROOT/usr/${dir}.usrmove-old"
|
||||
rm -fr -- "$ROOT/usr/${dir}.usrmove-old"
|
||||
mv "$ROOT/usr/$dir" "$ROOT/usr/${dir}.usrmove-old"
|
||||
mv "$ROOT/usr/${dir}.usrmove-new" "$ROOT/usr/$dir"
|
||||
done
|
||||
@@ -160,7 +160,7 @@ for dir in bin sbin lib lib64; do
|
||||
[[ -L "$ROOT/$dir" ]] && continue
|
||||
[[ -d "$ROOT/$dir" ]] || continue
|
||||
echo "Create \`$ROOT/$dir' symlink."
|
||||
rm -rf "$ROOT/${dir}.usrmove-old" || :
|
||||
rm -fr -- "$ROOT/${dir}.usrmove-old" || :
|
||||
mv "$ROOT/$dir" "$ROOT/${dir}.usrmove-old"
|
||||
ln -sfn usr/$dir "$ROOT/$dir"
|
||||
done
|
||||
@@ -178,9 +178,9 @@ done
|
||||
|
||||
for dir in bin sbin lib lib64; do
|
||||
[[ -d "$ROOT/usr/${dir}.usrmove-old~" ]] \
|
||||
&& rm -rf "$ROOT/usr/${dir}.usrmove-old~" || :
|
||||
&& rm -rf -- "$ROOT/usr/${dir}.usrmove-old~" || :
|
||||
[[ -d "$ROOT/${dir}.usrmove-old~" ]] \
|
||||
&& rm -rf "$ROOT/${dir}.usrmove-old~" || :
|
||||
&& rm -rf -- "$ROOT/${dir}.usrmove-old~" || :
|
||||
done
|
||||
|
||||
for dir in lib lib64; do
|
||||
|
@@ -12,7 +12,7 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install bash find ldconfig mv rm cp ln
|
||||
inst_multiple bash find ldconfig mv rm cp ln
|
||||
inst_hook pre-pivot 99 "$moddir/do-convertfs.sh"
|
||||
inst_script "$moddir/convertfs.sh" /usr/bin/convertfs
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@ setup_interface() {
|
||||
bcast=$new_broadcast_address
|
||||
gw=${new_routers%%,*}
|
||||
domain=$new_domain_name
|
||||
search=$(printf "$new_domain_search")
|
||||
search=$(printf -- "$new_domain_search")
|
||||
namesrv=$new_domain_name_servers
|
||||
hostname=$new_host_name
|
||||
|
||||
@@ -42,7 +42,7 @@ setup_interface() {
|
||||
|
||||
# Note: hostname can be fqdn OR short hostname, so chop off any
|
||||
# trailing domain name and explicity add any domain if set.
|
||||
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
}
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
@@ -89,7 +89,7 @@ case $reason in
|
||||
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
|
||||
echo "> /tmp/setup_net_$netif.ok"
|
||||
echo "> /tmp/setup_net_\$(cat /sys/class/net/$netif/address).ok"
|
||||
echo "rm -f $hookdir/initqueue/setup_net_$netif.sh"
|
||||
echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
|
||||
} > $hookdir/initqueue/setup_net_$netif.sh
|
||||
|
||||
echo "[ -f /tmp/setup_net_$netif.ok ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
|
||||
|
@@ -2,20 +2,24 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
|
||||
# This script is sourced, so root should be set. But let's be paranoid
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
[ -z "$netroot" ] && netroot=$(getarg netroot=)
|
||||
|
||||
if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] ; then
|
||||
if [ -z "$netroot" ]; then
|
||||
for netroot in $(getargs netroot=); do
|
||||
[ "$netroot" = "dhcp" ] && break
|
||||
[ "$netroot" = "dhcp6" ] && break
|
||||
done
|
||||
[ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] || unset netroot
|
||||
fi
|
||||
|
||||
if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ]; then
|
||||
# Tell ip= checker that we need dhcp
|
||||
NEEDDHCP="1"
|
||||
|
||||
# Done, all good!
|
||||
rootok=1
|
||||
if [ "$netroot" != "dhcp" ] ; then
|
||||
if [ "$netroot" != "dhcp" ] && [ "$netroot" != "dhcp6" ]; then
|
||||
netroot=$root
|
||||
fi
|
||||
|
||||
|
@@ -21,14 +21,18 @@ use_bridge='false'
|
||||
use_vlan='false'
|
||||
|
||||
# enslave this interface to bond?
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
for i in /tmp/bond.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset bondslaves
|
||||
unset bondname
|
||||
. "$i"
|
||||
for slave in $bondslaves ; do
|
||||
if [ "$netif" = "$slave" ] ; then
|
||||
netif=$bondname
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
@@ -39,6 +43,20 @@ if [ -e /tmp/team.info ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
if [ "$netif" = "$phydevice" ]; then
|
||||
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
|
||||
: # We need to really setup team (recursive call)
|
||||
else
|
||||
netif="$vlanname"
|
||||
use_vlan='true'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# bridge this interface?
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
@@ -46,6 +64,10 @@ if [ -e /tmp/bridge.info ]; then
|
||||
if [ "$netif" = "$ethname" ]; then
|
||||
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
|
||||
: # We need to really setup team (recursive call)
|
||||
elif [ "$netif" = "$vlanname" ] && [ -n "$DO_VLAN_SETUP" ]; then
|
||||
: # We need to really setup vlan (recursive call)
|
||||
else
|
||||
netif="$bridgename"
|
||||
use_bridge='true'
|
||||
@@ -54,18 +76,6 @@ if [ -e /tmp/bridge.info ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
if [ "$netif" = "$phydevice" ]; then
|
||||
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
else
|
||||
netif="$vlanname"
|
||||
use_vlan='true'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# disable manual ifup while netroot is set for simplifying our logic
|
||||
# in netroot case we prefer netroot to bringup $netif automaticlly
|
||||
[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
|
||||
@@ -98,6 +108,7 @@ do_ipv6auto() {
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
|
||||
linkup $netif
|
||||
wait_for_ipv6_auto $netif
|
||||
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
|
||||
@@ -113,10 +124,10 @@ do_static() {
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
if strstr $ip '*:*:*'; then
|
||||
# note no ip addr flush for ipv6
|
||||
ip addr add $ip/$mask ${srv+peer $srv} dev $netif
|
||||
ip addr add $ip/$mask ${srv:+peer $srv} dev $netif
|
||||
else
|
||||
ip addr flush dev $netif
|
||||
ip addr add $ip/$mask ${srv+peer $srv} brd + dev $netif
|
||||
ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif
|
||||
fi
|
||||
|
||||
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
@@ -134,11 +145,12 @@ if [ "$netif" = "lo" ] ; then
|
||||
fi
|
||||
|
||||
# start bond if needed
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
if [ -e /tmp/bond.${netif}.info ]; then
|
||||
. /tmp/bond.${netif}.info
|
||||
|
||||
if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.up ] ; then # We are master bond device
|
||||
modprobe bonding
|
||||
echo "+$netif" > /sys/class/net/bonding_masters
|
||||
ip link set $netif down
|
||||
|
||||
# Stolen from ifup-eth
|
||||
@@ -212,6 +224,10 @@ if [ -e /tmp/bridge.info ]; then
|
||||
for ethname in $ethnames ; do
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes ifup $bondname -m
|
||||
elif [ "$ethname" = "$teammaster" ] ; then
|
||||
DO_TEAM_SETUP=yes ifup $teammaster -m
|
||||
elif [ "$ethname" = "$vlanname" ]; then
|
||||
DO_VLAN_SETUP=yes ifup $vlanname -m
|
||||
else
|
||||
linkup $ethname
|
||||
fi
|
||||
@@ -235,10 +251,13 @@ if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
|
||||
modprobe 8021q
|
||||
if [ "$phydevice" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes ifup $phydevice -m
|
||||
elif [ "$phydevice" = "$teammaster" ] ; then
|
||||
DO_TEAM_SETUP=yes ifup $phydevice -m
|
||||
else
|
||||
linkup "$phydevice"
|
||||
fi
|
||||
ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname)"
|
||||
ip link set "$vlanname" up
|
||||
fi
|
||||
|
||||
# setup nameserver
|
||||
@@ -268,6 +287,17 @@ for p in $(getargs ip=); do
|
||||
# skip ibft
|
||||
[ "$autoconf" = "ibft" ] && continue
|
||||
|
||||
case "$dev" in
|
||||
??:??:??:??:??:??) # MAC address
|
||||
_dev=$(iface_for_mac $dev)
|
||||
[ -n "$_dev" ] && dev="$_dev"
|
||||
;;
|
||||
??-??-??-??-??-??) # MAC address in BOOTIF form
|
||||
_dev=$(iface_for_mac $(fix_bootif $dev))
|
||||
[ -n "$_dev" ] && dev="$_dev"
|
||||
;;
|
||||
esac
|
||||
|
||||
# If this option isn't directed at our interface, skip it
|
||||
[ -n "$dev" ] && [ "$dev" != "$netif" ] && \
|
||||
[ "$use_bridge" != 'true' ] && \
|
||||
@@ -303,6 +333,19 @@ for p in $(getargs ip=); do
|
||||
;;
|
||||
esac
|
||||
|
||||
break
|
||||
exit 0
|
||||
done
|
||||
|
||||
# netif isn't the top stack? Then we should exit here.
|
||||
# eg. netif is bond0. br0 is on top of it. dhcp br0 is correct but dhcp
|
||||
# bond0 doesn't make sense.
|
||||
if [ -n "$DO_BOND_SETUP" -o -n "$DO_TEAM_SETUP" -o -n "$DO_VLAN_SETUP" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# no ip option directed at our interface?
|
||||
if [ ! -e /tmp/setup_net_${netif}.ok ]; then
|
||||
do_dhcp -4
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
@@ -16,7 +16,6 @@ check() {
|
||||
}
|
||||
|
||||
depends() {
|
||||
[ -d /etc/sysconfig/network-scripts/ ] && echo ifcfg
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -70,10 +69,10 @@ installkernel() {
|
||||
|
||||
install() {
|
||||
local _arch _i _dir
|
||||
dracut_install ip arping dhclient sed
|
||||
dracut_install -o ping ping6
|
||||
dracut_install -o brctl
|
||||
dracut_install -o teamd teamdctl teamnl
|
||||
inst_multiple ip arping dhclient sed
|
||||
inst_multiple -o ping ping6
|
||||
inst_multiple -o brctl
|
||||
inst_multiple -o teamd teamdctl teamnl
|
||||
inst_simple /etc/libnl/classid
|
||||
inst_script "$moddir/ifup.sh" "/sbin/ifup"
|
||||
inst_script "$moddir/netroot.sh" "/sbin/netroot"
|
||||
@@ -83,6 +82,7 @@ install() {
|
||||
inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
|
||||
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
inst_hook cmdline 92 "$moddir/parse-ibft.sh"
|
||||
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-bond.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-team.sh"
|
||||
|
@@ -2,46 +2,45 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# pxelinux provides macaddr '-' separated, but we need ':'
|
||||
fix_bootif() {
|
||||
local macaddr=${1}
|
||||
local IFS='-'
|
||||
macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
|
||||
macaddr=${macaddr%:}
|
||||
# strip hardware type field from pxelinux
|
||||
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
|
||||
# return macaddr with lowercase alpha characters expected by udev
|
||||
echo $macaddr | sed 'y/ABCDEF/abcdef/'
|
||||
}
|
||||
getargbool 0 rd.neednet && NEEDNET=1
|
||||
|
||||
# Don't continue if we don't need network
|
||||
if [ -z "$netroot" ] && [ ! -e "/tmp/net.ifaces" ] && ! getargbool 0 rd.neednet >/dev/null; then
|
||||
if [ -z "$netroot" ] && [ ! -e "/tmp/net.ifaces" ] && [ "$NEEDNET" != "1" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
# Write udev rules
|
||||
{
|
||||
# bridge: attempt only the defined interface
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
IFACES="$IFACES ${ethnames%% *}"
|
||||
MASTER_IFACES="$MASTER_IFACES $bridgename"
|
||||
fi
|
||||
|
||||
# bond: attempt only the defined interface (override bridge defines)
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
for i in /tmp/bond.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset bondslaves
|
||||
unset bondname
|
||||
. "$i"
|
||||
# It is enough to fire up only one
|
||||
IFACES="$IFACES ${bondslaves%% *}"
|
||||
fi
|
||||
MASTER_IFACES="$MASTER_IFACES ${bondname}"
|
||||
done
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
IFACES="$IFACES ${teamslaves}"
|
||||
MASTER_IFACES="$MASTER_IFACES ${teammaster}"
|
||||
fi
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
IFACES="$IFACES $phydevice"
|
||||
MASTER_IFACES="$MASTER_IFACES ${vlanname}"
|
||||
fi
|
||||
|
||||
if [ -z "$IFACES" ]; then
|
||||
@@ -55,27 +54,50 @@ fi
|
||||
ifup='/sbin/ifup $env{INTERFACE}'
|
||||
[ -z "$netroot" ] && ifup="$ifup -m"
|
||||
|
||||
# BOOTIF says everything, use only that one
|
||||
BOOTIF=$(getarg 'BOOTIF=')
|
||||
if [ -n "$BOOTIF" ] ; then
|
||||
BOOTIF=$(fix_bootif "$BOOTIF")
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="%s"\n' "$BOOTIF" "/sbin/initqueue --onetime $ifup"
|
||||
echo "[ -f /tmp/setup_net_${BOOTIF}.ok ]" >$hookdir/initqueue/finished/wait-${BOOTIF}.sh
|
||||
runcmd="RUN+=\"/sbin/initqueue --name ifup-\$env{INTERFACE} --unique --onetime $ifup\""
|
||||
|
||||
# If we have to handle multiple interfaces, handle only them.
|
||||
elif [ -n "$IFACES" ] ; then
|
||||
for iface in $IFACES ; do
|
||||
printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="%s"\n' "$iface" "/sbin/initqueue --onetime $ifup"
|
||||
if [ "$bootdev" = "$iface" ]; then
|
||||
# We have some specific interfaces to handle
|
||||
if [ -n "$IFACES" ]; then
|
||||
echo 'SUBSYSTEM!="net", GOTO="net_end"'
|
||||
echo 'ACTION!="add|change|move", GOTO="net_end"'
|
||||
for iface in $IFACES; do
|
||||
case "$iface" in
|
||||
??:??:??:??:??:??) # MAC address
|
||||
cond="ATTR{address}==\"$iface\""
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
;;
|
||||
??-??-??-??-??-??) # MAC address in BOOTIF form
|
||||
cond="ATTR{address}==\"$(fix_bootif $iface)\""
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
;;
|
||||
*) # an interface name
|
||||
cond="ENV{INTERFACE}==\"$iface\""
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
cond="NAME==\"$iface\""
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
;;
|
||||
esac
|
||||
# The GOTO prevents us from trying to ifup the same device twice
|
||||
done
|
||||
echo 'LABEL="net_end"'
|
||||
|
||||
if [ -n "$MASTER_IFACES" ]; then
|
||||
wait_ifaces=$MASTER_IFACES
|
||||
else
|
||||
wait_ifaces=$IFACES
|
||||
fi
|
||||
|
||||
for iface in $wait_ifaces; do
|
||||
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
|
||||
echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh
|
||||
fi
|
||||
done
|
||||
|
||||
# Default: We don't know the interface to use, handle all
|
||||
# Fixme: waiting for the interface as well.
|
||||
else
|
||||
cond='ACTION=="add", SUBSYSTEM=="net"'
|
||||
# if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh
|
||||
printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup" > /etc/udev/rules.d/91-default-net.rules
|
||||
echo "$cond, $runcmd" > /etc/udev/rules.d/91-default-net.rules
|
||||
fi
|
||||
|
||||
# if you change the name of "90-net.rules", also change modules.d/80cms/cmssetup.sh
|
||||
|
@@ -14,6 +14,11 @@ iface_for_remote_addr() {
|
||||
echo $5
|
||||
}
|
||||
|
||||
iface_for_ip() {
|
||||
set -- $(ip -o addr show to $1)
|
||||
echo $2
|
||||
}
|
||||
|
||||
iface_for_mac() {
|
||||
local interface="" mac="$(echo $1 | sed 'y/ABCDEF/abcdef/')"
|
||||
for interface in /sys/class/net/*; do
|
||||
@@ -34,6 +39,45 @@ iface_has_link() {
|
||||
# XXX Do we need to reset the flags here? anaconda never bothered..
|
||||
}
|
||||
|
||||
find_iface_with_link() {
|
||||
local iface_path="" iface=""
|
||||
for iface_path in /sys/class/net/*; do
|
||||
iface=${iface_path##*/}
|
||||
str_starts "$iface" "lo" && continue
|
||||
if iface_has_link $iface; then
|
||||
echo "$iface"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# get the iface name for the given identifier - either a MAC, IP, or iface name
|
||||
iface_name() {
|
||||
case $1 in
|
||||
??:??:??:??:??:??|??-??-??-??-??-??) iface_for_mac $1 ;;
|
||||
*:*:*|*.*.*.*) iface_for_ip $1 ;;
|
||||
*) echo $1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# list the configured interfaces
|
||||
configured_ifaces() {
|
||||
local IFACES="" iface_id="" rv=1
|
||||
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
|
||||
if { pidof udevd || pidof systemd-udevd; } > /dev/null; then
|
||||
for iface_id in $IFACES; do
|
||||
echo $(iface_name $iface_id)
|
||||
rv=0
|
||||
done
|
||||
else
|
||||
warn "configured_ifaces called before udev is running"
|
||||
echo $IFACES
|
||||
[ -n "$IFACES" ] && rv=0
|
||||
fi
|
||||
return $rv
|
||||
}
|
||||
|
||||
all_ifaces_up() {
|
||||
local iface="" IFACES=""
|
||||
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
|
||||
@@ -61,7 +105,7 @@ ifdown() {
|
||||
ip link set $netif down
|
||||
ip addr flush dev $netif
|
||||
echo "#empty" > /etc/resolv.conf
|
||||
rm -f /tmp/net.$netif.did-setup
|
||||
rm -f -- /tmp/net.$netif.did-setup
|
||||
# TODO: send "offline" uevent?
|
||||
}
|
||||
|
||||
@@ -128,42 +172,93 @@ save_netinfo() {
|
||||
}
|
||||
|
||||
set_ifname() {
|
||||
local name="$1" mac="$2" num=0 n=""
|
||||
local name="$1" mac="$2" num=-1 n=""
|
||||
# if it's already set, return the existing name
|
||||
for n in $(getargs ifname=); do
|
||||
strstr "$n" "$mac" && echo ${n%%:*} && return
|
||||
done
|
||||
# otherwise, pick a new name and use that
|
||||
while [ -e /sys/class/$name$num ]; do num=$(($num+1)); done
|
||||
while :; do
|
||||
num=$(($num+1));
|
||||
[ -e /sys/class/net/$name$num ] && continue
|
||||
for n in $(getargs ifname=); do
|
||||
[ "$name$num" = "${n%%:*}" ] && continue 2
|
||||
done
|
||||
break
|
||||
done
|
||||
echo "ifname=$name$num:$mac" >> /etc/cmdline.d/45-ifname.conf
|
||||
echo "$name$num"
|
||||
}
|
||||
|
||||
# pxelinux provides macaddr '-' separated, but we need ':'
|
||||
fix_bootif() {
|
||||
local macaddr=${1}
|
||||
local IFS='-'
|
||||
macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
|
||||
macaddr=${macaddr%:}
|
||||
# strip hardware type field from pxelinux
|
||||
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
|
||||
# return macaddr with lowercase alpha characters expected by udev
|
||||
echo $macaddr | sed 'y/ABCDEF/abcdef/'
|
||||
}
|
||||
|
||||
ibft_to_cmdline() {
|
||||
local iface="" mac="" dev=""
|
||||
local dhcp="" ip="" gw="" mask="" hostname=""
|
||||
local iface=""
|
||||
modprobe -q iscsi_ibft
|
||||
(
|
||||
for iface in /sys/firmware/ibft/ethernet*; do
|
||||
local mac="" dev=""
|
||||
local dhcp="" ip="" gw="" mask="" hostname=""
|
||||
|
||||
[ -e ${iface}/mac ] || continue
|
||||
mac=$(read a < ${iface}/mac; echo $a)
|
||||
[ -z "$mac" ] && continue
|
||||
dev=$(set_ifname ibft $mac)
|
||||
dhcp=$(read a < ${iface}/dhcp; echo $a)
|
||||
|
||||
[ -e /tmp/net.${dev}.has_ibft_config ] && continue
|
||||
|
||||
[ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
|
||||
|
||||
if [ -n "$dhcp" ]; then
|
||||
echo "ip=$dev:dhcp"
|
||||
elif [ -e ${iface}/ip-addr ]; then
|
||||
[ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a)
|
||||
# skip not assigned ip adresses
|
||||
[ "$ip" = "0.0.0.0" ] && continue
|
||||
[ -e ${iface}/gateway ] && gw=$(read a < ${iface}/gateway; echo $a)
|
||||
[ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; echo $a)
|
||||
[ -e ${iface}/hostname ] && hostname=$(read a < ${iface}/hostname; echo $a)
|
||||
if [ -n "$ip" ] && [ -n "$mask" ]; then
|
||||
echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
|
||||
else
|
||||
warn "${iface} does not contain a valid iBFT configuration"
|
||||
warn "ip-addr=$ip"
|
||||
warn "gateway=$gw"
|
||||
warn "subnet-mask=$mask"
|
||||
warn "hostname=$hostname"
|
||||
fi
|
||||
else
|
||||
ip=$(read a < ${iface}/ip-addr; echo $a)
|
||||
gw=$(read a < ${iface}/gateway; echo $a)
|
||||
mask=$(read a < ${iface}/subnet-mask; echo $a)
|
||||
hostname=$(read a < ${iface}/hostname; echo $a)
|
||||
echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
|
||||
info "${iface} does not contain a valid iBFT configuration"
|
||||
ls -l ${iface} | vinfo
|
||||
fi
|
||||
|
||||
if [ -e ${iface}/vlan ]; then
|
||||
vlan=$(read a < ${iface}/vlan; echo $a)
|
||||
if [ "$vlan" -ne "0" ]; then
|
||||
case "$vlan" in
|
||||
[0-9]*)
|
||||
echo "vlan=$dev.$vlan:$dev"
|
||||
;;
|
||||
*)
|
||||
echo "vlan=$vlan:$dev"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
echo $mac > /tmp/net.${dev}.has_ibft_config
|
||||
done
|
||||
) >> /etc/cmdline.d/40-ibft.conf
|
||||
# reread cmdline
|
||||
unset CMDLINE
|
||||
}
|
||||
|
||||
parse_iscsi_root()
|
||||
@@ -282,7 +377,10 @@ ip_to_var() {
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
# anaconda-style argument cluster
|
||||
|
||||
# ip=<ipv4-address> means anaconda-style static config argument cluster:
|
||||
# ip=<ip> gateway=<gw> netmask=<nm> hostname=<host> mtu=<mtu>
|
||||
# ksdevice={link|bootif|ibft|<MAC>|<ifname>}
|
||||
if strstr "$autoconf" "*.*.*.*"; then
|
||||
ip="$autoconf"
|
||||
gw=$(getarg gateway=)
|
||||
@@ -291,9 +389,12 @@ ip_to_var() {
|
||||
dev=$(getarg ksdevice=)
|
||||
autoconf="none"
|
||||
mtu=$(getarg mtu=)
|
||||
|
||||
# handle special values for ksdevice
|
||||
case "$dev" in
|
||||
# ignore fancy values for ksdevice=XXX
|
||||
link|bootif|BOOTIF|ibft|*:*:*:*:*:*) dev="" ;;
|
||||
bootif|BOOTIF) dev=$(fix_bootif $(getarg BOOTIF=)) ;;
|
||||
link) dev="" ;; # FIXME: do something useful with this
|
||||
ibft) dev="" ;; # ignore - ibft is handled elsewhere
|
||||
esac
|
||||
fi
|
||||
}
|
||||
@@ -360,9 +461,25 @@ wait_for_route_ok() {
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_ipv6_auto() {
|
||||
local cnt=0
|
||||
local li
|
||||
while [ $cnt -lt 400 ]; do
|
||||
li=$(ip -6 addr show dev $1)
|
||||
strstr "$li" "dynamic" && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
linkup() {
|
||||
wait_for_if_link $1 2>/dev/null\
|
||||
&& ip link set $1 up 2>/dev/null\
|
||||
&& wait_for_if_up $1 2>/dev/null
|
||||
}
|
||||
|
||||
type hostname >/dev/null 2>&1 || \
|
||||
hostname() {
|
||||
cat /proc/sys/kernel/hostname
|
||||
}
|
||||
|
@@ -20,6 +20,18 @@ command -v setup_net >/dev/null || . /lib/net-lib.sh
|
||||
netif=$1
|
||||
[ -e "/tmp/net.bootdev" ] && read netif < /tmp/net.bootdev
|
||||
|
||||
case "$netif" in
|
||||
??:??:??:??:??:??) # MAC address
|
||||
for i in /sys/class/net/*/address; do
|
||||
mac=$(cat $i)
|
||||
if [ "$mac" = "$netif" ]; then
|
||||
i=${i%/address}
|
||||
netif=${i##*/}
|
||||
break
|
||||
fi
|
||||
done
|
||||
esac
|
||||
|
||||
# Figure out the handler for root=dhcp by recalling all netroot cmdline
|
||||
# handlers when this is not called from manually network bringing up.
|
||||
if [ -z "$2" ]; then
|
||||
@@ -39,6 +51,7 @@ if [ -z "$2" ]; then
|
||||
netroot=$new_root_path
|
||||
|
||||
# FIXME!
|
||||
unset rootok
|
||||
for f in $hookdir/cmdline/90*.sh; do
|
||||
[ -f "$f" ] && . "$f";
|
||||
done
|
||||
@@ -64,7 +77,7 @@ source_hook netroot $netif
|
||||
# Run the handler; don't store the root, it may change from device to device
|
||||
# XXX other variables to export?
|
||||
if $handler $netif $netroot $NEWROOT; then
|
||||
rm -f $hookdir/initqueue/finished/dhcp.sh
|
||||
rm -f -- $hookdir/initqueue/finished/dhcp.sh
|
||||
# Network rootfs mount successful - save interface info for ifcfg etc.
|
||||
save_netinfo $netif
|
||||
fi
|
||||
|
@@ -54,8 +54,8 @@ if getarg bond >/dev/null; then
|
||||
fi
|
||||
# Make it suitable for initscripts export
|
||||
bondoptions=$(str_replace "$bondoptions" ";" ",")
|
||||
echo "bondname=$bondname" > /tmp/bond.info
|
||||
echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.info
|
||||
echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.info
|
||||
echo "bondname=$bondname" > /tmp/bond.${bondname}.info
|
||||
echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.${bondname}.info
|
||||
echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.${bondname}.info
|
||||
return
|
||||
fi
|
||||
|
@@ -37,12 +37,6 @@ parsebridge() {
|
||||
unset bridgename ethnames
|
||||
|
||||
iface=eth0
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
if [ -n "$bondname" ] ; then
|
||||
iface=$bondname
|
||||
fi
|
||||
fi
|
||||
|
||||
# Parse bridge for bridgename and ethnames
|
||||
if bridge="$(getarg bridge)"; then
|
||||
|
10
modules.d/40network/parse-ibft.sh
Executable file
10
modules.d/40network/parse-ibft.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
# If ibft is requested, read ibft vals and write ip=XXX cmdline args
|
||||
[ "ibft" = "$(getarg ip=)" ] && ibft_to_cmdline
|
||||
|
@@ -15,16 +15,8 @@
|
||||
#
|
||||
|
||||
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
# Don't mix BOOTIF=macaddr from pxelinux and ip= lines
|
||||
getarg ip= >/dev/null && getarg BOOTIF= >/dev/null && \
|
||||
die "Mixing BOOTIF and ip= lines is dangerous"
|
||||
|
||||
# No more parsing stuff, BOOTIF says everything
|
||||
[ -n "$(getarg BOOTIF)" ] && return
|
||||
|
||||
if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] ; then
|
||||
if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] && [ -z "$(getarg BOOTIF=)" ]; then
|
||||
# No ip= argument(s) for netroot provided, defaulting to DHCP
|
||||
return;
|
||||
fi
|
||||
@@ -46,14 +38,17 @@ if [ -n "$NEEDBOOTDEV" ] ; then
|
||||
[ -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
|
||||
[ "ibft" = "$(getarg ip=)" ] && ibft_to_cmdline
|
||||
|
||||
# Check ip= lines
|
||||
# XXX Would be nice if we could errorcheck ip addresses here as well
|
||||
for p in $(getargs ip=); do
|
||||
ip_to_var $p
|
||||
|
||||
# make first device specified the BOOTDEV
|
||||
if [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then
|
||||
BOOTDEV="$dev"
|
||||
[ -n "$NEEDBOOTDEV" ] && warn "Setting bootdev to '$BOOTDEV'"
|
||||
fi
|
||||
|
||||
# skip ibft since we did it above
|
||||
[ "$autoconf" = "ibft" ] && continue
|
||||
|
||||
@@ -112,6 +107,12 @@ for p in $(getargs ip=); do
|
||||
|
||||
done
|
||||
|
||||
# put BOOTIF in IFACES to make sure it comes up
|
||||
if BOOTIF="$(getarg BOOTIF=)"; then
|
||||
BOOTDEV=$(fix_bootif $BOOTIF)
|
||||
IFACES="$BOOTDEV $IFACES"
|
||||
fi
|
||||
|
||||
# This ensures that BOOTDEV is always first in IFACES
|
||||
if [ -n "$BOOTDEV" ] && [ -n "$IFACES" ] ; then
|
||||
IFACES="${IFACES%$BOOTDEV*} ${IFACES#*$BOOTDEV}"
|
||||
@@ -121,6 +122,3 @@ fi
|
||||
# Store BOOTDEV and IFACES for later use
|
||||
[ -n "$BOOTDEV" ] && echo $BOOTDEV > /tmp/net.bootdev
|
||||
[ -n "$IFACES" ] && echo $IFACES > /tmp/net.ifaces
|
||||
|
||||
# We need a ip= line for the configured bootdev=
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$BOOTDEVOK" ] && die "Bootdev Argument '$BOOTDEV' not found"
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
[[ -d /etc/sysconfig/network-scripts ]] && return 0
|
||||
return 255
|
||||
}
|
||||
|
||||
|
@@ -4,19 +4,15 @@
|
||||
|
||||
# NFS root might have reached here before /tmp/net.ifaces was written
|
||||
udevadm settle --timeout=30
|
||||
# Don't write anything if we don't know our bootdev
|
||||
[ -f /tmp/net.ifaces ] || return 1
|
||||
|
||||
read IFACES < /tmp/net.ifaces
|
||||
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
fi
|
||||
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
fi
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
fi
|
||||
|
||||
mkdir -m 0755 -p /tmp/ifcfg/
|
||||
mkdir -m 0755 -p /tmp/ifcfg-leases/
|
||||
|
||||
@@ -83,12 +79,27 @@ print_s390() {
|
||||
echo "OPTIONS=\"${OPTIONS}\""
|
||||
}
|
||||
|
||||
for netup in /tmp/net.*.did-setup ; do
|
||||
[ -f $netup ] || continue
|
||||
|
||||
for netif in $IFACES ; do
|
||||
netif=${netup%%.did-setup}
|
||||
netif=${netif##*/net.}
|
||||
[ -e /tmp/ifcfg/ifcfg-$netif ] && continue
|
||||
# bridge?
|
||||
unset bridge
|
||||
unset bond
|
||||
unset bondslaves
|
||||
unset bondname
|
||||
unset bondoptions
|
||||
unset uuid
|
||||
unset ip
|
||||
unset gw
|
||||
unset mtu
|
||||
unset mask
|
||||
unset macaddr
|
||||
unset slave
|
||||
unset ethname
|
||||
[ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info
|
||||
|
||||
uuid=$(cat /proc/sys/kernel/random/uuid)
|
||||
if [ "$netif" = "$bridgename" ]; then
|
||||
bridge=yes
|
||||
@@ -96,63 +107,76 @@ for netif in $IFACES ; do
|
||||
# $netif can't be bridge and bond at the same time
|
||||
bond=yes
|
||||
fi
|
||||
if [ "$netif" = "$vlanname" ]; then
|
||||
vlan=yes
|
||||
fi
|
||||
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$netif"
|
||||
echo "DEVICE=\"$netif\""
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "UUID=$uuid"
|
||||
[ -n "$mtu" ] && echo "MTU=$mtu"
|
||||
if [ -f /tmp/net.$netif.lease ]; then
|
||||
echo "UUID=\"$uuid\""
|
||||
if [ -f /tmp/dhclient.$netif.lease ]; then
|
||||
[ -f /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
|
||||
strstr "$ip" '*:*:*' && echo "IPV6INIT=yes"
|
||||
if [ -f /tmp/net.$netif.has_ibft_config ]; then
|
||||
echo "BOOTPROTO=ibft"
|
||||
else
|
||||
echo "BOOTPROTO=dhcp"
|
||||
fi
|
||||
cp /tmp/net.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease
|
||||
cp /tmp/dhclient.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease
|
||||
else
|
||||
# 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"
|
||||
echo "IPV6ADDR=\"$ip/$mask\""
|
||||
else
|
||||
if [ -f /tmp/net.$netif.has_ibft_config ]; then
|
||||
echo "BOOTPROTO=ibft"
|
||||
else
|
||||
echo "BOOTPROTO=none"
|
||||
echo "IPADDR=$ip"
|
||||
echo "IPADDR=\"$ip\""
|
||||
if strstr "$mask" "."; then
|
||||
echo "NETMASK=$mask"
|
||||
echo "NETMASK=\"$mask\""
|
||||
else
|
||||
echo "PREFIX=$mask"
|
||||
echo "PREFIX=\"$mask\""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if strstr "$gw" '*:*:*'; then
|
||||
echo "IPV6_DEFAULTGW=$gw"
|
||||
echo "IPV6_DEFAULTGW=\"$gw\""
|
||||
elif [ -n "$gw" ]; then
|
||||
echo "GATEWAY=$gw"
|
||||
echo "GATEWAY=\"$gw\""
|
||||
fi
|
||||
fi
|
||||
[ -n "$mtu" ] && echo "MTU=\"$mtu\""
|
||||
} > /tmp/ifcfg/ifcfg-$netif
|
||||
|
||||
# bridge needs different things written to ifcfg
|
||||
if [ -z "$bridge" ] && [ -z "$bond" ]; then
|
||||
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
|
||||
# standard interface
|
||||
{
|
||||
if [ -n "$macaddr" ]; then
|
||||
echo "MACADDR=$macaddr"
|
||||
echo "MACADDR=\"$macaddr\""
|
||||
else
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
|
||||
fi
|
||||
print_s390 $netif
|
||||
echo "TYPE=Ethernet"
|
||||
echo "NAME=\"Boot Disk\""
|
||||
[ -n "$mtu" ] && echo "MTU=$mtu"
|
||||
echo "NAME=\"$netif\""
|
||||
[ -n "$mtu" ] && echo "MTU=\"$mtu\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
fi
|
||||
|
||||
if [ -n "$vlan" ] ; then
|
||||
{
|
||||
echo "TYPE=Vlan"
|
||||
echo "NAME=\"$netif\""
|
||||
echo "VLAN=yes"
|
||||
echo "PHYSDEV=\"$phydevice\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
fi
|
||||
|
||||
@@ -161,22 +185,22 @@ for netif in $IFACES ; do
|
||||
{
|
||||
# This variable is an indicator of a bond interface for initscripts
|
||||
echo "BONDING_OPTS=\"$bondoptions\""
|
||||
echo "NAME=\"Boot Disk\""
|
||||
echo "NAME=\"$netif\""
|
||||
echo "TYPE=Bond"
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
|
||||
for slave in $bondslaves ; do
|
||||
# Set ONBOOT=no to prevent initscripts from trying to setup already bonded physical interface
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$slave"
|
||||
echo "DEVICE=\"$slave\""
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=no"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$slave/address)"
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
|
||||
echo "SLAVE=yes"
|
||||
echo "MASTER=$netif"
|
||||
echo "NAME=$slave"
|
||||
echo "MASTER=\"$netif\""
|
||||
echo "NAME=\"$slave\""
|
||||
} >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
fi
|
||||
@@ -185,52 +209,50 @@ for netif in $IFACES ; do
|
||||
# bridge
|
||||
{
|
||||
echo "TYPE=Bridge"
|
||||
echo "NAME=\"Boot Disk\""
|
||||
echo "NAME=\"$netif\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
{
|
||||
# Set ONBOOT=no to prevent initscripts from trying to setup already bridged bond interface
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$bondname"
|
||||
echo "ONBOOT=no"
|
||||
echo "DEVICE=\"$bondname\""
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
# This variable is an indicator of a bond interface for initscripts
|
||||
echo "BONDING_OPTS=\"$bondoptions\""
|
||||
echo "BRIDGE=$netif"
|
||||
echo "BRIDGE=\"$netif\""
|
||||
echo "NAME=\"$bondname\""
|
||||
} >> /tmp/ifcfg/ifcfg-$bondname
|
||||
for slave in $bondslaves ; do
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
# Set ONBOOT=no to prevent initscripts from trying to setup already bridged physical interface
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$slave"
|
||||
echo "DEVICE=\"$slave\""
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=no"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$slave/address)"
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
|
||||
echo "SLAVE=yes"
|
||||
echo "MASTER=$bondname"
|
||||
echo "NAME=$slave"
|
||||
echo "MASTER=\"$bondname\""
|
||||
echo "NAME=\"$slave\""
|
||||
} >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
else
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$ethname"
|
||||
echo "DEVICE=\"$ethname\""
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=no"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$ethname/address)"
|
||||
echo "BRIDGE=$netif"
|
||||
echo "NAME=$ethname"
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$ethname/address)\""
|
||||
echo "BRIDGE=\"$netif\""
|
||||
echo "NAME=\"$ethname\""
|
||||
} >> /tmp/ifcfg/ifcfg-$ethname
|
||||
fi
|
||||
fi
|
||||
i=1
|
||||
for ns in $(getargs nameserver); do
|
||||
echo "DNS${i}=${ns}" >> /tmp/ifcfg/ifcfg-$netif
|
||||
echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-$netif
|
||||
i=$((i+1))
|
||||
done
|
||||
done
|
||||
|
@@ -12,19 +12,29 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
local _dir _crt _found _lib
|
||||
inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
|
||||
dracut_install curl
|
||||
inst_multiple 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 \
|
||||
/etc/ssl/certs/ca-certificates.crt; then
|
||||
dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
|
||||
fi
|
||||
for _dir in $libdirs; do
|
||||
[[ -d $_dir ]] || continue
|
||||
for _lib in $_dir/libcurl.so.*; do
|
||||
[[ -e $_lib ]] || continue
|
||||
_crt=$(grep -F --binary-files=text -z .crt $_lib)
|
||||
[[ $_crt ]] || continue
|
||||
[[ $_crt == /*/* ]] || continue
|
||||
if ! inst_simple "$_crt"; then
|
||||
dwarn "Couldn't install '$_crt' SSL CA cert bundle; HTTPS might not work."
|
||||
continue
|
||||
fi
|
||||
_found=1
|
||||
done
|
||||
done
|
||||
[[ $_found ]] || dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
|
||||
}
|
||||
|
||||
|
@@ -23,7 +23,7 @@ fetch_url() {
|
||||
local handler="$(get_url_handler $url)"
|
||||
[ -n "$handler" ] || return 254
|
||||
[ -n "$url" ] || return 255
|
||||
$handler "$url" "$outloc"
|
||||
"$handler" "$url" "$outloc"
|
||||
}
|
||||
|
||||
# get_url_handler URL
|
||||
@@ -54,7 +54,7 @@ add_url_handler() {
|
||||
|
||||
export CURL_HOME="/run/initramfs/url-lib"
|
||||
mkdir -p $CURL_HOME
|
||||
curl_args="--location --retry 3 --fail --show-error"
|
||||
curl_args="--globoff --location --retry 3 --fail --show-error"
|
||||
getargbool 0 rd.noverifyssl && curl_args="$curl_args --insecure"
|
||||
|
||||
proxy=$(getarg proxy=)
|
||||
@@ -64,7 +64,7 @@ curl_fetch_url() {
|
||||
local url="$1" outloc="$2"
|
||||
echo "$url" > /proc/self/fd/0
|
||||
if [ -n "$outloc" ]; then
|
||||
curl --globoff $curl_args --output "$outloc" "$url" || return $?
|
||||
curl $curl_args --output - -- "$url" > "$outloc" || return $?
|
||||
else
|
||||
local outdir="$(mkuniqdir /tmp curl_fetch_url)"
|
||||
( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
|
||||
@@ -106,18 +106,18 @@ nfs_fetch_url() {
|
||||
local filepath="${path%/*}" filename="${path##*/}" mntdir=""
|
||||
|
||||
# skip mount if server:/filepath is already mounted
|
||||
mntdir=$(nfs_already_mounted $server $path)
|
||||
mntdir=$(nfs_already_mounted "$server" "$path")
|
||||
if [ -z "$mntdir" ]; then
|
||||
local mntdir="$(mkuniqdir /run nfs_mnt)"
|
||||
mount_nfs $nfs:$server:$filepath${options:+:$options} $mntdir
|
||||
mount_nfs "$nfs:$server:$filepath${options:+:$options}" "$mntdir"
|
||||
# lazy unmount during pre-pivot hook
|
||||
inst_hook --hook pre-pivot --name 99url-lib-umount-nfs umount -l $mntdir
|
||||
inst_hook --hook pre-pivot --name 99url-lib-umount-nfs umount -l -- "$mntdir"
|
||||
fi
|
||||
|
||||
if [ -z "$outloc" ]; then
|
||||
outloc="$mntdir/$filename"
|
||||
else
|
||||
cp -f "$mntdir/$filename" "$outloc" || return $?
|
||||
cp -f -- "$mntdir/$filename" "$outloc" || return $?
|
||||
fi
|
||||
[ -f "$outloc" ] || return 253
|
||||
if [ -z "$2" ]; then echo "$outloc" ; fi
|
||||
|
@@ -71,7 +71,7 @@ install() {
|
||||
mv dev.old dev
|
||||
popd >/dev/null
|
||||
|
||||
dracut_install chvt
|
||||
inst_multiple chvt
|
||||
inst /usr/share/splashutils/initrd.splash /lib/gensplash-lib.sh
|
||||
inst_hook pre-pivot 90 "${moddir}"/gensplash-newroot.sh
|
||||
inst_hook pre-trigger 10 "${moddir}"/gensplash-pretrigger.sh
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
[[ -x /sbin/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]]
|
||||
type -P plymouthd >/dev/null && type -P plymouth >/dev/null
|
||||
}
|
||||
|
||||
depends() {
|
||||
@@ -22,7 +22,7 @@ install() {
|
||||
|
||||
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
|
||||
|
||||
dracut_install readlink
|
||||
inst_multiple readlink
|
||||
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --hide-splash
|
||||
plymouth --hide-splash 2>/dev/null || :
|
||||
|
@@ -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 -a -z "$DRACUT_SYSTEMD" ]; then
|
||||
/bin/plymouth --newroot=$NEWROOT
|
||||
if type plymouth >/dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
plymouth --newroot=$NEWROOT
|
||||
fi
|
||||
|
@@ -4,17 +4,16 @@
|
||||
PLYMOUTH_LOGO_FILE="/usr/share/pixmaps/system-logo-white.png"
|
||||
PLYMOUTH_THEME=$(plymouth-set-default-theme)
|
||||
|
||||
inst /sbin/plymouthd /bin/plymouthd
|
||||
dracut_install /bin/plymouth \
|
||||
inst_multiple plymouthd plymouth \
|
||||
"${PLYMOUTH_LOGO_FILE}" \
|
||||
/etc/system-release
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/usr/share/plymouth"
|
||||
|
||||
inst_libdir_file "plymouth/text.so" "plymouth/details.so"
|
||||
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
dracut_install \
|
||||
inst_multiple \
|
||||
"/usr/share/plymouth/themes/details/details.plymouth" \
|
||||
"/usr/share/plymouth/themes/text/text.plymouth" \
|
||||
|
||||
@@ -36,7 +35,7 @@ else
|
||||
[[ -f "$x" ]] || continue
|
||||
THEME_DIR=$(dirname "$x")
|
||||
mkdir -m 0755 -p "${initdir}/$THEME_DIR"
|
||||
dracut_install "$x"
|
||||
inst_multiple "$x"
|
||||
done
|
||||
(
|
||||
cd ${initdir}/usr/share/plymouth/themes;
|
||||
|
@@ -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 [ -x /bin/plymouthd -a -z "$DRACUT_SYSTEMD" ]; then
|
||||
if type plymouthd >/dev/null 2>&1 && [ -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
|
||||
@@ -16,8 +16,8 @@ if [ -x /bin/plymouthd -a -z "$DRACUT_SYSTEMD" ]; then
|
||||
read consoledev rest < /sys/class/tty/console/active
|
||||
consoledev=${consoledev:-tty0}
|
||||
[ -x /lib/udev/console_init -a -e "/dev/$consoledev" ] && /lib/udev/console_init "/dev/$consoledev"
|
||||
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session --pid-file /run/plymouth/pid
|
||||
/bin/plymouth --show-splash 2>&1 | vinfo
|
||||
plymouthd --attach-to-session --pid-file /run/plymouth/pid
|
||||
plymouth --show-splash 2>&1 | vinfo
|
||||
# reset tty after plymouth messed with it
|
||||
[ -x /lib/udev/console_init -a -e "/dev/$consoledev" ] && /lib/udev/console_init "/dev/$consoledev"
|
||||
fi
|
||||
|
@@ -27,12 +27,11 @@ else
|
||||
fi
|
||||
|
||||
{
|
||||
echo "ip=$IPADDR::$GATEWAY:$NETMASK:$HOSTNAME:$DEVICE:none:$MACADDR"
|
||||
echo "ip=$IPADDR::$GATEWAY:$NETMASK:$HOSTNAME:$DEVICE:none:$MTU:$MACADDR"
|
||||
for i in $DNS1 $DNS2; do
|
||||
echo "nameserver=$i"
|
||||
done
|
||||
} > /etc/cmdline.d/80-cms.conf
|
||||
unset CMDLINE
|
||||
|
||||
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
|
||||
IFACES="$IFACES $DEVICE"
|
||||
|
@@ -51,152 +51,164 @@ function dasd_settle_all() {
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
# prints a canonocalized device bus ID for a given devno of any format
|
||||
function canonicalize_devno()
|
||||
{
|
||||
case ${#1} in
|
||||
3) echo "0.0.0${1}" ;;
|
||||
4) echo "0.0.${1}" ;;
|
||||
*) echo "${1}" ;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
function canonicalize_devno()
|
||||
{
|
||||
case ${#1} in
|
||||
3) echo "0.0.0${1}" ;;
|
||||
4) echo "0.0.${1}" ;;
|
||||
*) echo "${1}" ;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
# read file from CMS and write it to /tmp
|
||||
function readcmsfile() # $1=dasdport $2=filename
|
||||
{
|
||||
local dev
|
||||
local numcpus
|
||||
local devname
|
||||
local ret=0
|
||||
if [ $# -ne 2 ]; then return; fi
|
||||
function readcmsfile() # $1=dasdport $2=filename
|
||||
{
|
||||
local dev
|
||||
local numcpus
|
||||
local devname
|
||||
local ret=0
|
||||
if [ $# -ne 2 ]; then return; fi
|
||||
# precondition: udevd created dasda block device node
|
||||
if ! dasd_cio_free -d $1 ; then
|
||||
echo $"DASD $1 could not be cleared from device blacklist"
|
||||
return 1
|
||||
fi
|
||||
if ! dasd_cio_free -d $1 ; then
|
||||
echo $"DASD $1 could not be cleared from device blacklist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
modprobe dasd_mod dasd=$CMSDASD
|
||||
modprobe dasd_eckd_mod
|
||||
udevadm settle
|
||||
modprobe dasd_mod dasd=$CMSDASD
|
||||
modprobe dasd_eckd_mod
|
||||
udevadm settle
|
||||
|
||||
# precondition: dasd_eckd_mod driver incl. dependencies loaded,
|
||||
# dasd_mod must be loaded without setting any DASD online
|
||||
dev=$(canonicalize_devno $1)
|
||||
numcpus=$(
|
||||
while read line; do
|
||||
if strstr "$line" "# processors"; then
|
||||
echo ${line##*:};
|
||||
break;
|
||||
fi;
|
||||
done < /proc/cpuinfo
|
||||
)
|
||||
dev=$(canonicalize_devno $1)
|
||||
numcpus=$(
|
||||
while read line; do
|
||||
if strstr "$line" "# processors"; then
|
||||
echo ${line##*:};
|
||||
break;
|
||||
fi;
|
||||
done < /proc/cpuinfo
|
||||
)
|
||||
|
||||
if [ ${numcpus} -eq 1 ]; then
|
||||
echo 1 > /sys/bus/ccw/devices/$dev/online
|
||||
else
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 1; then
|
||||
echo $"DASD $dev could not be set online"
|
||||
return 1
|
||||
if [ ${numcpus} -eq 1 ]; then
|
||||
echo 1 > /sys/bus/ccw/devices/$dev/online
|
||||
else
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 1; then
|
||||
echo $"DASD $dev could not be set online"
|
||||
return 1
|
||||
fi
|
||||
udevadm settle
|
||||
if ! dasd_settle $dev ; then
|
||||
echo $"Could not access DASD $dev in time"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
udevadm settle
|
||||
if ! dasd_settle $dev ; then
|
||||
echo $"Could not access DASD $dev in time"
|
||||
return 1
|
||||
|
||||
devname=$(cd /sys/bus/ccw/devices/$dev/block; set -- *; [ -b /dev/$1 ] && echo $1)
|
||||
devname=${devname:-dasda}
|
||||
|
||||
[[ -d /mnt ]] || mkdir /mnt
|
||||
if cmsfs-fuse --to=UTF-8 -a /dev/$devname /mnt; then
|
||||
cat /mnt/$2 > /run/initramfs/$2
|
||||
umount /mnt || umount -l /mnt
|
||||
udevadm settle
|
||||
else
|
||||
echo $"Could not read conf file $2 on CMS DASD $1."
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
|
||||
udevadm settle
|
||||
|
||||
devname=$(cd /sys/bus/ccw/devices/$dev/block; set -- *; [ -b /dev/$1 ] && echo $1)
|
||||
devname=${devname:-dasda}
|
||||
|
||||
[[ -d /mnt ]] || mkdir /mnt
|
||||
if cmsfs-fuse --to=UTF-8 -a /dev/$devname /mnt; then
|
||||
cat /mnt/$2 > /run/initramfs/$2
|
||||
umount /mnt || umount -l /mnt
|
||||
udevadm settle
|
||||
else
|
||||
echo $"Could not read conf file $2 on CMS DASD $1."
|
||||
ret=1
|
||||
fi
|
||||
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 0; then
|
||||
echo $"DASD $dev could not be set offline again"
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 0; then
|
||||
echo $"DASD $dev could not be set offline again"
|
||||
#return 1
|
||||
fi
|
||||
udevadm settle
|
||||
fi
|
||||
udevadm settle
|
||||
|
||||
# unbind all dasds to unload the dasd modules for a clean start
|
||||
( cd /sys/bus/ccw/drivers/dasd-eckd; for i in *.*; do echo $i > unbind;done)
|
||||
udevadm settle
|
||||
modprobe -r dasd_eckd_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_diag_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_mod
|
||||
udevadm settle
|
||||
return $ret
|
||||
}
|
||||
( cd /sys/bus/ccw/drivers/dasd-eckd; for i in *.*; do echo $i > unbind;done)
|
||||
udevadm settle
|
||||
modprobe -r dasd_eckd_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_diag_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_mod
|
||||
udevadm settle
|
||||
return $ret
|
||||
}
|
||||
|
||||
processcmsfile()
|
||||
{
|
||||
source /tmp/cms.conf
|
||||
processcmsfile()
|
||||
{
|
||||
source /tmp/cms.conf
|
||||
|
||||
if [[ $NETTYPE ]]; then
|
||||
(
|
||||
echo -n $NETTYPE,$SUBCHANNELS
|
||||
[[ $PORTNAME ]] && echo ",portname=$PORTNAME"
|
||||
[[ $LAYER2 ]] && echo ",layer2=$LAYER"
|
||||
[[ "$NETTYPE" = "ctc" ]] && [[ $CTCPROT ]] && echo ",protocol=$CTCPROT"
|
||||
echo
|
||||
) >> /etc/ccw.conf
|
||||
if [[ $NETTYPE ]]; then
|
||||
(
|
||||
echo -n $NETTYPE,$SUBCHANNELS
|
||||
[[ $PORTNAME ]] && echo -n ",portname=$PORTNAME"
|
||||
[[ $LAYER2 ]] && echo -n ",layer2=$LAYER2"
|
||||
[[ "$NETTYPE" = "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
|
||||
echo
|
||||
) >> /etc/ccw.conf
|
||||
|
||||
OLDIFS=$IFS
|
||||
IFS=,
|
||||
read -a subch_array <<< "indexzero,$SUBCHANNELS"
|
||||
IFS=$OLDIFS
|
||||
devbusid=${subch_array[1]}
|
||||
if [ "$NETTYPE" = "ctc" ]; then
|
||||
driver="ctcm"
|
||||
else
|
||||
driver=$NETTYPE
|
||||
OLDIFS=$IFS
|
||||
IFS=,
|
||||
read -a subch_array <<< "indexzero,$SUBCHANNELS"
|
||||
IFS=$OLDIFS
|
||||
devbusid=${subch_array[1]}
|
||||
if [ "$NETTYPE" = "ctc" ]; then
|
||||
driver="ctcm"
|
||||
else
|
||||
driver=$NETTYPE
|
||||
fi
|
||||
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
|
||||
# remove the default net rules
|
||||
rm -f -- /etc/udev/rules.d/91-default-net.rules
|
||||
[[ -f /etc/udev/rules.d/90-net.rules ]] \
|
||||
|| printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
|
||||
udevadm control --reload
|
||||
znet_cio_free
|
||||
fi
|
||||
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
|
||||
# remove the default net rules
|
||||
rm -f /etc/udev/rules.d/91-default-net.rules
|
||||
[[ -f /etc/udev/rules.d/90-net.rules ]] \
|
||||
|| printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
|
||||
if [[ $DASD ]]; then
|
||||
echo $DASD | normalize_dasd_arg > /etc/dasd.conf
|
||||
echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf
|
||||
dasd_cio_free
|
||||
fi
|
||||
|
||||
znet_cio_free
|
||||
fi
|
||||
unset _do_zfcp
|
||||
for i in ${!FCP_*}; do
|
||||
echo "${!i}" | while read port rest; do
|
||||
case $port in
|
||||
*.*.*)
|
||||
;;
|
||||
*.*)
|
||||
port="0.$port"
|
||||
;;
|
||||
*)
|
||||
port="0.0.$port"
|
||||
;;
|
||||
esac
|
||||
echo $port $rest >> /etc/zfcp.conf
|
||||
done
|
||||
_do_zfcp=1
|
||||
done
|
||||
[[ $_do_zfcp ]] && zfcp_cio_free
|
||||
unset _do_zfcp
|
||||
}
|
||||
|
||||
if [[ $DASD ]]; then
|
||||
echo $DASD | normalize_dasd_arg > /etc/dasd.conf
|
||||
echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf
|
||||
dasd_cio_free
|
||||
fi
|
||||
|
||||
unset _do_zfcp
|
||||
for i in ${!FCP_*}; do
|
||||
echo "${!i}" >> /etc/zfcp.conf
|
||||
_do_zfcp=1
|
||||
done
|
||||
[[ $_do_zfcp ]] && zfcp_cio_free
|
||||
unset _do_zfcp
|
||||
}
|
||||
|
||||
[[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=")
|
||||
[[ $CMSCONFFILE ]] || CMSCONFFILE=$(getarg "CMSCONFFILE=")
|
||||
[[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=")
|
||||
[[ $CMSCONFFILE ]] || CMSCONFFILE=$(getarg "CMSCONFFILE=")
|
||||
|
||||
# Parse configuration
|
||||
if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then
|
||||
if readcmsfile $CMSDASD $CMSCONFFILE; then
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/$CMSCONFFILE
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/cms.conf
|
||||
processcmsfile
|
||||
if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then
|
||||
if readcmsfile $CMSDASD $CMSCONFFILE; then
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/$CMSCONFFILE
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/cms.conf
|
||||
processcmsfile
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@@ -23,7 +23,7 @@ install() {
|
||||
inst_hook pre-trigger 30 "$moddir/cmssetup.sh"
|
||||
inst_hook pre-pivot 95 "$moddir/cms-write-ifcfg.sh"
|
||||
inst_script "$moddir/cmsifup.sh" /sbin/cmsifup
|
||||
dracut_install /etc/cmsfs-fuse/filetypes.conf /etc/udev/rules.d/99-fuse.rules /etc/fuse.conf \
|
||||
inst_multiple /etc/cmsfs-fuse/filetypes.conf /etc/udev/rules.d/99-fuse.rules /etc/fuse.conf \
|
||||
cmsfs-fuse fusermount ulockmgr_server bash insmod rmmod cat normalize_dasd_arg sed \
|
||||
$(rpm -ql s390utils-base)
|
||||
|
||||
|
@@ -39,11 +39,10 @@ install() {
|
||||
fi
|
||||
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_script "$moddir/btrfs_timeout.sh" \
|
||||
/usr/lib/dracut/hooks/initqueue/timeout/btrfs_timeout.sh
|
||||
inst_hook initqueue/timeout 10 "$moddir/btrfs_timeout.sh"
|
||||
fi
|
||||
|
||||
dracut_install btrfsck
|
||||
inst_multiple -o btrfsck btrfs-zero-log
|
||||
inst $(command -v btrfs) /sbin/btrfs
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
# close everything which is not busy
|
||||
rm -f /etc/udev/rules.d/70-luks.rules >/dev/null 2>&1
|
||||
rm -f -- /etc/udev/rules.d/70-luks.rules >/dev/null 2>&1
|
||||
|
||||
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
|
||||
|
@@ -4,6 +4,19 @@
|
||||
|
||||
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
|
||||
# check if the crypttab contains an entry for a LUKS UUID
|
||||
crypttab_contains() {
|
||||
local luks="$1"
|
||||
local l d rest
|
||||
if [ -f /etc/crypttab ]; then
|
||||
while read l d rest; do
|
||||
strstr "${l##luks-}" "${luks##luks-}" && return 0
|
||||
strstr "$d" "${luks##luks-}" && return 0
|
||||
done < /etc/crypttab
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
# ask_for_password
|
||||
#
|
||||
# Wraps around plymouth ask-for-password and adds fallback to tty password ask
|
||||
@@ -47,8 +60,8 @@ ask_for_password() {
|
||||
|
||||
{ flock -s 9;
|
||||
# Prompt for password with plymouth, if installed and running.
|
||||
if [ -x /bin/plymouth ] && /bin/plymouth --ping; then
|
||||
/bin/plymouth ask-for-password \
|
||||
if type plymouth >/dev/null 2>&1 && plymouth --ping 2>/dev/null; then
|
||||
plymouth ask-for-password \
|
||||
--prompt "$ply_prompt" --number-of-tries=$ply_tries \
|
||||
--command="$ply_cmd"
|
||||
ret=$?
|
||||
|
@@ -3,15 +3,12 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
type crypttab_contains >/dev/null 2>&1 || . /lib/dracut-crypt-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
|
||||
crypttab_contains "$luks" && exit 0
|
||||
|
||||
allowdiscards="-"
|
||||
|
||||
|
@@ -26,29 +26,30 @@ installkernel() {
|
||||
instmods dm_crypt =crypto
|
||||
}
|
||||
|
||||
cmdline() {
|
||||
local dev UUID
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[[ "${host_fs_types[$dev]}" != "crypto_LUKS" ]] && continue
|
||||
|
||||
UUID=$(
|
||||
blkid -u crypto -o export $dev \
|
||||
| while read line; do
|
||||
[[ ${line#UUID} = $line ]] && continue
|
||||
printf "%s" "${line#UUID=}"
|
||||
break
|
||||
done
|
||||
)
|
||||
[[ ${UUID} ]] || continue
|
||||
printf "%s" " rd.luks.uuid=luks-${UUID}"
|
||||
done
|
||||
}
|
||||
|
||||
install() {
|
||||
|
||||
check_crypt() {
|
||||
local dev=$1 fs=$2
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
||||
|
||||
[[ $fs = "crypto_LUKS" ]] || return 1
|
||||
ID_FS_UUID=$(udevadm info --query=property --name=$dev \
|
||||
| while read line; do
|
||||
[[ ${line#ID_FS_UUID} = $line ]] && continue
|
||||
eval "$line"
|
||||
echo $ID_FS_UUID
|
||||
break
|
||||
done)
|
||||
[[ ${ID_FS_UUID} ]] || return 1
|
||||
if ! [[ $kernel_only ]]; then
|
||||
echo " rd.luks.uuid=luks-${ID_FS_UUID} " >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
for_each_host_dev_fs check_crypt
|
||||
|
||||
dracut_install cryptsetup rmdir readlink umount
|
||||
inst_multiple cryptsetup rmdir readlink umount
|
||||
inst_script "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
|
||||
inst_script "$moddir"/probe-keydev.sh /sbin/probe-keydev
|
||||
inst_hook cmdline 10 "$moddir/parse-keydev.sh"
|
||||
@@ -56,11 +57,29 @@ install() {
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
|
||||
fi
|
||||
[[ $hostonly ]] && inst_simple /etc/crypttab
|
||||
|
||||
if [[ $hostonly ]] && [[ -f /etc/crypttab ]]; then
|
||||
# filter /etc/crypttab for the devices we need
|
||||
while read _mapper _dev _rest; do
|
||||
[[ $_mapper = \#* ]] && continue
|
||||
[[ $_dev ]] || continue
|
||||
|
||||
[[ $_dev == UUID=* ]] && \
|
||||
_dev="/dev/disk/by-uuid/${_dev#UUID=}"
|
||||
|
||||
for _hdev in "${!host_fs_types[@]}"; do
|
||||
[[ ${host_fs_types[$_hdev]} == "crypto_LUKS" ]] || continue
|
||||
if [[ $_hdev -ef $_dev ]] || [[ /dev/block/$_hdev -ef $_dev ]]; then
|
||||
echo "$_mapper $_dev $_rest"
|
||||
break
|
||||
fi
|
||||
done
|
||||
done < /etc/crypttab > $initdir/etc/crypttab
|
||||
fi
|
||||
|
||||
inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
|
||||
|
||||
dracut_install -o \
|
||||
$systemdutildir/system-generators/systemd-cryptsetup-generator \
|
||||
inst_multiple -o \
|
||||
$systemdutildir/system-generators/systemd-cryptsetup-generator \
|
||||
$systemdutildir/systemd-cryptsetup \
|
||||
$systemdsystemunitdir/systemd-ask-password-console.path \
|
||||
|
@@ -2,9 +2,11 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type crypttab_contains >/dev/null 2>&1 || . /lib/dracut-crypt-lib.sh
|
||||
|
||||
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
|
||||
rm -f -- /etc/udev/rules.d/70-luks.rules
|
||||
else
|
||||
{
|
||||
echo 'SUBSYSTEM!="block", GOTO="luks_end"'
|
||||
@@ -23,10 +25,20 @@ else
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
||||
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
||||
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
|
||||
printf -- 'RUN+="%s --settled --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
|
||||
if ! crypttab_contains "$luksid"; then
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
||||
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
||||
printf -- 'RUN+="%s --settled --unique --onetime ' $(command -v initqueue)
|
||||
printf -- '--name systemd-cryptsetup-%%k %s start ' $(command -v systemctl)
|
||||
printf -- 'systemd-cryptsetup@luks$$(dev_unit_name -$env{ID_FS_UUID}).service"\n'
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
fi
|
||||
fi
|
||||
|
||||
uuid=$luksid
|
||||
@@ -43,13 +55,13 @@ else
|
||||
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 -- '--unique --settled --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 -- '--unique --settled --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
|
||||
|
@@ -20,8 +20,8 @@ install() {
|
||||
modinfo -k $kernel dm_mod >/dev/null 2>&1 && \
|
||||
inst_hook pre-udev 30 "$moddir/dm-pre-udev.sh"
|
||||
|
||||
dracut_install dmsetup
|
||||
dracut_install -o dmeventd
|
||||
inst_multiple dmsetup
|
||||
inst_multiple -o dmeventd
|
||||
|
||||
inst_libdir_file "libdevmapper-event.so*"
|
||||
|
||||
@@ -29,6 +29,8 @@ install() {
|
||||
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
|
||||
# files, but provides the one below:
|
||||
inst_rules 64-device-mapper.rules
|
||||
# debian udev rules
|
||||
inst_rules 60-persistent-storage-dm.rules 55-dm.rules
|
||||
|
||||
inst_rules "$moddir/11-dm.rules"
|
||||
|
||||
|
@@ -27,8 +27,7 @@ if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
|
||||
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
|
||||
dmraid -ay -i --rm_partitions "$s" 2>&1 | vinfo
|
||||
udevsettle
|
||||
fi
|
||||
done
|
||||
@@ -37,8 +36,7 @@ if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
|
||||
# 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
|
||||
dmraid -ay -i --rm_partitions "$s" 2>&1 | vinfo
|
||||
done
|
||||
fi
|
||||
|
||||
|
@@ -9,8 +9,17 @@ check() {
|
||||
type -P dmraid >/dev/null || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ $fs = *_raid_member ]] && return 0
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
|
||||
|
||||
DEVPATH=$(get_devpath_block "$dev")
|
||||
|
||||
for holder in "$DEVPATH"/holders/*; do
|
||||
[[ -e "$holder" ]] || continue
|
||||
[[ -e "$holder/dm" ]] && return 0
|
||||
break
|
||||
done
|
||||
|
||||
done
|
||||
return 255
|
||||
}
|
||||
@@ -23,42 +32,40 @@ depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
cmdline() {
|
||||
local _activated
|
||||
declare -A _activated
|
||||
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
local holder DEVPATH DM_NAME majmin
|
||||
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
|
||||
|
||||
DEVPATH=$(get_devpath_block "$dev")
|
||||
|
||||
for holder in "$DEVPATH"/holders/*; do
|
||||
[[ -e "$holder" ]] || continue
|
||||
dev="/dev/${holder##*/}"
|
||||
DM_NAME="$(dmsetup info -c --noheadings -o name "$dev" 2>/dev/null)"
|
||||
[[ ${DM_NAME} ]] && break
|
||||
done
|
||||
|
||||
[[ ${DM_NAME} ]] || continue
|
||||
|
||||
if ! [[ ${_activated[${DM_NAME}]} ]]; then
|
||||
printf "%s" " rd.dm.uuid=${DM_NAME}"
|
||||
_activated["${DM_NAME}"]=1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
install() {
|
||||
local _i
|
||||
|
||||
check_dmraid() {
|
||||
local dev=$1 fs=$2 holder DEVPATH DM_NAME
|
||||
[[ "$fs" != *_raid_member ]] && return 1
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90dmraid.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90dmraid.conf"
|
||||
|
||||
DEVPATH=$(udevadm info --query=property --name=$dev \
|
||||
| while read line; do
|
||||
[[ ${line#DEVPATH} = $line ]] && continue
|
||||
eval "$line"
|
||||
echo $DEVPATH
|
||||
break
|
||||
done)
|
||||
for holder in /sys/$DEVPATH/holders/*; do
|
||||
[[ -e $holder ]] || continue
|
||||
DM_NAME=$(udevadm info --query=property --path=$holder \
|
||||
| while read line; do
|
||||
[[ ${line#DM_NAME} = $line ]] && continue
|
||||
eval "$line"
|
||||
echo $DM_NAME
|
||||
break
|
||||
done)
|
||||
done
|
||||
|
||||
[[ ${DM_NAME} ]] || return 1
|
||||
if ! [[ $kernel_only ]]; then
|
||||
echo " rd.dm.uuid=${DM_NAME} " >> "${initdir}/etc/cmdline.d/90dmraid.conf"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
for_each_host_dev_fs check_dmraid
|
||||
|
||||
dracut_install dmraid
|
||||
dracut_install -o kpartx
|
||||
inst_multiple dmraid
|
||||
inst_multiple -o kpartx
|
||||
inst $(command -v partx) /sbin/partx
|
||||
|
||||
inst "$moddir/dmraid.sh" /sbin/dmraid_scan
|
||||
|
@@ -7,12 +7,16 @@ if ! getargbool 1 rd.dm -d -n rd_NO_DM || getarg "rd.dm=0" -d nodmraid; then
|
||||
udevproperty rd_NO_DM=1
|
||||
fi
|
||||
|
||||
if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.imsm -d -n rd_NO_MDIMSM -n noiswmd; then
|
||||
if ! command -v mdadm >/dev/null \
|
||||
|| ! getargbool 1 rd.md.imsm -d -n rd_NO_MDIMSM -n noiswmd \
|
||||
|| ! getargbool 1 rd.md -d -n rd_NO_MD; 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 -n noddfmd; then
|
||||
if ! command -v mdadm >/dev/null \
|
||||
|| ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd \
|
||||
|| ! getargbool 1 rd.md -d -n rd_NO_MD; then
|
||||
info "rd.md.ddf=0: no MD RAID for SNIA ddf raids"
|
||||
udevproperty rd_NO_MDDDF=1
|
||||
fi
|
||||
|
@@ -19,6 +19,9 @@ livedev="$1"
|
||||
# specified as their own things
|
||||
live_dir=$(getarg rd.live.dir -d live_dir)
|
||||
[ -z "$live_dir" ] && live_dir="LiveOS"
|
||||
squash_image=$(getarg rd.live.squashimg)
|
||||
[ -z "$squash_image" ] && squash_image="squashfs.img"
|
||||
|
||||
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=""
|
||||
@@ -31,7 +34,7 @@ if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
|
||||
fi
|
||||
getarg rd.live.check -d check || check=""
|
||||
if [ -n "$check" ]; then
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --hide-splash
|
||||
type plymouth >/dev/null 2>&1 && plymouth --hide-splash
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
p=$(str_replace "$livedev" "-" '\x2d')
|
||||
systemctl start checkisomd5@${p}.service
|
||||
@@ -42,7 +45,7 @@ if [ -n "$check" ]; then
|
||||
die "CD check failed!"
|
||||
exit 1
|
||||
fi
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --show-splash
|
||||
type plymouth >/dev/null 2>&1 && plymouth --show-splash
|
||||
fi
|
||||
|
||||
ln -s $livedev /run/initramfs/livedev
|
||||
@@ -54,7 +57,7 @@ det_img_fs() {
|
||||
}
|
||||
|
||||
modprobe squashfs
|
||||
|
||||
CMDLINE=$(getcmdline)
|
||||
for arg in $CMDLINE; do case $arg in ro|rw) liverw=$arg ;; esac; done
|
||||
# mount the backing of the live image first
|
||||
mkdir -m 0755 -p /run/initramfs/live
|
||||
@@ -180,8 +183,8 @@ if [ -n "$FSIMG" ] ; then
|
||||
fi
|
||||
|
||||
# we might have an embedded fs image on squashfs (compressed live)
|
||||
if [ -e /run/initramfs/live/${live_dir}/squashfs.img ]; then
|
||||
SQUASHED="/run/initramfs/live/${live_dir}/squashfs.img"
|
||||
if [ -e /run/initramfs/live/${live_dir}/${squash_image} ]; then
|
||||
SQUASHED="/run/initramfs/live/${live_dir}/${squash_image}"
|
||||
fi
|
||||
|
||||
if [ -e "$SQUASHED" ] ; then
|
||||
|
38
modules.d/90dmsquash-live/iso-scan.sh
Executable file
38
modules.d/90dmsquash-live/iso-scan.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/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
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
isofile=$1
|
||||
|
||||
[ -z "$isofile" ] && exit 1
|
||||
|
||||
ismounted "/run/initramfs/isoscan" && exit 0
|
||||
|
||||
mkdir -p "/run/initramfs/isoscan"
|
||||
|
||||
do_iso_scan() {
|
||||
local _name
|
||||
local dev
|
||||
for dev in /dev/disk/by-uuid/*; do
|
||||
_name=$(dev_unit_name "$dev")
|
||||
[ -e /tmp/isoscan-${_name} ] && continue
|
||||
> /tmp/isoscan-${_name}
|
||||
mount -t auto -o ro "$dev" "/run/initramfs/isoscan" || continue
|
||||
if [ -f "/run/initramfs/isoscan/$isofile" ]; then
|
||||
losetup -f "/run/initramfs/isoscan/$isofile"
|
||||
rm -f -- "$job"
|
||||
exit 0
|
||||
else
|
||||
umount "/run/initramfs/isoscan"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
do_iso_scan
|
||||
|
||||
rmdir "/run/initramfs/isoscan"
|
||||
exit 1
|
@@ -20,13 +20,15 @@ installkernel() {
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install umount dmsetup blkid dd losetup grep blockdev
|
||||
dracut_install -o checkisomd5
|
||||
inst_multiple umount dmsetup blkid dd losetup grep blockdev
|
||||
inst_multiple -o checkisomd5
|
||||
inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
|
||||
inst_hook cmdline 31 "$moddir/parse-iso-scan.sh"
|
||||
inst_hook pre-udev 30 "$moddir/dmsquash-live-genrules.sh"
|
||||
inst_hook pre-udev 30 "$moddir/dmsquash-liveiso-genrules.sh"
|
||||
inst_hook pre-pivot 20 "$moddir/apply-live-updates.sh"
|
||||
inst_script "$moddir/dmsquash-live-root.sh" "/sbin/dmsquash-live-root"
|
||||
inst_script "$moddir/iso-scan.sh" "/sbin/iso-scan"
|
||||
# should probably just be generally included
|
||||
inst_rules 60-cdrom_id.rules
|
||||
inst_simple "$moddir/checkisomd5@.service" "/etc/systemd/system/checkisomd5@.service"
|
||||
|
@@ -34,6 +34,14 @@ case "$liveroot" in
|
||||
root="${root#live:}"
|
||||
root="live:/dev/disk/by-uuid/${root#UUID=}"
|
||||
rootok=1 ;;
|
||||
live:PARTUUID=*|PARTUUID=*) \
|
||||
root="${root#live:}"
|
||||
root="live:/dev/disk/by-partuuid/${root#PARTUUID=}"
|
||||
rootok=1 ;;
|
||||
live:PARTLABEL=*|PARTLABEL=*) \
|
||||
root="${root#live:}"
|
||||
root="live:/dev/disk/by-partlabel/${root#PARTLABEL=}"
|
||||
rootok=1 ;;
|
||||
live:/*.[Ii][Ss][Oo]|/*.[Ii][Ss][Oo])
|
||||
root="${root#live:}"
|
||||
root="liveiso:${root}"
|
||||
|
11
modules.d/90dmsquash-live/parse-iso-scan.sh
Executable file
11
modules.d/90dmsquash-live/parse-iso-scan.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
|
||||
# live images are specified with
|
||||
# root=live:backingdev
|
||||
|
||||
isofile=$(getarg iso-scan/filename)
|
||||
|
||||
if [ -n "$isofile" ]; then
|
||||
/sbin/initqueue --settled --unique /sbin/iso-scan "$isofile"
|
||||
fi
|
@@ -42,12 +42,13 @@ installkernel() {
|
||||
instmods yenta_socket scsi_dh_rdac scsi_dh_emc \
|
||||
atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech \
|
||||
hid-logitech-dj hid-microsoft firewire-ohci \
|
||||
pcmcia usb_storage
|
||||
pcmcia usb_storage nvme hid-hyperv hv-vmbus
|
||||
|
||||
if [[ "$(uname -p)" == arm* ]]; then
|
||||
# arm specific modules
|
||||
hostonly='' instmods sdhci_esdhc_imx mmci sdhci_tegra mvsdio omap omapdrm \
|
||||
omap_hsmmc sdhci_dove ahci_platform pata_imx sata_mv
|
||||
omap_hsmmc panel-tfp410 sdhci_dove ahci_platform pata_imx sata_mv \
|
||||
ehci-tegra
|
||||
fi
|
||||
|
||||
# install virtual machine support
|
||||
@@ -60,8 +61,7 @@ installkernel() {
|
||||
# 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##|}" \
|
||||
silent_omit_drivers="kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd" \
|
||||
instmods '=fs'
|
||||
fi
|
||||
else
|
||||
@@ -74,8 +74,8 @@ installkernel() {
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install -o /lib/modprobe.d/*.conf
|
||||
[[ $hostonly ]] && dracut_install -o /etc/modprobe.d/*.conf /etc/modprobe.conf
|
||||
inst_multiple -o /lib/modprobe.d/*.conf
|
||||
[[ $hostonly ]] && inst_multiple -o /etc/modprobe.d/*.conf /etc/modprobe.conf
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
|
||||
fi
|
||||
|
@@ -11,7 +11,6 @@ if [ -n "$updates" ]; then
|
||||
# make sure network comes up even if we're doing a local live device
|
||||
if [ -z "$netroot" ]; then
|
||||
echo > /tmp/net.ifaces
|
||||
unset CMDLINE
|
||||
fi
|
||||
echo "$updates" > /tmp/liveupdates.info
|
||||
echo '[ -e /tmp/liveupdates.done ]' > \
|
||||
|
@@ -108,9 +108,9 @@ if [ -n "$LVS" ] ; then
|
||||
info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
|
||||
lvm lvscan --ignorelockingfailure 2>&1 | vinfo
|
||||
if [ -z "$sysinit" ]; then
|
||||
lvm lvchange -ay --ignorelockingfailure $nopoll --ignoremonitoring $LVS 2>&1 | vinfo
|
||||
lvm lvchange --yes -ay --ignorelockingfailure $nopoll --ignoremonitoring $LVS 2>&1 | vinfo
|
||||
else
|
||||
lvm lvchange -ay $sysinit $LVS 2>&1 | vinfo
|
||||
lvm lvchange --yes -ay $sysinit $LVS 2>&1 | vinfo
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -125,7 +125,7 @@ if [ -z "$LVS" -o -n "$VGS" ]; then
|
||||
fi
|
||||
|
||||
if [ "$lvmwritten" ]; then
|
||||
rm -f /etc/lvm/lvm.conf
|
||||
rm -f -- /etc/lvm/lvm.conf
|
||||
fi
|
||||
unset lvmwritten
|
||||
|
||||
|
@@ -3,7 +3,6 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
local _rootdev _activated
|
||||
# No point trying to support lvm if the binaries are missing
|
||||
type -P lvm >/dev/null || return 1
|
||||
|
||||
@@ -23,26 +22,43 @@ depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
get_host_lvs() {
|
||||
local _activated
|
||||
declare -A _activated
|
||||
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[ -e /sys/block/${dev#/dev/}/dm/name ] || continue
|
||||
[ -e /sys/block/${dev#/dev/}/dm/uuid ] || continue
|
||||
uuid=$(</sys/block/${dev#/dev/}/dm/uuid)
|
||||
[[ "${uuid#LVM-}" == "$uuid" ]] && continue
|
||||
dev=$(</sys/block/${dev#/dev/}/dm/name)
|
||||
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
|
||||
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
|
||||
if ! [[ ${_activated[${DM_VG_NAME}/${DM_LV_NAME}]} ]]; then
|
||||
printf "%s\n" "${DM_VG_NAME}/${DM_LV_NAME} "
|
||||
_activated["${DM_VG_NAME}/${DM_LV_NAME}"]=1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
cmdline() {
|
||||
get_host_lvs | while read line; do
|
||||
printf " rd.lvm.lv=$line"
|
||||
done
|
||||
}
|
||||
|
||||
install() {
|
||||
local _i
|
||||
local _i _needthin
|
||||
|
||||
inst lvm
|
||||
|
||||
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)=')
|
||||
[[ "$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
|
||||
if ! [[ $kernel_only ]]; then
|
||||
echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
||||
fi
|
||||
push _activated "${DM_VG_NAME}/${DM_LV_NAME}"
|
||||
get_host_lvs | while read line; do
|
||||
printf "%s" " rd.lvm.lv=$line"
|
||||
if ! [[ $_needthin ]]; then
|
||||
[[ "$(lvs --noheadings -o segtype ${line%%/*} 2>/dev/null)" == *thin* ]] && _needthin=1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
for_each_host_dev_fs check_lvm
|
||||
done >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
||||
|
||||
inst_rules "$moddir/64-lvm.rules"
|
||||
|
||||
@@ -56,14 +72,31 @@ install() {
|
||||
fi
|
||||
fi
|
||||
|
||||
inst_rules 11-dm-lvm.rules
|
||||
if ! [[ -e ${initdir}/etc/lvm/lvm.conf ]]; then
|
||||
mkdir -p "${initdir}/etc/lvm"
|
||||
{
|
||||
echo 'global {'
|
||||
echo 'locking_type = 4'
|
||||
echo 'use_lvmetad = 0'
|
||||
echo '}'
|
||||
} > "${initdir}/etc/lvm/lvm.conf"
|
||||
fi
|
||||
|
||||
inst_rules 11-dm-lvm.rules 69-dm-lvm-metad.rules
|
||||
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
|
||||
# files, but provides the one below:
|
||||
inst_rules 64-device-mapper.rules
|
||||
# debian udev rules
|
||||
inst_rules 56-lvm.rules 60-persistent-storage-lvm.rules
|
||||
|
||||
inst_script "$moddir/lvm_scan.sh" /sbin/lvm_scan
|
||||
inst_hook cmdline 30 "$moddir/parse-lvm.sh"
|
||||
|
||||
inst_libdir_file "libdevmapper-event-lvm*.so"
|
||||
|
||||
if [[ $_needthin ]]; then
|
||||
inst_multiple -o thin_dump thin_restore thin_check thin_repair
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
@@ -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 [ -e /etc/lvm/lvm.conf ] && ! getargbool 1 rd.lvm.conf -d -n rd_NO_LVMCONF; then
|
||||
rm -f /etc/lvm/lvm.conf
|
||||
rm -f -- /etc/lvm/lvm.conf
|
||||
fi
|
||||
|
||||
LV_DEVS="$(getargs rd.lvm.vg -d rd_LVM_VG=) $(getargs rd.lvm.lv -d rd_LVM_LV=)"
|
||||
@@ -10,7 +10,7 @@ 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
|
||||
rm -f -- /etc/udev/rules.d/64-lvm*.rules
|
||||
else
|
||||
for dev in $LV_DEVS; do
|
||||
wait_for_dev "/dev/$dev"
|
||||
|
@@ -20,4 +20,5 @@ IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
|
||||
IMPORT BLKID
|
||||
OPTIONS+="link_priority=100"
|
||||
OPTIONS+="watch"
|
||||
OPTIONS+="db_persist"
|
||||
LABEL="md_end"
|
||||
|
@@ -11,6 +11,4 @@ _do_mdmon_takeover() {
|
||||
|
||||
if command -v mdmon >/dev/null; then
|
||||
_do_mdmon_takeover $1
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
@@ -8,8 +8,17 @@ check() {
|
||||
type -P mdadm >/dev/null || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ "$fs" == *_raid_member ]] && return 0
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
|
||||
|
||||
DEVPATH=$(get_devpath_block "$dev")
|
||||
|
||||
for holder in "$DEVPATH"/holders/*; do
|
||||
[[ -e "$holder" ]] || continue
|
||||
[[ -e "$holder/md" ]] && return 0
|
||||
break
|
||||
done
|
||||
|
||||
done
|
||||
return 255
|
||||
}
|
||||
@@ -26,39 +35,53 @@ installkernel() {
|
||||
instmods =drivers/md
|
||||
}
|
||||
|
||||
cmdline() {
|
||||
local _activated dev line UUID
|
||||
declare -A _activated
|
||||
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
|
||||
|
||||
UUID=$(
|
||||
/sbin/mdadm --examine --export $dev \
|
||||
| while read line; do
|
||||
[[ ${line#MD_UUID=} = $line ]] && continue
|
||||
printf "%s" "${line#MD_UUID=} "
|
||||
done
|
||||
)
|
||||
|
||||
if ! [[ ${_activated[${UUID}]} ]]; then
|
||||
printf "%s" " rd.md.uuid=${UUID}"
|
||||
_activated["${UUID}"]=1
|
||||
fi
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install cat
|
||||
dracut_install -o mdmon
|
||||
local rule rule_path
|
||||
inst_multiple cat
|
||||
inst_multiple -o mdmon
|
||||
inst $(command -v partx) /sbin/partx
|
||||
inst $(command -v mdadm) /sbin/mdadm
|
||||
|
||||
check_mdraid() {
|
||||
local dev=$1 fs=$2 holder DEVPATH MD_UUID
|
||||
[[ "$fs" != *_raid_member ]] && return 1
|
||||
|
||||
MD_UUID=$(/sbin/mdadm --examine --export $dev \
|
||||
| while read line; do
|
||||
[[ ${line#MD_UUID} = $line ]] && continue
|
||||
eval "$line"
|
||||
echo $MD_UUID
|
||||
break
|
||||
done)
|
||||
|
||||
[[ ${MD_UUID} ]] || return 1
|
||||
if ! [[ $kernel_only ]]; then
|
||||
echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
for_each_host_dev_fs check_mdraid
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
||||
|
||||
# <mdadm-3.3 udev rule
|
||||
inst_rules 64-md-raid.rules
|
||||
# >=mdadm-3.3 udev rules
|
||||
inst_rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules
|
||||
# remove incremental assembly from stock rules, so they don't shadow
|
||||
# 65-md-inc*.rules and its fine-grained controls, or cause other problems
|
||||
# when we explicitly don't want certain components to be incrementally
|
||||
# assembled
|
||||
sed -i -r -e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode)"/d' "${initdir}${udevdir}/rules.d/64-md-raid.rules"
|
||||
for rule in 64-md-raid.rules 64-md-raid-assembly.rules; do
|
||||
rule_path="${initdir}${udevdir}/rules.d/${rule}"
|
||||
[ -f "${rule_path}" ] && sed -i -r \
|
||||
-e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode|\$devnode)/d' \
|
||||
"${rule_path}"
|
||||
done
|
||||
|
||||
inst_rules "$moddir/65-md-incremental-imsm.rules"
|
||||
|
||||
@@ -79,6 +102,14 @@ install() {
|
||||
else
|
||||
[ -f /etc/mdadm/mdadm.conf ] && inst /etc/mdadm/mdadm.conf /etc/mdadm.conf
|
||||
fi
|
||||
if [ -d /etc/mdadm.conf.d ]; then
|
||||
local f
|
||||
inst_dir /etc/mdadm.conf.d
|
||||
for f in /etc/mdadm.conf.d/*.conf; do
|
||||
[ -f "$f" ] || continue
|
||||
inst "$f"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh"
|
||||
|
@@ -32,11 +32,11 @@ fi
|
||||
|
||||
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
|
||||
rm -f -- $hookdir/pre-pivot/*mdraid-cleanup.sh
|
||||
fi
|
||||
|
||||
if ! getargbool 1 rd.md.conf -d -n rd_NO_MDADMCONF; then
|
||||
rm -f /etc/mdadm/mdadm.conf /etc/mdadm.conf
|
||||
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
|
||||
|
||||
|
@@ -69,7 +69,7 @@ installkernel() {
|
||||
|
||||
install() {
|
||||
local _f
|
||||
dracut_install -o \
|
||||
inst_multiple -o \
|
||||
dmsetup \
|
||||
kpartx \
|
||||
mpath_wait \
|
||||
@@ -87,7 +87,7 @@ install() {
|
||||
inst_libdir_file "libmultipath*" "multipath/*"
|
||||
|
||||
if dracut_module_included "systemd"; then
|
||||
dracut_install \
|
||||
inst_multiple \
|
||||
$systemdsystemunitdir/multipathd.service
|
||||
mkdir -p "${initdir}${systemdsystemconfdir}/sysinit.target.wants"
|
||||
ln -rfs "${initdir}${systemdsystemunitdir}/multipathd.service" "${initdir}${systemdsystemconfdir}/sysinit.target.wants/multipathd.service"
|
||||
@@ -95,6 +95,9 @@ install() {
|
||||
inst_hook pre-trigger 02 "$moddir/multipathd.sh"
|
||||
inst_hook cleanup 02 "$moddir/multipathd-stop.sh"
|
||||
fi
|
||||
|
||||
inst_hook cleanup 80 "$moddir/multipathd-needshutdown.sh"
|
||||
|
||||
inst_rules 40-multipath.rules 62-multipath.rules 65-multipath.rules 66-kpartx.rules
|
||||
}
|
||||
|
||||
|
9
modules.d/90multipath/multipathd-needshutdown.sh
Executable file
9
modules.d/90multipath/multipathd-needshutdown.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
for i in /dev/mapper/mpath*; do
|
||||
[ -b "$i" ] || continue
|
||||
need_shutdown
|
||||
break
|
||||
done
|
@@ -7,6 +7,6 @@ if [ -e /etc/multipath.conf ]; then
|
||||
multipathd -B || multipathd
|
||||
need_shutdown
|
||||
else
|
||||
rm /etc/udev/rules.d/??-multipath.rules 2>/dev/null
|
||||
rm -- /etc/udev/rules.d/??-multipath.rules 2>/dev/null
|
||||
fi
|
||||
|
||||
|
@@ -14,6 +14,6 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install gpg
|
||||
inst_multiple gpg
|
||||
inst "$moddir/crypt-gpg-lib.sh" "/lib/dracut-crypt-gpg-lib.sh"
|
||||
}
|
||||
|
@@ -8,8 +8,12 @@ depends() {
|
||||
echo crypt
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods loop
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install losetup
|
||||
inst_multiple losetup
|
||||
inst "$moddir/crypt-loop-lib.sh" "/lib/dracut-crypt-loop-lib.sh"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -21,6 +21,6 @@ echo options: $options
|
||||
mount.cifs //$server/$path $NEWROOT -o $options && { [ -e /dev/root ] || ln -s null /dev/root ; }
|
||||
|
||||
# inject new exit_if_exists
|
||||
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/cifs.sh
|
||||
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm -f -- "$job"' > $hookdir/initqueue/cifs.sh
|
||||
# force udevsettle to break
|
||||
> $hookdir/initqueue/work
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user