Compare commits
238 Commits
048
...
check_conf
Author | SHA1 | Date | |
---|---|---|---|
![]() |
02844ff664 | ||
![]() |
daa49cc221 | ||
![]() |
224175d8bc | ||
![]() |
b4769b332d | ||
![]() |
72ae1c4fe7 | ||
![]() |
8e9b094b21 | ||
![]() |
8a063c50a3 | ||
![]() |
c9b3c89f94 | ||
![]() |
1fcc70fe57 | ||
![]() |
5e7ef0ab3d | ||
![]() |
42d93d3482 | ||
![]() |
22c8a5c73f | ||
![]() |
ce0344d325 | ||
![]() |
920048ff50 | ||
![]() |
31e18286fc | ||
![]() |
4a8ad28808 | ||
![]() |
9dd9329f7a | ||
![]() |
3436067663 | ||
![]() |
f39aa529c5 | ||
![]() |
0a01086456 | ||
![]() |
707d4e79fe | ||
![]() |
7a3d661971 | ||
![]() |
04ff0a1bae | ||
![]() |
4d573e3be0 | ||
![]() |
4e2cc49d75 | ||
![]() |
8084f3f66d | ||
![]() |
cd181d2c4c | ||
![]() |
ead8729b44 | ||
![]() |
b1c5cae63f | ||
![]() |
38b4f4b21c | ||
![]() |
f4e38c0da8 | ||
![]() |
999cfa8458 | ||
![]() |
b91d3f15bf | ||
![]() |
5b2258ea0d | ||
![]() |
44fb598605 | ||
![]() |
6a74c03b4a | ||
![]() |
d1afff43ae | ||
![]() |
23acf15227 | ||
![]() |
b355c7a532 | ||
![]() |
960d8726db | ||
![]() |
ce4d04bf72 | ||
![]() |
b6b1bf9202 | ||
![]() |
b988934a38 | ||
![]() |
b2616b5268 | ||
![]() |
12f023ab03 | ||
![]() |
c30070c8f5 | ||
![]() |
c8b35bf96a | ||
![]() |
305c6f91bb | ||
![]() |
393fb1ac05 | ||
![]() |
9dfd73bcbd | ||
![]() |
2b1b3bcdcb | ||
![]() |
70787ab619 | ||
![]() |
35efada5ec | ||
![]() |
381ab6b7cd | ||
![]() |
4be95b67a7 | ||
![]() |
5e0f8c8a4c | ||
![]() |
e318ba30fb | ||
![]() |
d9721f20d8 | ||
![]() |
3e53195bce | ||
![]() |
11e1f68065 | ||
![]() |
c21c1d459e | ||
![]() |
43c8c4ce04 | ||
![]() |
7b76fa924d | ||
![]() |
7934c6f918 | ||
![]() |
c27ed38bb2 | ||
![]() |
5a962b5939 | ||
![]() |
705eb4eeb2 | ||
![]() |
cbf3200885 | ||
![]() |
adee5b97bc | ||
![]() |
42e004feb9 | ||
![]() |
91c15babdf | ||
![]() |
4996e53ed3 | ||
![]() |
84c862d8f3 | ||
![]() |
3e67623ab5 | ||
![]() |
86f4dd0273 | ||
![]() |
19e5758590 | ||
![]() |
f6bbd024d9 | ||
![]() |
ab703f44b4 | ||
![]() |
a0d9ad6f70 | ||
![]() |
90ac0a2d77 | ||
![]() |
dddcb80945 | ||
![]() |
d10f6f8367 | ||
![]() |
9f561c54c7 | ||
![]() |
4f19427641 | ||
![]() |
8c6ab479ab | ||
![]() |
9cc1b76087 | ||
![]() |
dc86c12c45 | ||
![]() |
9f96bb4c73 | ||
![]() |
62f939b857 | ||
![]() |
8238f41b34 | ||
![]() |
7a2503ab8c | ||
![]() |
8365177644 | ||
![]() |
33cfad0b8f | ||
![]() |
5916d31b24 | ||
![]() |
fc141f2286 | ||
![]() |
0d08f43d71 | ||
![]() |
94eccd15c5 | ||
![]() |
ad906d85ea | ||
![]() |
38ccf7c8e5 | ||
![]() |
53cb081b4c | ||
![]() |
44f2fe5170 | ||
![]() |
58e0d2d5b5 | ||
![]() |
7c6d2ad916 | ||
![]() |
fca93eac19 | ||
![]() |
88820dc781 | ||
![]() |
1ff306a396 | ||
![]() |
32f68c1f9a | ||
![]() |
61afc70454 | ||
![]() |
09d2a1605b | ||
![]() |
7e944c77c0 | ||
![]() |
f9c96cf56f | ||
![]() |
a3ad33daf9 | ||
![]() |
ebe1821635 | ||
![]() |
b8a8d7a64e | ||
![]() |
712f471ebf | ||
![]() |
c38f9e980c | ||
![]() |
f6e3b59e5e | ||
![]() |
fb280834d7 | ||
![]() |
a6bc200c28 | ||
![]() |
79a17b0112 | ||
![]() |
76522d58c3 | ||
![]() |
01ffcf342a | ||
![]() |
05dc158e3c | ||
![]() |
a60af53413 | ||
![]() |
f18d069d46 | ||
![]() |
48c283a296 | ||
![]() |
0eef73ea43 | ||
![]() |
765b20333d | ||
![]() |
b38b7fef36 | ||
![]() |
7117bf6270 | ||
![]() |
e54ab383f7 | ||
![]() |
b9af0fcdfb | ||
![]() |
83cbc06ab9 | ||
![]() |
db4d6bb42c | ||
![]() |
f51ab4a81f | ||
![]() |
6d886bb74d | ||
![]() |
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 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,6 +10,7 @@
|
||||
/dracut-install
|
||||
/modules.d/99base/switch_root
|
||||
/test/*/test.log
|
||||
/test/*/.testdir
|
||||
test*.img
|
||||
/.buildpath
|
||||
/.project
|
||||
|
49
.travis.yml
Normal file
49
.travis.yml
Normal file
@@ -0,0 +1,49 @@
|
||||
language: generic
|
||||
dist: bionic
|
||||
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=60
|
||||
- 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=29 TESTS=13
|
||||
- IMAGE=29 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 fetch --tags --unshallow
|
||||
- |
|
||||
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
|
||||
|
@@ -35,10 +35,14 @@ case "$COMMAND" in
|
||||
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
elif [[ -f /usr/lib/kernel/cmdline ]]; then
|
||||
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
|
||||
fi
|
||||
else
|
||||
declare -a BOOT_OPTIONS
|
||||
|
||||
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
|
||||
read -r -d '' -a BOOT_OPTIONS < /proc/cmdline
|
||||
read -r -d '' -a line < /proc/cmdline
|
||||
for i in "${line[@]}"; do
|
||||
[[ "${i#initrd=*}" != "$i" ]] && continue
|
||||
BOOT_OPTIONS+=("$i")
|
||||
done
|
||||
fi
|
||||
|
||||
unset noimageifnotneeded
|
||||
@@ -49,7 +53,7 @@ case "$COMMAND" in
|
||||
break
|
||||
fi
|
||||
done
|
||||
dracut ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
|
||||
dracut -f ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
|
||||
ret=$?
|
||||
;;
|
||||
remove)
|
||||
|
68
51-dracut-rescue-postinst.sh
Executable file
68
51-dracut-rescue-postinst.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
|
||||
export LANG=C
|
||||
|
||||
KERNEL_VERSION="$1"
|
||||
KERNEL_IMAGE="$2"
|
||||
|
||||
[[ -f /etc/os-release ]] && . /etc/os-release
|
||||
|
||||
if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then
|
||||
systemd-machine-id-setup
|
||||
fi
|
||||
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
[[ $MACHINE_ID ]] || exit 1
|
||||
[[ -f $KERNEL_IMAGE ]] || exit 1
|
||||
|
||||
INITRDFILE="/boot/initramfs-0-rescue-${MACHINE_ID}.img"
|
||||
NEW_KERNEL_IMAGE="${KERNEL_IMAGE%/*}/vmlinuz-0-rescue-${MACHINE_ID}"
|
||||
|
||||
[[ -f $INITRDFILE ]] && [[ -f $NEW_KERNEL_IMAGE ]] && exit 0
|
||||
|
||||
dropindirs_sort()
|
||||
{
|
||||
suffix=$1; shift
|
||||
args=("$@")
|
||||
files=$(
|
||||
while (( $# > 0 )); do
|
||||
for i in ${1}/*${suffix}; do
|
||||
[[ -f $i ]] && echo ${i##*/}
|
||||
done
|
||||
shift
|
||||
done | sort -Vu
|
||||
)
|
||||
|
||||
for f in $files; do
|
||||
for d in "${args[@]}"; do
|
||||
if [[ -f "$d/$f" ]]; then
|
||||
echo "$d/$f"
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
# source our config dir
|
||||
for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
|
||||
[[ $dracut_rescue_image != "yes" ]] && exit 0
|
||||
|
||||
if [[ ! -f $INITRDFILE ]]; then
|
||||
dracut --no-hostonly -a "rescue" "$INITRDFILE" "$KERNEL_VERSION"
|
||||
((ret+=$?))
|
||||
fi
|
||||
|
||||
if [[ ! -f $NEW_KERNEL_IMAGE ]]; then
|
||||
cp --reflink=auto "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
|
||||
((ret+=$?))
|
||||
fi
|
||||
|
||||
new-kernel-pkg --install "$KERNEL_VERSION" --kernel-image "$NEW_KERNEL_IMAGE" --initrdfile "$INITRDFILE" --banner "$NAME $VERSION_ID Rescue $MACHINE_ID"
|
||||
|
||||
((ret+=$?))
|
||||
|
||||
exit $ret
|
@@ -47,9 +47,9 @@ if [[ -f /etc/kernel/cmdline ]]; then
|
||||
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
elif [[ -f /usr/lib/kernel/cmdline ]]; then
|
||||
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
|
||||
fi
|
||||
else
|
||||
declare -a BOOT_OPTIONS
|
||||
|
||||
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
|
||||
read -r -d '' -a line < /proc/cmdline
|
||||
for i in "${line[@]}"; do
|
||||
[[ "${i#initrd=*}" != "$i" ]] && continue
|
||||
@@ -57,12 +57,6 @@ if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
|
||||
done
|
||||
fi
|
||||
|
||||
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
|
||||
echo "Could not determine the kernel command line parameters." >&2
|
||||
echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -d "${BOOT_DIR_ABS%/*}" ]]; then
|
||||
BOOT_DIR="/${MACHINE_ID}/0-rescue"
|
||||
BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}
|
||||
@@ -98,7 +92,7 @@ case "$COMMAND" in
|
||||
fi
|
||||
|
||||
if [[ ! -f "$BOOT_DIR_ABS/$INITRD" ]]; then
|
||||
dracut --no-hostonly -a "rescue" "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
|
||||
dracut -f --no-hostonly -a "rescue" "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
|
||||
((ret+=$?))
|
||||
fi
|
||||
|
||||
|
16
AUTHORS
16
AUTHORS
@@ -14,20 +14,22 @@ Daniel Molkentin <dmolkentin@suse.com>
|
||||
Amerigo Wang <amwang@redhat.com>
|
||||
Thomas Renninger <trenn@suse.com>
|
||||
Lukas Nykryn <lnykryn@redhat.com>
|
||||
WANG Chao <chaowang@redhat.com>
|
||||
Alexander Tsoy <alexander@tsoy.me>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
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>
|
||||
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>
|
||||
@@ -38,6 +40,7 @@ Brendan Germain <brendan.germain@nasdaqomx.com>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Leho Kraav <leho@kraav.com>
|
||||
Moritz Maxeiner <moritz@ucworks.org>
|
||||
Nicolas Chauvet <kwizart@gmail.com>
|
||||
Ondrej Mosnacek <omosnace@redhat.com>
|
||||
Fabian Deutsch <fabiand@fedoraproject.org>
|
||||
Javier Martinez Canillas <javierm@redhat.com>
|
||||
@@ -45,7 +48,6 @@ 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>
|
||||
@@ -69,7 +71,6 @@ Dennis Gilmore <dennis@ausil.us>
|
||||
Jan Synacek <jsynacek@redhat.com>
|
||||
Jon Ander Hernandez <jonan.h@gmail.com>
|
||||
Juan RP <xtraeme@gmail.com>
|
||||
Kairui Song <kasong@redhat.com>
|
||||
Lance Albertson <lance@osuosl.org>
|
||||
Marcos Mello <marcosfrm@gmail.com>
|
||||
Marian Ganisin <mganisin@redhat.com>
|
||||
@@ -105,7 +106,6 @@ 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>
|
||||
@@ -117,6 +117,7 @@ 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>
|
||||
@@ -143,6 +144,7 @@ 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>
|
||||
@@ -205,11 +207,11 @@ 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>
|
||||
Tong Li <tonli@redhat.com>
|
||||
Tony Asleson <tasleson@redhat.com>
|
||||
Vadim Kuznetsov <vadimk@gentoo.org>
|
||||
Vaughan Cao <vaughan.cao@oracle.com>
|
||||
Vratislav Podzimek <vpodzime@redhat.com>
|
||||
|
59
Makefile
59
Makefile
@@ -1,7 +1,8 @@
|
||||
-include dracut-version.sh
|
||||
|
||||
VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags 2>/dev/null || echo $(DRACUT_VERSION))
|
||||
GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
|
||||
DRACUT_MAIN_VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags --always 2>/dev/null || :)
|
||||
DRACUT_MAIN_VERSION ?= $(DRACUT_VERSION)
|
||||
GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags --always 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
|
||||
|
||||
-include Makefile.inc
|
||||
|
||||
@@ -40,7 +41,7 @@ man8pages = dracut.8 \
|
||||
|
||||
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
|
||||
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
|
||||
.PHONY: install clean archive rpm srpm testimage test all check AUTHORS doc dracut-version.sh
|
||||
|
||||
all: dracut-version.sh dracut.pc dracut-install skipcpio/skipcpio
|
||||
|
||||
@@ -63,6 +64,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 $< $@
|
||||
|
||||
@@ -105,7 +109,7 @@ dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
|
||||
dracut.pc: Makefile.inc Makefile
|
||||
@echo "Name: dracut" > dracut.pc
|
||||
@echo "Description: dracut" >> dracut.pc
|
||||
@echo "Version: $(VERSION)$(GITVERSION)" >> dracut.pc
|
||||
@echo "Version: $(DRACUT_MAIN_VERSION)$(GITVERSION)" >> dracut.pc
|
||||
@echo "dracutdir=$(pkglibdir)" >> dracut.pc
|
||||
@echo "dracutmodulesdir=$(pkglibdir)/modules.d" >> dracut.pc
|
||||
@echo "dracutconfdir=$(pkglibdir)/dracut.conf.d" >> dracut.pc
|
||||
@@ -175,7 +179,7 @@ endif
|
||||
|
||||
dracut-version.sh:
|
||||
@rm -f dracut-version.sh
|
||||
@echo "DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh
|
||||
@echo "DRACUT_VERSION=$(DRACUT_MAIN_VERSION)$(GITVERSION)" > dracut-version.sh
|
||||
|
||||
clean:
|
||||
$(RM) *~
|
||||
@@ -190,28 +194,39 @@ clean:
|
||||
$(RM) $(manpages) dracut.html
|
||||
$(MAKE) -C test clean
|
||||
|
||||
dist: dracut-$(VERSION).tar.xz
|
||||
dist: dracut-$(DRACUT_MAIN_VERSION).tar.xz
|
||||
|
||||
dracut-$(VERSION).tar.xz: doc syncheck
|
||||
@echo "DRACUT_VERSION=$(VERSION)" > dracut-version.sh
|
||||
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ > dracut-$(VERSION).tar
|
||||
mkdir -p dracut-$(VERSION)
|
||||
for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(VERSION)/$${i%/*}"; cp "$$i" "dracut-$(VERSION)/$$i"; done
|
||||
tar --owner=root --group=root -rf dracut-$(VERSION).tar $$(find dracut-$(VERSION) -type f)
|
||||
rm -fr -- dracut-$(VERSION).tar.xz dracut-$(VERSION)
|
||||
xz -9 dracut-$(VERSION).tar
|
||||
rm -f -- dracut-$(VERSION).tar
|
||||
dracut-$(DRACUT_MAIN_VERSION).tar.xz: doc syncheck
|
||||
@echo "DRACUT_VERSION=$(DRACUT_MAIN_VERSION)" > dracut-version.sh
|
||||
git archive --format=tar $(DRACUT_MAIN_VERSION) --prefix=dracut-$(DRACUT_MAIN_VERSION)/ > dracut-$(DRACUT_MAIN_VERSION).tar
|
||||
mkdir -p dracut-$(DRACUT_MAIN_VERSION)
|
||||
for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(DRACUT_MAIN_VERSION)/$${i%/*}"; cp "$$i" "dracut-$(DRACUT_MAIN_VERSION)/$$i"; done
|
||||
tar --owner=root --group=root -rf dracut-$(DRACUT_MAIN_VERSION).tar $$(find dracut-$(DRACUT_MAIN_VERSION) -type f)
|
||||
rm -fr -- dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut-$(DRACUT_MAIN_VERSION)
|
||||
xz -9 dracut-$(DRACUT_MAIN_VERSION).tar
|
||||
rm -f -- dracut-$(DRACUT_MAIN_VERSION).tar
|
||||
|
||||
rpm: dracut-$(VERSION).tar.xz syncheck
|
||||
rpm: dracut-$(DRACUT_MAIN_VERSION).tar.xz syncheck
|
||||
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
|
||||
cp dracut-$(VERSION).tar.xz "$$rpmbuild"; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
cp dracut-$(DRACUT_MAIN_VERSION).tar.xz "$$rpmbuild"; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(DRACUT_MAIN_VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
(cd "$$rpmbuild"; \
|
||||
wget https://www.gnu.org/licenses/lgpl-2.1.txt; \
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
|
||||
--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
|
||||
( mv "$$rpmbuild"/{,$$(arch)/}*.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
|
||||
( mv "$$rpmbuild"/{,$$(uname -m)/}*.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
|
||||
|
||||
srpm: dracut-$(DRACUT_MAIN_VERSION).tar.xz syncheck
|
||||
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
|
||||
cp dracut-$(DRACUT_MAIN_VERSION).tar.xz "$$rpmbuild"; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(DRACUT_MAIN_VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
(cd "$$rpmbuild"; \
|
||||
[ -f $$src/lgpl-2.1.txt ] && cp $$src/lgpl-2.1.txt . || wget https://www.gnu.org/licenses/lgpl-2.1.txt; \
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
|
||||
--define "_rpmdir $$PWD" -bs dracut.spec; ) && \
|
||||
( mv "$$rpmbuild"/*.src.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
|
||||
|
||||
syncheck:
|
||||
@ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \
|
||||
@@ -259,9 +274,9 @@ efi: all
|
||||
AUTHORS:
|
||||
git shortlog --numbered --summary -e |while read a rest || [ -n "$$rest" ]; do echo $$rest;done > AUTHORS
|
||||
|
||||
dracut.html.sign: dracut-$(VERSION).tar.xz dracut.html
|
||||
gpg-sign-all dracut-$(VERSION).tar.xz dracut.html
|
||||
dracut.html.sign: dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut.html
|
||||
gpg-sign-all dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut.html
|
||||
|
||||
upload: dracut.html.sign
|
||||
kup put dracut-$(VERSION).tar.xz dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/
|
||||
kup put dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut-$(DRACUT_MAIN_VERSION).tar.sign /pub/linux/utils/boot/dracut/
|
||||
kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/
|
||||
|
60
NEWS
60
NEWS
@@ -1,4 +1,62 @@
|
||||
dracut-047
|
||||
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:
|
||||
|
86
README
86
README
@@ -1,86 +0,0 @@
|
||||
dracut
|
||||
------
|
||||
dracut is an event driven initramfs infrastructure.
|
||||
|
||||
dracut (the tool) is used to create an initramfs image by copying tools
|
||||
and files from an installed system and combining it with the
|
||||
dracut framework, usually found in /usr/lib/dracut/modules.d.
|
||||
|
||||
Unlike existing initramfs's, this is an attempt at having as little as
|
||||
possible hard-coded into the initramfs as possible. The initramfs has
|
||||
(basically) one purpose in life -- getting the rootfs mounted so that
|
||||
we can transition to the real rootfs. This is all driven off of
|
||||
device availability. Therefore, instead of scripts hard-coded to do
|
||||
various things, we depend on udev to create device nodes for us and
|
||||
then when we have the rootfs's device node, we mount and carry on.
|
||||
This helps to keep the time required in the initramfs as little as
|
||||
possible so that things like a 5 second boot aren't made impossible as
|
||||
a result of the very existence of an initramfs. It's likely that
|
||||
we'll grow some hooks for running arbitrary commands in the flow of
|
||||
the script, but it's worth trying to resist the urge as much as we can
|
||||
as hooks are guaranteed to be the path to slow-down.
|
||||
|
||||
Most of the initramfs generation functionality in dracut is provided by a bunch
|
||||
of generator modules that are sourced by the main dracut script to install
|
||||
specific functionality into the initramfs. They live in the modules.d
|
||||
subdirectory, and use functionality provided by dracut-functions to do their
|
||||
work.
|
||||
|
||||
Some general rules for writing modules:
|
||||
* Use one of the inst family of functions to actually install files
|
||||
on to the initramfs. They handle mangling the pathnames and (for binaries,
|
||||
scripts, and kernel modules) installing dependencies as appropriate so
|
||||
you do not have to.
|
||||
* Scripts that end up on the initramfs should be POSIX compliant. dracut
|
||||
will try to use /bin/dash as /bin/sh for the initramfs if it is available,
|
||||
so you should install it on your system -- dash aims for strict POSIX
|
||||
compliance to the extent possible.
|
||||
* Hooks MUST be POSIX compliant -- they are sourced by the init script,
|
||||
and having a bashism break your user's ability to boot really sucks.
|
||||
* Generator modules should have a two digit numeric prefix -- they run in
|
||||
ascending sort order. Anything in the 90-99 range is stuff that dracut
|
||||
relies on, so try not to break those hooks.
|
||||
* Hooks must have a .sh extension.
|
||||
* Generator modules are described in more detail in README.modules.
|
||||
* We have some breakpoints for debugging your hooks. If you pass 'rdbreak'
|
||||
as a kernel parameter, the initramfs will drop to a shell just before
|
||||
switching to a new root. You can pass 'rdbreak=hookpoint', and the initramfs
|
||||
will break just before hooks in that hookpoint run.
|
||||
|
||||
Also, there is an attempt to keep things as distribution-agnostic as
|
||||
possible. Every distribution has their own tool here and it's not
|
||||
something which is really interesting to have separate across them.
|
||||
So contributions to help decrease the distro-dependencies are welcome.
|
||||
|
||||
Currently dracut lives on github.com and kernel.org.
|
||||
|
||||
The tarballs can be found here:
|
||||
http://www.kernel.org/pub/linux/utils/boot/dracut/
|
||||
ftp://ftp.kernel.org/pub/linux/utils/boot/dracut/
|
||||
|
||||
Git:
|
||||
git://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
http://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
https://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
|
||||
git@github.com:dracutdevs/dracut.git
|
||||
|
||||
Git Web:
|
||||
https://github.com/dracutdevs/dracut.git
|
||||
|
||||
http://git.kernel.org/?p=boot/dracut/dracut.git
|
||||
|
||||
Project Documentation:
|
||||
http://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html
|
||||
|
||||
Project Wiki:
|
||||
http://dracut.wiki.kernel.org
|
||||
|
||||
See the TODO file for things which still need to be done and HACKING for
|
||||
some instructions on how to get started. There is also a mailing list
|
||||
that is being used for the discussion -- initramfs@vger.kernel.org.
|
||||
It is a typical vger list, send mail to majordomo@vger.kernel.org with body
|
||||
of 'subscribe initramfs email@host.com'
|
||||
|
||||
|
||||
Licensed under the GPLv2
|
107
README.md
107
README.md
@@ -1,26 +1,89 @@
|
||||
# dracut - master branch
|
||||
dracut
|
||||
====
|
||||
|
||||
dracut is an initramfs infrastructure.
|
||||
dracut is an event driven initramfs infrastructure.
|
||||
|
||||
## CentOS CI
|
||||
[](https://travis-ci.org/dracutdevs/dracut)
|
||||
|
||||
[](https://ci.centos.org/job/dracut-push-master/)
|
||||
dracut (the tool) is used to create an initramfs image by copying tools
|
||||
and files from an installed system and combining it with the
|
||||
dracut framework, usually found in /usr/lib/dracut/modules.d.
|
||||
|
||||
- Test 01: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=01,label=dracut-ci-slave01/)
|
||||
- Test 02: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=02,label=dracut-ci-slave01/)
|
||||
- Test 03: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=03,label=dracut-ci-slave01/)
|
||||
- Test 04: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=04,label=dracut-ci-slave01/)
|
||||
- Test 10: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=10,label=dracut-ci-slave01/)
|
||||
- Test 11: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=11,label=dracut-ci-slave01/)
|
||||
- Test 12: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=12,label=dracut-ci-slave01/)
|
||||
- Test 13: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=13,label=dracut-ci-slave01/)
|
||||
- Test 14: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=14,label=dracut-ci-slave01/)
|
||||
- Test 15: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=15,label=dracut-ci-slave01/)
|
||||
- Test 16: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=16,label=dracut-ci-slave01/)
|
||||
- Test 17: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=17,label=dracut-ci-slave01/)
|
||||
- Test 20: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=20,label=dracut-ci-slave01/)
|
||||
- Test 30: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=30,label=dracut-ci-slave01/)
|
||||
- Test 31: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=31,label=dracut-ci-slave01/)
|
||||
- Test 40: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=40,label=dracut-ci-slave01/)
|
||||
- Test 50: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=50,label=dracut-ci-slave01/)
|
||||
- Test 70: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=70,label=dracut-ci-slave01/)
|
||||
Unlike existing initramfs's, this is an attempt at having as little as
|
||||
possible hard-coded into the initramfs as possible. The initramfs has
|
||||
(basically) one purpose in life -- getting the rootfs mounted so that
|
||||
we can transition to the real rootfs. This is all driven off of
|
||||
device availability. Therefore, instead of scripts hard-coded to do
|
||||
various things, we depend on udev to create device nodes for us and
|
||||
then when we have the rootfs's device node, we mount and carry on.
|
||||
This helps to keep the time required in the initramfs as little as
|
||||
possible so that things like a 5 second boot aren't made impossible as
|
||||
a result of the very existence of an initramfs. It's likely that
|
||||
we'll grow some hooks for running arbitrary commands in the flow of
|
||||
the script, but it's worth trying to resist the urge as much as we can
|
||||
as hooks are guaranteed to be the path to slow-down.
|
||||
|
||||
Most of the initramfs generation functionality in dracut is provided by a bunch
|
||||
of generator modules that are sourced by the main dracut script to install
|
||||
specific functionality into the initramfs. They live in the modules.d
|
||||
subdirectory, and use functionality provided by dracut-functions to do their
|
||||
work.
|
||||
|
||||
Some general rules for writing modules:
|
||||
* Use one of the inst family of functions to actually install files
|
||||
on to the initramfs. They handle mangling the pathnames and (for binaries,
|
||||
scripts, and kernel modules) installing dependencies as appropriate so
|
||||
you do not have to.
|
||||
* Scripts that end up on the initramfs should be POSIX compliant. dracut
|
||||
will try to use /bin/dash as /bin/sh for the initramfs if it is available,
|
||||
so you should install it on your system -- dash aims for strict POSIX
|
||||
compliance to the extent possible.
|
||||
* Hooks MUST be POSIX compliant -- they are sourced by the init script,
|
||||
and having a bashism break your user's ability to boot really sucks.
|
||||
* Generator modules should have a two digit numeric prefix -- they run in
|
||||
ascending sort order. Anything in the 90-99 range is stuff that dracut
|
||||
relies on, so try not to break those hooks.
|
||||
* Hooks must have a .sh extension.
|
||||
* Generator modules are described in more detail in README.modules.
|
||||
* We have some breakpoints for debugging your hooks. If you pass 'rdbreak'
|
||||
as a kernel parameter, the initramfs will drop to a shell just before
|
||||
switching to a new root. You can pass 'rdbreak=hookpoint', and the initramfs
|
||||
will break just before hooks in that hookpoint run.
|
||||
|
||||
Also, there is an attempt to keep things as distribution-agnostic as
|
||||
possible. Every distribution has their own tool here and it's not
|
||||
something which is really interesting to have separate across them.
|
||||
So contributions to help decrease the distro-dependencies are welcome.
|
||||
|
||||
Currently dracut lives on github.com and kernel.org.
|
||||
|
||||
The tarballs can be found here:
|
||||
http://www.kernel.org/pub/linux/utils/boot/dracut/
|
||||
ftp://ftp.kernel.org/pub/linux/utils/boot/dracut/
|
||||
|
||||
Git:
|
||||
git://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
http://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
https://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
|
||||
git@github.com:dracutdevs/dracut.git
|
||||
|
||||
Git Web:
|
||||
https://github.com/dracutdevs/dracut.git
|
||||
|
||||
http://git.kernel.org/?p=boot/dracut/dracut.git
|
||||
|
||||
Project Documentation:
|
||||
http://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html
|
||||
|
||||
Project Wiki:
|
||||
http://dracut.wiki.kernel.org
|
||||
|
||||
See the TODO file for things which still need to be done and HACKING for
|
||||
some instructions on how to get started. There is also a mailing list
|
||||
that is being used for the discussion -- initramfs@vger.kernel.org.
|
||||
It is a typical vger list, send mail to majordomo@vger.kernel.org with body
|
||||
of 'subscribe initramfs email@host.com'
|
||||
|
||||
|
||||
Licensed under the GPLv2
|
||||
|
@@ -174,9 +174,6 @@ convert_abs_rel() {
|
||||
# $ get_fs_env /dev/sda2
|
||||
# ext4
|
||||
get_fs_env() {
|
||||
local evalstr
|
||||
local found
|
||||
|
||||
[[ $1 ]] || return
|
||||
unset ID_FS_TYPE
|
||||
ID_FS_TYPE=$(blkid -u filesystem -o export -- "$1" \
|
||||
@@ -199,7 +196,7 @@ get_fs_env() {
|
||||
# $ get_maj_min /dev/sda2
|
||||
# 8:2
|
||||
get_maj_min() {
|
||||
local _maj _min _majmin
|
||||
local _majmin
|
||||
_majmin="$(stat -L -c '%t:%T' "$1" 2>/dev/null)"
|
||||
printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"
|
||||
}
|
||||
|
178
dracut-init.sh
178
dracut-init.sh
@@ -150,6 +150,14 @@ dracut_module_included() {
|
||||
[[ " $mods_to_load $modules_loaded " == *\ $*\ * ]]
|
||||
}
|
||||
|
||||
dracut_no_switch_root() {
|
||||
>"$initdir/lib/dracut/no-switch-root"
|
||||
}
|
||||
|
||||
dracut_module_path() {
|
||||
echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }
|
||||
}
|
||||
|
||||
if ! [[ $DRACUT_INSTALL ]]; then
|
||||
DRACUT_INSTALL=$(find_binary dracut-install)
|
||||
fi
|
||||
@@ -533,6 +541,14 @@ inst_libdir_file() {
|
||||
[[ $_files ]] && inst_multiple $_files
|
||||
}
|
||||
|
||||
# get a command to decompress the given file
|
||||
get_decompress_cmd() {
|
||||
case "$1" in
|
||||
*.gz) echo 'gzip -f -d' ;;
|
||||
*.bz2) echo 'bzip2 -d' ;;
|
||||
*.xz) echo 'xz -f -d' ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# install function decompressing the target and handling symlinks
|
||||
# $@ = list of compressed (gz or bz2) files or symlinks pointing to such files
|
||||
@@ -544,11 +560,8 @@ inst_decompress() {
|
||||
|
||||
for _src in $@
|
||||
do
|
||||
case ${_src} in
|
||||
*.gz) _cmd='gzip -f -d' ;;
|
||||
*.bz2) _cmd='bzip2 -d' ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
_cmd=$(get_decompress_cmd ${_src})
|
||||
[[ -z "${_cmd}" ]] && return 1
|
||||
inst_simple ${_src}
|
||||
# Decompress with chosen tool. We assume that tool changes name e.g.
|
||||
# from 'name.gz' to 'name'.
|
||||
@@ -567,15 +580,16 @@ inst_opt_decompress() {
|
||||
done
|
||||
}
|
||||
|
||||
# module_check <dracut module>
|
||||
# module_check <dracut module> [<forced>] [<module path>]
|
||||
# execute the check() function of module-setup.sh of <dracut module>
|
||||
# or the "check" script, if module-setup.sh is not found
|
||||
# "check $hostonly" is called
|
||||
module_check() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _moddir=$3
|
||||
local _ret
|
||||
local _forced=0
|
||||
local _hostonly=$hostonly
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[ $# -eq 2 ] && _forced=$2
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
@@ -598,14 +612,15 @@ module_check() {
|
||||
return $_ret
|
||||
}
|
||||
|
||||
# module_check_mount <dracut module>
|
||||
# module_check_mount <dracut module> [<module path>]
|
||||
# execute the check() function of module-setup.sh of <dracut module>
|
||||
# or the "check" script, if module-setup.sh is not found
|
||||
# "mount_needs=1 check 0" is called
|
||||
module_check_mount() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _moddir=$2
|
||||
local _ret
|
||||
mount_needs=1
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# if we do not have a check script, we are unconditionally included
|
||||
@@ -624,12 +639,13 @@ module_check_mount() {
|
||||
return $_ret
|
||||
}
|
||||
|
||||
# module_depends <dracut module>
|
||||
# module_depends <dracut module> [<module path>]
|
||||
# execute the depends() function of module-setup.sh of <dracut module>
|
||||
# or the "depends" script, if module-setup.sh is not found
|
||||
module_depends() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _moddir=$2
|
||||
local _ret
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# if we do not have a check script, we have no deps
|
||||
@@ -647,12 +663,13 @@ module_depends() {
|
||||
fi
|
||||
}
|
||||
|
||||
# module_cmdline <dracut module>
|
||||
# module_cmdline <dracut module> [<module path>]
|
||||
# execute the cmdline() function of module-setup.sh of <dracut module>
|
||||
# or the "cmdline" script, if module-setup.sh is not found
|
||||
module_cmdline() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _moddir=$2
|
||||
local _ret
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
[[ -x $_moddir/cmdline ]] && . "$_moddir/cmdline"
|
||||
@@ -668,12 +685,13 @@ module_cmdline() {
|
||||
fi
|
||||
}
|
||||
|
||||
# module_install <dracut module>
|
||||
# module_install <dracut module> [<module path>]
|
||||
# execute the install() function of module-setup.sh of <dracut module>
|
||||
# or the "install" script, if module-setup.sh is not found
|
||||
module_install() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _moddir=$2
|
||||
local _ret
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
[[ -x $_moddir/install ]] && . "$_moddir/install"
|
||||
@@ -689,12 +707,13 @@ module_install() {
|
||||
fi
|
||||
}
|
||||
|
||||
# module_installkernel <dracut module>
|
||||
# module_installkernel <dracut module> [<module path>]
|
||||
# execute the installkernel() function of module-setup.sh of <dracut module>
|
||||
# or the "installkernel" script, if module-setup.sh is not found
|
||||
module_installkernel() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _moddir=$2
|
||||
local _ret
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
[[ -x $_moddir/installkernel ]] && . "$_moddir/installkernel"
|
||||
@@ -710,15 +729,16 @@ module_installkernel() {
|
||||
fi
|
||||
}
|
||||
|
||||
# check_mount <dracut module>
|
||||
# check_mount <dracut module> [<use_as_dep>] [<module path>]
|
||||
# check_mount checks, if a dracut module is needed for the given
|
||||
# device and filesystem types in "${host_fs_types[@]}"
|
||||
check_mount() {
|
||||
local _mod=$1
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _moddir=$3
|
||||
local _ret
|
||||
local _moddep
|
||||
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[ "${#host_fs_types[@]}" -le 0 ] && return 1
|
||||
|
||||
# If we are already scheduled to be loaded, no need to check again.
|
||||
@@ -735,7 +755,7 @@ check_mount() {
|
||||
fi
|
||||
|
||||
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
|
||||
module_check_mount $_mod; ret=$?
|
||||
module_check_mount $_mod $_moddir; ret=$?
|
||||
|
||||
# explicit module, so also accept ret=255
|
||||
[[ $ret = 0 || $ret = 255 ]] || return 1
|
||||
@@ -743,14 +763,14 @@ check_mount() {
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check_mount $_mod || return 1
|
||||
module_check_mount $_mod $_moddir || return 1
|
||||
else
|
||||
# skip this module
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
for _moddep in $(module_depends $_mod); do
|
||||
for _moddep in $(module_depends $_mod $_moddir); do
|
||||
# handle deps as if they were manually added
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \
|
||||
@@ -774,15 +794,17 @@ check_mount() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# check_module <dracut module> [<use_as_dep>]
|
||||
# check_module <dracut module> [<use_as_dep>] [<module path>]
|
||||
# check if a dracut module is to be used in the initramfs process
|
||||
# if <use_as_dep> is set, then the process also keeps track
|
||||
# that the modules were checked for the dependency tracking process
|
||||
check_module() {
|
||||
local _mod=$1
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _moddir=$3
|
||||
local _ret
|
||||
local _moddep
|
||||
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
# If we are already scheduled to be loaded, no need to check again.
|
||||
[[ " $mods_to_load " == *\ $_mod\ * ]] && return 0
|
||||
[[ " $mods_checked_as_dep " == *\ $_mod\ * ]] && return 1
|
||||
@@ -799,9 +821,9 @@ check_module() {
|
||||
|
||||
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
|
||||
if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then
|
||||
module_check $_mod 1; ret=$?
|
||||
module_check $_mod 1 $_moddir; ret=$?
|
||||
else
|
||||
module_check $_mod 0; ret=$?
|
||||
module_check $_mod 0 $_moddir; ret=$?
|
||||
fi
|
||||
# explicit module, so also accept ret=255
|
||||
[[ $ret = 0 || $ret = 255 ]] || return 1
|
||||
@@ -809,7 +831,7 @@ check_module() {
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check $_mod; ret=$?
|
||||
module_check $_mod 0 $_moddir; ret=$?
|
||||
if [[ $ret != 0 ]]; then
|
||||
[[ $2 ]] && return 1
|
||||
[[ $ret != 255 ]] && return 1
|
||||
@@ -820,7 +842,7 @@ check_module() {
|
||||
fi
|
||||
fi
|
||||
|
||||
for _moddep in $(module_depends $_mod); do
|
||||
for _moddep in $(module_depends $_mod $_moddir); do
|
||||
# handle deps as if they were manually added
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \
|
||||
@@ -845,7 +867,7 @@ check_module() {
|
||||
}
|
||||
|
||||
# for_each_module_dir <func>
|
||||
# execute "<func> <dracut module> 1"
|
||||
# execute "<func> <dracut module> 1 <module path>"
|
||||
for_each_module_dir() {
|
||||
local _modcheck
|
||||
local _mod
|
||||
@@ -857,7 +879,7 @@ for_each_module_dir() {
|
||||
[[ -e $_moddir/install || -e $_moddir/installkernel || \
|
||||
-e $_moddir/module-setup.sh ]] || continue
|
||||
_mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]}
|
||||
$_func $_mod 1
|
||||
$_func $_mod 1 $_moddir
|
||||
done
|
||||
|
||||
# Report any missing dracut modules, the user has specified
|
||||
@@ -878,80 +900,6 @@ for_each_module_dir() {
|
||||
done
|
||||
}
|
||||
|
||||
# Install a single kernel module along with any firmware it may require.
|
||||
# $1 = full path to kernel module to install
|
||||
install_kmod_with_fw() {
|
||||
# no need to go further if the module is already installed
|
||||
|
||||
[[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \
|
||||
&& return 0
|
||||
|
||||
if [[ $omit_drivers ]]; then
|
||||
local _kmod=${1##*/}
|
||||
_kmod=${_kmod%.ko*}
|
||||
_kmod=${_kmod/-/_}
|
||||
if [[ "$_kmod" =~ $omit_drivers ]]; then
|
||||
dinfo "Omitting driver $_kmod"
|
||||
return 0
|
||||
fi
|
||||
if [[ "${1##*/lib/modules/$kernel/}" =~ $omit_drivers ]]; then
|
||||
dinfo "Omitting driver $_kmod"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $silent_omit_drivers ]]; then
|
||||
local _kmod=${1##*/}
|
||||
_kmod=${_kmod%.ko*}
|
||||
_kmod=${_kmod/-/_}
|
||||
[[ "$_kmod" =~ $silent_omit_drivers ]] && return 0
|
||||
[[ "${1##*/lib/modules/$kernel/}" =~ $silent_omit_drivers ]] && return 0
|
||||
fi
|
||||
|
||||
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}"
|
||||
ret=$?
|
||||
(($ret != 0)) && return $ret
|
||||
|
||||
local _modname=${1##*/} _fwdir _found _fw
|
||||
_modname=${_modname%.ko*}
|
||||
for _fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
|
||||
_found=''
|
||||
for _fwdir in $fw_dir; do
|
||||
[[ -d $_fwdir && -f $_fwdir/$_fw ]] || continue
|
||||
inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw"
|
||||
_found=yes
|
||||
done
|
||||
if [[ $_found != yes ]]; then
|
||||
if ! [[ -d $(echo /sys/module/${_modname//-/_}|{ read a b; echo $a; }) ]]; then
|
||||
dinfo "Possible missing firmware \"${_fw}\" for kernel module" \
|
||||
"\"${_modname}.ko\""
|
||||
else
|
||||
dwarn "Possible missing firmware \"${_fw}\" for kernel module" \
|
||||
"\"${_modname}.ko\""
|
||||
fi
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# Do something with all the dependencies of a kernel module.
|
||||
# Note that kernel modules depend on themselves using the technique we use
|
||||
# $1 = function to call for each dependency we find
|
||||
# It will be passed the full path to the found kernel module
|
||||
# $2 = module to get dependencies for
|
||||
# rest of args = arguments to modprobe
|
||||
# _fderr specifies FD passed from surrounding scope
|
||||
for_each_kmod_dep() {
|
||||
local _func=$1 _kmod=$2 _cmd _modpath _options
|
||||
shift 2
|
||||
modprobe "$@" --ignore-install --show-depends $_kmod 2>&${_fderr} | (
|
||||
while read _cmd _modpath _options || [ -n "$_cmd" ]; do
|
||||
[[ $_cmd = insmod ]] || continue
|
||||
$_func ${_modpath} || exit $?
|
||||
done
|
||||
)
|
||||
}
|
||||
|
||||
dracut_kernel_post() {
|
||||
for _f in modules.builtin.bin modules.builtin modules.order; do
|
||||
[[ -e $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
|
||||
@@ -1037,3 +985,25 @@ else
|
||||
ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}"
|
||||
}
|
||||
fi
|
||||
|
||||
is_qemu_virtualized() {
|
||||
# 0 if a virt environment was detected
|
||||
# 1 if a virt environment could not be detected
|
||||
# 255 if any error was encountered
|
||||
if type -P systemd-detect-virt >/dev/null 2>&1; then
|
||||
vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
|
||||
(($? != 0)) && return 255
|
||||
[[ $vm = "qemu" ]] && return 0
|
||||
[[ $vm = "kvm" ]] && return 0
|
||||
[[ $vm = "bochs" ]] && return 0
|
||||
fi
|
||||
|
||||
for i in /sys/class/dmi/id/*_vendor; do
|
||||
[[ -f $i ]] || continue
|
||||
read vendor < $i
|
||||
[[ "$vendor" == "QEMU" ]] && return 0
|
||||
[[ "$vendor" == "Red Hat" ]] && return 0
|
||||
[[ "$vendor" == "Bochs" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
@@ -40,4 +40,18 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -d squash ]]; then
|
||||
unsquashfs -no-xattrs -f -d . squash/root.img >/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Squash module is enabled for this initramfs but failed to unpack squash/root.img" >&2
|
||||
rm -f -- /run/initramfs/shutdown
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e /etc/selinux/config -a -x /usr/sbin/setfiles ] ; then
|
||||
. /etc/selinux/config
|
||||
/usr/sbin/setfiles -v -r /run/initramfs /etc/selinux/${SELINUXTYPE}/contexts/files/file_contexts /run/initramfs > /dev/null
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
@@ -61,7 +61,7 @@ Depending on which algorithms were compiled statically into it, the kernel can
|
||||
currently unpack initrd/initramfs images compressed with gzip, bzip2 and LZMA.
|
||||
|
||||
== Mount preparations
|
||||
dracut can generate a customized initrams image which contains only whatever is
|
||||
dracut can generate a customized initramfs image which contains only whatever is
|
||||
necessary to boot some particular computer, such as ATA, SCSI and filesystem
|
||||
kernel modules (host-only mode).
|
||||
|
||||
@@ -142,7 +142,7 @@ The following steps are executed during a shutdown:
|
||||
* if yes, it does a pivot_root to /run/initramfs and executes ./shutdown.
|
||||
The old root is then mounted on /oldroot.
|
||||
/usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable.
|
||||
* shutdown will try to umount every /oldroot mount and calls the various
|
||||
* shutdown will try to unmount every /oldroot mount and calls the various
|
||||
shutdown hooks from the dracut modules
|
||||
|
||||
This ensures, that all devices are disassembled and unmounted cleanly.
|
||||
|
@@ -242,7 +242,7 @@ rd.vconsole.keymap=de-latin1-nodeadkeys
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
rd.vconsole.font=LatArCyrHeb-16
|
||||
rd.vconsole.font=eurlatgr
|
||||
--
|
||||
|
||||
**rd.vconsole.font.map=**__<console map base file name>__::
|
||||
@@ -346,7 +346,7 @@ As you see, you can skip colons in such a case.
|
||||
[NOTE]
|
||||
===============================
|
||||
dracut pipes key to cryptsetup with _-d -_ argument, therefore you need to pipe
|
||||
to crypsetup luksFormat with _-d -_, too!
|
||||
to cryptsetup luksFormat with _-d -_, too!
|
||||
|
||||
Here follows example for key encrypted with GPG:
|
||||
|
||||
@@ -528,7 +528,7 @@ same <interface>.
|
||||
number, encoding the network prefix length.
|
||||
|
||||
**ifname=**__<interface>__:__<MAC>__::
|
||||
Assign network device name <interface> (ie "bootnet") to the NIC with
|
||||
Assign network device name <interface> (i.e. "bootnet") to the NIC with
|
||||
MAC <MAC>.
|
||||
+
|
||||
WARNING: Do **not** use the default kernel naming scheme for the interface name,
|
||||
@@ -601,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
|
||||
@@ -765,6 +765,9 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30
|
||||
|
||||
FCoE
|
||||
~~~~
|
||||
**rd.nofcoe=0**::
|
||||
disable FCoE and lldpad
|
||||
|
||||
**fcoe=**__<edd|interface|MAC>__:__{dcb|nodcb}__:__{fabric|vn2vn}__::
|
||||
Try to connect to a FCoE SAN through the NIC specified by _<interface>_ or
|
||||
_<MAC>_ or EDD settings. The second argument specifies if DCB
|
||||
@@ -838,23 +841,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
|
||||
@@ -865,21 +869,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
|
||||
@@ -887,12 +905,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
|
||||
@@ -902,7 +920,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)
|
||||
@@ -930,10 +948,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
|
||||
@@ -945,7 +964,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.
|
||||
@@ -953,35 +972,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::
|
||||
@@ -992,25 +1028,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.
|
||||
|
||||
|
||||
|
@@ -157,7 +157,7 @@ provide a valid _/etc/fstab_.
|
||||
archive. This cpio archive gets glued (concatenated, uncompressed one
|
||||
must be the first one) to the compressed cpio archive. The first,
|
||||
uncompressed cpio archive is for data which the kernel must be able
|
||||
to access very early (and cannot make use of uncompress alogrithms yet)
|
||||
to access very early (and cannot make use of uncompress algorithms yet)
|
||||
like microcode or ACPI tables (default=no).
|
||||
|
||||
*acpi_table_dir=*"__<dir>__"::
|
||||
@@ -187,7 +187,7 @@ provide a valid _/etc/fstab_.
|
||||
|
||||
*i18n_default_font=*"__<fontname>__"::
|
||||
The font <fontname> to install, if not specified otherwise.
|
||||
Default is "LatArCyrHeb-16".
|
||||
Default is "eurlatgr".
|
||||
|
||||
*i18n_install_all=*"__{yes|no}__"::
|
||||
Install everything regardless of generic or hostonly mode.
|
||||
@@ -204,6 +204,10 @@ provide a valid _/etc/fstab_.
|
||||
_/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
|
||||
or _/usr/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
|
||||
|
||||
*uefi_secureboot_cert=*"_<FILE>_", *uefi_secureboot_key=*"_<FILE>_"::
|
||||
Specifies a certificate and corresponding key, which are used to sign the created UEFI executable.
|
||||
Requires both certificate and key need to be specified and _sbsign_ to be installed.
|
||||
|
||||
*kernel_image=*"_<FILE>_"::
|
||||
Specifies the kernel image, which to include in the UEFI executable. The default is
|
||||
_/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
|
||||
|
@@ -12,4 +12,4 @@ ro_mnt=yes
|
||||
i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE"
|
||||
i18n_default_font="LatArCyrHeb-16"
|
||||
|
||||
omit_drivers+=" i2o_scsi"
|
||||
omit_drivers+=" i2o_scsi "
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# SUSE specifc dracut settings
|
||||
# SUSE specific dracut settings
|
||||
#
|
||||
# SUSE by default always builds a as small as possible initrd for performance
|
||||
# SUSE by default always builds as small as possible initrd for performance
|
||||
# and resource reasons.
|
||||
# If you like to build a generic initrd which works on other platforms than
|
||||
# on the one dracut/mkinitrd got called comment out below setting(s).
|
||||
@@ -10,7 +10,7 @@ hostonly_cmdline="yes"
|
||||
compress="xz -0 --check=crc32 --memlimit-compress=50%"
|
||||
|
||||
i18n_vars="/etc/sysconfig/language:RC_LANG-LANG,RC_LC_ALL-LC_ALL /etc/sysconfig/console:CONSOLE_UNICODEMAP-FONT_UNIMAP,CONSOLE_FONT-FONT,CONSOLE_SCREENMAP-FONT_MAP /etc/sysconfig/keyboard:KEYTABLE-KEYMAP"
|
||||
omit_drivers+=" i2o_scsi"
|
||||
omit_drivers+=" i2o_scsi "
|
||||
|
||||
# Below adds additional tools to the initrd which are not urgently necessary to
|
||||
# bring up the system, but help to debug problems.
|
||||
|
@@ -103,7 +103,7 @@ half of the rd.retry counter.
|
||||
|
||||
This hook (initqueue/finished) is called after udev has settled and
|
||||
if all scripts herein return 0 the main loop will be ended.
|
||||
Abritary scripts can be added here, to loop in the
|
||||
Arbitrary scripts can be added here, to loop in the
|
||||
initqueue until something happens, which a dracut module wants to wait for.
|
||||
|
||||
=== Hook: pre-mount
|
||||
@@ -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,8 +255,8 @@ 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>. inst with more than two arguments is treated the same as
|
||||
inst_multiple, all arguments are treated as files to install and none as
|
||||
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>
|
||||
@@ -266,7 +266,7 @@ installs an executable/script <src> in the dracut hook <hookdir> with priority
|
||||
|
||||
==== inst_rules <udevrule> [ <udevrule> ...]
|
||||
|
||||
installs one ore more udev rules. Non-existant udev rules are reported, but do
|
||||
installs one or more udev rules. Non-existant udev rules are reported, but do
|
||||
not let dracut fail.
|
||||
|
||||
==== instmods <kernelmodule> [ <kernelmodule> ... ]
|
||||
|
248
dracut.sh
248
dracut.sh
@@ -272,6 +272,14 @@ read_arg() {
|
||||
fi
|
||||
}
|
||||
|
||||
check_conf_file()
|
||||
{
|
||||
if grep -H -e '^[^#]*[+]=\("[^ ]\|.*[^ ]"\)' "$@"; then
|
||||
printf '\ndracut: WARNING: <key>+=" <values> ": <values> should have surrounding white spaces!\n' >&2
|
||||
printf 'dracut: WARNING: This will lead to unwanted side effects! Please fix the configuration file.\n\n' >&2
|
||||
fi
|
||||
}
|
||||
|
||||
dropindirs_sort()
|
||||
{
|
||||
local suffix=$1; shift
|
||||
@@ -474,9 +482,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
|
||||
@@ -692,10 +697,14 @@ if [[ ! -d $confdir ]]; then
|
||||
fi
|
||||
|
||||
# source our config file
|
||||
[[ -f $conffile ]] && . "$conffile"
|
||||
if [[ -f $conffile ]]; then
|
||||
check_conf_file "$conffile"
|
||||
. "$conffile"
|
||||
fi
|
||||
|
||||
# source our config dir
|
||||
for f in $(dropindirs_sort ".conf" "$confdir" "$dracutbasedir/dracut.conf.d"); do
|
||||
check_conf_file "$f"
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
|
||||
@@ -775,12 +784,22 @@ if ! [[ $outfile ]]; then
|
||||
fi
|
||||
|
||||
if [[ $uefi == "yes" ]]; then
|
||||
if [[ -n "$uefi_secureboot_key" && -z "$uefi_secureboot_cert" ]] || [[ -z $uefi_secureboot_key && -n $uefi_secureboot_cert ]]; then
|
||||
dfatal "Need 'uefi_secureboot_key' and 'uefi_secureboot_cert' both to be set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "$uefi_secureboot_key" && -n "$uefi_secureboot_cert" ]] && !command -v sbsign &>/dev/null; then
|
||||
dfatal "Need 'sbsign' to create a signed UEFI executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BUILD_ID=$(cat /etc/os-release /usr/lib/os-release \
|
||||
| while read -r line || [[ $line ]]; do \
|
||||
[[ $line =~ BUILD_ID\=* ]] && eval "$line" && echo "$BUILD_ID" && break; \
|
||||
done)
|
||||
if [[ -d /efi ]] && mountpoint -q /efi; then
|
||||
efidir=/efi
|
||||
efidir=/efi/EFI
|
||||
else
|
||||
efidir=/boot/EFI
|
||||
if [[ -d /boot/efi/EFI ]] && mountpoint -q /boot/efi; then
|
||||
@@ -1002,6 +1021,16 @@ esac
|
||||
|
||||
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
|
||||
|
||||
|
||||
[[ -d $systemdutildir ]] \
|
||||
|| systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
|
||||
|
||||
if ! [[ -d "$systemdutildir" ]]; then
|
||||
[[ -e /lib/systemd/systemd-udevd ]] && systemdutildir=/lib/systemd
|
||||
[[ -e /usr/lib/systemd/systemd-udevd ]] && systemdutildir=/usr/lib/systemd
|
||||
fi
|
||||
|
||||
|
||||
if [[ $no_kernel != yes ]] && [[ -d $srcmods ]]; then
|
||||
if ! [[ -f $srcmods/modules.dep ]]; then
|
||||
if [[ -n "$(find "$srcmods" -name '*.ko*')" ]]; then
|
||||
@@ -1063,13 +1092,13 @@ if [[ ! $print_cmdline ]]; then
|
||||
exit 1
|
||||
fi
|
||||
unset EFI_MACHINE_TYPE_NAME
|
||||
case $(arch) in
|
||||
case $(uname -m) in
|
||||
x86_64)
|
||||
EFI_MACHINE_TYPE_NAME=x64;;
|
||||
ia32)
|
||||
EFI_MACHINE_TYPE_NAME=ia32;;
|
||||
*)
|
||||
dfatal "Architecture '$(arch)' not supported to create a UEFI executable"
|
||||
dfatal "Architecture '$(uname -m)' not supported to create a UEFI executable"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -1314,16 +1343,8 @@ done
|
||||
[[ -d $udevdir ]] \
|
||||
|| udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
|
||||
if ! [[ -d "$udevdir" ]]; then
|
||||
[[ -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
|
||||
[[ -e /lib/systemd/systemd-udevd ]] && systemdutildir=/lib/systemd
|
||||
[[ -e /usr/lib/systemd/systemd-udevd ]] && systemdutildir=/usr/lib/systemd
|
||||
[[ -e /lib/udev/ata_id ]] && udevdir=/lib/udev
|
||||
[[ -e /usr/lib/udev/ata_id ]] && udevdir=/usr/lib/udev
|
||||
fi
|
||||
|
||||
[[ -d $systemdsystemunitdir ]] \
|
||||
@@ -1376,7 +1397,7 @@ do_print_cmdline()
|
||||
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
_d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
|
||||
[[ ${_mods_to_print[$_d_mod]} ]] || continue
|
||||
module_cmdline "$_d_mod"
|
||||
module_cmdline "$_d_mod" "$moddir"
|
||||
done
|
||||
unset moddir
|
||||
}
|
||||
@@ -1457,14 +1478,14 @@ for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
dinfo "*** Including module: $_d_mod ***"
|
||||
fi
|
||||
if [[ $kernel_only == yes ]]; then
|
||||
module_installkernel "$_d_mod" || {
|
||||
module_installkernel "$_d_mod" "$moddir" || {
|
||||
dfatal "installkernel failed in module $_d_mod"
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
module_install "$_d_mod"
|
||||
module_install "$_d_mod" "$moddir"
|
||||
if [[ $no_kernel != yes ]]; then
|
||||
module_installkernel "$_d_mod" || {
|
||||
module_installkernel "$_d_mod" "$moddir" || {
|
||||
dfatal "installkernel failed in module $_d_mod"
|
||||
exit 1
|
||||
}
|
||||
@@ -1492,6 +1513,9 @@ dinfo "*** Including modules done ***"
|
||||
|
||||
## final stuff that has to happen
|
||||
if [[ $no_kernel != yes ]]; then
|
||||
if [[ $hostonly ]]; then
|
||||
cp "$DRACUT_KERNEL_MODALIASES" $initdir/lib/dracut/hostonly-kernel-modules.txt
|
||||
fi
|
||||
|
||||
if [[ $drivers ]]; then
|
||||
hostonly='' instmods $drivers
|
||||
@@ -1572,7 +1596,7 @@ if [[ $kernel_only != yes ]]; then
|
||||
dinfo "*** Resolving executable dependencies ***"
|
||||
find "$initdir" -type f -perm /0111 -not -path '*.ko' -print0 \
|
||||
| xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R ${DRACUT_FIPS_MODE:+-f} --
|
||||
dinfo "*** Resolving executable dependencies done***"
|
||||
dinfo "*** Resolving executable dependencies done ***"
|
||||
fi
|
||||
|
||||
# Now we are done with lazy resolving, always install dependencies
|
||||
@@ -1595,7 +1619,7 @@ for ((i=0; i < ${#include_src[@]}; i++)); do
|
||||
if [[ $src && $target ]]; then
|
||||
if [[ -f $src ]]; then
|
||||
inst $src $target
|
||||
else
|
||||
elif [[ -d $src ]]; then
|
||||
ddebug "Including directory: $src"
|
||||
destdir="${initdir}/${target}"
|
||||
mkdir -p "$destdir"
|
||||
@@ -1616,6 +1640,10 @@ for ((i=0; i < ${#include_src[@]}; i++)); do
|
||||
$DRACUT_CP -t "$destdir" "$objectname"
|
||||
fi
|
||||
done
|
||||
elif [[ -e $src ]]; then
|
||||
derror "$src is neither a directory nor a regular file"
|
||||
else
|
||||
derror "$src doesn't exist"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -1659,21 +1687,6 @@ 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 \
|
||||
-executable -not -path '*/lib/modules/*.ko' -print0 \
|
||||
| xargs -r -0 $strip_cmd -g 2>/dev/null
|
||||
|
||||
# strip kernel modules, but do not touch signed modules
|
||||
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
|
||||
| while read -r -d $'\0' f || [ -n "$f" ]; do
|
||||
SIG=$(tail -c 28 "$f" | tr -d '\000')
|
||||
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
|
||||
done | xargs -r -0 $strip_cmd -g
|
||||
|
||||
dinfo "*** Stripping files done ***"
|
||||
fi
|
||||
if [[ $early_microcode = yes ]]; then
|
||||
dinfo "*** Generating early-microcode cpio image ***"
|
||||
ucode_dir=(amd-ucode intel-ucode)
|
||||
@@ -1690,7 +1703,7 @@ if [[ $early_microcode = yes ]]; then
|
||||
for _fwdir in $fw_dir; do
|
||||
if [[ -d $_fwdir && -d $_fwdir/$_fw ]]; then
|
||||
_src="*"
|
||||
dinfo "*** Constructing ${ucode_dest[$idx]} ****"
|
||||
dinfo "*** Constructing ${ucode_dest[$idx]} ***"
|
||||
if [[ $hostonly ]]; then
|
||||
_src=$(get_ucode_file)
|
||||
[[ $_src ]] || break
|
||||
@@ -1745,6 +1758,142 @@ if [[ $hostonly_cmdline == "yes" ]] ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if dracut_module_included "squash"; then
|
||||
dinfo "*** Install squash loader ***"
|
||||
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="$initdir/squash/root"
|
||||
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
|
||||
|
||||
# Move some files out side of the squash image, including:
|
||||
# - Files required to boot and mount the squashfs image
|
||||
# - Files need to be accessible 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 [[ -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
|
||||
if [[ -d $_sqsh_file ]]; then
|
||||
mkdir $_init_file
|
||||
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
|
||||
ln -s squash/init.sh $initdir/init
|
||||
|
||||
# Reinstall required files for the squash image setup script.
|
||||
# We have moved them inside the squashed image, but they need to be
|
||||
# accessible before mounting the image.
|
||||
inst_multiple "echo" "sh" "mount" "modprobe" "mkdir"
|
||||
hostonly="" instmods "loop" "squashfs" "overlay"
|
||||
|
||||
# Only keep systemctl outsite if we need switch root
|
||||
if [[ ! -f "$initdir/lib/dracut/no-switch-root" ]]; then
|
||||
inst "systemctl"
|
||||
fi
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Stripping files ***"
|
||||
find "$initdir" -type f \
|
||||
-executable -not -path '*/lib/modules/*.ko' -print0 \
|
||||
| xargs -r -0 $strip_cmd -g -p 2>/dev/null
|
||||
|
||||
# strip kernel modules, but do not touch signed modules
|
||||
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
|
||||
| while read -r -d $'\0' f || [ -n "$f" ]; do
|
||||
SIG=$(tail -c 28 "$f" | tr -d '\000')
|
||||
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
|
||||
done | xargs -r -0 $strip_cmd -g -p
|
||||
dinfo "*** Stripping files done ***"
|
||||
fi
|
||||
|
||||
if dracut_module_included "squash"; then
|
||||
dinfo "*** Squashing the files inside the initramfs ***"
|
||||
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
|
||||
|
||||
rm -rf $squash_dir
|
||||
dinfo "*** Squashing the files inside the initramfs done ***"
|
||||
fi
|
||||
|
||||
dinfo "*** Creating image file '$outfile' ***"
|
||||
|
||||
if [[ $uefi = yes ]]; then
|
||||
@@ -1818,7 +1967,7 @@ if [[ $uefi = yes ]]; then
|
||||
echo -ne "\x00" >> "$uefi_outdir/cmdline.txt"
|
||||
|
||||
dinfo "Using UEFI kernel cmdline:"
|
||||
dinfo $(< "$uefi_outdir/cmdline.txt")
|
||||
dinfo $(tr -d '\000' < "$uefi_outdir/cmdline.txt")
|
||||
|
||||
[[ -s /usr/lib/os-release ]] && uefi_osrelease="/usr/lib/os-release"
|
||||
[[ -s /etc/os-release ]] && uefi_osrelease="/etc/os-release"
|
||||
@@ -1828,9 +1977,22 @@ if [[ $uefi = yes ]]; then
|
||||
--add-section .cmdline="${uefi_outdir}/cmdline.txt" --change-section-vma .cmdline=0x30000 \
|
||||
--add-section .linux="$kernel_image" --change-section-vma .linux=0x40000 \
|
||||
--add-section .initrd="${DRACUT_TMPDIR}/initramfs.img" --change-section-vma .initrd=0x3000000 \
|
||||
"$uefi_stub" "${uefi_outdir}/linux.efi" \
|
||||
&& cp --reflink=auto "${uefi_outdir}/linux.efi" "$outfile"; then
|
||||
dinfo "*** Creating UEFI image file '$outfile' done ***"
|
||||
"$uefi_stub" "${uefi_outdir}/linux.efi"; then
|
||||
if [[ -n "${uefi_secureboot_key}" && -n "${uefi_secureboot_cert}" ]]; then \
|
||||
if sbsign \
|
||||
--key "${uefi_secureboot_key}" \
|
||||
--cert "${uefi_secureboot_cert}" \
|
||||
--output "$outfile" "${uefi_outdir}/linux.efi"; then
|
||||
dinfo "*** Creating signed UEFI image file '$outfile' done ***"
|
||||
else
|
||||
dfatal "*** Creating signed UEFI image file '$outfile' failed ***"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if cp --reflink=auto "${uefi_outdir}/linux.efi" "$outfile"; then
|
||||
dinfo "*** Creating UEFI image file '$outfile' done ***"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
rm -f -- "$outfile"
|
||||
dfatal "*** Creating UEFI image file '$outfile' failed ***"
|
||||
|
65
dracut.spec
65
dracut.spec
@@ -32,7 +32,7 @@ Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
|
||||
|
||||
BuildRequires: bash
|
||||
BuildRequires: git
|
||||
BuildRequires: kmod-devel >= 23
|
||||
BuildRequires: pkgconfig(libkmod) >= 23
|
||||
BuildRequires: gcc
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
@@ -49,7 +49,7 @@ 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
|
||||
@@ -178,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: squashfs-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} .
|
||||
@@ -235,6 +245,8 @@ 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
|
||||
@@ -245,26 +257,32 @@ mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse*
|
||||
%endif
|
||||
%if 0%{?suse_version}
|
||||
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
%else
|
||||
rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse*
|
||||
%endif
|
||||
|
||||
%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
|
||||
rm -f -- $RPM_BUILD_ROOT%{_mandir}/man8/mkinitrd.8*
|
||||
rm -f -- $RPM_BUILD_ROOT%{_mandir}/man1/lsinitrd.1*
|
||||
%endif
|
||||
|
||||
%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
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
# 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
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,0755)
|
||||
%if %{with doc}
|
||||
%doc README HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
|
||||
%doc README.md HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
|
||||
%endif
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%license COPYING lgpl-2.1.txt
|
||||
@@ -301,6 +319,9 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
||||
%{_mandir}/man8/mkinitrd.8*
|
||||
%{_mandir}/man1/lsinitrd.1*
|
||||
%endif
|
||||
%if 0%{?suse_version}
|
||||
%{_mandir}/man8/mkinitrd-suse.8*
|
||||
%endif
|
||||
%{_mandir}/man7/dracut.kernel.7*
|
||||
%{_mandir}/man7/dracut.cmdline.7*
|
||||
%{_mandir}/man7/dracut.modules.7*
|
||||
@@ -313,11 +334,18 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
||||
%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
|
||||
%{dracutlibdir}/modules.d/04watchdog
|
||||
%{dracutlibdir}/modules.d/05busybox
|
||||
%{dracutlibdir}/modules.d/06rngd
|
||||
%{dracutlibdir}/modules.d/10i18n
|
||||
%{dracutlibdir}/modules.d/30convertfs
|
||||
%{dracutlibdir}/modules.d/45url-lib
|
||||
@@ -329,6 +357,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
||||
%{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
|
||||
@@ -390,20 +419,13 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
||||
%{_unitdir}/initrd.target.wants/dracut-pre-pivot.service
|
||||
%{_unitdir}/initrd.target.wants/dracut-pre-trigger.service
|
||||
%{_unitdir}/initrd.target.wants/dracut-pre-udev.service
|
||||
|
||||
%endif
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
%{_prefix}/lib/kernel/install.d/50-dracut.install
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/01fips
|
||||
%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
|
||||
@@ -421,19 +443,15 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
||||
%{dracutlibdir}/modules.d/99uefi-lib
|
||||
|
||||
%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
|
||||
@@ -443,15 +461,18 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
||||
%dir /var/lib/dracut
|
||||
%dir /var/lib/dracut/overlay
|
||||
|
||||
%files squash
|
||||
%{dracutlibdir}/modules.d/99squash
|
||||
|
||||
%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}
|
||||
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
# FIXME: remove after F30
|
||||
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
|
@@ -83,7 +83,7 @@ on the command line:
|
||||
=== Adding Kernel Modules
|
||||
If you need a special kernel module in the initramfs, which is not
|
||||
automatically picked up by dracut, you have the use the --add-drivers option
|
||||
on the command line or the drivers vaiable in the _/etc/dracut.conf_
|
||||
on the command line or the drivers variable in the _/etc/dracut.conf_
|
||||
or _/etc/dracut.conf.d/myconf.conf_ configuration file (see *dracut.conf*(5)):
|
||||
----
|
||||
# dracut --add-drivers mymod initramfs-with-mymod.img
|
||||
@@ -94,7 +94,7 @@ An initramfs generated without the "hostonly" mode, does not contain any system
|
||||
configuration files (except for some special exceptions), so the configuration
|
||||
has to be done on the kernel command line. With this flexibility, you can easily
|
||||
boot from a changed root partition, without the need to recompile the initramfs
|
||||
image. So, you could completly change your root partition (move it inside a md
|
||||
image. So, you could completely change your root partition (move it inside a md
|
||||
raid with encryption and LVM on top), as long as you specify the correct
|
||||
filesystem LABEL or UUID on the kernel command line for your root device, dracut
|
||||
will find it and boot from it.
|
||||
@@ -151,9 +151,9 @@ If your root partition is on the network see <<NetworkBoot>>.
|
||||
If you have to input passwords for encrypted disk volumes, you might want to set
|
||||
the keyboard layout and specify a display font.
|
||||
|
||||
A typical german kernel command would contain:
|
||||
A typical german kernel command line would contain:
|
||||
----
|
||||
rd.vconsole.font=latarcyrheb-sun16 rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8
|
||||
rd.vconsole.font=eurlatgr rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8
|
||||
----
|
||||
|
||||
Setting these options can override the setting stored on your system, if you use
|
||||
@@ -185,7 +185,7 @@ This turns off every automatic assembly of LVM, MD raids, DM raids and
|
||||
crypto LUKS.
|
||||
|
||||
Of course, you could also omit the dracut modules in the initramfs creation
|
||||
process, but then you would lose the posibility to turn it on on demand.
|
||||
process, but then you would lose the possibility to turn it on on demand.
|
||||
|
||||
|
||||
[[Injecting]]
|
||||
@@ -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
|
||||
@@ -262,7 +262,7 @@ For example for a NFS image, you would do:
|
||||
|
||||
|
||||
----
|
||||
# dracut -m "nfs network base" initramfs-nfs-only.img
|
||||
# dracut -m "nfs network base" initramfs-nfs-only.img
|
||||
----
|
||||
|
||||
Then you would boot from this image with your target machine and reduce the size
|
||||
@@ -349,7 +349,7 @@ serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
----
|
||||
+
|
||||
. Also in _/boot/grub2/grub.cfg_, add the following boot arguemnts to the ''kernel''
|
||||
. Also in _/boot/grub2/grub.cfg_, add the following boot arguments to the ''kernel''
|
||||
line:
|
||||
+
|
||||
----
|
||||
|
62
fedora-test.sh
Executable file
62
fedora-test.sh
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/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 \
|
||||
tcpdump \
|
||||
$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
|
@@ -37,7 +37,7 @@ $tag=`git describe --abbrev=0 --tags` if not defined $tag;
|
||||
chomp($tag);
|
||||
my @patches=&create_patches($tag, $pdir);
|
||||
my $num=$#patches + 2;
|
||||
$tag=~s/[^0-9]+?([0-9]+)/$1/;
|
||||
$tag=~s/[^0-9]+?([0-9]+)/$1/ if $tag !~ /\b[0-9a-f]{5,40}\b/;
|
||||
my $release="$num.git$datestr";
|
||||
$release="1" if $num == 1;
|
||||
|
||||
|
@@ -84,6 +84,11 @@ static bool arg_mod_filter_noname = false;
|
||||
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst);
|
||||
|
||||
|
||||
static inline void kmod_module_unrefp(struct kmod_module **p) {
|
||||
if (*p)
|
||||
kmod_module_unref(*p);
|
||||
}
|
||||
#define _cleanup_kmod_module_unref_ _cleanup_(kmod_module_unrefp)
|
||||
|
||||
static inline void kmod_module_unref_listp(struct kmod_list **p) {
|
||||
if (*p)
|
||||
@@ -479,11 +484,7 @@ static int resolve_deps(const char *src)
|
||||
if (strstr(buf, destrootdir))
|
||||
break;
|
||||
|
||||
p = strstr(buf, "=>");
|
||||
if (!p)
|
||||
p = buf;
|
||||
|
||||
p = strchr(p, '/');
|
||||
p = strchr(buf, '/');
|
||||
if (p) {
|
||||
char *q;
|
||||
|
||||
@@ -1150,6 +1151,8 @@ static int install_firmware(struct kmod_module *mod)
|
||||
ret = -1;
|
||||
STRV_FOREACH(q, firmwaredirs) {
|
||||
_cleanup_free_ char *fwpath = NULL;
|
||||
_cleanup_free_ char *fwpath_xz = NULL;
|
||||
const char *fw;
|
||||
struct stat sb;
|
||||
int r;
|
||||
|
||||
@@ -1159,12 +1162,21 @@ static int install_firmware(struct kmod_module *mod)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fw = fwpath;
|
||||
if (stat(fwpath, &sb) != 0) {
|
||||
log_debug("stat(%s) != 0", fwpath);
|
||||
continue;
|
||||
r = asprintf(&fwpath_xz, "%s.xz", fwpath);
|
||||
if (r < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (stat(fwpath_xz, &sb) != 0) {
|
||||
log_debug("stat(%s) != 0", fwpath);
|
||||
continue;
|
||||
}
|
||||
fw = fwpath_xz;
|
||||
}
|
||||
|
||||
ret = dracut_install(fwpath, fwpath, false, false, true);
|
||||
ret = dracut_install(fw, fw, false, false, true);
|
||||
if (ret == 0)
|
||||
log_debug("dracut_install '%s' OK", fwpath);
|
||||
}
|
||||
@@ -1234,28 +1246,48 @@ static bool check_module_path(const char *path)
|
||||
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) {
|
||||
_cleanup_kmod_module_unref_ struct kmod_module *mod = NULL;
|
||||
mod = kmod_module_get_module(itr);
|
||||
path = kmod_module_get_path(mod);
|
||||
|
||||
if (path == NULL)
|
||||
continue;
|
||||
|
||||
if (check_hashmap(items_failed, path))
|
||||
return -1;
|
||||
|
||||
if (check_hashmap(items, path)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
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) {
|
||||
_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;
|
||||
log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]);
|
||||
install_firmware(mod);
|
||||
modlist = kmod_module_get_dependencies(mod);
|
||||
ret = install_dependent_modules(modlist);
|
||||
if (ret == 0) {
|
||||
ret = kmod_module_get_softdeps(mod, &modpre, &modpost);
|
||||
if (ret == 0)
|
||||
ret = install_dependent_modules(modpre);
|
||||
}
|
||||
} else {
|
||||
log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
|
||||
}
|
||||
kmod_module_unref(mod);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@@ -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
|
||||
|
86
lsinitrd.sh
86
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
|
||||
@@ -118,6 +121,9 @@ if ! [[ -f "$image" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TMPDIR="$(mktemp -d -t lsinitrd.XXXXXX)"
|
||||
trap "rm -rf '$TMPDIR'" EXIT
|
||||
|
||||
dracutlibdirs() {
|
||||
for d in lib64/dracut lib/dracut usr/lib64/dracut usr/lib/dracut; do
|
||||
echo "$d/$1"
|
||||
@@ -157,15 +163,71 @@ list_files()
|
||||
echo "========================================================================"
|
||||
}
|
||||
|
||||
unpack_files()
|
||||
list_squash_content()
|
||||
{
|
||||
$CAT "$image" 2>/dev/null | cpio -id --quiet $verbose
|
||||
((ret+=$?))
|
||||
SQUASH_IMG="squash/root.img"
|
||||
SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh"
|
||||
|
||||
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- \
|
||||
$SQUASH_IMG > "$SQUASH_TMPFILE" 2>/dev/null
|
||||
if [[ -s $SQUASH_TMPFILE ]]; then
|
||||
echo "Squashed content ($SQUASH_IMG):"
|
||||
echo "========================================================================"
|
||||
unsquashfs -ll "$SQUASH_TMPFILE" | tail -n +4
|
||||
echo "========================================================================"
|
||||
fi
|
||||
}
|
||||
|
||||
unpack_files()
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
read -N 2 bin < "$image"
|
||||
if [ "$bin" = "MZ" ]; then
|
||||
command -v objcopy > /dev/null || { echo "Need 'objcopy' to unpack an UEFI executable."; exit 1; }
|
||||
objcopy \
|
||||
--dump-section .linux="$TMPDIR/vmlinuz" \
|
||||
--dump-section .initrd="$TMPDIR/initrd.img" \
|
||||
--dump-section .cmdline="$TMPDIR/cmdline.txt" \
|
||||
--dump-section .osrel="$TMPDIR/osrel.txt" \
|
||||
"$image" /dev/null
|
||||
uefi="$image"
|
||||
image="$TMPDIR/initrd.img"
|
||||
[ -f "$image" ] || exit 1
|
||||
fi
|
||||
|
||||
if (( ${#filenames[@]} <= 0 )) && [[ -z "$unpack" ]] && [[ -z "$unpackearly" ]]; then
|
||||
echo "Image: $image: $(du -h $image | while read a b || [ -n "$a" ]; do echo $a;done)"
|
||||
if [ -n $uefi ]; then
|
||||
echo -n "initrd in UEFI: $uefi: "
|
||||
du -h $image | while read a b || [ -n "$a" ]; do echo $a;done
|
||||
if [ -f "$TMPDIR/osrel.txt" ]; then
|
||||
name=$(sed -En '/^PRETTY_NAME/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
|
||||
id=$(sed -En '/^ID/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
|
||||
build=$(sed -En '/^BUILD_ID/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
|
||||
echo "OS Release: $name (${id}-${build})"
|
||||
fi
|
||||
if [ -f "$TMPDIR/vmlinuz" ]; then
|
||||
version=$(strings -n 20 "$TMPDIR/vmlinuz" | sed -En '/[0-9]+\.[0-9]+\.[0-9]+/ { p; q 0 }')
|
||||
echo "Kernel Version: $version"
|
||||
fi
|
||||
if [ -f "$TMPDIR/cmdline.txt" ]; then
|
||||
echo "Command line:"
|
||||
sed -En 's/\s+/\n/g; s/\x00/\n/; p' "$TMPDIR/cmdline.txt"
|
||||
fi
|
||||
else
|
||||
echo -n "Image: $image: "
|
||||
du -h $image | while read a b || [ -n "$a" ]; do echo $a;done
|
||||
fi
|
||||
|
||||
echo "========================================================================"
|
||||
fi
|
||||
|
||||
@@ -175,7 +237,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
|
||||
@@ -241,6 +306,16 @@ if [[ $SKIP ]]; then
|
||||
CAT=skipcpio
|
||||
fi
|
||||
|
||||
if (( ${#filenames[@]} > 1 )); then
|
||||
TMPFILE="$TMPDIR/initrd.cpio"
|
||||
$CAT "$image" 2>/dev/null > $TMPFILE
|
||||
pre_decompress()
|
||||
{
|
||||
cat $TMPFILE
|
||||
}
|
||||
CAT=pre_decompress
|
||||
fi
|
||||
|
||||
ret=0
|
||||
|
||||
if [[ -n "$unpack" ]]; then
|
||||
@@ -263,6 +338,7 @@ else
|
||||
echo
|
||||
list_modules
|
||||
list_files
|
||||
list_squash_content
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@@ -66,7 +66,7 @@ default_kernel_images() {
|
||||
arm*)
|
||||
regex='[uz]Image'
|
||||
;;
|
||||
aarch64)
|
||||
aarch64|riscv64)
|
||||
regex='Image'
|
||||
;;
|
||||
*) regex='vmlinu.'
|
||||
|
@@ -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.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash --norc
|
||||
#
|
||||
# mkinitrd compability wrapper for SUSE.
|
||||
# mkinitrd compatibility wrapper for SUSE.
|
||||
#
|
||||
# Copyright (c) 2013 SUSE Linux Products GmbH. All rights reserved.
|
||||
#
|
||||
@@ -62,7 +62,7 @@ usage () {
|
||||
$cmd " /etc/sysconfig/kernel."
|
||||
$cmd " -d root_device Root device. Defaults to the device from"
|
||||
$cmd " which / is mounted. Overrides the rootdev"
|
||||
$cmd " enviroment variable if set."
|
||||
$cmd " environment variable if set."
|
||||
$cmd " -j device Journal device"
|
||||
$cmd " -D interface Run dhcp on the specified interface."
|
||||
$cmd " -I interface Configure the specified interface statically."
|
||||
@@ -145,31 +145,17 @@ is_xen_kernel() {
|
||||
return
|
||||
}
|
||||
|
||||
# kernel_image_gz_from_image() and kernel_version_from_image() are helpers
|
||||
# for arm* kernels which produce zImage files which cannot be read from
|
||||
# get_kernel_version -> get rid of this workaround if possible
|
||||
kernel_image_gz_from_image() {
|
||||
local arch=$(uname -i)
|
||||
local r=${1}.gz
|
||||
|
||||
# uImage kernels can't be extracted directly. Use the vmlinux.gz instead
|
||||
r=${r//uImage/vmlinux}
|
||||
|
||||
# on ARM a zImage can't be extracted directly. Other platforms define it
|
||||
# as a gzipped vmlinux file, but not ARM. So only on ARM, use vmlinux.gz.
|
||||
if [[ $arch =~ arm ]] || [[ $arch =~ aarch ]]; then
|
||||
r=${r//zImage/vmlinux}
|
||||
fi
|
||||
|
||||
echo $r
|
||||
}
|
||||
|
||||
kernel_version_from_image() {
|
||||
local kernel_image="$1" kernel_image_gz=$(kernel_image_gz_from_image "$1")
|
||||
local dir="${1%/*}/"
|
||||
[[ "$dir" != "$1" ]] || dir=""
|
||||
local kernel_image="$1" kernel_image_gz="${dir}vmlinux-${1#*-}.gz"
|
||||
echo kernel_image_gz="'$kernel_image_gz'" >&2
|
||||
|
||||
if get_kernel_version "$kernel_image" 2>/dev/null; then
|
||||
return
|
||||
fi
|
||||
|
||||
# As a last resort, try vmlinux-$version.gz, which might be around
|
||||
get_kernel_version "$kernel_image_gz" 2>/dev/null
|
||||
}
|
||||
|
||||
@@ -191,7 +177,7 @@ default_kernel_images() {
|
||||
arm*)
|
||||
regex='[uz]Image'
|
||||
;;
|
||||
aarch64)
|
||||
aarch64|riscv64)
|
||||
regex='Image'
|
||||
;;
|
||||
*) regex='vmlinu.'
|
||||
|
@@ -1,10 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
getSystemdVersion() {
|
||||
SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
|
||||
# Check if the systemd version is a valid number
|
||||
if ! [[ $SYSTEMD_VERSION =~ ^[0-9]+$ ]]; then
|
||||
dfatal "systemd version is not a number ($SYSTEMD_VERSION)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $SYSTEMD_VERSION
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ $mount_needs ]] && return 1
|
||||
if require_binaries $systemdutildir/systemd; then
|
||||
SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
|
||||
SYSTEMD_VERSION=$(getSystemdVersion)
|
||||
(( $SYSTEMD_VERSION >= 198 )) && return 0
|
||||
return 255
|
||||
fi
|
||||
@@ -31,6 +42,12 @@ install() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $(getSystemdVersion) -ge 240 ]; then
|
||||
inst_multiple -o \
|
||||
$systemdutildir/system-generators/systemd-debug-generator \
|
||||
$systemdsystemunitdir/debug-shell.service
|
||||
fi
|
||||
|
||||
inst_multiple -o \
|
||||
$systemdutildir/systemd \
|
||||
$systemdutildir/systemd-coredump \
|
||||
@@ -43,6 +60,7 @@ install() {
|
||||
$systemdutildir/systemd-sysctl \
|
||||
$systemdutildir/systemd-modules-load \
|
||||
$systemdutildir/systemd-vconsole-setup \
|
||||
$systemdutildir/systemd-volatile-root \
|
||||
$systemdutildir/system-generators/systemd-fstab-generator \
|
||||
$systemdutildir/system-generators/systemd-gpt-auto-generator \
|
||||
\
|
||||
@@ -99,6 +117,7 @@ install() {
|
||||
$systemdsystemunitdir/systemd-ask-password-plymouth.service \
|
||||
$systemdsystemunitdir/systemd-journald.service \
|
||||
$systemdsystemunitdir/systemd-vconsole-setup.service \
|
||||
$systemdsystemunitdir/systemd-volatile-root.service \
|
||||
$systemdsystemunitdir/systemd-random-seed-load.service \
|
||||
$systemdsystemunitdir/systemd-random-seed.service \
|
||||
$systemdsystemunitdir/systemd-sysctl.service \
|
||||
|
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
|
8
modules.d/01fips/fips-load-crypto.sh
Normal file
8
modules.d/01fips/fips-load-crypto.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
else
|
||||
. /sbin/fips.sh
|
||||
fips_load_crypto || die "FIPS integrity test failed"
|
||||
fi
|
@@ -69,22 +69,15 @@ do_rhevh_check()
|
||||
return 0
|
||||
}
|
||||
|
||||
do_fips()
|
||||
fips_load_crypto()
|
||||
{
|
||||
local _v
|
||||
local _s
|
||||
local _v
|
||||
local _module
|
||||
|
||||
KERNEL=$(uname -r)
|
||||
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
|
||||
info "Loading and integrity checking all crypto modules"
|
||||
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
|
||||
for _module in $FIPSMODULES; do
|
||||
if [ "$_module" != "tcrypt" ]; then
|
||||
if ! modprobe "${_module}"; then
|
||||
if ! modprobe "${_module}" 2>/tmp/fips.modprobe_err; then
|
||||
# check if kernel provides generic algo
|
||||
_found=0
|
||||
while read _k _s _v || [ -n "$_k" ]; do
|
||||
@@ -93,7 +86,7 @@ do_fips()
|
||||
_found=1
|
||||
break
|
||||
done </proc/crypto
|
||||
[ "$_found" = "0" ] && return 1
|
||||
[ "$_found" = "0" ] && cat /tmp/fips.modprobe_err >&2 && return 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -102,6 +95,16 @@ do_fips()
|
||||
info "Self testing crypto algorithms"
|
||||
modprobe tcrypt || return 1
|
||||
rmmod tcrypt
|
||||
}
|
||||
|
||||
do_fips()
|
||||
{
|
||||
local _v
|
||||
local _s
|
||||
local _v
|
||||
local _module
|
||||
|
||||
KERNEL=$(uname -r)
|
||||
|
||||
info "Checking integrity of kernel"
|
||||
if [ -e "/run/initramfs/live/vmlinuz0" ]; then
|
||||
|
@@ -12,7 +12,7 @@ depends() {
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
local _fipsmodules _mod
|
||||
local _fipsmodules _mod _bootfstype
|
||||
if [[ -f "${srcmods}/modules.fips" ]]; then
|
||||
_fipsmodules="$(cat "${srcmods}/modules.fips")"
|
||||
else
|
||||
@@ -24,7 +24,7 @@ installkernel() {
|
||||
_fipsmodules+="crc32c crct10dif ghash "
|
||||
|
||||
# Ciphers:
|
||||
_fipsmodules+="cipher_null des3_ede aes "
|
||||
_fipsmodules+="cipher_null des3_ede aes cfb "
|
||||
|
||||
# Modes/templates:
|
||||
_fipsmodules+="ecb cbc ctr xts gcm ccm authenc hmac cmac "
|
||||
@@ -47,13 +47,24 @@ installkernel() {
|
||||
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
fi
|
||||
done
|
||||
|
||||
# with hostonly_default_device fs module for /boot is not installed by default
|
||||
if [[ $hostonly ]] && [[ "$hostonly_default_device" == "no" ]]; then
|
||||
_bootfstype=$(find_mp_fstype /boot)
|
||||
if [[ -n "$_bootfstype" ]]; then
|
||||
hostonly='' instmods $_bootfstype
|
||||
else
|
||||
dwarning "Can't determine fs type for /boot, FIPS check may fail."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _dir
|
||||
inst_hook pre-trigger 01 "$moddir/fips-boot.sh"
|
||||
inst_hook pre-mount 01 "$moddir/fips-boot.sh"
|
||||
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
|
||||
inst_hook pre-udev 01 "$moddir/fips-load-crypto.sh"
|
||||
inst_script "$moddir/fips.sh" /sbin/fips.sh
|
||||
|
||||
inst_multiple sha512hmac rmmod insmod mount uname umount
|
||||
|
@@ -37,33 +37,5 @@ install() {
|
||||
$systemdsystemunitdir/initrd-parse-etc.service
|
||||
|
||||
ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target"
|
||||
|
||||
if [ -e /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
VERSION+=" "
|
||||
PRETTY_NAME+=" "
|
||||
else
|
||||
VERSION=""
|
||||
PRETTY_NAME=""
|
||||
fi
|
||||
NAME=dracut
|
||||
ID=dracut
|
||||
VERSION+="dracut-$DRACUT_VERSION"
|
||||
PRETTY_NAME+="dracut-$DRACUT_VERSION (Initramfs)"
|
||||
VERSION_ID=$DRACUT_VERSION
|
||||
ANSI_COLOR="0;34"
|
||||
|
||||
{
|
||||
echo NAME=\"$NAME\"
|
||||
echo VERSION=\"$VERSION\"
|
||||
echo ID=$ID
|
||||
echo VERSION_ID=$VERSION_ID
|
||||
echo PRETTY_NAME=\"$PRETTY_NAME\"
|
||||
echo ANSI_COLOR=\"$ANSI_COLOR\"
|
||||
} > $initdir/usr/lib/initrd-release
|
||||
echo dracut-$DRACUT_VERSION > $initdir/lib/dracut/dracut-$DRACUT_VERSION
|
||||
ln -sf ../usr/lib/initrd-release $initdir/etc/initrd-release
|
||||
ln -sf initrd-release $initdir/usr/lib/os-release
|
||||
ln -sf initrd-release $initdir/etc/os-release
|
||||
}
|
||||
|
||||
|
@@ -22,9 +22,6 @@ install() {
|
||||
_progs="$_progs $_i"
|
||||
done
|
||||
|
||||
# FIXME: switch_root should be in the above list, but busybox version hangs
|
||||
# (using busybox-1.15.1-7.fc14.i686 at the time of writing)
|
||||
|
||||
for _i in $_progs; do
|
||||
_path=$(find_binary "$_i")
|
||||
[ -z "$_path" ] && continue
|
||||
|
39
modules.d/06rngd/module-setup.sh
Normal file
39
modules.d/06rngd/module-setup.sh
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
# vim: set tabstop=8 shiftwidth=4 softtabstop=4 expandtab smarttab colorcolumn=80:
|
||||
#
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
# Author: Renaud Métrich <rmetrich@redhat.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
depends() {
|
||||
echo systemd
|
||||
return 0
|
||||
}
|
||||
|
||||
check() {
|
||||
# if there's no rngd binary, no go.
|
||||
require_binaries rngd || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
inst rngd
|
||||
inst_simple "${moddir}/rngd.service" "${systemdsystemunitdir}/rngd.service"
|
||||
mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.wants"
|
||||
ln -rfs "${initdir}${systemdsystemunitdir}/rngd.service" \
|
||||
"${initdir}${systemdsystemunitdir}/sysinit.target.wants/rngd.service"
|
||||
}
|
7
modules.d/06rngd/rngd.service
Normal file
7
modules.d/06rngd/rngd.service
Normal file
@@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=Hardware RNG Entropy Gatherer Daemon
|
||||
DefaultDependencies=no
|
||||
Before=systemd-udevd.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/rngd -f
|
@@ -8,7 +8,7 @@ fi
|
||||
|
||||
[ -e /etc/vconsole.conf ] && . /etc/vconsole.conf
|
||||
|
||||
DEFAULT_FONT=LatArCyrHeb-16
|
||||
DEFAULT_FONT=eurlatgr
|
||||
DEFAULT_KEYMAP=/etc/sysconfig/console/default.kmap
|
||||
|
||||
set_keyboard() {
|
||||
|
@@ -23,7 +23,7 @@ install() {
|
||||
fi
|
||||
|
||||
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
|
||||
DEFAULT_FONT="${i18n_default_font:-LatArCyrHeb-16}"
|
||||
DEFAULT_FONT="${i18n_default_font:-eurlatgr}"
|
||||
I18N_CONF="/etc/locale.conf"
|
||||
VCONFIG_CONF="/etc/vconsole.conf"
|
||||
|
||||
@@ -36,7 +36,7 @@ install() {
|
||||
MAPS=$(find ${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\*)
|
||||
|
||||
for map in $MAPS; do
|
||||
KEYMAPS="$KEYMAPS $map"
|
||||
KEYMAPS="$KEYMAPS $map "
|
||||
case $map in
|
||||
*.gz) cmd=zgrep;;
|
||||
*.bz2) cmd=bzgrep;;
|
||||
@@ -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
|
||||
strstr "$KEYMAPS" "$FN" || findkeymap $FN
|
||||
strstr "$KEYMAPS" " $FN " || findkeymap $FN
|
||||
done
|
||||
done
|
||||
done
|
||||
|
@@ -126,9 +126,11 @@ parse_option_121() {
|
||||
elif [ $mask -gt 8 ]; then
|
||||
destination="$1.$2.0.0/$mask"
|
||||
shift; shift
|
||||
else
|
||||
elif [ $mask -gt 0 ]; then
|
||||
destination="$1.0.0.0/$mask"
|
||||
shift
|
||||
else
|
||||
destination="0.0.0.0/$mask"
|
||||
fi
|
||||
|
||||
# Read the gateway
|
||||
@@ -138,7 +140,7 @@ parse_option_121() {
|
||||
# Multicast routing on Linux
|
||||
# - If you set a next-hop address for a multicast group, this breaks with Cisco switches
|
||||
# - If you simply leave it link-local and attach it to an interface, it works fine.
|
||||
if [ $multicast -eq 1 ]; then
|
||||
if [ $multicast -eq 1 -o "$gateway" = "0.0.0.0" ]; then
|
||||
temp_result="$destination dev $interface"
|
||||
else
|
||||
temp_result="$destination via $gateway dev $interface"
|
@@ -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 "$@" \
|
||||
@@ -402,7 +408,11 @@ for p in $(getargs ip=); do
|
||||
esac
|
||||
|
||||
# If this option isn't directed at our interface, skip it
|
||||
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
|
||||
if [ -n "$dev" ]; then
|
||||
[ "$dev" != "$netif" ] && continue
|
||||
else
|
||||
iface_is_enslaved "$netif" && continue
|
||||
fi
|
||||
|
||||
# Store config for later use
|
||||
for i in ip srv gw mask hostname macaddr mtu dns1 dns2; do
|
||||
@@ -452,6 +462,11 @@ for p in $(getargs ip=); do
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if command -v wicked >/dev/null && [ -z "$manualup" ]; then
|
||||
/sbin/netroot $netif
|
||||
fi
|
||||
|
||||
exit $ret
|
||||
fi
|
||||
done
|
92
modules.d/35network-legacy/module-setup.sh
Executable file
92
modules.d/35network-legacy/module-setup.sh
Executable file
@@ -0,0 +1,92 @@
|
||||
#!/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 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
|
||||
}
|
||||
|
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
|
||||
}
|
7
modules.d/35network-manager/nm-config.sh
Executable file
7
modules.d/35network-manager/nm-config.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -n "$netroot" ] || [ -e /tmp/net.ifaces ]; then
|
||||
echo rd.neednet >> /etc/cmdline.d/35-neednet.conf
|
||||
fi
|
||||
|
||||
/usr/libexec/nm-initrd-generator -- $(getcmdline)
|
17
modules.d/35network-manager/nm-run.sh
Executable file
17
modules.d/35network-manager/nm-run.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/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 connection-uuid= $state 2>/dev/null || continue
|
||||
ifname=${_i##*/}
|
||||
sed -n 's/root-path/new_root_path/p;s/next-server/new_next_server/p' <$state >/tmp/dhclient.$ifname.dhcpopts
|
||||
source_hook initqueue/online $ifname
|
||||
/sbin/netroot $ifname
|
||||
done
|
@@ -2,17 +2,17 @@
|
||||
|
||||
# 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 +24,11 @@ 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
|
||||
}
|
||||
|
||||
|
@@ -14,20 +14,20 @@ is_ip() {
|
||||
|
||||
get_ip() {
|
||||
local iface="$1" ip=""
|
||||
ip=$(ip -o -f inet addr show $iface)
|
||||
ip=$(ip -f inet addr show $iface)
|
||||
ip=${ip%%/*}
|
||||
ip=${ip##* }
|
||||
echo $ip
|
||||
}
|
||||
|
||||
iface_for_remote_addr() {
|
||||
set -- $(ip -o route get to $1)
|
||||
echo $5
|
||||
set -- $(ip route get to $1 | sed 's/.*\bdev\b//p;q')
|
||||
echo $1
|
||||
}
|
||||
|
||||
iface_for_ip() {
|
||||
set -- $(ip -o addr show to $1)
|
||||
echo $2
|
||||
set -- $(ip addr show to $1)
|
||||
echo ${2%:}
|
||||
}
|
||||
|
||||
iface_for_mac() {
|
||||
@@ -129,7 +129,7 @@ setup_net() {
|
||||
for _p in $(getargs rd.route); do
|
||||
route_to_var "$_p" || continue
|
||||
[ -n "$route_dev" ] && [ "$route_dev" != "$netif" ] && continue
|
||||
ip route add "$route_mask" ${route_gw:+via "$route_gw"} ${route_dev:+dev "$route_dev"}
|
||||
ip route add "$route_mask" ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}
|
||||
if strstr "$route_mask" ":"; then
|
||||
printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
|
||||
> /tmp/net.route6."$netif"
|
||||
@@ -463,7 +463,7 @@ ip_to_var() {
|
||||
# ip=<ipv4-address> means anaconda-style static config argument cluster
|
||||
autoconf="$1"
|
||||
|
||||
if strstr "$autoconf" "*.*.*.*"; then
|
||||
if strglob "$autoconf" "*.*.*.*"; then
|
||||
# ip=<ipv4-address> means anaconda-style static config argument cluster:
|
||||
# ip=<ip> gateway=<gw> netmask=<nm> hostname=<host> mtu=<mtu>
|
||||
# ksdevice={link|bootif|ibft|<MAC>|<ifname>}
|
||||
@@ -593,7 +593,7 @@ wait_for_if_link() {
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip -o link show dev $1 2>/dev/null)
|
||||
li=$(ip link show dev $1 2>/dev/null)
|
||||
[ -n "$li" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
@@ -609,7 +609,7 @@ wait_for_if_up() {
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip -o link show up dev $1)
|
||||
li=$(ip link show up dev $1)
|
||||
if [ -n "$li" ]; then
|
||||
case "$li" in
|
||||
*\<UP*)
|
||||
@@ -653,7 +653,8 @@ wait_for_ipv6_dad_link() {
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
|
||||
[ -n "$(ip -6 addr show dev "$1" scope link)" ] \
|
||||
&& [ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
|
||||
&& [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
|
||||
&& return 0
|
||||
[ -n "$(ip -6 addr show dev "$1" scope link dadfailed)" ] \
|
||||
@@ -671,7 +672,8 @@ wait_for_ipv6_dad() {
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -z "$(ip -6 addr show dev "$1" tentative)" ] \
|
||||
[ -n "$(ip -6 addr show dev "$1")" ] \
|
||||
&& [ -z "$(ip -6 addr show dev "$1" tentative)" ] \
|
||||
&& [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
|
||||
&& return 0
|
||||
[ -n "$(ip -6 addr show dev "$1" dadfailed)" ] \
|
||||
@@ -721,12 +723,12 @@ iface_has_carrier() {
|
||||
|
||||
linkup "$1"
|
||||
|
||||
li=$(ip -o link show up dev $1)
|
||||
li=$(ip link show up dev $1)
|
||||
strstr "$li" "NO-CARRIER" && _no_carrier_flag=1
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
if [ -n "$_no_carrier_flag" ]; then
|
||||
li=$(ip -o link show up dev $1)
|
||||
li=$(ip link show up dev $1)
|
||||
# NO-CARRIER flag was cleared
|
||||
strstr "$li" "NO-CARRIER" || return 0
|
||||
elif ! [ -e "$interface/carrier" ]; then
|
||||
@@ -745,6 +747,13 @@ iface_has_link() {
|
||||
iface_has_carrier "$@"
|
||||
}
|
||||
|
||||
iface_is_enslaved() {
|
||||
local _li
|
||||
_li=$(ip link show dev $1)
|
||||
strstr "$_li" " master " || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
find_iface_with_link() {
|
||||
local iface_path="" iface=""
|
||||
for iface_path in /sys/class/net/*; do
|
||||
|
@@ -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 awk
|
||||
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 | awk '!($0 in a) { a[$0]; print }' > /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
|
||||
|
@@ -191,7 +191,7 @@ readkey() {
|
||||
local device="$3"
|
||||
|
||||
# No mounting needed if the keyfile resides inside the initrd
|
||||
if [ "/" == "$keydev" ]; then
|
||||
if [ "/" = "$keydev" ]; then
|
||||
local mntp=/
|
||||
else
|
||||
# This creates a unique single mountpoint for *, or several for explicitly
|
||||
|
@@ -8,6 +8,8 @@ NEWROOT=${NEWROOT:-"/sysroot"}
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
mkdir -m 0700 /run/cryptsetup
|
||||
|
||||
# if device name is /dev/dm-X, convert to /dev/mapper/name
|
||||
if [ "${1##/dev/dm-}" != "$1" ]; then
|
||||
device="/dev/mapper/$(dmsetup info -c --noheadings -o name "$1")"
|
||||
@@ -156,9 +158,9 @@ else
|
||||
|
||||
info "Using '$keypath' on '$keydev'"
|
||||
readkey "$keypath" "$keydev" "$device" \
|
||||
| cryptsetup -d - $cryptsetupopts luksOpen "$device" "$luksname"
|
||||
| cryptsetup -d - $cryptsetupopts luksOpen "$device" "$luksname" \
|
||||
&& ask_passphrase=0
|
||||
unset keypath keydev
|
||||
ask_passphrase=0
|
||||
break
|
||||
done
|
||||
fi
|
||||
|
@@ -25,7 +25,7 @@ depends() {
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
hostonly="" instmods drbg
|
||||
arch=$(arch)
|
||||
arch=$(uname -m)
|
||||
[[ $arch == x86_64 ]] && arch=x86
|
||||
[[ $arch == s390x ]] && arch=s390
|
||||
instmods dm_crypt =crypto =drivers/crypto =arch/$arch/crypto
|
||||
|
@@ -18,7 +18,7 @@ if getargbool 1 rd.luks -n rd_NO_LUKS && \
|
||||
fi
|
||||
|
||||
# A keydev of '/' is treated as the initrd itself
|
||||
if [ "/" == "$keydev" ]; then
|
||||
if [ "/" = "$keydev" ]; then
|
||||
[ -z "$luksdev" ] && luksdev='*'
|
||||
echo "$luksdev:$keydev:$keypath" >> /tmp/luks.keys
|
||||
continue
|
||||
|
@@ -1,7 +1,7 @@
|
||||
SUBSYSTEM!="block", GOTO="dm_end"
|
||||
ACTION!="add|change", GOTO="dm_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="dm_end"
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="dm_end"
|
||||
|
||||
KERNEL!="dm-[0-9]*", GOTO="dm_end"
|
||||
ACTION=="add", GOTO="dm_end"
|
||||
|
@@ -5,7 +5,7 @@
|
||||
SUBSYSTEM!="block", GOTO="dm_end"
|
||||
ACTION!="add|change", GOTO="dm_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="dm_end"
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="dm_end"
|
||||
|
||||
ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="dm_end"
|
||||
|
||||
|
@@ -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 -se --) \
|
||||
| instmods || return 1
|
||||
|
||||
return 0
|
||||
}
|
@@ -25,7 +25,7 @@ installkernel() {
|
||||
ohci-hcd ohci-pci \
|
||||
uhci-hcd \
|
||||
xhci-hcd xhci-pci xhci-plat-hcd \
|
||||
pinctrl-cherryview \
|
||||
"=drivers/pinctrl" \
|
||||
${NULL}
|
||||
|
||||
hostonly=$(optional_hostonly) instmods \
|
||||
@@ -41,7 +41,7 @@ installkernel() {
|
||||
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 vmd
|
||||
"=drivers/pcmcia" =ide nvme vmd nfit
|
||||
|
||||
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
|
||||
# arm/aarch64 specific modules
|
||||
@@ -50,6 +50,7 @@ installkernel() {
|
||||
"=drivers/clk" \
|
||||
"=drivers/dma" \
|
||||
"=drivers/extcon" \
|
||||
"=drivers/gpio" \
|
||||
"=drivers/hwspinlock" \
|
||||
"=drivers/i2c/busses" \
|
||||
"=drivers/mfd" \
|
||||
|
@@ -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"
|
||||
|
@@ -7,7 +7,7 @@
|
||||
SUBSYSTEM!="block", GOTO="lvm_end"
|
||||
ACTION!="add|change", GOTO="lvm_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="lvm_end"
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="lvm_end"
|
||||
KERNEL=="dm-[0-9]*", ACTION=="add", GOTO="lvm_end"
|
||||
ENV{ID_FS_TYPE}!="LVM?_member", GOTO="lvm_end"
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
SUBSYSTEM!="block", GOTO="md_end"
|
||||
ACTION!="add|change", GOTO="md_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="md_end"
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="md_end"
|
||||
|
||||
KERNEL!="md[0-9]*|md_d[0-9]*|md/*", KERNEL!="md*", GOTO="md_end"
|
||||
|
||||
|
@@ -9,7 +9,7 @@ KERNEL=="md*", ENV{ID_FS_TYPE}!="linux_raid_member", GOTO="md_end"
|
||||
KERNEL=="md*", ACTION!="change", GOTO="md_end"
|
||||
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="md_end"
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="md_end"
|
||||
|
||||
ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_raid_member", GOTO="md_try"
|
||||
GOTO="md_end"
|
||||
|
@@ -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
|
||||
|
@@ -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,11 +31,7 @@ else
|
||||
mv "${f}.new" "$f"
|
||||
done
|
||||
for uuid in $MD_UUID; do
|
||||
if strstr "$uuid" "-"; then
|
||||
# convert ID_FS_UUID to MD_UUID format
|
||||
uuid=$(str_replace "$uuid" "-" "")
|
||||
uuid="$(expr substr $uuid 1 8):$(expr substr $uuid 9 8):$(expr substr $uuid 17 8):$(expr substr $uuid 25 8)"
|
||||
fi
|
||||
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,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
|
||||
|
@@ -3,21 +3,7 @@
|
||||
# called by dracut
|
||||
check() {
|
||||
if [[ $hostonly ]] || [[ $mount_needs ]]; then
|
||||
if type -P systemd-detect-virt >/dev/null 2>&1; then
|
||||
vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
|
||||
(($? != 0)) && return 255
|
||||
[[ $vm = "qemu" ]] && return 0
|
||||
[[ $vm = "kvm" ]] && return 0
|
||||
[[ $vm = "bochs" ]] && return 0
|
||||
fi
|
||||
|
||||
for i in /sys/class/dmi/id/*_vendor; do
|
||||
[[ -f $i ]] || continue
|
||||
read vendor < $i
|
||||
[[ "$vendor" == "QEMU" ]] && return 0
|
||||
[[ "$vendor" == "Bochs" ]] && return 0
|
||||
done
|
||||
|
||||
is_qemu_virtualized && return 0
|
||||
return 255
|
||||
fi
|
||||
return 0
|
||||
|
@@ -3,22 +3,7 @@
|
||||
# called by dracut
|
||||
check() {
|
||||
if [[ $hostonly ]] || [[ $mount_needs ]]; then
|
||||
if type -P systemd-detect-virt >/dev/null 2>&1; then
|
||||
vm=$(systemd-detect-virt --vm 2>/dev/null)
|
||||
(($? != 0)) && return 255
|
||||
[[ $vm = "qemu" ]] && return 0
|
||||
[[ $vm = "kvm" ]] && return 0
|
||||
[[ $vm = "bochs" ]] && return 0
|
||||
fi
|
||||
|
||||
for i in /sys/class/dmi/id/*_vendor; do
|
||||
[[ -f $i ]] || continue
|
||||
read vendor < $i
|
||||
[[ "$vendor" == "QEMU" ]] && return 0
|
||||
[[ "$vendor" == "Red Hat" ]] && return 0
|
||||
[[ "$vendor" == "Bochs" ]] && return 0
|
||||
done
|
||||
|
||||
is_qemu_virtualized && return 0
|
||||
return 255
|
||||
fi
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
require_binaries stratisd-init thin_check thin_repair || return 1
|
||||
require_binaries stratisd-init thin_check thin_repair mkfs.xfs xfs_admin xfs_growfs || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ installkernel() {
|
||||
# called by dracut
|
||||
install() {
|
||||
|
||||
inst_multiple stratisd-init thin_check thin_repair
|
||||
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"
|
||||
|
@@ -53,7 +53,7 @@ gpg_decrypt() {
|
||||
--tries 3 --tty-echo-off
|
||||
|
||||
# Clean up the smartcard gpg-agent
|
||||
if [ "${useSmartcard}" == "1" ]; then
|
||||
if [ "${useSmartcard}" = "1" ]; then
|
||||
GNUPGHOME="$gpghome" gpg-connect-agent 1>/dev/null killagent /bye
|
||||
fi
|
||||
|
||||
|
@@ -22,7 +22,7 @@ depends() {
|
||||
installkernel() {
|
||||
local _boot_zipl
|
||||
|
||||
_boot_zipl=$(sed -n 's/\(.*\)\w*\/boot\/zipl.*/\1/p' /etc/fstab)
|
||||
_boot_zipl=$(sed -n -e '/^[[:space:]]*#/d' -e 's/\(.*\)\w*\/boot\/zipl.*/\1/p' /etc/fstab)
|
||||
if [ -n "$_boot_zipl" ] ; then
|
||||
eval $(blkid -s TYPE -o udev ${_boot_zipl})
|
||||
if [ -n "$ID_FS_TYPE" ] ; then
|
||||
@@ -40,7 +40,7 @@ installkernel() {
|
||||
cmdline() {
|
||||
local _boot_zipl
|
||||
|
||||
_boot_zipl=$(sed -n 's/\(.*\)\w*\/boot\/zipl.*/\1/p' /etc/fstab)
|
||||
_boot_zipl=$(sed -n -e '/^[[:space:]]*#/d' -e 's/\(.*\)\w*\/boot\/zipl.*/\1/p' /etc/fstab)
|
||||
if [ -n "$_boot_zipl" ] ; then
|
||||
echo "rd.zipl=${_boot_zipl}"
|
||||
fi
|
||||
|
@@ -54,6 +54,8 @@ install() {
|
||||
if [[ $hostonly ]] ; then
|
||||
inst_rules_wildcard 51-dasd-*.rules
|
||||
inst_rules_wildcard 41-s390x-dasd-*.rules
|
||||
mark_hostonly /etc/udev/rules.d/51-dasd-*.rules
|
||||
mark_hostonly /etc/udev/rules.d/41-s390x-dasd-*.rules
|
||||
fi
|
||||
inst_rules 59-dasd.rules
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
dcssblk_arg=$(getarg rd.dcssblk=)
|
||||
if [ $? == 0 ];then
|
||||
if [ $? = 0 ];then
|
||||
info "Loading dcssblk segments=$dcssblk_arg"
|
||||
modprobe dcssblk segments=$dcssblk_arg
|
||||
fi
|
||||
|
@@ -13,9 +13,9 @@ depends() {
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple -o cat ls ps grep more cat rm strace free showmount \
|
||||
ping netstat rpcinfo vi scp ping6 ssh find vi \
|
||||
tcpdump cp less hostname mkdir systemd-analyze \
|
||||
inst_multiple -o ls ps grep more cat rm strace free showmount df du lsblk \
|
||||
ping netstat rpcinfo vi scp ping6 ssh find \
|
||||
tcpdump cp dd less hostname mkdir systemd-analyze \
|
||||
fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.f2fs fsck.vfat e2fsck
|
||||
|
||||
grep '^tcpdump:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
|
0
modules.d/95fcoe/cleanup-fcoe.sh
Normal file → Executable file
0
modules.d/95fcoe/cleanup-fcoe.sh
Normal file → Executable file
@@ -1,5 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
if ! getargbool 0 rd.nofcoe ; then
|
||||
info "rd.nofcoe=0: skipping lldpad activation"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Note lldpad will stay running after switchroot, the system initscripts
|
||||
# are to kill it and start a new lldpad to take over. Data is transfered
|
||||
# between the 2 using a shm segment
|
||||
|
@@ -13,12 +13,17 @@
|
||||
# fcoe=eth0:nodcb:vn2vn
|
||||
# fcoe=4a:3f:4c:04:f8:d7:nodcb:fabric
|
||||
|
||||
if ! getargbool 0 rd.nofcoe ; then
|
||||
info "rd.nofcoe=0: skipping fcoe"
|
||||
return 0
|
||||
fi
|
||||
|
||||
[ -z "$fcoe" ] && fcoe=$(getarg fcoe=)
|
||||
|
||||
# If it's not set we don't continue
|
||||
[ -z "$fcoe" ] && return
|
||||
|
||||
[ -e /sys/bus/fcoe/ctlr_create ] || modprobe -b -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
|
||||
[ -e /sys/bus/fcoe/ctlr_create ] || modprobe -b -a fcoe || modprobe -b -a libfcoe || die "FCoE requested but kernel/initrd does not support FCoE"
|
||||
|
||||
initqueue --onetime modprobe -b -q bnx2fc
|
||||
|
||||
|
@@ -109,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 $p"
|
||||
iscsi_param="$iscsi_param $p"
|
||||
done
|
||||
|
||||
parse_iscsi_root "$1" || return 1
|
||||
@@ -194,6 +194,12 @@ handle_netroot()
|
||||
sleep 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
iscsid
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
# FIXME $iscsi_protocol??
|
||||
|
||||
if [ "$root" = "dhcp" ] || [ "$netroot" = "dhcp" ]; then
|
||||
@@ -208,28 +214,31 @@ handle_netroot()
|
||||
echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
|
||||
fi
|
||||
|
||||
### ToDo: Upstream calls systemd-run - Shall we, do we have to port this?
|
||||
|
||||
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)
|
||||
[ -n "$iscsi_initiator" ] && $(iscsiadm -m iface -I $iscsi_iface_name --op=update --name=iface.initiatorname --value=$iscsi_initiator)
|
||||
[ -n "$iscsi_netdev_name" ] && $(iscsiadm -m iface -I $iscsi_iface_name --op=update --name=iface.net_ifacename --value=$iscsi_netdev_name)
|
||||
COMMAND="iscsiadm -m node -T $target -p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port} -I $iscsi_iface_name --op=update"
|
||||
else
|
||||
COMMAND="iscsiadm -m node -T $target -p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port} --op=update"
|
||||
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
|
||||
$($COMMAND --name=node.startup --value=onboot)
|
||||
[ -n "$iscsi_username" ] && $($COMMAND --name=node.session.auth.username --value=$iscsi_username)
|
||||
[ -n "$iscsi_password" ] && $($COMMAND --name=node.session.auth.password --value=$iscsi_password)
|
||||
[ -n "$iscsi_in_username" ] && $($COMMAND --name=node.session.auth.username_in --value=$iscsi_in_username)
|
||||
[ -n "$iscsi_in_password" ] && $($COMMAND --name=node.session.auth.password_in --value=$iscsi_in_password)
|
||||
[ -n "$iscsi_param" ] && for param in $iscsi_param; do $($COMMAND --name=${param%=*} --value=${param#*=}); done
|
||||
[ -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
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
check() {
|
||||
local _rootdev
|
||||
# If our prerequisites are not met, fail anyways.
|
||||
require_binaries hostname iscsi-iname iscsiadm iscsid || return 1
|
||||
require_binaries iscsi-iname iscsiadm iscsid || return 1
|
||||
|
||||
# If hostonly was requested, fail the check if we are not actually
|
||||
# booting from root.
|
||||
@@ -22,8 +22,10 @@ check() {
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
pushd . >/dev/null
|
||||
for_each_host_dev_and_slaves is_iscsi || return 255
|
||||
for_each_host_dev_and_slaves is_iscsi
|
||||
local _is_iscsi=$?
|
||||
popd >/dev/null
|
||||
[[ $_is_iscsi == 0 ]] || return 255
|
||||
}
|
||||
return 0
|
||||
}
|
||||
@@ -72,6 +74,7 @@ install_iscsiroot() {
|
||||
local devpath=$1
|
||||
local scsi_path iscsi_lun session c d conn host flash
|
||||
local iscsi_session iscsi_address iscsi_port iscsi_targetname iscsi_tpgt
|
||||
local bootproto
|
||||
|
||||
scsi_path=${devpath%%/block*}
|
||||
[ "$scsi_path" = "$devpath" ] && return 1
|
||||
@@ -86,6 +89,7 @@ install_iscsiroot() {
|
||||
iscsi_host=${host##*/}
|
||||
|
||||
for flash in ${host}/flashnode_sess-* ; do
|
||||
[ ! -e "$flash/is_boot_target" ] && continue
|
||||
is_boot=$(cat $flash/is_boot_target)
|
||||
if [ $is_boot -eq 1 ] ; then
|
||||
# qla4xxx flashnode session; skip iBFT discovery
|
||||
@@ -118,8 +122,14 @@ install_iscsiroot() {
|
||||
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')
|
||||
|
||||
#follow ifcfg settings for boot protocol
|
||||
bootproto=$(sed -n "/BOOTPROTO/s/BOOTPROTO='\([[:alpha:]]*6\?\)4\?'/\1/p" /etc/sysconfig/network/ifcfg-$ifname)
|
||||
# follow ifcfg settings for boot protocol
|
||||
for _path in \
|
||||
"/etc/sysconfig/network-scripts/ifcfg-$ifname" \
|
||||
"/etc/sysconfig/network/ifcfg-$ifname" \
|
||||
; do
|
||||
[ -f "$_path" ] && bootproto=$(sed -n "s/BOOTPROTO='\?\([[:alpha:]]*6\?\)4\?/\1/p" "$_path")
|
||||
done
|
||||
|
||||
if [ $bootproto ]; then
|
||||
printf 'ip=%s:%s ' ${ifname} ${bootproto}
|
||||
else
|
||||
@@ -206,10 +216,7 @@ cmdline() {
|
||||
install() {
|
||||
inst_multiple -o iscsiuio
|
||||
inst_libdir_file 'libgcc_s.so*'
|
||||
inst_multiple umount hostname iscsi-iname iscsiadm iscsid
|
||||
|
||||
ln -sf $systemdsystemunitdir/iscsid.socket $systemdsystemunitdir/sockets.target.wants/iscsid.socket
|
||||
ln -sf $systemdsystemunitdir/iscsiuio.socket $systemdsystemunitdir/sockets.target.wants/iscsiuio.socket
|
||||
inst_multiple umount iscsi-iname iscsiadm iscsid
|
||||
|
||||
inst_multiple -o \
|
||||
$systemdsystemunitdir/iscsid.socket \
|
||||
@@ -219,7 +226,11 @@ install() {
|
||||
$systemdsystemunitdir/sockets.target.wants/iscsid.socket \
|
||||
$systemdsystemunitdir/sockets.target.wants/iscsiuio.socket
|
||||
|
||||
[[ -d /etc/iscsi ]] && inst_dir $(/usr/bin/find /etc/iscsi)
|
||||
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
|
||||
@@ -243,6 +254,7 @@ install() {
|
||||
|
||||
mkdir -p "${initdir}/$systemdsystemunitdir/sockets.target.wants"
|
||||
for i in \
|
||||
iscsid.socket \
|
||||
iscsiuio.socket \
|
||||
; do
|
||||
ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/sockets.target.wants/${i}"
|
||||
@@ -263,6 +275,23 @@ install() {
|
||||
echo "After=dracut-cmdline.service"
|
||||
echo "Before=dracut-initqueue.service"
|
||||
) > "${initdir}/$systemdsystemunitdir/iscsid.service.d/dracut.conf"
|
||||
|
||||
# The iscsi deamon does not need to wait for any storage inside initrd
|
||||
mkdir -p "${initdir}/$systemdsystemunitdir/iscsid.socket.d"
|
||||
(
|
||||
echo "[Unit]"
|
||||
echo "DefaultDependencies=no"
|
||||
echo "Conflicts=shutdown.target"
|
||||
echo "Before=shutdown.target sockets.target"
|
||||
) > "${initdir}/$systemdsystemunitdir/iscsid.socket.d/dracut.conf"
|
||||
mkdir -p "${initdir}/$systemdsystemunitdir/iscsiuio.socket.d"
|
||||
(
|
||||
echo "[Unit]"
|
||||
echo "DefaultDependencies=no"
|
||||
echo "Conflicts=shutdown.target"
|
||||
echo "Before=shutdown.target sockets.target"
|
||||
) > "${initdir}/$systemdsystemunitdir/iscsiuio.socket.d/dracut.conf"
|
||||
|
||||
fi
|
||||
inst_dir /var/lib/iscsi
|
||||
dracut_need_initqueue
|
||||
|
@@ -2,7 +2,7 @@
|
||||
if [ -z $iscsi_lun ]; then
|
||||
iscsi_lun=0
|
||||
fi
|
||||
NEWROOT=${NEWROOT:-"/sysroot"}
|
||||
NEWROOT=${NEWROOT:-/sysroot}
|
||||
|
||||
for disk in /dev/disk/by-path/*-iscsi-*-$iscsi_lun; do
|
||||
if mount -t ${fstype:-auto} -o "$rflags" $disk $NEWROOT; then
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user