Compare commits
169 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
225e4b94cb | ||
![]() |
3e676eb12f | ||
![]() |
2257b800ac | ||
![]() |
290df2e1de | ||
![]() |
4be697e5c1 | ||
![]() |
08bdadbf31 | ||
![]() |
734739187b | ||
![]() |
1c4a51c39c | ||
![]() |
0aa2e5f728 | ||
![]() |
5e615f4eb4 | ||
![]() |
9e82732dd4 | ||
![]() |
0454dc247a | ||
![]() |
24f3463bff | ||
![]() |
095e1f37c4 | ||
![]() |
f4334e9bdf | ||
![]() |
838f22259a | ||
![]() |
b3480d31b0 | ||
![]() |
8dd7bb48fc | ||
![]() |
44d1688164 | ||
![]() |
a7d8fc280c | ||
![]() |
e9a84e0a21 | ||
![]() |
d09218823c | ||
![]() |
ae9bc0d72f | ||
![]() |
09ba1b289f | ||
![]() |
9f3c31cd8d | ||
![]() |
eb18a1fe29 | ||
![]() |
789668deb3 | ||
![]() |
e791d753be | ||
![]() |
e0e6d96d69 | ||
![]() |
ee18dd2b88 | ||
![]() |
09132c732a | ||
![]() |
f19063ac71 | ||
![]() |
a17440713a | ||
![]() |
bd03d374b7 | ||
![]() |
06e12e4ba8 | ||
![]() |
f059ce7682 | ||
![]() |
286685cb72 | ||
![]() |
7c62555bcf | ||
![]() |
2699d8ff7e | ||
![]() |
5a8f1aef55 | ||
![]() |
9c034dc326 | ||
![]() |
f8cad00948 | ||
![]() |
c128b969bb | ||
![]() |
f59664a01f | ||
![]() |
67f43d2124 | ||
![]() |
0ae5848245 | ||
![]() |
9f02b291ac | ||
![]() |
2b77ba0b75 | ||
![]() |
6f90be2971 | ||
![]() |
110063c585 | ||
![]() |
51d0a54555 | ||
![]() |
c31a80c9ed | ||
![]() |
79afb279c2 | ||
![]() |
3c8d3a6565 | ||
![]() |
01f9d0d9bf | ||
![]() |
3111988680 | ||
![]() |
1ebbe2eb7b | ||
![]() |
65d16d1914 | ||
![]() |
da5a44cfb7 | ||
![]() |
75b8b144a1 | ||
![]() |
1363167d65 | ||
![]() |
d15c15c8f5 | ||
![]() |
9288d21b9f | ||
![]() |
cafe6675c2 | ||
![]() |
fba4d28433 | ||
![]() |
b7774da97c | ||
![]() |
3c1a083e5c | ||
![]() |
0f294d90b2 | ||
![]() |
a2dbecfcd6 | ||
![]() |
604c09b1da | ||
![]() |
f9c8b3112a | ||
![]() |
bb75d16521 | ||
![]() |
ca8f1c1ba3 | ||
![]() |
94cc856cb8 | ||
![]() |
827a5b1a80 | ||
![]() |
393da0c370 | ||
![]() |
82fe4ea0a5 | ||
![]() |
ffbd37d784 | ||
![]() |
ab94a204e0 | ||
![]() |
6058b06b86 | ||
![]() |
26aea0299a | ||
![]() |
0a80cda0ea | ||
![]() |
6f0500ed4a | ||
![]() |
746135dd1e | ||
![]() |
a762dedb60 | ||
![]() |
a0c915b1e4 | ||
![]() |
99df3d22be | ||
![]() |
be98291caf | ||
![]() |
33782aebbf | ||
![]() |
55a12055c5 | ||
![]() |
25111d717e | ||
![]() |
819ea38651 | ||
![]() |
143420bc05 | ||
![]() |
986b12d391 | ||
![]() |
f81c864eed | ||
![]() |
aac3a0652a | ||
![]() |
a0eadcdc64 | ||
![]() |
e331e06a39 | ||
![]() |
7047294617 | ||
![]() |
1caaeaae1e | ||
![]() |
d63a4e285e | ||
![]() |
9a9c67d61b | ||
![]() |
bc01f822de | ||
![]() |
f265cb67dc | ||
![]() |
f98d3066d9 | ||
![]() |
9d1b81c0d1 | ||
![]() |
e3fb645821 | ||
![]() |
8f77326479 | ||
![]() |
ca77afdeb3 | ||
![]() |
35e86ac117 | ||
![]() |
058ff2f06d | ||
![]() |
efecf0a95e | ||
![]() |
c574c3f565 | ||
![]() |
61ac90fefa | ||
![]() |
432647c278 | ||
![]() |
a695250ec7 | ||
![]() |
6ccb58a5b6 | ||
![]() |
7d0848957c | ||
![]() |
6b7ffedf0d | ||
![]() |
b31f3fe0d1 | ||
![]() |
c1688560ad | ||
![]() |
4cdee66c8e | ||
![]() |
e0ec6f10d4 | ||
![]() |
f4947f8793 | ||
![]() |
ba26c59523 | ||
![]() |
cec0d04112 | ||
![]() |
f4d34357c0 | ||
![]() |
eed91294f8 | ||
![]() |
a73ba9a8ef | ||
![]() |
4f55387829 | ||
![]() |
bca1967c90 | ||
![]() |
d00cfc2a7b | ||
![]() |
e0758c8168 | ||
![]() |
1b72c97cc5 | ||
![]() |
c1c78f8a91 | ||
![]() |
935dd5746a | ||
![]() |
67354eebbc | ||
![]() |
f6e777ec4b | ||
![]() |
df6bb5e959 | ||
![]() |
08e11e30e3 | ||
![]() |
731b37e929 | ||
![]() |
8ad3215590 | ||
![]() |
b2a024991f | ||
![]() |
bfa4e45fa7 | ||
![]() |
c9b5165daa | ||
![]() |
740e41b843 | ||
![]() |
3161dea8e1 | ||
![]() |
cae0004dbe | ||
![]() |
3c8a69677b | ||
![]() |
c4f8329cc2 | ||
![]() |
654484b82b | ||
![]() |
ccaf52901f | ||
![]() |
384eeedd2d | ||
![]() |
65cfabf7a6 | ||
![]() |
2b5192c18d | ||
![]() |
fe6c7e0f06 | ||
![]() |
3c3b2cf093 | ||
![]() |
1f50d5b86d | ||
![]() |
0bb9a683d4 | ||
![]() |
d23f32dd4b | ||
![]() |
ebfd53e1d9 | ||
![]() |
f8c24964cd | ||
![]() |
f8e0c7cc62 | ||
![]() |
3aa37cafde | ||
![]() |
b39b8452d2 | ||
![]() |
48723f28aa | ||
![]() |
3ed33db54a | ||
![]() |
0a68b6a518 | ||
![]() |
7b3f374a82 |
47
.travis.yml
Normal file
47
.travis.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
language: generic
|
||||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
env:
|
||||
matrix:
|
||||
- IMAGE=latest
|
||||
- IMAGE=latest TESTS=01
|
||||
- IMAGE=latest TESTS=12
|
||||
- IMAGE=latest TESTS=20
|
||||
- IMAGE=latest TESTS=50
|
||||
- IMAGE=latest TESTS=30
|
||||
- IMAGE=latest TESTS=31
|
||||
- IMAGE=latest TESTS=70
|
||||
- IMAGE=latest TESTS=99
|
||||
- IMAGE=latest TESTS=02
|
||||
- IMAGE=latest TESTS=03
|
||||
- IMAGE=latest TESTS=04
|
||||
- IMAGE=latest TESTS=10
|
||||
- IMAGE=latest TESTS=11
|
||||
- IMAGE=latest TESTS=13
|
||||
- IMAGE=latest TESTS=14
|
||||
- IMAGE=latest TESTS=15
|
||||
- IMAGE=latest TESTS=17
|
||||
|
||||
before_script:
|
||||
- docker pull fedora:$IMAGE
|
||||
- |
|
||||
sudo modprobe kvm-intel nested=1 || :
|
||||
sudo modprobe kvm-amd nested=1 || :
|
||||
dmesg | tail || :
|
||||
- git pull --depth=100
|
||||
- |
|
||||
git describe --abbrev=0 --tags || :
|
||||
git describe --tags || :
|
||||
|
||||
script:
|
||||
- docker run --privileged -it -v $(pwd)/:/dracut fedora:$IMAGE /dracut/fedora-test.sh $IMAGE-$$ "$TESTS"
|
||||
|
||||
notifications:
|
||||
webhooks:
|
||||
urls:
|
||||
- https://webhooks.gitter.im/e/effa917ca3e0ed5fd00e
|
||||
on_success: change # options: [always|never|change] default: always
|
||||
on_failure: always # options: [always|never|change] default: always
|
||||
on_start: never # options: [always|never|change] default: always
|
||||
|
@@ -11,6 +11,13 @@ if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ -d "$BOOT_DIR_ABS" ]]; then
|
||||
INITRD="initrd"
|
||||
else
|
||||
BOOT_DIR_ABS="/boot"
|
||||
INITRD="initramfs-${KERNEL_VERSION}.img"
|
||||
fi
|
||||
|
||||
ret=0
|
||||
case "$COMMAND" in
|
||||
add)
|
||||
@@ -18,9 +25,9 @@ case "$COMMAND" in
|
||||
if [[ -f ${INITRD_IMAGE_PREGENERATED} ]]; then
|
||||
# we found an initrd at the same place as the kernel
|
||||
# use this and don't generate a new one
|
||||
cp --reflink=auto "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/initrd" \
|
||||
&& chown root:root "$BOOT_DIR_ABS/initrd" \
|
||||
&& chmod 0600 "$BOOT_DIR_ABS/initrd" \
|
||||
cp --reflink=auto "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/$INITRD" \
|
||||
&& chown root:root "$BOOT_DIR_ABS/$INITRD" \
|
||||
&& chmod 0600 "$BOOT_DIR_ABS/$INITRD" \
|
||||
&& exit 0
|
||||
fi
|
||||
|
||||
@@ -42,11 +49,11 @@ case "$COMMAND" in
|
||||
break
|
||||
fi
|
||||
done
|
||||
dracut ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS"/initrd "$KERNEL_VERSION"
|
||||
dracut ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
|
||||
ret=$?
|
||||
;;
|
||||
remove)
|
||||
rm -f -- "$BOOT_DIR_ABS"/initrd
|
||||
rm -f -- "$BOOT_DIR_ABS/$INITRD"
|
||||
ret=$?
|
||||
;;
|
||||
esac
|
||||
|
@@ -63,15 +63,26 @@ if ! [[ ${BOOT_OPTIONS[*]} ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BOOT_DIR="/${MACHINE_ID}/0-rescue"
|
||||
BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}
|
||||
LOADER_ENTRY="$BOOT_ROOT/loader/entries/${MACHINE_ID}-0-rescue.conf"
|
||||
if [[ -d "${BOOT_DIR_ABS%/*}" ]]; then
|
||||
BOOT_DIR="/${MACHINE_ID}/0-rescue"
|
||||
BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}
|
||||
LOADER_ENTRY="$BOOT_ROOT/loader/entries/${MACHINE_ID}-0-rescue.conf"
|
||||
KERNEL="linux"
|
||||
INITRD="initrd"
|
||||
else
|
||||
BLS_DIR="/boot/loader/entries"
|
||||
BOOT_DIR_ABS="/boot"
|
||||
LOADER_ENTRY="$BLS_DIR/${MACHINE_ID}-0-rescue.conf"
|
||||
KERNEL="vmlinuz-0-rescue-${MACHINE_ID}"
|
||||
INITRD="initramfs-0-rescue-${MACHINE_ID}.img"
|
||||
fi
|
||||
|
||||
ret=0
|
||||
|
||||
case "$COMMAND" in
|
||||
add)
|
||||
[[ -f "$LOADER_ENTRY" ]] && exit 0
|
||||
[[ -f "$LOADER_ENTRY" ]] && [[ -f "$BOOT_DIR_ABS/$KERNEL" ]] \
|
||||
&& [[ -f "$BOOT_DIR_ABS/$INITRD" ]] && exit 0
|
||||
|
||||
# source our config dir
|
||||
for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do
|
||||
@@ -82,21 +93,29 @@ case "$COMMAND" in
|
||||
|
||||
[[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS"
|
||||
|
||||
if ! cp --reflink=auto "$KERNEL_IMAGE" "$BOOT_DIR_ABS"/linux; then
|
||||
echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/linux'!" >&2
|
||||
if ! cp --reflink=auto "$KERNEL_IMAGE" "$BOOT_DIR_ABS/$KERNEL"; then
|
||||
echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/$KERNEL'!" >&2
|
||||
fi
|
||||
|
||||
dracut --no-hostonly -a "rescue" "$BOOT_DIR_ABS"/initrd "$KERNEL_VERSION"
|
||||
((ret+=$?))
|
||||
if [[ ! -f "$BOOT_DIR_ABS/$INITRD" ]]; then
|
||||
dracut --no-hostonly -a "rescue" "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
|
||||
((ret+=$?))
|
||||
fi
|
||||
|
||||
if [[ "${BOOT_DIR_ABS}" != "/boot" ]]; then
|
||||
{
|
||||
echo "title $PRETTY_NAME - Rescue Image"
|
||||
echo "version $KERNEL_VERSION"
|
||||
echo "machine-id $MACHINE_ID"
|
||||
echo "options ${BOOT_OPTIONS[@]} rd.auto=1"
|
||||
echo "linux $BOOT_DIR/linux"
|
||||
echo "initrd $BOOT_DIR/initrd"
|
||||
} > $LOADER_ENTRY
|
||||
else
|
||||
cp -aT "${KERNEL_IMAGE%/*}/bls.conf" $LOADER_ENTRY
|
||||
sed -i 's/'$KERNEL_VERSION'/0-rescue-'${MACHINE_ID}'/' $LOADER_ENTRY
|
||||
fi
|
||||
|
||||
{
|
||||
echo "title $PRETTY_NAME - Rescue Image"
|
||||
echo "version $KERNEL_VERSION"
|
||||
echo "machine-id $MACHINE_ID"
|
||||
echo "options ${BOOT_OPTIONS[@]} rd.auto=1"
|
||||
echo "linux $BOOT_DIR/linux"
|
||||
echo "initrd $BOOT_DIR/initrd"
|
||||
} > $LOADER_ENTRY
|
||||
((ret+=$?))
|
||||
;;
|
||||
|
||||
@@ -109,6 +128,4 @@ case "$COMMAND" in
|
||||
ret=1;;
|
||||
esac
|
||||
|
||||
((ret+=$?))
|
||||
|
||||
exit $ret
|
||||
|
44
AUTHORS
44
AUTHORS
@@ -10,24 +10,26 @@ Jeremy Katz <katzj@redhat.com>
|
||||
David Dillow <dave@thedillows.org>
|
||||
Michal Soltys <soltys@ziu.info>
|
||||
Colin Guthrie <colin@mageia.org>
|
||||
Daniel Molkentin <dmolkentin@suse.com>
|
||||
Amerigo Wang <amwang@redhat.com>
|
||||
Thomas Renninger <trenn@suse.com>
|
||||
Daniel Molkentin <dmolkentin@suse.com>
|
||||
WANG Chao <chaowang@redhat.com>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Alexander Tsoy <alexander@tsoy.me>
|
||||
Lukas Nykryn <lnykryn@redhat.com>
|
||||
Alexander Tsoy <alexander@tsoy.me>
|
||||
Frederick Grose <fgrose@sugarlabs.org>
|
||||
WANG Chao <chaowang@redhat.com>
|
||||
Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Frederick Grose <fgrose@sugarlabs.org>
|
||||
Peter Robinson <pbrobinson@fedoraproject.org>
|
||||
Fabian Vogt <fvogt@suse.com>
|
||||
Kairui Song <kasong@redhat.com>
|
||||
John Reiser <jreiser@bitwagon.com>
|
||||
Luca Berra <bluca@vodka.it>
|
||||
Xunlei Pang <xlpang@redhat.com>
|
||||
Daniel Drake <drake@endlessm.com>
|
||||
Lubomir Rintel <lkundrak@v3.sk>
|
||||
Angelo "pallotron" Failla <pallotron@fb.com>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
Ville Skyttä <ville.skytta@iki.fi>
|
||||
@@ -35,15 +37,17 @@ Cristian Rodríguez <crrodriguez@opensuse.org>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
Baoquan He <bhe@redhat.com>
|
||||
Brendan Germain <brendan.germain@nasdaqomx.com>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Leho Kraav <leho@kraav.com>
|
||||
Moritz Maxeiner <moritz@ucworks.org>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Nicolas Chauvet <kwizart@gmail.com>
|
||||
Ondrej Mosnacek <omosnace@redhat.com>
|
||||
Fabian Deutsch <fabiand@fedoraproject.org>
|
||||
Javier Martinez Canillas <javierm@redhat.com>
|
||||
Kamil Rytarowski <n54@gmx.com>
|
||||
Lidong Zhong <lidong.zhong@suse.com>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
NeilBrown <neilb@suse.de>
|
||||
Nicolas Chauvet <kwizart@gmail.com>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Radek Vykydal <rvykydal@redhat.com>
|
||||
Thorsten Behrens <tbehrens@suse.com>
|
||||
@@ -52,10 +56,12 @@ Frederic Crozat <fcrozat@suse.com>
|
||||
James Lee <jlee@thestaticvoid.com>
|
||||
Jesse Keating <jkeating@redhat.com>
|
||||
Martin Wilck <mwilck@suse.de>
|
||||
Mike Gilbert <floppym@gentoo.org>
|
||||
Milan Broz <mbroz@redhat.com>
|
||||
Mimi Zohar <zohar@linux.vnet.ibm.com>
|
||||
Roberto Sassu <roberto.sassu@polito.it>
|
||||
Stefan Reimer <it@startux.de>
|
||||
Adam Williamson <awilliam@redhat.com>
|
||||
Anton Blanchard <anton@samba.org>
|
||||
Bill Nottingham <notting@redhat.com>
|
||||
Chapman Flack <g2@anastigmatix.net>
|
||||
@@ -66,10 +72,10 @@ Jan Synacek <jsynacek@redhat.com>
|
||||
Jon Ander Hernandez <jonan.h@gmail.com>
|
||||
Juan RP <xtraeme@gmail.com>
|
||||
Lance Albertson <lance@osuosl.org>
|
||||
Marcos Mello <marcosfrm@gmail.com>
|
||||
Marian Ganisin <mganisin@redhat.com>
|
||||
Matthias Gerstner <matthias.gerstner@suse.de>
|
||||
Michael Ploujnikov <plouj@somanetworks.com>
|
||||
Mike Gilbert <floppym@gentoo.org>
|
||||
Pratyush Anand <panand@redhat.com>
|
||||
Silvio Fricke <silvio.fricke@gmail.com>
|
||||
Steven Brudenell <steven.brudenell@gmail.com>
|
||||
@@ -77,7 +83,7 @@ Stig Telfer <stelfer@cray.com>
|
||||
Thomas Backlund <tmb@mageia.org>
|
||||
Vasiliy Tolstov <v.tolstov@selfip.ru>
|
||||
Wim Muskee <wimmuskee@gmail.com>
|
||||
Adam Williamson <awilliam@redhat.com>
|
||||
tpgxyz <tpgxyz@gmail.com>
|
||||
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
||||
Alan Pevec <apevec@redhat.com>
|
||||
Alex Harpin <development@landsofshadow.co.uk>
|
||||
@@ -100,27 +106,28 @@ Julian Wolf <juwolf@suse.com>
|
||||
Koen Kooi <koen@dominion.thruhere.net>
|
||||
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Kyle McMartin <kmcmarti@redhat.com>
|
||||
Lubomir Rintel <lkundrak@v3.sk>
|
||||
Lukas Wunner <lukas@wunner.de>
|
||||
Mike Snitzer <snitzer@redhat.com>
|
||||
Minfei Huang <mhuang@redhat.com>
|
||||
Nikoli <nikoli@gmx.us>
|
||||
Pingfan Liu <piliu@redhat.com>
|
||||
Przemysław Rudy <prudy1@o2.pl>
|
||||
Robert LeBlanc <robert@leblancnet.us>
|
||||
Robert Scheck <robert@fedoraproject.org>
|
||||
Stefan Berger <stefanb@us.ibm.com>
|
||||
Thomas Lange <lange@informatik.uni-koeln.de>
|
||||
Till Maas <opensource@till.name>
|
||||
Tony Asleson <tasleson@redhat.com>
|
||||
Vivek Goyal <vgoyal@redhat.com>
|
||||
Vladislav Bogdanov <bubble@hoster-ok.com>
|
||||
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
|
||||
tpgxyz <tpgxyz@gmail.com>
|
||||
Alexander Kurtz <alexander@kurtz.be>
|
||||
Alexander Todorov <atodorov@redhat.com>
|
||||
Andreas Stieger <astieger@suse.com>
|
||||
Andy Lutomirski <luto@mit.edu>
|
||||
Anssi Hannula <anssi@mageia.org>
|
||||
Artem Savkov <asavkov@redhat.com>
|
||||
B. Wilson <x@wilsonb.com>
|
||||
Brandon Philips <brandon@ifup.co>
|
||||
Bryn M. Reeves <bmr@redhat.com>
|
||||
Canek Peláez Valdés <caneko@gmail.com>
|
||||
@@ -136,18 +143,23 @@ Dennis Schridde <devurandom@gmx.net>
|
||||
Derek Higgins <derekh@redhat.com>
|
||||
Duane Griffin <duaneg@dghda.com>
|
||||
Elan Ruusamäe <glen@delfi.ee>
|
||||
Enno Boland <g@s01.de>
|
||||
Eugene Syromiatnikov <esyr@redhat.com>
|
||||
Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
|
||||
Florian Gamböck <mail@floga.de>
|
||||
François Cami <fcami@fedoraproject.org>
|
||||
Gerd von Egidy <gerd.von.egidy@intra2net.com>
|
||||
Glen Gray <slaine@slaine.org>
|
||||
HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
|
||||
Hendrik Brueckner <brueckner@linux.ibm.com>
|
||||
Hermann Gausterer <git-dracut-2012@mrq1.org>
|
||||
Hiroaki Mizuguchi <hiroaki-m@iij.ad.jp>
|
||||
Hui Wang <john.wanghui@huawei.com>
|
||||
Ignaz Forster <iforster@suse.com>
|
||||
James Laska <jlaska@redhat.com>
|
||||
Jan Stodola <jstodola@redhat.com>
|
||||
Jason Dana <jasondana@quarksecurity.com>
|
||||
Javier Martinez Canillas <javierm@redhat.com>
|
||||
Jeremy Linton <lintonrjeremy@gmail.com>
|
||||
Jiri Pirko <jiri@resnulli.us>
|
||||
Joe Lawrence <Joe.Lawrence@stratus.com>
|
||||
Johannes Thumshirn <jthumshirn@suse.com>
|
||||
@@ -165,23 +177,25 @@ Matt Smith <shadowfax@gmx.com>
|
||||
Matthew Thode <mthode@mthode.org>
|
||||
Mei Liu <liumbj@linux.vnet.ibm.com>
|
||||
Michael Chapman <mike@very.puzzling.org>
|
||||
Michael McCracken <michael.mccracken@gmail.com>
|
||||
Michal Koutný <mkoutny@suse.com>
|
||||
Michal Schmidt <mschmidt@redhat.com>
|
||||
Michal Sekletar <msekleta@redhat.com>
|
||||
Mike Gorse <mgorse@suse.com>
|
||||
Moritz 'Morty' Strübe <morty@gmx.net>
|
||||
Munehiro Matsuda <haro@kgt.co.jp>
|
||||
Nicolas Porcel <nicolasporcel06@gmail.com>
|
||||
Olivier Blin <dev@blino.org>
|
||||
P J P <ppandit@redhat.com>
|
||||
Paolo Bonzini <pbonzini@redhat.com>
|
||||
Pavel Zhukov <pzhukov@redhat.com>
|
||||
Pawel Wieczorkiewicz <pwieczorkiewicz@suse.de>
|
||||
Pekka Wallendahl <wyrmiyu@gmail.com>
|
||||
Pingfan Liu <piliu@redhat.com>
|
||||
Prarit Bhargava <prarit@redhat.com>
|
||||
Praveen_Paladugu@Dell.com <Praveen_Paladugu@Dell.com>
|
||||
Pádraig Brady <P@draigBrady.com>
|
||||
Quentin Armitage <quentin@armitage.org.uk>
|
||||
Renaud Métrich <rmetrich@redhat.com>
|
||||
Robert Buchholz <rbu@goodpoint.de>
|
||||
Ruben Kerkhof <ruben@rubenkerkhof.com>
|
||||
Rusty Bird <rustybird@openmailbox.org>
|
||||
@@ -189,9 +203,11 @@ Sergey Fionov <fionov@gmail.com>
|
||||
Shawn W Dunn <sfalken@opensuse.org>
|
||||
Srinivasa T N <seenutn@linux.vnet.ibm.com>
|
||||
Stijn Hoop <stijn@sandcat.nl>
|
||||
Sullivan (CTR), Austin <austin.sullivan.ctr@progeny.net>
|
||||
Thilo Bangert <thilo.bangert@gmx.net>
|
||||
Thomas Blume <thomas.blume@suse.com>
|
||||
Tobias Geerinckx <tobias.geerinckx@gmail.com>
|
||||
Tobias Klauser <tklauser@distanz.ch>
|
||||
Tom Gundersen <teg@jklm.no>
|
||||
Tomasz Paweł Gajc <tpgxyz@gmail.com>
|
||||
Tomasz Torcz <tomek@pipebreaker.pl>
|
||||
|
7
Makefile
7
Makefile
@@ -1,7 +1,7 @@
|
||||
-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); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
|
||||
VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags --always 2>/dev/null || echo $(DRACUT_VERSION))
|
||||
GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags --always 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
|
||||
|
||||
-include Makefile.inc
|
||||
|
||||
@@ -63,6 +63,9 @@ install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h ins
|
||||
install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
|
||||
$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(KMOD_LIBS)
|
||||
|
||||
logtee: logtee.c
|
||||
$(CC) $(LDFLAGS) -o $@ $<
|
||||
|
||||
dracut-install: install/dracut-install
|
||||
ln -fs $< $@
|
||||
|
||||
|
134
NEWS
134
NEWS
@@ -1,3 +1,137 @@
|
||||
dracut-049
|
||||
==========
|
||||
lsinitrd:
|
||||
- record loaded kernel modules when hostonly mode is enabled
|
||||
lsinitrd $image -f */lib/dracut/loaded-kernel-modules.txt
|
||||
- allow to only unpack certain files
|
||||
|
||||
kernel-modules:
|
||||
- add gpio and pinctrl drivers for arm*/aarch64
|
||||
- add nfit
|
||||
|
||||
kernel-network-modules:
|
||||
- add vlan kernel modules
|
||||
|
||||
ifcfg/write-ifcfg.sh:
|
||||
- aggregate resolv.conf
|
||||
|
||||
livenet:
|
||||
- Enable OverlayFS overlay in sysroot.mount generator.
|
||||
|
||||
dmsquash-live:
|
||||
- Support a flattened squashfs.img
|
||||
|
||||
dracut-systemd:
|
||||
- Start systemd-vconsole-setup before dracut-cmdline-ask
|
||||
|
||||
iscsi:
|
||||
- do not install all of /etc/iscsi unless hostonly
|
||||
- start iscsid even w/o systemd
|
||||
|
||||
multipath:
|
||||
- fixed shutdown
|
||||
|
||||
network:
|
||||
- configure NetworkManager to use dhclient
|
||||
|
||||
mdraid:
|
||||
- fixed uuid handling ":" versus "-"
|
||||
|
||||
stratis:
|
||||
- Add additional binaries
|
||||
|
||||
new modules:
|
||||
- 00warpclock
|
||||
- 99squash
|
||||
Adds support for building a squashed initramfs
|
||||
- 35network-legacy
|
||||
the old 40network
|
||||
- 35network-manager
|
||||
alternative to 35network-legacy
|
||||
- 90kernel-modules-extra
|
||||
adds out-of-tree kernel modules
|
||||
|
||||
testsuite:
|
||||
- now runs on travis
|
||||
- support new qemu device options
|
||||
- even runs without kvm now
|
||||
|
||||
dracut-048
|
||||
==========
|
||||
|
||||
dracut.sh:
|
||||
- fixed finding of btrfs devices
|
||||
- harden dracut against BASH_ENV environment variable
|
||||
- no more prelinking
|
||||
- scan and install "external" kernel modules
|
||||
- fixed instmods with zero input
|
||||
- rdsosreport: best effort to strip out passwords
|
||||
- introduce tri-state hostonly mode
|
||||
|
||||
Add a new option --hostonly-mode which accept an <mode> parameter, so we have a tri-state hostonly mode:
|
||||
|
||||
* generic: by passing "--no-hostonly" or not passing anything.
|
||||
"--hostonly-mode" has no effect in such case.
|
||||
* sloppy: by passing "--hostonly --hostonly-mode sloppy". This
|
||||
is also the default mode when only "--hostonly" is given.
|
||||
* strict: by passing "--hostonly --hostonly-mode strict".
|
||||
|
||||
Sloppy mode is the original hostonly mode, the new introduced strict
|
||||
mode will allow modules to ignore more drivers or do some extra job to
|
||||
save memory and disk space, while making the image less portable.
|
||||
|
||||
Also introduced a helper function "optional_hostonly" to make it
|
||||
easier for modules to leverage new hostonly mode.
|
||||
|
||||
To force install modules only in sloppy hostonly mode, use the form:
|
||||
|
||||
hostonly="$(optional_hostonly)" instmods <modules>
|
||||
|
||||
dracut-install:
|
||||
- don't error out, if no modules were installed
|
||||
- support modules.softdep
|
||||
|
||||
lsinitrd.sh:
|
||||
- fixed zstd file signature
|
||||
|
||||
kernel:
|
||||
- include all pci/host modules
|
||||
- add mmc/core for arm
|
||||
- Include Intel Volume Management Device support
|
||||
|
||||
plymouth:
|
||||
- fix detection of plymouth directory
|
||||
|
||||
drm:
|
||||
- make failing installation of drm modules nonfatal
|
||||
- include virtio DRM drivers in hostonly initramfs
|
||||
|
||||
stratis:
|
||||
- initial Stratis support
|
||||
|
||||
crypt:
|
||||
- correct s390 arch to include arch-specific crypto modules
|
||||
- add cmdline rd.luks.partuuid
|
||||
- add timeout option rd.luks.timeout
|
||||
|
||||
shutdown:
|
||||
- sleep a little, if a process was killed
|
||||
|
||||
network:
|
||||
- introduce ip=either6 option
|
||||
|
||||
iscsi:
|
||||
- replace iscsistart with iscsid
|
||||
|
||||
qeth_rules:
|
||||
- new module to copy qeth rules
|
||||
|
||||
multipath-hostonly:
|
||||
- merged back into multipath
|
||||
|
||||
mdraid:
|
||||
- fixed case if rd.md.uuid is in ID_FS_UUID format
|
||||
|
||||
dracut-047
|
||||
==========
|
||||
dracut.sh:
|
||||
|
@@ -2,6 +2,10 @@
|
||||
|
||||
dracut is an initramfs infrastructure.
|
||||
|
||||
## Travis
|
||||
|
||||
[](https://travis-ci.org/dracutdevs/dracut)
|
||||
|
||||
## CentOS CI
|
||||
|
||||
[](https://ci.centos.org/job/dracut-push-master/)
|
||||
|
@@ -31,9 +31,7 @@ _dracut() {
|
||||
--local --hostonly --no-hostonly --fstab --help --bzip2 --lzma
|
||||
--xz --zstd --no-compress --gzip --list-modules --show-modules --keep
|
||||
--printsize --regenerate-all --noimageifnotneeded --early-microcode
|
||||
--no-early-microcode --print-cmdline --prelink --noprelink --reproducible
|
||||
--uefi
|
||||
'
|
||||
--no-early-microcode --print-cmdline --reproducible --uefi'
|
||||
|
||||
[ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers
|
||||
--omit-drivers --modules --omit --drivers --filesystems --install
|
||||
|
@@ -676,6 +676,17 @@ get_ucode_file ()
|
||||
fi
|
||||
}
|
||||
|
||||
# Get currently loaded modules
|
||||
# sorted, and delimited by newline
|
||||
get_loaded_kernel_modules ()
|
||||
{
|
||||
local modules=( )
|
||||
while read _module _size _used _used_by; do
|
||||
modules+=( "$_module" )
|
||||
done <<< "$(lsmod | sed -n '1!p')"
|
||||
printf '%s\n' "${modules[@]}" | sort
|
||||
}
|
||||
|
||||
# Not every device in /dev/mapper should be examined.
|
||||
# If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
|
||||
lvm_internal_dev() {
|
||||
|
@@ -267,6 +267,18 @@ inst_fsck_help() {
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper || :
|
||||
}
|
||||
|
||||
# Use with form hostonly="$(optional_hostonly)" inst_xxxx <args>
|
||||
# If hosotnly mode is set to "strict", hostonly restrictions will still
|
||||
# be applied, else will ignore hostonly mode and try to install all
|
||||
# given modules.
|
||||
optional_hostonly() {
|
||||
if [[ $hostonly_mode = "strict" ]]; then
|
||||
printf -- "$hostonly"
|
||||
else
|
||||
printf ""
|
||||
fi
|
||||
}
|
||||
|
||||
mark_hostonly() {
|
||||
for i in "$@"; do
|
||||
echo "$i" >> "$initdir/lib/dracut/hostonly-files"
|
||||
@@ -942,7 +954,7 @@ for_each_kmod_dep() {
|
||||
|
||||
dracut_kernel_post() {
|
||||
for _f in modules.builtin.bin modules.builtin modules.order; do
|
||||
[[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
|
||||
[[ -e $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
|
||||
done
|
||||
|
||||
# generate module dependencies for the initrd
|
||||
@@ -981,6 +993,10 @@ instmods() {
|
||||
set -- "${args[@]}"
|
||||
fi
|
||||
|
||||
if (($# == 0)); then
|
||||
return 0
|
||||
fi
|
||||
|
||||
$DRACUT_INSTALL \
|
||||
${initdir:+-D "$initdir"} \
|
||||
${loginstall:+-L "$loginstall"} \
|
||||
|
@@ -243,12 +243,6 @@ 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)
|
||||
|
||||
|
@@ -311,6 +311,11 @@ crypto LUKS
|
||||
**rd.luks.crypttab=0**::
|
||||
do not check, if LUKS partition is in _/etc/crypttab_
|
||||
|
||||
**rd.luks.timeout=**__<seconds>__::
|
||||
specify how long dracut should wait when waiting for the user to enter the
|
||||
password. This avoid blocking the boot if no password is entered. It does
|
||||
not apply to luks key. The default is '0', which means 'forever'.
|
||||
|
||||
crypto LUKS - key on removable device support
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
**rd.luks.key=**__<keypath>__:__<keydev>__:__<luksdev>__::
|
||||
@@ -480,7 +485,7 @@ USB Android phone::
|
||||
* enp0s29u1u2
|
||||
=====================
|
||||
|
||||
**ip=**__{dhcp|on|any|dhcp6|auto6}__::
|
||||
**ip=**__{dhcp|on|any|dhcp6|auto6|either6}__::
|
||||
dhcp|on|any::: get ip from dhcp server from all interfaces. If root=dhcp,
|
||||
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
|
||||
with a valid DHCP root-path.
|
||||
@@ -489,6 +494,8 @@ USB Android phone::
|
||||
|
||||
dhcp6::: IPv6 DHCP
|
||||
|
||||
either6::: if auto6 fails, then dhcp6
|
||||
|
||||
**ip=**__<interface>__:__{dhcp|on|any|dhcp6|auto6}__[:[__<mtu>__][:__<macaddr>__]]::
|
||||
This parameter can be specified multiple times.
|
||||
+
|
||||
@@ -594,7 +601,7 @@ NFS
|
||||
mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given, use
|
||||
dhcp next_server. If server-ip is an IPv6 address it has to be put in
|
||||
brackets, e.g. [2001:DB8::1]. NFS options can be appended with the prefix
|
||||
":" or "," and are seperated by ",".
|
||||
":" or "," and are separated by ",".
|
||||
|
||||
**root=**nfs:\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__], **root=**nfs4:\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__], **root=**__{dhcp|dhcp6}__::
|
||||
root=dhcp alone directs initrd to look at the DHCP root-path where NFS
|
||||
@@ -727,6 +734,9 @@ You may want to use rd.iscsi.firmware.
|
||||
**root=**_???_ **netroot=**iscsi **rd.iscsi.firmware=1**::
|
||||
will read the iscsi parameter from the BIOS firmware
|
||||
|
||||
**rd.iscsi.login_retry_max=**__<num>__::
|
||||
maximum number of login retries
|
||||
|
||||
**rd.iscsi.param=**__<param>__::
|
||||
<param> will be passed as "--param <param>" to iscsistart.
|
||||
This parameter can be specified multiple times.
|
||||
@@ -828,23 +838,24 @@ Booting live images
|
||||
Dracut offers multiple options for live booted images:
|
||||
|
||||
=====================
|
||||
SquashFS with read-only filesystem image::: The system will boot with a read
|
||||
only filesystem from the SquashFS and apply a writable device-mapper snapshot
|
||||
over the read only filesystem. Using this method ensures a relatively fast
|
||||
boot and lower RAM usage. Users **must be careful** to avoid writing too many
|
||||
blocks to the snapshot volume. Once the blocks of the snapshot overlay are
|
||||
exhausted, the root filesystem becomes read only and may cause application
|
||||
failures. The overlay file is marked 'Overflow', and a difficult recovery is
|
||||
required to repair and enlarge the overlay offline. Non-persistent overlays
|
||||
are sparse files in RAM that only consume content space as required blocks are
|
||||
allocated. They default to an apparent size of 32 GiB in RAM. The size can be
|
||||
adjusted with the **rd.live.overlay.size=** kernel command line option.
|
||||
SquashFS with read-only filesystem image::: The system will boot with a
|
||||
read-only filesystem from the SquashFS and apply a writable Device-mapper
|
||||
snapshot or an OverlayFS overlay mount for the read-only base filesystem. This
|
||||
method ensures a relatively fast boot and lower RAM usage. Users **must be
|
||||
careful** to avoid writing too many blocks to a snapshot volume. Once the
|
||||
blocks of the snapshot overlay are exhausted, the root filesystem becomes
|
||||
read-only and may cause application failures. The snapshot overlay file is
|
||||
marked 'Overflow', and a difficult recovery is required to repair and enlarge
|
||||
the overlay offline. Non-persistent overlays are sparse files in RAM that only
|
||||
consume content space as required blocks are allocated. They default to an
|
||||
apparent size of 32 GiB in RAM. The size can be adjusted with the
|
||||
**rd.live.overlay.size=** kernel command line option.
|
||||
+
|
||||
The filesystem structure is expected to be:
|
||||
The filesystem structure is traditionally expected to be:
|
||||
+
|
||||
[listing]
|
||||
--
|
||||
squashfs.img | Squashfs from LiveCD .iso downloaded via network
|
||||
squashfs.img | SquashFS from LiveCD .iso
|
||||
!(mount)
|
||||
/LiveOS
|
||||
|- rootfs.img | Filesystem image to mount read-only
|
||||
@@ -855,21 +866,35 @@ squashfs.img | Squashfs from LiveCD .iso downloaded via network
|
||||
... |
|
||||
--
|
||||
+
|
||||
Dracut uses this method of live booting by default. No additional command line
|
||||
options are required other than **root=live:<URL>** to specify the location
|
||||
of your squashed filesystem.
|
||||
For OverlayFS mount overlays, the filesystem structure may also be a direct
|
||||
compression of the root filesystem:
|
||||
+
|
||||
[listing]
|
||||
--
|
||||
squashfs.img | SquashFS from LiveCD .iso
|
||||
!(mount)
|
||||
/bin | Live filesystem
|
||||
/boot |
|
||||
/dev |
|
||||
... |
|
||||
--
|
||||
+
|
||||
Dracut uses one of the overlay methods of live booting by default. No
|
||||
additional command line options are required other than **root=live:<URL>** to
|
||||
specify the location of your squashed filesystem.
|
||||
+
|
||||
- The compressed SquashFS image can be copied during boot to RAM at
|
||||
`/run/initramfs/squashed.img` by using the **rd.live.ram=1** option.
|
||||
- A device with a persistent overlay can be booted read only by using the
|
||||
- A device with a persistent overlay can be booted read-only by using the
|
||||
**rd.live.overlay.readonly** option on the kernel command line. This will
|
||||
cause a temporary, writable overlay to be stacked over a read-only snapshot
|
||||
of the root filesystem.
|
||||
either cause a temporary, writable overlay to be stacked over a read-only
|
||||
snapshot of the root filesystem or the OverlayFS mount will use an additional
|
||||
lower layer with the root filesystem.
|
||||
+
|
||||
Uncompressed live filesystem image:::
|
||||
When the live system was installed with the '--skipcompress' option of the
|
||||
__livecd-iso-to-disk__ installation script for Live USB devices, the root
|
||||
filesystem image, `rootfs.img`, is expanded on installation and no SquashFS
|
||||
filesystem image, __rootfs.img__, is expanded on installation and no SquashFS
|
||||
is involved during boot.
|
||||
+
|
||||
- If **rd.live.ram=1** is used in this situation, the full, uncompressed
|
||||
@@ -877,12 +902,12 @@ root filesystem is copied during boot to `/run/initramfs/rootfs.img` in the
|
||||
`/run` tmpfs.
|
||||
+
|
||||
- If **rd.live.overlay=none** is provided as a kernel command line option,
|
||||
a writable, linear device-mapper target is created on boot with no overlay.
|
||||
a writable, linear Device-mapper target is created on boot with no overlay.
|
||||
|
||||
writable filesystem image:::
|
||||
Writable filesystem image:::
|
||||
The system will retrieve a compressed filesystem image, extract it to
|
||||
`/run/initramfs/fsimg/rootfs.img`, connect it to a loop device, create a
|
||||
writable, linear device-mapper target at `/dev/mapper/live-rw`, and mount that
|
||||
writable, linear Device-mapper target at `/dev/mapper/live-rw`, and mount that
|
||||
as a writable volume at `/`. More RAM is required during boot but the live
|
||||
filesystem is easier to manage if it becomes full. Users can make a filesystem
|
||||
image of any size and that size will be maintained when the system boots. There
|
||||
@@ -892,7 +917,7 @@ The filesystem structure is expected to be:
|
||||
+
|
||||
[listing]
|
||||
--
|
||||
rootfs.tgz | Compressed tarball containing fileystem image
|
||||
rootfs.tgz | Compressed tarball containing filesystem image
|
||||
!(unpack)
|
||||
/rootfs.img | Filesystem image at /run/initramfs/fsimg/
|
||||
!(mount)
|
||||
@@ -920,10 +945,11 @@ NOTE: There must be enough free RAM available to hold the complete image.
|
||||
This method is very suitable for diskless boots.
|
||||
|
||||
**root=**live:__<url>__::
|
||||
Boots a live image retrieved from __<url>__. Valid handlers: __http, https, ftp, torrent, tftp__.
|
||||
Boots a live image retrieved from __<url>__. Requires the dracut 'livenet'
|
||||
module. Valid handlers: __http, https, ftp, torrent, tftp__.
|
||||
+
|
||||
[listing]
|
||||
.Example
|
||||
.Examples
|
||||
--
|
||||
root=live:http://example.com/liveboot.img
|
||||
root=live:ftp://ftp.example.com/liveboot.img
|
||||
@@ -935,7 +961,7 @@ Enables debug output from the live boot process.
|
||||
|
||||
**rd.live.dir=**__<path>__::
|
||||
Specifies the directory within the boot device where the squashfs.img or
|
||||
rootfs.img can be found. By default, this is __LiveOS__.
|
||||
rootfs.img can be found. By default, this is `/LiveOS`.
|
||||
|
||||
**rd.live.squashimg=**__<filename of SquashFS image>__::
|
||||
Specifies the filename for a SquashFS image of the root filesystem.
|
||||
@@ -943,35 +969,52 @@ By default, this is __squashfs.img__.
|
||||
|
||||
**rd.live.ram=**1::
|
||||
Copy the complete image to RAM and use this for booting. This is useful
|
||||
when the image resides on, i.e., a DVD which needs to be ejected later on.
|
||||
when the image resides on, e.g., a DVD which needs to be ejected later on.
|
||||
|
||||
**rd.live.overlay=**__<devspec>__:__(<pathspec>|auto)__|__none__::
|
||||
Allow the usage of a permanent overlay.
|
||||
- _<devspec>_ specifies the path to a device with a mountable filesystem.
|
||||
- _<pathspec>_ is the path to a file within that filesystem, which shall be
|
||||
**rd.live.overlay={**__<devspec>__[:__{<pathspec>|auto}__]|__none__}::
|
||||
Manage the usage of a permanent overlay.
|
||||
+
|
||||
--
|
||||
* _<devspec>_ specifies the path to a device with a mountable filesystem.
|
||||
* _<pathspec>_ is the path to a file within that filesystem, which shall be
|
||||
used to persist the changes made to the device specified by the
|
||||
**root=live:__<url>__** option.
|
||||
- _none_ specifies no overlay when an uncompressed live root filesystem is
|
||||
available.
|
||||
If a persistent overlay is detected at the standard LiveOS path, the overlay &
|
||||
overlay type detected (whether Device-mapper or OverlayFS) will be used.
|
||||
+
|
||||
The default _pathspec_, when _auto_ or no _:<pathspec>_ is given, is
|
||||
`/<+++<b>rd.live.dir</b>+++>/overlay-<label>-<uuid>`, where _<label>_ is the
|
||||
device LABEL, and _<uuid>_ is the device UUID.
|
||||
* _none_ (the word itself) specifies that no overlay will be used, such as when
|
||||
an uncompressed, writable live root filesystem is available.
|
||||
+
|
||||
If a persistent overlay __is detected__ at the standard LiveOS path, the
|
||||
overlay & overlay type detected, whether Device-mapper or OverlayFS, will be
|
||||
used.
|
||||
--
|
||||
+
|
||||
[listing]
|
||||
.Example
|
||||
.Examples
|
||||
--
|
||||
rd.live.overlay=/dev/sdb1:persistent-overlay.img
|
||||
rd.live.overlay=UUID=99440c1f-8daa-41bf-b965-b7240a8996f4
|
||||
--
|
||||
|
||||
**rd.live.overlay.size=**__<size_MiB>__::
|
||||
Specifies a non-persistent overlay size in MiB. The default is _32768_.
|
||||
Specifies a non-persistent Device-mapper overlay size in MiB. The default is
|
||||
_32768_.
|
||||
|
||||
**rd.live.overlay.readonly=**1::
|
||||
Specifies a non-persistent, writable snapshot overlay to be stacked over a
|
||||
read-only snapshot of the root filesystem, `/dev/mapper/live-ro`, or a read-
|
||||
only loop device of a writable `rootfs.img`.
|
||||
This is used to boot with a normally read-write persistent overlay in a
|
||||
read-only mode. With this option, either an additional, non-persistent,
|
||||
writable snapshot overlay will be stacked over a read-only snapshot,
|
||||
`/dev/mapper/live‑ro`, of the base filesystem with the persistent overlay, or a
|
||||
read-only loop device, in the case of a writable __rootfs.img__, or an OverlayFS
|
||||
mount will use the persistent overlay directory linked at `/run/overlayfs‑r` as
|
||||
an additional lower layer along with the base root filesystem and apply a
|
||||
transient, writable upper directory overlay, in order to complete the booted
|
||||
root filesystem.
|
||||
|
||||
**rd.live.overlay.reset=**1::
|
||||
Specifies that a persistent overlay should be reset on boot. All root
|
||||
Specifies that a persistent overlay should be reset on boot. All previous root
|
||||
filesystem changes are vacated by this action.
|
||||
|
||||
**rd.live.overlay.thin=**1::
|
||||
@@ -982,25 +1025,25 @@ that memory is given back to the kernel when the filesystem does not claim it
|
||||
anymore.
|
||||
|
||||
**rd.live.overlay.overlayfs=**1::
|
||||
Enables the use of the **OverlayFS** kernel module, if available, to provide a
|
||||
Enables the use of the *OverlayFS* kernel module, if available, to provide a
|
||||
copy-on-write union directory for the root filesystem. OverlayFS overlays are
|
||||
directories of the files that have changed on the read-only base (lower)
|
||||
filesystem. The root filesystem is provided through a special overlay type
|
||||
mount that merges the lower and upper directories. If an OverlayFS upper
|
||||
directory is not present on the boot device, a tmpfs directory will be created
|
||||
at /run/overlayfs to provide temporary storage. Persistent storage can be
|
||||
at `/run/overlayfs` to provide temporary storage. Persistent storage can be
|
||||
provided on vfat or msdos formatted devices by supplying the OverlayFS upper
|
||||
directory within an embedded filesystem that supports the creation of trusted.*
|
||||
extended attributes and provides a valid d_type in readdir responses, such as
|
||||
with ext4 and xfs. On non-vfat-formatted devices, a persistent OverlayFS
|
||||
overlay can extend the available root filesystem storage up to the capacity of
|
||||
the LiveOS device.
|
||||
|
||||
the LiveOS disk device.
|
||||
+
|
||||
If a persistent overlay is detected at the standard LiveOS path, the overlay &
|
||||
overlay type detected (whether OverlayFS or Device-mapper) will be used.
|
||||
|
||||
overlay type detected, whether OverlayFS or Device-mapper, will be used.
|
||||
+
|
||||
The **rd.live.overlay.readonly** option, which allows a persistent overlayfs to
|
||||
be mounted read only through a higher level transient overlay directory, has
|
||||
be mounted read-only through a higher level transient overlay directory, has
|
||||
been implemented through the multiple lower layers feature of OverlayFS.
|
||||
|
||||
|
||||
|
@@ -89,9 +89,6 @@ 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.
|
||||
|
@@ -212,7 +212,7 @@ check() should return with:
|
||||
|
||||
0:: Include the dracut module in the initramfs.
|
||||
|
||||
1:: Do not include the dracut module. The requirements are not fullfilled
|
||||
1:: Do not include the dracut module. The requirements are not fulfilled
|
||||
(missing tools, etc.)
|
||||
|
||||
255:: Only include the dracut module, if another module requires it or if
|
||||
@@ -255,7 +255,9 @@ not lead to an error.
|
||||
==== inst <src> [<dst>]
|
||||
|
||||
installs _one_ file <src> either to the same place in the initramfs or to an
|
||||
optional <dst>.
|
||||
optional <dst>. inst with more than two arguments is treated the same as
|
||||
inst_multiple, all arguments are treated as files to install and none as
|
||||
install destinations.
|
||||
|
||||
==== inst_hook <hookdir> <prio> <src>
|
||||
|
||||
|
217
dracut.sh
217
dracut.sh
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash --norc
|
||||
#!/bin/bash -p
|
||||
#
|
||||
# Generator script for a dracut initramfs
|
||||
# Tries to retain some degree of compatibility with the command line
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
# store for logging
|
||||
|
||||
unset BASH_ENV
|
||||
|
||||
# Verify bash version, current minimum is 4
|
||||
if (( BASH_VERSINFO[0] < 4 )); then
|
||||
printf -- 'You need at least Bash 4 to use dracut, sorry.' >&2
|
||||
@@ -108,8 +110,6 @@ Creates initial ramdisk images for preloading modules
|
||||
--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]
|
||||
@@ -147,6 +147,21 @@ Creates initial ramdisk images for preloading modules
|
||||
-H, --hostonly Host-Only mode: Install only what is needed for
|
||||
booting the local host instead of a generic host.
|
||||
-N, --no-hostonly Disables Host-Only mode
|
||||
--hostonly-mode <mode>
|
||||
Specify the hostonly mode to use. <mode> could be
|
||||
one of "sloppy" or "strict". "sloppy" mode is used
|
||||
by default.
|
||||
In "sloppy" hostonly mode, extra drivers and modules
|
||||
will be installed, so minor hardware change won't make
|
||||
the image unbootable (eg. changed keyboard), and the
|
||||
image is still portable among similar hosts.
|
||||
With "strict" mode enabled, anything not necessary
|
||||
for booting the local host in its current state will
|
||||
not be included, and modules may do some extra job
|
||||
to save more space. Minor change of hardware or
|
||||
environment could make the image unbootable.
|
||||
DO NOT use "strict" mode unless you know what you
|
||||
are doing.
|
||||
--hostonly-cmdline Store kernel command line arguments needed
|
||||
in the initramfs
|
||||
--no-hostonly-cmdline Do not store kernel command line arguments needed
|
||||
@@ -334,8 +349,6 @@ rearrange_params()
|
||||
--long kernel-cmdline: \
|
||||
--long strip \
|
||||
--long nostrip \
|
||||
--long prelink \
|
||||
--long noprelink \
|
||||
--long hardlink \
|
||||
--long nohardlink \
|
||||
--long noprefix \
|
||||
@@ -354,6 +367,7 @@ rearrange_params()
|
||||
--long host-only \
|
||||
--long no-hostonly \
|
||||
--long no-host-only \
|
||||
--long hostonly-mode: \
|
||||
--long hostonly-cmdline \
|
||||
--long no-hostonly-cmdline \
|
||||
--long no-hostonly-default-device \
|
||||
@@ -460,9 +474,6 @@ if [[ $append_args_l == "yes" ]]; then
|
||||
eval set -- "$TEMP"
|
||||
rearrange_params "$@"
|
||||
fi
|
||||
|
||||
# clean the temporarily used scratch-pad directory
|
||||
rm -rf $scratch_dir
|
||||
fi
|
||||
|
||||
unset PARMS_TO_STORE
|
||||
@@ -520,8 +531,6 @@ while :; do
|
||||
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="/";;
|
||||
@@ -544,6 +553,8 @@ while :; do
|
||||
hostonly_l="yes" ;;
|
||||
-N|--no-hostonly|--no-host-only)
|
||||
hostonly_l="no" ;;
|
||||
--hostonly-mode)
|
||||
hostonly_mode_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--hostonly-cmdline)
|
||||
hostonly_cmdline_l="yes" ;;
|
||||
--hostonly-i18n)
|
||||
@@ -724,14 +735,13 @@ 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
|
||||
[[ $hostonly_cmdline_l ]] && hostonly_cmdline=$hostonly_cmdline_l
|
||||
[[ $hostonly_mode_l ]] && hostonly_mode=$hostonly_mode_l
|
||||
[[ "$hostonly" == "yes" ]] && ! [[ $hostonly_cmdline ]] && hostonly_cmdline="yes"
|
||||
[[ $i18n_install_all_l ]] && i18n_install_all=$i18n_install_all_l
|
||||
[[ $persistent_policy_l ]] && persistent_policy=$persistent_policy_l
|
||||
@@ -856,6 +866,19 @@ esac
|
||||
[[ $hostonly = yes ]] && hostonly="-h"
|
||||
[[ $hostonly != "-h" ]] && unset hostonly
|
||||
|
||||
case $hostonly_mode in
|
||||
'')
|
||||
[[ $hostonly ]] && hostonly_mode="sloppy" ;;
|
||||
sloppy|strict)
|
||||
if [[ ! $hostonly ]]; then
|
||||
unset hostonly_mode
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
printf "%s\n" "dracut: Invalid hostonly mode '$hostonly_mode'." >&2
|
||||
exit 1
|
||||
esac
|
||||
|
||||
[[ $reproducible == yes ]] && DRACUT_REPRODUCIBLE=1
|
||||
|
||||
readonly TMPDIR="$(realpath -e "$tmpdir")"
|
||||
@@ -1236,7 +1259,7 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
|
||||
|
||||
push_host_devs "$_dev"
|
||||
if [[ "$_t" == btrfs ]]; then
|
||||
for i in $(find_btrfs_devs "$_m"); do
|
||||
for i in $(btrfs_devs "$_m"); do
|
||||
push_host_devs "$i"
|
||||
done
|
||||
fi
|
||||
@@ -1288,16 +1311,16 @@ done
|
||||
[[ -d $udevdir ]] \
|
||||
|| udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
|
||||
if ! [[ -d "$udevdir" ]]; then
|
||||
[[ ! -h /lib ]] && [[ -d /lib/udev ]] && udevdir=/lib/udev
|
||||
[[ -d /usr/lib/udev ]] && udevdir=/usr/lib/udev
|
||||
[[ -e /lib/udev/collect ]] && udevdir=/lib/udev
|
||||
[[ -e /usr/lib/udev/collect ]] && udevdir=/usr/lib/udev
|
||||
fi
|
||||
|
||||
[[ -d $systemdutildir ]] \
|
||||
|| systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
|
||||
|
||||
if ! [[ -d "$systemdutildir" ]]; then
|
||||
[[ ! -h /lib ]] && [[ -d /lib/systemd ]] && systemdutildir=/lib/systemd
|
||||
[[ -d /usr/lib/systemd ]] && systemdutildir=/usr/lib/systemd
|
||||
[[ -e /lib/systemd/systemd-udevd ]] && systemdutildir=/lib/systemd
|
||||
[[ -e /usr/lib/systemd/systemd-udevd ]] && systemdutildir=/usr/lib/systemd
|
||||
fi
|
||||
|
||||
[[ -d $systemdsystemunitdir ]] \
|
||||
@@ -1466,6 +1489,9 @@ dinfo "*** Including modules done ***"
|
||||
|
||||
## final stuff that has to happen
|
||||
if [[ $no_kernel != yes ]]; then
|
||||
if [[ $hostonly ]]; then
|
||||
echo "$(get_loaded_kernel_modules)" > $initdir/lib/dracut/loaded-kernel-modules.txt
|
||||
fi
|
||||
|
||||
if [[ $drivers ]]; then
|
||||
hostonly='' instmods $drivers
|
||||
@@ -1608,21 +1634,6 @@ if [[ $kernel_only != yes ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
PRELINK_BIN="$(command -v prelink)"
|
||||
if [[ $EUID = 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
|
||||
elif [[ $do_prelink == yes ]]; then
|
||||
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
|
||||
|
||||
if [[ $do_hardlink = yes ]] && command -v hardlink >/dev/null; then
|
||||
dinfo "*** Hardlinking files ***"
|
||||
hardlink "$initdir" 2>&1
|
||||
@@ -1643,6 +1654,11 @@ if [[ $do_strip = yes ]] ; then
|
||||
done
|
||||
fi
|
||||
|
||||
# cleanup empty ldconfig_paths directories
|
||||
for d in $(ldconfig_paths); do
|
||||
rmdir -p --ignore-fail-on-non-empty "$initdir/$d" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Stripping files ***"
|
||||
find "$initdir" -type f \
|
||||
@@ -1731,6 +1747,120 @@ fi
|
||||
|
||||
dinfo "*** Creating image file '$outfile' ***"
|
||||
|
||||
if dracut_module_included "squash"; then
|
||||
if ! check_kernel_config CONFIG_SQUASHFS; then
|
||||
dfatal "CONFIG_SQUASHFS have to be enabled for dracut squash module to work"
|
||||
exit 1
|
||||
fi
|
||||
if ! check_kernel_config CONFIG_OVERLAY_FS; then
|
||||
dfatal "CONFIG_OVERLAY_FS have to be enabled for dracut squash module to work"
|
||||
exit 1
|
||||
fi
|
||||
if ! check_kernel_config CONFIG_DEVTMPFS; then
|
||||
dfatal "CONFIG_DEVTMPFS have to be enabled for dracut squash module to work"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
readonly squash_dir="${DRACUT_TMPDIR}/squashfs"
|
||||
readonly squash_img=$initdir/squash/root.img
|
||||
|
||||
# Currently only move "usr" "etc" to squashdir
|
||||
readonly squash_candidate=( "usr" "etc" )
|
||||
|
||||
mkdir -m 0755 -p $squash_dir
|
||||
for folder in "${squash_candidate[@]}"; do
|
||||
mv $initdir/$folder $squash_dir/$folder
|
||||
done
|
||||
|
||||
# Reinstall required files, because we have moved some important folders to $squash_dir
|
||||
inst_multiple "echo" "sh" "mount" "modprobe" "mkdir" \
|
||||
"systemctl" "udevadm" "$systemdutildir/systemd"
|
||||
hostonly="" instmods "loop" "squashfs" "overlay"
|
||||
|
||||
for folder in "${squash_candidate[@]}"; do
|
||||
# Remove duplicated files in squashfs image, save some more space
|
||||
[[ ! -d $initdir/$folder/ ]] && continue
|
||||
for file in $(find $initdir/$folder/ -not -type d);
|
||||
do
|
||||
if [[ -e $squash_dir${file#$initdir} ]]; then
|
||||
mv $squash_dir${file#$initdir} $file
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# Move some files out side of the squash image, including:
|
||||
# - Files required to boot and mount the squashfs image
|
||||
# - Files need to be accessable without mounting the squash image
|
||||
required_in_root() {
|
||||
local file=$1
|
||||
local _sqsh_file=$squash_dir/$file
|
||||
local _init_file=$initdir/$file
|
||||
|
||||
if [[ -e $_init_file ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ ! -e $_sqsh_file ]] && [[ ! -L $_sqsh_file ]]; then
|
||||
derror "$file is required to boot a squashed initramfs but it's not installed!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ ! -d $(dirname $_init_file) ]]; then
|
||||
required_in_root $(dirname $file)
|
||||
fi
|
||||
|
||||
if [[ -d $_sqsh_file ]]; then
|
||||
if [[ -L $_sqsh_file ]]; then
|
||||
cp --preserve=all -P $_sqsh_file $_init_file
|
||||
else
|
||||
mkdir $_init_file
|
||||
fi
|
||||
else
|
||||
if [[ -L $_sqsh_file ]]; then
|
||||
cp --preserve=all -P $_sqsh_file $_init_file
|
||||
_sqsh_file=$(realpath $_sqsh_file 2>/dev/null)
|
||||
if [[ -e $_sqsh_file ]] && [[ "$_sqsh_file" == "$squash_dir"* ]]; then
|
||||
# Relative symlink
|
||||
required_in_root ${_sqsh_file#$squash_dir/}
|
||||
return
|
||||
fi
|
||||
if [[ -e $squash_dir$_sqsh_file ]]; then
|
||||
# Absolute symlink
|
||||
required_in_root ${_sqsh_file#/}
|
||||
return
|
||||
fi
|
||||
required_in_root ${module_spec#$squash_dir/}
|
||||
else
|
||||
mv $_sqsh_file $_init_file
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
required_in_root etc/initrd-release
|
||||
|
||||
for module_spec in $squash_dir/usr/lib/modules/*/modules.*;
|
||||
do
|
||||
required_in_root ${module_spec#$squash_dir/}
|
||||
done
|
||||
|
||||
for dracut_spec in $squash_dir/usr/lib/dracut/*;
|
||||
do
|
||||
required_in_root ${dracut_spec#$squash_dir/}
|
||||
done
|
||||
|
||||
mv $initdir/init $initdir/init.stock
|
||||
mv $initdir/shutdown $initdir/shutdown.stock
|
||||
ln -s squash/init.sh $initdir/init
|
||||
ln -s squash/shutdown.sh $initdir/shutdown
|
||||
|
||||
mksquashfs $squash_dir $squash_img -comp xz -b 64K -Xdict-size 100% &> /dev/null
|
||||
|
||||
if [[ $? != 0 ]]; then
|
||||
dfatal "dracut: Failed making squash image"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $uefi = yes ]]; then
|
||||
readonly uefi_outdir="$DRACUT_TMPDIR/uefi"
|
||||
mkdir "$uefi_outdir"
|
||||
@@ -1832,15 +1962,22 @@ fi
|
||||
|
||||
command -v restorecon &>/dev/null && restorecon -- "$outfile"
|
||||
|
||||
if ! sync "$outfile" 2> /dev/null; then
|
||||
dinfo "dracut: sync operation on newly created initramfs $outfile failed"
|
||||
exit 1
|
||||
fi
|
||||
# We sync/fsfreeze only if we're operating on a live booted system.
|
||||
# It's possible for e.g. `kernel` to be installed as an RPM BuildRequires or equivalent,
|
||||
# and there's no reason to sync, and *definitely* no reason to fsfreeze.
|
||||
# Another case where this happens is rpm-ostree, which performs its own sync/fsfreeze
|
||||
# globally. See e.g. https://github.com/ostreedev/ostree/commit/8642ef5ab3fec3ac8eb8f193054852f83a8bc4d0
|
||||
if test -d /run/systemd/system; then
|
||||
if ! sync "$outfile" 2> /dev/null; then
|
||||
dinfo "dracut: sync operation on newly created initramfs $outfile failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# use fsfreeze only if we're not writing to /
|
||||
if [[ "$(stat -c %m -- "$outfile")" != "/" && "$(stat -f -c %T -- "$outfile")" != "msdos" ]]; then
|
||||
if ! $(fsfreeze -f $(dirname "$outfile") 2>/dev/null && fsfreeze -u $(dirname "$outfile") 2>/dev/null); then
|
||||
dinfo "dracut: warning: could not fsfreeze $(dirname "$outfile")"
|
||||
# use fsfreeze only if we're not writing to /
|
||||
if [[ "$(stat -c %m -- "$outfile")" != "/" && "$(stat -f -c %T -- "$outfile")" != "msdos" ]]; then
|
||||
if ! $(fsfreeze -f $(dirname "$outfile") 2>/dev/null && fsfreeze -u $(dirname "$outfile") 2>/dev/null); then
|
||||
dinfo "dracut: warning: could not fsfreeze $(dirname "$outfile")"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
180
dracut.spec
180
dracut.spec
@@ -5,15 +5,6 @@
|
||||
# strip the automatically generated dep here and instead co-own the
|
||||
# directory.
|
||||
%global __requires_exclude pkg-config
|
||||
|
||||
# Variables must be defined
|
||||
%define with_nbd 1
|
||||
|
||||
# nbd in Fedora only
|
||||
%if 0%{?rhel} >= 6
|
||||
%define with_nbd 0
|
||||
%endif
|
||||
|
||||
%define dist_free_release xxx
|
||||
|
||||
Name: dracut
|
||||
@@ -45,53 +36,34 @@ BuildRequires: kmod-devel >= 23
|
||||
BuildRequires: gcc
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: systemd
|
||||
%endif
|
||||
%if 0%{?fedora}
|
||||
BuildRequires: bash-completion
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%endif
|
||||
|
||||
%if %{with doc}
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
BuildRequires: docbook-style-xsl docbook-dtds libxslt
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
-BuildRequires: docbook-xsl-stylesheets libxslt
|
||||
BuildRequires: docbook-xsl-stylesheets libxslt
|
||||
%endif
|
||||
|
||||
BuildRequires: asciidoc
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel}
|
||||
# no "provides", because dracut does not offer
|
||||
# all functionality of the obsoleted packages
|
||||
Obsoletes: mkinitrd < 6.0.94
|
||||
Obsoletes: mkinitrd-devel < 6.0.94
|
||||
Obsoletes: nash < 6.0.94
|
||||
Obsoletes: libbdevid-python < 6.0.94
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} > 16 || 0%{?rhel} > 6
|
||||
BuildRequires: systemd-units
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version} > 9999
|
||||
Obsoletes: mkinitrd < 2.6.1
|
||||
Provides: mkinitrd = 2.6.1
|
||||
%endif
|
||||
|
||||
Obsoletes: dracut-kernel < 005
|
||||
Provides: dracut-kernel = %{version}-%{release}
|
||||
|
||||
Obsoletes: dracut < 030
|
||||
Obsoletes: dracut-norescue < 030
|
||||
Provides: dracut-norescue = %{version}-%{release}
|
||||
Obsoletes: dracut-fips <= 047
|
||||
Provides: dracut-fips = %{version}-%{release}
|
||||
Obsoletes: dracut-fips-aesni <= 047
|
||||
Provides: dracut-fips-aesni = %{version}-%{release}
|
||||
|
||||
Requires: bash >= 4
|
||||
Requires: coreutils
|
||||
@@ -104,39 +76,33 @@ Requires: sed
|
||||
Requires: xz
|
||||
Requires: gzip
|
||||
|
||||
%if 0%{?fedora} > 22 || 0%{?rhel} > 7
|
||||
Recommends: grubby
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
Recommends: hardlink
|
||||
Recommends: pigz
|
||||
Recommends: kpartx
|
||||
%else
|
||||
Requires: hardlink
|
||||
Requires: gzip
|
||||
Requires: kpartx
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
Requires: util-linux >= 2.21
|
||||
Requires: systemd >= 219
|
||||
Requires: systemd-udev >= 219
|
||||
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: hardlink
|
||||
Requires: gzip
|
||||
Requires: kpartx
|
||||
Requires: udev > 166
|
||||
Requires: util-linux-ng >= 2.21
|
||||
%endif
|
||||
|
||||
Conflicts: mdadm < 3.2.6-14
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
Requires: libkcapi-hmaccalc
|
||||
%endif
|
||||
|
||||
%description
|
||||
dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
|
||||
Unlike existing implementations, dracut does hard-code as little as possible
|
||||
into the initramfs. dracut contains various modules which are driven by the
|
||||
event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
|
||||
NFS, iSCSI, NBD, FCoE with the dracut-network package.
|
||||
dracut contains tools to create bootable initramfses for the Linux
|
||||
kernel. Unlike previous implementations, dracut hard-codes as little
|
||||
as possible into the initramfs. dracut contains various modules which
|
||||
are driven by the event-based udev. Having root on MD, DM, LVM2, LUKS
|
||||
is supported as well as NFS, iSCSI, NBD, FCoE with the dracut-network
|
||||
package.
|
||||
|
||||
%package network
|
||||
Summary: dracut modules to build a dracut initramfs with network support
|
||||
@@ -159,32 +125,6 @@ Provides: dracut-generic = %{version}-%{release}
|
||||
This package requires everything which is needed to build a generic
|
||||
all purpose initramfs with network support with dracut.
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?suse_version}
|
||||
%package fips
|
||||
Summary: dracut modules to build a dracut initramfs with an integrity check
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: hmaccalc
|
||||
%if 0%{?rhel} > 5
|
||||
# For Alpha 3, we want nss instead of nss-softokn
|
||||
Requires: nss
|
||||
%else
|
||||
Requires: nss-softokn
|
||||
%endif
|
||||
Requires: nss-softokn-freebl
|
||||
|
||||
%description fips
|
||||
This package requires everything which is needed to build an
|
||||
initramfs with dracut, which does an integrity check.
|
||||
%endif
|
||||
|
||||
%package fips-aesni
|
||||
Summary: dracut modules to build a dracut initramfs with an integrity check with aesni-intel
|
||||
Requires: %{name}-fips = %{version}-%{release}
|
||||
|
||||
%description fips-aesni
|
||||
This package requires everything which is needed to build an
|
||||
initramfs with dracut, which does an integrity check and adds the aesni-intel kernel module.
|
||||
|
||||
%package caps
|
||||
Summary: dracut modules to build a dracut initramfs which drops capabilities
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
@@ -238,6 +178,16 @@ Requires: %{name} = %{version}-%{release}
|
||||
%description tools
|
||||
This package contains tools to assemble the local initrd and host configuration.
|
||||
|
||||
%package squash
|
||||
Summary: dracut module to build an initramfs with most files in a squashfs image
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: squash-tools
|
||||
|
||||
%description squash
|
||||
This package provides a dracut module to build an initramfs, but store most files
|
||||
in a squashfs image, result in a smaller initramfs size and reduce runtime memory
|
||||
usage.
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-%{version} -S git_am
|
||||
cp %{SOURCE1} .
|
||||
@@ -254,9 +204,6 @@ cp %{SOURCE1} .
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
rm -rf -- $RPM_BUILD_ROOT
|
||||
%endif
|
||||
make %{?_smp_mflags} install \
|
||||
DESTDIR=$RPM_BUILD_ROOT \
|
||||
libdir=%{_prefix}/lib
|
||||
@@ -265,7 +212,6 @@ echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dr
|
||||
|
||||
%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} == 0
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
|
||||
%endif
|
||||
|
||||
%if %{defined _unitdir}
|
||||
@@ -295,9 +241,12 @@ rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd_mod
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd_rules
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dcssblk
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95qeth_rules
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95zfcp
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95zfcp_rules
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95znet
|
||||
%else
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00warpclock
|
||||
%endif
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/boot/dracut
|
||||
@@ -314,33 +263,21 @@ rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse*
|
||||
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
|
||||
%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} <= 9999
|
||||
rm -f -- $RPM_BUILD_ROOT%{_bindir}/mkinitrd
|
||||
rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
# FIXME: remove after F19
|
||||
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
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
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
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
> $RPM_BUILD_ROOT/etc/system-fips
|
||||
# FIXME: remove after F30
|
||||
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
|
||||
%endif
|
||||
|
||||
%clean
|
||||
rm -rf -- $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,0755)
|
||||
%if %{with doc}
|
||||
%doc README HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
|
||||
%endif
|
||||
@@ -349,7 +286,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{_bindir}/dracut
|
||||
%{_datadir}/bash-completion/completions/dracut
|
||||
%{_datadir}/bash-completion/completions/lsinitrd
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999
|
||||
%{_bindir}/mkinitrd
|
||||
%{_bindir}/lsinitrd
|
||||
%endif
|
||||
@@ -375,7 +312,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%if %{with doc}
|
||||
%{_mandir}/man8/dracut.8*
|
||||
%{_mandir}/man8/*service.8*
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999
|
||||
%{_mandir}/man8/mkinitrd.8*
|
||||
%{_mandir}/man1/lsinitrd.1*
|
||||
%endif
|
||||
@@ -391,6 +328,12 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%endif
|
||||
%{dracutlibdir}/modules.d/00bash
|
||||
%{dracutlibdir}/modules.d/00systemd
|
||||
%ifnarch s390 s390x
|
||||
%{dracutlibdir}/modules.d/00warpclock
|
||||
%endif
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
%{dracutlibdir}/modules.d/01fips
|
||||
%endif
|
||||
%{dracutlibdir}/modules.d/01systemd-initrd
|
||||
%{dracutlibdir}/modules.d/03modsign
|
||||
%{dracutlibdir}/modules.d/03rescue
|
||||
@@ -407,10 +350,11 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/90dm
|
||||
%{dracutlibdir}/modules.d/90dmraid
|
||||
%{dracutlibdir}/modules.d/90kernel-modules
|
||||
%{dracutlibdir}/modules.d/90kernel-modules-extra
|
||||
%{dracutlibdir}/modules.d/90lvm
|
||||
%{dracutlibdir}/modules.d/90mdraid
|
||||
%{dracutlibdir}/modules.d/90multipath
|
||||
%{dracutlibdir}/modules.d/90multipath-hostonly
|
||||
%{dracutlibdir}/modules.d/90stratis
|
||||
%{dracutlibdir}/modules.d/90qemu
|
||||
%{dracutlibdir}/modules.d/91crypt-gpg
|
||||
%{dracutlibdir}/modules.d/91crypt-loop
|
||||
@@ -430,6 +374,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/95dasd_mod
|
||||
%{dracutlibdir}/modules.d/95dasd_rules
|
||||
%{dracutlibdir}/modules.d/95dcssblk
|
||||
%{dracutlibdir}/modules.d/95qeth_rules
|
||||
%{dracutlibdir}/modules.d/95zfcp
|
||||
%{dracutlibdir}/modules.d/95zfcp_rules
|
||||
%endif
|
||||
@@ -469,13 +414,14 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{_unitdir}/initrd.target.wants/dracut-pre-udev.service
|
||||
|
||||
%endif
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
%{_prefix}/lib/kernel/install.d/50-dracut.install
|
||||
%endif
|
||||
|
||||
%files network
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/02systemd-networkd
|
||||
%{dracutlibdir}/modules.d/35network-manager
|
||||
%{dracutlibdir}/modules.d/35network-legacy
|
||||
%{dracutlibdir}/modules.d/40network
|
||||
%{dracutlibdir}/modules.d/45ifcfg
|
||||
%{dracutlibdir}/modules.d/90kernel-network-modules
|
||||
@@ -492,50 +438,36 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%endif
|
||||
%{dracutlibdir}/modules.d/99uefi-lib
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
%files fips
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/01fips
|
||||
%{dracutlibdir}/dracut.conf.d/40-fips.conf
|
||||
%config(missingok) /etc/system-fips
|
||||
%endif
|
||||
|
||||
%files fips-aesni
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/02fips-aesni
|
||||
|
||||
%files caps
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/02caps
|
||||
|
||||
%files live
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/99img-lib
|
||||
%{dracutlibdir}/modules.d/90dmsquash-live
|
||||
%{dracutlibdir}/modules.d/90dmsquash-live-ntfs
|
||||
%{dracutlibdir}/modules.d/90livenet
|
||||
|
||||
%files tools
|
||||
%defattr(-,root,root,0755)
|
||||
|
||||
%if %{with doc}
|
||||
%doc %{_mandir}/man8/dracut-catimages.8*
|
||||
%endif
|
||||
|
||||
%files squash
|
||||
%{dracutlibdir}/modules.d/99squash
|
||||
|
||||
%{_bindir}/dracut-catimages
|
||||
%dir /boot/dracut
|
||||
%dir /var/lib/dracut
|
||||
%dir /var/lib/dracut/overlay
|
||||
|
||||
%files config-generic
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
|
||||
|
||||
%files config-rescue
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/dracut.conf.d/02-rescue.conf
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
# FIXME: remove after F30
|
||||
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
|
||||
%endif
|
||||
|
||||
|
@@ -243,7 +243,7 @@ If your root partition is on a network drive, you have to have the network
|
||||
dracut modules installed to create a network aware initramfs image.
|
||||
|
||||
If you specify ip=dhcp on the kernel command line, then dracut asks a dhcp
|
||||
server about the ip adress for the machine. The dhcp server can also serve an
|
||||
server about the ip address for the machine. The dhcp server can also serve an
|
||||
additional root-path, which will set the root device for dracut. With this
|
||||
mechanism, you have static configuration on your client machine and a
|
||||
centralized boot configuration on your TFTP/DHCP server. If you can't pass a
|
||||
@@ -252,7 +252,7 @@ method described in <<Injecting>>.
|
||||
|
||||
==== Reducing the Image Size
|
||||
|
||||
To reduce the size of the initramfs, you should create it with by ommitting all
|
||||
To reduce the size of the initramfs, you should create it with by omitting all
|
||||
dracut modules, which you know, you don't need to boot the machine.
|
||||
|
||||
You can also specify the exact dracut and kernel modules to produce a very tiny
|
||||
|
61
fedora-test.sh
Executable file
61
fedora-test.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
[[ -d ${0%/*} ]] && cd ${0%/*}
|
||||
|
||||
RUN_ID="$1"
|
||||
TESTS=$2
|
||||
|
||||
dnf -y update --best --allowerasing &>/dev/null
|
||||
|
||||
dnf -y install --best --allowerasing \
|
||||
dash \
|
||||
asciidoc \
|
||||
mdadm \
|
||||
lvm2 \
|
||||
dmraid \
|
||||
cryptsetup \
|
||||
nfs-utils \
|
||||
nbd \
|
||||
dhcp-server \
|
||||
scsi-target-utils \
|
||||
iscsi-initiator-utils \
|
||||
strace \
|
||||
btrfs-progs \
|
||||
kmod-devel \
|
||||
gcc \
|
||||
bzip2 \
|
||||
xz \
|
||||
tar \
|
||||
wget \
|
||||
rpm-build \
|
||||
make \
|
||||
git \
|
||||
bash-completion \
|
||||
sudo \
|
||||
kernel \
|
||||
dhcp-client \
|
||||
/usr/bin/qemu-kvm \
|
||||
/usr/bin/qemu-system-$(uname -i) \
|
||||
e2fsprogs \
|
||||
$NULL &>/dev/null
|
||||
|
||||
./configure
|
||||
|
||||
NCPU=$(getconf _NPROCESSORS_ONLN)
|
||||
|
||||
if ! [[ $TESTS ]]; then
|
||||
make -j$NCPU all syncheck rpm logtee
|
||||
else
|
||||
make -j$NCPU all logtee
|
||||
|
||||
cd test
|
||||
|
||||
time sudo make \
|
||||
KVERSION=$(rpm -qa kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -rn | head -1) \
|
||||
TEST_RUN_ID=$RUN_ID \
|
||||
${TESTS:+TESTS="$TESTS"} \
|
||||
-k V=2 \
|
||||
check
|
||||
fi
|
@@ -402,9 +402,9 @@ static int resolve_deps(const char *src)
|
||||
_cleanup_pclose_ FILE *fptr = NULL;
|
||||
_cleanup_free_ char *cmd = NULL;
|
||||
|
||||
buf = malloc(LINE_MAX);
|
||||
if (buf == NULL)
|
||||
return -errno;
|
||||
buf = malloc(LINE_MAX);
|
||||
if (buf == NULL)
|
||||
return -errno;
|
||||
|
||||
if (strstr(src, ".so") == 0) {
|
||||
_cleanup_close_ int fd = -1;
|
||||
@@ -456,11 +456,11 @@ static int resolve_deps(const char *src)
|
||||
break;
|
||||
}
|
||||
|
||||
/* musl ldd */
|
||||
if (strstr(buf, "Not a valid dynamic program"))
|
||||
break;
|
||||
/* musl ldd */
|
||||
if (strstr(buf, "Not a valid dynamic program"))
|
||||
break;
|
||||
|
||||
/* glibc */
|
||||
/* glibc */
|
||||
if (strstr(buf, "cannot execute binary file"))
|
||||
break;
|
||||
|
||||
@@ -1061,7 +1061,7 @@ static int install_one(const char *src, const char *dst)
|
||||
if (strchr(src, '/') == NULL) {
|
||||
char **p = find_binary(src);
|
||||
if (p) {
|
||||
char **q = NULL;
|
||||
char **q = NULL;
|
||||
STRV_FOREACH(q, p) {
|
||||
char *newsrc = *q;
|
||||
log_debug("dracut_install '%s' '%s'", newsrc, dst);
|
||||
@@ -1097,7 +1097,7 @@ static int install_all(int argc, char **argv)
|
||||
if (strchr(argv[i], '/') == NULL) {
|
||||
char **p = find_binary(argv[i]);
|
||||
if (p) {
|
||||
char **q = NULL;
|
||||
char **q = NULL;
|
||||
STRV_FOREACH(q, p) {
|
||||
char *newsrc = *q;
|
||||
log_debug("dracut_install '%s'", newsrc);
|
||||
@@ -1231,11 +1231,42 @@ static bool check_module_path(const char *path)
|
||||
return true;
|
||||
}
|
||||
|
||||
static int install_dependent_modules(struct kmod_list *modlist)
|
||||
{
|
||||
struct kmod_list *itr;
|
||||
struct kmod_module *mod;
|
||||
const char *path = NULL;
|
||||
const char *name = NULL;
|
||||
int ret = 0;
|
||||
|
||||
kmod_list_foreach(itr, modlist) {
|
||||
mod = kmod_module_get_module(itr);
|
||||
path = kmod_module_get_path(mod);
|
||||
|
||||
name = kmod_module_get_name(mod);
|
||||
if ((path == NULL) || (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0))) {
|
||||
kmod_module_unref(mod);
|
||||
continue;
|
||||
}
|
||||
ret = dracut_install(path, &path[kerneldirlen], false, false, true);
|
||||
if (ret == 0) {
|
||||
log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]);
|
||||
install_firmware(mod);
|
||||
} else {
|
||||
log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
|
||||
}
|
||||
kmod_module_unref(mod);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int install_module(struct kmod_module *mod)
|
||||
{
|
||||
int ret = 0;
|
||||
struct kmod_list *itr;
|
||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
|
||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modpre = NULL;
|
||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modpost = NULL;
|
||||
const char *path = NULL;
|
||||
const char *name = NULL;
|
||||
|
||||
@@ -1278,23 +1309,12 @@ static int install_module(struct kmod_module *mod)
|
||||
install_firmware(mod);
|
||||
|
||||
modlist = kmod_module_get_dependencies(mod);
|
||||
kmod_list_foreach(itr, modlist) {
|
||||
mod = kmod_module_get_module(itr);
|
||||
path = kmod_module_get_path(mod);
|
||||
ret = install_dependent_modules(modlist);
|
||||
|
||||
name = kmod_module_get_name(mod);
|
||||
if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) {
|
||||
kmod_module_unref(mod);
|
||||
continue;
|
||||
}
|
||||
ret = dracut_install(path, &path[kerneldirlen], false, false, true);
|
||||
if (ret == 0) {
|
||||
log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]);
|
||||
install_firmware(mod);
|
||||
} else {
|
||||
log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
|
||||
}
|
||||
kmod_module_unref(mod);
|
||||
if (ret == 0) {
|
||||
ret = kmod_module_get_softdeps(mod, &modpre, &modpost);
|
||||
if (ret == 0)
|
||||
ret = install_dependent_modules(modpre);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -1394,6 +1414,7 @@ static int install_modules(int argc, char **argv)
|
||||
const char *abskpath = NULL;
|
||||
char *p;
|
||||
int i;
|
||||
int modinst = 0;
|
||||
|
||||
ctx = kmod_new(kerneldir, NULL);
|
||||
abskpath = kmod_get_dirname(ctx);
|
||||
@@ -1439,12 +1460,11 @@ static int install_modules(int argc, char **argv)
|
||||
for (i = 0; i < argc; i++) {
|
||||
int r = 0;
|
||||
int ret = -1;
|
||||
|
||||
log_debug("Handle module '%s'", argv[i]);
|
||||
|
||||
if (argv[i][0] == '/') {
|
||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
|
||||
_cleanup_free_ const char *modname = NULL;
|
||||
_cleanup_free_ const char *modname = NULL;
|
||||
|
||||
r = kmod_module_new_from_path(ctx, argv[i], &mod_o);
|
||||
if (r < 0) {
|
||||
@@ -1498,6 +1518,7 @@ static int install_modules(int argc, char **argv)
|
||||
return -ENOENT;
|
||||
};
|
||||
ret = ( ret == 0 ? 0 : r );
|
||||
modinst = 1;
|
||||
}
|
||||
} else if (argv[i][0] == '=') {
|
||||
_cleanup_free_ char *path1 = NULL, *path2 = NULL, *path3 = NULL;
|
||||
@@ -1530,7 +1551,7 @@ static int install_modules(int argc, char **argv)
|
||||
|
||||
for (FTSENT *ftsent = fts_read(fts); ftsent != NULL; ftsent = fts_read(fts)) {
|
||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
|
||||
_cleanup_free_ const char *modname = NULL;
|
||||
_cleanup_free_ const char *modname = NULL;
|
||||
|
||||
if((ftsent->fts_info == FTS_D) && !check_module_path(ftsent->fts_accpath)) {
|
||||
fts_set(fts, ftsent, FTS_SKIP);
|
||||
@@ -1592,6 +1613,7 @@ static int install_modules(int argc, char **argv)
|
||||
return -ENOENT;
|
||||
};
|
||||
ret = ( ret == 0 ? 0 : r );
|
||||
modinst = 1;
|
||||
}
|
||||
}
|
||||
if (errno) {
|
||||
@@ -1599,7 +1621,7 @@ static int install_modules(int argc, char **argv)
|
||||
}
|
||||
} else {
|
||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
|
||||
char *modname = argv[i];
|
||||
char *modname = argv[i];
|
||||
|
||||
if (endswith(modname, ".ko")) {
|
||||
int len = strlen(modname);
|
||||
@@ -1638,10 +1660,11 @@ static int install_modules(int argc, char **argv)
|
||||
return -ENOENT;
|
||||
};
|
||||
ret = ( ret == 0 ? 0 : r );
|
||||
modinst = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((ret != 0) && (!arg_optional)) {
|
||||
if ((modinst != 0) && (ret != 0) && (!arg_optional)) {
|
||||
if (!arg_silent)
|
||||
log_error("ERROR: installing '%s'", argv[i]);
|
||||
return EXIT_FAILURE;
|
||||
|
@@ -167,7 +167,7 @@ int safe_atoi(const char *s, int *ret_i);
|
||||
int safe_atollu(const char *s, unsigned long long *ret_u);
|
||||
int safe_atolli(const char *s, long long int *ret_i);
|
||||
|
||||
#if __WORDSIZE == 32
|
||||
#if LONG_MAX == INT_MAX
|
||||
static inline int safe_atolu(const char *s, unsigned long *ret_u) {
|
||||
assert_cc(sizeof(unsigned long) == sizeof(unsigned));
|
||||
return safe_atou(s, (unsigned*) ret_u);
|
||||
|
54
logtee.c
Normal file
54
logtee.c
Normal file
@@ -0,0 +1,54 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define BUFLEN 4096
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int fd;
|
||||
int len, slen;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: %s <file>\n", argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if (fd == -1) {
|
||||
perror("open");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fprintf(stderr, "Logging to %s: ", argv[1]);
|
||||
|
||||
slen = 0;
|
||||
|
||||
do {
|
||||
len = splice(STDIN_FILENO, NULL, fd, NULL,
|
||||
BUFLEN, SPLICE_F_MOVE);
|
||||
|
||||
if (len < 0) {
|
||||
if (errno == EAGAIN)
|
||||
continue;
|
||||
perror("tee");
|
||||
exit(EXIT_FAILURE);
|
||||
} else
|
||||
if (len == 0)
|
||||
break;
|
||||
slen += len;
|
||||
if ((slen/BUFLEN) > 0) {
|
||||
fprintf(stderr, ".");
|
||||
}
|
||||
slen = slen % BUFLEN;
|
||||
|
||||
} while (1);
|
||||
close(fd);
|
||||
fprintf(stderr, "\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
@@ -34,11 +34,17 @@ OPTIONS
|
||||
**-k, --kver** _<kernel version>_::
|
||||
inspect the initramfs of <kernel version>.
|
||||
|
||||
**-m, --mod**::
|
||||
list dracut modules included of the initramfs image.
|
||||
|
||||
**--unpack**::
|
||||
unpack the initramfs to the current directory, instead of displaying the contents.
|
||||
If optional filenames are given, will only unpack specified files, else the whole image will be unpacked.
|
||||
Won't unpack anything from early cpio part.
|
||||
|
||||
**--unpackearly**::
|
||||
unpack the early microcode initramfs to the current directory, instead of displaying the contents.
|
||||
Same as --unpack, but only unpack files from early cpio part.
|
||||
|
||||
**-v, --verbose**::
|
||||
unpack verbosely
|
||||
|
32
lsinitrd.sh
32
lsinitrd.sh
@@ -28,7 +28,10 @@ usage()
|
||||
echo "-m, --mod list modules."
|
||||
echo "-f, --file <filename> print the contents of <filename>."
|
||||
echo "--unpack unpack the initramfs, instead of displaying the contents."
|
||||
echo " If optional filenames are given, will only unpack specified files,"
|
||||
echo " else the whole image will be unpacked. Won't unpack anything from early cpio part."
|
||||
echo "--unpackearly unpack the early microcode part of the initramfs."
|
||||
echo " Same as --unpack, but only unpack files from early cpio part."
|
||||
echo "-v, --verbose unpack verbosely."
|
||||
echo "-k, --kver <kernel version> inspect the initramfs of <kernel version>."
|
||||
echo
|
||||
@@ -159,8 +162,15 @@ list_files()
|
||||
|
||||
unpack_files()
|
||||
{
|
||||
$CAT "$image" 2>/dev/null | cpio -id --quiet $verbose
|
||||
((ret+=$?))
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
for f in "${!filenames[@]}"; do
|
||||
$CAT "$image" 2>/dev/null | cpio -id --quiet $verbose $f
|
||||
((ret+=$?))
|
||||
done
|
||||
else
|
||||
$CAT "$image" 2>/dev/null | cpio -id --quiet $verbose
|
||||
((ret+=$?))
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +185,10 @@ case $bin in
|
||||
CAT="cat --"
|
||||
is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2>/dev/null)
|
||||
if [[ "$is_early" ]]; then
|
||||
if [[ -n "$unpackearly" ]]; then
|
||||
if [[ -n "$unpack" ]]; then
|
||||
# should use --unpackearly for early CPIO
|
||||
:
|
||||
elif [[ -n "$unpackearly" ]]; then
|
||||
unpack_files
|
||||
elif (( ${#filenames[@]} > 0 )); then
|
||||
extract_files
|
||||
@@ -219,7 +232,7 @@ case $bin in
|
||||
$'\x89'LZO$'\0'*)
|
||||
CAT="lzop -d -c"
|
||||
;;
|
||||
$'0xFD2FB528'*)
|
||||
$'\x28\xB5\x2F\xFD'*)
|
||||
CAT="zstd -d -c"
|
||||
;;
|
||||
*)
|
||||
@@ -241,6 +254,17 @@ if [[ $SKIP ]]; then
|
||||
CAT=skipcpio
|
||||
fi
|
||||
|
||||
if (( ${#filenames[@]} > 1 )); then
|
||||
TMPFILE="$(mktemp -t --suffix=.cpio lsinitrd.XXXXXX)"
|
||||
$CAT "$image" 2>/dev/null > $TMPFILE
|
||||
trap "rm -f '$TMPFILE'" EXIT
|
||||
pre_decompress()
|
||||
{
|
||||
cat $TMPFILE
|
||||
}
|
||||
CAT=pre_decompress
|
||||
fi
|
||||
|
||||
ret=0
|
||||
|
||||
if [[ -n "$unpack" ]]; then
|
||||
|
@@ -18,7 +18,7 @@ DESCRIPTION
|
||||
version <kernel-version> by calling *dracut*.
|
||||
|
||||
[IMPORTANT]
|
||||
This version of mkinitrd is provided for compability with older
|
||||
This version of mkinitrd is provided for compatibility with older
|
||||
versions of mkinitrd. If a more fine grained control over the
|
||||
resulting image is needed, *dracut* should be called directly.
|
||||
|
||||
@@ -30,7 +30,7 @@ OPTIONS
|
||||
**-k** _<kernel_list>_::
|
||||
List of kernel images for which initrd files are created (relative
|
||||
to _boot_dir_), Image name should begin with the following string,
|
||||
defaults to _vmlinux_ on ppc/ppc64, _image_ on s390/s390x and _vmlinuz_
|
||||
defaults to _vmlinux_ on ppc/ppc64, _image_ on s390/s390x and _vmlinuz_
|
||||
for everything else.
|
||||
|
||||
**-i** _<initrd_list>_::
|
||||
@@ -51,7 +51,7 @@ OPTIONS
|
||||
|
||||
**-d** _<root_device>_::
|
||||
Root device, defaults to the device from which the root_dir is
|
||||
mounted; overwrites the rootdev enviroment variable if set
|
||||
mounted; overwrites the rootdev environment variable if set
|
||||
|
||||
**-s** _<size>_::
|
||||
Add splash animation and bootscreen to initrd.
|
||||
|
29
modules.d/00warpclock/module-setup.sh
Normal file
29
modules.d/00warpclock/module-setup.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
# hwclock does not exist on S390(x), bail out silently then
|
||||
local _arch=$(uname -m)
|
||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] && return 1
|
||||
|
||||
[ -e /etc/localtime -a -e /etc/adjtime ] || return 1
|
||||
require_binaries /sbin/hwclock || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst /usr/share/zoneinfo/UTC
|
||||
inst /etc/localtime
|
||||
inst /etc/adjtime
|
||||
inst_hook pre-trigger 00 "$moddir/warpclock.sh"
|
||||
inst /sbin/hwclock
|
||||
}
|
9
modules.d/00warpclock/warpclock.sh
Normal file
9
modules.d/00warpclock/warpclock.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
if test -e /etc/adjtime ; then
|
||||
while read line ; do
|
||||
if test "$line" = LOCAL ; then
|
||||
hwclock --systz
|
||||
fi
|
||||
done < /etc/adjtime
|
||||
fi
|
@@ -16,12 +16,27 @@ installkernel() {
|
||||
if [[ -f "${srcmods}/modules.fips" ]]; then
|
||||
_fipsmodules="$(cat "${srcmods}/modules.fips")"
|
||||
else
|
||||
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 authenc authencesn blowfish camellia cast6 cbc ccm "
|
||||
_fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg "
|
||||
_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 "
|
||||
_fipsmodules+="aes_s390 des_s390 prng sha256_s390 sha_common des_check_key ghash_s390 sha1_s390 sha512_s390 cmac authenc "
|
||||
_fipsmodules=""
|
||||
|
||||
# Hashes:
|
||||
_fipsmodules+="sha1 sha224 sha256 sha384 sha512 "
|
||||
_fipsmodules+="sha3-224 sha3-256 sha3-384 sha3-512 "
|
||||
_fipsmodules+="crc32c crct10dif ghash "
|
||||
|
||||
# Ciphers:
|
||||
_fipsmodules+="cipher_null des3_ede aes "
|
||||
|
||||
# Modes/templates:
|
||||
_fipsmodules+="ecb cbc ctr xts gcm ccm authenc hmac cmac "
|
||||
|
||||
# Compression algs:
|
||||
_fipsmodules+="deflate lzo zlib "
|
||||
|
||||
# PRNG algs:
|
||||
_fipsmodules+="ansi_cprng "
|
||||
|
||||
# Misc:
|
||||
_fipsmodules+="aead cryptomgr tcrypt crypto_user "
|
||||
fi
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
@@ -41,14 +56,8 @@ install() {
|
||||
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
|
||||
inst_script "$moddir/fips.sh" /sbin/fips.sh
|
||||
|
||||
inst_multiple sha512hmac rmmod insmod mount uname umount fipscheck
|
||||
inst_multiple sha512hmac rmmod insmod mount uname umount
|
||||
|
||||
inst_libdir_file libsoftokn3.so libsoftokn3.so \
|
||||
libsoftokn3.chk libfreebl3.so libfreebl3.chk \
|
||||
libssl.so 'hmaccalc/sha512hmac.hmac' libssl.so.10 \
|
||||
libfreeblpriv3.so libfreeblpriv3.chk
|
||||
|
||||
inst_multiple -o prelink
|
||||
inst_simple /etc/system-fips
|
||||
[ -c ${initdir}/dev/random ] || mknod ${initdir}/dev/random c 1 8 \
|
||||
|| {
|
||||
|
@@ -38,13 +38,12 @@ install() {
|
||||
|
||||
ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target"
|
||||
|
||||
local VERSION=""
|
||||
local PRETTY_NAME=""
|
||||
if [ -e /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
VERSION+=" "
|
||||
PRETTY_NAME+=" "
|
||||
else
|
||||
VERSION=""
|
||||
PRETTY_NAME=""
|
||||
[[ -n ${VERSION} ]] && VERSION+=" "
|
||||
[[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" "
|
||||
fi
|
||||
NAME=dracut
|
||||
ID=dracut
|
||||
|
@@ -1,32 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aesni-intel ghash_clmulni_intel"
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
for _mod in $_fipsmodules; do
|
||||
if instmods $_mod; then
|
||||
echo $_mod >> "${initdir}/etc/fipsmodules"
|
||||
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
return 0
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ install() {
|
||||
|
||||
for INCL in $($cmd "^include " $map | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
|
||||
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
|
||||
findkeymap $FN
|
||||
strstr "$KEYMAPS" "$FN" || findkeymap $FN
|
||||
done
|
||||
done
|
||||
done
|
||||
|
@@ -41,6 +41,12 @@ do_dhcp() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -e /run/NetworkManager/conf.d/10-dracut-dhclient.conf ]; then
|
||||
mkdir -p /run/NetworkManager/conf.d
|
||||
echo '[main]' > /run/NetworkManager/conf.d/10-dracut-dhclient.conf
|
||||
echo 'dhcp=dhclient' >>/run/NetworkManager/conf.d/10-dracut-dhclient.conf
|
||||
fi
|
||||
|
||||
while [ $_COUNT -lt $_DHCPRETRY ]; do
|
||||
info "Starting dhcp for interface $netif"
|
||||
dhclient "$@" \
|
||||
@@ -70,23 +76,25 @@ load_ipv6() {
|
||||
}
|
||||
|
||||
do_ipv6auto() {
|
||||
local ret
|
||||
load_ipv6
|
||||
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
|
||||
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
|
||||
ret=$?
|
||||
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
|
||||
return 0
|
||||
return $ret
|
||||
}
|
||||
|
||||
# Handle static ip configuration
|
||||
do_static() {
|
||||
strglobin $ip '*:*:*' && load_ipv6
|
||||
|
||||
if [ -z "$dev" ] && ! iface_has_carrier "$netif"; then
|
||||
if ! iface_has_carrier "$netif"; then
|
||||
warn "No carrier detected on interface $netif"
|
||||
return 1
|
||||
elif ! linkup "$netif"; then
|
||||
@@ -416,6 +424,8 @@ for p in $(getargs ip=); do
|
||||
do_dhcp -6 ;;
|
||||
auto6)
|
||||
do_ipv6auto ;;
|
||||
either6)
|
||||
do_ipv6auto || do_dhcp -6 ;;
|
||||
*)
|
||||
do_static ;;
|
||||
esac
|
93
modules.d/35network-legacy/module-setup.sh
Executable file
93
modules.d/35network-legacy/module-setup.sh
Executable file
@@ -0,0 +1,93 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
local _program
|
||||
|
||||
require_binaries ip dhclient sed awk grep || return 1
|
||||
require_any_binary arping arping2 || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _arch _i _dir
|
||||
inst_multiple ip dhclient sed awk grep
|
||||
|
||||
inst_multiple -o arping arping2
|
||||
strstr "$(arping 2>&1)" "ARPing 2" && mv "$initdir/bin/arping" "$initdir/bin/arping2"
|
||||
|
||||
inst_multiple -o ping ping6
|
||||
inst_multiple -o teamd teamdctl teamnl
|
||||
inst_simple /etc/libnl/classid
|
||||
inst_script "$moddir/ifup.sh" "/sbin/ifup"
|
||||
inst_script "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst_simple -H "/etc/dhclient.conf"
|
||||
cat "$moddir/dhclient.conf" >> "${initdir}/etc/dhclient.conf"
|
||||
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"
|
||||
inst_hook cmdline 97 "$moddir/parse-bridge.sh"
|
||||
inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
|
||||
inst_hook cleanup 10 "$moddir/kill-dhclient.sh"
|
||||
|
||||
# install all config files for teaming
|
||||
unset TEAM_MASTER
|
||||
unset TEAM_CONFIG
|
||||
unset TEAM_PORT_CONFIG
|
||||
unset HWADDR
|
||||
unset SUBCHANNELS
|
||||
for i in /etc/sysconfig/network-scripts/ifcfg-*; do
|
||||
[ -e "$i" ] || continue
|
||||
case "$i" in
|
||||
*~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
(
|
||||
. "$i"
|
||||
if ! [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] \
|
||||
&& [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
|
||||
if [ -n "$TEAM_CONFIG" ] && [ -n "$DEVICE" ]; then
|
||||
mkdir -p $initdir/etc/teamd
|
||||
printf -- "%s" "$TEAM_CONFIG" > "$initdir/etc/teamd/${DEVICE}.conf"
|
||||
elif [ -n "$TEAM_PORT_CONFIG" ]; then
|
||||
inst_simple "$i"
|
||||
|
||||
HWADDR="$(echo $HWADDR | sed 'y/ABCDEF/abcdef/')"
|
||||
if [ -n "$HWADDR" ]; then
|
||||
ln_r "$i" "/etc/sysconfig/network-scripts/mac-${HWADDR}.conf"
|
||||
fi
|
||||
|
||||
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
|
||||
if [ -n "$SUBCHANNELS" ]; then
|
||||
ln_r "$i" "/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
)
|
||||
done
|
||||
|
||||
_arch=$(uname -m)
|
||||
|
||||
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
|
||||
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -76,6 +76,7 @@ for p in $(getargs ip=); do
|
||||
die "Sorry, automatic calculation of netmask is not yet supported"
|
||||
;;
|
||||
auto6);;
|
||||
either6);;
|
||||
dhcp|dhcp6|on|any) \
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
||||
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
|
52
modules.d/35network-manager/module-setup.sh
Executable file
52
modules.d/35network-manager/module-setup.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
local _program
|
||||
|
||||
require_binaries sed grep || return 1
|
||||
|
||||
# do not add this module by default
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _nm_version
|
||||
|
||||
_nm_version=$(NetworkManager --version)
|
||||
|
||||
inst_multiple sed grep
|
||||
|
||||
inst NetworkManager
|
||||
inst /usr/libexec/nm-initrd-generator
|
||||
inst_multiple -o teamd dhclient
|
||||
inst_hook cmdline 99 "$moddir/nm-config.sh"
|
||||
inst_hook initqueue/settled 99 "$moddir/nm-run.sh"
|
||||
inst_rules 85-nm-unmanaged.rules
|
||||
inst_libdir_file "NetworkManager/$_nm_version/libnm-device-plugin-team.so"
|
||||
|
||||
if [[ -x "$initdir/usr/sbin/dhclient" ]]; then
|
||||
inst /usr/libexec/nm-dhcp-helper
|
||||
elif ! [[ -e "$initdir/etc/machine-id" ]]; then
|
||||
# The internal DHCP client silently fails if we
|
||||
# have no machine-id
|
||||
systemd-machine-id-setup --root="$initdir"
|
||||
fi
|
||||
|
||||
# We don't install the ifcfg files from the host automatically.
|
||||
# But if the user chooses to include them, we pull in the machinery to read them.
|
||||
if ! [[ -d "$initdir/etc/sysconfig/network-scripts" ]]; then
|
||||
inst_libdir_file "NetworkManager/$_nm_version/libnm-settings-plugin-ifcfg-rh.so"
|
||||
fi
|
||||
}
|
3
modules.d/35network-manager/nm-config.sh
Executable file
3
modules.d/35network-manager/nm-config.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
/usr/libexec/nm-initrd-generator -- $(getcmdline)
|
16
modules.d/35network-manager/nm-run.sh
Executable file
16
modules.d/35network-manager/nm-run.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
|
||||
/usr/sbin/NetworkManager --configure-and-quit=initrd --debug --log-level=trace
|
||||
else
|
||||
/usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
|
||||
fi
|
||||
|
||||
for _i in /sys/class/net/*/
|
||||
do
|
||||
state=/run/NetworkManager/devices/$(cat $_i/ifindex)
|
||||
grep -q managed=true $state 2>/dev/null || continue
|
||||
ifname=$(basename $_i)
|
||||
sed -n 's/root-path/new_root_path/p' <$state >/tmp/dhclient.$ifname.dhcpopts
|
||||
/sbin/netroot $ifname
|
||||
done
|
@@ -1,18 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
local _program
|
||||
|
||||
require_binaries ip dhclient sed awk grep || return 1
|
||||
require_any_binary arping arping2 || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo "kernel-network-modules"
|
||||
echo -n "kernel-network-modules "
|
||||
if ! dracut_module_included "network-legacy" && [ -x "/usr/libexec/nm-initrd-generator" ] ; then
|
||||
echo "network-manager"
|
||||
else
|
||||
echo "network-legacy"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -24,74 +19,10 @@ installkernel() {
|
||||
# called by dracut
|
||||
install() {
|
||||
local _arch _i _dir
|
||||
inst_multiple ip dhclient sed awk grep
|
||||
|
||||
inst_multiple -o arping arping2
|
||||
strstr "$(arping 2>&1)" "ARPing 2" && mv "$initdir/bin/arping" "$initdir/bin/arping2"
|
||||
|
||||
inst_multiple -o ping ping6
|
||||
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"
|
||||
inst_script "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst_simple "$moddir/net-lib.sh" "/lib/net-lib.sh"
|
||||
inst_simple -H "/etc/dhclient.conf"
|
||||
cat "$moddir/dhclient.conf" >> "${initdir}/etc/dhclient.conf"
|
||||
inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
|
||||
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
inst_hook cmdline 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"
|
||||
inst_hook cmdline 97 "$moddir/parse-bridge.sh"
|
||||
inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
|
||||
inst_hook cleanup 10 "$moddir/kill-dhclient.sh"
|
||||
|
||||
# install all config files for teaming
|
||||
unset TEAM_MASTER
|
||||
unset TEAM_CONFIG
|
||||
unset TEAM_PORT_CONFIG
|
||||
unset HWADDR
|
||||
unset SUBCHANNELS
|
||||
for i in /etc/sysconfig/network-scripts/ifcfg-*; do
|
||||
[ -e "$i" ] || continue
|
||||
case "$i" in
|
||||
*~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
(
|
||||
. "$i"
|
||||
if ! [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] \
|
||||
&& [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
|
||||
if [ -n "$TEAM_CONFIG" ] && [ -n "$DEVICE" ]; then
|
||||
mkdir -p $initdir/etc/teamd
|
||||
printf -- "%s" "$TEAM_CONFIG" > "$initdir/etc/teamd/${DEVICE}.conf"
|
||||
elif [ -n "$TEAM_PORT_CONFIG" ]; then
|
||||
inst_simple "$i"
|
||||
|
||||
HWADDR="$(echo $HWADDR | sed 'y/ABCDEF/abcdef/')"
|
||||
if [ -n "$HWADDR" ]; then
|
||||
ln_r "$i" "/etc/sysconfig/network-scripts/mac-${HWADDR}.conf"
|
||||
fi
|
||||
|
||||
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
|
||||
if [ -n "$SUBCHANNELS" ]; then
|
||||
ln_r "$i" "/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
)
|
||||
done
|
||||
|
||||
_arch=$(uname -m)
|
||||
|
||||
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
|
||||
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
@@ -458,7 +458,7 @@ ip_to_var() {
|
||||
fi
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
# format: ip={dhcp|on|any|dhcp6|auto6}
|
||||
# format: ip={dhcp|on|any|dhcp6|auto6|either6}
|
||||
# or
|
||||
# ip=<ipv4-address> means anaconda-style static config argument cluster
|
||||
autoconf="$1"
|
||||
@@ -485,7 +485,7 @@ ip_to_var() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$2" = "dhcp" -o "$2" = "on" -o "$2" = "any" -o "$2" = "dhcp6" -o "$2" = "auto6" ]; then
|
||||
if [ "$2" = "dhcp" -o "$2" = "on" -o "$2" = "any" -o "$2" = "dhcp6" -o "$2" = "auto6" -o "$2" = "either6" ]; then
|
||||
# format: ip=<interface>:{dhcp|on|any|dhcp6|auto6}[:[<mtu>][:<macaddr>]]
|
||||
[ -n "$1" ] && dev="$1"
|
||||
[ -n "$2" ] && autoconf="$2"
|
||||
@@ -726,8 +726,12 @@ iface_has_carrier() {
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
if [ -n "$_no_carrier_flag" ]; then
|
||||
li=$(ip -o link show up dev $1)
|
||||
# NO-CARRIER flag was cleared
|
||||
strstr "$li" "NO-CARRIER" || return 0
|
||||
elif ! [ -e "$interface/carrier" ]; then
|
||||
# sysfs not available and "NO-CARRIER" not displayed
|
||||
return 0
|
||||
fi
|
||||
# double check the syscfs carrier flag
|
||||
[ -e "$interface/carrier" ] && [ "$(cat $interface/carrier)" = 1 ] && return 0
|
||||
|
@@ -46,7 +46,7 @@ if [ -z "$2" ]; then
|
||||
# we die. Otherwise we just warn
|
||||
if [ -z "$new_root_path" ] ; then
|
||||
[ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
|
||||
warn "No dhcp root-path received for '$BOOTDEV' trying other interfaces if available"
|
||||
warn "No dhcp root-path received for '$netif' trying other interfaces if available"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@@ -14,6 +14,7 @@ depends() {
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_binary sort
|
||||
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
|
||||
}
|
||||
|
||||
|
@@ -286,7 +286,10 @@ echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab
|
||||
echo "files /var/lib/dhclient" >> /run/initramfs/rwtab
|
||||
{
|
||||
cp /tmp/net.* /run/initramfs/
|
||||
cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/resolv.conf
|
||||
for i in /tmp/net.*.resolv.conf; do
|
||||
[ -f "$i" ] && cat "$i"
|
||||
done | sort -u > /run/initramfs/state/etc/resolv.conf
|
||||
[ -s /run/initramfs/state/etc/resolv.conf ] || rm -f /run/initramfs/state/etc/resolv.conf
|
||||
copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network-scripts
|
||||
cp /tmp/ifcfg-leases/* /run/initramfs/state/var/lib/dhclient
|
||||
} > /dev/null 2>&1
|
||||
|
@@ -31,7 +31,7 @@ installkernel() {
|
||||
# as we could e.g. be in the installer; nokmsboot boot parameter will disable
|
||||
# loading of the driver if needed
|
||||
if [[ $hostonly ]]; then
|
||||
for i in /sys/bus/{pci/devices,soc/devices/soc?}/*/modalias; do
|
||||
for i in /sys/bus/{pci/devices,virtio/devices,soc/devices/soc?}/*/modalias; do
|
||||
[[ -e $i ]] || continue
|
||||
if hostonly="" dracut_instmods --silent -s "drm_crtc_init" -S "iw_handler_get_spy" $(<$i); then
|
||||
if strstr "$(modinfo -F filename $(<$i) 2>/dev/null)" radeon.ko; then
|
||||
@@ -40,6 +40,6 @@ installkernel() {
|
||||
fi
|
||||
done
|
||||
else
|
||||
dracut_instmods -s "drm_crtc_init" "=drivers/gpu/drm" "=drivers/staging"
|
||||
dracut_instmods -o -s "drm_crtc_init" "=drivers/gpu/drm" "=drivers/staging"
|
||||
fi
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@ pkglib_dir() {
|
||||
_dirs+=" /usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth"
|
||||
fi
|
||||
for _dir in $_dirs; do
|
||||
if [ -d $_dir ]; then
|
||||
if [ -x $_dir/plymouth-populate-initrd ]; then
|
||||
echo $_dir
|
||||
return
|
||||
fi
|
||||
|
0
modules.d/80lvmmerge/README.md
Executable file → Normal file
0
modules.d/80lvmmerge/README.md
Executable file → Normal file
@@ -12,7 +12,7 @@ crypttab_contains() {
|
||||
strstr "${l##luks-}" "${luks##luks-}" && return 0
|
||||
strstr "$d" "${luks##luks-}" && return 0
|
||||
if [ -n "$dev" ]; then
|
||||
for _dev in "$(devnames $d)"; do
|
||||
for _dev in $(devnames $d); do
|
||||
[ "$dev" -ef "$_dev" ] && return 0
|
||||
done
|
||||
fi
|
||||
|
@@ -165,12 +165,15 @@ fi
|
||||
|
||||
if [ $ask_passphrase -ne 0 ]; then
|
||||
luks_open="$(command -v cryptsetup) $cryptsetupopts luksOpen"
|
||||
_timeout=$(getargs "rd.luks.timeout")
|
||||
_timeout=${_timeout:-0}
|
||||
ask_for_password --ply-tries 5 \
|
||||
--ply-cmd "$luks_open -T1 $device $luksname" \
|
||||
--ply-prompt "Password ($device)" \
|
||||
--tty-tries 1 \
|
||||
--tty-cmd "$luks_open -T5 $device $luksname"
|
||||
--tty-cmd "$luks_open -T5 -t $_timeout $device $luksname"
|
||||
unset luks_open
|
||||
unset _timeout
|
||||
fi
|
||||
|
||||
unset device luksname luksfile
|
||||
|
@@ -27,6 +27,7 @@ installkernel() {
|
||||
hostonly="" instmods drbg
|
||||
arch=$(arch)
|
||||
[[ $arch == x86_64 ]] && arch=x86
|
||||
[[ $arch == s390x ]] && arch=s390
|
||||
instmods dm_crypt =crypto =drivers/crypto =arch/$arch/crypto
|
||||
}
|
||||
|
||||
|
@@ -35,6 +35,7 @@ else
|
||||
echo 'ACTION!="add|change", GOTO="luks_end"'
|
||||
} > /etc/udev/rules.d/70-luks.rules.new
|
||||
|
||||
PARTUUID=$(getargs rd.luks.partuuid -d rd_LUKS_PARTUUID)
|
||||
SERIAL=$(getargs rd.luks.serial -d rd_LUKS_SERIAL)
|
||||
LUKS=$(getargs rd.luks.uuid -d rd_LUKS_UUID)
|
||||
tout=$(getarg rd.luks.key.tout)
|
||||
@@ -45,7 +46,39 @@ else
|
||||
done < /etc/crypttab
|
||||
fi
|
||||
|
||||
if [ -n "$SERIAL" ]; then
|
||||
if [ -n "$PARTUUID" ]; then
|
||||
for uuid in $PARTUUID; do
|
||||
|
||||
uuid=${uuid##luks-}
|
||||
if luksname=$(_cryptgetargsname "rd.luks.name=$uuid="); then
|
||||
luksname="${luksname#$uuid=}"
|
||||
else
|
||||
luksname="luks-$uuid"
|
||||
fi
|
||||
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
{
|
||||
printf -- 'ENV{ID_PART_ENTRY_UUID}=="*%s*", ' "$uuid"
|
||||
printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
|
||||
printf -- '--name cryptroot-ask-%%k %s ' "$(command -v cryptroot-ask)"
|
||||
printf -- '$env{DEVNAME} %s %s"\n' "$luksname" "$tout"
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
else
|
||||
luksname=$(dev_unit_name "$luksname")
|
||||
luksname="$(str_replace "$luksname" '\' '\\')"
|
||||
|
||||
if ! crypttab_contains "$uuid"; then
|
||||
{
|
||||
printf -- 'ENV{ID_PART_ENTRY_UUID}=="*%s*", ' "$uuid"
|
||||
printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
|
||||
printf -- '--name systemd-cryptsetup-%%k %s start ' "$(command -v systemctl)"
|
||||
printf -- 'systemd-cryptsetup@%s.service"\n' "$luksname"
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
elif [ -n "$SERIAL" ]; then
|
||||
for serialid in $SERIAL; do
|
||||
|
||||
serialid=${serialid##luks-}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -L /run/rootfsbase ] && [ -d /run/initramfs/live/updates -o -d /updates ]; then
|
||||
if [ -h /dev/root ] && [ -d /run/initramfs/live/updates -o -d /updates ]; then
|
||||
info "Applying updates to live image..."
|
||||
mount -o bind /run $NEWROOT/run
|
||||
# avoid overwriting symlinks (e.g. /lib -> /usr/lib) with directories
|
||||
|
@@ -18,12 +18,12 @@ fi
|
||||
case "$liveroot" in
|
||||
live:LABEL=*|LABEL=*) \
|
||||
root="${root#live:}"
|
||||
root="$(echo $root | sed 's,/,\\x2f,g')"
|
||||
root="${root//\//\\x2f}"
|
||||
root="live:/dev/disk/by-label/${root#LABEL=}"
|
||||
rootok=1 ;;
|
||||
live:CDLABEL=*|CDLABEL=*) \
|
||||
root="${root#live:}"
|
||||
root="$(echo $root | sed 's,/,\\x2f,g')"
|
||||
root="${root//\//\\x2f}"
|
||||
root="live:/dev/disk/by-label/${root#CDLABEL=}"
|
||||
rootok=1 ;;
|
||||
live:UUID=*|UUID=*) \
|
||||
@@ -54,8 +54,10 @@ GENERATOR_DIR="$2"
|
||||
[ -z "$GENERATOR_DIR" ] && exit 1
|
||||
[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR"
|
||||
|
||||
getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
|
||||
getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"
|
||||
[ -e /xor_overlayfs ] && xor_overlayfs="yes"
|
||||
[ -e /xor_readonly ] && xor_readonly="--readonly"
|
||||
ROOTFLAGS="$(getarg rootflags)"
|
||||
{
|
||||
echo "[Unit]"
|
||||
@@ -64,7 +66,12 @@ ROOTFLAGS="$(getarg rootflags)"
|
||||
echo "Where=/sysroot"
|
||||
if [ "$overlayfs$xor_overlayfs" = "yes" ]; then
|
||||
echo "What=LiveOS_rootfs"
|
||||
echo "Options=${ROOTFLAGS},lowerdir=/run/rootfsbase,upperdir=/run/overlayfs,workdir=/run/ovlwork"
|
||||
if [ "$readonly_overlay$xor_readonly" = "--readonly" ]; then
|
||||
ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
|
||||
else
|
||||
ovlfs=lowerdir=/run/rootfsbase
|
||||
fi
|
||||
echo "Options=${ROOTFLAGS},${ovlfs},upperdir=/run/overlayfs,workdir=/run/ovlwork"
|
||||
echo "Type=overlay"
|
||||
_dev=LiveOS_rootfs
|
||||
else
|
||||
|
@@ -109,15 +109,15 @@ do_live_overlay() {
|
||||
|
||||
if [ -z "$overlay" ]; then
|
||||
pathspec="/${live_dir}/overlay-$l-$u"
|
||||
elif ( echo $overlay | grep -q ":" ); then
|
||||
elif strstr $overlay ":"; then
|
||||
# pathspec specified, extract
|
||||
pathspec=$( echo $overlay | sed -e 's/^.*://' )
|
||||
pathspec=${overlay##*:}
|
||||
fi
|
||||
|
||||
if [ -z "$pathspec" -o "$pathspec" = "auto" ]; then
|
||||
pathspec="/${live_dir}/overlay-$l-$u"
|
||||
fi
|
||||
devspec=$( echo $overlay | sed -e 's/:.*$//' )
|
||||
devspec=${overlay%%:*}
|
||||
|
||||
# need to know where to look for the overlay
|
||||
if [ -z "$setup" -a -n "$devspec" -a -n "$pathspec" -a -n "$overlay" ]; then
|
||||
@@ -137,7 +137,7 @@ do_live_overlay() {
|
||||
fi
|
||||
if [ -n "$overlayfs" ]; then
|
||||
unset -v overlayfs
|
||||
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="yes"
|
||||
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit=":>/xor_overlayfs;"
|
||||
fi
|
||||
setup="yes"
|
||||
else
|
||||
@@ -146,10 +146,10 @@ do_live_overlay() {
|
||||
[ -d /run/initramfs/overlayfs/ovlwork ]; then
|
||||
ln -s /run/initramfs/overlayfs/overlayfs /run/overlayfs$opt
|
||||
ln -s /run/initramfs/overlayfs/ovlwork /run/ovlwork$opt
|
||||
if [ -z "$overlayfs" ]; then
|
||||
overlayfs="yes"
|
||||
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="yes"
|
||||
if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
reloadsysrootmountunit=":>/xor_overlayfs;"
|
||||
fi
|
||||
overlayfs="required"
|
||||
setup="yes"
|
||||
fi
|
||||
fi
|
||||
@@ -157,19 +157,24 @@ do_live_overlay() {
|
||||
[ -d /run/initramfs/overlayfs$pathspec/../ovlwork ]; then
|
||||
ln -s /run/initramfs/overlayfs$pathspec /run/overlayfs$opt
|
||||
ln -s /run/initramfs/overlayfs$pathspec/../ovlwork /run/ovlwork$opt
|
||||
if [ -z "$overlayfs" ]; then
|
||||
overlayfs="yes"
|
||||
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="yes"
|
||||
if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
reloadsysrootmountunit=":>/xor_overlayfs;"
|
||||
fi
|
||||
overlayfs="required"
|
||||
setup="yes"
|
||||
fi
|
||||
fi
|
||||
if [ -n "$overlayfs" ]; then
|
||||
modprobe overlay
|
||||
if [ $? != 0 ]; then
|
||||
if [ "$overlayfs" = required ]; then
|
||||
die "OverlayFS is required but not available."
|
||||
exit 1
|
||||
fi
|
||||
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit=":>/xor_overlayfs;"
|
||||
m='OverlayFS is not available; using temporary Device-mapper overlay.'
|
||||
info $m
|
||||
unset -v overlayfs setup
|
||||
[ -n "$reloadsysrootmountunit" ] && unset -v reloadsysrootmountunit
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -181,7 +186,7 @@ do_live_overlay() {
|
||||
m=' Unable to find a persistent overlay; using a temporary one.'
|
||||
m="$m"$'\n All root filesystem changes will be lost on shutdown.'
|
||||
m="$m"$'\n Press [Enter] to continue.'
|
||||
echo -e "\n\n\n\n${m}\n\n\n" > /dev/kmsg
|
||||
printf "\n\n\n\n${m}\n\n\n" > /dev/kmsg
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
if type plymouth >/dev/null 2>&1 && plymouth --ping ; then
|
||||
if getargbool 0 rhgb || getargbool 0 splash ; then
|
||||
@@ -203,6 +208,11 @@ do_live_overlay() {
|
||||
if [ -n "$overlayfs" ]; then
|
||||
mkdir -m 0755 /run/overlayfs
|
||||
mkdir -m 0755 /run/ovlwork
|
||||
if [ -n "$readonly_overlay" ] && ! [ -h /run/overlayfs-r ]; then
|
||||
info "No persistent overlay found."
|
||||
unset -v readonly_overlay
|
||||
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="${reloadsysrootmountunit}:>/xor_readonly;"
|
||||
fi
|
||||
else
|
||||
dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((overlay_size*1024)) 2> /dev/null
|
||||
if [ -n "$setup" -a -n "$readonly_overlay" ]; then
|
||||
@@ -250,14 +260,13 @@ do_live_overlay() {
|
||||
echo 0 $sz snapshot $base $over PO 8 | dmsetup create live-rw
|
||||
fi
|
||||
|
||||
# Create a device that always points to a ro base image
|
||||
if [ -n "$overlayfs" ]; then
|
||||
BASE_LOOPDUP=$(losetup -f --show -r $BASE_LOOPDEV)
|
||||
echo 0 $sz linear $BASE_LOOPDUP 0 | dmsetup create --readonly live-base
|
||||
else
|
||||
# Create a device for the ro base of overlayed file systems.
|
||||
if [ -z "$overlayfs" ]; then
|
||||
echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create --readonly live-base
|
||||
fi
|
||||
ln -s $BASE_LOOPDEV /dev/live-base
|
||||
}
|
||||
# end do_live_overlay()
|
||||
|
||||
# we might have a genMinInstDelta delta file for anaconda to take advantage of
|
||||
if [ -e /run/initramfs/live/${live_dir}/osmin.img ]; then
|
||||
@@ -291,10 +300,21 @@ if [ -e "$SQUASHED" ]; then
|
||||
mkdir -m 0755 -p /run/initramfs/squashfs
|
||||
mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /run/initramfs/squashfs
|
||||
|
||||
if [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
|
||||
FSIMG="/run/initramfs/squashfs/LiveOS/rootfs.img"
|
||||
elif [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
|
||||
FSIMG="/run/initramfs/squashfs/LiveOS/ext3fs.img"
|
||||
if [ -d /run/initramfs/squashfs/LiveOS ]; then
|
||||
if [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
|
||||
FSIMG="/run/initramfs/squashfs/LiveOS/rootfs.img"
|
||||
elif [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
|
||||
FSIMG="/run/initramfs/squashfs/LiveOS/ext3fs.img"
|
||||
fi
|
||||
elif [ -d /run/initramfs/squashfs/proc ]; then
|
||||
FSIMG=$SQUASHED
|
||||
if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
reloadsysrootmountunit=":>/xor_overlayfs;"
|
||||
fi
|
||||
overlayfs="required"
|
||||
else
|
||||
die "Failed to find a root filesystem in $SQUASHED."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# we might have an embedded fs image to use as rootfs (uncompressed live)
|
||||
@@ -312,8 +332,8 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$FSIMG" ] ; then
|
||||
if [ -n "$writable_fsimg" ] ; then
|
||||
if [ -n "$FSIMG" ]; then
|
||||
if [ -n "$writable_fsimg" ]; then
|
||||
# mount the provided filesystem read/write
|
||||
echo "Unpacking live filesystem (may take some time)" > /dev/kmsg
|
||||
mkdir -m 0755 /run/initramfs/fsimg/
|
||||
@@ -336,9 +356,13 @@ if [ -n "$FSIMG" ] ; then
|
||||
setup=yes
|
||||
fi
|
||||
fi
|
||||
BASE_LOOPDEV=$(losetup -f --show $opt $FSIMG)
|
||||
sz=$(blockdev --getsz $BASE_LOOPDEV)
|
||||
if [ "$setup" == rw ]; then
|
||||
if [ "$FSIMG" = "$SQUASHED" ]; then
|
||||
BASE_LOOPDEV=$SQUASHED_LOOPDEV
|
||||
else
|
||||
BASE_LOOPDEV=$(losetup -f --show $opt $FSIMG)
|
||||
sz=$(blockdev --getsz $BASE_LOOPDEV)
|
||||
fi
|
||||
if [ "$setup" = rw ]; then
|
||||
echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create live-rw
|
||||
else
|
||||
# Add a DM snapshot or OverlayFS for writes.
|
||||
@@ -346,8 +370,6 @@ if [ -n "$FSIMG" ] ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -e "$SQUASHED" ] && [ -z "$overlayfs" ] && umount -l /run/initramfs/squashfs
|
||||
|
||||
if [ -b "$OSMIN_LOOPDEV" ]; then
|
||||
# set up the devicemapper snapshot device, which will merge
|
||||
# the normal live fs image, and the delta, into a minimzied fs image
|
||||
@@ -355,7 +377,7 @@ if [ -b "$OSMIN_LOOPDEV" ]; then
|
||||
fi
|
||||
|
||||
if [ -n "$reloadsysrootmountunit" ]; then
|
||||
> /xor_overlayfs
|
||||
eval "$reloadsysrootmountunit"
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
|
||||
@@ -363,33 +385,33 @@ ROOTFLAGS="$(getarg rootflags)"
|
||||
|
||||
if [ -n "$overlayfs" ]; then
|
||||
mkdir -m 0755 /run/rootfsbase
|
||||
if [ -n "$reset_overlay" ] && [ -L /run/overlayfs ]; then
|
||||
if [ -n "$reset_overlay" ] && [ -h /run/overlayfs ]; then
|
||||
ovlfs=$(readlink /run/overlayfs)
|
||||
info "Resetting the OverlayFS overlay directory."
|
||||
rm -r -- ${ovlfs}/* ${ovlfs}/.* >/dev/null 2>&1
|
||||
fi
|
||||
if [ -n "$readonly_overlay" ]; then
|
||||
mkdir -m 0755 /run/rootfsbase-r
|
||||
mount -r $FSIMG /run/rootfsbase-r
|
||||
mount -t overlay LiveOS_rootfs-r -oro,lowerdir=/run/overlayfs-r:/run/rootfsbase-r /run/rootfsbase
|
||||
if [ -n "$readonly_overlay" ] && [ -h /run/overlayfs-r ]; then
|
||||
ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
|
||||
else
|
||||
mount -r $FSIMG /run/rootfsbase
|
||||
ovlfs=lowerdir=/run/rootfsbase
|
||||
fi
|
||||
mount -r $FSIMG /run/rootfsbase
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
#FIXME What to link to /dev/root? Is it even needed?
|
||||
printf 'mount -t overlay LiveOS_rootfs -o%s,%s %s\n' "$ROOTFLAGS" \
|
||||
'lowerdir=/run/rootfsbase,upperdir=/run/overlayfs,workdir=/run/ovlwork' \
|
||||
"$ovlfs",upperdir=/run/overlayfs,workdir=/run/ovlwork \
|
||||
"$NEWROOT" > $hookdir/mount/01-$$-live.sh
|
||||
fi
|
||||
else
|
||||
ln -s /dev/mapper/live-rw /dev/root
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
[ -n "$ROOTFLAGS" ] && ROOTFLAGS="-o $ROOTFLAGS"
|
||||
printf 'mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > $hookdir/mount/01-$$-live.sh
|
||||
fi
|
||||
ln -s $BASE_LOOPDEV /run/rootfsbase
|
||||
fi
|
||||
[ -e "$SQUASHED" ] && umount -l /run/initramfs/squashfs
|
||||
|
||||
ln -s null /dev/root
|
||||
|
||||
need_shutdown
|
||||
|
||||
exit 0
|
||||
|
||||
|
@@ -22,7 +22,7 @@ installkernel() {
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple umount dmsetup blkid dd losetup grep blockdev find
|
||||
inst_multiple umount dmsetup blkid dd losetup blockdev find
|
||||
inst_multiple -o checkisomd5
|
||||
inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
|
||||
inst_hook cmdline 31 "$moddir/parse-iso-scan.sh"
|
||||
|
@@ -20,12 +20,12 @@ modprobe -q loop
|
||||
case "$liveroot" in
|
||||
live:LABEL=*|LABEL=*) \
|
||||
root="${root#live:}"
|
||||
root="$(echo $root | sed 's,/,\\x2f,g')"
|
||||
root="${root//\//\\x2f}"
|
||||
root="live:/dev/disk/by-label/${root#LABEL=}"
|
||||
rootok=1 ;;
|
||||
live:CDLABEL=*|CDLABEL=*) \
|
||||
root="${root#live:}"
|
||||
root="$(echo $root | sed 's,/,\\x2f,g')"
|
||||
root="${root//\//\\x2f}"
|
||||
root="live:/dev/disk/by-label/${root#CDLABEL=}"
|
||||
rootok=1 ;;
|
||||
live:UUID=*|UUID=*) \
|
||||
@@ -57,6 +57,6 @@ info "root was $liveroot, is now $root"
|
||||
# make sure that init doesn't complain
|
||||
[ -z "$root" ] && root="live"
|
||||
|
||||
wait_for_dev -n /run/rootfsbase
|
||||
wait_for_dev -n /dev/root
|
||||
|
||||
return 0
|
||||
|
194
modules.d/90kernel-modules-extra/module-setup.sh
Executable file
194
modules.d/90kernel-modules-extra/module-setup.sh
Executable file
@@ -0,0 +1,194 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
#
|
||||
# Parses depmod configuration and calls instmods for out-of-tree kernel
|
||||
# modules found. Specifically, kernel modules inside directories that
|
||||
# come from the following places are included (if these kernel modules
|
||||
# are present in modules.dep):
|
||||
# - "search" configuration option;
|
||||
# - "override" configuration option (matching an exact file name constructed
|
||||
# by concatenating the provided directory and the kernel module name);
|
||||
# - "external" configuration option (if "external" is a part of "search"
|
||||
# configuration).
|
||||
# (See depmod.d(5) for details.)
|
||||
#
|
||||
# This module has the following variables available for configuration:
|
||||
# - "depmod_modules_dep" - Path to the modules.dep file
|
||||
# ("$srcmods/modules.dep" by default);
|
||||
# - "depmod_module_dir" - Directory containing kernel modules ("$srcmods"
|
||||
# by default);
|
||||
# - "depmod_configs" - array of depmod configuration paths to parse
|
||||
# (as supplied to depmod -C, ("/run/depmod.d/"
|
||||
# "/etc/depmod.d/" "/lib/depmod.d/") by default).
|
||||
installkernel()
|
||||
{
|
||||
: "${depmod_modules_dep:=$srcmods/modules.dep}"
|
||||
: "${depmod_module_dir:=$srcmods}"
|
||||
|
||||
[[ -f "${depmod_modules_dep}" ]] || return 0
|
||||
|
||||
# Message printers with custom prefix
|
||||
local mod_name="kernel-modules-extra"
|
||||
prinfo() { dinfo " ${mod_name}: $*"; }
|
||||
prdebug() { ddebug " ${mod_name}: $*"; }
|
||||
|
||||
# Escape a string for usage as a part of extended regular expression.
|
||||
# $1 - string to escape
|
||||
re_escape() {
|
||||
printf "%s" "$1" | sed 's/\([.+?^$\/\\|()\[]\|\]\)/\\\0/'
|
||||
}
|
||||
|
||||
local OLDIFS
|
||||
local cfg
|
||||
local cfgs=()
|
||||
local search_list=""
|
||||
local overrides=()
|
||||
local external_dirs=()
|
||||
local e f
|
||||
|
||||
|
||||
## Gathering and sorting configuration file list
|
||||
|
||||
[ -n "${depmod_configs[@]-}" ] \
|
||||
|| depmod_configs=(/run/depmod.d/ /etc/depmod.d/ /lib/depmod.d/)
|
||||
|
||||
for cfg in "${depmod_configs[@]}"; do
|
||||
[ -e "$cfg" ] || {
|
||||
prdebug "configuration source \"$cfg\" does not exist"
|
||||
continue
|
||||
}
|
||||
|
||||
# '/' is used as a separator between configuration name and
|
||||
# configuration path
|
||||
if [ -d "$cfg" ]; then
|
||||
for f in "$cfg/"*; do
|
||||
[[ -e "$f" && ! -d "$f" ]] || {
|
||||
prdebug "configuration source" \
|
||||
"\"$cfg\" is ignored" \
|
||||
"(directory or doesn't exist)"
|
||||
continue
|
||||
}
|
||||
cfgs+=("$(basename "$f")/$f")
|
||||
done
|
||||
else
|
||||
cfgs+=("$(basename "$cfg")/$cfg")
|
||||
fi
|
||||
done
|
||||
|
||||
OLDIFS="$IFS"
|
||||
IFS=$'\n'
|
||||
LANG=C cfgs=($(printf '%s\n' "${cfgs[@]}" \
|
||||
| sort -u -k1,1 -t '/' | cut -f 2- -d '/'))
|
||||
IFS="$OLDIFS"
|
||||
|
||||
|
||||
## Parse configurations
|
||||
|
||||
for cfg in "${cfgs[@]}"; do
|
||||
prdebug "parsing configuration file \"$cfg\""
|
||||
|
||||
local k v mod kverpat path
|
||||
while read -r k v; do
|
||||
case "$k" in
|
||||
search)
|
||||
search_list="$search_list $v"
|
||||
prdebug "$cfg: added \"$v\" to the list of" \
|
||||
"search directories"
|
||||
;;
|
||||
override) # module_name kver_pattern dir
|
||||
read -r mod kverpat path <<<"$v"
|
||||
|
||||
if [[ ! "$mod" || ! "$kverpat" || ! "$path" ]]
|
||||
then
|
||||
prinfo "$cfg: ignoring incorrect" \
|
||||
"override option: \"$k $v\""
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ '*' = "$kverpat" \
|
||||
|| "$kernel" =~ "$kverpat" ]]
|
||||
then
|
||||
overrides+=("${path}/${mod}")
|
||||
|
||||
prdebug "$cfg: added override" \
|
||||
"\"${path}/${mod}\""
|
||||
else
|
||||
prdebug "$cfg: override \"$v\" is" \
|
||||
"ignored since \"$kverpat\"" \
|
||||
"doesn't match \"$kernel\""
|
||||
fi
|
||||
;;
|
||||
external) # kverpat dir
|
||||
read -r kverpat path <<<"$v"
|
||||
|
||||
if [[ ! "$kverpat" || ! "$path" ]]; then
|
||||
prinfo "$cfg: ignoring incorrect" \
|
||||
"external option: \"$k $v\""
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ '*' = "$kverpat" \
|
||||
|| "$kernel" =~ "$kverpat" ]]
|
||||
then
|
||||
external_dirs+=("$path")
|
||||
|
||||
prdebug "$cfg: added external" \
|
||||
"directory \"$path\""
|
||||
else
|
||||
prdebug "$cfg: external directory" \
|
||||
"\"$path\" is ignored since" \
|
||||
"\"$kverpat\" doesn't match " \
|
||||
"\"$kernel\""
|
||||
fi
|
||||
;;
|
||||
'#'*|'') # comments and empty strings
|
||||
;;
|
||||
include|make_map_files) # ignored by depmod
|
||||
;;
|
||||
*)
|
||||
prinfo "$cfg: unknown depmod configuration" \
|
||||
"option \"$k $v\""
|
||||
;;
|
||||
esac
|
||||
done < "$cfg"
|
||||
done
|
||||
|
||||
# "updates built-in" is the default search list
|
||||
: "${search_list:=updates}"
|
||||
|
||||
|
||||
## Build a list of regular expressions for grepping modules.dep
|
||||
|
||||
local pathlist=()
|
||||
for f in "${overrides[@]}"; do
|
||||
pathlist+=("^$(re_escape "$f")")
|
||||
done
|
||||
|
||||
for f in $(printf "%s" "$search_list"); do
|
||||
# Ignoring builtin modules
|
||||
[ "built-in" != "$f" ] || continue
|
||||
|
||||
if [ "external" = "$f" ]; then
|
||||
for e in "${external_dirs[@]}"; do
|
||||
pathlist+=("$(re_escape "${e%/}")/[^:]+")
|
||||
done
|
||||
fi
|
||||
|
||||
pathlist+=("$(re_escape "${f%/}")/[^:]+")
|
||||
done
|
||||
|
||||
|
||||
## Filter modules.dep, canonicalise the resulting filenames and supply
|
||||
## them to instmods.
|
||||
|
||||
[ 0 -lt "${#pathlist[@]}" ] || return 0
|
||||
|
||||
printf "^%s\.ko(\.gz|\.bz2|\.xz)?:\n" "${pathlist[@]}" \
|
||||
| (LANG=C grep -E -o -f - -- "$depmod_modules_dep" || exit 0) \
|
||||
| tr -d ':' \
|
||||
| (cd "$depmod_module_dir" || exit; xargs -r realpath -e --) \
|
||||
| instmods || return 1
|
||||
|
||||
return 0
|
||||
}
|
@@ -2,6 +2,20 @@
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
find_kernel_modules_external () {
|
||||
local _OLDIFS
|
||||
local external_pattern="^/"
|
||||
|
||||
[[ -f "$srcmods/modules.dep" ]] || return 0
|
||||
|
||||
_OLDIFS=$IFS
|
||||
IFS=:
|
||||
while read a rest; do
|
||||
[[ $a =~ $external_pattern ]] || continue
|
||||
printf "%s\n" "$a"
|
||||
done < "$srcmods/modules.dep"
|
||||
IFS=$_OLDIFS
|
||||
}
|
||||
local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma'
|
||||
|
||||
if [[ -z $drivers ]]; then
|
||||
@@ -11,30 +25,36 @@ installkernel() {
|
||||
ohci-hcd ohci-pci \
|
||||
uhci-hcd \
|
||||
xhci-hcd xhci-pci xhci-plat-hcd \
|
||||
pinctrl-cherryview \
|
||||
"=drivers/pinctrl" \
|
||||
${NULL}
|
||||
|
||||
hostonly=$(optional_hostonly) instmods \
|
||||
"=drivers/hid" \
|
||||
"=drivers/tty/serial" \
|
||||
"=drivers/input/serio" \
|
||||
"=drivers/input/keyboard" \
|
||||
"=drivers/usb/storage" \
|
||||
"=drivers/pci/host" \
|
||||
${NULL}
|
||||
|
||||
instmods \
|
||||
yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
|
||||
atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \
|
||||
virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
|
||||
"=drivers/pcmcia" =ide nvme
|
||||
"=drivers/pcmcia" =ide nvme vmd nfit
|
||||
|
||||
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
|
||||
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
|
||||
# arm/aarch64 specific modules
|
||||
_blockfuncs+='|dw_mc_probe|dw_mci_pltfm_register'
|
||||
instmods \
|
||||
"=drivers/clk" \
|
||||
"=drivers/dma" \
|
||||
"=drivers/extcon" \
|
||||
"=drivers/gpio" \
|
||||
"=drivers/hwspinlock" \
|
||||
"=drivers/i2c/busses" \
|
||||
"=drivers/mfd" \
|
||||
"=drivers/mmc/core" \
|
||||
"=drivers/phy" \
|
||||
"=drivers/power" \
|
||||
"=drivers/regulator" \
|
||||
@@ -48,12 +68,14 @@ installkernel() {
|
||||
"=drivers/usb/misc" \
|
||||
"=drivers/usb/musb" \
|
||||
"=drivers/usb/phy" \
|
||||
"=drivers/scsi/hisi_sas" \
|
||||
"=drivers/scsi/hisi_sas" \
|
||||
${NULL}
|
||||
fi
|
||||
|
||||
dracut_instmods -o -s "${_blockfuncs}" "=drivers"
|
||||
|
||||
find_kernel_modules_external | instmods
|
||||
|
||||
# if not on hostonly mode, install all known filesystems,
|
||||
# if the required list is not set via the filesystems variable
|
||||
if ! [[ $hostonly ]]; then
|
||||
|
@@ -28,7 +28,7 @@ installkernel() {
|
||||
=drivers/net/phy \
|
||||
=drivers/net/team \
|
||||
=drivers/net/ethernet \
|
||||
ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net xennet
|
||||
ecb arc4 bridge stp llc ipv6 bonding 8021q ipvlan macvlan af_packet virtio_net xennet
|
||||
hostonly="" instmods iscsi_ibft crc32c iscsi_boot_sysfs
|
||||
}
|
||||
|
||||
|
@@ -43,19 +43,36 @@ GENERATOR_DIR="$2"
|
||||
|
||||
[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR"
|
||||
|
||||
getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
|
||||
getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"
|
||||
[ -e /xor_overlayfs ] && xor_overlayfs="yes"
|
||||
[ -e /xor_readonly ] && xor_readonly="--readonly"
|
||||
ROOTFLAGS="$(getarg rootflags)"
|
||||
{
|
||||
echo "[Unit]"
|
||||
echo "Before=initrd-root-fs.target"
|
||||
echo "[Mount]"
|
||||
echo "Where=/sysroot"
|
||||
echo "What=/dev/mapper/live-rw"
|
||||
[ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
|
||||
if [ "$overlayfs$xor_overlayfs" = "yes" ]; then
|
||||
echo "What=LiveOS_rootfs"
|
||||
if [ "$readonly_overlay$xor_readonly" = "--readonly" ]; then
|
||||
ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
|
||||
else
|
||||
ovlfs=lowerdir=/run/rootfsbase
|
||||
fi
|
||||
echo "Options=${ROOTFLAGS},${ovlfs},upperdir=/run/overlayfs,workdir=/run/ovlwork"
|
||||
echo "Type=overlay"
|
||||
_dev=LiveOS_rootfs
|
||||
else
|
||||
echo "What=/dev/mapper/live-rw"
|
||||
[ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
|
||||
_dev=$'dev-mapper-live\\x2drw'
|
||||
fi
|
||||
} > "$GENERATOR_DIR"/sysroot.mount
|
||||
|
||||
mkdir -p "$GENERATOR_DIR/dev-mapper-live\x2drw.device.d"
|
||||
mkdir -p "$GENERATOR_DIR/$_dev.device.d"
|
||||
{
|
||||
echo "[Unit]"
|
||||
echo "JobTimeoutSec=3000"
|
||||
echo "JobRunningTimeoutSec=3000"
|
||||
} > "$GENERATOR_DIR/dev-mapper-live\x2drw.device.d/timeout.conf"
|
||||
} > "$GENERATOR_DIR/$_dev.device.d/timeout.conf"
|
||||
|
@@ -39,6 +39,9 @@ _md_force_run() {
|
||||
_offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
|
||||
|
||||
if [ -n "$_MD_UUID" ]; then
|
||||
_MD_UUID=$(str_replace "$_MD_UUID" "-" "")
|
||||
_MD_UUID=$(str_replace "$_MD_UUID" ":" "")
|
||||
|
||||
for _md in /dev/md[0-9_]*; do
|
||||
[ -b "$_md" ] || continue
|
||||
_UUID=$(
|
||||
@@ -50,6 +53,7 @@ _md_force_run() {
|
||||
)
|
||||
|
||||
[ -z "$_UUID" ] && continue
|
||||
_UUID=$(str_replace "$_UUID" ":" "")
|
||||
|
||||
# check if we should handle this device
|
||||
strstr " $_MD_UUID " " $_UUID " || continue
|
||||
|
@@ -4,7 +4,7 @@
|
||||
check() {
|
||||
local _rootdev
|
||||
# No mdadm? No mdraid support.
|
||||
require_binaries mdadm || return 1
|
||||
require_binaries mdadm expr || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
@@ -65,7 +65,7 @@ cmdline() {
|
||||
# called by dracut
|
||||
install() {
|
||||
local rule rule_path
|
||||
inst_multiple cat
|
||||
inst_multiple cat expr
|
||||
inst_multiple -o mdmon
|
||||
inst $(command -v partx) /sbin/partx
|
||||
inst $(command -v mdadm) /sbin/mdadm
|
||||
|
@@ -1,6 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
|
||||
# normalize the uuid
|
||||
MD_UUID=$(str_replace "$MD_UUID" "-" "")
|
||||
MD_UUID=$(str_replace "$MD_UUID" ":" "")
|
||||
|
||||
if ( ! [ -n "$MD_UUID" ] && ! getargbool 0 rd.auto ) || ! getargbool 1 rd.md -d -n rd_NO_MD; then
|
||||
info "rd.md=0: removing MD RAID activation"
|
||||
@@ -12,10 +15,12 @@ else
|
||||
[ -e "$f" ] || continue
|
||||
while read line || [ -n "$line" ]; do
|
||||
if [ "${line%%UUID CHECK}" != "$line" ]; then
|
||||
for uuid in $MD_UUID; do
|
||||
printf 'ENV{ID_FS_UUID}=="%s", GOTO="md_uuid_ok"\n' "$(expr substr $uuid 1 8)-$(expr substr $uuid 9 4)-$(expr substr $uuid 13 4)-$(expr substr $uuid 17 4)-$(expr substr $uuid 21 12)"
|
||||
done;
|
||||
printf 'IMPORT{program}="/sbin/mdadm --examine --export $tempnode"\n'
|
||||
for uuid in $MD_UUID; do
|
||||
printf 'ENV{MD_UUID}=="%s", GOTO="md_uuid_ok"\n' $uuid
|
||||
printf 'ENV{ID_FS_UUID}=="%s", GOTO="md_uuid_ok"\n' $uuid
|
||||
printf 'ENV{MD_UUID}=="%s", GOTO="md_uuid_ok"\n' "$(expr substr $uuid 1 8):$(expr substr $uuid 9 8):$(expr substr $uuid 17 8):$(expr substr $uuid 25 8)"
|
||||
done;
|
||||
printf 'GOTO="md_end"\n'
|
||||
printf 'LABEL="md_uuid_ok"\n'
|
||||
@@ -26,6 +31,7 @@ else
|
||||
mv "${f}.new" "$f"
|
||||
done
|
||||
for uuid in $MD_UUID; do
|
||||
uuid="$(expr substr $uuid 1 8):$(expr substr $uuid 9 8):$(expr substr $uuid 17 8):$(expr substr $uuid 25 8)"
|
||||
wait_for_dev "/dev/disk/by-id/md-uuid-${uuid}"
|
||||
done
|
||||
fi
|
||||
|
@@ -1,53 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo multipath
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _f _allow
|
||||
|
||||
is_mpath() {
|
||||
local _dev=$1
|
||||
[ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
|
||||
[[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
majmin_to_mpath_dev() {
|
||||
local _dev
|
||||
for i in /dev/mapper/*; do
|
||||
[[ $i == /dev/mapper/control ]] && continue
|
||||
_dev=$(get_maj_min $i)
|
||||
if [ "$_dev" = "$1" ]; then
|
||||
echo $i
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
add_hostonly_mpath_conf() {
|
||||
is_mpath $1 && {
|
||||
local _dev
|
||||
|
||||
_dev=$(majmin_to_mpath_dev $1)
|
||||
[ -z "$_dev" ] && return
|
||||
strstr "$_allow" "$_dev" && return
|
||||
_allow="$_allow --allow $_dev"
|
||||
}
|
||||
}
|
||||
|
||||
[[ $hostonly ]] && {
|
||||
for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
|
||||
[ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
|
||||
}
|
||||
}
|
||||
|
@@ -7,6 +7,18 @@ is_mpath() {
|
||||
return 1
|
||||
}
|
||||
|
||||
majmin_to_mpath_dev() {
|
||||
local _dev
|
||||
for i in /dev/mapper/*; do
|
||||
[[ $i == /dev/mapper/control ]] && continue
|
||||
_dev=$(get_maj_min $i)
|
||||
if [ "$_dev" = "$1" ]; then
|
||||
echo $i
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
local _rootdev
|
||||
@@ -55,6 +67,17 @@ installkernel() {
|
||||
install() {
|
||||
local _f _allow
|
||||
|
||||
add_hostonly_mpath_conf() {
|
||||
is_mpath $1 && {
|
||||
local _dev
|
||||
|
||||
_dev=$(majmin_to_mpath_dev $1)
|
||||
[ -z "$_dev" ] && return
|
||||
strstr "$_allow" "$_dev" && return
|
||||
_allow="$_allow --allow $_dev"
|
||||
}
|
||||
}
|
||||
|
||||
inst_multiple -o \
|
||||
dmsetup \
|
||||
kpartx \
|
||||
@@ -69,6 +92,11 @@ install() {
|
||||
/etc/multipath/* \
|
||||
/etc/multipath/conf.d/*
|
||||
|
||||
[[ $hostonly ]] && [[ $hostonly_mode = "strict" ]] && {
|
||||
for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
|
||||
[ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
|
||||
}
|
||||
|
||||
inst $(command -v partx) /sbin/partx
|
||||
|
||||
inst_libdir_file "libmultipath*" "multipath/*"
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
for i in $(multipath -l -v1); do
|
||||
if ! $(dmsetup table $i | sed -n '/.*queue_if_no_path.*/q1') ; then
|
||||
if ! dmsetup table $i | sed -n '/.*queue_if_no_path.*/q1' ; then
|
||||
dmsetup message $i 0 fail_if_no_path
|
||||
fi
|
||||
done
|
||||
|
34
modules.d/90stratis/module-setup.sh
Executable file
34
modules.d/90stratis/module-setup.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
require_binaries stratisd-init thin_check thin_repair mkfs.xfs xfs_admin xfs_growfs || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo dm
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
instmods xfs
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
|
||||
inst_multiple stratisd-init thin_check thin_repair mkfs.xfs xfs_admin xfs_growfs
|
||||
|
||||
if dracut_module_included "systemd"; then
|
||||
inst_simple "${moddir}/stratisd-init.service" "${systemdsystemunitdir}/stratisd-init.service"
|
||||
mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.wants"
|
||||
ln -rfs "${initdir}${systemdsystemunitdir}/stratisd-init.service" "${initdir}${systemdsystemunitdir}/sysinit.target.wants/stratisd-init.service"
|
||||
else
|
||||
inst_hook cmdline 25 "$moddir/stratisd-start.sh"
|
||||
inst_hook cleanup 25 "$moddir/stratisd-stop.sh"
|
||||
fi
|
||||
}
|
||||
|
15
modules.d/90stratis/stratisd-init.service
Normal file
15
modules.d/90stratis/stratisd-init.service
Normal file
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=A daemon that manages a pool of block devices to create flexible file systems
|
||||
Documentation=man:stratisd(8)
|
||||
Before=local-fs-pre.target
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/sbin/stratisd-init --debug
|
||||
KillSignal=SIGINT
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
|
||||
[Install]
|
||||
WantedBy=sysinit.target
|
3
modules.d/90stratis/stratisd-start.sh
Executable file
3
modules.d/90stratis/stratisd-start.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
stratisd-init --debug > /dev/kmsg 2>&1 &
|
6
modules.d/90stratis/stratisd-stop.sh
Executable file
6
modules.d/90stratis/stratisd-stop.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -f /lib/dracut-lib.sh ] && . /lib/dracut-lib.sh
|
||||
|
||||
pid=$(pidof stratisd-init)
|
||||
[ -n "$pid" ] && kill ${pid}
|
0
modules.d/95fcoe/cleanup-fcoe.sh
Normal file → Executable file
0
modules.d/95fcoe/cleanup-fcoe.sh
Normal file → Executable file
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -e /sys/module/bnx2i ] && killproc iscsiuio
|
||||
[ -z "${DRACUT_SYSTEMD}" ] && [ -e /sys/module/bnx2i ] && killproc iscsiuio
|
||||
|
||||
|
@@ -36,31 +36,45 @@ iroot=${iroot#:}
|
||||
# figured out a way how to check whether this is built-in or not
|
||||
modprobe crc32c 2>/dev/null
|
||||
|
||||
if [ -e /sys/module/bnx2i ] && ! [ -e /tmp/iscsiuio-started ]; then
|
||||
if [ -z "${DRACUT_SYSTEMD}" ] && [ -e /sys/module/bnx2i ] && ! [ -e /tmp/iscsiuio-started ]; then
|
||||
iscsiuio
|
||||
> /tmp/iscsiuio-started
|
||||
fi
|
||||
|
||||
|
||||
handle_firmware()
|
||||
{
|
||||
if ! iscsistart-flocked -f; then
|
||||
warn "iscistart: Could not get list of targets from firmware. Skipping."
|
||||
echo 'skipped' > "/tmp/iscsistarted-firmware"
|
||||
return 0
|
||||
local ifaces retry
|
||||
|
||||
# Depending on the 'ql4xdisablesysfsboot' qla4xxx
|
||||
# will be autostarting sessions without presenting
|
||||
# them via the firmware interface.
|
||||
# In these cases 'iscsiadm -m fw' will fail, but
|
||||
# the iSCSI sessions will still be present.
|
||||
if ! iscsiadm -m fw; then
|
||||
warn "iscsiadm: Could not get list of targets from firmware."
|
||||
else
|
||||
ifaces=( $(echo /sys/firmware/ibft/ethernet*) )
|
||||
retry=$(cat /tmp/session-retry)
|
||||
|
||||
if [ $retry -lt ${#ifaces[*]} ]; then
|
||||
let retry++
|
||||
echo $retry > /tmp/session-retry
|
||||
return 1
|
||||
else
|
||||
rm /tmp/session-retry
|
||||
fi
|
||||
|
||||
if ! iscsiadm -m fw -l; then
|
||||
warn "iscsiadm: Log-in to iscsi target failed"
|
||||
else
|
||||
need_shutdown
|
||||
fi
|
||||
fi
|
||||
|
||||
for p in $(getargs rd.iscsi.param -d iscsi_param); do
|
||||
iscsi_param="$iscsi_param --param $p"
|
||||
done
|
||||
|
||||
if ! iscsistart-flocked -b $iscsi_param; then
|
||||
warn "'iscsistart -b $iscsi_param' failed with return code $?"
|
||||
fi
|
||||
|
||||
[ -d /sys/class/iscsi_session ] || return 1
|
||||
echo 'started' > "/tmp/iscsistarted-iscsi:"
|
||||
echo 'started' > "/tmp/iscsistarted-firmware"
|
||||
|
||||
need_shutdown
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -72,13 +86,13 @@ handle_netroot()
|
||||
local iscsi_username iscsi_password
|
||||
local iscsi_in_username iscsi_in_password
|
||||
local iscsi_iface_name iscsi_netdev_name
|
||||
local iscsi_param
|
||||
local iscsi_param param
|
||||
local p
|
||||
|
||||
# override conf settings by command line options
|
||||
arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=)
|
||||
[ -n "$arg" ] && iscsi_initiator=$arg
|
||||
arg=$(getarg rd.iscsi.target.name -d iscsi_target_name=)
|
||||
arg=$(getargs rd.iscsi.target.name -d iscsi_target_name=)
|
||||
[ -n "$arg" ] && iscsi_target_name=$arg
|
||||
arg=$(getarg rd.iscsi.target.ip -d iscsi_target_ip)
|
||||
[ -n "$arg" ] && iscsi_target_ip=$arg
|
||||
@@ -95,7 +109,7 @@ handle_netroot()
|
||||
arg=$(getarg rd.iscsi.in.password -d iscsi_in_password=)
|
||||
[ -n "$arg" ] && iscsi_in_password=$arg
|
||||
for p in $(getargs rd.iscsi.param -d iscsi_param); do
|
||||
iscsi_param="$iscsi_param --param $p"
|
||||
iscsi_param="$iscsi_param $p"
|
||||
done
|
||||
|
||||
parse_iscsi_root "$1" || return 1
|
||||
@@ -105,6 +119,17 @@ handle_netroot()
|
||||
ip route get "$iscsi_target_ip" >/dev/null 2>&1 || return 0
|
||||
fi
|
||||
|
||||
#limit iscsistart login retries
|
||||
case "$iscsi_param" in
|
||||
*node.session.initial_login_retry_max*) ;;
|
||||
*)
|
||||
retries=$(getargnum 3 0 10000 rd.iscsi.login_retry_max)
|
||||
if [ $retries -gt 0 ]; then
|
||||
iscsi_param="${iscsi_param% } node.session.initial_login_retry_max=$retries"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# XXX is this needed?
|
||||
getarg ro && iscsirw=ro
|
||||
getarg rw && iscsirw=rw
|
||||
@@ -117,6 +142,11 @@ handle_netroot()
|
||||
mkdir -p /etc/iscsi
|
||||
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
|
||||
> /tmp/iscsi_set_initiator
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
systemctl try-restart iscsid
|
||||
# FIXME: iscsid is not yet ready, when the service is :-/
|
||||
sleep 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$iscsi_initiator" ]; then
|
||||
@@ -133,6 +163,11 @@ handle_netroot()
|
||||
mkdir -p /etc/iscsi
|
||||
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
|
||||
> /tmp/iscsi_set_initiator
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
systemctl try-restart iscsid
|
||||
# FIXME: iscsid is not yet ready, when the service is :-/
|
||||
sleep 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -153,7 +188,18 @@ handle_netroot()
|
||||
if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then
|
||||
mkdir -p /etc/iscsi
|
||||
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
systemctl try-restart iscsid
|
||||
# FIXME: iscsid is not yet ready, when the service is :-/
|
||||
sleep 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
iscsid
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
# FIXME $iscsi_protocol??
|
||||
|
||||
if [ "$root" = "dhcp" ] || [ "$netroot" = "dhcp" ]; then
|
||||
@@ -168,46 +214,40 @@ handle_netroot()
|
||||
echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
|
||||
fi
|
||||
|
||||
if [ -n "$DRACUT_SYSTEMD" ] && command -v systemd-run >/dev/null 2>&1; then
|
||||
netroot_enc=$(systemd-escape "iscsistart_${1}")
|
||||
status=$(systemctl is-active "$netroot_enc" 2>/dev/null)
|
||||
is_active=$?
|
||||
if [ $is_active -ne 0 ]; then
|
||||
if [ "$status" != "activating" ] && ! systemctl is-failed "$netroot_enc" >/dev/null 2>&1; then
|
||||
systemd-run --no-block --service-type=oneshot --remain-after-exit --quiet \
|
||||
--description="Login iSCSI Target $iscsi_target_name" \
|
||||
-p 'DefaultDependencies=no' \
|
||||
--unit="$netroot_enc" -- \
|
||||
$(command -v iscsistart-flocked) \
|
||||
-i "$iscsi_initiator" -t "$iscsi_target_name" \
|
||||
-g "$iscsi_target_group" -a "$iscsi_target_ip" \
|
||||
-p "$iscsi_target_port" \
|
||||
${iscsi_username:+-u "$iscsi_username"} \
|
||||
${iscsi_password:+-w "$iscsi_password"} \
|
||||
${iscsi_in_username:+-U "$iscsi_in_username"} \
|
||||
${iscsi_in_password:+-W "$iscsi_in_password"} \
|
||||
${iscsi_iface_name:+--param "iface.iscsi_ifacename=$iscsi_iface_name"} \
|
||||
${iscsi_netdev_name:+--param "iface.net_ifacename=$iscsi_netdev_name"} \
|
||||
${iscsi_param} >/dev/null 2>&1 \
|
||||
&& { > $hookdir/initqueue/work ; }
|
||||
else
|
||||
systemctl --no-block restart "$netroot_enc" >/dev/null 2>&1 \
|
||||
&& { > $hookdir/initqueue/work ; }
|
||||
targets=$(iscsiadm -m discovery -t st -p $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/')
|
||||
[ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1
|
||||
|
||||
for target in $iscsi_target_name; do
|
||||
case "$targets" in
|
||||
*$target*)
|
||||
EXTRA=""
|
||||
if [ -n "$iscsi_iface_name" ]; then
|
||||
iscsiadm -m iface -I $iscsi_iface_name --op=new
|
||||
EXTRA=" ${iscsi_netdev_name:+--name=iface.net_ifacename --value=$iscsi_netdev_name} "
|
||||
EXTRA="$EXTRA ${iscsi_initiator:+--name=iface.initiatorname --value=$iscsi_initiator} "
|
||||
fi
|
||||
fi
|
||||
else
|
||||
iscsistart-flocked -i "$iscsi_initiator" -t "$iscsi_target_name" \
|
||||
-g "$iscsi_target_group" -a "$iscsi_target_ip" \
|
||||
-p "$iscsi_target_port" \
|
||||
${iscsi_username:+-u "$iscsi_username"} \
|
||||
${iscsi_password:+-w "$iscsi_password"} \
|
||||
${iscsi_in_username:+-U "$iscsi_in_username"} \
|
||||
${iscsi_in_password:+-W "$iscsi_in_password"} \
|
||||
${iscsi_iface_name:+--param "iface.iscsi_ifacename=$iscsi_iface_name"} \
|
||||
${iscsi_netdev_name:+--param "iface.net_ifacename=$iscsi_netdev_name"} \
|
||||
${iscsi_param} \
|
||||
&& { > $hookdir/initqueue/work ; }
|
||||
fi
|
||||
[ -n "$iscsi_param" ] && for param in $iscsi_param; do EXTRA="$EXTRA --name=${param%=*} --value=${param#*=}"; done
|
||||
|
||||
iscsiadm -m node -T $target \
|
||||
${iscsi_iface_name:+-I $iscsi_iface_name} \
|
||||
-p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port} \
|
||||
--op=update \
|
||||
--name=node.startup --value=onboot \
|
||||
${iscsi_username:+ --name=node.session.auth.username --value=$iscsi_username} \
|
||||
${iscsi_password:+ --name=node.session.auth.password --value=$iscsi_password} \
|
||||
${iscsi_in_username:+--name=node.session.auth.username_in --value=$iscsi_in_username} \
|
||||
${iscsi_in_password:+--name=node.session.auth.password_in --value=$iscsi_in_password} \
|
||||
$EXTRA \
|
||||
$NULL
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
iscsiadm -m node -L onboot || :
|
||||
> $hookdir/initqueue/work
|
||||
|
||||
netroot_enc=$(str_replace "$1" '/' '\2f')
|
||||
echo 'started' > "/tmp/iscsistarted-iscsi:${netroot_enc}"
|
||||
return 0
|
||||
@@ -215,12 +255,21 @@ handle_netroot()
|
||||
|
||||
ret=0
|
||||
|
||||
if [ "$netif" != "timeout" ] && getargbool 1 rd.iscsi.waitnet; then
|
||||
if [ "$netif" != "timeout" ] && getargbool 0 rd.iscsi.waitnet; then
|
||||
all_ifaces_setup || exit 0
|
||||
fi
|
||||
|
||||
if [ "$netif" = "timeout" ] && all_ifaces_setup; then
|
||||
# s.th. went wrong and the timeout script hits
|
||||
# restart
|
||||
systemctl restart iscsid
|
||||
# damn iscsid is not ready after unit says it's ready
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
|
||||
if [ "$netif" = "timeout" ] || [ "$netif" = "online" ]; then
|
||||
if [ "$netif" = "timeout" ] || [ "$netif" = "online" ] || [ "$netif" = "dummy" ]; then
|
||||
[ -f /tmp/session-retry ] || echo 1 > /tmp/session-retry
|
||||
handle_firmware
|
||||
ret=$?
|
||||
fi
|
||||
|
@@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
{
|
||||
flock -e 9
|
||||
iscsistart "$@"
|
||||
} 9>/tmp/.iscsi_lock
|
@@ -4,7 +4,7 @@
|
||||
check() {
|
||||
local _rootdev
|
||||
# If our prerequisites are not met, fail anyways.
|
||||
require_binaries iscsistart hostname iscsi-iname || return 1
|
||||
require_binaries hostname iscsi-iname iscsiadm iscsid || return 1
|
||||
|
||||
# If hostonly was requested, fail the check if we are not actually
|
||||
# booting from root.
|
||||
@@ -61,7 +61,7 @@ install_ibft() {
|
||||
fi
|
||||
if [ -d ${d}/initiator ] ; then
|
||||
if [ ${d##*/} = "ibft" ] && [ "$ibft_mod" != "bnx2i" ] ; then
|
||||
echo -n "ip=ibft "
|
||||
echo -n "rd.iscsi.ibft=1 "
|
||||
fi
|
||||
echo -n "rd.iscsi.firmware=1"
|
||||
fi
|
||||
@@ -70,7 +70,7 @@ install_ibft() {
|
||||
|
||||
install_iscsiroot() {
|
||||
local devpath=$1
|
||||
local scsi_path iscsi_lun session c d conn
|
||||
local scsi_path iscsi_lun session c d conn host flash
|
||||
local iscsi_session iscsi_address iscsi_port iscsi_targetname iscsi_tpgt
|
||||
|
||||
scsi_path=${devpath%%/block*}
|
||||
@@ -81,6 +81,19 @@ install_iscsiroot() {
|
||||
[ "$session" = "$devpath" ] && return 1
|
||||
iscsi_session=${session##*/}
|
||||
[ "$iscsi_session" = "$session" ] && return 1
|
||||
host=${session%%/session*}
|
||||
[ "$host" = "$session" ] && return 1
|
||||
iscsi_host=${host##*/}
|
||||
|
||||
for flash in ${host}/flashnode_sess-* ; do
|
||||
is_boot=$(cat $flash/is_boot_target)
|
||||
if [ $is_boot -eq 1 ] ; then
|
||||
# qla4xxx flashnode session; skip iBFT discovery
|
||||
iscsi_initiator=$(cat /sys/class/iscsi_host/${iscsi_host}/initiatorname)
|
||||
echo "rd.iscsi.initiator=${iscsi_initiator}"
|
||||
return;
|
||||
fi
|
||||
done
|
||||
|
||||
for d in ${session}/* ; do
|
||||
case $d in
|
||||
@@ -104,7 +117,14 @@ install_iscsiroot() {
|
||||
[ -z "$iscsi_address" ] && return
|
||||
local_address=$(ip -o route get to $iscsi_address | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
|
||||
ifname=$(ip -o route get to $iscsi_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
|
||||
printf 'ip=%s:static ' ${ifname}
|
||||
|
||||
#follow ifcfg settings for boot protocol
|
||||
bootproto=$(sed -n "/BOOTPROTO/s/BOOTPROTO='\([[:alpha:]]*6\?\)4\?'/\1/p" /etc/sysconfig/network/ifcfg-$ifname)
|
||||
if [ $bootproto ]; then
|
||||
printf 'ip=%s:%s ' ${ifname} ${bootproto}
|
||||
else
|
||||
printf 'ip=%s:static ' ${ifname}
|
||||
fi
|
||||
|
||||
if [ -e /sys/class/net/$ifname/address ] ; then
|
||||
ifmac=$(cat /sys/class/net/$ifname/address)
|
||||
@@ -128,6 +148,7 @@ install_iscsiroot() {
|
||||
# can sort out rd.iscsi.initiator= duplicates
|
||||
echo "rd.iscsi.initiator=${iscsi_initiator}"
|
||||
echo "netroot=iscsi:${iscsi_address}::${iscsi_port}:${iscsi_lun}:${iscsi_targetname}"
|
||||
echo "rd.neednet=1"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@@ -159,15 +180,14 @@ installkernel() {
|
||||
local _arch=$(uname -m)
|
||||
local _funcs='iscsi_register_transport'
|
||||
|
||||
instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi
|
||||
instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi qedi
|
||||
hostonly="" instmods iscsi_tcp iscsi_ibft crc32c iscsi_boot_sysfs
|
||||
|
||||
if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then
|
||||
_s390drivers="=drivers/s390/scsi"
|
||||
fi
|
||||
|
||||
dracut_instmods -o -s "$_funcs" "=drivers/scsi" ${_s390drivers:+"$_s390drivers"}
|
||||
|
||||
dracut_instmods -o -s ${_funcs} =drivers/scsi ${_s390drivers:+"$_s390drivers"}
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
@@ -184,9 +204,23 @@ cmdline() {
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple umount iscsistart hostname iscsi-iname
|
||||
inst_multiple -o iscsiuio
|
||||
inst_libdir_file 'libgcc_s.so*'
|
||||
inst_multiple umount hostname iscsi-iname iscsiadm iscsid
|
||||
|
||||
inst_multiple -o \
|
||||
$systemdsystemunitdir/iscsid.socket \
|
||||
$systemdsystemunitdir/iscsid.service \
|
||||
$systemdsystemunitdir/iscsiuio.service \
|
||||
$systemdsystemunitdir/iscsiuio.socket \
|
||||
$systemdsystemunitdir/sockets.target.wants/iscsid.socket \
|
||||
$systemdsystemunitdir/sockets.target.wants/iscsiuio.socket
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
inst_dir $(/usr/bin/find /etc/iscsi)
|
||||
else
|
||||
inst_simple /etc/iscsi/iscsid.conf
|
||||
fi
|
||||
|
||||
# Detect iBFT and perform mandatory steps
|
||||
if [[ $hostonly_cmdline == "yes" ]] ; then
|
||||
@@ -194,12 +228,43 @@ install() {
|
||||
[[ $_iscsiconf ]] && printf "%s\n" "$_iscsiconf" >> "${initdir}/etc/cmdline.d/95iscsi.conf"
|
||||
fi
|
||||
|
||||
inst "$moddir/iscsistart-flocked.sh" "/bin/iscsistart-flocked"
|
||||
inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
|
||||
inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
|
||||
inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
|
||||
else
|
||||
inst_multiple -o \
|
||||
$systemdsystemunitdir/iscsi.service \
|
||||
$systemdsystemunitdir/iscsid.service \
|
||||
$systemdsystemunitdir/iscsid.socket \
|
||||
$systemdsystemunitdir/iscsiuio.service \
|
||||
$systemdsystemunitdir/iscsiuio.socket \
|
||||
iscsiadm iscsid
|
||||
|
||||
mkdir -p "${initdir}/$systemdsystemunitdir/sockets.target.wants"
|
||||
for i in \
|
||||
iscsid.socket \
|
||||
iscsiuio.socket \
|
||||
; do
|
||||
ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/sockets.target.wants/${i}"
|
||||
done
|
||||
|
||||
mkdir -p "${initdir}/$systemdsystemunitdir/basic.target.wants"
|
||||
for i in \
|
||||
iscsid.service \
|
||||
iscsiuio.service \
|
||||
; do
|
||||
ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/basic.target.wants/${i}"
|
||||
done
|
||||
|
||||
# Make sure iscsid is started after dracut-cmdline and ready for the initqueue
|
||||
mkdir -p "${initdir}/$systemdsystemunitdir/iscsid.service.d"
|
||||
(
|
||||
echo "[Unit]"
|
||||
echo "After=dracut-cmdline.service"
|
||||
echo "Before=dracut-initqueue.service"
|
||||
) > "${initdir}/$systemdsystemunitdir/iscsid.service.d/dracut.conf"
|
||||
fi
|
||||
inst_dir /var/lib/iscsi
|
||||
dracut_need_initqueue
|
||||
|
@@ -90,19 +90,13 @@ if [ -n "$iscsi_firmware" ]; then
|
||||
initqueue --unique --onetime --settled /sbin/iscsiroot online "iscsi:" "'$NEWROOT'"
|
||||
fi
|
||||
|
||||
if [ -z "$netroot" ] || ! [ "${netroot%%:*}" = "iscsi" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT"
|
||||
|
||||
initqueue --onetime modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi
|
||||
|
||||
# ISCSI actually supported?
|
||||
if ! [ -e /sys/module/iscsi_tcp ]; then
|
||||
modprobe -b -q iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi"
|
||||
fi
|
||||
|
||||
modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi
|
||||
|
||||
if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
|
||||
if ! getargbool 1 rd.neednet >/dev/null || ! getarg "ip="; then
|
||||
initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
|
||||
@@ -116,6 +110,11 @@ if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ] && ! [
|
||||
if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then
|
||||
mkdir -p /etc/iscsi
|
||||
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
systemctl try-restart iscsid
|
||||
# FIXME: iscsid is not yet ready, when the service is :-/
|
||||
sleep 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -128,9 +127,19 @@ if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ]
|
||||
mkdir -p /etc/iscsi
|
||||
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
|
||||
> /tmp/iscsi_set_initiator
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
systemctl try-restart iscsid
|
||||
# FIXME: iscsid is not yet ready, when the service is :-/
|
||||
sleep 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$netroot" ] || ! [ "${netroot%%:*}" = "iscsi" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT"
|
||||
|
||||
for nroot in $(getargs netroot); do
|
||||
[ "${nroot%%:*}" = "iscsi" ] || continue
|
||||
|
59
modules.d/95qeth_rules/module-setup.sh
Executable file
59
modules.d/95qeth_rules/module-setup.sh
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
local _arch=$(uname -m)
|
||||
local _online=0
|
||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||
require_binaries /usr/lib/udev/collect || return 1
|
||||
dracut_module_included network || return 1
|
||||
|
||||
[[ $hostonly ]] && {
|
||||
for i in /sys/devices/qeth/*/online; do
|
||||
read _online < $i
|
||||
[ $_online -eq 1 ] && return 0
|
||||
done
|
||||
}
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
instmods qeth
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
ccwid() {
|
||||
qeth_path=$(readlink -e -q $1/device)
|
||||
basename "$qeth_path"
|
||||
}
|
||||
|
||||
inst_rules_qeth() {
|
||||
for rule in /etc/udev/rules.d/{4,5}1-qeth-${1}.rules; do
|
||||
# prefer chzdev generated 41- rules
|
||||
if [ -f "$rule" ]; then
|
||||
inst_rules "$rule"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
has_carrier() {
|
||||
carrier=0
|
||||
# not readable in qeth interfaces
|
||||
# that have just been assembled, ignore
|
||||
# read error and assume no carrier
|
||||
read carrier 2>/dev/null < "$1/carrier"
|
||||
[ "$carrier" -eq 1 ] && return 0
|
||||
return 1;
|
||||
}
|
||||
|
||||
for dev in /sys/class/net/*; do
|
||||
has_carrier $dev || continue
|
||||
id=$(ccwid $dev)
|
||||
[ -n "$id" ] && inst_rules_qeth $id
|
||||
done
|
||||
|
||||
inst_simple /usr/lib/udev/collect
|
||||
}
|
@@ -7,6 +7,8 @@ Description=dracut ask for additional cmdline parameters
|
||||
DefaultDependencies=no
|
||||
Before=dracut-cmdline.service
|
||||
After=systemd-journald.socket
|
||||
After=systemd-vconsole-setup.service
|
||||
Requires=systemd-vconsole-setup.service
|
||||
Wants=systemd-journald.socket
|
||||
ConditionPathExists=/usr/lib/initrd-release
|
||||
ConditionKernelCommandLine=|rd.cmdline=ask
|
||||
|
@@ -76,8 +76,8 @@ load_evm_x509()
|
||||
return 1
|
||||
fi
|
||||
|
||||
local evm_pubid
|
||||
local line=$(keyctl describe %keyring:.evm)
|
||||
local evm_pubid line
|
||||
line=$(keyctl describe %keyring:.evm)
|
||||
if [ $? -eq 0 ]; then
|
||||
# the kernel already setup a trusted .evm keyring so use that one
|
||||
evm_pubid=${line%%:*}
|
||||
|
@@ -15,7 +15,7 @@ detect_syslog() {
|
||||
syslogtype="rsyslogd"
|
||||
elif [ -e /sbin/syslogd ]; then
|
||||
syslogtype="syslogd"
|
||||
elif [ /sbin/syslog-ng ]; then
|
||||
elif [ -e /sbin/syslog-ng ]; then
|
||||
syslogtype="syslog-ng"
|
||||
else
|
||||
warn "Could not find any syslog binary although the syslogmodule is selected to be installed. Please check."
|
||||
|
@@ -118,6 +118,7 @@ str_replace() {
|
||||
killall_proc_mountpoint() {
|
||||
local _pid
|
||||
local _t
|
||||
local _killed=0
|
||||
for _pid in /proc/*; do
|
||||
_pid=${_pid##/proc/}
|
||||
case $_pid in
|
||||
@@ -125,8 +126,12 @@ killall_proc_mountpoint() {
|
||||
esac
|
||||
[ -e "/proc/$_pid/exe" ] || continue
|
||||
[ -e "/proc/$_pid/root" ] || continue
|
||||
strstr "$(ls -l -- "/proc/$_pid" "/proc/$_pid/fd" 2>/dev/null)" "$1" && kill -9 "$_pid"
|
||||
if strstr "$(ls -l -- "/proc/$_pid" "/proc/$_pid/fd" 2>/dev/null)" "$1" ; then
|
||||
kill -9 "$_pid"
|
||||
_killed=1
|
||||
fi
|
||||
done
|
||||
return $_killed
|
||||
}
|
||||
|
||||
getcmdline() {
|
||||
@@ -1055,7 +1060,7 @@ if ! command -v pidof >/dev/null 2>/dev/null; then
|
||||
debug_on
|
||||
return 1
|
||||
fi
|
||||
_exe=$(type -P "$1")
|
||||
_exe=$(command -v "$1")
|
||||
for i in /proc/*/exe; do
|
||||
[ -e "$i" ] || continue
|
||||
if [ -n "$_exe" ]; then
|
||||
|
@@ -63,13 +63,12 @@ install() {
|
||||
echo ro >> "${initdir}/etc/cmdline.d/base.conf"
|
||||
fi
|
||||
|
||||
local VERSION=""
|
||||
local PRETTY_NAME=""
|
||||
if [ -e /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
VERSION+=" "
|
||||
PRETTY_NAME+=" "
|
||||
else
|
||||
VERSION=""
|
||||
PRETTY_NAME=""
|
||||
[[ -n ${VERSION} ]] && VERSION+=" "
|
||||
[[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" "
|
||||
fi
|
||||
NAME=dracut
|
||||
ID=dracut
|
||||
@@ -94,6 +93,9 @@ install() {
|
||||
|
||||
## save host_devs which we need bring up
|
||||
if [[ $hostonly_cmdline == "yes" ]]; then
|
||||
if [[ -n $add_device ]]; then
|
||||
dracut_need_initqueue
|
||||
fi
|
||||
if [[ -f "$initdir/lib/dracut/need-initqueue" ]] || ! dracut_module_included "systemd"; then
|
||||
(
|
||||
if dracut_module_included "systemd"; then
|
||||
|
@@ -6,18 +6,18 @@ echo 'Generating "/run/initramfs/rdsosreport.txt"'
|
||||
|
||||
exec >/run/initramfs/rdsosreport.txt 2>&1
|
||||
|
||||
PWFILTER='s/\(ftp:\/\/.*\):.*@/\1:*******@/g;s/\(cifs:\/\/.*\):.*@/\1:*******@/g;s/cifspass=[^ ]*/cifspass=*******/g;s/iscsi:.*@/iscsi:******@/g;s/rd.iscsi.password=[^ ]*/rd.iscsi.password=******/g;s/rd.iscsi.in.password=[^ ]*/rd.iscsi.in.password=******/g'
|
||||
set -x
|
||||
|
||||
cat /lib/dracut/dracut-*
|
||||
|
||||
cat /proc/cmdline
|
||||
cat /proc/cmdline | sed -e "$PWFILTER"
|
||||
|
||||
[ -f /etc/cmdline ] && cat /etc/cmdline
|
||||
[ -f /etc/cmdline ] && cat /etc/cmdline | sed -e "$PWFILTER"
|
||||
|
||||
for _i in /etc/cmdline.d/*.conf; do
|
||||
[ -f "$_i" ] || break
|
||||
echo $_i
|
||||
cat $_i
|
||||
cat $_i | sed -e "$PWFILTER"
|
||||
done
|
||||
|
||||
cat /proc/self/mountinfo
|
||||
@@ -31,7 +31,7 @@ ls -l /dev/disk/by*
|
||||
for _i in /etc/conf.d/*.conf; do
|
||||
[ -f "$_i" ] || break
|
||||
echo $_i
|
||||
cat $_i
|
||||
cat $_i | sed -e "$PWFILTER"
|
||||
done
|
||||
|
||||
if command -v lvm >/dev/null 2>/dev/null; then
|
||||
@@ -47,9 +47,9 @@ cat /proc/mdstat
|
||||
command -v ip >/dev/null 2>/dev/null && ip addr
|
||||
|
||||
if command -v journalctl >/dev/null 2>/dev/null; then
|
||||
journalctl -ab --no-pager -o short-monotonic
|
||||
journalctl -ab --no-pager -o short-monotonic | sed -e "$PWFILTER"
|
||||
else
|
||||
dmesg
|
||||
[ -f /run/initramfs/init.log ] && cat /run/initramfs/init.log
|
||||
dmesg | sed -e "$PWFILTER"
|
||||
[ -f /run/initramfs/init.log ] && cat /run/initramfs/init.log | sed -e "$PWFILTER"
|
||||
fi
|
||||
|
||||
|
@@ -15,14 +15,11 @@ echo_fs_helper() {
|
||||
local dev=$1 fs=$2
|
||||
case "$fs" in
|
||||
xfs)
|
||||
echo -n " xfs_db xfs_repair xfs_check xfs_metadump"
|
||||
echo -n " xfs_db xfs_repair xfs_check xfs_metadump "
|
||||
;;
|
||||
ext?)
|
||||
echo -n " e2fsck "
|
||||
;;
|
||||
f2fs)
|
||||
echo -n " fsck.f2fs "
|
||||
;;
|
||||
jfs)
|
||||
echo -n " jfs_fsck "
|
||||
;;
|
||||
@@ -41,7 +38,7 @@ echo_fs_helper() {
|
||||
include_fs_helper_modules() {
|
||||
local dev=$1 fs=$2
|
||||
case "$fs" in
|
||||
xfs|btrfs)
|
||||
xfs|btrfs|ext4)
|
||||
instmods crc32c
|
||||
;;
|
||||
f2fs)
|
||||
@@ -52,12 +49,12 @@ include_fs_helper_modules() {
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
# xfs and btrfs needs crc32c...
|
||||
# xfs/btrfs/ext4 need crc32c, f2fs needs crc32
|
||||
if [[ $hostonly ]]; then
|
||||
for_each_host_dev_fs include_fs_helper_modules
|
||||
:
|
||||
else
|
||||
instmods crc32c
|
||||
instmods crc32c crc32
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -74,7 +71,7 @@ install() {
|
||||
_helpers="\
|
||||
umount mount /sbin/fsck*
|
||||
xfs_db xfs_check xfs_repair xfs_metadump
|
||||
e2fsck fsck.f2fs jfs_fsck reiserfsck btrfsck
|
||||
e2fsck jfs_fsck reiserfsck btrfsck
|
||||
"
|
||||
if [[ $hostonly ]]; then
|
||||
_helpers="umount mount "
|
||||
@@ -84,7 +81,7 @@ install() {
|
||||
_helpers="$fscks"
|
||||
fi
|
||||
|
||||
if [[ "$_helpers" == *e2fsck* ]] && [ -e /etc/e2fsck.conf ]; then
|
||||
if [[ "$_helpers" == *e2fsck* ]] && [ -e /etc/e2fsck.conf ]; then
|
||||
inst_simple /etc/e2fsck.conf
|
||||
fi
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
# works with stdin if $1 is not set.
|
||||
det_archive() {
|
||||
# NOTE: echo -e works in ash and bash, but not dash
|
||||
local bz="BZh" xz="$(echo -e '\xfd7zXZ')" gz="$(echo -e '\x1f\x8b')" zs="$(echo -e '0xFD2FB528')"
|
||||
local bz="BZh" xz="$(echo -e '\xfd7zXZ')" gz="$(echo -e '\x1f\x8b')" zs="$(echo -e '\x28\xB5\x2F\xFD')"
|
||||
local headerblock="$(dd ${1:+if=$1} bs=262 count=1 2>/dev/null)"
|
||||
case "$headerblock" in
|
||||
$xz*) echo "xz" ;;
|
||||
|
@@ -14,7 +14,7 @@ depends() {
|
||||
# called by dracut
|
||||
install() {
|
||||
local _d
|
||||
inst_multiple umount poweroff reboot halt losetup stat
|
||||
inst_multiple umount poweroff reboot halt losetup stat sleep
|
||||
inst_multiple -o kexec
|
||||
inst "$moddir/shutdown.sh" "$prefix/shutdown"
|
||||
[ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib
|
||||
|
@@ -38,7 +38,7 @@ source_hook pre-shutdown
|
||||
|
||||
warn "Killing all remaining processes"
|
||||
|
||||
killall_proc_mountpoint /oldroot
|
||||
killall_proc_mountpoint /oldroot || sleep 0.2
|
||||
|
||||
umount_a() {
|
||||
local _did_umount="n"
|
||||
|
9
modules.d/99squash/clear-squash.sh
Executable file
9
modules.d/99squash/clear-squash.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
SQUASH_MNT_REC=/squash/mounts
|
||||
SQUASH_MNTS=( )
|
||||
|
||||
while read mnt; do
|
||||
SQUASH_MNTS+=( "$mnt" )
|
||||
done <<< "$(cat $SQUASH_MNT_REC)"
|
||||
|
||||
umount --lazy -- ${SQUASH_MNTS[@]}
|
7
modules.d/99squash/init.sh
Executable file
7
modules.d/99squash/init.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
/squash/setup-squash.sh
|
||||
|
||||
exec /init.stock
|
||||
|
||||
echo "Something went wrong when trying to start original init executable!"
|
||||
exit 1
|
29
modules.d/99squash/module-setup.sh
Normal file
29
modules.d/99squash/module-setup.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo "bash systemd systemd-initrd"
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
hostonly="" instmods squashfs loop overlay
|
||||
}
|
||||
|
||||
install() {
|
||||
if ! type -P mksquashfs >/dev/null || ! type -P unsquashfs >/dev/null ; then
|
||||
derror "squash module requires squashfs-tools to be installed."
|
||||
return 1
|
||||
fi
|
||||
|
||||
inst_multiple kmod modprobe mount mkdir ln echo
|
||||
inst $moddir/setup-squash.sh /squash/setup-squash.sh
|
||||
inst $moddir/clear-squash.sh /squash/clear-squash.sh
|
||||
inst $moddir/init.sh /squash/init.sh
|
||||
|
||||
inst "$moddir/squash-mnt-clear.service" "$systemdsystemunitdir/squash-mnt-clear.service"
|
||||
ln_r "$systemdsystemunitdir/squash-mnt-clear.service" "$systemdsystemunitdir/initrd.target.wants/squash-mnt-clear.service"
|
||||
}
|
61
modules.d/99squash/setup-squash.sh
Executable file
61
modules.d/99squash/setup-squash.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/sh
|
||||
PATH=/bin:/sbin
|
||||
|
||||
SQUASH_IMG=/squash/root.img
|
||||
SQUASH_MNT=/squash/root
|
||||
SQUASH_MNT_REC=/squash/mounts
|
||||
SQUASHED_MNT="usr etc"
|
||||
|
||||
echo $SQUASH_MNT > $SQUASH_MNT_REC
|
||||
|
||||
# Following mount points are neccessary for mounting a squash image
|
||||
|
||||
[ ! -d /proc/self ] && \
|
||||
mount -t proc -o nosuid,noexec,nodev proc /proc
|
||||
|
||||
[ ! -d /sys/kernel ] && \
|
||||
mount -t sysfs -o nosuid,noexec,nodev sysfs /sys
|
||||
|
||||
[ ! -e /dev/loop-control ] && \
|
||||
mount -t devtmpfs -o mode=0755,noexec,nosuid,strictatime devtmpfs /dev
|
||||
|
||||
# Need a loop device backend, overlayfs, and squashfs module
|
||||
modprobe loop
|
||||
if [ $? != 0 ]; then
|
||||
echo "Unable to setup loop module"
|
||||
fi
|
||||
|
||||
modprobe squashfs
|
||||
if [ $? != 0 ]; then
|
||||
echo "Unable to setup squashfs module"
|
||||
fi
|
||||
|
||||
modprobe overlay
|
||||
if [ $? != 0 ]; then
|
||||
echo "Unable to setup overlay module"
|
||||
fi
|
||||
|
||||
[ ! -d "$SQUASH_MNT" ] && \
|
||||
mkdir -m 0755 -p $SQUASH_MNT
|
||||
|
||||
# Mount the squashfs image
|
||||
mount -t squashfs -o ro,loop $SQUASH_IMG $SQUASH_MNT
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
echo "Unable to mount squashed initramfs image"
|
||||
fi
|
||||
|
||||
for file in $SQUASHED_MNT; do
|
||||
lowerdir=$SQUASH_MNT/$file
|
||||
workdir=/squash/overlay-work/$file
|
||||
upperdir=/$file
|
||||
mntdir=/$file
|
||||
|
||||
mkdir -m 0755 -p $workdir
|
||||
mkdir -m 0755 -p $mntdir
|
||||
|
||||
mount -t overlay overlay -o\
|
||||
lowerdir=$lowerdir,upperdir=$upperdir,workdir=$workdir $mntdir
|
||||
|
||||
echo $mntdir >> $SQUASH_MNT_REC
|
||||
done
|
7
modules.d/99squash/shutdown.sh
Executable file
7
modules.d/99squash/shutdown.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
/squash/setup-squash.sh
|
||||
|
||||
exec /shutdown.stock
|
||||
|
||||
echo "Something went wrong when trying to start original shutdown executable!"
|
||||
exit 1
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user