Compare commits
277 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
036712546b | ||
![]() |
391d605790 | ||
![]() |
aef0f55791 | ||
![]() |
66ed711ccf | ||
![]() |
960b1e48e8 | ||
![]() |
437a56dc6b | ||
![]() |
630aed8b66 | ||
![]() |
af6292f0fc | ||
![]() |
b710520a3d | ||
![]() |
66e092bb53 | ||
![]() |
fdc1037b19 | ||
![]() |
76df206685 | ||
![]() |
77364fd6bb | ||
![]() |
41b0e41a09 | ||
![]() |
791532b0ce | ||
![]() |
ad45024416 | ||
![]() |
3ae5ac28af | ||
![]() |
fd28794bbc | ||
![]() |
d18fd0235b | ||
![]() |
15c5c072f4 | ||
![]() |
caf207afa7 | ||
![]() |
57937cf480 | ||
![]() |
feaf30ffaa | ||
![]() |
dcae873414 | ||
![]() |
32214acb3a | ||
![]() |
e64bcf5a99 | ||
![]() |
62cb52f431 | ||
![]() |
cf8b1b7853 | ||
![]() |
bc97e005fa | ||
![]() |
679fa7ed3c | ||
![]() |
4f084f3ab5 | ||
![]() |
af2716626a | ||
![]() |
6625c085ae | ||
![]() |
af2578562c | ||
![]() |
8099e7b1ba | ||
![]() |
0a3e348225 | ||
![]() |
b78e6ac2c3 | ||
![]() |
cbfe65c2fe | ||
![]() |
284d62da81 | ||
![]() |
c6df70fb48 | ||
![]() |
1b8616adee | ||
![]() |
639bd4873b | ||
![]() |
e0904b27ff | ||
![]() |
d9eff33ce2 | ||
![]() |
8974102f6b | ||
![]() |
599182b108 | ||
![]() |
6a736cc129 | ||
![]() |
15b93069bb | ||
![]() |
19b5c10963 | ||
![]() |
bcfbddefe1 | ||
![]() |
780cb33741 | ||
![]() |
8d7c07f191 | ||
![]() |
fefd3f66f9 | ||
![]() |
d57b8833c4 | ||
![]() |
9584c6ae90 | ||
![]() |
021b2fddff | ||
![]() |
b6f2e05819 | ||
![]() |
3ed08d1e4d | ||
![]() |
26a077fc7e | ||
![]() |
8461734ee4 | ||
![]() |
6f4c2dada4 | ||
![]() |
ab42fe38fd | ||
![]() |
3be5d63c2f | ||
![]() |
b4dc22cab7 | ||
![]() |
2b125c69cc | ||
![]() |
9268366cad | ||
![]() |
d0eedc4a5f | ||
![]() |
4460416abc | ||
![]() |
884e1cda7c | ||
![]() |
46a885bf9f | ||
![]() |
7dbca9be86 | ||
![]() |
7d9bb76ac7 | ||
![]() |
26ab7b07a6 | ||
![]() |
14499534ba | ||
![]() |
1540df0e79 | ||
![]() |
5d68c80b16 | ||
![]() |
5f8cd1a4be | ||
![]() |
14201d23e7 | ||
![]() |
a229b17434 | ||
![]() |
ca2c693679 | ||
![]() |
cdcb27a4fe | ||
![]() |
0c5ccb35c7 | ||
![]() |
9d787df196 | ||
![]() |
0290e98271 | ||
![]() |
d136ca4eeb | ||
![]() |
a55f910cf6 | ||
![]() |
96efbc51ac | ||
![]() |
9d36d4fb1d | ||
![]() |
41bfa5dad1 | ||
![]() |
db9fbaf9b8 | ||
![]() |
56fb5c4dbf | ||
![]() |
a8986425a4 | ||
![]() |
ea3c4e8273 | ||
![]() |
6db8c5a5fe | ||
![]() |
ab9b04f55b | ||
![]() |
c4b572b5ca | ||
![]() |
cc6f0925df | ||
![]() |
d50cf62d62 | ||
![]() |
75369f8ba0 | ||
![]() |
8e2bcb4b42 | ||
![]() |
bfac40665b | ||
![]() |
6c6d805765 | ||
![]() |
44f870be42 | ||
![]() |
b37398dc1c | ||
![]() |
1b0a362d83 | ||
![]() |
bb425d20a1 | ||
![]() |
cbd69dc6ff | ||
![]() |
cb8def95c4 | ||
![]() |
78d1d4f86d | ||
![]() |
5bfa3b363a | ||
![]() |
1d4b337543 | ||
![]() |
8c67d395d4 | ||
![]() |
02566acdd7 | ||
![]() |
478aa7dac1 | ||
![]() |
967db70090 | ||
![]() |
619c1bb334 | ||
![]() |
57aa1e9140 | ||
![]() |
af2fcbafe8 | ||
![]() |
7b6bdc3f94 | ||
![]() |
db43f56d94 | ||
![]() |
a1ebd77179 | ||
![]() |
e26d76dca1 | ||
![]() |
d59732004d | ||
![]() |
a3a8f58d73 | ||
![]() |
c9e5b75308 | ||
![]() |
fd191a7b41 | ||
![]() |
e42c7a980c | ||
![]() |
85804a9197 | ||
![]() |
ee2321c91e | ||
![]() |
11fbde4454 | ||
![]() |
fb05f9876a | ||
![]() |
7e9bfdde14 | ||
![]() |
7e9fc37db8 | ||
![]() |
bb278147cf | ||
![]() |
81b676a675 | ||
![]() |
6b46e7baa0 | ||
![]() |
85c85f07e2 | ||
![]() |
c853dc72e9 | ||
![]() |
18d0c9b858 | ||
![]() |
0a5fd0dcec | ||
![]() |
e0e99c59a5 | ||
![]() |
d46394ad33 | ||
![]() |
87dc81a1f6 | ||
![]() |
ce92ca0527 | ||
![]() |
c390590fac | ||
![]() |
fd8e4aef90 | ||
![]() |
c5a742a3bf | ||
![]() |
fc4e10a859 | ||
![]() |
83bb0893ed | ||
![]() |
8fdcc1a9b1 | ||
![]() |
a23b368c92 | ||
![]() |
bbfff3e58b | ||
![]() |
9c322b2f3b | ||
![]() |
dff9a66c44 | ||
![]() |
449b0e0707 | ||
![]() |
4a5a9c6d89 | ||
![]() |
917f3e4d25 | ||
![]() |
7d848c55a6 | ||
![]() |
7d17d6c976 | ||
![]() |
b8060ef781 | ||
![]() |
727543c1e6 | ||
![]() |
c85cda9e2f | ||
![]() |
c0c6c74d99 | ||
![]() |
d26bd6ca55 | ||
![]() |
e22eb857be | ||
![]() |
2fa6fd3aaa | ||
![]() |
dd5875499e | ||
![]() |
d351541ee6 | ||
![]() |
d928724c3c | ||
![]() |
727e68d0b5 | ||
![]() |
8d28614e4f | ||
![]() |
fba5fbbdad | ||
![]() |
d008b6b89f | ||
![]() |
aede120c92 | ||
![]() |
cc2303001e | ||
![]() |
54e7d7c32d | ||
![]() |
bcd352dfa1 | ||
![]() |
d837ac3984 | ||
![]() |
900e15da34 | ||
![]() |
19d69051a3 | ||
![]() |
31737a05e1 | ||
![]() |
1161f03777 | ||
![]() |
cf24ac8c19 | ||
![]() |
af3ef92a6b | ||
![]() |
c46cda8260 | ||
![]() |
34bd2be23f | ||
![]() |
c3dd68fcf1 | ||
![]() |
3e35441f18 | ||
![]() |
dde2db3da9 | ||
![]() |
cbc21754e5 | ||
![]() |
eb2dc8c34b | ||
![]() |
c4e098a514 | ||
![]() |
72875215a3 | ||
![]() |
335bc217b3 | ||
![]() |
510aecdbd8 | ||
![]() |
9dd9d81fc6 | ||
![]() |
a5b48ce798 | ||
![]() |
59afbd8e73 | ||
![]() |
348baca3e4 | ||
![]() |
83691c413f | ||
![]() |
ca36b9b8f8 | ||
![]() |
a9c7dc74c4 | ||
![]() |
ce862de624 | ||
![]() |
500861cd05 | ||
![]() |
44d26d9209 | ||
![]() |
35270e34d0 | ||
![]() |
fe654ff0aa | ||
![]() |
5e1e1ec060 | ||
![]() |
2673ff1932 | ||
![]() |
e8f7ea6794 | ||
![]() |
3899211bfc | ||
![]() |
6e0c1c448d | ||
![]() |
6ae68b4674 | ||
![]() |
41eba87b32 | ||
![]() |
a1084c02fd | ||
![]() |
5ac8420abc | ||
![]() |
24d009507f | ||
![]() |
e9020221a7 | ||
![]() |
b59e9e5724 | ||
![]() |
b5859d6359 | ||
![]() |
dbfaae0e34 | ||
![]() |
8d85429a44 | ||
![]() |
3e4ab73cd4 | ||
![]() |
4e32b2e916 | ||
![]() |
356333b331 | ||
![]() |
f62f3a2191 | ||
![]() |
389333396a | ||
![]() |
cfb7410cd0 | ||
![]() |
f672b1c399 | ||
![]() |
f12f694355 | ||
![]() |
9a9c6e1256 | ||
![]() |
9c65c125a9 | ||
![]() |
7d4d3f8da6 | ||
![]() |
569ffe77bf | ||
![]() |
a42b2b8133 | ||
![]() |
31ba4de21d | ||
![]() |
a005c47763 | ||
![]() |
5db6ca5a4b | ||
![]() |
1a6fdf2417 | ||
![]() |
27a2c3a406 | ||
![]() |
b347edfa23 | ||
![]() |
3ed09d970e | ||
![]() |
a28e2aeefe | ||
![]() |
c6a71c7b8a | ||
![]() |
6ecb9a2d68 | ||
![]() |
918a6874df | ||
![]() |
2663232a01 | ||
![]() |
cebab07e68 | ||
![]() |
a04f3077cd | ||
![]() |
04b873598b | ||
![]() |
22137f9cac | ||
![]() |
54665349ec | ||
![]() |
f251a89772 | ||
![]() |
fbdfa57746 | ||
![]() |
6b095274fb | ||
![]() |
11174408e8 | ||
![]() |
c2117747fd | ||
![]() |
4f6e293308 | ||
![]() |
d9076cac19 | ||
![]() |
ff52ca1b57 | ||
![]() |
8a3c4957fc | ||
![]() |
3f54a83ca8 | ||
![]() |
7fa3b9e376 | ||
![]() |
39135af155 | ||
![]() |
02640e8e65 | ||
![]() |
579f385384 | ||
![]() |
56d60c4b2d | ||
![]() |
62fd2b3644 | ||
![]() |
cd9072d342 | ||
![]() |
19bab59c48 | ||
![]() |
d8b627b9dc | ||
![]() |
6320d072a1 | ||
![]() |
7abeb49878 | ||
![]() |
14fcfbec3e | ||
![]() |
fa9f15e3be | ||
![]() |
ae4758ce0d | ||
![]() |
66f01450a8 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -13,3 +13,7 @@ test*.img
|
||||
/.project
|
||||
/dracut-version.sh
|
||||
/install/dracut-install
|
||||
/*.rpm
|
||||
/*.[0-9]
|
||||
/modules.d/98systemd/*.service.8
|
||||
/*.sign
|
||||
|
27
.mailmap
27
.mailmap
@@ -1,12 +1,15 @@
|
||||
Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer-omB+W0Dpw2o@public.gmane.org>
|
||||
Seewer Philippe <philippe.seewer@bfh.ch> <philippe.seewer@bfh.ch>
|
||||
Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer@bfh.ch>
|
||||
Victor Lowther <victor.lowther@gmail.com> <victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
|
||||
Harald Hoyer <harald@redhat.com> <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
|
||||
Harald Hoyer <harald@redhat.com> <harald@eeepc.(none)>
|
||||
Mike Snitzer <snitzer@redhat.com> <msnitzer@redhat.com>
|
||||
Amerigo Wang <amwang@redhat.com> <xiyou.wangcong@gmail.com>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com> <arvidjaar@mail.ru>
|
||||
Dan Horák <dhorak@redhat.com> <dan@danny.cz>
|
||||
John Reiser <jreiser@bitwagon.com> <jreiser@BitWagon.com>
|
||||
Luca Berra <bluca@vodka.it> <bluca@comedia.it>
|
||||
Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer-omB+W0Dpw2o@public.gmane.org>
|
||||
Seewer Philippe <philippe.seewer@bfh.ch> <philippe.seewer@bfh.ch>
|
||||
Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer@bfh.ch>
|
||||
Victor Lowther <victor.lowther@gmail.com> <victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
|
||||
Harald Hoyer <harald@redhat.com> <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
|
||||
Harald Hoyer <harald@redhat.com> <harald@eeepc.(none)>
|
||||
Mike Snitzer <snitzer@redhat.com> <msnitzer@redhat.com>
|
||||
Amerigo Wang <amwang@redhat.com> <xiyou.wangcong@gmail.com>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com> <arvidjaar@mail.ru>
|
||||
Dan Horák <dhorak@redhat.com> <dan@danny.cz>
|
||||
John Reiser <jreiser@bitwagon.com> <jreiser@BitWagon.com>
|
||||
Luca Berra <bluca@vodka.it> <bluca@comedia.it>
|
||||
Dave Young <dyoung@redhat.com> dyoung@redhat.com
|
||||
Frederick Grose <fgrose@sugarlabs.org> <fgrose@gmail.com>
|
||||
Frederic Crozat <fcrozat@suse.com> <fcrozat@mandriva.com>
|
||||
|
33
50-dracut.install
Executable file
33
50-dracut.install
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if [[ -f /etc/kernel/cmdline ]]; then
|
||||
readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
fi
|
||||
|
||||
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
|
||||
readarray -t BOOT_OPTIONS < /proc/cmdline
|
||||
fi
|
||||
|
||||
unset noimageifnotneeded
|
||||
|
||||
for ((i=0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
|
||||
if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
|
||||
noimageifnotneeded="yes"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
ret=0
|
||||
case "$1" in
|
||||
add)
|
||||
dracut ${noimageifnotneeded+--noimageifnotneeded} "$3"/initrd "$2"
|
||||
ret=$?
|
||||
;;
|
||||
remove)
|
||||
rm -f "$3"/initrd
|
||||
ret=$?
|
||||
;;
|
||||
esac
|
||||
exit $ret
|
70
51-dracut-rescue-postinst.sh
Executable file
70
51-dracut-rescue-postinst.sh
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
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 "$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
|
101
51-dracut-rescue.install
Executable file
101
51-dracut-rescue.install
Executable file
@@ -0,0 +1,101 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
export LANG=C
|
||||
|
||||
COMMAND="$1"
|
||||
KERNEL_VERSION="$2"
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
[[ -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
|
||||
|
||||
if [[ -f /etc/kernel/cmdline ]]; then
|
||||
readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
fi
|
||||
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
|
||||
readarray -t BOOT_OPTIONS < /proc/cmdline
|
||||
fi
|
||||
if ! [[ $BOOT_OPTIONS ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOADER_ENTRY="/boot/loader/entries/${MACHINE_ID}-0-rescue.conf"
|
||||
BOOT_DIR="/${MACHINE_ID}/0-rescue"
|
||||
BOOT_DIR_ABS="/boot${BOOT_DIR}"
|
||||
|
||||
ret=0
|
||||
|
||||
case "$COMMAND" in
|
||||
add)
|
||||
for i in "/boot/loader/entries/${MACHINE_ID}-0-rescue.conf"; do
|
||||
[[ -f $i ]] && exit 0
|
||||
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
|
||||
|
||||
[[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS"
|
||||
|
||||
if ! cp "$KERNEL_IMAGE" "$BOOT_DIR_ABS"/linux; then
|
||||
echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/linux'!" >&2
|
||||
fi
|
||||
|
||||
dracut --no-hostonly -a "rescue" "$BOOT_DIR_ABS"/initrd "$2"
|
||||
((ret+=$?))
|
||||
|
||||
{
|
||||
echo "title $PRETTY_NAME - Rescue Image"
|
||||
echo "version $KERNEL_VERSION"
|
||||
echo "machine-id $MACHINE_ID"
|
||||
echo "options ${BOOT_OPTIONS[@]} rd.auto=1"
|
||||
echo "linux $BOOT_DIR/linux"
|
||||
echo "initrd $BOOT_DIR/initrd"
|
||||
} > $LOADER_ENTRY
|
||||
((ret+=$?))
|
||||
;;
|
||||
|
||||
remove)
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*)
|
||||
usage
|
||||
ret=1;;
|
||||
esac
|
||||
|
||||
((ret+=$?))
|
||||
|
||||
exit $ret
|
27
AUTHORS
27
AUTHORS
@@ -6,9 +6,9 @@ Warren Togami <wtogami@redhat.com>
|
||||
Will Woods <wwoods@redhat.com>
|
||||
Jeremy Katz <katzj@redhat.com>
|
||||
David Dillow <dave@thedillows.org>
|
||||
Dave Young <dyoung@redhat.com>
|
||||
Michal Soltys <soltys@ziu.info>
|
||||
Amerigo Wang <amwang@redhat.com>
|
||||
Dave Young <dyoung@redhat.com>
|
||||
Colin Guthrie <colin@mageia.org>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
@@ -17,53 +17,61 @@ Peter Jones <pjones@redhat.com>
|
||||
John Reiser <jreiser@bitwagon.com>
|
||||
Luca Berra <bluca@vodka.it>
|
||||
Daniel Drake <dsd@laptop.org>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
Leho Kraav <leho@kraav.com>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
Chao Wang <chaowang@redhat.com>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
Frederic Crozat <fcrozat@suse.com>
|
||||
Jesse Keating <jkeating@redhat.com>
|
||||
Milan Broz <mbroz@redhat.com>
|
||||
Roberto Sassu <roberto.sassu@polito.it>
|
||||
dyoung@redhat.com <dyoung@redhat.com>
|
||||
Anton Blanchard <anton@samba.org>
|
||||
Bill Nottingham <notting@redhat.com>
|
||||
David Cantrell <dcantrell@redhat.com>
|
||||
Frederic Crozat <fcrozat@suse.com>
|
||||
Jon Ander Hernandez <jonan.h@gmail.com>
|
||||
Juan RP <xtraeme@gmail.com>
|
||||
Lance Albertson <lance@osuosl.org>
|
||||
Marian Ganisin <mganisin@redhat.com>
|
||||
Michael Ploujnikov <plouj@somanetworks.com>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Radek Vykydal <rvykydal@redhat.com>
|
||||
WANG Chao <chaowang@redhat.com>
|
||||
Wim Muskee <wimmuskee@gmail.com>
|
||||
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
||||
Alan Pevec <apevec@redhat.com>
|
||||
Baoquan He <bhe@redhat.com>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Dennis Gilmore <dennis@ausil.us>
|
||||
Frederick Grose <fgrose@sugarlabs.org>
|
||||
Ian Dall <ian@beware.dropbear.id.au>
|
||||
James Buren <ryuo@frugalware.org>
|
||||
Joey Boggs <jboggs@redhat.com>
|
||||
Mike Snitzer <snitzer@redhat.com>
|
||||
Przemysław Rudy <prudy1@o2.pl>
|
||||
Stefan Reimer <it@startux.de>
|
||||
Thomas Lange <lange@informatik.uni-koeln.de>
|
||||
Vivek Goyal <vgoyal@redhat.com>
|
||||
Vladislav Bogdanov <bubble@hoster-ok.com>
|
||||
Wim Muskee <wimmuskee@gmail.com>
|
||||
Alexander Todorov <atodorov@redhat.com>
|
||||
Andy Lutomirski <luto@mit.edu>
|
||||
Anssi Hannula <anssi@mageia.org>
|
||||
Canek Peláez Valdés <caneko@gmail.com>
|
||||
Chris Leech <cleech@redhat.com>
|
||||
Christian Heinz <christian.ch.heinz@gmail.com>
|
||||
Cong Wang <amwang@redhat.com>
|
||||
Dave Jones <davej@redhat.com>
|
||||
Dave Young <dave@redhat.com>
|
||||
Duane Griffin <duaneg@dghda.com>
|
||||
Frederic Crozat <fcrozat@mandriva.com>
|
||||
Frederick Grose <fgrose@gmail.com>
|
||||
Glen Gray <slaine@slaine.org>
|
||||
Hermann Gausterer <git-dracut-2012@mrq1.org>
|
||||
James Laska <jlaska@redhat.com>
|
||||
Jan Stodola <jstodola@redhat.com>
|
||||
Jiri Pirko <jiri@resnulli.us>
|
||||
Joe Lawrence <Joe.Lawrence@stratus.com>
|
||||
Kevin Yung <Kevin.Yung@myob.com>
|
||||
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Lars R. Damerow <lars@pixar.com>
|
||||
Lennert Buytenhek <buytenh@wantstofly.org>
|
||||
Lubomir Rintel <lkundrak@v3.sk>
|
||||
Matt <smoothsailing72@hotmail.com>
|
||||
@@ -71,17 +79,18 @@ Matt Smith <shadowfax@gmx.com>
|
||||
Michal Schmidt <mschmidt@redhat.com>
|
||||
Mike Gorse <mgorse@suse.com>
|
||||
Munehiro Matsuda <haro@kgt.co.jp>
|
||||
Nicolas Chauvet <kwizart@gmail.com>
|
||||
Nikoli <nikoli@lavabit.com>
|
||||
Olivier Blin <dev@blino.org>
|
||||
Paolo Bonzini <pbonzini@redhat.com>
|
||||
Peter Robinson <pbrobinson@fedoraproject.org>
|
||||
Pádraig Brady <P@draigBrady.com>
|
||||
Quentin Armitage <quentin@armitage.org.uk>
|
||||
Radek Vykydal <rvykydal@redhat.com>
|
||||
Robert Buchholz <rbu@goodpoint.de>
|
||||
Sergey Fionov <fionov@gmail.com>
|
||||
Srinivasa T N <seenutn@linux.vnet.ibm.com>
|
||||
Stefan Reimer <it@startux.de>
|
||||
Thilo Bangert <thilo.bangert@gmx.net>
|
||||
Thomas Backlund <tmb@mageia.org>
|
||||
Tomasz Torcz <tomek@pipebreaker.pl>
|
||||
Vadim Kuznetsov <vadimk@gentoo.org>
|
||||
Ville Skyttä <ville.skytta@iki.fi>
|
||||
|
54
Makefile
54
Makefile
@@ -1,5 +1,6 @@
|
||||
VERSION=025
|
||||
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
|
||||
RELEASEDVERSION = -- will be replaced by "make dist" --
|
||||
VERSION = $(shell [ -d .git ] && git describe --abbrev=0 --tags || echo $(RELEASEDVERSION))
|
||||
GITVERSION = $(shell [ -d .git ] && { v=$$(git describe --tags); echo -$${v\#*-}; } )
|
||||
|
||||
-include Makefile.inc
|
||||
|
||||
@@ -11,29 +12,31 @@ sysconfdir ?= ${prefix}/etc
|
||||
bindir ?= ${prefix}/bin
|
||||
mandir ?= ${prefix}/share/man
|
||||
CFLAGS ?= -O2 -g -Wall
|
||||
CFLAGS += -std=gnu99
|
||||
CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64
|
||||
bashcompletiondir ?= ${datadir}/bash-completion/completions
|
||||
|
||||
man1pages = lsinitrd.1
|
||||
|
||||
man5pages = dracut.conf.5
|
||||
|
||||
man7pages = dracut.cmdline.7
|
||||
man7pages = dracut.cmdline.7 \
|
||||
dracut.bootup.7
|
||||
|
||||
man8pages = dracut.8 \
|
||||
dracut-catimages.8 \
|
||||
mkinitrd.8 \
|
||||
modules.d/98systemd/dracut-cmdline.service.8 \
|
||||
modules.d/98systemd/dracut-initqueue.service.8 \
|
||||
modules.d/98systemd/dracut-mount.service.8 \
|
||||
modules.d/98systemd/dracut-pre-mount.service.8 \
|
||||
modules.d/98systemd/dracut-pre-pivot.service.8 \
|
||||
modules.d/98systemd/dracut-pre-trigger.service.8 \
|
||||
modules.d/98systemd/dracut-pre-udev.service.8 \
|
||||
modules.d/98systemd/initrd-switch-root.service.8 \
|
||||
modules.d/98systemd/udevadm-cleanup-db.service.8
|
||||
modules.d/98systemd/dracut-pre-udev.service.8
|
||||
|
||||
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
|
||||
|
||||
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS doc
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
|
||||
|
||||
all: syncheck dracut-version.sh dracut-install
|
||||
|
||||
@@ -91,6 +94,7 @@ install: dracut-version.sh
|
||||
install -m 0755 lsinitrd.sh $(DESTDIR)$(bindir)/lsinitrd
|
||||
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)/dracut.conf.d
|
||||
install -m 0755 dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions.sh
|
||||
install -m 0755 dracut-version.sh $(DESTDIR)$(pkglibdir)/dracut-version.sh
|
||||
ln -fs dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
|
||||
@@ -110,13 +114,33 @@ endif
|
||||
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants; \
|
||||
ln -s ../dracut-shutdown.service \
|
||||
$(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants/dracut-shutdown.service; \
|
||||
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants; \
|
||||
for i in \
|
||||
dracut-cmdline.service \
|
||||
dracut-initqueue.service \
|
||||
dracut-mount.service \
|
||||
dracut-pre-mount.service \
|
||||
dracut-pre-pivot.service \
|
||||
dracut-pre-trigger.service \
|
||||
dracut-pre-udev.service \
|
||||
; do \
|
||||
install -m 0644 modules.d/98systemd/$$i $(DESTDIR)$(systemdsystemunitdir); \
|
||||
ln -s ../$$i \
|
||||
$(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants/$i; \
|
||||
done \
|
||||
fi
|
||||
if [ -f install/dracut-install ]; then \
|
||||
install -m 0755 install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
|
||||
fi
|
||||
mkdir -p $(DESTDIR)${prefix}/lib/kernel/install.d
|
||||
install -m 0755 50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install
|
||||
install -m 0755 51-dracut-rescue.install $(DESTDIR)${prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
mkdir -p $(DESTDIR)${bashcompletiondir}
|
||||
install -m 0644 dracut-bash-completion.sh $(DESTDIR)${bashcompletiondir}/dracut
|
||||
install -m 0644 lsinitrd-bash-completion.sh $(DESTDIR)${bashcompletiondir}/lsinitrd
|
||||
|
||||
dracut-version.sh:
|
||||
@echo "DRACUT_VERSION=$(VERSION)-$(GITVERSION)" > dracut-version.sh
|
||||
@echo "DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh
|
||||
|
||||
clean:
|
||||
$(RM) *~
|
||||
@@ -125,19 +149,19 @@ clean:
|
||||
$(RM) $(manpages:%=%.xml) dracut.xml
|
||||
$(RM) test-*.img
|
||||
$(RM) dracut-*.rpm dracut-*.tar.bz2
|
||||
$(RM) dracut-version.sh
|
||||
$(RM) dracut-install install/dracut-install $(DRACUT_INSTALL_OBJECTS)
|
||||
$(RM) $(manpages) dracut.html
|
||||
$(MAKE) -C test clean
|
||||
|
||||
archive: dracut-$(VERSION)-$(GITVERSION).tar.bz2
|
||||
|
||||
dist: dracut-$(VERSION).tar.bz2
|
||||
|
||||
dracut-$(VERSION).tar.bz2: doc
|
||||
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ > dracut-$(VERSION).tar
|
||||
mkdir -p dracut-$(VERSION)
|
||||
cp $(manpages) dracut.html dracut-$(VERSION)
|
||||
tar -rf dracut-$(VERSION).tar dracut-$(VERSION)/*.[0-9] dracut-$(VERSION)/dracut.html
|
||||
git show $(VERSION):Makefile | sed 's/^RELEASEDVERSION =.*/RELEASEDVERSION = $(VERSION)/' > dracut-$(VERSION)/Makefile
|
||||
tar --owner=root --group=root -rf dracut-$(VERSION).tar dracut-$(VERSION)/*.[0-9] dracut-$(VERSION)/dracut.html dracut-$(VERSION)/Makefile
|
||||
rm -fr dracut-$(VERSION).tar.bz2 dracut-$(VERSION)
|
||||
bzip2 -9 dracut-$(VERSION).tar
|
||||
rm -f dracut-$(VERSION).tar
|
||||
@@ -156,14 +180,14 @@ syncheck:
|
||||
modules.d/99base/init.sh modules.d/*/*.sh; do \
|
||||
[ "$${i##*/}" = "module-setup.sh" ] && continue; \
|
||||
read line < "$$i"; [ "$${line#*bash*}" != "$$line" ] && continue; \
|
||||
dash -n "$$i" ; ret=$$(($$ret+$$?)); \
|
||||
[ $$V ] && echo "dash syntax check: $$i"; dash -n "$$i" ; ret=$$(($$ret+$$?)); \
|
||||
done;exit $$ret
|
||||
@ret=0;for i in *.sh mkinitrd-dracut.sh modules.d/*/*.sh \
|
||||
modules.d/*/module-setup.sh; do \
|
||||
bash -n "$$i" ; ret=$$(($$ret+$$?)); \
|
||||
[ $$V ] && echo "bash syntax check: $$i"; bash -n "$$i" ; ret=$$(($$ret+$$?)); \
|
||||
done;exit $$ret
|
||||
|
||||
check: all syncheck
|
||||
check: all syncheck rpm
|
||||
@[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; }
|
||||
@$(MAKE) -C test check
|
||||
|
||||
|
95
NEWS
95
NEWS
@@ -1,3 +1,98 @@
|
||||
dracut-028
|
||||
==========
|
||||
- full integration of crypto devs in systemd logic
|
||||
- support for bridge over team and vlan tagged team
|
||||
- support multiple bonding interfaces
|
||||
- new kernel command line param "rd.action_on_fail"
|
||||
to control the emergency action
|
||||
- support for bridge over a vlan tagged interface
|
||||
- support for "iso-scan/filename" kernel parameter
|
||||
- lsinitrd got some love and does not use "file" anymore
|
||||
- fixed issue with noexec mounted tmp dirs
|
||||
- FIPS mode fixed
|
||||
- dracut_install got some love
|
||||
- fixed some /usr mounting problems
|
||||
- ifcfg dracut module got some love and fixes
|
||||
- default installed font is now latarcyrheb-sun16
|
||||
- new parameters rd.live.dir and rd.live.squashimg
|
||||
- lvm: add tools for thin provisioning
|
||||
- also install non-hwcap libs
|
||||
- setup correct system time and time zone in initrd
|
||||
- s390: fixed cms setup
|
||||
- add systemd-udevd persistent network interface naming
|
||||
|
||||
Contributions from:
|
||||
Harald Hoyer
|
||||
Kamil Rytarowski
|
||||
WANG Chao
|
||||
Baoquan He
|
||||
Adam Williamson
|
||||
Colin Guthrie
|
||||
Dan Horák
|
||||
Dave Young
|
||||
Dennis Gilmore
|
||||
Dennis Schridde
|
||||
|
||||
dracut-027
|
||||
==========
|
||||
- dracut now has bash-completion
|
||||
- require bash version 4
|
||||
- systemd module now requires systemd >= 199
|
||||
- dracut makes use of native systemd initrd units
|
||||
- added hooks for new-kernel-pkg and kernel-install
|
||||
- hostonly is now default for fedora
|
||||
- comply with the BootLoaderSpec paths
|
||||
http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec
|
||||
- added rescue module
|
||||
- host_fs_types is now a hashmap
|
||||
- new dracut argument "--regenerate-all"
|
||||
- new dracut argument "--noimageifnotneeded"
|
||||
- new man page dracut.bootup
|
||||
- install all host filesystem drivers
|
||||
- use -D_FILE_OFFSET_BITS=64 to build dracut-install
|
||||
|
||||
dracut-026
|
||||
==========
|
||||
- introduce /usr/lib/dracut/dracut.conf.d/ drop-in directory
|
||||
|
||||
/usr/lib/dracut/dracut.conf.d/*.conf can be overwritten by the same
|
||||
filenames in /etc/dracut.conf.d.
|
||||
|
||||
Packages should use /usr/lib/dracut/dracut.conf.d rather than
|
||||
/etc/dracut.conf.d for drop-in configuration files.
|
||||
|
||||
/etc/dracut.conf and /etc/dracut.conf.d belong to the system administrator.
|
||||
|
||||
- uses systemd-198 native initrd units
|
||||
- totally rely on the fstab-generator in systemd mode for block devices
|
||||
- dracut systemd now uses dracut.target rather than basic.target
|
||||
- dracut systemd services optimize themselves away
|
||||
- fixed hostonly parameter generation
|
||||
- turn off curl globbing (fixes IPv6)
|
||||
- modify the udev rules on install and not runtime time
|
||||
- enable initramfs building without kernel modules (fixed regression)
|
||||
- in the initqueue/timeout,
|
||||
reset the main loop counter, as we see new udev events or initqueue/work
|
||||
- fixed udev rule installation
|
||||
|
||||
dracut-025
|
||||
==========
|
||||
- do not strip signed kernel modules
|
||||
- add sosreport script and generate /run/initramfs/sosreport.txt
|
||||
- make short uuid specification for allow-discards work
|
||||
- turn off RateLimit for the systemd journal
|
||||
- fixed MAC address assignment
|
||||
- add systemd checkisomd5 service
|
||||
- splitout drm kernel modules from plymouth module
|
||||
- add 'swapoff' to initramfs to fix shutdown/reboot
|
||||
- add team device support
|
||||
- add pre-shutdown hook
|
||||
- kill all processes in shutdown and report remaining ones
|
||||
- "--device" changed to "--add-device" and "add_device=" added for conf files
|
||||
- add memory usage trace to different hook points
|
||||
- cope with optional field #7 in /proc/self/mountinfo
|
||||
- lots of small bugfixes
|
||||
|
||||
dracut-024
|
||||
==========
|
||||
- new dracut option "--device"
|
||||
|
8
TODO
8
TODO
@@ -7,7 +7,6 @@ Items are ordered in priority.
|
||||
INITRAMFS TODO
|
||||
|
||||
- use info and warn prefix
|
||||
- add sosreport
|
||||
- generate systemd unit dracut-initramfs-restore in /run/systemd dynamically
|
||||
- put "root=" parsing hooks in separate hook dir
|
||||
- call "root=" parsing hooks after getting new rootpath from dhcp
|
||||
@@ -20,18 +19,19 @@ INITRAMFS TODO
|
||||
- disable write-ifcfg https://bugzilla.redhat.com/show_bug.cgi?id=840784
|
||||
- check for /var to be mounted in convertfs https://bugzilla.redhat.com/show_bug.cgi?id=848172
|
||||
- probably fix "--include" https://bugzilla.redhat.com/show_bug.cgi?id=849338
|
||||
- iscsi livecd boot
|
||||
|
||||
GENERATOR TODO
|
||||
|
||||
- remove wait for swap devs, if no "resume=" is given on the kernel command line
|
||||
- add presets (predefined set of modules)
|
||||
- add interpreter/plugin-scripts to be sourced at the beginning or end (can use dracut-functions)
|
||||
- provide "installkernel" and "new-kernel-pkg"
|
||||
- add mechanism for module specific command line options
|
||||
- pkg-config integration, to make it easy for other packages to use us.
|
||||
- add recovery image creator (mkrecovery)
|
||||
- default module specification could use some work
|
||||
- udev rule copying, as mentioned above, is a bit too hard-coded
|
||||
|
||||
- dracut-install parse LD_SHOW_AUXV="" AT_PLATFORM for lib install
|
||||
|
||||
CODE TODO
|
||||
|
||||
- document more functions
|
||||
|
31
configure
vendored
31
configure
vendored
@@ -25,6 +25,7 @@ read_arg() {
|
||||
# return 1 to indicate they should do it instead.
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
while (($# > 0)); do
|
||||
@@ -36,18 +37,42 @@ while (($# > 0)); do
|
||||
--sbindir) read_arg sbindir "$@" || shift;;
|
||||
--mandir) read_arg mandir "$@" || shift;;
|
||||
--disable-documentation) enable_documentation=no;;
|
||||
--program-prefix) read_arg programprefix "$@" || shift;;
|
||||
--exec-prefix) read_arg execprefix "$@" || shift;;
|
||||
--bindir) read_arg bindir "$@" || shift;;
|
||||
--includedir) read_arg includedir "$@" || shift;;
|
||||
--libexecdir) read_arg libexecdir "$@" || shift;;
|
||||
--localstatedir) read_arg localstatedir "$@" || shift;;
|
||||
--sharedstatedir) read_arg sharedstatedir "$@" || shift;;
|
||||
--infodir) read_arg infodir "$@" || shift;;
|
||||
--systemdsystemunitdir) read_arg systemdsystemunitdir "$@" || shift;;
|
||||
--bashcompletiondir) read_arg bashcompletiondir "$@" || shift;;
|
||||
*) echo "Ignoring unknown option '$1'";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
cat > Makefile.inc.tmp <<EOF
|
||||
cat > Makefile.inc.$$ <<EOF
|
||||
prefix ?= ${prefix}
|
||||
libdir ?= ${libdir:-${prefix}/lib}
|
||||
datadir ?= ${datadir:-${prefix}/share}
|
||||
sysconfdir ?= ${sysconfdir:-${prefix}/etc}
|
||||
sbindir ?= ${sbindir:-${prefix}/sbin}
|
||||
mandir ?= ${mandir:-${prefix}/share/man}
|
||||
enable_documentation ?= ${enable_documentation}
|
||||
enable_documentation ?= ${enable_documentation:-yes}
|
||||
bindir ?= ${bindir:-${prefix}/bin}
|
||||
EOF
|
||||
mv Makefile.inc.tmp Makefile.inc
|
||||
|
||||
{
|
||||
[[ $programprefix ]] && echo "programprefix ?= ${programprefix}"
|
||||
[[ $execprefix ]] && echo "execprefix ?= ${execprefix}"
|
||||
[[ $includedir ]] && echo "includedir ?= ${includedir}"
|
||||
[[ $libexecdir ]] && echo "libexecdir ?= ${libexecdir}"
|
||||
[[ $localstatedir ]] && echo "localstatedir ?= ${localstatedir}"
|
||||
[[ $sharedstatedir ]] && echo "sharedstatedir ?= ${sharedstatedir}"
|
||||
[[ $infodir ]] && echo "infodir ?= ${infodir}"
|
||||
[[ $systemdsystemunitdir ]] && echo "systemdsystemunitdir ?= ${systemdsystemunitdir}"
|
||||
[[ $bashcompletiondir ]] && echo "bashcompletiondir ?= ${bashcompletiondir}"
|
||||
} >> Makefile.inc.$$
|
||||
|
||||
mv Makefile.inc.$$ Makefile.inc
|
||||
|
75
dracut-bash-completion.sh
Normal file
75
dracut-bash-completion.sh
Normal file
@@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Copyright 2013 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
__contains_word () {
|
||||
local word=$1; shift
|
||||
for w in $*; do [[ $w = $word ]] && return 0; done
|
||||
return 1
|
||||
}
|
||||
|
||||
_dracut() {
|
||||
local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local -A OPTS=(
|
||||
[STANDALONE]='-f -v -q -l -H -h -M -N
|
||||
--ro-mnt --force --kernel-only --no-kernel --strip --nostrip
|
||||
--hardlink --nohardlink --noprefix --mdadmconf --nomdadmconf
|
||||
--lvmconf --nolvmconf --debug --profile --verbose --quiet
|
||||
--local --hostonly --no-hostonly --fstab --help --bzip2 --lzma
|
||||
--xz --no-compress --gzip --list-modules --show-modules --keep
|
||||
--printsize --regenerate-all --noimageifnotneeded'
|
||||
|
||||
[ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers
|
||||
--omit-drivers --modules --omit --drivers --filesystems --install
|
||||
--fwdir --libdirs --fscks --add-fstab --mount --device --nofscks
|
||||
--kmoddir --conf --confdir --tmpdir --stdlog --compress --prefix
|
||||
--kernel-cmdline --sshkey'
|
||||
)
|
||||
|
||||
if __contains_word "$prev" ${OPTS[ARG]}; then
|
||||
case $prev in
|
||||
--kmoddir|-k|--fwdir|--confdir|--tmpdir)
|
||||
comps=$(compgen -d -- "$cur")
|
||||
compopt -o filenames
|
||||
;;
|
||||
-c|--conf|--sshkey|--add-fstab|--add-device|-I|--install)
|
||||
comps=$(compgen -f -- "$cur")
|
||||
compopt -o filenames
|
||||
;;
|
||||
-a|-m|-o|--add|--modules|--omit)
|
||||
comps=$(dracut --list-modules 2>/dev/null)
|
||||
;;
|
||||
--kver)
|
||||
comps=$(cd /lib/modules; echo [0-9]*)
|
||||
;;
|
||||
*)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ $cur = -* ]]; then
|
||||
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
complete -F _dracut dracut
|
@@ -110,6 +110,14 @@ fi
|
||||
export hookdirs
|
||||
}
|
||||
|
||||
dracut_need_initqueue() {
|
||||
>"$initdir/lib/dracut/need-initqueue"
|
||||
}
|
||||
|
||||
dracut_module_included() {
|
||||
strstr "$mods_to_load $modules_loaded" "$@"
|
||||
}
|
||||
|
||||
# Create all subdirectories for given path without creating the last element.
|
||||
# $1 = path
|
||||
mksubdirs() { [[ -e ${1%/*} ]] || mkdir -m 0755 -p ${1%/*}; }
|
||||
@@ -246,6 +254,7 @@ get_persistent_dev() {
|
||||
[ -z "$_dev" ] && return
|
||||
|
||||
for i in /dev/mapper/* /dev/disk/by-uuid/* /dev/disk/by-id/*; do
|
||||
[[ $i == /dev/mapper/mpath* ]] && continue
|
||||
_tmp=$(udevadm info --query=name --name="$i" 2>/dev/null)
|
||||
if [ "$_tmp" = "$_dev" ]; then
|
||||
echo $i
|
||||
@@ -311,44 +320,79 @@ get_maj_min() {
|
||||
# $ find_block_device /usr
|
||||
# 8:4
|
||||
find_block_device() {
|
||||
local _x _mpt _majmin _dev _fs _maj _min _find_mpt
|
||||
local _majmin _dev _majmin _find_mpt
|
||||
_find_mpt="$1"
|
||||
if [[ $use_fstab != yes ]]; then
|
||||
while read _x; do
|
||||
set -- $_x
|
||||
_majmin="$3"
|
||||
_mpt="$5"
|
||||
[[ $8 = "-" ]] && shift
|
||||
_fs="$8"
|
||||
_dev="$9"
|
||||
[[ $_mpt = $_find_mpt ]] || continue
|
||||
[[ $_fs = nfs ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs3 ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs4 ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = btrfs ]] && {
|
||||
get_maj_min $_dev
|
||||
return 0;
|
||||
}
|
||||
if [[ ${_majmin#0:} = $_majmin ]]; then
|
||||
echo $_majmin
|
||||
return 0 # we have a winner!
|
||||
[[ -d $_find_mpt/. ]]
|
||||
while read _majmin _dev; do
|
||||
if [[ -b $_dev ]]; then
|
||||
if ! [[ $_majmin ]] || [[ $_majmin == 0:* ]]; then
|
||||
read _majmin < <(get_maj_min $_dev)
|
||||
fi
|
||||
if [[ $_majmin ]]; then
|
||||
echo $_majmin
|
||||
else
|
||||
echo $_dev
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
done < /proc/self/mountinfo
|
||||
if [[ $_dev = *:* ]]; then
|
||||
echo $_dev
|
||||
return 0
|
||||
fi
|
||||
done < <(findmnt -e -v -n -o 'MAJ:MIN,SOURCE' "$_find_mpt")
|
||||
fi
|
||||
# fall back to /etc/fstab
|
||||
while read _dev _mpt _fs _x; do
|
||||
[ "${_dev%%#*}" != "$_dev" ] && continue
|
||||
|
||||
if [[ $_mpt = $_find_mpt ]]; then
|
||||
[[ $_fs = nfs ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs3 ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs4 ]] && { echo $_dev; return 0;}
|
||||
[[ $_dev != ${_dev#UUID=} ]] && _dev=/dev/disk/by-uuid/${_dev#UUID=}
|
||||
[[ $_dev != ${_dev#LABEL=} ]] && _dev=/dev/disk/by-label/${_dev#LABEL=}
|
||||
[[ -b $_dev ]] || return 1 # oops, not a block device.
|
||||
get_maj_min "$_dev" && return 0
|
||||
while read _majmin _dev; do
|
||||
if ! [[ $_dev ]]; then
|
||||
_dev="$_majmin"
|
||||
unset _majmin
|
||||
fi
|
||||
done < /etc/fstab
|
||||
if [[ -b $_dev ]]; then
|
||||
[[ $_majmin ]] || read _majmin < <(get_maj_min $_dev)
|
||||
if [[ $_majmin ]]; then
|
||||
echo $_majmin
|
||||
else
|
||||
echo $_dev
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
if [[ $_dev = *:* ]]; then
|
||||
echo $_dev
|
||||
return 0
|
||||
fi
|
||||
done < <(findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' "$_find_mpt")
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# find_mp_fstype <mountpoint>
|
||||
# Echo the filesystem type for a given mountpoint.
|
||||
# /proc/self/mountinfo is taken as the primary source of information
|
||||
# and /etc/fstab is used as a fallback.
|
||||
# No newline is appended!
|
||||
# Example:
|
||||
# $ find_mp_fstype /;echo
|
||||
# ext4
|
||||
find_mp_fstype() {
|
||||
local _fs
|
||||
|
||||
if [[ $use_fstab != yes ]]; then
|
||||
while read _fs; do
|
||||
[[ $_fs ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
echo -n $_fs
|
||||
return 0
|
||||
done < <(findmnt -e -v -n -o 'FSTYPE' "$1")
|
||||
fi
|
||||
|
||||
while read _fs; do
|
||||
[[ $_fs ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
echo -n $_fs
|
||||
return 0
|
||||
done < <(findmnt --fstab -e -v -n -o 'FSTYPE' "$1")
|
||||
|
||||
return 1
|
||||
}
|
||||
@@ -364,105 +408,35 @@ find_block_device() {
|
||||
find_dev_fstype() {
|
||||
local _x _mpt _majmin _dev _fs _maj _min _find_dev
|
||||
_find_dev="$1"
|
||||
strstr "$_find_dev" "/dev" || _find_dev="/dev/block/$_find_dev"
|
||||
while read _x; do
|
||||
set -- $_x
|
||||
_majmin="$3"
|
||||
_mpt="$5"
|
||||
[[ $8 = "-" ]] && shift
|
||||
_fs="$8"
|
||||
_dev="$9"
|
||||
strstr "$_dev" "/dev" || continue
|
||||
[[ $_dev -ef $_find_dev ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
echo -n $_fs;
|
||||
return 0;
|
||||
done < /proc/self/mountinfo
|
||||
|
||||
# fall back to /etc/fstab
|
||||
while read _dev _mpt _fs _x; do
|
||||
[ "${_dev%%#*}" != "$_dev" ] && continue
|
||||
case "$_dev" in
|
||||
LABEL=*)
|
||||
_dev="$(echo $_dev | sed 's,/,\\x2f,g')"
|
||||
_dev="/dev/disk/by-label/${_dev#LABEL=}"
|
||||
;;
|
||||
UUID=*)
|
||||
_dev="/dev/disk/by-uuid/${_dev#UUID=}"
|
||||
;;
|
||||
PARTUUID=*)
|
||||
_dev="/dev/disk/by-partuuid/${_dev#PARTUUID=}"
|
||||
;;
|
||||
esac
|
||||
|
||||
[[ $_dev -ef $_find_dev ]] || continue
|
||||
echo -n $_fs;
|
||||
return 0;
|
||||
done < /etc/fstab
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# find_mp_fstype <mountpoint>
|
||||
# Echo the filesystem type for a given mountpoint.
|
||||
# /proc/self/mountinfo is taken as the primary source of information
|
||||
# and /etc/fstab is used as a fallback.
|
||||
# No newline is appended!
|
||||
# Example:
|
||||
# $ find_mp_fstype /;echo
|
||||
# ext4
|
||||
find_mp_fstype() {
|
||||
local _x _mpt _majmin _dev _fs _maj _min _find_mpt
|
||||
_find_mpt="$1"
|
||||
while read _x; do
|
||||
set -- $_x
|
||||
_majmin="$3"
|
||||
_mpt="$5"
|
||||
[[ $8 = "-" ]] && shift
|
||||
_fs="$8"
|
||||
_dev="$9"
|
||||
[[ $_mpt = $_find_mpt ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
echo -n $_fs;
|
||||
return 0;
|
||||
done < /proc/self/mountinfo
|
||||
|
||||
# fall back to /etc/fstab
|
||||
while read _dev _mpt _fs _x; do
|
||||
[ "${_dev%%#*}" != "$_dev" ] && continue
|
||||
[[ $_mpt = $_find_mpt ]] || continue
|
||||
echo -n $_fs;
|
||||
return 0;
|
||||
done < /etc/fstab
|
||||
|
||||
return 1
|
||||
[[ "$_find_dev" = /dev* ]] || _find_dev="/dev/block/$_find_dev"
|
||||
find_mp_fstype "$_find_dev"
|
||||
}
|
||||
|
||||
# finds the major:minor of the block device backing the root filesystem.
|
||||
find_root_block_device() { find_block_device /; }
|
||||
|
||||
# for_each_host_dev_fs <func>
|
||||
# Execute "<func> <dev> <filesystem>" for every "<dev>|<fs>" pair found
|
||||
# Execute "<func> <dev> <filesystem>" for every "<dev> <fs>" pair found
|
||||
# in ${host_fs_types[@]}
|
||||
for_each_host_dev_fs()
|
||||
{
|
||||
local _func="$1"
|
||||
local _dev
|
||||
local _fs
|
||||
local _ret=1
|
||||
for f in ${host_fs_types[@]}; do
|
||||
OLDIFS="$IFS"
|
||||
IFS="|"
|
||||
set -- $f
|
||||
IFS="$OLDIFS"
|
||||
_dev="$1"
|
||||
[[ -b "$_dev" ]] || continue
|
||||
_fs="$2"
|
||||
$_func $_dev $_fs && _ret=0
|
||||
|
||||
[[ "${!host_fs_types[@]}" ]] || return 0
|
||||
|
||||
for _dev in "${!host_fs_types[@]}"; do
|
||||
$_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
|
||||
done
|
||||
return $_ret
|
||||
}
|
||||
|
||||
host_fs_all()
|
||||
{
|
||||
echo "${host_fs_types[@]}"
|
||||
}
|
||||
|
||||
# Walk all the slave relationships for a given block device.
|
||||
# Stop when our helper function returns success
|
||||
# $1 = function to call on every found block device
|
||||
@@ -508,6 +482,9 @@ for_each_host_dev_and_slaves_all()
|
||||
local _func="$1"
|
||||
local _dev
|
||||
local _ret=1
|
||||
|
||||
[[ "${host_devs[@]}" ]] || return 0
|
||||
|
||||
for _dev in ${host_devs[@]}; do
|
||||
[[ -b "$_dev" ]] || continue
|
||||
if check_block_and_slaves_all $_func $(get_maj_min $_dev); then
|
||||
@@ -521,6 +498,9 @@ for_each_host_dev_and_slaves()
|
||||
{
|
||||
local _func="$1"
|
||||
local _dev
|
||||
|
||||
[[ "${host_devs[@]}" ]] || return 0
|
||||
|
||||
for _dev in ${host_devs[@]}; do
|
||||
[[ -b "$_dev" ]] || continue
|
||||
check_block_and_slaves $_func $(get_maj_min $_dev) && return 0
|
||||
@@ -870,7 +850,7 @@ inst_rule_programs() {
|
||||
_bin=""
|
||||
if [ -x ${udevdir}/$_prog ]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
elif [[ "${_prog/\$\{/}" != "$_prog" ]]; then
|
||||
elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue;
|
||||
@@ -885,7 +865,7 @@ inst_rule_programs() {
|
||||
_bin=""
|
||||
if [ -x ${udevdir}/$_prog ]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
elif [[ "${_prog/\$\{/}" != "$_prog" ]]; then
|
||||
elif [[ "${_prog/\$env\{/}" == "$_prog" ]] && [[ "${_prog}" != "/sbin/initqueue" ]]; then
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue;
|
||||
@@ -900,7 +880,7 @@ inst_rule_programs() {
|
||||
_bin=""
|
||||
if [ -x ${udevdir}/$_prog ]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
elif [[ "${_prog/\$\{/}" != "$_prog" ]]; then
|
||||
elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue;
|
||||
@@ -932,6 +912,12 @@ inst_rule_group_owner() {
|
||||
fi
|
||||
}
|
||||
|
||||
inst_rule_initqueue() {
|
||||
if grep -q -F initqueue "$1"; then
|
||||
dracut_need_initqueue
|
||||
fi
|
||||
}
|
||||
|
||||
# udev rules always get installed in the same place, so
|
||||
# create a function to install them to make life simpler.
|
||||
inst_rules() {
|
||||
@@ -946,6 +932,7 @@ inst_rules() {
|
||||
_found="$r/$_rule"
|
||||
inst_rule_programs "$_found"
|
||||
inst_rule_group_owner "$_found"
|
||||
inst_rule_initqueue "$_found"
|
||||
inst_simple "$_found"
|
||||
fi
|
||||
done
|
||||
@@ -955,6 +942,7 @@ inst_rules() {
|
||||
_found="${r}$_rule"
|
||||
inst_rule_programs "$_found"
|
||||
inst_rule_group_owner "$_found"
|
||||
inst_rule_initqueue "$_found"
|
||||
inst_simple "$_found" "$_target/${_found##*/}"
|
||||
fi
|
||||
done
|
||||
@@ -962,6 +950,33 @@ inst_rules() {
|
||||
done
|
||||
}
|
||||
|
||||
prepare_udev_rules() {
|
||||
[ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
|
||||
|
||||
for f in "$@"; do
|
||||
f="${initdir}/etc/udev/rules.d/$f"
|
||||
[ -e "$f" ] || continue
|
||||
while read line; do
|
||||
if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then
|
||||
if [ $UDEVVERSION -ge 174 ]; then
|
||||
printf '%sIMPORT{builtin}="path_id"\n' "${line%%IMPORT PATH_ID}"
|
||||
else
|
||||
printf '%sIMPORT{program}="path_id %%p"\n' "${line%%IMPORT PATH_ID}"
|
||||
fi
|
||||
elif [ "${line%%IMPORT BLKID}" != "$line" ]; then
|
||||
if [ $UDEVVERSION -ge 176 ]; then
|
||||
printf '%sIMPORT{builtin}="blkid"\n' "${line%%IMPORT BLKID}"
|
||||
else
|
||||
printf '%sIMPORT{program}="/sbin/blkid -o udev -p $tempnode"\n' "${line%%IMPORT BLKID}"
|
||||
fi
|
||||
else
|
||||
echo "$line"
|
||||
fi
|
||||
done < "${f}" > "${f}.new"
|
||||
mv "${f}.new" "$f"
|
||||
done
|
||||
}
|
||||
|
||||
# install function specialized for hooks
|
||||
# $1 = type of hook, $2 = hook priority (lower runs first), $3 = hook
|
||||
# All hooks should be POSIX/SuS compliant, they will be sourced by init.
|
||||
@@ -1499,13 +1514,16 @@ module_is_host_only() (
|
||||
|
||||
find_kernel_modules_by_path () (
|
||||
local _OLDIFS
|
||||
_OLDIFS=$IFS
|
||||
IFS=:
|
||||
while read a rest; do
|
||||
[[ $a = kernel*/$1/* ]] || continue
|
||||
echo $srcmods/$a
|
||||
done < $srcmods/modules.dep
|
||||
IFS=$_OLDIFS
|
||||
|
||||
[[ -f $srcmods/modules.dep ]] || return 0
|
||||
|
||||
_OLDIFS=$IFS
|
||||
IFS=:
|
||||
while read a rest; do
|
||||
[[ $a = */$1/* ]] || continue
|
||||
echo $srcmods/$a
|
||||
done < $srcmods/modules.dep
|
||||
IFS=$_OLDIFS
|
||||
return 0
|
||||
)
|
||||
|
||||
@@ -1591,7 +1609,7 @@ instmods() {
|
||||
while read _mod; do
|
||||
inst1mod "${_mod%.ko*}" || {
|
||||
if [[ "$_check" == "yes" ]]; then
|
||||
[[ "$_silent" == "no" ]] && dfatal "Failed to install $_mod"
|
||||
[[ "$_silent" == "no" ]] && dfatal "Failed to install module $_mod"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -1600,7 +1618,7 @@ instmods() {
|
||||
while (($# > 0)); do # filenames as arguments
|
||||
inst1mod ${1%.ko*} || {
|
||||
if [[ "$_check" == "yes" ]]; then
|
||||
[[ "$_silent" == "no" ]] && dfatal "Failed to install $1"
|
||||
[[ "$_silent" == "no" ]] && dfatal "Failed to install module $1"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
@@ -1,17 +1,28 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
set -e
|
||||
|
||||
KERNEL_VERSION="$(uname -r)"
|
||||
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
|
||||
IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
|
||||
fi
|
||||
[[ -f $IMG ]] || IMG="/boot/initramfs-${KERNEL_VERSION}.img"
|
||||
|
||||
cd /run/initramfs
|
||||
IMG="/boot/initramfs-$(uname -r).img"
|
||||
|
||||
[ -f .need_shutdown -a -f "$IMG" ] || exit 1
|
||||
if zcat "$IMG" | cpio -id >/dev/null 2>&1; then
|
||||
if zcat "$IMG" | cpio -id --quiet >/dev/null; then
|
||||
rm .need_shutdown
|
||||
elif xzcat "$IMG" | cpio -id >/dev/null 2>&1; then
|
||||
elif xzcat "$IMG" | cpio -id --quiet >/dev/null; then
|
||||
rm .need_shutdown
|
||||
else
|
||||
# something failed, so we clean up
|
||||
echo "Unpacking of $IMG to /run/initramfs failed" >&2
|
||||
rm -f /run/initramfs/shutdown
|
||||
exit 1
|
||||
fi
|
||||
|
37
dracut.8.asc
37
dracut.8.asc
@@ -75,12 +75,12 @@ version is:
|
||||
----
|
||||
|
||||
If you want to create lighter, smaller initramfs images, you may want to specify
|
||||
the --host-only or -H option. Using this option, the resulting image will
|
||||
the --hostonly or -H option. Using this option, the resulting image will
|
||||
contain only those dracut modules, kernel modules and filesystems, which are
|
||||
needed to boot this specific machine. This has the drawback, that you can't put
|
||||
the disk on another controller or machine, and that you can't switch to another
|
||||
root filesystem, without recreating the initramfs image. The usage of the
|
||||
--host-only option is only for experts and you will have to keep the broken
|
||||
--hostonly option is only for experts and you will have to keep the broken
|
||||
pieces. At least keep a copy of a general purpose image (and corresponding
|
||||
kernel) as a fallback to rescue your system.
|
||||
|
||||
@@ -376,7 +376,7 @@ will not be able to boot. Equivalent to "--compress=bzip2"
|
||||
[WARNING]
|
||||
====
|
||||
Make sure your kernel has lzma decompression support compiled in, otherwise you
|
||||
will not be able to boot. Equivalent to "--compress=lzma -9"
|
||||
will not be able to boot. Equivalent to "lzma --compress=lzma -9"
|
||||
====
|
||||
|
||||
**--xz**::
|
||||
@@ -385,8 +385,7 @@ will not be able to boot. Equivalent to "--compress=lzma -9"
|
||||
[WARNING]
|
||||
====
|
||||
Make sure your kernel has xz decompression support compiled in, otherwise you
|
||||
will not be able to boot. Equivalent to "--compress=xz --check=crc32
|
||||
--lzma2=dict=1MiB"
|
||||
will not be able to boot. Equivalent to "lzma --compress=xz --check=crc32 --lzma2=dict=1MiB"
|
||||
====
|
||||
|
||||
**--compress** _<compressor>_::
|
||||
@@ -409,6 +408,31 @@ will not be able to boot. Equivalent to "--compress=xz --check=crc32
|
||||
**--keep**::
|
||||
Keep the initramfs temporary directory for debugging purposes.
|
||||
|
||||
**--printsize**::
|
||||
Print out the module install size
|
||||
|
||||
**--profile**:
|
||||
Output profile information of the build process
|
||||
|
||||
**--ro-mnt**:
|
||||
Mount / and /usr read-only by default.
|
||||
|
||||
**-L, --stdlog** _<level>_::
|
||||
[0-6] Specify logging level (to standard error)
|
||||
----
|
||||
0 - suppress any messages
|
||||
1 - only fatal errors
|
||||
2 - all errors
|
||||
3 - warnings
|
||||
4 - info
|
||||
5 - debug info (here starts lots of output)
|
||||
6 - trace info (and even more)
|
||||
----
|
||||
|
||||
**--regenerate-all**::
|
||||
Regenerate all initramfs images at the default location with the kernel versions found on the system.
|
||||
Additional parameters are passed through.
|
||||
|
||||
FILES
|
||||
-----
|
||||
_/var/log/dracut.log_::
|
||||
@@ -424,6 +448,9 @@ _/etc/dracut.conf_::
|
||||
_/etc/dracut.conf.d/*.conf_::
|
||||
see dracut.conf5
|
||||
|
||||
_/usr/lib/dracut/dracut.conf.d/*.conf_::
|
||||
see dracut.conf5
|
||||
|
||||
Configuration in the initramfs
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
_/etc/conf.d/_::
|
||||
|
29
dracut.asc
29
dracut.asc
@@ -120,6 +120,9 @@ final cleanup tasks. On an initramfs, the initial root file system cannot be
|
||||
rotated away. Instead, it is simply emptied and the final root file system
|
||||
mounted over the top.
|
||||
|
||||
If the systemd module is used in the initramfs, the ordering of the services
|
||||
started looks like <<dracutbootup7>>.
|
||||
|
||||
== Dracut on shutdown
|
||||
|
||||
On a systemd driven system, the dracut initramfs is also used for the shutdown procedure.
|
||||
@@ -531,19 +534,19 @@ all files in _/etc/dracut.conf.d/*.conf_
|
||||
As well as the information from <<all-bug-reports>> include the following
|
||||
information:
|
||||
|
||||
* Include physical volume information by running the command:
|
||||
* Include physical volume information by running the command:
|
||||
+
|
||||
----
|
||||
# lvm pvdisplay
|
||||
----
|
||||
+
|
||||
* Include volume group information by running the command:
|
||||
* Include volume group information by running the command:
|
||||
+
|
||||
----
|
||||
# lvm vgdisplay
|
||||
----
|
||||
+
|
||||
* Include logical volume information by running the command:
|
||||
* Include logical volume information by running the command:
|
||||
+
|
||||
----
|
||||
# lvm lvdisplay
|
||||
@@ -554,7 +557,7 @@ information:
|
||||
As well as the information from <<all-bug-reports>>, include the following
|
||||
information:
|
||||
|
||||
* If using software RAID disk partitions, please include the output of
|
||||
* If using software RAID disk partitions, please include the output of
|
||||
+
|
||||
----
|
||||
# cat /proc/mdstat
|
||||
@@ -659,7 +662,7 @@ title Fedora (2.6.29.5-191.fc11.x86_64)
|
||||
No root device found
|
||||
Dropping to debug shell.
|
||||
|
||||
#
|
||||
#
|
||||
----
|
||||
+
|
||||
. Use this shell prompt to gather the information requested above (see <<all-bug-reports>>).
|
||||
@@ -679,7 +682,7 @@ The exact method for locating and preparing will vary. However, to continue with
|
||||
a successful boot, the objective is to locate your root volume and create a
|
||||
symlink _/dev/root_ which points to the file system. For example, the following
|
||||
example demonstrates accessing and booting a root volume that is an encrypted
|
||||
LVM Logical volume.
|
||||
LVM Logical volume.
|
||||
|
||||
. Inspect your partitions using parted
|
||||
+
|
||||
@@ -695,7 +698,7 @@ Number Start End Size Type File system Flags
|
||||
----
|
||||
+
|
||||
. You recall that your root volume was a LVM logical volume. Scan and activate
|
||||
any logical volumes.
|
||||
any logical volumes.
|
||||
+
|
||||
----
|
||||
# lvm vgscan
|
||||
@@ -721,7 +724,7 @@ Installation Guide, you unlock your encrypted root volume.
|
||||
# UUID=$(cryptsetup luksUUID /dev/mapper/linux-root)
|
||||
# cryptsetup luksOpen /dev/mapper/linux-root luks-$UUID
|
||||
Enter passphrase for /dev/mapper/linux-root:
|
||||
Key slot 0 unlocked.
|
||||
Key slot 0 unlocked.
|
||||
----
|
||||
+
|
||||
. Next, make a symbolic link to the unlocked root volume
|
||||
@@ -780,7 +783,7 @@ processes, and switches to the real root device for further booting. dracut
|
||||
modules can insert custom script at various points, to control the boot process.
|
||||
These hooks are plain directories containing shell scripts ending with ".sh",
|
||||
which are sourced by init.
|
||||
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
|
||||
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
|
||||
|
||||
|
||||
|
||||
@@ -829,7 +832,7 @@ udevadm.
|
||||
=== Trigger Udev
|
||||
|
||||
udev is triggered by calling udevadm trigger, which sends add events for all
|
||||
devices and subsystems.
|
||||
devices and subsystems.
|
||||
|
||||
|
||||
|
||||
@@ -909,7 +912,6 @@ still running from the initramfs should not have any open file descriptors left.
|
||||
|
||||
== Network Infrastructure
|
||||
|
||||
|
||||
FIXME
|
||||
|
||||
|
||||
@@ -1028,13 +1030,11 @@ instmods
|
||||
|
||||
=== Creation Functions
|
||||
|
||||
|
||||
FIXME
|
||||
|
||||
|
||||
=== Initramfs Functions
|
||||
|
||||
|
||||
FIXME
|
||||
|
||||
|
||||
@@ -1042,6 +1042,9 @@ FIXME
|
||||
|
||||
FIXME
|
||||
|
||||
:leveloffset: 1
|
||||
[[dracutbootup7]]
|
||||
include::dracut.bootup.7.asc[]
|
||||
|
||||
:leveloffset: 1
|
||||
[[dracut8]]
|
||||
|
122
dracut.bootup.7.asc
Normal file
122
dracut.bootup.7.asc
Normal file
@@ -0,0 +1,122 @@
|
||||
DRACUT.BOOTUP(7)
|
||||
================
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
|
||||
NAME
|
||||
----
|
||||
dracut.bootup - boot ordering in the initramfs
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
This flow chart illustrates the ordering of the services, if systemd is used in the dracut initramfs.
|
||||
----
|
||||
|
||||
systemd-journal.socket
|
||||
|
|
||||
v
|
||||
dracut-cmdline.service
|
||||
|
|
||||
v
|
||||
dracut-pre-udev.service
|
||||
|
|
||||
v
|
||||
systemd-udevd.service
|
||||
|
|
||||
v
|
||||
local-fs-pre.target dracut-pre-trigger.service
|
||||
| |
|
||||
v v
|
||||
(various mounts) (various swap systemd-udev-trigger.service
|
||||
| devices...) | (various low-level (various low-level
|
||||
| | | services: seed, API VFS mounts:
|
||||
v v v tmpfiles, random mqueue, configfs,
|
||||
local-fs.target swap.target dracut-initqueue.service sysctl, ...) debugfs, ...)
|
||||
| | | | |
|
||||
\_______________|____________________ | ___________________|____________________/
|
||||
\|/
|
||||
v
|
||||
sysinit.target
|
||||
|
|
||||
_________________/|\___________________
|
||||
/ | \
|
||||
| | |
|
||||
v | v
|
||||
(various | rescue.service
|
||||
sockets...) | |
|
||||
| | v
|
||||
v | rescue.target
|
||||
sockets.target |
|
||||
| |
|
||||
\_________________ | emergency.service
|
||||
\| |
|
||||
v v
|
||||
basic.target emergency.target
|
||||
|
|
||||
______________________/|
|
||||
/ |
|
||||
| v
|
||||
| dracut-pre-mount.service
|
||||
| |
|
||||
| v
|
||||
| sysroot.mount
|
||||
| |
|
||||
| v
|
||||
| initrd-root-fs.target
|
||||
(custom initrd services) |
|
||||
| v
|
||||
| dracut-mount.service
|
||||
| |
|
||||
| v
|
||||
| initrd-parse-etc.service
|
||||
| |
|
||||
| v
|
||||
| (sysroot-usr.mount and
|
||||
| various mounts marked
|
||||
| with fstab option
|
||||
| x-initrd.mount)
|
||||
| |
|
||||
| v
|
||||
| initrd-fs.target
|
||||
\______________________ |
|
||||
\|
|
||||
v
|
||||
initrd.target
|
||||
|
|
||||
v
|
||||
dracut-pre-pivot.service
|
||||
|
|
||||
v
|
||||
initrd-cleanup.service
|
||||
isolates to
|
||||
initrd-switch-root.target
|
||||
|
|
||||
v
|
||||
______________________/|
|
||||
/ |
|
||||
| initrd-udevadm-cleanup-db.service
|
||||
| |
|
||||
(custom initrd services) |
|
||||
| |
|
||||
\______________________ |
|
||||
\|
|
||||
v
|
||||
initrd-switch-root.target
|
||||
|
|
||||
v
|
||||
initrd-switch-root.service
|
||||
|
|
||||
v
|
||||
switch-root
|
||||
----
|
||||
|
||||
|
||||
AUTHOR
|
||||
------
|
||||
Harald Hoyer
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
*dracut*(8) *bootup*(7)
|
@@ -121,6 +121,10 @@ Misc
|
||||
specify the controlling terminal for the console.
|
||||
This is useful, if you have multiple "console=" arguments.
|
||||
|
||||
**rd.action_on_fail=**_{shell|continue}_::
|
||||
Specify the action after failure. By default it's emergency_shell.
|
||||
'continue' means: ignore the current failure and go ahead.
|
||||
|
||||
[[dracutkerneldebug]]
|
||||
Debug
|
||||
~~~~~
|
||||
@@ -144,8 +148,12 @@ It should be attached to any report about dracut problems.
|
||||
If "quiet" is set, it also logs to the console.
|
||||
|
||||
**rd.memdebug=[0-3]**::
|
||||
print memory usage debug info, set the verbose level from 1 to 3
|
||||
print nothing when set rd.memdebug=0
|
||||
Print memory usage info at various points, set the verbose level from 0 to 3
|
||||
Higher level means more debugging output:
|
||||
0 - no output
|
||||
1 - partial /proc/meminfo
|
||||
2 - /proc/meminfo
|
||||
3 - /proc/meminfo + /proc/slabinfo
|
||||
|
||||
**rd.break**::
|
||||
drop to a shell at the end
|
||||
@@ -600,7 +608,7 @@ ZNET
|
||||
+
|
||||
----
|
||||
rd.znet=qeth,0.0.0600,0.0.0601,0.0.0602,layer2=1,portname=foo
|
||||
rd.znet=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar
|
||||
rd.znet=ctc,0.0.0600,0.0.0601,protocol=bar
|
||||
----
|
||||
|
||||
Plymouth Boot Splash
|
||||
|
10
dracut.conf
10
dracut.conf
@@ -1,11 +1,11 @@
|
||||
# PUT YOUR CONFIG HERE OR IN separate files named *.conf
|
||||
# in /etc/dracut.conf.d
|
||||
# /etc/dracut.conf.d/*.conf will override the settings in here
|
||||
# SEE man dracut.conf(5)
|
||||
|
||||
# Sample dracut config file
|
||||
|
||||
logfile=/var/log/dracut.log
|
||||
fileloglvl=6
|
||||
#logfile=/var/log/dracut.log
|
||||
#fileloglvl=6
|
||||
|
||||
# Exact list of dracut modules to use. Modules not listed here are not going
|
||||
# to be included. If you only want to add some optional modules use
|
||||
@@ -29,10 +29,10 @@ fileloglvl=6
|
||||
#
|
||||
|
||||
# install local /etc/mdadm.conf
|
||||
mdadmconf="yes"
|
||||
#mdadmconf="no"
|
||||
|
||||
# install local /etc/lvm/lvm.conf
|
||||
lvmconf="yes"
|
||||
#lvmconf="no"
|
||||
|
||||
# A list of fsck tools to install. If it's not specified, module's hardcoded
|
||||
# default is used, currently: "umount mount /sbin/fsck* xfs_db xfs_check
|
||||
|
@@ -10,17 +10,24 @@ dracut.conf - configuration file(s) for dracut
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_
|
||||
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_ _/usr/lib/dracut/dracut.conf.d/*.conf_
|
||||
|
||||
Description
|
||||
-----------
|
||||
_dracut.conf_ is loaded during the initialisation phase of dracut. Command line
|
||||
parameter will overwrite any values set here. _dracut.conf.d/*.conf_ files are
|
||||
read in alphanumerical order and will overwrite parameters set in
|
||||
parameter will overwrite any values set here.
|
||||
|
||||
_*.conf_ files are read from /usr/lib/dracut/dracut.conf.d and /etc/dracut.conf.d.
|
||||
Files with the same name in /etc/dracut.conf.d will replace files in /usr/lib/dracut/dracut.conf.d.
|
||||
The files are then read in alphanumerical order and will overwrite parameters set in
|
||||
_/etc/dracut.conf_. Each line specifies an attribute and a value. A '#'
|
||||
indicates the beginning of a comment; following characters, up to the end of the
|
||||
line are not interpreted.
|
||||
|
||||
dracut command line options will overwrite any values set here.
|
||||
|
||||
Configuration files must have the extension .conf; other extensions are ignored.
|
||||
|
||||
*dracutmodules+=*" __<dracut modules>__ "::
|
||||
Specify a space-separated list of dracut modules to call when building the
|
||||
initramfs. Modules are located in _/usr/lib/dracut/modules.d_.
|
||||
@@ -44,10 +51,6 @@ line are not interpreted.
|
||||
Specify a space-separated list of kernel modules not to add to the
|
||||
initramfs. The kernel modules have to be specified without the ".ko" suffix.
|
||||
|
||||
*install_items+=*" __<kernel modules>__ "::
|
||||
Specify a space-separated list of files, which are added to the initramfs
|
||||
image.
|
||||
|
||||
*filesystems+=*" __<filesystem names>__ "::
|
||||
Specify a space-separated list of kernel filesystem modules to exclusively
|
||||
include in the generic initramfs.
|
||||
@@ -127,13 +130,13 @@ If chrooted to another root other than the real root device, use --fstab and pro
|
||||
Path to log file.
|
||||
|
||||
*show_modules=*"__{yes|no}__"::
|
||||
Print included module's name to standard output during build.
|
||||
Print the name of the included modules to standard output during build.
|
||||
|
||||
Files
|
||||
-----
|
||||
_/etc/dracut.conf_::
|
||||
Old configuration file. You better use your own file in
|
||||
_/etc/dracut/conf.d/_.
|
||||
_/etc/dracut.conf.d/_.
|
||||
|
||||
_/etc/dracut.conf.d/_::
|
||||
Any _/etc/dracut.conf.d/*.conf_ file can overwrite the values in
|
||||
|
@@ -2,14 +2,16 @@
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
|
||||
omit_drivers+=" .*/fs/ocfs/.* i2o_scsi"
|
||||
omit_drivers+=' .*/fs/ocfs/.* i2o_scsi'
|
||||
stdloglvl=3
|
||||
logfile=/var/log/dracut.log
|
||||
fileloglvl=6
|
||||
install_items+=" vi /etc/virc ps grep cat rm "
|
||||
prefix="/"
|
||||
systemdutildir=/usr/lib/systemd
|
||||
systemdsystemunitdir=/usr/lib/systemd/system
|
||||
systemdsystemconfdir=/etc/systemd/system
|
||||
udevdir=/usr/lib/udev
|
||||
add_dracutmodules+=" systemd "
|
||||
realinitpath="/usr/lib/systemd/systemd"
|
||||
kernel_cmdline+=" rd.auto=1 "
|
||||
|
||||
hostonly="yes"
|
||||
dracut_rescue_image="yes"
|
||||
|
262
dracut.sh
262
dracut.sh
@@ -7,7 +7,7 @@
|
||||
# of the various mkinitrd implementations out there
|
||||
#
|
||||
|
||||
# Copyright 2005-2010 Red Hat, Inc. All rights reserved.
|
||||
# Copyright 2005-2013 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -69,33 +69,35 @@ Creates initial ramdisk images for preloading modules
|
||||
|
||||
--kver [VERSION] Set kernel version to [VERSION].
|
||||
-f, --force Overwrite existing initramfs file.
|
||||
-a, --add [LIST] Add a space-separated list of dracut modules.
|
||||
-m, --modules [LIST] Specify a space-separated list of dracut modules to
|
||||
call when building the initramfs. Modules are located
|
||||
in /usr/lib/dracut/modules.d.
|
||||
-o, --omit [LIST] Omit a space-separated list of dracut modules.
|
||||
-a, --add [LIST] Add a space-separated list of dracut modules.
|
||||
--force-add [LIST] Force to add a space-separated list of dracut modules
|
||||
to the default set of modules, when -H is specified.
|
||||
-d, --drivers [LIST] Specify a space-separated list of kernel modules to
|
||||
exclusively include in the initramfs.
|
||||
--add-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules to add to the initramfs.
|
||||
exclusively include in the initramfs.
|
||||
--add-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules to add to the initramfs.
|
||||
--omit-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules not to add to the initramfs.
|
||||
modules not to add to the initramfs.
|
||||
--filesystems [LIST] Specify a space-separated list of kernel filesystem
|
||||
modules to exclusively include in the generic
|
||||
initramfs.
|
||||
modules to exclusively include in the generic
|
||||
initramfs.
|
||||
-k, --kmoddir [DIR] Specify the directory, where to look for kernel
|
||||
modules
|
||||
modules
|
||||
--fwdir [DIR] Specify additional directories, where to look for
|
||||
firmwares, separated by :
|
||||
firmwares, separated by :
|
||||
--kernel-only Only install kernel drivers and firmware files
|
||||
--no-kernel Do not install kernel drivers and firmware files
|
||||
--kernel-cmdline [PARAMETERS] Specify default kernel command line parameters
|
||||
--strip Strip binaries in the initramfs (default)
|
||||
--strip Strip binaries in the initramfs
|
||||
--nostrip Do not strip binaries in the initramfs
|
||||
--hardlink Hardlink files in the initramfs (default)
|
||||
--hardlink Hardlink files in the initramfs
|
||||
--nohardlink Do not hardlink files in the initramfs
|
||||
--prefix [DIR] Prefix initramfs files with [DIR]
|
||||
--noprefix Do not prefix initramfs files (default)
|
||||
--noprefix Do not prefix initramfs files
|
||||
--mdadmconf Include local /etc/mdadm.conf
|
||||
--nomdadmconf Do not include local /etc/mdadm.conf
|
||||
--lvmconf Include local /etc/lvm/lvm.conf
|
||||
@@ -111,11 +113,11 @@ Creates initial ramdisk images for preloading modules
|
||||
1 - only fatal errors
|
||||
2 - all errors
|
||||
3 - warnings
|
||||
4 - info (default)
|
||||
4 - info
|
||||
5 - debug info (here starts lots of output)
|
||||
6 - trace info (and even more)
|
||||
-v, --verbose Increase verbosity level (default is info(4))
|
||||
-q, --quiet Decrease verbosity level (default is info(4))
|
||||
-v, --verbose Increase verbosity level
|
||||
-q, --quiet Decrease verbosity level
|
||||
-c, --conf [FILE] Specify configuration file to use.
|
||||
Default: /etc/dracut.conf
|
||||
--confdir [DIR] Specify configuration directory to use *.conf files
|
||||
@@ -235,6 +237,30 @@ read_arg() {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
dropindirs_sort()
|
||||
{
|
||||
suffix=$1; shift
|
||||
args=("$@")
|
||||
files=$(
|
||||
while (( $# > 0 )); do
|
||||
for i in ${1}/*${suffix}; do
|
||||
[[ -f $i ]] && echo ${i##*/}
|
||||
done
|
||||
shift
|
||||
done | sort -Vu
|
||||
)
|
||||
|
||||
for f in $files; do
|
||||
for d in "${args[@]}"; do
|
||||
if [[ -f "$d/$f" ]]; then
|
||||
echo "$d/$f"
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
verbosity_mod_l=0
|
||||
unset kernel
|
||||
unset outfile
|
||||
@@ -293,7 +319,9 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
|
||||
--long quiet \
|
||||
--long local \
|
||||
--long hostonly \
|
||||
--long host-only \
|
||||
--long no-hostonly \
|
||||
--long no-host-only \
|
||||
--long fstab \
|
||||
--long help \
|
||||
--long bzip2 \
|
||||
@@ -305,6 +333,8 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
|
||||
--long show-modules \
|
||||
--long keep \
|
||||
--long printsize \
|
||||
--long regenerate-all \
|
||||
--long noimageifnotneeded \
|
||||
-- "$@")
|
||||
|
||||
if (( $? != 0 )); then
|
||||
@@ -365,8 +395,10 @@ while :; do
|
||||
[[ -f "$(readlink -f ${0%/*})/dracut-functions.sh" ]] \
|
||||
&& dracutbasedir="$(readlink -f ${0%/*})"
|
||||
;;
|
||||
-H|--hostonly) hostonly_l="yes" ;;
|
||||
-N|--no-hostonly) hostonly_l="no" ;;
|
||||
-H|--hostonly|--host-only)
|
||||
hostonly_l="yes" ;;
|
||||
-N|--no-hostonly|--no-host-only)
|
||||
hostonly_l="no" ;;
|
||||
--fstab) use_fstab_l="yes" ;;
|
||||
-h|--help) long_usage; exit 1 ;;
|
||||
-i|--include) push include_src "$2"
|
||||
@@ -382,6 +414,8 @@ while :; do
|
||||
;;
|
||||
--keep) keep="yes";;
|
||||
--printsize) printsize="yes";;
|
||||
--regenerate-all) regenerate_all="yes";;
|
||||
--noimageifnotneeded) noimageifnotneeded="yes";;
|
||||
|
||||
--) shift; break;;
|
||||
|
||||
@@ -413,12 +447,45 @@ while (($# > 0)); do
|
||||
shift
|
||||
done
|
||||
|
||||
if [[ $regenerate_all == "yes" ]]; then
|
||||
ret=0
|
||||
if [[ $kernel ]]; then
|
||||
echo "--regenerate-all cannot be called with a kernel version" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $outfile ]]; then
|
||||
echo "--regenerate-all cannot be called with a image file" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
((len=${#dracut_args[@]}))
|
||||
for ((i=0; i < len; i++)); do
|
||||
[[ ${dracut_args[$i]} == "--regenerate-all" ]] && \
|
||||
unset dracut_args[$i]
|
||||
done
|
||||
|
||||
cd /lib/modules
|
||||
for i in *; do
|
||||
[[ -f $i/modules.builtin ]] || continue
|
||||
dracut --kver=$i "${dracut_args[@]}"
|
||||
((ret+=$?))
|
||||
done
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
if ! [[ $kernel ]]; then
|
||||
kernel=$(uname -r)
|
||||
fi
|
||||
|
||||
if ! [[ $outfile ]]; then
|
||||
outfile="/boot/initramfs-$kernel.img"
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
|
||||
outfile="/boot/${MACHINE_ID}/$kernel/initrd"
|
||||
else
|
||||
outfile="/boot/initramfs-$kernel.img"
|
||||
fi
|
||||
fi
|
||||
|
||||
for i in /usr/sbin /sbin /usr/bin /bin; do
|
||||
@@ -465,11 +532,9 @@ fi
|
||||
[[ -f $conffile ]] && . "$conffile"
|
||||
|
||||
# source our config dir
|
||||
if [[ $confdir && -d $confdir ]]; then
|
||||
for f in "$confdir"/*.conf; do
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
fi
|
||||
for f in $(dropindirs_sort ".conf" "$confdir" "$dracutbasedir/dracut.conf.d"); do
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
|
||||
# these optins add to the stuff in the config file
|
||||
if (( ${#add_dracutmodules_l[@]} )); then
|
||||
@@ -595,6 +660,11 @@ readonly initdir=$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)
|
||||
exit 1
|
||||
}
|
||||
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'ret=$?;[[ $outfile ]] && [[ -f $outfile.$$ ]] && rm -f "$outfile.$$";[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf "$initdir";exit $ret; };' EXIT
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'exit 1;' SIGINT
|
||||
|
||||
export DRACUT_KERNEL_LAZY="1"
|
||||
export DRACUT_RESOLVE_LAZY="1"
|
||||
|
||||
@@ -689,10 +759,11 @@ esac
|
||||
|
||||
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
|
||||
|
||||
[[ -f $srcmods/modules.dep ]] || {
|
||||
dfatal "$srcmods/modules.dep is missing. Did you run depmod?"
|
||||
exit 1
|
||||
}
|
||||
if [[ -d $srcmods ]]; then
|
||||
[[ -f $srcmods/modules.dep ]] || {
|
||||
dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
|
||||
}
|
||||
fi
|
||||
|
||||
if [[ -f $outfile && ! $force ]]; then
|
||||
dfatal "Will not override existing initramfs ($outfile) without --force"
|
||||
@@ -703,7 +774,7 @@ outdir=${outfile%/*}
|
||||
[[ $outdir ]] || outdir="/"
|
||||
|
||||
if [[ ! -d "$outdir" ]]; then
|
||||
dfatal "Can't write $outfile: Directory $outdir does not exist."
|
||||
dfatal "Can't write to $outdir: Directory $outdir does not exist or is not accessible."
|
||||
exit 1
|
||||
elif [[ ! -w "$outdir" ]]; then
|
||||
dfatal "No permission to write to $outdir."
|
||||
@@ -713,19 +784,29 @@ elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'ret=$?;[[ $keep ]] && echo "Not removing $initdir." >&2 || rm -rf "$initdir";exit $ret;' EXIT
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'exit 1;' SIGINT
|
||||
|
||||
# Need to be able to have non-root users read stuff (rpcbind etc)
|
||||
chmod 755 "$initdir"
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
for i in /sys /proc /run /dev; do
|
||||
if ! findmnt "$i" &>/dev/null; then
|
||||
dwarning "Turning off host-only mode: '$i' is not mounted!"
|
||||
unset hostonly
|
||||
fi
|
||||
done
|
||||
if ! [[ -d /run/udev/data ]]; then
|
||||
dwarning "Turning off host-only mode: udev database not found!"
|
||||
unset hostonly
|
||||
fi
|
||||
fi
|
||||
|
||||
declare -A host_fs_types
|
||||
|
||||
for line in "${fstab_lines[@]}"; do
|
||||
set -- $line
|
||||
#dev mp fs fsopts
|
||||
push host_devs "$1"
|
||||
push host_fs_types "$1|$3"
|
||||
host_fs_types["$1"]="$3"
|
||||
done
|
||||
|
||||
for f in $add_fstab; do
|
||||
@@ -749,7 +830,7 @@ if [[ $hostonly ]]; then
|
||||
# in hostonly mode, determine all devices, which have to be accessed
|
||||
# and examine them for filesystem types
|
||||
|
||||
push host_mp \
|
||||
for mp in \
|
||||
"/" \
|
||||
"/etc" \
|
||||
"/usr" \
|
||||
@@ -757,39 +838,62 @@ if [[ $hostonly ]]; then
|
||||
"/usr/sbin" \
|
||||
"/usr/lib" \
|
||||
"/usr/lib64" \
|
||||
"/boot"
|
||||
|
||||
for mp in "${host_mp[@]}"; do
|
||||
"/boot";
|
||||
do
|
||||
mountpoint "$mp" >/dev/null 2>&1 || continue
|
||||
push host_devs $(readlink -f "/dev/block/$(find_block_device "$mp")")
|
||||
done
|
||||
|
||||
while read dev type rest; do
|
||||
[[ -b $dev ]] || continue
|
||||
[[ "$type" == "partition" ]] || continue
|
||||
while read _d _m _t _o _r; do
|
||||
[[ "$_d" == \#* ]] && continue
|
||||
[[ $_d ]] || continue
|
||||
[[ $_t != "swap" ]] || [[ $_m != "swap" ]] && continue
|
||||
[[ "$_o" == *noauto* ]] && continue
|
||||
[[ "$_d" == UUID\=* ]] && _d="/dev/disk/by-uuid/${_d#UUID=}"
|
||||
[[ "$_d" == LABEL\=* ]] && _d="/dev/disk/by-label/$_d#LABEL=}"
|
||||
[[ "$_d" -ef "$dev" ]] || continue
|
||||
|
||||
while read _mapper _a _p _o; do
|
||||
[[ $_mapper = \#* ]] && continue
|
||||
[[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
|
||||
[[ "$_o" ]] || _o="$_p"
|
||||
# skip mkswap swap
|
||||
[[ $_o == *swap* ]] && continue 2
|
||||
done < /etc/crypttab
|
||||
|
||||
push host_devs $(readlink -f $dev)
|
||||
break
|
||||
done < /etc/fstab
|
||||
done < /proc/swaps
|
||||
fi
|
||||
|
||||
_get_fs_type() (
|
||||
[[ $1 ]] || return 1
|
||||
[[ $1 ]] || return
|
||||
if [[ -b $1 ]] && get_fs_env $1; then
|
||||
echo "$(readlink -f $1)|$ID_FS_TYPE"
|
||||
return 0
|
||||
echo "$(readlink -f $1) $ID_FS_TYPE"
|
||||
return 1
|
||||
fi
|
||||
if [[ -b /dev/block/$1 ]] && get_fs_env /dev/block/$1; then
|
||||
echo "$(readlink -f /dev/block/$1)|$ID_FS_TYPE"
|
||||
return 0
|
||||
echo "$(readlink -f /dev/block/$1) $ID_FS_TYPE"
|
||||
return 1
|
||||
fi
|
||||
if fstype=$(find_dev_fstype $1); then
|
||||
echo "$1|$fstype"
|
||||
return 0
|
||||
echo "$1 $fstype"
|
||||
return 1
|
||||
fi
|
||||
return 1
|
||||
)
|
||||
|
||||
for dev in "${host_devs[@]}"; do
|
||||
unset fs_type
|
||||
for fstype in $(_get_fs_type $dev) \
|
||||
$(check_block_and_slaves _get_fs_type $(get_maj_min $dev)); do
|
||||
if ! strstr " ${host_fs_types[*]} " " $fstype ";then
|
||||
push host_fs_types "$fstype"
|
||||
fi
|
||||
done
|
||||
while read key val; do
|
||||
host_fs_types["$key"]="$val"
|
||||
done < <(
|
||||
_get_fs_type $dev
|
||||
check_block_and_slaves_all _get_fs_type $(get_maj_min $dev)
|
||||
)
|
||||
done
|
||||
|
||||
[[ -d $udevdir ]] \
|
||||
@@ -801,23 +905,30 @@ fi
|
||||
|
||||
[[ -d $systemdutildir ]] \
|
||||
|| systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
|
||||
[[ -d $systemdsystemunitdir ]] \
|
||||
|| systemdsystemunitdir=$(pkg-config systemd --variable=systemdsystemunitdir 2>/dev/null)
|
||||
|
||||
if ! [[ -d "$systemdutildir" ]]; then
|
||||
[[ -d /lib/systemd ]] && systemdutildir=/lib/systemd
|
||||
[[ -d /usr/lib/systemd ]] && systemdutildir=/usr/lib/systemd
|
||||
fi
|
||||
|
||||
[[ -d $systemdsystemunitdir ]] \
|
||||
|| systemdsystemunitdir=$(pkg-config systemd --variable=systemdsystemunitdir 2>/dev/null)
|
||||
|
||||
[[ -d "$systemdsystemunitdir" ]] || systemdsystemunitdir=${systemdutildir}/system
|
||||
|
||||
[[ -d $systemdsystemconfdir ]] \
|
||||
|| systemdsystemconfdir=$(pkg-config systemd --variable=systemdsystemconfdir 2>/dev/null)
|
||||
|
||||
[[ -d "$systemdsystemconfdir" ]] || systemdsystemconfdir=/etc/systemd/system
|
||||
|
||||
export initdir dracutbasedir dracutmodules \
|
||||
fw_dir drivers_dir debug no_kernel kernel_only \
|
||||
omit_drivers mdadmconf lvmconf \
|
||||
use_fstab fstab_lines libdirs fscks nofscks ro_mnt \
|
||||
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
|
||||
debug host_fs_types host_devs sshkey add_fstab \
|
||||
DRACUT_VERSION udevdir systemdutildir systemdsystemunitdir \
|
||||
prefix filesystems drivers
|
||||
DRACUT_VERSION udevdir prefix filesystems drivers \
|
||||
systemdutildir systemdsystemunitdir systemdsystemconfdir
|
||||
|
||||
# Create some directory structure first
|
||||
[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
|
||||
@@ -833,7 +944,7 @@ if [[ $prefix ]]; then
|
||||
fi
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
for d in usr/bin usr/sbin bin etc lib sbin tmp usr var var/log $libdirs; do
|
||||
for d in usr/bin usr/sbin bin etc lib sbin tmp usr var $libdirs; do
|
||||
[[ -e "${initdir}${prefix}/$d" ]] && continue
|
||||
if [ -L "/$d" ]; then
|
||||
inst_symlink "/$d" "${prefix}/$d"
|
||||
@@ -852,6 +963,7 @@ if [[ $kernel_only != yes ]]; then
|
||||
|
||||
ln -sfn ../run "$initdir/var/run"
|
||||
ln -sfn ../run/lock "$initdir/var/lock"
|
||||
ln -sfn ../run/log "$initdir/var/log"
|
||||
else
|
||||
for d in lib "$libdir"; do
|
||||
[[ -e "${initdir}${prefix}/$d" ]] && continue
|
||||
@@ -943,6 +1055,16 @@ if [[ $no_kernel != yes ]]; then
|
||||
dinfo "*** Installing kernel module dependencies and firmware ***"
|
||||
dracut_kernel_post
|
||||
dinfo "*** Installing kernel module dependencies and firmware done ***"
|
||||
|
||||
if [[ $noimageifnotneeded == yes ]] && [[ $hostonly ]]; then
|
||||
if [[ ! -f "$initdir/lib/dracut/need-initqueue" ]] && \
|
||||
[[ -f ${initdir}/lib/modules/$kernel/modules.dep && ! -s ${initdir}/lib/modules/$kernel/modules.dep ]]; then
|
||||
for i in ${initdir}/etc/cmdline.d/*.conf; do
|
||||
# We need no initramfs image and do not generate one.
|
||||
[[ $i == "${initdir}/etc/cmdline.d/*.conf" ]] && exit 0
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
@@ -958,6 +1080,15 @@ if [[ $kernel_only != yes ]]; then
|
||||
cat $f >> "${initdir}/etc/fstab"
|
||||
done
|
||||
|
||||
if [ -d ${initdir}/$systemdutildir ]; then
|
||||
mkdir -p ${initdir}/etc/conf.d
|
||||
{
|
||||
echo "systemdutildir=\"$systemdutildir\""
|
||||
echo "systemdsystemunitdir=\"$systemdsystemunitdir\""
|
||||
echo "systemdsystemconfdir=\"$systemdsystemconfdir\""
|
||||
} > ${initdir}/etc/conf.d/systemd.conf
|
||||
fi
|
||||
|
||||
if [[ $DRACUT_RESOLVE_LAZY ]] && [[ $DRACUT_INSTALL ]]; then
|
||||
dinfo "*** Resolving executable dependencies ***"
|
||||
find "$initdir" -type f \
|
||||
@@ -1016,12 +1147,8 @@ fi
|
||||
PRELINK_BIN=$(command -v prelink)
|
||||
if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
|
||||
if [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Pre-unlinking files ***"
|
||||
dinfo "*** Installing prelink files ***"
|
||||
dracut_install -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
|
||||
chroot "$initdir" $PRELINK_BIN -u -a
|
||||
rm -f "$initdir"/$PRELINK_BIN
|
||||
rm -fr "$initdir"/etc/prelink.*
|
||||
dinfo "*** Pre-unlinking files done ***"
|
||||
else
|
||||
dinfo "*** Pre-linking files ***"
|
||||
dracut_install -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
|
||||
@@ -1042,7 +1169,7 @@ fi
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
for p in strip xargs find; do
|
||||
if ! type -P $p >/dev/null; then
|
||||
dwarn "Could not find '$p'. Not stripping the initramfs."
|
||||
dinfo "Could not find '$p'. Not stripping the initramfs."
|
||||
do_strip=no
|
||||
fi
|
||||
done
|
||||
@@ -1055,6 +1182,8 @@ if [[ $do_strip = yes ]] ; then
|
||||
-executable -not -path '*/lib/modules/*.ko' -print0 \
|
||||
| while read -r -d $'\0' f; do
|
||||
if ! [[ -e "${f%/*}/.${f##*/}.hmac" ]] \
|
||||
&& ! [[ -e "/lib/hmaccalc/${f##*/}.hmac" ]] \
|
||||
&& ! [[ -e "/lib64/hmaccalc/${f##*/}.hmac" ]] \
|
||||
&& ! [[ -e "/lib/fipscheck/${f##*/}.hmac" ]] \
|
||||
&& ! [[ -e "/lib64/fipscheck/${f##*/}.hmac" ]]; then
|
||||
echo -n "$f"; echo -n -e "\000"
|
||||
@@ -1079,10 +1208,11 @@ fi
|
||||
rm -f "$outfile"
|
||||
dinfo "*** Creating image file ***"
|
||||
if ! ( umask 077; cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
|
||||
$compress > "$outfile"; ); then
|
||||
dfatal "dracut: creation of $outfile failed"
|
||||
$compress > "$outfile.$$"; ); then
|
||||
dfatal "dracut: creation of $outfile.$$ failed"
|
||||
exit 1
|
||||
fi
|
||||
mv $outfile.$$ $outfile
|
||||
dinfo "*** Creating image file done ***"
|
||||
|
||||
dinfo "Wrote $outfile:"
|
||||
|
131
dracut.spec
131
dracut.spec
@@ -34,7 +34,13 @@ BuildRequires: dash bash git
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: pkgconfig
|
||||
%endif
|
||||
%if 0%{?fedora}
|
||||
BuildRequires: bash-completion
|
||||
BuildRequires: pkgconfig
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%endif
|
||||
@@ -70,7 +76,7 @@ Provides: mkinitrd = 2.6.1
|
||||
Obsoletes: dracut-kernel < 005
|
||||
Provides: dracut-kernel = %{version}-%{release}
|
||||
|
||||
Requires: bash
|
||||
Requires: bash >= 4
|
||||
Requires: coreutils
|
||||
Requires: cpio
|
||||
Requires: filesystem >= 2.1.0
|
||||
@@ -78,16 +84,16 @@ Requires: findutils
|
||||
Requires: grep
|
||||
Requires: hardlink
|
||||
Requires: gzip xz
|
||||
Requires: module-init-tools >= 3.7-9
|
||||
Requires: kmod
|
||||
Requires: sed
|
||||
Requires: file
|
||||
Requires: kpartx
|
||||
Requires: udev > 166
|
||||
Requires: kbd kbd-misc
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
Requires: util-linux >= 2.21
|
||||
Conflicts: systemd < 187
|
||||
Requires: systemd >= 199
|
||||
Conflicts: grubby < 8.23
|
||||
%else
|
||||
Requires: udev > 166
|
||||
Requires: util-linux-ng >= 2.21
|
||||
%endif
|
||||
|
||||
@@ -96,6 +102,8 @@ Conflicts: initscripts < 8.63-1
|
||||
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
|
||||
%endif
|
||||
|
||||
Conflicts: mdadm < 3.2.6-14
|
||||
|
||||
%description
|
||||
dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
|
||||
Unlike existing implementations, dracut does hard-code as little as possible
|
||||
@@ -130,7 +138,7 @@ Requires: nss-softokn-freebl
|
||||
|
||||
%description fips
|
||||
This package requires everything which is needed to build an
|
||||
all purpose initramfs with dracut, which does an integrity check.
|
||||
initramfs with dracut, which does an integrity check.
|
||||
%endif
|
||||
|
||||
%package fips-aesni
|
||||
@@ -139,8 +147,7 @@ Requires: %{name}-fips = %{version}-%{release}
|
||||
|
||||
%description fips-aesni
|
||||
This package requires everything which is needed to build an
|
||||
all purpose initramfs with dracut, which does an integrity check
|
||||
and adds the aesni-intel kernel module.
|
||||
initramfs with dracut, which does an integrity check and adds the aesni-intel kernel module.
|
||||
|
||||
%package caps
|
||||
Summary: dracut modules to build a dracut initramfs which drops capabilities
|
||||
@@ -149,7 +156,23 @@ Requires: libcap
|
||||
|
||||
%description caps
|
||||
This package requires everything which is needed to build an
|
||||
all purpose initramfs with dracut, which drops capabilities.
|
||||
initramfs with dracut, which drops capabilities.
|
||||
|
||||
%package nohostonly
|
||||
Summary: dracut configuration to turn off hostonly image generation
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description nohostonly
|
||||
This package provides the configuration to turn off the host specific initramfs
|
||||
generation with dracut.
|
||||
|
||||
%package norescue
|
||||
Summary: dracut configuration to turn off rescue image generation
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description norescue
|
||||
This package provides the configuration to turn off the rescue initramfs
|
||||
generation with dracut.
|
||||
|
||||
%package tools
|
||||
Summary: dracut tools to build the local initramfs
|
||||
@@ -173,19 +196,17 @@ git am -p1 %{patches}
|
||||
%endif
|
||||
|
||||
%build
|
||||
make all
|
||||
%configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib
|
||||
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%endif
|
||||
make install DESTDIR=$RPM_BUILD_ROOT \
|
||||
libdir=%{_prefix}/lib \
|
||||
bindir=%{_bindir} \
|
||||
%if %{defined _unitdir}
|
||||
systemdsystemunitdir=%{_unitdir} \
|
||||
%endif
|
||||
sysconfdir=/etc mandir=%{_mandir}
|
||||
make %{?_smp_mflags} install \
|
||||
DESTDIR=$RPM_BUILD_ROOT \
|
||||
libdir=%{_prefix}/lib
|
||||
|
||||
echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh
|
||||
|
||||
@@ -194,6 +215,11 @@ rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
|
||||
%endif
|
||||
|
||||
%if %{defined _unitdir}
|
||||
# for systemd, better use systemd-bootchart
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00bootchart
|
||||
%endif
|
||||
|
||||
# we do not support dash in the initramfs
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
|
||||
|
||||
@@ -205,7 +231,6 @@ rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/96securityfs
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/97masterkey
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98integrity
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98selinux
|
||||
%endif
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/boot/dracut
|
||||
@@ -215,12 +240,12 @@ touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
|
||||
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/40-fips.conf
|
||||
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
|
||||
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
|
||||
@@ -228,8 +253,17 @@ rm $RPM_BUILD_ROOT%{_bindir}/mkinitrd
|
||||
rm $RPM_BUILD_ROOT%{_bindir}/lsinitrd
|
||||
%endif
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
|
||||
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/dracut_log
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
# FIXME: remove after F19
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
|
||||
install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
|
||||
|
||||
echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-nohostonly.conf
|
||||
echo 'dracut_rescue_image="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-norescue.conf
|
||||
%endif
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
|
||||
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/dracut_log
|
||||
|
||||
# create compat symlink
|
||||
mkdir -p $RPM_BUILD_ROOT/sbin
|
||||
@@ -244,6 +278,8 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_bindir}/dracut
|
||||
# compat symlink
|
||||
/sbin/dracut
|
||||
%{_datadir}/bash-completion/completions/dracut
|
||||
%{_datadir}/bash-completion/completions/lsinitrd
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
%{_bindir}/mkinitrd
|
||||
%{_bindir}/lsinitrd
|
||||
@@ -256,11 +292,12 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/dracut-logger.sh
|
||||
%{dracutlibdir}/dracut-initramfs-restore
|
||||
%{dracutlibdir}/dracut-install
|
||||
%config(noreplace) /etc/dracut.conf
|
||||
%config(noreplace) %{_sysconfdir}/dracut.conf
|
||||
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
|
||||
%config /etc/dracut.conf.d/01-dist.conf
|
||||
%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
%dir /etc/dracut.conf.d
|
||||
%dir %{_sysconfdir}/dracut.conf.d
|
||||
%dir %{dracutlibdir}/dracut.conf.d
|
||||
%{_mandir}/man8/dracut.8*
|
||||
%{_mandir}/man8/*service.8*
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
@@ -269,8 +306,14 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%endif
|
||||
%{_mandir}/man7/dracut.kernel.7*
|
||||
%{_mandir}/man7/dracut.cmdline.7*
|
||||
%{_mandir}/man7/dracut.bootup.7*
|
||||
%{_mandir}/man5/dracut.conf.5*
|
||||
%if %{defined _unitdir}
|
||||
%{dracutlibdir}/modules.d/00systemd-bootchart
|
||||
%else
|
||||
%{dracutlibdir}/modules.d/00bootchart
|
||||
%endif
|
||||
%{dracutlibdir}/modules.d/03rescue
|
||||
%{dracutlibdir}/modules.d/04watchdog
|
||||
%{dracutlibdir}/modules.d/05busybox
|
||||
%{dracutlibdir}/modules.d/10i18n
|
||||
@@ -304,12 +347,12 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%if %{undefined _unitdir}
|
||||
%{dracutlibdir}/modules.d/96securityfs
|
||||
%{dracutlibdir}/modules.d/97masterkey
|
||||
%{dracutlibdir}/modules.d/98selinux
|
||||
%{dracutlibdir}/modules.d/98integrity
|
||||
%endif
|
||||
%{dracutlibdir}/modules.d/97biosdevname
|
||||
%{dracutlibdir}/modules.d/98ecryptfs
|
||||
%{dracutlibdir}/modules.d/98pollcdrom
|
||||
%{dracutlibdir}/modules.d/98selinux
|
||||
%{dracutlibdir}/modules.d/98syslog
|
||||
%{dracutlibdir}/modules.d/98systemd
|
||||
%{dracutlibdir}/modules.d/98usrmount
|
||||
@@ -317,12 +360,32 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/99fs-lib
|
||||
%{dracutlibdir}/modules.d/99img-lib
|
||||
%{dracutlibdir}/modules.d/99shutdown
|
||||
%config(noreplace) /etc/logrotate.d/dracut_log
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/dracut_log
|
||||
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
|
||||
%dir %{_sharedstatedir}/initramfs
|
||||
%if %{defined _unitdir}
|
||||
%{_unitdir}/dracut-shutdown.service
|
||||
%{_unitdir}/shutdown.target.wants/dracut-shutdown.service
|
||||
%{_unitdir}/dracut-cmdline.service
|
||||
%{_unitdir}/dracut-initqueue.service
|
||||
%{_unitdir}/dracut-mount.service
|
||||
%{_unitdir}/dracut-pre-mount.service
|
||||
%{_unitdir}/dracut-pre-pivot.service
|
||||
%{_unitdir}/dracut-pre-trigger.service
|
||||
%{_unitdir}/dracut-pre-udev.service
|
||||
%{_unitdir}/initrd.target.wants/dracut-cmdline.service
|
||||
%{_unitdir}/initrd.target.wants/dracut-initqueue.service
|
||||
%{_unitdir}/initrd.target.wants/dracut-mount.service
|
||||
%{_unitdir}/initrd.target.wants/dracut-pre-mount.service
|
||||
%{_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} > 6
|
||||
%{_prefix}/lib/kernel/install.d/50-dracut.install
|
||||
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
|
||||
%endif
|
||||
|
||||
%files network
|
||||
@@ -343,7 +406,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%files fips
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/01fips
|
||||
%config(noreplace) /etc/dracut.conf.d/40-fips.conf
|
||||
%{dracutlibdir}/dracut.conf.d/40-fips.conf
|
||||
%endif
|
||||
|
||||
%files fips-aesni
|
||||
@@ -363,4 +426,12 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%dir /var/lib/dracut
|
||||
%dir /var/lib/dracut/overlay
|
||||
|
||||
%files nohostonly
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/dracut.conf.d/02-nohostonly.conf
|
||||
|
||||
%files norescue
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/dracut.conf.d/02-norescue.conf
|
||||
|
||||
%changelog
|
||||
|
19
git2spec.pl
19
git2spec.pl
@@ -1,21 +1,5 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
sub last_tag {
|
||||
open( GIT, 'git log --pretty=format:%H |');
|
||||
LINE: while( <GIT> ) {
|
||||
open( GIT2, "git tag --contains $_ |");
|
||||
while( <GIT2> ) {
|
||||
chomp;
|
||||
last LINE if /..*/;
|
||||
}
|
||||
close GIT2;
|
||||
}
|
||||
$tag=$_;
|
||||
close GIT2;
|
||||
close GIT; # be done
|
||||
return $tag;
|
||||
};
|
||||
|
||||
sub create_patches {
|
||||
my $tag=shift;
|
||||
my $pdir=shift;
|
||||
@@ -31,7 +15,8 @@ my $datestr = strftime "%Y%m%d", gmtime;
|
||||
|
||||
my $tag=shift;
|
||||
my $pdir=shift;
|
||||
$tag=&last_tag if not defined $tag;
|
||||
$tag=`git describe --abbrev=0 --tags` if not defined $tag;
|
||||
chomp($tag);
|
||||
my @patches=&create_patches($tag, $pdir);
|
||||
my $num=$#patches + 2;
|
||||
$tag=~s/[^0-9]+?([0-9]+)/$1/;
|
||||
|
@@ -62,6 +62,10 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
static size_t dir_len(char const *file)
|
||||
{
|
||||
size_t length;
|
||||
|
||||
if(!file)
|
||||
return 0;
|
||||
|
||||
/* Strip the basename and any redundant slashes before it. */
|
||||
for (length = strlen(file)-1; 0 < length; length--)
|
||||
if (file[length] == '/' && file[length-1] != '/')
|
||||
@@ -73,20 +77,23 @@ static char *convert_abs_rel(const char *from, const char *target)
|
||||
{
|
||||
/* we use the 4*MAXPATHLEN, which should not overrun */
|
||||
char relative_from[MAXPATHLEN * 4];
|
||||
char *realtarget = NULL;
|
||||
char *p, *q;
|
||||
_cleanup_free_ char *realtarget = NULL;
|
||||
_cleanup_free_ char *target_dir_p = NULL, *realpath_p = NULL;
|
||||
const char *realfrom = from;
|
||||
int level = 0, fromlevel = 0, targetlevel = 0;
|
||||
int l, i, rl;
|
||||
int dirlen;
|
||||
size_t level = 0, fromlevel = 0, targetlevel = 0;
|
||||
int l;
|
||||
size_t i, rl, dirlen;
|
||||
int ret;
|
||||
|
||||
p = strdup(target);
|
||||
dirlen = dir_len(p);
|
||||
p[dirlen] = '\0';
|
||||
q = realpath(p, NULL);
|
||||
target_dir_p = strdup(target);
|
||||
if (!target_dir_p)
|
||||
return strdup(from);
|
||||
|
||||
if (q == NULL) {
|
||||
free(p);
|
||||
dirlen = dir_len(target_dir_p);
|
||||
target_dir_p[dirlen] = '\0';
|
||||
realpath_p = realpath(target_dir_p, NULL);
|
||||
|
||||
if (realpath_p == NULL) {
|
||||
log_warning("convert_abs_rel(): target '%s' directory has no realpath.", target);
|
||||
return strdup(from);
|
||||
}
|
||||
@@ -95,11 +102,13 @@ static char *convert_abs_rel(const char *from, const char *target)
|
||||
* character - need to skip all leading /'s */
|
||||
rl = strlen(target);
|
||||
for (i = dirlen+1; i < rl; ++i)
|
||||
if (p[i] != '/')
|
||||
if (target_dir_p[i] != '/')
|
||||
break;
|
||||
asprintf(&realtarget, "%s/%s", q, &p[i]);
|
||||
free(p);
|
||||
free(q);
|
||||
ret = asprintf(&realtarget, "%s/%s", realpath_p, &target_dir_p[i]);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* now calculate the relative path from <from> to <target> and
|
||||
store it in <relative_from>
|
||||
@@ -122,8 +131,6 @@ static char *convert_abs_rel(const char *from, const char *target)
|
||||
if (realtarget[i] == '/')
|
||||
level++;
|
||||
|
||||
free(realtarget);
|
||||
|
||||
/* add "../" to the relative_from path, until the common pathname is
|
||||
reached */
|
||||
for (i = level; i < targetlevel; i++) {
|
||||
@@ -155,18 +162,16 @@ static char *convert_abs_rel(const char *from, const char *target)
|
||||
static int ln_r(const char *src, const char *dst)
|
||||
{
|
||||
int ret;
|
||||
const char *points_to = convert_abs_rel(src, dst);
|
||||
_cleanup_free_ const char *points_to = convert_abs_rel(src, dst);
|
||||
|
||||
log_info("ln -s '%s' '%s'", points_to, dst);
|
||||
ret = symlink(points_to, dst);
|
||||
|
||||
if (ret != 0) {
|
||||
log_error("ERROR: ln -s '%s' '%s': %m", points_to, dst);
|
||||
free((char *)points_to);
|
||||
return 1;
|
||||
}
|
||||
|
||||
free((char *)points_to);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -186,11 +191,11 @@ static bool use_clone = true;
|
||||
static int cp(const char *src, const char *dst)
|
||||
{
|
||||
int pid;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
if (use_clone) {
|
||||
struct stat sb;
|
||||
int dest_desc, source_desc;
|
||||
_cleanup_close_ int dest_desc = -1, source_desc = -1;
|
||||
|
||||
if (lstat(src, &sb) != 0)
|
||||
goto normal_copy;
|
||||
@@ -207,20 +212,24 @@ static int cp(const char *src, const char *dst)
|
||||
(sb.st_mode) & (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO));
|
||||
|
||||
if (dest_desc < 0) {
|
||||
close(source_desc);
|
||||
goto normal_copy;
|
||||
}
|
||||
|
||||
ret = clone_file(dest_desc, source_desc);
|
||||
close(source_desc);
|
||||
|
||||
if (ret == 0) {
|
||||
struct timeval tv[2];
|
||||
if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0)
|
||||
fchown(dest_desc, -1, sb.st_gid);
|
||||
close(dest_desc);
|
||||
fchown(dest_desc, (__uid_t)-1, sb.st_gid);
|
||||
tv[0].tv_sec = sb.st_atime;
|
||||
tv[0].tv_usec = 0;
|
||||
tv[1].tv_sec = sb.st_mtime;
|
||||
tv[1].tv_usec = 0;
|
||||
futimes(dest_desc, tv);
|
||||
return ret;
|
||||
}
|
||||
close(dest_desc);
|
||||
|
||||
dest_desc = -1;
|
||||
/* clone did not work, remove the file */
|
||||
unlink(dst);
|
||||
/* do not try clone again */
|
||||
@@ -230,16 +239,83 @@ static int cp(const char *src, const char *dst)
|
||||
normal_copy:
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode", "-fL", src, dst, NULL);
|
||||
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,timestamps", "-fL", src, dst, NULL);
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
while (waitpid(pid, &ret, 0) < 0) {
|
||||
if (errno != EINTR) {
|
||||
ret = -1;
|
||||
log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,timestamps -fL %s %s", src, dst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
log_debug("cp ret = %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int library_install(const char *src, const char *lib)
|
||||
{
|
||||
_cleanup_free_ char *p = NULL;
|
||||
_cleanup_free_ char *pdir = NULL, *ppdir = NULL, *clib = NULL;
|
||||
char *q;
|
||||
int r, ret = 0;
|
||||
|
||||
p = strdup(lib);
|
||||
|
||||
r = dracut_install(p, p, false, false, true);
|
||||
if (r != 0)
|
||||
log_error("ERROR: failed to install '%s' for '%s'", p, src);
|
||||
else
|
||||
log_debug("Lib install: '%s'", p);
|
||||
ret += r;
|
||||
|
||||
/* also install lib.so for lib.so.* files */
|
||||
q = strstr(p, ".so.");
|
||||
if (q) {
|
||||
q[3] = '\0';
|
||||
|
||||
/* ignore errors for base lib symlink */
|
||||
if (dracut_install(p, p, false, false, true) == 0)
|
||||
log_debug("Lib install: '%s'", p);
|
||||
}
|
||||
|
||||
/* Also try to install the same library from one directory above.
|
||||
This fixes the case, where only the HWCAP lib would be installed
|
||||
# ldconfig -p|fgrep libc.so
|
||||
libc.so.6 (libc6,64bit, hwcap: 0x0000001000000000, OS ABI: Linux 2.6.32) => /lib64/power6/libc.so.6
|
||||
libc.so.6 (libc6,64bit, hwcap: 0x0000000000000200, OS ABI: Linux 2.6.32) => /lib64/power6x/libc.so.6
|
||||
libc.so.6 (libc6,64bit, OS ABI: Linux 2.6.32) => /lib64/libc.so.6
|
||||
*/
|
||||
|
||||
free(p);
|
||||
p = strdup(lib);
|
||||
|
||||
pdir = dirname(p);
|
||||
if (!pdir)
|
||||
return ret;
|
||||
|
||||
pdir = strdup(pdir);
|
||||
ppdir = dirname(pdir);
|
||||
if (!ppdir)
|
||||
return ret;
|
||||
|
||||
ppdir = strdup(ppdir);
|
||||
|
||||
strcpy(p, lib);
|
||||
|
||||
clib = strjoin(ppdir, "/", basename(p), NULL);
|
||||
if (dracut_install(clib, clib, false, false, true) == 0)
|
||||
log_debug("Lib install: '%s'", clib);
|
||||
/* also install lib.so for lib.so.* files */
|
||||
q = strstr(clib, ".so.");
|
||||
if (q) {
|
||||
q[3] = '\0';
|
||||
|
||||
/* ignore errors for base lib symlink */
|
||||
if (dracut_install(clib, clib, false, false, true) == 0)
|
||||
log_debug("Lib install: '%s'", p);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -248,17 +324,19 @@ static int resolve_deps(const char *src)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
char *buf = malloc(LINE_MAX);
|
||||
_cleanup_free_ char *buf = malloc(LINE_MAX);
|
||||
size_t linesize = LINE_MAX;
|
||||
FILE *fptr;
|
||||
char *cmd;
|
||||
_cleanup_pclose_ FILE *fptr = NULL;
|
||||
_cleanup_free_ char *cmd = NULL;
|
||||
|
||||
if (strstr(src, ".so") == 0) {
|
||||
int fd;
|
||||
_cleanup_close_ int fd = -1;
|
||||
fd = open(src, O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0)
|
||||
return -errno;
|
||||
|
||||
read(fd, buf, LINE_MAX);
|
||||
buf[LINE_MAX - 1] = '\0';
|
||||
close(fd);
|
||||
if (buf[0] == '#' && buf[1] == '!') {
|
||||
/* we have a shebang */
|
||||
char *p, *q;
|
||||
@@ -274,7 +352,14 @@ static int resolve_deps(const char *src)
|
||||
}
|
||||
|
||||
/* run ldd */
|
||||
asprintf(&cmd, "ldd %s 2>&1", src);
|
||||
ret = asprintf(&cmd, "ldd %s 2>&1", src);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
fptr = popen(cmd, "r");
|
||||
|
||||
while (!feof(fptr)) {
|
||||
@@ -285,6 +370,12 @@ static int resolve_deps(const char *src)
|
||||
|
||||
log_debug("ldd: '%s'", buf);
|
||||
|
||||
if (strstr(buf, "you do not have execution permission")) {
|
||||
log_error("%s", buf);
|
||||
ret+=1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (strstr(buf, "not a dynamic executable"))
|
||||
break;
|
||||
|
||||
@@ -294,31 +385,21 @@ static int resolve_deps(const char *src)
|
||||
if (strstr(buf, "not regular file"))
|
||||
break;
|
||||
|
||||
p = strstr(buf, "/");
|
||||
if (strstr(buf, "cannot read header"))
|
||||
break;
|
||||
|
||||
if (strstr(buf, destrootdir))
|
||||
break;
|
||||
|
||||
p = strchr(buf, '/');
|
||||
if (p) {
|
||||
int r;
|
||||
for (q = p; *q && *q != ' ' && *q != '\n'; q++) ;
|
||||
*q = '\0';
|
||||
r = dracut_install(p, p, false, false, true);
|
||||
if (r != 0)
|
||||
log_error("ERROR: failed to install '%s' for '%s'", p, src);
|
||||
else
|
||||
log_debug("Lib install: '%s'", p);
|
||||
ret += r;
|
||||
|
||||
/* also install lib.so for lib.so.* files */
|
||||
q = strstr(p, ".so.");
|
||||
if (q) {
|
||||
q += 3;
|
||||
*q = '\0';
|
||||
ret += library_install(src, p);
|
||||
|
||||
/* ignore errors for base lib symlink */
|
||||
if (dracut_install(p, p, false, false, true) == 0)
|
||||
log_debug("Lib install: '%s'", p);
|
||||
}
|
||||
}
|
||||
}
|
||||
pclose(fptr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -326,10 +407,15 @@ static int resolve_deps(const char *src)
|
||||
/* Install ".<filename>.hmac" file for FIPS self-checks */
|
||||
static int hmac_install(const char *src, const char *dst, const char *hmacpath)
|
||||
{
|
||||
char *srcpath = strdup(src);
|
||||
char *dstpath = strdup(dst);
|
||||
char *srchmacname = NULL;
|
||||
char *dsthmacname = NULL;
|
||||
_cleanup_free_ char *srcpath = strdup(src);
|
||||
_cleanup_free_ char *dstpath = strdup(dst);
|
||||
_cleanup_free_ char *srchmacname = NULL;
|
||||
_cleanup_free_ char *dsthmacname = NULL;
|
||||
int ret;
|
||||
|
||||
if (!(srcpath && dstpath))
|
||||
return -ENOMEM;
|
||||
|
||||
size_t dlen = dir_len(src);
|
||||
|
||||
if (endswith(src, ".hmac"))
|
||||
@@ -338,35 +424,51 @@ static int hmac_install(const char *src, const char *dst, const char *hmacpath)
|
||||
if (!hmacpath) {
|
||||
hmac_install(src, dst, "/lib/fipscheck");
|
||||
hmac_install(src, dst, "/lib64/fipscheck");
|
||||
hmac_install(src, dst, "/lib/hmaccalc");
|
||||
hmac_install(src, dst, "/lib64/hmaccalc");
|
||||
}
|
||||
|
||||
srcpath[dlen] = '\0';
|
||||
dstpath[dir_len(dst)] = '\0';
|
||||
if (hmacpath) {
|
||||
asprintf(&srchmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
|
||||
asprintf(&dsthmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
|
||||
ret = asprintf(&srchmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ret = asprintf(&dsthmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
asprintf(&srchmacname, "%s/.%s.hmac", srcpath, &src[dlen + 1]);
|
||||
asprintf(&dsthmacname, "%s/.%s.hmac", dstpath, &src[dlen + 1]);
|
||||
ret = asprintf(&srchmacname, "%s/.%s.hmac", srcpath, &src[dlen + 1]);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ret = asprintf(&dsthmacname, "%s/.%s.hmac", dstpath, &src[dlen + 1]);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
log_debug("hmac cp '%s' '%s')", srchmacname, dsthmacname);
|
||||
dracut_install(srchmacname, dsthmacname, false, false, true);
|
||||
free(dsthmacname);
|
||||
free(srchmacname);
|
||||
free(srcpath);
|
||||
free(dstpath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst)
|
||||
{
|
||||
struct stat sb, db;
|
||||
char *dname = NULL;
|
||||
char *fulldstpath = NULL;
|
||||
char *fulldstdir = NULL;
|
||||
_cleanup_free_ char *fulldstpath = NULL;
|
||||
_cleanup_free_ char *fulldstdir = NULL;
|
||||
int ret;
|
||||
bool src_exists = true;
|
||||
char *i, *existing;
|
||||
char *i = NULL;
|
||||
char *existing;
|
||||
|
||||
log_debug("dracut_install('%s', '%s')", src, dst);
|
||||
|
||||
@@ -399,9 +501,16 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
}
|
||||
|
||||
i = strdup(dst);
|
||||
if (!i)
|
||||
return -ENOMEM;
|
||||
|
||||
hashmap_put(items, i, i);
|
||||
|
||||
asprintf(&fulldstpath, "%s%s", destrootdir, dst);
|
||||
ret = asprintf(&fulldstpath, "%s%s", destrootdir, dst);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ret = stat(fulldstpath, &sb);
|
||||
|
||||
@@ -417,7 +526,6 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
} else
|
||||
log_debug("'%s' already exists", fulldstpath);
|
||||
|
||||
free(fulldstpath);
|
||||
/* dst does already exist */
|
||||
return ret;
|
||||
}
|
||||
@@ -429,6 +537,8 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
ret = stat(fulldstdir, &db);
|
||||
|
||||
if (ret < 0) {
|
||||
_cleanup_free_ char *dname = NULL;
|
||||
|
||||
if (errno != ENOENT) {
|
||||
log_error("ERROR: stat '%s': %m", fulldstdir);
|
||||
return 1;
|
||||
@@ -436,35 +546,34 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
/* create destination directory */
|
||||
log_debug("dest dir '%s' does not exist", fulldstdir);
|
||||
dname = strdup(dst);
|
||||
if (!dname)
|
||||
return 1;
|
||||
|
||||
dname[dir_len(dname)] = '\0';
|
||||
ret = dracut_install(dname, dname, true, false, true);
|
||||
|
||||
free(dname);
|
||||
|
||||
if (ret != 0) {
|
||||
log_error("ERROR: failed to create directory '%s'", fulldstdir);
|
||||
free(fulldstdir);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
free(fulldstdir);
|
||||
|
||||
if (isdir && !src_exists) {
|
||||
log_info("mkdir '%s'", fulldstpath);
|
||||
return mkdir(fulldstpath, 0755);
|
||||
ret = mkdir(fulldstpath, 0755);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ready to install src */
|
||||
|
||||
if (S_ISDIR(sb.st_mode)) {
|
||||
log_info("mkdir '%s'", fulldstpath);
|
||||
return mkdir(fulldstpath, sb.st_mode | S_IWUSR);
|
||||
ret = mkdir(fulldstpath, sb.st_mode | S_IWUSR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (S_ISLNK(sb.st_mode)) {
|
||||
char *abspath;
|
||||
char *absdestpath = NULL;
|
||||
_cleanup_free_ char *abspath = NULL;
|
||||
|
||||
abspath = realpath(src, NULL);
|
||||
|
||||
@@ -482,15 +591,17 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
}
|
||||
|
||||
if (lstat(fulldstpath, &sb) != 0) {
|
||||
_cleanup_free_ char *absdestpath = NULL;
|
||||
|
||||
asprintf(&absdestpath, "%s%s", destrootdir, abspath);
|
||||
ret = asprintf(&absdestpath, "%s%s", destrootdir, abspath);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ln_r(absdestpath, fulldstpath);
|
||||
|
||||
free(absdestpath);
|
||||
}
|
||||
|
||||
free(abspath);
|
||||
if (arg_hmac) {
|
||||
/* copy .hmac files also */
|
||||
hmac_install(src, dst, NULL);
|
||||
@@ -508,8 +619,12 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||
}
|
||||
}
|
||||
|
||||
log_debug("dracut_install ret = %d", ret);
|
||||
log_info("cp '%s' '%s'", src, fulldstpath);
|
||||
ret += cp(src, fulldstpath);
|
||||
|
||||
log_debug("dracut_install ret = %d", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -520,49 +635,49 @@ static void item_free(char *i)
|
||||
}
|
||||
|
||||
static void usage(int status)
|
||||
{
|
||||
/* */
|
||||
printf("\
|
||||
Usage: %s -D DESTROOTDIR [OPTION]... -a SOURCE...\n\
|
||||
or: %s -D DESTROOTDIR [OPTION]... SOURCE DEST\n\
|
||||
\n\
|
||||
Install SOURCE to DEST in DESTROOTDIR with all needed dependencies.\n\
|
||||
\n\
|
||||
-D --destrootdir Install all files to DESTROOTDIR as the root\n\
|
||||
-a --all Install all SOURCE arguments to DESTROOTDIR\n\
|
||||
-o --optional If SOURCE does not exist, do not fail\n\
|
||||
-d --dir SOURCE is a directory\n\
|
||||
-l --ldd Also install shebang executables and libraries\n\
|
||||
-R --resolvelazy Only install shebang executables and libraries for all SOURCE files\n\
|
||||
-H --fips Also install all '.SOURCE.hmac' files\n\
|
||||
-v --verbose Show more output\n\
|
||||
--debug Show debug output\n\
|
||||
--version Show package version\n\
|
||||
-h --help Show this help\n\
|
||||
\n\
|
||||
Example:\n\
|
||||
# mkdir -p /var/tmp/test-root\n\
|
||||
# %s -D /var/tmp/test-root --ldd -a sh tr\n\
|
||||
# tree /var/tmp/test-root\n\
|
||||
/var/tmp/test-root\n\
|
||||
|-- lib64 -> usr/lib64\n\
|
||||
`-- usr\n\
|
||||
|-- bin\n\
|
||||
| |-- bash\n\
|
||||
| |-- sh -> bash\n\
|
||||
| `-- tr\n\
|
||||
`-- lib64\n\
|
||||
|-- ld-2.15.90.so\n\
|
||||
|-- ld-linux-x86-64.so.2 -> ld-2.15.90.so\n\
|
||||
|-- libc-2.15.90.so\n\
|
||||
|-- libc.so\n\
|
||||
|-- libc.so.6 -> libc-2.15.90.so\n\
|
||||
|-- libdl-2.15.90.so\n\
|
||||
|-- libdl.so -> libdl-2.15.90.so\n\
|
||||
|-- libdl.so.2 -> libdl-2.15.90.so\n\
|
||||
|-- libtinfo.so.5 -> libtinfo.so.5.9\n\
|
||||
`-- libtinfo.so.5.9\n\
|
||||
", program_invocation_short_name, program_invocation_short_name, program_invocation_short_name);
|
||||
{
|
||||
/* */
|
||||
printf("Usage: %s -D DESTROOTDIR [OPTION]... -a SOURCE...\n"
|
||||
"or: %s -D DESTROOTDIR [OPTION]... SOURCE DEST\n"
|
||||
"\n"
|
||||
"Install SOURCE to DEST in DESTROOTDIR with all needed dependencies.\n"
|
||||
"\n"
|
||||
" -D --destrootdir Install all files to DESTROOTDIR as the root\n"
|
||||
" -a --all Install all SOURCE arguments to DESTROOTDIR\n"
|
||||
" -o --optional If SOURCE does not exist, do not fail\n"
|
||||
" -d --dir SOURCE is a directory\n"
|
||||
" -l --ldd Also install shebang executables and libraries\n"
|
||||
" -R --resolvelazy Only install shebang executables and libraries\n"
|
||||
" for all SOURCE files\n"
|
||||
" -H --fips Also install all '.SOURCE.hmac' files\n"
|
||||
" -v --verbose Show more output\n"
|
||||
" --debug Show debug output\n"
|
||||
" --version Show package version\n"
|
||||
" -h --help Show this help\n"
|
||||
"\n"
|
||||
"Example:\n"
|
||||
"# mkdir -p /var/tmp/test-root\n"
|
||||
"# %s -D /var/tmp/test-root --ldd -a sh tr\n"
|
||||
"# tree /var/tmp/test-root\n"
|
||||
"/var/tmp/test-root\n"
|
||||
"|-- lib64 -> usr/lib64\n"
|
||||
"`-- usr\n"
|
||||
" |-- bin\n"
|
||||
" | |-- bash\n"
|
||||
" | |-- sh -> bash\n"
|
||||
" | `-- tr\n"
|
||||
" `-- lib64\n"
|
||||
" |-- ld-2.15.90.so\n"
|
||||
" |-- ld-linux-x86-64.so.2 -> ld-2.15.90.so\n"
|
||||
" |-- libc-2.15.90.so\n"
|
||||
" |-- libc.so\n"
|
||||
" |-- libc.so.6 -> libc-2.15.90.so\n"
|
||||
" |-- libdl-2.15.90.so\n"
|
||||
" |-- libdl.so -> libdl-2.15.90.so\n"
|
||||
" |-- libdl.so.2 -> libdl-2.15.90.so\n"
|
||||
" |-- libtinfo.so.5 -> libtinfo.so.5.9\n"
|
||||
" `-- libtinfo.so.5.9\n"
|
||||
, program_invocation_short_name, program_invocation_short_name, program_invocation_short_name);
|
||||
exit(status);
|
||||
}
|
||||
|
||||
@@ -575,7 +690,7 @@ static int parse_argv(int argc, char *argv[])
|
||||
ARG_DEBUG
|
||||
};
|
||||
|
||||
static const struct option const options[] = {
|
||||
static struct option const options[] = {
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"version", no_argument, NULL, ARG_VERSION},
|
||||
{"dir", no_argument, NULL, 'd'},
|
||||
@@ -590,7 +705,7 @@ static int parse_argv(int argc, char *argv[])
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
while ((c = getopt_long(argc, argv, "adhloD:DHILR", options, NULL)) != -1) {
|
||||
while ((c = getopt_long(argc, argv, "adhloD:HR", options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case ARG_VERSION:
|
||||
puts(PROGRAM_VERSION_STRING);
|
||||
@@ -641,7 +756,7 @@ static int parse_argv(int argc, char *argv[])
|
||||
static int resolve_lazy(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
int destrootdirlen = strlen(destrootdir);
|
||||
size_t destrootdirlen = strlen(destrootdir);
|
||||
int ret = 0;
|
||||
char *item;
|
||||
for (i = 0; i < argc; i++) {
|
||||
@@ -671,10 +786,12 @@ static int resolve_lazy(int argc, char **argv)
|
||||
|
||||
static char *find_binary(const char *src)
|
||||
{
|
||||
char *path;
|
||||
_cleanup_free_ char *path = NULL;
|
||||
char *p, *q;
|
||||
bool end = false;
|
||||
char *newsrc = NULL;
|
||||
int ret;
|
||||
|
||||
path = getenv("PATH");
|
||||
|
||||
if (path == NULL) {
|
||||
@@ -683,6 +800,12 @@ static char *find_binary(const char *src)
|
||||
}
|
||||
path = strdup(path);
|
||||
p = path;
|
||||
|
||||
if (path == NULL) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
log_debug("PATH=%s", path);
|
||||
|
||||
do {
|
||||
@@ -695,7 +818,12 @@ static char *find_binary(const char *src)
|
||||
else
|
||||
*q = '\0';
|
||||
|
||||
asprintf(&newsrc, "%s/%s", p, src);
|
||||
ret = asprintf(&newsrc, "%s/%s", p, src);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
p = q + 1;
|
||||
|
||||
if (stat(newsrc, &sb) != 0) {
|
||||
@@ -709,15 +837,15 @@ static char *find_binary(const char *src)
|
||||
|
||||
} while (!end);
|
||||
|
||||
free(path);
|
||||
if (newsrc)
|
||||
log_debug("find_binary(%s) == %s", src, newsrc);
|
||||
|
||||
return newsrc;
|
||||
}
|
||||
|
||||
static int install_one(const char *src, const char *dst)
|
||||
{
|
||||
int r = 0;
|
||||
int r = EXIT_SUCCESS;
|
||||
int ret;
|
||||
|
||||
if (strchr(src, '/') == NULL) {
|
||||
@@ -746,29 +874,27 @@ static int install_one(const char *src, const char *dst)
|
||||
|
||||
static int install_all(int argc, char **argv)
|
||||
{
|
||||
int r = 0;
|
||||
int r = EXIT_SUCCESS;
|
||||
int i;
|
||||
for (i = 0; i < argc; i++) {
|
||||
int ret;
|
||||
log_debug("Handle '%s'", argv[i]);
|
||||
|
||||
if (strchr(argv[i], '/') == NULL) {
|
||||
char *newsrc = find_binary(argv[i]);
|
||||
_cleanup_free_ char *newsrc = find_binary(argv[i]);
|
||||
if (newsrc) {
|
||||
log_debug("dracut_install '%s'", newsrc);
|
||||
ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true);
|
||||
if (ret == 0) {
|
||||
log_debug("dracut_install '%s' OK", newsrc);
|
||||
}
|
||||
free(newsrc);
|
||||
} else {
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
} else {
|
||||
char *dest = strdup(argv[i]);
|
||||
_cleanup_free_ char *dest = strdup(argv[i]);
|
||||
ret = dracut_install(argv[i], dest, arg_createdir, arg_resolvedeps, true);
|
||||
free(dest);
|
||||
}
|
||||
|
||||
if ((ret != 0) && (!arg_optional)) {
|
||||
|
152
install/macro.h
152
install/macro.h
@@ -1,7 +1,6 @@
|
||||
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
|
||||
#ifndef foomacrohfoo
|
||||
#define foomacrohfoo
|
||||
#pragma once
|
||||
|
||||
/***
|
||||
This file is part of systemd.
|
||||
@@ -45,16 +44,38 @@
|
||||
#define _hidden_ __attribute__ ((visibility("hidden")))
|
||||
#define _weakref_(x) __attribute__((weakref(#x)))
|
||||
#define _introspect_(x) __attribute__((section("introspect." x)))
|
||||
#define _alignas_(x) __attribute__((aligned(__alignof(x))))
|
||||
#define _cleanup_(x) __attribute__((cleanup(x)))
|
||||
|
||||
/* automake test harness */
|
||||
#define EXIT_TEST_SKIP 77
|
||||
|
||||
#define XSTRINGIFY(x) #x
|
||||
#define STRINGIFY(x) XSTRINGIFY(x)
|
||||
|
||||
/* Rounds up */
|
||||
#define ALIGN(l) ALIGN_TO((l), sizeof(void*))
|
||||
|
||||
#define ALIGN4(l) (((l) + 3) & ~3)
|
||||
#define ALIGN8(l) (((l) + 7) & ~7)
|
||||
|
||||
#if __SIZEOF_POINTER__ == 8
|
||||
#define ALIGN(l) ALIGN8(l)
|
||||
#elif __SIZEOF_POINTER__ == 4
|
||||
#define ALIGN(l) ALIGN4(l)
|
||||
#else
|
||||
#error "Wut? Pointers are neither 4 nor 8 bytes long?"
|
||||
#endif
|
||||
|
||||
#define ALIGN_PTR(p) ((void*) ALIGN((unsigned long) p))
|
||||
#define ALIGN4_PTR(p) ((void*) ALIGN4((unsigned long) p))
|
||||
#define ALIGN8_PTR(p) ((void*) ALIGN8((unsigned long) p))
|
||||
|
||||
static inline size_t ALIGN_TO(size_t l, size_t ali) {
|
||||
return ((l + ali - 1) & ~(ali - 1));
|
||||
}
|
||||
|
||||
#define ALIGN_TO_PTR(p, ali) ((void*) ALIGN_TO((unsigned long) p))
|
||||
|
||||
#define ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
/*
|
||||
@@ -64,34 +85,35 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) {
|
||||
* @member: the name of the member within the struct.
|
||||
*
|
||||
*/
|
||||
#define container_of(ptr, type, member) ({ \
|
||||
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
||||
(type *)( (char *)__mptr - offsetof(type,member) );})
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) \
|
||||
__extension__ ({ \
|
||||
typeof(a) _a = (a); \
|
||||
typeof(b) _b = (b); \
|
||||
_a > _b ? _a : _b; \
|
||||
#define container_of(ptr, type, member) \
|
||||
__extension__ ({ \
|
||||
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
||||
(type *)( (char *)__mptr - offsetof(type,member) ); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#define MAX3(a,b,c) \
|
||||
MAX(MAX(a,b),c)
|
||||
#undef MAX
|
||||
#define MAX(a,b) \
|
||||
__extension__ ({ \
|
||||
typeof(a) _a = (a); \
|
||||
typeof(b) _b = (b); \
|
||||
_a > _b ? _a : _b; \
|
||||
})
|
||||
|
||||
#ifndef MIN
|
||||
#define MAX3(x,y,z) \
|
||||
__extension__ ({ \
|
||||
typeof(x) _c = MAX(x,y); \
|
||||
MAX(_c, z); \
|
||||
})
|
||||
|
||||
#undef MIN
|
||||
#define MIN(a,b) \
|
||||
__extension__ ({ \
|
||||
typeof(a) _a = (a); \
|
||||
typeof(b) _b = (b); \
|
||||
_a < _b ? _a : _b; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#define MIN3(a,b,c) \
|
||||
MIN(MIN(a,b),c)
|
||||
|
||||
#ifndef CLAMP
|
||||
#define CLAMP(x, low, high) \
|
||||
__extension__ ({ \
|
||||
typeof(x) _x = (x); \
|
||||
@@ -99,6 +121,7 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) {
|
||||
typeof(high) _high = (high); \
|
||||
((_x > _high) ? _high : ((_x < _low) ? _low : _x)); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#define assert_se(expr) \
|
||||
do { \
|
||||
@@ -119,14 +142,21 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) {
|
||||
log_assert_failed_unreachable(t, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
|
||||
} while (false)
|
||||
|
||||
#define assert_cc(expr) \
|
||||
do { \
|
||||
switch (0) { \
|
||||
case 0: \
|
||||
case !!(expr): \
|
||||
; \
|
||||
} \
|
||||
#if defined(static_assert)
|
||||
#define assert_cc(expr) \
|
||||
do { \
|
||||
static_assert(expr, #expr); \
|
||||
} while (false)
|
||||
#else
|
||||
#define assert_cc(expr) \
|
||||
do { \
|
||||
switch (0) { \
|
||||
case 0: \
|
||||
case !!(expr): \
|
||||
; \
|
||||
} \
|
||||
} while (false)
|
||||
#endif
|
||||
|
||||
#define PTR_TO_UINT(p) ((unsigned int) ((uintptr_t) (p)))
|
||||
#define UINT_TO_PTR(u) ((void*) ((uintptr_t) (u)))
|
||||
@@ -149,6 +179,8 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) {
|
||||
#define memzero(x,l) (memset((x), 0, (l)))
|
||||
#define zero(x) (memzero(&(x), sizeof(x)))
|
||||
|
||||
#define CHAR_TO_STR(x) ((char[2]) { x, 0 })
|
||||
|
||||
#define char_array_0(x) x[sizeof(x)-1] = 0;
|
||||
|
||||
#define IOVEC_SET_STRING(i, s) \
|
||||
@@ -187,6 +219,66 @@ static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) {
|
||||
return k;
|
||||
}
|
||||
|
||||
#include "log.h"
|
||||
#define VA_FORMAT_ADVANCE(format, ap) \
|
||||
do { \
|
||||
int _argtypes[128]; \
|
||||
size_t _i, _k; \
|
||||
_k = parse_printf_format((format), ELEMENTSOF(_argtypes), _argtypes); \
|
||||
assert(_k < ELEMENTSOF(_argtypes)); \
|
||||
for (_i = 0; _i < _k; _i++) { \
|
||||
if (_argtypes[_i] & PA_FLAG_PTR) { \
|
||||
(void) va_arg(ap, void*); \
|
||||
continue; \
|
||||
} \
|
||||
\
|
||||
switch (_argtypes[_i]) { \
|
||||
case PA_INT: \
|
||||
case PA_INT|PA_FLAG_SHORT: \
|
||||
case PA_CHAR: \
|
||||
(void) va_arg(ap, int); \
|
||||
break; \
|
||||
case PA_INT|PA_FLAG_LONG: \
|
||||
(void) va_arg(ap, long int); \
|
||||
break; \
|
||||
case PA_INT|PA_FLAG_LONG_LONG: \
|
||||
(void) va_arg(ap, long long int); \
|
||||
break; \
|
||||
case PA_WCHAR: \
|
||||
(void) va_arg(ap, wchar_t); \
|
||||
break; \
|
||||
case PA_WSTRING: \
|
||||
case PA_STRING: \
|
||||
case PA_POINTER: \
|
||||
(void) va_arg(ap, void*); \
|
||||
break; \
|
||||
case PA_FLOAT: \
|
||||
case PA_DOUBLE: \
|
||||
(void) va_arg(ap, double); \
|
||||
break; \
|
||||
case PA_DOUBLE|PA_FLAG_LONG_DOUBLE: \
|
||||
(void) va_arg(ap, long double); \
|
||||
break; \
|
||||
default: \
|
||||
assert_not_reached("Unknown format string argument."); \
|
||||
} \
|
||||
} \
|
||||
} while(false)
|
||||
|
||||
#endif
|
||||
/* Because statfs.t_type can be int on some architecures, we have to cast
|
||||
* the const magic to the type, otherwise the compiler warns about
|
||||
* signed/unsigned comparison, because the magic can be 32 bit unsigned.
|
||||
*/
|
||||
#define F_TYPE_CMP(a, b) (a == (typeof(a)) b)
|
||||
|
||||
|
||||
/* Returns the number of chars needed to format variables of the
|
||||
* specified type as a decimal string. Adds in extra space for a
|
||||
* negative '-' prefix. */
|
||||
|
||||
#define DECIMAL_STR_MAX(type) \
|
||||
(1+(sizeof(type) <= 1 ? 3 : \
|
||||
sizeof(type) <= 2 ? 5 : \
|
||||
sizeof(type) <= 4 ? 10 : \
|
||||
sizeof(type) <= 8 ? 20 : sizeof(int[-2*(sizeof(type) > 8)])))
|
||||
|
||||
#include "log.h"
|
||||
|
@@ -185,3 +185,95 @@ static const char *const log_level_table[] = {
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(log_level, int);
|
||||
|
||||
char *strnappend(const char *s, const char *suffix, size_t b) {
|
||||
size_t a;
|
||||
char *r;
|
||||
|
||||
if (!s && !suffix)
|
||||
return strdup("");
|
||||
|
||||
if (!s)
|
||||
return strndup(suffix, b);
|
||||
|
||||
if (!suffix)
|
||||
return strdup(s);
|
||||
|
||||
assert(s);
|
||||
assert(suffix);
|
||||
|
||||
a = strlen(s);
|
||||
if (b > ((size_t) -1) - a)
|
||||
return NULL;
|
||||
|
||||
r = new(char, a+b+1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
memcpy(r, s, a);
|
||||
memcpy(r+a, suffix, b);
|
||||
r[a+b] = 0;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
char *strappend(const char *s, const char *suffix) {
|
||||
return strnappend(s, suffix, suffix ? strlen(suffix) : 0);
|
||||
}
|
||||
|
||||
char *strjoin(const char *x, ...) {
|
||||
va_list ap;
|
||||
size_t l;
|
||||
char *r, *p;
|
||||
|
||||
va_start(ap, x);
|
||||
|
||||
if (x) {
|
||||
l = strlen(x);
|
||||
|
||||
for (;;) {
|
||||
const char *t;
|
||||
size_t n;
|
||||
|
||||
t = va_arg(ap, const char *);
|
||||
if (!t)
|
||||
break;
|
||||
|
||||
n = strlen(t);
|
||||
if (n > ((size_t) -1) - l) {
|
||||
va_end(ap);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
l += n;
|
||||
}
|
||||
} else
|
||||
l = 0;
|
||||
|
||||
va_end(ap);
|
||||
|
||||
r = new(char, l+1);
|
||||
if (!r)
|
||||
return NULL;
|
||||
|
||||
if (x) {
|
||||
p = stpcpy(r, x);
|
||||
|
||||
va_start(ap, x);
|
||||
|
||||
for (;;) {
|
||||
const char *t;
|
||||
|
||||
t = va_arg(ap, const char *);
|
||||
if (!t)
|
||||
break;
|
||||
|
||||
p = stpcpy(p, t);
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
} else
|
||||
r[0] = 0;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@@ -507,6 +507,42 @@ void* memdup(const void *p, size_t l);
|
||||
|
||||
int is_kernel_thread(pid_t pid);
|
||||
|
||||
static inline void freep(void *p) {
|
||||
free(*(void**) p);
|
||||
}
|
||||
|
||||
static inline void fclosep(FILE **f) {
|
||||
if (*f)
|
||||
fclose(*f);
|
||||
}
|
||||
|
||||
static inline void pclosep(FILE **f) {
|
||||
if (*f)
|
||||
pclose(*f);
|
||||
}
|
||||
|
||||
static inline void closep(int *fd) {
|
||||
if (*fd >= 0)
|
||||
close_nointr_nofail(*fd);
|
||||
}
|
||||
|
||||
static inline void closedirp(DIR **d) {
|
||||
if (*d)
|
||||
closedir(*d);
|
||||
}
|
||||
|
||||
static inline void umaskp(mode_t *u) {
|
||||
umask(*u);
|
||||
}
|
||||
|
||||
#define _cleanup_free_ _cleanup_(freep)
|
||||
#define _cleanup_fclose_ _cleanup_(fclosep)
|
||||
#define _cleanup_pclose_ _cleanup_(pclosep)
|
||||
#define _cleanup_close_ _cleanup_(closep)
|
||||
#define _cleanup_closedir_ _cleanup_(closedirp)
|
||||
#define _cleanup_umask_ _cleanup_(umaskp)
|
||||
#define _cleanup_globfree_ _cleanup_(globfree)
|
||||
|
||||
int fd_inc_sndbuf(int fd, size_t n);
|
||||
int fd_inc_rcvbuf(int fd, size_t n);
|
||||
|
||||
@@ -524,4 +560,6 @@ bool in_initrd(void);
|
||||
|
||||
void warn_melody(void);
|
||||
|
||||
char *strjoin(const char *x, ...) _sentinel_;
|
||||
|
||||
#endif
|
||||
|
63
lsinitrd-bash-completion.sh
Normal file
63
lsinitrd-bash-completion.sh
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Copyright 2013 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
__contains_word () {
|
||||
local word=$1; shift
|
||||
for w in $*; do [[ $w = $word ]] && return 0; done
|
||||
return 1
|
||||
}
|
||||
|
||||
_lsinitrd() {
|
||||
local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local -A OPTS=(
|
||||
[STANDALONE]='-s --size -h --help'
|
||||
|
||||
[ARG]='-f --file -k --kver'
|
||||
)
|
||||
|
||||
if __contains_word "$prev" ${OPTS[ARG]}; then
|
||||
case $prev in
|
||||
--file|-f)
|
||||
comps=$(compgen -f -- "$cur")
|
||||
compopt -o filenames
|
||||
;;
|
||||
--kver|-k)
|
||||
comps=$(cd /lib/modules; echo [0-9]*)
|
||||
;;
|
||||
*)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ $cur = -* ]]; then
|
||||
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
comps=$(compgen -f -- "$cur")
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -F _lsinitrd lsinitrd
|
@@ -10,12 +10,15 @@ lsinitrd - tool to show the contents of an initramfs image
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
*lsinit* ['OPTION...'] [<image>]
|
||||
*lsinitrd* ['OPTION...'] [<image> [<filename> [<filename> [...] ]]]
|
||||
|
||||
*lsinitrd* ['OPTION...'] -k <kernel-version>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
lsinitrd shows the contents of an initramfs image. if <image> is omitted, then
|
||||
lsinitrd uses the default image /boot/initramfs-<kernel version>.img.
|
||||
lsinitrd uses the default image _/boot/<machine-id>/<kernel-version>/initrd_ or
|
||||
_/boot/initramfs-<kernel-version>.img_.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
@@ -25,6 +28,12 @@ OPTIONS
|
||||
**-s, --size**::
|
||||
sort the contents of the initramfs by size.
|
||||
|
||||
**-f, --file** _<filename>_::
|
||||
print the contents of <filename>.
|
||||
|
||||
**-k, --kver** _<kernel version>_::
|
||||
inspect the initramfs of <kernel version>.
|
||||
|
||||
AVAILABILITY
|
||||
------------
|
||||
The lsinitrd command is part of the dracut package and is available from
|
||||
|
163
lsinitrd.sh
163
lsinitrd.sh
@@ -21,55 +21,132 @@
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "Usage: $(${0##*/}) [-s] [<initramfs file> [<filename>]]"
|
||||
{
|
||||
echo "Usage: ${0##*/} [options] [<initramfs file> [<filename> [<filename> [...] ]]]"
|
||||
echo "Usage: ${0##*/} [options] -k <kernel version>"
|
||||
echo
|
||||
echo "-h, --help print a help message and exit."
|
||||
echo "-s, --size sort the contents of the initramfs by size."
|
||||
echo "-f, --file <filename> print the contents of <filename>."
|
||||
echo "-k, --kver <kernel version> inspect the initramfs of <kernel version>."
|
||||
echo
|
||||
} >&2
|
||||
}
|
||||
|
||||
[[ $# -le 2 ]] || { usage ; exit 1 ; }
|
||||
|
||||
sorted=0
|
||||
while getopts "s" opt; do
|
||||
case $opt in
|
||||
s) sorted=1;;
|
||||
h) usage; exit 0;;
|
||||
\?) usage; exit 1;;
|
||||
declare -A filenames
|
||||
|
||||
unset POSIXLY_CORRECT
|
||||
TEMP=$(getopt \
|
||||
-o "shf:k:" \
|
||||
--long kver: \
|
||||
--long file: \
|
||||
--long help \
|
||||
--long size \
|
||||
-- "$@")
|
||||
|
||||
if (( $? != 0 )); then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval set -- "$TEMP"
|
||||
|
||||
while (($# > 0)); do
|
||||
case $1 in
|
||||
-k|--kver) KERNEL_VERSION="$2"; shift;;
|
||||
-f|--file) filenames[${2#/}]=1; shift;;
|
||||
-s|--size) sorted=1;;
|
||||
-h|--help) usage; exit 0;;
|
||||
--) shift;break;;
|
||||
*) usage; exit 1;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
image="${1:-/boot/initramfs-$(uname -r).img}"
|
||||
[[ -f "$image" ]] || { echo "$image does not exist" ; exit 1 ; }
|
||||
[[ $KERNEL_VERSION ]] || KERNEL_VERSION="$(uname -r)"
|
||||
|
||||
CAT=zcat
|
||||
FILE_T=$(file --dereference "$image")
|
||||
|
||||
if echo "test"|xz|xz -dc --single-stream >/dev/null 2>&1; then
|
||||
XZ_SINGLE_STREAM="--single-stream"
|
||||
fi
|
||||
|
||||
if [[ "$FILE_T" =~ :\ gzip\ compressed\ data ]]; then
|
||||
CAT=zcat
|
||||
elif [[ "$FILE_T" =~ :\ xz\ compressed\ data ]]; then
|
||||
CAT="xzcat $XZ_SINGLE_STREAM"
|
||||
elif [[ "$FILE_T" =~ :\ XZ\ compressed\ data ]]; then
|
||||
CAT="xzcat $XZ_SINGLE_STREAM"
|
||||
elif [[ "$FILE_T" =~ :\ LZMA ]]; then
|
||||
CAT="xzcat $XZ_SINGLE_STREAM"
|
||||
elif [[ "$FILE_T" =~ :\ data ]]; then
|
||||
CAT="xzcat $XZ_SINGLE_STREAM"
|
||||
fi
|
||||
|
||||
if [[ $# -eq 2 ]]; then
|
||||
$CAT $image | cpio --extract --verbose --quiet --to-stdout ${2#/} 2>/dev/null
|
||||
exit $?
|
||||
fi
|
||||
|
||||
echo "$image: $(du -h $image | while read a b; do echo $a;done)"
|
||||
echo "========================================================================"
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout '*lib/dracut/dracut-*' 2>/dev/null
|
||||
echo "========================================================================"
|
||||
if [ "$sorted" -eq 1 ]; then
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
if [[ $1 ]]; then
|
||||
image="$1"
|
||||
if ! [[ -f "$image" ]]; then
|
||||
{
|
||||
echo "$image does not exist"
|
||||
echo
|
||||
} >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
if [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
|
||||
&& [[ $MACHINE_ID ]] \
|
||||
&& [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
|
||||
image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
|
||||
else
|
||||
image="/boot/initramfs-${KERNEL_VERSION}.img"
|
||||
fi
|
||||
fi
|
||||
echo "========================================================================"
|
||||
|
||||
shift
|
||||
while (($# > 0)); do
|
||||
filenames[${1#/}]=1;
|
||||
shift
|
||||
done
|
||||
|
||||
if ! [[ -f "$image" ]]; then
|
||||
{
|
||||
echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
|
||||
echo
|
||||
} >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
read -N 6 bin < "$image"
|
||||
case $bin in
|
||||
$'\x1f\x8b'*)
|
||||
CAT="zcat";;
|
||||
BZh*)
|
||||
CAT="bzcat";;
|
||||
070701)
|
||||
CAT="cat";;
|
||||
*)
|
||||
CAT="xzcat";
|
||||
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
|
||||
CAT="xzcat --single-stream"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
ret=0
|
||||
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
(( ${#filenames[@]} == 1 )) && nofileinfo=1
|
||||
for f in ${!filenames[@]}; do
|
||||
[[ $nofileinfo ]] || echo "initramfs:/$f"
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
$CAT $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
|
||||
((ret+=$?))
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
[[ $nofileinfo ]] || echo
|
||||
done
|
||||
else
|
||||
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
|
||||
echo "========================================================================"
|
||||
version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout '*lib/dracut/dracut-*' 2>/dev/null)
|
||||
((ret+=$?))
|
||||
echo "$version with dracut modules:"
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout 'usr/lib/dracut/modules.txt' 2>/dev/null
|
||||
((ret+=$?))
|
||||
echo "========================================================================"
|
||||
if [ "$sorted" -eq 1 ]; then
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
else
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
|
||||
fi
|
||||
((ret+=$?))
|
||||
echo "========================================================================"
|
||||
fi
|
||||
|
||||
exit $ret
|
||||
|
18
modules.d/00systemd-bootchart/module-setup.sh
Executable file
18
modules.d/00systemd-bootchart/module-setup.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
[ -x $systemdutildir/systemd-bootchart ] || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_symlink /init /sbin/init
|
||||
dracut_install $systemdutildir/systemd-bootchart
|
||||
}
|
@@ -51,7 +51,6 @@ mount_boot()
|
||||
|
||||
do_fips()
|
||||
{
|
||||
info "Checking integrity of kernel"
|
||||
KERNEL=$(uname -r)
|
||||
|
||||
if ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
|
||||
@@ -59,19 +58,21 @@ do_fips()
|
||||
return 1
|
||||
fi
|
||||
|
||||
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
|
||||
info "Loading and integrity checking all crypto modules"
|
||||
for module in $FIPSMODULES; do
|
||||
if [ "$module" != "tcrypt" ]; then
|
||||
modprobe ${module} || return 1
|
||||
modprobe ${module}
|
||||
fi
|
||||
done
|
||||
info "Self testing crypto algorithms"
|
||||
modprobe tcrypt || return 1
|
||||
rmmod tcrypt
|
||||
|
||||
info "Checking integrity of kernel"
|
||||
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
|
||||
info "All initrd crypto checks done"
|
||||
|
||||
> /tmp/fipsdone
|
||||
|
@@ -12,9 +12,11 @@ depends() {
|
||||
|
||||
installkernel() {
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aead aes_generic xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr gcm ghash_generic"
|
||||
_fipsmodules+=" des deflate ecb eseqiv hmac seqiv sha256 sha256_generic sha512 sha512_generic"
|
||||
_fipsmodules+=" cryptomgr crypto_null tcrypt dm-mod dm-crypt"
|
||||
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
|
||||
_fipsmodules+="chainiv crc32c cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod "
|
||||
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
|
||||
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
|
||||
_fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib"
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
@@ -36,7 +38,7 @@ install() {
|
||||
|
||||
inst_libdir_file libsoftokn3.so libsoftokn3.so \
|
||||
libsoftokn3.chk libfreebl3.so libfreebl3.chk \
|
||||
libssl.so 'hmaccalc/sha512hmac.hmac'
|
||||
libssl.so 'hmaccalc/sha512hmac.hmac' libssl.so.10
|
||||
|
||||
dracut_install -o prelink
|
||||
}
|
||||
|
19
modules.d/03rescue/module-setup.sh
Executable file
19
modules.d/03rescue/module-setup.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
# do not add this module by default
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install -o ps grep more cat rm strace free showmount \
|
||||
ping netstat rpcinfo vi scp ping6 ssh \
|
||||
fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck
|
||||
}
|
||||
|
@@ -4,8 +4,8 @@
|
||||
|
||||
[ -n "$DRACUT_SYSTEMD" ] && exit 0
|
||||
|
||||
if [ -x /lib/systemd/systemd-vconsole-setup ]; then
|
||||
/lib/systemd/systemd-vconsole-setup "$@"
|
||||
if [ -x $systemdutildir/systemd-vconsole-setup ]; then
|
||||
$systemdutildir/systemd-vconsole-setup "$@"
|
||||
fi
|
||||
|
||||
[ -e /etc/vconsole.conf ] && . /etc/vconsole.conf
|
||||
|
@@ -12,9 +12,9 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
[ -x /lib/systemd/systemd-vconsole-setup ] && dracut_install /lib/systemd/systemd-vconsole-setup
|
||||
dracut_install -o $systemdutildir/systemd-vconsole-setup
|
||||
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
|
||||
DEFAULT_FONT=LatArCyrHeb-16
|
||||
DEFAULT_FONT=latarcyrheb-sun16
|
||||
I18N_CONF="/etc/locale.conf"
|
||||
VCONFIG_CONF="/etc/vconsole.conf"
|
||||
|
||||
@@ -86,9 +86,11 @@ install() {
|
||||
install_base() {
|
||||
dracut_install setfont loadkeys kbd_mode stty
|
||||
|
||||
inst ${moddir}/console_init.sh /lib/udev/console_init
|
||||
inst_rules ${moddir}/10-console.rules
|
||||
inst_hook cmdline 20 "${moddir}/parse-i18n.sh"
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst ${moddir}/console_init.sh /lib/udev/console_init
|
||||
inst_rules ${moddir}/10-console.rules
|
||||
inst_hook cmdline 20 "${moddir}/parse-i18n.sh"
|
||||
fi
|
||||
}
|
||||
|
||||
install_all_kbd() {
|
||||
|
@@ -17,16 +17,22 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
|
||||
# $netif reads easier than $1
|
||||
netif=$1
|
||||
use_bridge='false'
|
||||
use_vlan='false'
|
||||
|
||||
# enslave this interface to bond?
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
for i in /tmp/bond.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset bondslaves
|
||||
unset bondname
|
||||
. "$i"
|
||||
for slave in $bondslaves ; do
|
||||
if [ "$netif" = "$slave" ] ; then
|
||||
netif=$bondname
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
@@ -37,6 +43,20 @@ if [ -e /tmp/team.info ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
if [ "$netif" = "$phydevice" ]; then
|
||||
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
|
||||
: # We need to really setup team (recursive call)
|
||||
else
|
||||
netif="$vlanname"
|
||||
use_vlan='true'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# bridge this interface?
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
@@ -44,24 +64,18 @@ if [ -e /tmp/bridge.info ]; then
|
||||
if [ "$netif" = "$ethname" ]; then
|
||||
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
|
||||
: # We need to really setup team (recursive call)
|
||||
elif [ "$netif" = "$vlanname" ] && [ -n "$DO_VLAN_SETUP" ]; then
|
||||
: # We need to really setup vlan (recursive call)
|
||||
else
|
||||
netif="$bridgename"
|
||||
use_bridge='true'
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
if [ "$netif" = "$phydevice" ]; then
|
||||
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
else
|
||||
netif="$vlanname"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# disable manual ifup while netroot is set for simplifying our logic
|
||||
# in netroot case we prefer netroot to bringup $netif automaticlly
|
||||
[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
|
||||
@@ -109,10 +123,10 @@ do_static() {
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
if strstr $ip '*:*:*'; then
|
||||
# note no ip addr flush for ipv6
|
||||
ip addr add $ip/$mask dev $netif
|
||||
ip addr add $ip/$mask ${srv+peer $srv} dev $netif
|
||||
else
|
||||
ip addr flush dev $netif
|
||||
ip addr add $ip/$mask brd + dev $netif
|
||||
ip addr add $ip/$mask ${srv+peer $srv} brd + dev $netif
|
||||
fi
|
||||
|
||||
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
@@ -130,11 +144,12 @@ if [ "$netif" = "lo" ] ; then
|
||||
fi
|
||||
|
||||
# start bond if needed
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
if [ -e /tmp/bond.${netif}.info ]; then
|
||||
. /tmp/bond.${netif}.info
|
||||
|
||||
if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.up ] ; then # We are master bond device
|
||||
modprobe bonding
|
||||
echo "+$netif" > /sys/class/net/bonding_masters
|
||||
ip link set $netif down
|
||||
|
||||
# Stolen from ifup-eth
|
||||
@@ -208,6 +223,10 @@ if [ -e /tmp/bridge.info ]; then
|
||||
for ethname in $ethnames ; do
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes ifup $bondname -m
|
||||
elif [ "$ethname" = "$teammaster" ] ; then
|
||||
DO_TEAM_SETUP=yes ifup $teammaster -m
|
||||
elif [ "$ethname" = "$vlanname" ]; then
|
||||
DO_VLAN_SETUP=yes ifup $vlanname -m
|
||||
else
|
||||
linkup $ethname
|
||||
fi
|
||||
@@ -219,10 +238,10 @@ fi
|
||||
get_vid() {
|
||||
case "$1" in
|
||||
vlan*)
|
||||
return ${1#vlan}
|
||||
echo ${1#vlan}
|
||||
;;
|
||||
*.*)
|
||||
return ${1##*.}
|
||||
echo ${1##*.}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -231,10 +250,13 @@ if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
|
||||
modprobe 8021q
|
||||
if [ "$phydevice" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes ifup $phydevice -m
|
||||
elif [ "$phydevice" = "$teammaster" ] ; then
|
||||
DO_TEAM_SETUP=yes ifup $phydevice -m
|
||||
else
|
||||
linkup "$phydevice"
|
||||
fi
|
||||
ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname; echo $?)"
|
||||
ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname)"
|
||||
ip link set "$vlanname" up
|
||||
fi
|
||||
|
||||
# setup nameserver
|
||||
@@ -256,6 +278,7 @@ if [ -z "$ip" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Specific configuration, spin through the kernel command line
|
||||
# looking for ip= lines
|
||||
for p in $(getargs ip=); do
|
||||
@@ -264,7 +287,9 @@ for p in $(getargs ip=); do
|
||||
[ "$autoconf" = "ibft" ] && continue
|
||||
|
||||
# If this option isn't directed at our interface, skip it
|
||||
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
|
||||
[ -n "$dev" ] && [ "$dev" != "$netif" ] && \
|
||||
[ "$use_bridge" != 'true' ] && \
|
||||
[ "$use_vlan" != 'true' ] && continue
|
||||
|
||||
# Store config for later use
|
||||
for i in ip srv gw mask hostname macaddr; do
|
||||
|
@@ -95,5 +95,7 @@ install() {
|
||||
|
||||
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
|
||||
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
@@ -14,8 +14,10 @@ fix_bootif() {
|
||||
echo $macaddr | sed 'y/ABCDEF/abcdef/'
|
||||
}
|
||||
|
||||
getargbool 0 rd.neednet && NEEDNET=1
|
||||
|
||||
# Don't continue if we don't need network
|
||||
if [ -z "$netroot" ] && [ ! -e "/tmp/net.ifaces" ] && ! getargbool 0 rd.neednet >/dev/null; then
|
||||
if [ -z "$netroot" ] && [ ! -e "/tmp/net.ifaces" ] && [ "$NEEDNET" != "1" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -24,24 +26,31 @@ fi
|
||||
# bridge: attempt only the defined interface
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
IFACES+=" ${ethnames%% *}"
|
||||
IFACES="$IFACES ${ethnames%% *}"
|
||||
MASTER_IFACES="$MASTER_IFACES $bridgename"
|
||||
fi
|
||||
|
||||
# bond: attempt only the defined interface (override bridge defines)
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
for i in /tmp/bond.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset bondslaves
|
||||
unset bondname
|
||||
. "$i"
|
||||
# It is enough to fire up only one
|
||||
IFACES+=" ${bondslaves%% *}"
|
||||
fi
|
||||
IFACES="$IFACES ${bondslaves%% *}"
|
||||
MASTER_IFACES="$MASTER_IFACES ${bondname}"
|
||||
done
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
IFACES+=" ${teamslaves}"
|
||||
IFACES="$IFACES ${teamslaves}"
|
||||
MASTER_IFACES="$MASTER_IFACES ${teammaster}"
|
||||
fi
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
IFACES+=" $phydevice"
|
||||
IFACES="$IFACES $phydevice"
|
||||
MASTER_IFACES="$MASTER_IFACES ${vlanname}"
|
||||
fi
|
||||
|
||||
if [ -z "$IFACES" ]; then
|
||||
@@ -66,11 +75,16 @@ fi
|
||||
elif [ -n "$IFACES" ] ; then
|
||||
for iface in $IFACES ; do
|
||||
printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="%s"\n' "$iface" "/sbin/initqueue --onetime $ifup"
|
||||
if [ "$bootdev" = "$iface" ]; then
|
||||
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
|
||||
echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh
|
||||
fi
|
||||
done
|
||||
|
||||
for iface in $MASTER_IFACES; do
|
||||
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
|
||||
echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh
|
||||
fi
|
||||
done
|
||||
# Default: We don't know the interface to use, handle all
|
||||
# Fixme: waiting for the interface as well.
|
||||
else
|
||||
|
@@ -159,6 +159,7 @@ ibft_to_cmdline() {
|
||||
hostname=$(read a < ${iface}/hostname; echo $a)
|
||||
echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
|
||||
fi
|
||||
echo $mac > /tmp/net.${dev}.has_ibft_config
|
||||
done
|
||||
) >> /etc/cmdline.d/40-ibft.conf
|
||||
# reread cmdline
|
||||
@@ -271,11 +272,11 @@ ip_to_var() {
|
||||
case $# in
|
||||
0) autoconf="error" ;;
|
||||
1) autoconf=$1 ;;
|
||||
2) dev=$1; autoconf=$2 ;;
|
||||
3) dev=$1; autoconf=$2; mtu=$3 ;;
|
||||
4) dev=$1; autoconf=$2; mtu=$3; macaddr=$4 ;;
|
||||
*) ip=$1; srv=$2; gw=$3; mask=$4;
|
||||
hostname=$5; dev=$6; autoconf=$7; mtu=$8;
|
||||
2) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2 ;;
|
||||
3) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3 ;;
|
||||
4) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3; [ -n "$4" ] && macaddr=$4 ;;
|
||||
*) [ -n "$1" ] && ip=$1; [ -n "$2" ] && srv=$2; [ -n "$3" ] && gw=$3; [ -n "$4" ] && mask=$4;
|
||||
[ -n "$5" ] && hostname=$5; [ -n "$6" ] && dev=$6; [ -n "$7" ] && autoconf=$7; [ -n "$8" ] && mtu=$8;
|
||||
if [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
|
||||
macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
|
||||
fi
|
||||
@@ -365,3 +366,7 @@ linkup() {
|
||||
&& wait_for_if_up $1 2>/dev/null
|
||||
}
|
||||
|
||||
type hostname >/dev/null 2>&1 || \
|
||||
hostname() {
|
||||
cat /proc/sys/kernel/hostname
|
||||
}
|
||||
|
@@ -24,9 +24,6 @@ netif=$1
|
||||
# handlers when this is not called from manually network bringing up.
|
||||
if [ -z "$2" ]; then
|
||||
if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
|
||||
# Unset root so we can check later
|
||||
unset root
|
||||
|
||||
# Load dhcp options
|
||||
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
|
||||
|
||||
@@ -67,6 +64,7 @@ source_hook netroot $netif
|
||||
# Run the handler; don't store the root, it may change from device to device
|
||||
# XXX other variables to export?
|
||||
if $handler $netif $netroot $NEWROOT; then
|
||||
rm -f $hookdir/initqueue/finished/dhcp.sh
|
||||
# Network rootfs mount successful - save interface info for ifcfg etc.
|
||||
save_netinfo $netif
|
||||
fi
|
||||
|
@@ -54,8 +54,8 @@ if getarg bond >/dev/null; then
|
||||
fi
|
||||
# Make it suitable for initscripts export
|
||||
bondoptions=$(str_replace "$bondoptions" ";" ",")
|
||||
echo "bondname=$bondname" > /tmp/bond.info
|
||||
echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.info
|
||||
echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.info
|
||||
echo "bondname=$bondname" > /tmp/bond.${bondname}.info
|
||||
echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.${bondname}.info
|
||||
echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.${bondname}.info
|
||||
return
|
||||
fi
|
||||
|
@@ -37,12 +37,6 @@ parsebridge() {
|
||||
unset bridgename ethnames
|
||||
|
||||
iface=eth0
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
if [ -n "$bondname" ] ; then
|
||||
iface=$bondname
|
||||
fi
|
||||
fi
|
||||
|
||||
# Parse bridge for bridgename and ethnames
|
||||
if bridge="$(getarg bridge)"; then
|
||||
|
@@ -54,6 +54,12 @@ fi
|
||||
for p in $(getargs ip=); do
|
||||
ip_to_var $p
|
||||
|
||||
# make first device specified the BOOTDEV
|
||||
if [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then
|
||||
BOOTDEV="$dev"
|
||||
[ -n "$NEEDBOOTDEV" ] && warn "Setting bootdev to '$BOOTDEV'"
|
||||
fi
|
||||
|
||||
# skip ibft since we did it above
|
||||
[ "$autoconf" = "ibft" ] && continue
|
||||
|
||||
@@ -121,6 +127,3 @@ fi
|
||||
# Store BOOTDEV and IFACES for later use
|
||||
[ -n "$BOOTDEV" ] && echo $BOOTDEV > /tmp/net.bootdev
|
||||
[ -n "$IFACES" ] && echo $IFACES > /tmp/net.ifaces
|
||||
|
||||
# We need a ip= line for the configured bootdev=
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$BOOTDEVOK" ] && die "Bootdev Argument '$BOOTDEV' not found"
|
||||
|
@@ -4,14 +4,6 @@
|
||||
|
||||
# NFS root might have reached here before /tmp/net.ifaces was written
|
||||
udevadm settle --timeout=30
|
||||
# Don't write anything if we don't know our bootdev
|
||||
[ -f /tmp/net.ifaces ] || return 1
|
||||
|
||||
read IFACES < /tmp/net.ifaces
|
||||
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
fi
|
||||
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
@@ -83,12 +75,27 @@ print_s390() {
|
||||
echo "OPTIONS=\"${OPTIONS}\""
|
||||
}
|
||||
|
||||
for netup in /tmp/net.*.did-setup ; do
|
||||
[ -f $netup ] || continue
|
||||
|
||||
for netif in $IFACES ; do
|
||||
netif=${netup%%.did-setup}
|
||||
netif=${netif##*/net.}
|
||||
[ -e /tmp/ifcfg/ifcfg-$netif ] && continue
|
||||
# bridge?
|
||||
unset bridge
|
||||
unset bond
|
||||
unset bondslaves
|
||||
unset bondname
|
||||
unset bondoptions
|
||||
unset uuid
|
||||
unset ip
|
||||
unset gw
|
||||
unset mtu
|
||||
unset mask
|
||||
unset macaddr
|
||||
unset slave
|
||||
unset ethname
|
||||
[ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info
|
||||
|
||||
uuid=$(cat /proc/sys/kernel/random/uuid)
|
||||
if [ "$netif" = "$bridgename" ]; then
|
||||
bridge=yes
|
||||
@@ -99,39 +106,46 @@ for netif in $IFACES ; do
|
||||
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$netif"
|
||||
echo "DEVICE=\"$netif\""
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "UUID=$uuid"
|
||||
[ -n "$mtu" ] && echo "MTU=$mtu"
|
||||
if [ -f /tmp/net.$netif.lease ]; then
|
||||
strstr "$ip" '*:*:*' &&
|
||||
echo "IPV6INIT=yes"
|
||||
echo "DHCPV6C=yes"
|
||||
echo "BOOTPROTO=dhcp"
|
||||
cp /tmp/net.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease
|
||||
echo "UUID=\"$uuid\""
|
||||
if [ -f /tmp/dhclient.$netif.lease ]; then
|
||||
[ -f /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
|
||||
strstr "$ip" '*:*:*' && echo "IPV6INIT=yes"
|
||||
if [ -f /tmp/net.$netif.has_ibft_config ]; then
|
||||
echo "BOOTPROTO=ibft"
|
||||
else
|
||||
echo "BOOTPROTO=dhcp"
|
||||
fi
|
||||
cp /tmp/dhclient.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease
|
||||
else
|
||||
# If we've booted with static ip= lines, the override file is there
|
||||
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
if strstr "$ip" '*:*:*'; then
|
||||
echo "IPV6INIT=yes"
|
||||
echo "IPV6_AUTOCONF=no"
|
||||
echo "IPV6ADDR=$ip/$mask"
|
||||
echo "IPV6ADDR=\"$ip/$mask\""
|
||||
else
|
||||
echo "BOOTPROTO=none"
|
||||
echo "IPADDR=$ip"
|
||||
if strstr "$mask" "."; then
|
||||
echo "NETMASK=$mask"
|
||||
if [ -f /tmp/net.$netif.has_ibft_config ]; then
|
||||
echo "BOOTPROTO=ibft"
|
||||
else
|
||||
echo "PREFIX=$mask"
|
||||
echo "BOOTPROTO=none"
|
||||
echo "IPADDR=\"$ip\""
|
||||
if strstr "$mask" "."; then
|
||||
echo "NETMASK=\"$mask\""
|
||||
else
|
||||
echo "PREFIX=\"$mask\""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if strstr "$gw" '*:*:*'; then
|
||||
echo "IPV6_DEFAULTGW=$gw"
|
||||
echo "IPV6_DEFAULTGW=\"$gw\""
|
||||
elif [ -n "$gw" ]; then
|
||||
echo "GATEWAY=$gw"
|
||||
echo "GATEWAY=\"$gw\""
|
||||
fi
|
||||
fi
|
||||
[ -n "$mtu" ] && echo "MTU=\"$mtu\""
|
||||
} > /tmp/ifcfg/ifcfg-$netif
|
||||
|
||||
# bridge needs different things written to ifcfg
|
||||
@@ -139,14 +153,14 @@ for netif in $IFACES ; do
|
||||
# standard interface
|
||||
{
|
||||
if [ -n "$macaddr" ]; then
|
||||
echo "MACADDR=$macaddr"
|
||||
echo "MACADDR=\"$macaddr\""
|
||||
else
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
|
||||
fi
|
||||
print_s390 $netif
|
||||
echo "TYPE=Ethernet"
|
||||
echo "NAME=\"Boot Disk\""
|
||||
[ -n "$mtu" ] && echo "MTU=$mtu"
|
||||
echo "NAME=\"$netif\""
|
||||
[ -n "$mtu" ] && echo "MTU=\"$mtu\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
fi
|
||||
|
||||
@@ -155,22 +169,22 @@ for netif in $IFACES ; do
|
||||
{
|
||||
# This variable is an indicator of a bond interface for initscripts
|
||||
echo "BONDING_OPTS=\"$bondoptions\""
|
||||
echo "NAME=\"Boot Disk\""
|
||||
echo "NAME=\"$netif\""
|
||||
echo "TYPE=Bond"
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
|
||||
for slave in $bondslaves ; do
|
||||
# Set ONBOOT=no to prevent initscripts from trying to setup already bonded physical interface
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$slave"
|
||||
echo "DEVICE=\"$slave\""
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=no"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$slave/address)"
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
|
||||
echo "SLAVE=yes"
|
||||
echo "MASTER=$netif"
|
||||
echo "NAME=$slave"
|
||||
echo "MASTER=\"$netif\""
|
||||
echo "NAME=\"$slave\""
|
||||
} >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
fi
|
||||
@@ -179,52 +193,50 @@ for netif in $IFACES ; do
|
||||
# bridge
|
||||
{
|
||||
echo "TYPE=Bridge"
|
||||
echo "NAME=\"Boot Disk\""
|
||||
echo "NAME=\"$netif\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
{
|
||||
# Set ONBOOT=no to prevent initscripts from trying to setup already bridged bond interface
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$bondname"
|
||||
echo "ONBOOT=no"
|
||||
echo "DEVICE=\"$bondname\""
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
# This variable is an indicator of a bond interface for initscripts
|
||||
echo "BONDING_OPTS=\"$bondoptions\""
|
||||
echo "BRIDGE=$netif"
|
||||
echo "BRIDGE=\"$netif\""
|
||||
echo "NAME=\"$bondname\""
|
||||
} >> /tmp/ifcfg/ifcfg-$bondname
|
||||
for slave in $bondslaves ; do
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
# Set ONBOOT=no to prevent initscripts from trying to setup already bridged physical interface
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$slave"
|
||||
echo "DEVICE=\"$slave\""
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=no"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$slave/address)"
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
|
||||
echo "SLAVE=yes"
|
||||
echo "MASTER=$bondname"
|
||||
echo "NAME=$slave"
|
||||
echo "MASTER=\"$bondname\""
|
||||
echo "NAME=\"$slave\""
|
||||
} >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
else
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$ethname"
|
||||
echo "DEVICE=\"$ethname\""
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=no"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$ethname/address)"
|
||||
echo "BRIDGE=$netif"
|
||||
echo "NAME=$ethname"
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$ethname/address)\""
|
||||
echo "BRIDGE=\"$netif\""
|
||||
echo "NAME=\"$ethname\""
|
||||
} >> /tmp/ifcfg/ifcfg-$ethname
|
||||
fi
|
||||
fi
|
||||
i=1
|
||||
for ns in $(getargs nameserver); do
|
||||
echo "DNS${i}=${ns}" >> /tmp/ifcfg/ifcfg-$netif
|
||||
echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-$netif
|
||||
i=$((i+1))
|
||||
done
|
||||
done
|
||||
|
@@ -12,6 +12,7 @@ depends() {
|
||||
}
|
||||
|
||||
install() {
|
||||
local _dir _crt _found
|
||||
inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
|
||||
dracut_install curl
|
||||
# also install libs for curl https
|
||||
@@ -20,11 +21,17 @@ install() {
|
||||
inst_libdir_file "libsoftokn3.so*"
|
||||
inst_libdir_file "libsqlite3.so*"
|
||||
|
||||
mkdir -m 0755 -p "$initdir/etc/ssl/certs"
|
||||
if ! inst_any -t /etc/ssl/certs/ca-bundle.crt \
|
||||
/etc/ssl/certs/ca-bundle.crt \
|
||||
/etc/ssl/certs/ca-certificates.crt; then
|
||||
dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
|
||||
fi
|
||||
for _dir in $libdirs; do
|
||||
[[ -d $_dir ]] || continue
|
||||
_crt=$(grep -F --binary-files=text -z .crt $_dir/libcurl.so)
|
||||
[[ $_crt ]] || continue
|
||||
[[ $_crt == /*/* ]] || continue
|
||||
if ! inst_simple "$_crt"; then
|
||||
dwarn "Couldn't install '$_crt' SSL CA cert bundle; HTTPS might not work."
|
||||
continue
|
||||
fi
|
||||
_found=1
|
||||
done
|
||||
[[ $_found ]] || dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
|
||||
}
|
||||
|
||||
|
@@ -54,8 +54,11 @@ add_url_handler() {
|
||||
|
||||
export CURL_HOME="/run/initramfs/url-lib"
|
||||
mkdir -p $CURL_HOME
|
||||
curl_args="--location --retry 3 --fail --show-error"
|
||||
getargbool 0 rd.noverifyssl && curl_args+=" --insecure"
|
||||
curl_args="--globoff --location --retry 3 --fail --show-error"
|
||||
getargbool 0 rd.noverifyssl && curl_args="$curl_args --insecure"
|
||||
|
||||
proxy=$(getarg proxy=)
|
||||
[ -n "$proxy" ] && curl_args="$curl_args --proxy $proxy"
|
||||
|
||||
curl_fetch_url() {
|
||||
local url="$1" outloc="$2"
|
||||
|
@@ -3,7 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
return 0
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
@@ -54,7 +54,7 @@ installkernel() {
|
||||
# as we could e.g. be in the installer; nokmsboot boot parameter will disable
|
||||
# loading of the driver if needed
|
||||
if [[ $hostonly ]] && modinfo -F alias $_modname | sed -e 's,\?,\.,g' -e 's,\*,\.\*,g' \
|
||||
| grep -qxf - /sys/bus/pci/devices/*/modalias; then
|
||||
| grep -qxf - /sys/bus/pci/devices/*/modalias 2>/dev/null; then
|
||||
hostonly='' instmods $_modname
|
||||
continue
|
||||
fi
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
[[ -x /sbin/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]]
|
||||
type -P plymouthd >/dev/null && type -P plymouth >/dev/null
|
||||
}
|
||||
|
||||
depends() {
|
||||
@@ -17,12 +17,16 @@ install() {
|
||||
. "$moddir"/plymouth-populate-initrd.sh
|
||||
else
|
||||
PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
|
||||
/usr/libexec/plymouth/plymouth-populate-initrd -t $initdir
|
||||
/usr/libexec/plymouth/plymouth-populate-initrd -t "$initdir"
|
||||
fi
|
||||
|
||||
inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
|
||||
inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
|
||||
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
|
||||
|
||||
dracut_install readlink
|
||||
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
|
||||
inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
|
||||
fi
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --hide-splash
|
||||
plymouth --hide-splash 2>/dev/null || :
|
||||
|
@@ -2,6 +2,6 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if [ -x /bin/plymouth -a -z "$DRACUT_SYSTEMD" ]; then
|
||||
/bin/plymouth --newroot=$NEWROOT
|
||||
if type plymouth >/dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
plymouth --newroot=$NEWROOT
|
||||
fi
|
||||
|
@@ -4,15 +4,14 @@
|
||||
PLYMOUTH_LOGO_FILE="/usr/share/pixmaps/system-logo-white.png"
|
||||
PLYMOUTH_THEME=$(plymouth-set-default-theme)
|
||||
|
||||
inst /sbin/plymouthd /bin/plymouthd
|
||||
dracut_install /bin/plymouth \
|
||||
dracut_install plymouthd plymouth \
|
||||
"${PLYMOUTH_LOGO_FILE}" \
|
||||
/etc/system-release
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/usr/share/plymouth"
|
||||
|
||||
inst_libdir_file "plymouth/text.so" "plymouth/details.so"
|
||||
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
dracut_install \
|
||||
"/usr/share/plymouth/themes/details/details.plymouth" \
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if [ -x /bin/plymouthd -a -z "$DRACUT_SYSTEMD" ]; then
|
||||
if type plymouthd >/dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
if getargbool 1 plymouth.enable && getargbool 1 rd.plymouth -d -n rd_NO_PLYMOUTH; then
|
||||
# first trigger graphics subsystem
|
||||
udevadm trigger --action=add --attr-match=class=0x030000 >/dev/null 2>&1
|
||||
@@ -16,8 +16,8 @@ if [ -x /bin/plymouthd -a -z "$DRACUT_SYSTEMD" ]; then
|
||||
read consoledev rest < /sys/class/tty/console/active
|
||||
consoledev=${consoledev:-tty0}
|
||||
[ -x /lib/udev/console_init -a -e "/dev/$consoledev" ] && /lib/udev/console_init "/dev/$consoledev"
|
||||
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session --pid-file /run/plymouth/pid
|
||||
/bin/plymouth --show-splash 2>&1 | vinfo
|
||||
plymouthd --attach-to-session --pid-file /run/plymouth/pid
|
||||
plymouth --show-splash 2>&1 | vinfo
|
||||
# reset tty after plymouth messed with it
|
||||
[ -x /lib/udev/console_init -a -e "/dev/$consoledev" ] && /lib/udev/console_init "/dev/$consoledev"
|
||||
fi
|
||||
|
@@ -27,7 +27,7 @@ else
|
||||
fi
|
||||
|
||||
{
|
||||
echo "ip=$IPADDR::$GATEWAY:$NETMASK:$HOSTNAME:$DEVICE:none:$MACADDR"
|
||||
echo "ip=$IPADDR::$GATEWAY:$NETMASK:$HOSTNAME:$DEVICE:none:$MTU:$MACADDR"
|
||||
for i in $DNS1 $DNS2; do
|
||||
echo "nameserver=$i"
|
||||
done
|
||||
|
@@ -51,152 +51,152 @@ function dasd_settle_all() {
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
# prints a canonocalized device bus ID for a given devno of any format
|
||||
function canonicalize_devno()
|
||||
{
|
||||
case ${#1} in
|
||||
3) echo "0.0.0${1}" ;;
|
||||
4) echo "0.0.${1}" ;;
|
||||
*) echo "${1}" ;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
function canonicalize_devno()
|
||||
{
|
||||
case ${#1} in
|
||||
3) echo "0.0.0${1}" ;;
|
||||
4) echo "0.0.${1}" ;;
|
||||
*) echo "${1}" ;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
# read file from CMS and write it to /tmp
|
||||
function readcmsfile() # $1=dasdport $2=filename
|
||||
{
|
||||
local dev
|
||||
local numcpus
|
||||
local devname
|
||||
local ret=0
|
||||
if [ $# -ne 2 ]; then return; fi
|
||||
function readcmsfile() # $1=dasdport $2=filename
|
||||
{
|
||||
local dev
|
||||
local numcpus
|
||||
local devname
|
||||
local ret=0
|
||||
if [ $# -ne 2 ]; then return; fi
|
||||
# precondition: udevd created dasda block device node
|
||||
if ! dasd_cio_free -d $1 ; then
|
||||
echo $"DASD $1 could not be cleared from device blacklist"
|
||||
return 1
|
||||
fi
|
||||
if ! dasd_cio_free -d $1 ; then
|
||||
echo $"DASD $1 could not be cleared from device blacklist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
modprobe dasd_mod dasd=$CMSDASD
|
||||
modprobe dasd_eckd_mod
|
||||
udevadm settle
|
||||
modprobe dasd_mod dasd=$CMSDASD
|
||||
modprobe dasd_eckd_mod
|
||||
udevadm settle
|
||||
|
||||
# precondition: dasd_eckd_mod driver incl. dependencies loaded,
|
||||
# dasd_mod must be loaded without setting any DASD online
|
||||
dev=$(canonicalize_devno $1)
|
||||
numcpus=$(
|
||||
while read line; do
|
||||
if strstr "$line" "# processors"; then
|
||||
echo ${line##*:};
|
||||
break;
|
||||
fi;
|
||||
done < /proc/cpuinfo
|
||||
)
|
||||
dev=$(canonicalize_devno $1)
|
||||
numcpus=$(
|
||||
while read line; do
|
||||
if strstr "$line" "# processors"; then
|
||||
echo ${line##*:};
|
||||
break;
|
||||
fi;
|
||||
done < /proc/cpuinfo
|
||||
)
|
||||
|
||||
if [ ${numcpus} -eq 1 ]; then
|
||||
echo 1 > /sys/bus/ccw/devices/$dev/online
|
||||
else
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 1; then
|
||||
echo $"DASD $dev could not be set online"
|
||||
return 1
|
||||
if [ ${numcpus} -eq 1 ]; then
|
||||
echo 1 > /sys/bus/ccw/devices/$dev/online
|
||||
else
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 1; then
|
||||
echo $"DASD $dev could not be set online"
|
||||
return 1
|
||||
fi
|
||||
udevadm settle
|
||||
if ! dasd_settle $dev ; then
|
||||
echo $"Could not access DASD $dev in time"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
udevadm settle
|
||||
if ! dasd_settle $dev ; then
|
||||
echo $"Could not access DASD $dev in time"
|
||||
return 1
|
||||
|
||||
devname=$(cd /sys/bus/ccw/devices/$dev/block; set -- *; [ -b /dev/$1 ] && echo $1)
|
||||
devname=${devname:-dasda}
|
||||
|
||||
[[ -d /mnt ]] || mkdir /mnt
|
||||
if cmsfs-fuse --to=UTF-8 -a /dev/$devname /mnt; then
|
||||
cat /mnt/$2 > /run/initramfs/$2
|
||||
umount /mnt || umount -l /mnt
|
||||
udevadm settle
|
||||
else
|
||||
echo $"Could not read conf file $2 on CMS DASD $1."
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
|
||||
udevadm settle
|
||||
|
||||
devname=$(cd /sys/bus/ccw/devices/$dev/block; set -- *; [ -b /dev/$1 ] && echo $1)
|
||||
devname=${devname:-dasda}
|
||||
|
||||
[[ -d /mnt ]] || mkdir /mnt
|
||||
if cmsfs-fuse --to=UTF-8 -a /dev/$devname /mnt; then
|
||||
cat /mnt/$2 > /run/initramfs/$2
|
||||
umount /mnt || umount -l /mnt
|
||||
udevadm settle
|
||||
else
|
||||
echo $"Could not read conf file $2 on CMS DASD $1."
|
||||
ret=1
|
||||
fi
|
||||
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 0; then
|
||||
echo $"DASD $dev could not be set offline again"
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 0; then
|
||||
echo $"DASD $dev could not be set offline again"
|
||||
#return 1
|
||||
fi
|
||||
udevadm settle
|
||||
fi
|
||||
udevadm settle
|
||||
|
||||
# unbind all dasds to unload the dasd modules for a clean start
|
||||
( cd /sys/bus/ccw/drivers/dasd-eckd; for i in *.*; do echo $i > unbind;done)
|
||||
udevadm settle
|
||||
modprobe -r dasd_eckd_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_diag_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_mod
|
||||
udevadm settle
|
||||
return $ret
|
||||
}
|
||||
( cd /sys/bus/ccw/drivers/dasd-eckd; for i in *.*; do echo $i > unbind;done)
|
||||
udevadm settle
|
||||
modprobe -r dasd_eckd_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_diag_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_mod
|
||||
udevadm settle
|
||||
return $ret
|
||||
}
|
||||
|
||||
processcmsfile()
|
||||
{
|
||||
source /tmp/cms.conf
|
||||
processcmsfile()
|
||||
{
|
||||
source /tmp/cms.conf
|
||||
|
||||
if [[ $NETTYPE ]]; then
|
||||
(
|
||||
echo -n $NETTYPE,$SUBCHANNELS
|
||||
[[ $PORTNAME ]] && echo ",portname=$PORTNAME"
|
||||
[[ $LAYER2 ]] && echo ",layer2=$LAYER"
|
||||
[[ "$NETTYPE" = "ctc" ]] && [[ $CTCPROT ]] && echo ",protocol=$CTCPROT"
|
||||
echo
|
||||
) >> /etc/ccw.conf
|
||||
if [[ $NETTYPE ]]; then
|
||||
(
|
||||
echo -n $NETTYPE,$SUBCHANNELS
|
||||
[[ $PORTNAME ]] && echo -n ",portname=$PORTNAME"
|
||||
[[ $LAYER2 ]] && echo -n ",layer2=$LAYER2"
|
||||
[[ "$NETTYPE" = "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
|
||||
echo
|
||||
) >> /etc/ccw.conf
|
||||
|
||||
OLDIFS=$IFS
|
||||
IFS=,
|
||||
read -a subch_array <<< "indexzero,$SUBCHANNELS"
|
||||
IFS=$OLDIFS
|
||||
devbusid=${subch_array[1]}
|
||||
if [ "$NETTYPE" = "ctc" ]; then
|
||||
driver="ctcm"
|
||||
else
|
||||
driver=$NETTYPE
|
||||
OLDIFS=$IFS
|
||||
IFS=,
|
||||
read -a subch_array <<< "indexzero,$SUBCHANNELS"
|
||||
IFS=$OLDIFS
|
||||
devbusid=${subch_array[1]}
|
||||
if [ "$NETTYPE" = "ctc" ]; then
|
||||
driver="ctcm"
|
||||
else
|
||||
driver=$NETTYPE
|
||||
fi
|
||||
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
|
||||
# remove the default net rules
|
||||
rm -f /etc/udev/rules.d/91-default-net.rules
|
||||
[[ -f /etc/udev/rules.d/90-net.rules ]] \
|
||||
|| printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
|
||||
udevadm control --reload
|
||||
znet_cio_free
|
||||
fi
|
||||
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
|
||||
# remove the default net rules
|
||||
rm -f /etc/udev/rules.d/91-default-net.rules
|
||||
[[ -f /etc/udev/rules.d/90-net.rules ]] \
|
||||
|| printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
|
||||
if [[ $DASD ]]; then
|
||||
echo $DASD | normalize_dasd_arg > /etc/dasd.conf
|
||||
echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf
|
||||
dasd_cio_free
|
||||
fi
|
||||
|
||||
znet_cio_free
|
||||
fi
|
||||
unset _do_zfcp
|
||||
for i in ${!FCP_*}; do
|
||||
echo "${!i}" >> /etc/zfcp.conf
|
||||
_do_zfcp=1
|
||||
done
|
||||
[[ $_do_zfcp ]] && zfcp_cio_free
|
||||
unset _do_zfcp
|
||||
}
|
||||
|
||||
if [[ $DASD ]]; then
|
||||
echo $DASD | normalize_dasd_arg > /etc/dasd.conf
|
||||
echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf
|
||||
dasd_cio_free
|
||||
fi
|
||||
|
||||
unset _do_zfcp
|
||||
for i in ${!FCP_*}; do
|
||||
echo "${!i}" >> /etc/zfcp.conf
|
||||
_do_zfcp=1
|
||||
done
|
||||
[[ $_do_zfcp ]] && zfcp_cio_free
|
||||
unset _do_zfcp
|
||||
}
|
||||
|
||||
[[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=")
|
||||
[[ $CMSCONFFILE ]] || CMSCONFFILE=$(getarg "CMSCONFFILE=")
|
||||
[[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=")
|
||||
[[ $CMSCONFFILE ]] || CMSCONFFILE=$(getarg "CMSCONFFILE=")
|
||||
|
||||
# Parse configuration
|
||||
if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then
|
||||
if readcmsfile $CMSDASD $CMSCONFFILE; then
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/$CMSCONFFILE
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/cms.conf
|
||||
processcmsfile
|
||||
if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then
|
||||
if readcmsfile $CMSDASD $CMSCONFFILE; then
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/$CMSCONFFILE
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/cms.conf
|
||||
processcmsfile
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@@ -29,4 +29,5 @@ install() {
|
||||
|
||||
inst_libdir_file "gconv/*"
|
||||
#inst /usr/lib/locale/locale-archive
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -1,11 +1,8 @@
|
||||
SUBSYSTEM!="block", GOTO="btrfs_end"
|
||||
ACTION!="add|change", GOTO="btrfs_end"
|
||||
ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end"
|
||||
RUN+="/sbin/modprobe btrfs"
|
||||
RUN+="/sbin/btrfs device scan $env{DEVNAME}"
|
||||
|
||||
RUN+="/sbin/initqueue --finished --unique --name btrfs_finished /sbin/btrfs_finished"
|
||||
RUN+="/sbin/initqueue --timeout --onetime --unique --name btrfs_timeout /sbin/btrfs_timeout"
|
||||
|
||||
LABEL="btrfs_end"
|
||||
|
||||
|
21
modules.d/90btrfs/btrfs_device_ready.sh
Executable file
21
modules.d/90btrfs/btrfs_device_ready.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
btrfs_check_complete() {
|
||||
local _rootinfo _dev
|
||||
_dev="${1:-/dev/root}"
|
||||
[ -e "$_dev" ] || return 0
|
||||
_rootinfo=$(udevadm info --query=env "--name=$_dev" 2>/dev/null)
|
||||
if strstr "$_rootinfo" "ID_FS_TYPE=btrfs"; then
|
||||
info "Checking, if btrfs device complete"
|
||||
btrfs device ready "$_dev" >/dev/null 2>&1
|
||||
return $?
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
btrfs_check_complete $1
|
||||
exit $?
|
@@ -5,5 +5,4 @@
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
info "Scanning for all btrfs devices"
|
||||
/sbin/btrfs device scan 2>&1 | vinfo
|
||||
exit 0
|
||||
/sbin/btrfs device scan >/dev/null 2>&1
|
||||
|
@@ -9,12 +9,10 @@ check() {
|
||||
type -P btrfs >/dev/null || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
local _found
|
||||
for fs in ${host_fs_types[@]}; do
|
||||
strstr "$fs" "\|btrfs" && _found="1"
|
||||
[[ "$fs" == "btrfs" ]] && return 0
|
||||
done
|
||||
[[ $_found ]] || return 1
|
||||
unset _found
|
||||
return 255
|
||||
}
|
||||
|
||||
return 0
|
||||
@@ -30,10 +28,22 @@ installkernel() {
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_rules "$moddir/80-btrfs.rules"
|
||||
inst_script "$moddir/btrfs_finished.sh" /sbin/btrfs_finished
|
||||
inst_script "$moddir/btrfs_timeout.sh" /sbin/btrfs_timeout
|
||||
dracut_install btrfsck
|
||||
if ! inst_rules 64-btrfs.rules; then
|
||||
inst_rules "$moddir/80-btrfs.rules"
|
||||
case "$(btrfs --help)" in
|
||||
*device\ ready*)
|
||||
inst_script "$moddir/btrfs_device_ready.sh" /sbin/btrfs_finished ;;
|
||||
*)
|
||||
inst_script "$moddir/btrfs_finished.sh" /sbin/btrfs_finished ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_script "$moddir/btrfs_timeout.sh" \
|
||||
/usr/lib/dracut/hooks/initqueue/timeout/btrfs_timeout.sh
|
||||
fi
|
||||
|
||||
dracut_install -o btrfsck btrfs-zero-log
|
||||
inst $(command -v btrfs) /sbin/btrfs
|
||||
}
|
||||
|
||||
|
@@ -47,8 +47,8 @@ ask_for_password() {
|
||||
|
||||
{ flock -s 9;
|
||||
# Prompt for password with plymouth, if installed and running.
|
||||
if [ -x /bin/plymouth ] && /bin/plymouth --ping; then
|
||||
/bin/plymouth ask-for-password \
|
||||
if type plymouth >/dev/null 2>&1 && plymouth --ping 2>/dev/null; then
|
||||
plymouth ask-for-password \
|
||||
--prompt "$ply_prompt" --number-of-tries=$ply_tries \
|
||||
--command="$ply_cmd"
|
||||
ret=$?
|
||||
|
@@ -7,25 +7,11 @@ check() {
|
||||
# if cryptsetup is not installed, then we cannot support encrypted devices.
|
||||
type -P cryptsetup >/dev/null || return 1
|
||||
|
||||
check_crypt() {
|
||||
local dev=$1 fs=$2
|
||||
[[ $fs = "crypto_LUKS" ]] || return 1
|
||||
ID_FS_UUID=$(udevadm info --query=property --name=$dev \
|
||||
| while read line; do
|
||||
[[ ${line#ID_FS_UUID} = $line ]] && continue
|
||||
eval "$line"
|
||||
echo $ID_FS_UUID
|
||||
break
|
||||
done)
|
||||
[[ ${ID_FS_UUID} ]] || return 1
|
||||
if ! [[ $kernel_only ]]; then
|
||||
echo " rd.luks.uuid=luks-${ID_FS_UUID} " >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_fs check_crypt || return 1
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ $fs = "crypto_LUKS" ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
|
||||
return 0
|
||||
@@ -41,13 +27,55 @@ installkernel() {
|
||||
}
|
||||
|
||||
install() {
|
||||
|
||||
check_crypt() {
|
||||
local dev=$1 fs=$2
|
||||
|
||||
[[ $fs = "crypto_LUKS" ]] || return 1
|
||||
ID_FS_UUID=$(udevadm info --query=property --name=$dev \
|
||||
| while read line; do
|
||||
[[ ${line#ID_FS_UUID} = $line ]] && continue
|
||||
eval "$line"
|
||||
echo $ID_FS_UUID
|
||||
break
|
||||
done)
|
||||
[[ ${ID_FS_UUID} ]] || return 1
|
||||
if ! [[ $kernel_only ]]; then
|
||||
echo " rd.luks.uuid=luks-${ID_FS_UUID} " >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
for_each_host_dev_fs check_crypt
|
||||
|
||||
dracut_install cryptsetup rmdir readlink umount
|
||||
inst_script "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
|
||||
inst_script "$moddir"/probe-keydev.sh /sbin/probe-keydev
|
||||
inst_hook cmdline 10 "$moddir/parse-keydev.sh"
|
||||
inst_hook cmdline 30 "$moddir/parse-crypt.sh"
|
||||
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
|
||||
[[ $hostonly ]] && inst_simple /etc/crypttab
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
|
||||
fi
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
# filter /etc/crypttab for the devices we need
|
||||
while read _mapper _dev _rest; do
|
||||
[[ $_mapper = \#* ]] && continue
|
||||
[[ $_dev ]] || continue
|
||||
|
||||
[[ $_dev == UUID=* ]] && \
|
||||
_dev="/dev/disk/by-uuid/${_dev#UUID=}"
|
||||
|
||||
for _hdev in "${!host_fs_types[@]}"; do
|
||||
[[ ${host_fs_types[$_hdev]} == "crypto_LUKS" ]] || continue
|
||||
if [[ $_hdev -ef $_dev ]] || [[ /dev/block/$_hdev -ef $_dev ]]; then
|
||||
echo "$_mapper $_dev $_rest"
|
||||
break
|
||||
fi
|
||||
done
|
||||
done < /etc/crypttab > $initdir/etc/crypttab
|
||||
fi
|
||||
|
||||
inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
|
||||
|
||||
dracut_install -o \
|
||||
@@ -60,4 +88,5 @@ install() {
|
||||
$systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \
|
||||
systemd-ask-password systemd-tty-ask-password-agent
|
||||
inst_script "$moddir"/crypt-run-generator.sh /sbin/crypt-run-generator
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -32,8 +32,8 @@ else
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
||||
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
||||
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
|
||||
printf -- '--name crypt-run-generator-%%k %s ' $(command -v crypt-run-generator)
|
||||
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID}"\n'
|
||||
printf -- '--name systemd-cryptsetup-%%k %s start ' $(command -v systemctl)
|
||||
printf -- 'systemd-cryptsetup@luks$$(dev_unit_name -$env{ID_FS_UUID}).service"\n'
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
fi
|
||||
|
||||
|
15
modules.d/90dm/59-persistent-storage-dm.rules
Normal file
15
modules.d/90dm/59-persistent-storage-dm.rules
Normal file
@@ -0,0 +1,15 @@
|
||||
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"
|
||||
|
||||
KERNEL!="dm-[0-9]*", GOTO="dm_end"
|
||||
ACTION=="add", GOTO="dm_end"
|
||||
IMPORT{program}="/sbin/dmsetup info -c --nameprefixes --unquoted --rows --noheadings -o name,uuid,suspended,readonly,major,minor,open,tables_loaded,names_using_dev -j%M -m%m"
|
||||
ENV{DM_NAME}!="?*", GOTO="dm_end"
|
||||
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="dm_end"
|
||||
ENV{DM_UUID}=="CRYPT-TEMP-?*", GOTO="dm_end"
|
||||
ENV{DM_UUID}!="?*", ENV{DM_NAME}=="temporary-cryptsetup-?*", GOTO="dm_end"
|
||||
IMPORT BLKID
|
||||
|
||||
LABEL="dm_end"
|
@@ -32,6 +32,9 @@ install() {
|
||||
|
||||
inst_rules "$moddir/11-dm.rules"
|
||||
|
||||
inst_rules "$moddir/59-persistent-storage-dm.rules"
|
||||
prepare_udev_rules 59-persistent-storage-dm.rules
|
||||
|
||||
inst_hook shutdown 30 "$moddir/dm-shutdown.sh"
|
||||
}
|
||||
|
||||
|
@@ -28,7 +28,7 @@ if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
|
||||
if [ "${s##$r}" != "$s" ]; then
|
||||
info "Activating $s"
|
||||
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
|
||||
[ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" 2>&1 | vinfo
|
||||
[ -e "/dev/mapper/$s" ] && kpartx -a "/dev/mapper/$s" 2>&1 | vinfo
|
||||
udevsettle
|
||||
fi
|
||||
done
|
||||
@@ -38,7 +38,7 @@ if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
|
||||
for s in $SETS; do
|
||||
info "Activating $s"
|
||||
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
|
||||
[ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" 2>&1 | vinfo
|
||||
[ -e "/dev/mapper/$s" ] && kpartx -a "/dev/mapper/$s" 2>&1 | vinfo
|
||||
done
|
||||
fi
|
||||
|
||||
|
@@ -8,9 +8,27 @@ check() {
|
||||
# in trying to support it in the initramfs.
|
||||
type -P dmraid >/dev/null || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ $fs = *_raid_member ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo dm rootfs-block
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
local _i
|
||||
|
||||
check_dmraid() {
|
||||
local dev=$1 fs=$2 holder DEVPATH DM_NAME
|
||||
[[ "$fs" = "${fs%%_raid_member}" ]] && return 1
|
||||
[[ "$fs" != *_raid_member ]] && return 1
|
||||
|
||||
DEVPATH=$(udevadm info --query=property --name=$dev \
|
||||
| while read line; do
|
||||
@@ -37,20 +55,8 @@ check() {
|
||||
return 0
|
||||
}
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_fs check_dmraid || return 1
|
||||
}
|
||||
for_each_host_dev_fs check_dmraid
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo dm rootfs-block
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
local _i
|
||||
dracut_install dmraid
|
||||
dracut_install -o kpartx
|
||||
inst $(command -v partx) /sbin/partx
|
||||
|
@@ -19,6 +19,9 @@ livedev="$1"
|
||||
# specified as their own things
|
||||
live_dir=$(getarg rd.live.dir -d live_dir)
|
||||
[ -z "$live_dir" ] && live_dir="LiveOS"
|
||||
squash_image=$(getarg rd.live.squashimg)
|
||||
[ -z "$squash_image" ] && squash_image="squashfs.img"
|
||||
|
||||
getargbool 0 rd.live.ram -d -y live_ram && live_ram="yes"
|
||||
getargbool 0 rd.live.overlay.reset -d -y reset_overlay && reset_overlay="yes"
|
||||
getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
|
||||
@@ -31,7 +34,7 @@ if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
|
||||
fi
|
||||
getarg rd.live.check -d check || check=""
|
||||
if [ -n "$check" ]; then
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --hide-splash
|
||||
type plymouth >/dev/null 2>&1 && plymouth --hide-splash
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
p=$(str_replace "$livedev" "-" '\x2d')
|
||||
systemctl start checkisomd5@${p}.service
|
||||
@@ -42,16 +45,19 @@ if [ -n "$check" ]; then
|
||||
die "CD check failed!"
|
||||
exit 1
|
||||
fi
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --show-splash
|
||||
type plymouth >/dev/null 2>&1 && plymouth --show-splash
|
||||
fi
|
||||
|
||||
ln -s $livedev /run/initramfs/livedev
|
||||
|
||||
# determine filesystem type for a filesystem image
|
||||
det_img_fs() {
|
||||
udevadm settle
|
||||
blkid -s TYPE -u noraid -o value "$1"
|
||||
}
|
||||
|
||||
modprobe squashfs
|
||||
|
||||
for arg in $CMDLINE; do case $arg in ro|rw) liverw=$arg ;; esac; done
|
||||
# mount the backing of the live image first
|
||||
mkdir -m 0755 -p /run/initramfs/live
|
||||
@@ -110,18 +116,34 @@ do_live_overlay() {
|
||||
umount -l /run/initramfs/overlayfs || :
|
||||
fi
|
||||
|
||||
if [ -z "$setup" ]; then
|
||||
if [ -n "$devspec" -a -n "$pathspec" ]; then
|
||||
if [ -z "$setup" -o -n "$readonly_overlay" ]; then
|
||||
if [ -n "$setup" ]; then
|
||||
warn "Using temporary overlay."
|
||||
elif [ -n "$devspec" -a -n "$pathspec" ]; then
|
||||
warn "Unable to find persistent overlay; using temporary"
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((512*1024)) 2> /dev/null
|
||||
losetup $OVERLAY_LOOPDEV /overlay
|
||||
if [ -n "$setup" -a -n "$readonly_overlay" ]; then
|
||||
RO_OVERLAY_LOOPDEV=$( losetup -f )
|
||||
losetup $RO_OVERLAY_LOOPDEV /overlay
|
||||
else
|
||||
losetup $OVERLAY_LOOPDEV /overlay
|
||||
fi
|
||||
fi
|
||||
|
||||
# set up the snapshot
|
||||
echo 0 `blockdev --getsz $BASE_LOOPDEV` snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create $readonly_overlay live-rw
|
||||
sz=$(blockdev --getsz $BASE_LOOPDEV)
|
||||
if [ -n "$readonly_overlay" ]; then
|
||||
echo 0 $sz snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create $readonly_overlay live-ro
|
||||
base="/dev/mapper/live-ro"
|
||||
over=$RO_OVERLAY_LOOPDEV
|
||||
else
|
||||
base=$BASE_LOOPDEV
|
||||
over=$OVERLAY_LOOPDEV
|
||||
fi
|
||||
echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw
|
||||
}
|
||||
|
||||
# live cd helper function
|
||||
@@ -161,8 +183,8 @@ if [ -n "$FSIMG" ] ; then
|
||||
fi
|
||||
|
||||
# we might have an embedded fs image on squashfs (compressed live)
|
||||
if [ -e /run/initramfs/live/${live_dir}/squashfs.img ]; then
|
||||
SQUASHED="/run/initramfs/live/${live_dir}/squashfs.img"
|
||||
if [ -e /run/initramfs/live/${live_dir}/${squash_image} ]; then
|
||||
SQUASHED="/run/initramfs/live/${live_dir}/${squash_image}"
|
||||
fi
|
||||
|
||||
if [ -e "$SQUASHED" ] ; then
|
||||
|
38
modules.d/90dmsquash-live/iso-scan.sh
Executable file
38
modules.d/90dmsquash-live/iso-scan.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
isofile=$1
|
||||
|
||||
[ -z "$isofile" ] && exit 1
|
||||
|
||||
ismounted "/run/initramfs/isoscan" && exit 1
|
||||
|
||||
mkdir -p "/run/initramfs/isoscan"
|
||||
|
||||
do_iso_scan() {
|
||||
local _name
|
||||
local dev
|
||||
for dev in /dev/disk/by-uuid/*; do
|
||||
_name=$(dev_unit_name "$dev")
|
||||
[ -e /tmp/isoscan-${_name} ] && continue
|
||||
> /tmp/isoscan-${_name}
|
||||
mount -t auto -o ro "$dev" "/run/initramfs/isoscan" || continue
|
||||
if [ -f "/run/initramfs/isoscan/$isofile" ]; then
|
||||
losetup -f "/run/initramfs/isoscan/$isofile"
|
||||
rm -f "$job"
|
||||
exit 0
|
||||
else
|
||||
umount "/run/initramfs/isoscan"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
do_iso_scan
|
||||
|
||||
rmdir "/run/initramfs/isoscan"
|
||||
exit 1
|
@@ -16,19 +16,21 @@ depends() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods squashfs loop
|
||||
instmods squashfs loop iso9660
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install umount dmsetup blkid dd losetup grep blockdev
|
||||
dracut_install -o checkisomd5
|
||||
inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
|
||||
inst_hook cmdline 31 "$moddir/parse-iso-scan.sh"
|
||||
inst_hook pre-udev 30 "$moddir/dmsquash-live-genrules.sh"
|
||||
inst_hook pre-udev 30 "$moddir/dmsquash-liveiso-genrules.sh"
|
||||
inst_hook pre-pivot 20 "$moddir/apply-live-updates.sh"
|
||||
inst_script "$moddir/dmsquash-live-root.sh" "/sbin/dmsquash-live-root"
|
||||
inst_script "$moddir/iso-scan.sh" "/sbin/iso-scan"
|
||||
# should probably just be generally included
|
||||
inst_rules 60-cdrom_id.rules
|
||||
inst_simple "$moddir/checkisomd5@.service" "/etc/systemd/system/checkisomd5@.service"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
14
modules.d/90dmsquash-live/parse-iso-scan.sh
Executable file
14
modules.d/90dmsquash-live/parse-iso-scan.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
# live images are specified with
|
||||
# root=live:backingdev
|
||||
|
||||
isofile=$(getarg iso-scan/filename)
|
||||
|
||||
if [ -n "$isofile" ]; then
|
||||
{
|
||||
printf 'KERNEL=="loop0", RUN+="/sbin/initqueue --settled --unique /sbin/iso-scan %s"\n' \
|
||||
"'${isofile}'"
|
||||
} >> /etc/udev/rules.d/99-isofile-mount.rules
|
||||
fi
|
@@ -35,15 +35,21 @@ installkernel() {
|
||||
return 0
|
||||
}
|
||||
|
||||
hostonly='' instmods sr_mod sd_mod scsi_dh scsi_dh_rdac scsi_dh_emc ata_piix \
|
||||
pcmcia firewire-ohci yenta_socket \
|
||||
usb_storage sdhci sdhci-pci \
|
||||
sdhci_esdhc_imx mmci sdhci_tegra mvsdio \
|
||||
omap omapdrm omap_hsmmc sdhci_dove ahci_platform pata_imx sata_mv \
|
||||
atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech \
|
||||
hid-logitech-dj hid-microsoft ehci-hcd ohci-hcd uhci-hcd xhci-hcd hid_generic \
|
||||
hostonly='' instmods sr_mod sd_mod scsi_dh ata_piix \
|
||||
ehci-hcd ehci-pci ehci-platform ohci-hcd uhci-hcd xhci-hcd hid_generic \
|
||||
unix
|
||||
|
||||
instmods yenta_socket scsi_dh_rdac scsi_dh_emc \
|
||||
atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech \
|
||||
hid-logitech-dj hid-microsoft firewire-ohci \
|
||||
pcmcia usb_storage nvme hid-hyperv hv-vmbus
|
||||
|
||||
if [[ "$(uname -p)" == arm* ]]; then
|
||||
# arm specific modules
|
||||
hostonly='' instmods sdhci_esdhc_imx mmci sdhci_tegra mvsdio omap omapdrm \
|
||||
omap_hsmmc panel-tfp410 sdhci_dove ahci_platform pata_imx sata_mv
|
||||
fi
|
||||
|
||||
# install virtual machine support
|
||||
instmods virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
|
||||
"=drivers/pcmcia" =ide "=drivers/usb/storage"
|
||||
@@ -59,18 +65,19 @@ installkernel() {
|
||||
instmods '=fs'
|
||||
fi
|
||||
else
|
||||
inst_fs() {
|
||||
[[ $2 ]] || return 1
|
||||
hostonly='' instmods $2
|
||||
}
|
||||
for_each_host_dev_fs inst_fs
|
||||
for i in $(host_fs_all); do
|
||||
hostonly='' instmods $i
|
||||
done
|
||||
fi
|
||||
fi
|
||||
:
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install -o /lib/modprobe.d/*.conf
|
||||
[[ $hostonly ]] && dracut_install -o /etc/modprobe.d/*.conf /etc/modprobe.conf
|
||||
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
|
||||
fi
|
||||
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
|
||||
}
|
||||
|
@@ -14,5 +14,6 @@ install() {
|
||||
inst_hook cmdline 29 "$moddir/parse-livenet.sh"
|
||||
inst_hook initqueue/online 95 "$moddir/fetch-liveupdate.sh"
|
||||
inst_script "$moddir/livenetroot.sh" "/sbin/livenetroot"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
@@ -3,26 +3,14 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
local _rootdev _activated
|
||||
# No point trying to support lvm if the binaries are missing
|
||||
type -P lvm >/dev/null || return 1
|
||||
|
||||
check_lvm() {
|
||||
local DM_VG_NAME DM_LV_NAME DM_UDEV_DISABLE_DISK_RULES_FLAG
|
||||
eval $(udevadm info --query=property --name=/dev/block/$1|egrep '(DM_VG_NAME|DM_LV_NAME|DM_UDEV_DISABLE_DISK_RULES_FLAG)=')
|
||||
[[ "$DM_UDEV_DISABLE_DISK_RULES_FLAG" = "1" ]] && return 1
|
||||
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
|
||||
if ! strstr " ${_activated[*]} " " ${DM_VG_NAME}/${DM_LV_NAME} "; then
|
||||
if ! [[ $kernel_only ]]; then
|
||||
echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
||||
fi
|
||||
push _activated "${DM_VG_NAME}/${DM_LV_NAME}"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_and_slaves check_lvm || return 1
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ $fs = LVM*_member ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
|
||||
return 0
|
||||
@@ -36,8 +24,31 @@ depends() {
|
||||
|
||||
install() {
|
||||
local _i
|
||||
local _needthin
|
||||
local _activated
|
||||
inst lvm
|
||||
|
||||
check_lvm() {
|
||||
local DM_VG_NAME DM_LV_NAME DM_UDEV_DISABLE_DISK_RULES_FLAG
|
||||
|
||||
eval $(udevadm info --query=property --name=$1 | egrep '(DM_VG_NAME|DM_LV_NAME|DM_UDEV_DISABLE_DISK_RULES_FLAG)=')
|
||||
[[ "$DM_UDEV_DISABLE_DISK_RULES_FLAG" = "1" ]] && return 1
|
||||
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
|
||||
if ! strstr " ${_activated[*]} " " ${DM_VG_NAME}/${DM_LV_NAME} "; then
|
||||
if ! [[ $kernel_only ]]; then
|
||||
echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
||||
fi
|
||||
push _activated "${DM_VG_NAME}/${DM_LV_NAME}"
|
||||
fi
|
||||
if ! [[ $_needthin ]]; then
|
||||
[[ $(lvs --noheadings -o segtype ${DM_VG_NAME}) == *thin* ]] && _needthin=1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
for_each_host_dev_fs check_lvm
|
||||
|
||||
inst_rules "$moddir/64-lvm.rules"
|
||||
|
||||
if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
|
||||
@@ -59,5 +70,10 @@ install() {
|
||||
inst_hook cmdline 30 "$moddir/parse-lvm.sh"
|
||||
|
||||
inst_libdir_file "libdevmapper-event-lvm*.so"
|
||||
|
||||
if [[ $_needthin ]]; then
|
||||
dracut_install -o thin_dump thin_restore thin_check
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
23
modules.d/90mdraid/59-persistent-storage-md.rules
Normal file
23
modules.d/90mdraid/59-persistent-storage-md.rules
Normal file
@@ -0,0 +1,23 @@
|
||||
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"
|
||||
|
||||
KERNEL!="md[0-9]*|md_d[0-9]*|md/*", KERNEL!="md*", GOTO="md_end"
|
||||
|
||||
# partitions have no md/{array_state,metadata_version}
|
||||
ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
|
||||
|
||||
# container devices have a metadata version of e.g. 'external:ddf' and
|
||||
# never leave state 'inactive'
|
||||
ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
|
||||
TEST!="md/array_state", GOTO="md_end"
|
||||
ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
|
||||
|
||||
LABEL="md_ignore_state"
|
||||
|
||||
IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
|
||||
IMPORT BLKID
|
||||
OPTIONS+="link_priority=100"
|
||||
OPTIONS+="watch"
|
||||
LABEL="md_end"
|
@@ -29,9 +29,6 @@ _md_force_run() {
|
||||
|
||||
_path_d="${_path_s%/*}/degraded"
|
||||
[ ! -r "$_path_d" ] && continue
|
||||
|
||||
# workaround for mdmon bug
|
||||
[ "$(cat "$_path_d")" -gt "0" ] && mdmon $_offroot --takeover "$md"
|
||||
done
|
||||
}
|
||||
|
||||
|
@@ -7,27 +7,11 @@ check() {
|
||||
# No mdadm? No mdraid support.
|
||||
type -P mdadm >/dev/null || return 1
|
||||
|
||||
check_mdraid() {
|
||||
local dev=$1 fs=$2 holder DEVPATH MD_UUID
|
||||
[[ "$fs" = "${fs%%_raid_member}" ]] && return 1
|
||||
|
||||
MD_UUID=$(/sbin/mdadm --examine --export $dev \
|
||||
| while read line; do
|
||||
[[ ${line#MD_UUID} = $line ]] && continue
|
||||
eval "$line"
|
||||
echo $MD_UUID
|
||||
break
|
||||
done)
|
||||
|
||||
[[ ${MD_UUID} ]] || return 1
|
||||
if ! [[ $kernel_only ]]; then
|
||||
echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_fs check_mdraid || return 1
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ "$fs" == *_raid_member ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
|
||||
return 0
|
||||
@@ -48,23 +32,39 @@ install() {
|
||||
inst $(command -v partx) /sbin/partx
|
||||
inst $(command -v mdadm) /sbin/mdadm
|
||||
|
||||
# XXX: mdmon really needs to run as non-root?
|
||||
# If so, write only the user it needs in the initrd's /etc/passwd (and maybe /etc/group)
|
||||
# in a similar fashion to modules.d/95nfs. Do not copy /etc/passwd and /etc/group from
|
||||
# the system into the initrd.
|
||||
# dledford has hardware to test this, so he should be able to clean this up.
|
||||
# inst /etc/passwd
|
||||
# inst /etc/group
|
||||
check_mdraid() {
|
||||
local dev=$1 fs=$2 holder DEVPATH MD_UUID
|
||||
[[ "$fs" != *_raid_member ]] && return 1
|
||||
|
||||
inst_rules 64-md-raid.rules
|
||||
# remove incremental assembly from stock rules, so they don't shadow
|
||||
# 65-md-inc*.rules and its fine-grained controls, or cause other problems
|
||||
# when we explicitly don't want certain components to be incrementally
|
||||
# assembled
|
||||
sed -i -r -e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode)"/d' "${initdir}${udevdir}/rules.d/64-md-raid.rules"
|
||||
MD_UUID=$(/sbin/mdadm --examine --export $dev \
|
||||
| while read line; do
|
||||
[[ ${line#MD_UUID} = $line ]] && continue
|
||||
eval "$line"
|
||||
echo $MD_UUID
|
||||
break
|
||||
done)
|
||||
|
||||
[[ ${MD_UUID} ]] || return 1
|
||||
if ! [[ $kernel_only ]]; then
|
||||
echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
for_each_host_dev_fs check_mdraid
|
||||
|
||||
inst_rules 64-md-raid.rules
|
||||
# remove incremental assembly from stock rules, so they don't shadow
|
||||
# 65-md-inc*.rules and its fine-grained controls, or cause other problems
|
||||
# when we explicitly don't want certain components to be incrementally
|
||||
# assembled
|
||||
sed -i -r -e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode)"/d' "${initdir}${udevdir}/rules.d/64-md-raid.rules"
|
||||
|
||||
inst_rules "$moddir/65-md-incremental-imsm.rules"
|
||||
|
||||
inst_rules "$moddir/59-persistent-storage-md.rules"
|
||||
prepare_udev_rules 59-persistent-storage-md.rules
|
||||
|
||||
# guard against pre-3.0 mdadm versions, that can't handle containers
|
||||
if ! mdadm -Q -e imsm /dev/null >/dev/null 2>&1; then
|
||||
inst_hook pre-trigger 30 "$moddir/md-noimsm.sh"
|
||||
@@ -88,8 +88,10 @@ install() {
|
||||
inst_hook shutdown 30 "$moddir/md-shutdown.sh"
|
||||
inst_script "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
|
||||
inst_script "$moddir/mdraid_start.sh" /sbin/mdraid_start
|
||||
if [ -e /lib/systemd/system/mdmon-offroot@.service ]; then
|
||||
inst_simple /lib/systemd/system/mdmon-offroot@.service
|
||||
if dracut_module_included "systemd"; then
|
||||
if [ -e $systemdsystemunitdir/mdmon@.service ]; then
|
||||
inst_simple $systemdsystemunitdir/mdmon@.service
|
||||
fi
|
||||
fi
|
||||
inst_hook pre-shutdown 30 "$moddir/mdmon-pre-shutdown.sh"
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ check() {
|
||||
}
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_and_slaves is_mpath || return 1
|
||||
for_each_host_dev_and_slaves is_mpath || return 255
|
||||
}
|
||||
|
||||
return 0
|
||||
@@ -75,6 +75,7 @@ install() {
|
||||
mpath_wait \
|
||||
multipath \
|
||||
multipathd \
|
||||
mpathpersist \
|
||||
xdrgetuid \
|
||||
xdrgetprio \
|
||||
/etc/xdrdevices.conf \
|
||||
@@ -85,8 +86,15 @@ install() {
|
||||
|
||||
inst_libdir_file "libmultipath*" "multipath/*"
|
||||
|
||||
inst_hook pre-trigger 02 "$moddir/multipathd.sh"
|
||||
inst_hook cleanup 02 "$moddir/multipathd-stop.sh"
|
||||
if dracut_module_included "systemd"; then
|
||||
dracut_install \
|
||||
$systemdsystemunitdir/multipathd.service
|
||||
mkdir -p "${initdir}${systemdsystemconfdir}/sysinit.target.wants"
|
||||
ln -rfs "${initdir}${systemdsystemunitdir}/multipathd.service" "${initdir}${systemdsystemconfdir}/sysinit.target.wants/multipathd.service"
|
||||
else
|
||||
inst_hook pre-trigger 02 "$moddir/multipathd.sh"
|
||||
inst_hook cleanup 02 "$moddir/multipathd-stop.sh"
|
||||
fi
|
||||
inst_rules 40-multipath.rules 62-multipath.rules 65-multipath.rules 66-kpartx.rules
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,12 @@ depends() {
|
||||
echo crypt
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods loop
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install losetup
|
||||
inst "$moddir/crypt-loop-lib.sh" "/lib/dracut-crypt-loop-lib.sh"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ check() {
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in ${host_fs_types[@]}; do
|
||||
strstr "$fs" "\|cifs" && return 0
|
||||
[[ "$fs" == "cifs" ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
@@ -43,4 +43,5 @@ install() {
|
||||
inst_hook cmdline 90 "$moddir/parse-cifsroot.sh"
|
||||
inst "$moddir/cifsroot.sh" "/sbin/cifsroot"
|
||||
inst "$moddir/cifs-lib.sh" "/lib/cifs-lib.sh"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -33,5 +33,6 @@ install() {
|
||||
inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
|
||||
inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-fcoe.sh"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
@@ -10,6 +10,7 @@
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
@@ -43,6 +44,8 @@ if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
|
||||
# if root is not specified try to mount the whole iSCSI LUN
|
||||
printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
|
||||
udevadm control --reload
|
||||
write_fs_tab /dev/root
|
||||
wait_for_dev /dev/root
|
||||
fi
|
||||
|
||||
for p in $(getargs rd.iscsi.param -d iscsi_param); do
|
||||
@@ -50,6 +53,8 @@ if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
|
||||
done
|
||||
|
||||
iscsistart -b $iscsi_param
|
||||
echo 'started' > "/tmp/iscsistarted-iscsi"
|
||||
echo 'started' > "/tmp/iscsistarted-firmware"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -136,14 +141,14 @@ handle_netroot()
|
||||
# if root is not specified try to mount the whole iSCSI LUN
|
||||
printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' $iscsi_lun >> /etc/udev/rules.d/99-iscsi-root.rules
|
||||
udevadm control --reload
|
||||
write_fs_tab /dev/root
|
||||
wait_for_dev /dev/root
|
||||
|
||||
# install mount script
|
||||
echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
|
||||
[ -z "$DRACUT_SYSTEMD" ] && \
|
||||
echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
|
||||
fi
|
||||
|
||||
# inject new exit_if_exists
|
||||
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/iscsi-settle.sh
|
||||
|
||||
# force udevsettle to break
|
||||
> $hookdir/initqueue/work
|
||||
|
||||
@@ -158,6 +163,10 @@ handle_netroot()
|
||||
${iscsi_netdev_name+--param iface.net_ifacename=$iscsi_netdev_name} \
|
||||
${iscsi_param} \
|
||||
|| :
|
||||
|
||||
netroot_enc=$(str_replace "$1" '/' '\2f')
|
||||
echo 'started' > "/tmp/iscsistarted-iscsi:${netroot_enc}"
|
||||
|
||||
}
|
||||
|
||||
# loop over all netroot parameter
|
||||
|
@@ -78,5 +78,8 @@ install() {
|
||||
inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
|
||||
inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
|
||||
inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
|
||||
inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
|
||||
fi
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -24,6 +24,8 @@
|
||||
|
||||
[ -n "$iscsiroot" ] && [ -n "$iscsi_firmware" ] && die "Mixing iscsiroot and iscsi_firmware is dangerous"
|
||||
|
||||
type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh
|
||||
|
||||
# Root takes precedence over netroot
|
||||
if [ "${root%%:*}" = "iscsi" ] ; then
|
||||
if [ -n "$netroot" ] ; then
|
||||
@@ -33,6 +35,8 @@ if [ "${root%%:*}" = "iscsi" ] ; then
|
||||
# if root is not specified try to mount the whole iSCSI LUN
|
||||
printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
|
||||
root=/dev/root
|
||||
|
||||
write_fs_tab /dev/root
|
||||
fi
|
||||
|
||||
# If it's not empty or iscsi we don't continue
|
||||
@@ -58,6 +62,7 @@ if [ -n "$iscsi_firmware" ] ; then
|
||||
netroot=${netroot:-iscsi}
|
||||
modprobe -q iscsi_boot_sysfs 2>/dev/null
|
||||
modprobe -q iscsi_ibft
|
||||
echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_firmware_started.sh
|
||||
fi
|
||||
|
||||
# If it's not iscsi we don't continue
|
||||
@@ -79,9 +84,17 @@ if ! [ -e /sys/module/iscsi_tcp ]; then
|
||||
modprobe -q iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi"
|
||||
fi
|
||||
|
||||
if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
|
||||
if ! getargbool 1 rd.neednet >/dev/null || ! getarg "ip="; then
|
||||
initqueue --onetime --settled /sbin/iscsiroot dummy "$netroot" "$NEWROOT"
|
||||
fi
|
||||
fi
|
||||
|
||||
netroot_enc=$(str_replace "$netroot" '/' '\2f')
|
||||
echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
|
||||
|
||||
# Done, all good!
|
||||
rootok=1
|
||||
|
||||
# Shut up init error check
|
||||
[ -z "$root" ] && root="iscsi"
|
||||
|
||||
|
@@ -33,5 +33,6 @@ install() {
|
||||
inst nbd-client
|
||||
inst_hook cmdline 90 "$moddir/parse-nbdroot.sh"
|
||||
inst_script "$moddir/nbdroot.sh" "/sbin/nbdroot"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
@@ -17,21 +17,21 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
# root is in the form root=nbd:srv:port[:fstype[:rootflags[:nbdopts]]]
|
||||
netif="$1"
|
||||
root="$2"
|
||||
nroot="$2"
|
||||
NEWROOT="$3"
|
||||
|
||||
# If it's not nbd we don't continue
|
||||
[ "${root%%:*}" = "nbd" ] || return
|
||||
[ "${nroot%%:*}" = "nbd" ] || return
|
||||
|
||||
root=${root#nbd:}
|
||||
nbdserver=${root%%:*}; root=${root#*:}
|
||||
nbdport=${root%%:*}; root=${root#*:}
|
||||
nbdfstype=${root%%:*}; root=${root#*:}
|
||||
nbdflags=${root%%:*}
|
||||
nbdopts=${root#*:}
|
||||
nroot=${nroot#nbd:}
|
||||
nbdserver=${nroot%%:*}; nroot=${nroot#*:}
|
||||
nbdport=${nroot%%:*}; nroot=${nroot#*:}
|
||||
nbdfstype=${nroot%%:*}; nroot=${nroot#*:}
|
||||
nbdflags=${nroot%%:*}
|
||||
nbdopts=${nroot#*:}
|
||||
|
||||
# If nbdport not an integer, then assume name based import
|
||||
if [ "${nbdport%[0-9]}" = "$nbdport" ]; then
|
||||
if [ ! -z $(echo "$nbdport" | sed 's/[0-9]//g') ]; then
|
||||
nbdport="-N $nbdport"
|
||||
fi
|
||||
|
||||
@@ -92,23 +92,27 @@ while [ ! -b /dev/nbd0 ]; do
|
||||
else
|
||||
sleep 0.1
|
||||
fi
|
||||
i=$(( $i + 1))
|
||||
i=$(($i + 1))
|
||||
done
|
||||
|
||||
nbd-client $preopts "$nbdserver" $nbdport /dev/nbd0 $opts || exit 1
|
||||
|
||||
# If we didn't get a root= on the command line, then we need to
|
||||
# add the udev rules for mounting the nbd0 device
|
||||
root=$(getarg root=)
|
||||
if [ -z "$root" ] || strstr "$root" "nbd:" || strstr "$root" "dhcp"; then
|
||||
echo '[ -e /dev/root ] || { info=$(udevadm info --query=env --name=/dev/nbd0); [ -z "${info%%*ID_FS_TYPE*}" ] && { ln -s /dev/nbd0 /dev/root 2>/dev/null; :; };} && rm $job;' \
|
||||
> $hookdir/initqueue/settled/nbd.sh
|
||||
if [ -z "$root" -o -n "${root%%block:*}" -o "$root" = "block:/dev/root" ]; then
|
||||
printf 'KERNEL=="nbd0", ENV{DEVTYPE}!="partition", ENV{ID_FS_TYPE}=="?*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-nbd-root.rules
|
||||
udevadm control --reload
|
||||
type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh
|
||||
write_fs_tab /dev/root "$nbdfstype" "$fsopts"
|
||||
wait_for_dev /dev/root
|
||||
|
||||
printf '/bin/mount -t %s -o %s %s %s\n' \
|
||||
"$nbdfstype" "$fsopts" /dev/nbd0 "$NEWROOT" \
|
||||
> $hookdir/mount/01-$$-nbd.sh
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
printf '/bin/mount %s\n' \
|
||||
"$NEWROOT" \
|
||||
> $hookdir/mount/01-$$-nbd.sh
|
||||
fi
|
||||
fi
|
||||
|
||||
nbd-client $preopts "$nbdserver" $nbdport /dev/nbd0 $opts || exit 1
|
||||
|
||||
# NBD doesn't emit uevents when it gets connected, so kick it
|
||||
echo change > /sys/block/nbd0/uevent
|
||||
udevadm settle
|
||||
|
@@ -9,9 +9,9 @@ check() {
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in ${host_fs_types[@]}; do
|
||||
strstr "$fs" "\|nfs" && return 0
|
||||
strstr "$fs" "\|nfs3" && return 0
|
||||
strstr "$fs" "\|nfs4" && return 0
|
||||
[[ "$fs" == "nfs" ]] && return 0
|
||||
[[ "$fs" == "nfs3" ]] && return 0
|
||||
[[ "$fs" == "nfs4" ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
@@ -62,12 +62,8 @@ install() {
|
||||
|
||||
# Rather than copy the passwd file in, just set a user for rpcbind
|
||||
# We'll save the state and restart the daemon from the root anyway
|
||||
egrep '^nfsnobody:' /etc/passwd >> "$initdir/etc/passwd"
|
||||
egrep '^rpc:' /etc/passwd >> "$initdir/etc/passwd"
|
||||
egrep '^rpcuser:' /etc/passwd >> "$initdir/etc/passwd"
|
||||
#type -P nologin >/dev/null && dracut_install nologin
|
||||
egrep '^nobody:' /etc/group >> "$initdir/etc/group"
|
||||
egrep '^rpc:' /etc/group >> "$initdir/etc/group"
|
||||
egrep '^nfsnobody:|^rpc:|^rpcuser:' /etc/passwd >> "$initdir/etc/passwd"
|
||||
egrep '^nogroup:|^rpc:|^nobody:' /etc/group >> "$initdir/etc/group"
|
||||
|
||||
# rpc user needs to be able to write to this directory to save the warmstart
|
||||
# file
|
||||
@@ -75,5 +71,6 @@ install() {
|
||||
egrep -q '^rpc:' /etc/passwd \
|
||||
&& egrep -q '^rpc:' /etc/group \
|
||||
&& chown rpc.rpc "$initdir/var/lib/rpcbind"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,8 @@ nfs_to_var $root $netif
|
||||
|
||||
mount_nfs $root $NEWROOT $netif && { [ -e /dev/root ] || ln -s null /dev/root ; }
|
||||
|
||||
[ -f $NEWROOT/etc/fstab ] && cat $NEWROOT/etc/fstab > /dev/null
|
||||
|
||||
# inject new exit_if_exists
|
||||
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/nfs.sh
|
||||
# force udevsettle to break
|
||||
|
@@ -14,8 +14,13 @@ install() {
|
||||
}
|
||||
done
|
||||
|
||||
inst_hook cmdline 10 "$moddir/parse-resume.sh"
|
||||
inst_hook pre-udev 30 "$moddir/resume-genrules.sh"
|
||||
inst_hook mount 10 "$moddir/resume.sh"
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook cmdline 10 "$moddir/parse-resume.sh"
|
||||
else
|
||||
inst_script "$moddir/parse-resume.sh" /lib/dracut/parse-resume.sh
|
||||
inst_hook pre-udev 30 "$moddir/resume-genrules.sh"
|
||||
fi
|
||||
|
||||
inst_script "$moddir/resume.sh" /lib/dracut/resume.sh
|
||||
}
|
||||
|
||||
|
@@ -24,3 +24,51 @@ if splash=$(getarg splash=); then
|
||||
else
|
||||
unset splash
|
||||
fi
|
||||
|
||||
case "$splash" in
|
||||
quiet )
|
||||
a_splash="-P splash=y"
|
||||
;;
|
||||
* )
|
||||
a_splash="-P splash=n"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$resume" ]; then
|
||||
{
|
||||
printf "KERNEL==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \
|
||||
${resume#/dev/};
|
||||
printf "SYMLINK==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \
|
||||
${resume#/dev/};
|
||||
} >> /etc/udev/rules.d/99-resume-link.rules
|
||||
|
||||
{
|
||||
if [ -x /usr/sbin/resume ]; then
|
||||
printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \
|
||||
${resume#/dev/} "$a_splash" "$resume";
|
||||
printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \
|
||||
${resume#/dev/} "$a_splash" "$resume";
|
||||
fi
|
||||
printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %%M:%%m > /sys/power/resume\"\n" \
|
||||
${resume#/dev/};
|
||||
printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %%M:%%m > /sys/power/resume\"\n" \
|
||||
${resume#/dev/};
|
||||
} >> /etc/udev/rules.d/99-resume.rules
|
||||
|
||||
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm "$job" "%s/initqueue/timeout/resume.sh"; }\n' \
|
||||
"$resume" "$resume" "$hookdir" >> $hookdir/initqueue/settled/resume.sh
|
||||
|
||||
printf 'warn "Cancelling resume operation. Device not found."; cancel_wait_for_dev /dev/resume; rm "$job" "%s/initqueue/settled/resume.sh";' \
|
||||
"$hookdir" >> $hookdir/initqueue/timeout/resume.sh
|
||||
|
||||
wait_for_dev "/dev/resume"
|
||||
mv /lib/dracut/resume.sh /lib/dracut/hooks/pre-mount/10-resume.sh
|
||||
elif ! getarg noresume; then
|
||||
{
|
||||
if [ -x /usr/sbin/resume ]; then
|
||||
printf "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \$tempnode\"\n" "$a_splash"
|
||||
fi
|
||||
echo "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\"," \
|
||||
" RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %M:%m > /sys/power/resume\"";
|
||||
} >> /etc/udev/rules.d/99-resume.rules
|
||||
fi
|
||||
|
@@ -32,8 +32,8 @@ if [ -n "$resume" ]; then
|
||||
${resume#/dev/};
|
||||
} >> /etc/udev/rules.d/99-resume.rules
|
||||
|
||||
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm "$job"; udevadm settle; }\n' \
|
||||
"$resume" "$resume" >> $hookdir/initqueue/settled/resume.sh
|
||||
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm "$job" "%s/initqueue/timeout/resume.sh"; }\n' \
|
||||
"$resume" "$resume" "$hookdir" >> $hookdir/initqueue/settled/resume.sh
|
||||
|
||||
printf 'warn "Cancelling resume operation. Device not found."; cancel_wait_for_dev /dev/resume; rm "$job" "%s/initqueue/settled/resume.sh";' \
|
||||
"$hookdir" >> $hookdir/initqueue/timeout/resume.sh
|
||||
|
@@ -13,22 +13,5 @@ if [ "${root%%:*}" = "block" ]; then
|
||||
printf '[ -e "%s" ] && { ln -s "%s" /dev/root 2>/dev/null; rm "$job"; }\n' \
|
||||
"${root#block:}" "${root#block:}" > $hookdir/initqueue/settled/blocksymlink.sh
|
||||
|
||||
# if [ -d /lib/systemd/system/ ]; then
|
||||
# echo "${root#block:} $NEWROOT ${fstype:-auto} ${rflags:-defaults} 1 1" >> /etc/fstab
|
||||
# {
|
||||
# echo '[Unit]'
|
||||
# echo 'Description=New Root File System'
|
||||
# echo 'DefaultDependencies=no'
|
||||
# echo 'Before=initrd-switch-root.service'
|
||||
# echo '[Mount]'
|
||||
# echo "What=${root#block:}"
|
||||
# echo "Where=$NEWROOT"
|
||||
|
||||
# } >/lib/systemd/system/${NEWROOT#/}.mount
|
||||
|
||||
# mkdir -p /lib/systemd/system/initrd-switch-root.target.requires
|
||||
# ln -s ../${NEWROOT#/}.mount /lib/systemd/system/initrd-switch-root.target.requires/${NEWROOT#/}.mount
|
||||
# fi
|
||||
|
||||
wait_for_dev "${root#block:}"
|
||||
fi
|
||||
|
@@ -23,7 +23,6 @@ check() {
|
||||
echo "root.journaldev=$journaldev" >> "${initdir}/etc/cmdline.d/95root-jurnaldev.conf"
|
||||
fi
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
depends() {
|
||||
@@ -32,8 +31,10 @@ depends() {
|
||||
|
||||
install() {
|
||||
dracut_install umount
|
||||
inst_hook cmdline 95 "$moddir/parse-block.sh"
|
||||
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
|
||||
inst_hook mount 99 "$moddir/mount-root.sh"
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook cmdline 95 "$moddir/parse-block.sh"
|
||||
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
|
||||
inst_hook mount 99 "$moddir/mount-root.sh"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@@ -26,9 +26,10 @@ mount_root() {
|
||||
fi
|
||||
|
||||
_rflags_ro="$rflags,ro"
|
||||
_rflags_ro="${_rflags_ro##,}"
|
||||
|
||||
while ! mount -t ${rootfs} -o "$_rflags_ro" "${root#block:}" "$NEWROOT"; do
|
||||
warn "Failed to mount -t ${rootfs} -o ${_rflags_ro##,} ${root#block:} $NEWROOT"
|
||||
warn "Failed to mount -t ${rootfs} -o $_rflags_ro ${root#block:} $NEWROOT"
|
||||
fsck_ask_err
|
||||
done
|
||||
|
||||
@@ -67,7 +68,7 @@ mount_root() {
|
||||
warn "*** Warning -- the system did not shut down cleanly. "
|
||||
warn "*** Dropping you to a shell; the system will continue"
|
||||
warn "*** when you leave the shell."
|
||||
emergency_shell
|
||||
action_on_fail
|
||||
fi
|
||||
fsckoptions="$AUTOFSCK_OPT $fsckoptions"
|
||||
fi
|
||||
|
@@ -20,3 +20,5 @@ case "$root" in
|
||||
root="block:${root}"
|
||||
rootok=1 ;;
|
||||
esac
|
||||
|
||||
[ "${root%%:*}" = "block" ] && wait_for_dev "${root#block:}"
|
||||
|
@@ -6,35 +6,4 @@ ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="ps_end"
|
||||
KERNEL=="cciss[0-9]*", IMPORT BLKID
|
||||
KERNEL=="nbd[0-9]*", IMPORT BLKID
|
||||
|
||||
|
||||
KERNEL!="md[0-9]*|md_d[0-9]*|md/*", KERNEL!="md*", GOTO="md_end"
|
||||
|
||||
# partitions have no md/{array_state,metadata_version}
|
||||
ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
|
||||
|
||||
# container devices have a metadata version of e.g. 'external:ddf' and
|
||||
# never leave state 'inactive'
|
||||
ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
|
||||
TEST!="md/array_state", GOTO="md_end"
|
||||
ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
|
||||
|
||||
LABEL="md_ignore_state"
|
||||
|
||||
IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
|
||||
IMPORT BLKID
|
||||
OPTIONS+="link_priority=100"
|
||||
OPTIONS+="watch"
|
||||
LABEL="md_end"
|
||||
|
||||
|
||||
KERNEL!="dm-[0-9]*", GOTO="ps_end"
|
||||
ACTION=="add", GOTO="ps_end"
|
||||
IMPORT{program}="/sbin/dmsetup info -c --nameprefixes --unquoted --rows --noheadings -o name,uuid,suspended,readonly,major,minor,open,tables_loaded,names_using_dev -j%M -m%m"
|
||||
ENV{DM_NAME}!="?*", GOTO="ps_end"
|
||||
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="ps_end"
|
||||
ENV{DM_UUID}=="CRYPT-TEMP-?*", GOTO="ps_end"
|
||||
ENV{DM_UUID}!="?*", ENV{DM_NAME}=="temporary-cryptsetup-?*", GOTO="ps_end"
|
||||
IMPORT BLKID
|
||||
|
||||
|
||||
LABEL="ps_end"
|
||||
|
@@ -11,17 +11,17 @@ install() {
|
||||
dracut_install udevadm cat uname blkid \
|
||||
/etc/udev/udev.conf
|
||||
|
||||
[ -d ${initdir}/lib/systemd ] || mkdir -p ${initdir}/lib/systemd
|
||||
for _i in ${systemdutildir}/systemd-udevd ${udevdir}/udevd /lib/systemd/systemd-udevd /sbin/udevd; do
|
||||
[ -d ${initdir}/$systemdutildir ] || mkdir -p ${initdir}/$systemdutildir
|
||||
for _i in ${systemdutildir}/systemd-udevd ${udevdir}/udevd /sbin/udevd; do
|
||||
[ -x "$_i" ] || continue
|
||||
inst "$_i"
|
||||
|
||||
if ! [[ -f ${initdir}/lib/systemd/systemd-udevd ]]; then
|
||||
ln -fs "$_i" ${initdir}/lib/systemd/systemd-udevd
|
||||
if ! [[ -f ${initdir}${systemdutildir}/systemd-udevd ]]; then
|
||||
ln -fs "$_i" ${initdir}${systemdutildir}/systemd-udevd
|
||||
fi
|
||||
break
|
||||
done
|
||||
if ! [[ -e ${initdir}/lib/systemd/systemd-udevd ]]; then
|
||||
if ! [[ -e ${initdir}${systemdutildir}/systemd-udevd ]]; then
|
||||
derror "Cannot find [systemd-]udevd binary!"
|
||||
exit 1
|
||||
fi
|
||||
@@ -31,17 +31,17 @@ install() {
|
||||
60-pcmcia.rules \
|
||||
50-udev.rules 95-late.rules \
|
||||
50-firmware.rules \
|
||||
80-net-name-slot.rules \
|
||||
"$moddir/59-persistent-storage.rules" \
|
||||
"$moddir/61-persistent-storage.rules"
|
||||
|
||||
inst_dir /run/udev
|
||||
inst_dir /run/udev/rules.d
|
||||
prepare_udev_rules 59-persistent-storage.rules 61-persistent-storage.rules
|
||||
|
||||
{
|
||||
for i in cdrom tape dialout floppy; do
|
||||
if ! egrep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then
|
||||
if ! egrep "^$i:" /etc/group 2>/dev/null; then
|
||||
case $i in
|
||||
case $i in
|
||||
cdrom) echo "$i:x:11:";;
|
||||
dialout) echo "$i:x:18:";;
|
||||
floppy) echo "$i:x:19:";;
|
||||
@@ -70,11 +70,12 @@ install() {
|
||||
${udevdir}/pcmcia-socket-startup \
|
||||
${udevdir}/pcmcia-check-broken-cis
|
||||
|
||||
dracut_install -o /etc/pcmcia/config.opts
|
||||
|
||||
[ -f /etc/arch-release ] && \
|
||||
inst_script "$moddir/load-modules.sh" /lib/udev/load-modules.sh
|
||||
|
||||
inst_libdir_file "libnss_files*"
|
||||
|
||||
inst_hook pre-udev 10 "$moddir/udev-rules-prepare.sh"
|
||||
}
|
||||
|
||||
|
@@ -1,27 +0,0 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
[ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
|
||||
|
||||
for f in /etc/udev/rules.d/*-persistent-storage.rules; do
|
||||
[ -e "$f" ] || continue
|
||||
while read line; do
|
||||
if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then
|
||||
if [ $UDEVVERSION -ge 174 ]; then
|
||||
printf '%sIMPORT{builtin}="path_id"\n' "${line%%IMPORT PATH_ID}"
|
||||
else
|
||||
printf '%sIMPORT{program}="path_id %%p"\n' "${line%%IMPORT PATH_ID}"
|
||||
fi
|
||||
elif [ "${line%%IMPORT BLKID}" != "$line" ]; then
|
||||
if [ $UDEVVERSION -ge 176 ]; then
|
||||
printf '%sIMPORT{builtin}="blkid"\n' "${line%%IMPORT BLKID}"
|
||||
else
|
||||
printf '%sIMPORT{program}="/sbin/blkid -o udev -p $tempnode"\n' "${line%%IMPORT BLKID}"
|
||||
fi
|
||||
else
|
||||
echo "$line"
|
||||
fi
|
||||
done < "${f}" > "${f}.new"
|
||||
mv "${f}.new" "$f"
|
||||
done
|
@@ -5,9 +5,9 @@
|
||||
check() {
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in ${host_fs_types[@]}; do
|
||||
strstr "$fs" "\|9p" && return 0
|
||||
[[ "$fs" == "9p" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
if type -P systemd-detect-virt >/dev/null 2>&1; then
|
||||
@@ -32,7 +32,7 @@ depends() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods 9p 9pnet_virtio
|
||||
instmods 9p 9pnet_virtio virtio_pci
|
||||
}
|
||||
|
||||
install() {
|
||||
|
@@ -1 +0,0 @@
|
||||
KERNEL=="zfcp_cfdc", RUN+="/sbin/zfcpconf.sh"
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user