Compare commits
134 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a0799ffb55 | ||
![]() |
65f78f3d74 | ||
![]() |
2b909b9a4b | ||
![]() |
ed25fb0e91 | ||
![]() |
c2408eed7f | ||
![]() |
1792759721 | ||
![]() |
e316ae0e43 | ||
![]() |
5abd692fe4 | ||
![]() |
1279a9e1a0 | ||
![]() |
0baf5a3e99 | ||
![]() |
bdf0f9ce32 | ||
![]() |
ae989390a1 | ||
![]() |
39018c93c2 | ||
![]() |
f496af50b7 | ||
![]() |
c427603cd1 | ||
![]() |
e2b877a18b | ||
![]() |
690b24f02f | ||
![]() |
98663fcaac | ||
![]() |
8523ec50c2 | ||
![]() |
af6eee79e3 | ||
![]() |
9fd0461b7d | ||
![]() |
66a3d4053b | ||
![]() |
b1ae591945 | ||
![]() |
017978f868 | ||
![]() |
2187b3d097 | ||
![]() |
c75ce02775 | ||
![]() |
f24d205537 | ||
![]() |
85ed04e0cf | ||
![]() |
c0371761fb | ||
![]() |
2ceb910a73 | ||
![]() |
72c084918a | ||
![]() |
ad3b209d40 | ||
![]() |
1a95f1f4fc | ||
![]() |
ef025dcbbe | ||
![]() |
d23b0efc1a | ||
![]() |
1bfa75b015 | ||
![]() |
dd75a946db | ||
![]() |
e95a3c36ed | ||
![]() |
400a85ffaf | ||
![]() |
9388d99361 | ||
![]() |
5a532aa83f | ||
![]() |
9cd4edb445 | ||
![]() |
a1d92d8ace | ||
![]() |
fac3e9d975 | ||
![]() |
9b8e6e40a9 | ||
![]() |
a430c3f7a6 | ||
![]() |
e7b343138f | ||
![]() |
4011b48c42 | ||
![]() |
295194ee42 | ||
![]() |
76dd870bfd | ||
![]() |
3e7498ea03 | ||
![]() |
62b7920ed1 | ||
![]() |
5ce7cc7337 | ||
![]() |
d84f4687c3 | ||
![]() |
db17ef6c4f | ||
![]() |
3ad12c7be8 | ||
![]() |
26264af7f5 | ||
![]() |
37437cac8a | ||
![]() |
106255afd4 | ||
![]() |
c1699b59c6 | ||
![]() |
add1ea88d2 | ||
![]() |
3d875f77f3 | ||
![]() |
44302d6f28 | ||
![]() |
38e9d6249a | ||
![]() |
0a50111ab3 | ||
![]() |
937cc53ecb | ||
![]() |
343c74311b | ||
![]() |
c3b6970394 | ||
![]() |
9bf5f989ee | ||
![]() |
940169e8d8 | ||
![]() |
337a55eb2d | ||
![]() |
c8aa1d949a | ||
![]() |
5f923256e3 | ||
![]() |
5e7bbe43a3 | ||
![]() |
3a8ba44026 | ||
![]() |
e0c3b0793f | ||
![]() |
8b0791fa01 | ||
![]() |
e5bf1cecd6 | ||
![]() |
cf9c8c5fe3 | ||
![]() |
05bf320972 | ||
![]() |
2600b54c18 | ||
![]() |
bd355f8643 | ||
![]() |
1362641310 | ||
![]() |
e5d21b80c0 | ||
![]() |
5d1ea2d726 | ||
![]() |
856d039ba4 | ||
![]() |
55c763b1ff | ||
![]() |
c8e531239b | ||
![]() |
624f173cbd | ||
![]() |
9be4be7aa7 | ||
![]() |
bbca3891ed | ||
![]() |
a0d129e33e | ||
![]() |
0c4c9792c8 | ||
![]() |
6ed9975c5a | ||
![]() |
73e30ea106 | ||
![]() |
e3189ab123 | ||
![]() |
cf9a4e0c73 | ||
![]() |
08e51654bf | ||
![]() |
63c7b358f5 | ||
![]() |
70ce5ea256 | ||
![]() |
a0e3794b2a | ||
![]() |
fd24c90c36 | ||
![]() |
1856ae95c8 | ||
![]() |
b71d162a7a | ||
![]() |
3cea065819 | ||
![]() |
87ddd4d9af | ||
![]() |
1e00295a15 | ||
![]() |
b40585e6c7 | ||
![]() |
feaaee4278 | ||
![]() |
892b1fe6b7 | ||
![]() |
2e1861fde2 | ||
![]() |
ab66ef2d4a | ||
![]() |
29fd71b23d | ||
![]() |
bc6f06a795 | ||
![]() |
7cf2c21798 | ||
![]() |
11947da13f | ||
![]() |
f59548aeab | ||
![]() |
fafb4c0182 | ||
![]() |
0096157e14 | ||
![]() |
9998940493 | ||
![]() |
538ff0fd80 | ||
![]() |
8b6d136e62 | ||
![]() |
ea765c0ee1 | ||
![]() |
e190073b21 | ||
![]() |
ce999bff98 | ||
![]() |
031e2f7bb8 | ||
![]() |
a0545765e8 | ||
![]() |
96b708e178 | ||
![]() |
4c3d99f966 | ||
![]() |
c603419030 | ||
![]() |
0e1b686b83 | ||
![]() |
0982fcb2e5 | ||
![]() |
98047e08d0 | ||
![]() |
2a1723ed83 |
1
.mailmap
1
.mailmap
@@ -16,3 +16,4 @@ Frederick Grose <fgrose@sugarlabs.org> <fgrose@gmail.com>
|
||||
Frederic Crozat <fcrozat@suse.com> <fcrozat@mandriva.com>
|
||||
Shawn W Dunn <sfalken@opensuse.org> <sfalken@opensuse.org>
|
||||
Kyle McMartin <kmcmarti@redhat.com> <kyle@redhat.com>
|
||||
Angelo "pallotron" Failla <pallotron@fb.com> <pallotron@fb.com>
|
||||
|
@@ -5,6 +5,12 @@ KERNEL_VERSION="$2"
|
||||
BOOT_DIR_ABS="$3"
|
||||
KERNEL_IMAGE="$4"
|
||||
|
||||
# If KERNEL_INSTALL_MACHINE_ID is defined but empty, BOOT_DIR_ABS is a fake directory.
|
||||
# So, let's skip to create initrd.
|
||||
if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ret=0
|
||||
case "$COMMAND" in
|
||||
add)
|
||||
|
@@ -33,11 +33,15 @@ dropindirs_sort()
|
||||
|
||||
[[ -f /etc/os-release ]] && . /etc/os-release
|
||||
|
||||
if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then
|
||||
systemd-machine-id-setup
|
||||
if [[ ${KERNEL_INSTALL_MACHINE_ID+x} ]]; then
|
||||
MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID
|
||||
elif [[ -f /etc/machine-id ]] ; then
|
||||
read MACHINE_ID < /etc/machine-id
|
||||
fi
|
||||
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
if ! [[ $MACHINE_ID ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ -f /etc/kernel/cmdline ]]; then
|
||||
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
|
4
Makefile
4
Makefile
@@ -12,8 +12,8 @@ pkglibdir ?= ${libdir}/dracut
|
||||
sysconfdir ?= ${prefix}/etc
|
||||
bindir ?= ${prefix}/bin
|
||||
mandir ?= ${prefix}/share/man
|
||||
CFLAGS ?= -O2 -g -Wall $(KMOD_CFLAGS)
|
||||
CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
|
||||
CFLAGS ?= -O2 -g -Wall
|
||||
CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 $(KMOD_CFLAGS)
|
||||
bashcompletiondir ?= ${datadir}/bash-completion/completions
|
||||
pkgconfigdatadir ?= $(datadir)/pkgconfig
|
||||
|
||||
|
51
NEWS
51
NEWS
@@ -1,3 +1,54 @@
|
||||
dracut-046
|
||||
==========
|
||||
|
||||
dracut.sh:
|
||||
- bail out if module directory does not exist
|
||||
if people want to build the initramfs without kernel modules,
|
||||
then --no-kernel should be specified
|
||||
- add early microcode support for AMD family 16h
|
||||
- collect also all modaliases modules from sysfs for hostonly modules
|
||||
- sync initramfs after creation
|
||||
|
||||
network:
|
||||
- wait for IPv6 RA if using none/static IPv6 assignment
|
||||
- ipv6 improvements
|
||||
- Handle curl using libnssckbi for TLS
|
||||
- fix dhcp classless_static_routes
|
||||
- dhclient: send client-identifier matching hardware address
|
||||
- don't arping for point-to-point connections
|
||||
- only bring up wired network interfaces (no wlan and wwan)
|
||||
|
||||
mraid:
|
||||
- mdraid: wait for rd.md.uuid specified devices to be assembled
|
||||
|
||||
crypt:
|
||||
- handle rd.luks.name
|
||||
|
||||
crypt-gpg:
|
||||
- For GnuPG >= 2.1 support OpenPGP smartcards
|
||||
|
||||
kernel-install:
|
||||
- Skip to create initrd if /etc/machine-id is missing or empty
|
||||
|
||||
nfs:
|
||||
- handle rpcbind /run/rpcbind directory
|
||||
|
||||
s390:
|
||||
- various fixes
|
||||
|
||||
dmsquash-live:
|
||||
- add NTFS support
|
||||
|
||||
multipath:
|
||||
- split out multipath-hostonly module
|
||||
|
||||
lvmmerge:
|
||||
- new module, see README.md in the module directory
|
||||
|
||||
dracut-systemd:
|
||||
- fixed dependencies
|
||||
|
||||
|
||||
dracut-045
|
||||
==========
|
||||
|
||||
|
21
README.md
21
README.md
@@ -2,5 +2,24 @@
|
||||
|
||||
dracut is an initramfs infrastructure.
|
||||
|
||||
CentOS CI: [](https://ci.centos.org/job/dracut-push-master/)
|
||||
## CentOS CI
|
||||
|
||||
[](https://ci.centos.org/job/dracut-push-master/)
|
||||
|
||||
- Test 01: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=01,label=dracut-ci-slave01/)
|
||||
- Test 02: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=02,label=dracut-ci-slave01/)
|
||||
- Test 03: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=03,label=dracut-ci-slave01/)
|
||||
- Test 04: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=04,label=dracut-ci-slave01/)
|
||||
- Test 10: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=10,label=dracut-ci-slave01/)
|
||||
- Test 11: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=11,label=dracut-ci-slave01/)
|
||||
- Test 12: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=12,label=dracut-ci-slave01/)
|
||||
- Test 13: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=13,label=dracut-ci-slave01/)
|
||||
- Test 14: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=14,label=dracut-ci-slave01/)
|
||||
- Test 15: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=15,label=dracut-ci-slave01/)
|
||||
- Test 16: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=16,label=dracut-ci-slave01/)
|
||||
- Test 17: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=17,label=dracut-ci-slave01/)
|
||||
- Test 20: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=20,label=dracut-ci-slave01/)
|
||||
- Test 30: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=30,label=dracut-ci-slave01/)
|
||||
- Test 40: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=40,label=dracut-ci-slave01/)
|
||||
- Test 50: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=50,label=dracut-ci-slave01/)
|
||||
- Test 70: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=70,label=dracut-ci-slave01/)
|
||||
|
@@ -661,8 +661,10 @@ get_ucode_file ()
|
||||
local stepping=`grep -E "stepping" /proc/cpuinfo | head -1 | sed s/.*:\ //`
|
||||
|
||||
if [[ "$(get_cpu_vendor)" == "AMD" ]]; then
|
||||
# If family greater or equal than 0x15
|
||||
if [[ $family -ge 21 ]]; then
|
||||
# If family greater than or equal to 0x16
|
||||
if [[ $family -ge 22 ]]; then
|
||||
printf "microcode_amd_fam16h.bin"
|
||||
elif [[ $family -eq 21 ]]; then
|
||||
printf "microcode_amd_fam15h.bin"
|
||||
else
|
||||
printf "microcode_amd.bin"
|
||||
|
@@ -52,13 +52,6 @@ if ! [[ -d $initdir ]]; then
|
||||
mkdir -p "$initdir"
|
||||
fi
|
||||
|
||||
if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
|
||||
if ! [[ -d "$initdir/.kernelmodseen" ]]; then
|
||||
mkdir -p "$initdir/.kernelmodseen"
|
||||
fi
|
||||
DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
|
||||
fi
|
||||
|
||||
if ! [[ $kernel ]]; then
|
||||
kernel=$(uname -r)
|
||||
export kernel
|
||||
@@ -172,6 +165,13 @@ if ! [[ -x $DRACUT_INSTALL ]]; then
|
||||
exit 10
|
||||
fi
|
||||
|
||||
if [[ $hostonly == "-h" ]]; then
|
||||
if ! [[ $DRACUT_KERNEL_MODALIASES ]] || ! [[ -f "$DRACUT_KERNEL_MODALIASES" ]]; then
|
||||
export DRACUT_KERNEL_MODALIASES="${DRACUT_TMPDIR}/modaliases"
|
||||
$DRACUT_INSTALL ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
|
||||
inst_dir() {
|
||||
[[ -e ${initdir}/"$1" ]] && return 0 # already there
|
||||
@@ -935,9 +935,6 @@ for_each_kmod_dep() {
|
||||
}
|
||||
|
||||
dracut_kernel_post() {
|
||||
local _moddirname=${srcmods%%/lib/modules/*}
|
||||
local _pid
|
||||
|
||||
for _f in modules.builtin.bin modules.builtin modules.order; do
|
||||
[[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
|
||||
done
|
||||
|
@@ -788,12 +788,19 @@ DASD
|
||||
ZFCP
|
||||
~~~~
|
||||
**rd.zfcp=**__<zfcp adaptor device bus ID>__,__<WWPN>__,__<FCPLUN>__::
|
||||
rd.zfcp can be specified multiple times on the kernel command line.
|
||||
rd.zfcp can be specified multiple times on the kernel command
|
||||
line.
|
||||
|
||||
**rd.zfcp=**__<zfcp adaptor device bus ID>__::
|
||||
If NPIV is enabled and the 'allow_lun_scan' parameter to the zfcp
|
||||
module is set to 'Y' then the zfcp adaptor will be initiating a
|
||||
scan internally and the <WWPN> and <FCPLUN> parameters can be omitted.
|
||||
+
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
rd.zfcp=0.0.4000,0x5005076300C213e9,0x5022000000000000
|
||||
rd.zfcp=0.0.4000
|
||||
--
|
||||
|
||||
**rd.zfcp.conf=0**::
|
||||
|
@@ -97,7 +97,7 @@ Configuration files must have the extension .conf; other extensions are ignored.
|
||||
instead of a generic host and generate host-specific configuration.
|
||||
|
||||
*hostonly_cmdline=*"__{yes|no}__"::
|
||||
If set, store the kernel command line arguments needed in the initramfs
|
||||
If set to "yes", store the kernel command line arguments needed in the initramfs
|
||||
|
||||
*persistent_policy=*"__<policy>__"::
|
||||
Use _<policy>_ to address disks and partitions.
|
||||
|
36
dracut.sh
36
dracut.sh
@@ -306,7 +306,7 @@ rearrange_params()
|
||||
--long mount: \
|
||||
--long device: \
|
||||
--long add-device: \
|
||||
--long nofscks: \
|
||||
--long nofscks \
|
||||
--long ro-mnt \
|
||||
--long kmoddir: \
|
||||
--long conf: \
|
||||
@@ -621,12 +621,6 @@ if ! [[ $kernel ]]; then
|
||||
kernel=$(uname -r)
|
||||
fi
|
||||
|
||||
if [[ $kernel ]]; then
|
||||
if ! [[ -d /lib/modules/$kernel ]] && [[ $no_kernel != yes ]]; then
|
||||
printf -- "Kernel version $kernel has no module directory /lib/modules/$kernel\n" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
export LC_ALL=C
|
||||
export LANG=C
|
||||
unset LC_MESSAGES
|
||||
@@ -894,6 +888,12 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $no_kernel != yes ]] && ! [[ -d $srcmods ]]; then
|
||||
printf "%s\n" "dracut: Cannot find module directory $srcmods" >&2
|
||||
printf "%s\n" "dracut: and --no-kernel was not specified" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [[ $print_cmdline ]]; then
|
||||
inst /bin/sh
|
||||
if ! $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R "$initdir/bin/sh" &>/dev/null; then
|
||||
@@ -1053,8 +1053,8 @@ if [[ ! $print_cmdline ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $acpi_override = yes ]] && ! check_kernel_config CONFIG_ACPI_INITRD_TABLE_OVERRIDE; then
|
||||
dwarn "Disabling ACPI override, because kernel does not support it. CONFIG_ACPI_INITRD_TABLE_OVERRIDE!=y"
|
||||
if [[ $acpi_override = yes ]] && ! ( check_kernel_config CONFIG_ACPI_TABLE_UPGRADE || check_kernel_config CONFIG_ACPI_INITRD_TABLE_OVERRIDE ); then
|
||||
dwarn "Disabling ACPI override, because kernel does not support it. CONFIG_ACPI_INITRD_TABLE_OVERRIDE!=y or CONFIG_ACPI_TABLE_UPGRADE!=y"
|
||||
unset acpi_override
|
||||
fi
|
||||
|
||||
@@ -1605,7 +1605,11 @@ fi
|
||||
|
||||
# strip binaries
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
for p in strip xargs find; do
|
||||
# Prefer strip from elfutils for package size
|
||||
declare strip_cmd=$(command -v eu-strip)
|
||||
test -z "$strip_cmd" && strip_cmd="strip"
|
||||
|
||||
for p in $strip_cmd xargs find; do
|
||||
if ! type -P $p >/dev/null; then
|
||||
dinfo "Could not find '$p'. Not stripping the initramfs."
|
||||
do_strip=no
|
||||
@@ -1617,14 +1621,14 @@ if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Stripping files ***"
|
||||
find "$initdir" -type f \
|
||||
-executable -not -path '*/lib/modules/*.ko' -print0 \
|
||||
| xargs -r -0 strip -g 2>/dev/null
|
||||
| xargs -r -0 $strip_cmd -g 2>/dev/null
|
||||
|
||||
# strip kernel modules, but do not touch signed modules
|
||||
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
|
||||
| while read -r -d $'\0' f || [ -n "$f" ]; do
|
||||
SIG=$(tail -c 28 "$f" | tr -d '\000')
|
||||
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
|
||||
done | xargs -r -0 strip -g
|
||||
done | xargs -r -0 $strip_cmd -g
|
||||
|
||||
dinfo "*** Stripping files done ***"
|
||||
fi
|
||||
@@ -1684,7 +1688,7 @@ if ! ( echo $PARMS_TO_STORE > $initdir/lib/dracut/build-parameter.txt ); then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $hostonly_cmdline ]] ; then
|
||||
if [[ $hostonly_cmdline == "yes" ]] ; then
|
||||
unset _stored_cmdline
|
||||
if [ -d $initdir/etc/cmdline.d ];then
|
||||
dinfo "Stored kernel commandline:"
|
||||
@@ -1802,4 +1806,10 @@ fi
|
||||
|
||||
command -v restorecon &>/dev/null && restorecon -- "$outfile"
|
||||
|
||||
sync $outfile 2> /dev/null
|
||||
if [ $? -ne 0 ] ; then
|
||||
dinfo "dracut: sync operartion on newly created initramfs $outfile failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
@@ -37,7 +37,6 @@ URL: https://dracut.wiki.kernel.org/
|
||||
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.xz
|
||||
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
|
||||
|
||||
|
||||
BuildRequires: bash git
|
||||
BuildRequires: kmod-devel >= 15
|
||||
|
||||
@@ -101,7 +100,7 @@ Requires: sed
|
||||
Requires: xz
|
||||
Requires: gzip
|
||||
|
||||
%if 0%{?fedora} > 22
|
||||
%if 0%{?fedora} > 22 || 0%{?rhel} > 7
|
||||
Recommends: grubby
|
||||
Recommends: hardlink
|
||||
Recommends: pigz
|
||||
@@ -371,6 +370,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/50drm
|
||||
%{dracutlibdir}/modules.d/50plymouth
|
||||
%{dracutlibdir}/modules.d/80cms
|
||||
%{dracutlibdir}/modules.d/80lvmmerge
|
||||
%{dracutlibdir}/modules.d/90btrfs
|
||||
%{dracutlibdir}/modules.d/90crypt
|
||||
%{dracutlibdir}/modules.d/90dm
|
||||
@@ -379,6 +379,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/90lvm
|
||||
%{dracutlibdir}/modules.d/90mdraid
|
||||
%{dracutlibdir}/modules.d/90multipath
|
||||
%{dracutlibdir}/modules.d/90multipath-hostonly
|
||||
%{dracutlibdir}/modules.d/90qemu
|
||||
%{dracutlibdir}/modules.d/91crypt-gpg
|
||||
%{dracutlibdir}/modules.d/91crypt-loop
|
||||
@@ -471,6 +472,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/99img-lib
|
||||
%{dracutlibdir}/modules.d/90dmsquash-live
|
||||
%{dracutlibdir}/modules.d/90dmsquash-live-ntfs
|
||||
%{dracutlibdir}/modules.d/90livenet
|
||||
|
||||
%files tools
|
||||
|
22
git2spec.pl
22
git2spec.pl
@@ -3,10 +3,22 @@
|
||||
sub create_patches {
|
||||
my $tag=shift;
|
||||
my $pdir=shift;
|
||||
my $num=0;
|
||||
open( GIT, 'git format-patch -M -N --no-signature -o "'.$pdir.'" '.$tag.' |');
|
||||
@lines=<GIT>;
|
||||
close GIT; # be done
|
||||
my $n=1;
|
||||
my @lines;
|
||||
|
||||
mkdir $pdir, 0755;
|
||||
|
||||
open( GIT, 'git log -p --pretty=email --stat -m --first-parent --reverse '.$tag.'..HEAD |');
|
||||
|
||||
while (<GIT>) {
|
||||
if (/^From [a-z0-9]{40} .*$/) {
|
||||
my $fname = sprintf("%04d", $n++).".patch";
|
||||
push @lines, $fname;
|
||||
open FH, ">".$pdir."/".$fname;
|
||||
}
|
||||
print FH;
|
||||
}
|
||||
|
||||
return @lines;
|
||||
};
|
||||
|
||||
@@ -35,7 +47,7 @@ while(<>) {
|
||||
$num=1;
|
||||
for(@patches) {
|
||||
s/.*\///g;
|
||||
print "Patch$num: $_";
|
||||
print "Patch$num: $_\n";
|
||||
$num++;
|
||||
}
|
||||
print "\n";
|
||||
|
@@ -41,6 +41,7 @@
|
||||
#include <libkmod.h>
|
||||
#include <fts.h>
|
||||
#include <regex.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "hashmap.h"
|
||||
@@ -54,6 +55,7 @@ static bool arg_optional = false;
|
||||
static bool arg_silent = false;
|
||||
static bool arg_all = false;
|
||||
static bool arg_module = false;
|
||||
static bool arg_modalias = false;
|
||||
static bool arg_resolvelazy = false;
|
||||
static bool arg_resolvedeps = false;
|
||||
static bool arg_hostonly = false;
|
||||
@@ -794,6 +796,7 @@ static void usage(int status)
|
||||
" --kerneldir Specify the kernel module directory\n"
|
||||
" --firmwaredirs Specify the firmware directory search path with : separation\n"
|
||||
" --silent Don't display error messages for kernel module install\n"
|
||||
" --modalias Only generate module list from /sys/devices modalias list\n"
|
||||
" -o --optional If kernel module does not exist, do not fail\n"
|
||||
" -p --mod-filter-path Filter kernel modules by path regexp\n"
|
||||
" -P --mod-filter-nopath Exclude kernel modules by path regexp\n"
|
||||
@@ -818,6 +821,7 @@ static int parse_argv(int argc, char *argv[])
|
||||
enum {
|
||||
ARG_VERSION = 0x100,
|
||||
ARG_SILENT,
|
||||
ARG_MODALIAS,
|
||||
ARG_KERNELDIR,
|
||||
ARG_FIRMWAREDIRS,
|
||||
ARG_DEBUG
|
||||
@@ -843,6 +847,7 @@ static int parse_argv(int argc, char *argv[])
|
||||
{"mod-filter-symbol", required_argument, NULL, 's'},
|
||||
{"mod-filter-nosymbol", required_argument, NULL, 'S'},
|
||||
{"mod-filter-noname", required_argument, NULL, 'N'},
|
||||
{"modalias", no_argument, NULL, ARG_MODALIAS},
|
||||
{"silent", no_argument, NULL, ARG_SILENT},
|
||||
{"kerneldir", required_argument, NULL, ARG_KERNELDIR},
|
||||
{"firmwaredirs", required_argument, NULL, ARG_FIRMWAREDIRS},
|
||||
@@ -863,6 +868,10 @@ static int parse_argv(int argc, char *argv[])
|
||||
case ARG_SILENT:
|
||||
arg_silent = true;
|
||||
break;
|
||||
case ARG_MODALIAS:
|
||||
arg_modalias = true;
|
||||
return 1;
|
||||
break;
|
||||
case 'v':
|
||||
arg_loglevel = LOG_INFO;
|
||||
break;
|
||||
@@ -949,6 +958,16 @@ static int parse_argv(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (!kerneldir) {
|
||||
struct utsname buf;
|
||||
uname(&buf);
|
||||
kerneldir = strdup(buf.version);
|
||||
}
|
||||
|
||||
if (arg_modalias) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (arg_module) {
|
||||
if (!firmwaredirs) {
|
||||
char *path = NULL;
|
||||
@@ -965,6 +984,7 @@ static int parse_argv(int argc, char *argv[])
|
||||
firmwaredirs = strv_split(path, ":");
|
||||
}
|
||||
}
|
||||
|
||||
if (!optind || optind == argc) {
|
||||
log_error("No SOURCE argument given");
|
||||
usage(EXIT_FAILURE);
|
||||
@@ -1218,16 +1238,6 @@ static bool check_module_path(const char *path)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool check_module_hostonly(struct kmod_module *mod)
|
||||
{
|
||||
const char *name = kmod_module_get_name(mod);
|
||||
|
||||
if (check_hashmap(modules_loaded, name))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int install_module(struct kmod_module *mod)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -1242,7 +1252,7 @@ static int install_module(struct kmod_module *mod)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (arg_hostonly && ! check_module_hostonly(mod)) {
|
||||
if (arg_hostonly && !check_hashmap(modules_loaded, name)) {
|
||||
log_debug("dracut_install '%s' not hostonly", name);
|
||||
return 0;
|
||||
}
|
||||
@@ -1258,7 +1268,7 @@ static int install_module(struct kmod_module *mod)
|
||||
return 0;
|
||||
|
||||
if (!check_module_path(path) || !check_module_symbols(mod)) {
|
||||
log_debug("No symbol or patch match for '%s'", path);
|
||||
log_debug("No symbol or path match for '%s'", path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1297,12 +1307,94 @@ static int install_module(struct kmod_module *mod)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int modalias_list(struct kmod_ctx *ctx)
|
||||
{
|
||||
int err;
|
||||
struct kmod_list *loaded_list = NULL;
|
||||
struct kmod_list *itr, *l;
|
||||
_cleanup_fts_close_ FTS *fts = NULL;
|
||||
|
||||
{
|
||||
char *paths[] = { "/sys/devices", NULL };
|
||||
fts = fts_open(paths, FTS_NOCHDIR|FTS_NOSTAT, NULL);
|
||||
}
|
||||
for (FTSENT *ftsent = fts_read(fts); ftsent != NULL; ftsent = fts_read(fts)) {
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
_cleanup_kmod_module_unref_list_ struct kmod_list *list = NULL;
|
||||
struct kmod_list *l;
|
||||
|
||||
int err;
|
||||
|
||||
char alias[2048];
|
||||
size_t len;
|
||||
|
||||
if (strncmp("modalias", ftsent->fts_name, 8) != 0)
|
||||
continue;
|
||||
if (!(f = fopen(ftsent->fts_accpath, "r")))
|
||||
continue;
|
||||
|
||||
if(!fgets(alias, sizeof(alias), f))
|
||||
continue;
|
||||
|
||||
len = strlen(alias);
|
||||
|
||||
if (len == 0)
|
||||
continue;
|
||||
|
||||
if (alias[len-1] == '\n')
|
||||
alias[len-1] = 0;
|
||||
|
||||
err = kmod_module_new_from_lookup(ctx, alias, &list);
|
||||
if (err < 0)
|
||||
continue;
|
||||
|
||||
kmod_list_foreach(l, list) {
|
||||
struct kmod_module *mod = kmod_module_get_module(l);
|
||||
char *name = strdup(kmod_module_get_name(mod));
|
||||
kmod_module_unref(mod);
|
||||
hashmap_put(modules_loaded, name, name);
|
||||
}
|
||||
}
|
||||
|
||||
err = kmod_module_new_from_loaded(ctx, &loaded_list);
|
||||
if (err < 0) {
|
||||
errno = err;
|
||||
log_error("Could not get list of loaded modules: %m. Switching to non-hostonly mode.");
|
||||
arg_hostonly = false;
|
||||
} else {
|
||||
kmod_list_foreach(itr, loaded_list) {
|
||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
|
||||
|
||||
struct kmod_module *mod = kmod_module_get_module(itr);
|
||||
char *name = strdup(kmod_module_get_name(mod));
|
||||
hashmap_put(modules_loaded, name, name);
|
||||
kmod_module_unref(mod);
|
||||
|
||||
/* also put the modules from the new kernel in the hashmap,
|
||||
* which resolve the name as an alias, in case a kernel module is
|
||||
* renamed.
|
||||
*/
|
||||
err = kmod_module_new_from_lookup(ctx, name, &modlist);
|
||||
if (err < 0)
|
||||
continue;
|
||||
if (!modlist)
|
||||
continue;
|
||||
kmod_list_foreach(l, modlist) {
|
||||
mod = kmod_module_get_module(l);
|
||||
char *name = strdup(kmod_module_get_name(mod));
|
||||
hashmap_put(modules_loaded, name, name);
|
||||
kmod_module_unref(mod);
|
||||
}
|
||||
}
|
||||
kmod_module_unref_list(loaded_list);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int install_modules(int argc, char **argv)
|
||||
{
|
||||
_cleanup_kmod_unref_ struct kmod_ctx *ctx = NULL;
|
||||
struct kmod_list *loaded_list = NULL;
|
||||
struct kmod_list *itr, *l;
|
||||
int err;
|
||||
struct kmod_list *itr;
|
||||
|
||||
struct kmod_module *mod = NULL, *mod_o = NULL;
|
||||
|
||||
@@ -1311,38 +1403,37 @@ static int install_modules(int argc, char **argv)
|
||||
|
||||
ctx = kmod_new(kerneldir, NULL);
|
||||
if (arg_hostonly) {
|
||||
err = kmod_module_new_from_loaded(ctx, &loaded_list);
|
||||
if (err < 0) {
|
||||
errno = err;
|
||||
log_error("Could not get list of loaded modules: %m. Switching to non-hostonly mode.");
|
||||
arg_hostonly = false;
|
||||
char *modalias_file;
|
||||
modalias_file = getenv("DRACUT_KERNEL_MODALIASES");
|
||||
|
||||
if (modalias_file == NULL) {
|
||||
modalias_list(ctx);
|
||||
} else {
|
||||
kmod_list_foreach(itr, loaded_list) {
|
||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
if ((f = fopen(modalias_file, "r"))) {
|
||||
char name[2048];
|
||||
|
||||
struct kmod_module *mod = kmod_module_get_module(itr);
|
||||
char *name = strdup(kmod_module_get_name(mod));
|
||||
hashmap_put(modules_loaded, name, name);
|
||||
kmod_module_unref(mod);
|
||||
while (!feof(f)) {
|
||||
size_t len;
|
||||
char *dupname = NULL;
|
||||
|
||||
/* also put the modules from the new kernel in the hashmap,
|
||||
* which resolve the name as an alias, in case a kernel module is
|
||||
* renamed.
|
||||
*/
|
||||
err = kmod_module_new_from_lookup(ctx, name, &modlist);
|
||||
if (err < 0)
|
||||
continue;
|
||||
if (!modlist)
|
||||
continue;
|
||||
kmod_list_foreach(l, modlist) {
|
||||
mod = kmod_module_get_module(l);
|
||||
char *name = strdup(kmod_module_get_name(mod));
|
||||
hashmap_put(modules_loaded, name, name);
|
||||
kmod_module_unref(mod);
|
||||
if(!(fgets(name, sizeof(name), f)))
|
||||
continue;
|
||||
len = strlen(name);
|
||||
|
||||
if (len == 0)
|
||||
continue;
|
||||
|
||||
if (name[len-1] == '\n')
|
||||
name[len-1] = 0;
|
||||
|
||||
log_debug("Adding module '%s' to hostonly module list", name);
|
||||
dupname = strdup(name);
|
||||
hashmap_put(modules_loaded, dupname, dupname);
|
||||
}
|
||||
}
|
||||
kmod_module_unref_list(loaded_list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
@@ -1576,6 +1667,20 @@ int main(int argc, char **argv)
|
||||
|
||||
log_open();
|
||||
|
||||
modules_loaded = hashmap_new(string_hash_func, string_compare_func);
|
||||
if (arg_modalias) {
|
||||
Iterator i;
|
||||
char *name;
|
||||
_cleanup_kmod_unref_ struct kmod_ctx *ctx = NULL;
|
||||
ctx = kmod_new(kerneldir, NULL);
|
||||
|
||||
modalias_list(ctx);
|
||||
HASHMAP_FOREACH(name, modules_loaded, i) {
|
||||
printf("%s\n", name);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
path = getenv("PATH");
|
||||
|
||||
if (path == NULL) {
|
||||
@@ -1614,7 +1719,6 @@ int main(int argc, char **argv)
|
||||
|
||||
items = hashmap_new(string_hash_func, string_compare_func);
|
||||
items_failed = hashmap_new(string_hash_func, string_compare_func);
|
||||
modules_loaded = hashmap_new(string_hash_func, string_compare_func);
|
||||
|
||||
if (!items || !items_failed || !modules_loaded) {
|
||||
log_error("Out of memory");
|
||||
|
@@ -104,7 +104,7 @@ calc_netmask() {
|
||||
local prefix=$1
|
||||
|
||||
[ -z "$prefix" ] && return
|
||||
mask=$(echo "(2 ^ 32) - (2 ^ $prefix)" | bc -l)
|
||||
mask=$(( 0xffffffff << (32 - $prefix) ))
|
||||
byte1=$(( mask >> 24 ))
|
||||
byte2=$(( mask >> 16 ))
|
||||
byte3=$(( mask >> 8 ))
|
||||
|
@@ -77,6 +77,7 @@ install() {
|
||||
$systemdsystemunitdir/sys-kernel-config.mount \
|
||||
\
|
||||
$systemdsystemunitdir/kmod-static-nodes.service \
|
||||
$systemdsystemunitdir/systemd-tmpfiles-setup.service \
|
||||
$systemdsystemunitdir/systemd-tmpfiles-setup-dev.service \
|
||||
$systemdsystemunitdir/systemd-ask-password-console.path \
|
||||
$systemdsystemunitdir/systemd-udevd-control.socket \
|
||||
@@ -112,6 +113,7 @@ install() {
|
||||
$systemdsystemunitdir/sysinit.target.wants/systemd-udevd.service \
|
||||
$systemdsystemunitdir/sysinit.target.wants/systemd-udev-trigger.service \
|
||||
$systemdsystemunitdir/sysinit.target.wants/kmod-static-nodes.service \
|
||||
$systemdsystemunitdir/sysinit.target.wants/systemd-tmpfiles-setup.service \
|
||||
$systemdsystemunitdir/sysinit.target.wants/systemd-tmpfiles-setup-dev.service \
|
||||
$systemdsystemunitdir/sysinit.target.wants/systemd-sysctl.service \
|
||||
\
|
||||
@@ -194,6 +196,10 @@ install() {
|
||||
grep '^utmp:' /etc/group >> "$initdir/etc/group"
|
||||
grep '^root:' /etc/group >> "$initdir/etc/group"
|
||||
|
||||
# we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
|
||||
grep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
grep '^systemd-network:' /etc/group >> "$initdir/etc/group"
|
||||
|
||||
ln_r $systemdutildir/systemd "/init"
|
||||
ln_r $systemdutildir/systemd "/sbin/init"
|
||||
|
||||
|
@@ -77,12 +77,6 @@ do_fips()
|
||||
local _module
|
||||
|
||||
KERNEL=$(uname -r)
|
||||
BOOT_IMAGE="$(getarg BOOT_IMAGE)"
|
||||
BOOT_IMAGE="${BOOT_IMAGE:-/vmlinuz-${KERNEL}}"
|
||||
if ! [ -e "/boot/.${BOOT_IMAGE}.hmac" ] && ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
|
||||
warn "/boot/.${BOOT_IMAGE}.hmac does not exist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
|
||||
@@ -115,6 +109,13 @@ do_fips()
|
||||
elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then
|
||||
do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
|
||||
else
|
||||
BOOT_IMAGE="$(getarg BOOT_IMAGE)"
|
||||
[ -e "/boot/.${BOOT_IMAGE}.hmac" ] || BOOT_IMAGE="vmlinuz-${KERNEL}"
|
||||
|
||||
if ! [ -e "/boot/.${BOOT_IMAGE}.hmac" ]; then
|
||||
warn "/boot/.${BOOT_IMAGE}.hmac does not exist"
|
||||
return 1
|
||||
fi
|
||||
sha512hmac -c "/boot/.${BOOT_IMAGE}.hmac" || return 1
|
||||
fi
|
||||
|
||||
|
@@ -21,7 +21,7 @@ installkernel() {
|
||||
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
|
||||
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
|
||||
_fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib "
|
||||
_fipsmodules+="aes_s390 des_s390 prng sha256_s390 sha_common des_check_key ghash_s390 sha1_s390 sha512_s390"
|
||||
_fipsmodules+="aes_s390 des_s390 prng sha256_s390 sha_common des_check_key ghash_s390 sha1_s390 sha512_s390 cmac authenc "
|
||||
fi
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
@@ -191,7 +191,10 @@ case $reason in
|
||||
echo '. /lib/net-lib.sh'
|
||||
echo "setup_net $netif"
|
||||
if [ -n "$new_classless_static_routes" ]; then
|
||||
modify_routes add "$(parse_option_121 $new_classless_static_routes)"
|
||||
OLDIFS="$IFS"
|
||||
IFS=".$IFS"
|
||||
parse_option_121 $new_classless_static_routes
|
||||
IFS="$OLDIFS"
|
||||
fi
|
||||
echo "source_hook initqueue/online $netif"
|
||||
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
|
||||
|
@@ -1,6 +1,8 @@
|
||||
|
||||
option classless-routes code 121 = array of unsigned integer 8;
|
||||
option classless-static-routes code 121 = array of unsigned integer 8;
|
||||
|
||||
send dhcp-client-identifier = hardware;
|
||||
|
||||
request subnet-mask, broadcast-address, time-offset, routers,
|
||||
domain-name, domain-name-servers, domain-search, host-name,
|
||||
root-path, interface-mtu, classless-routes;
|
||||
root-path, interface-mtu, classless-static-routes;
|
||||
|
@@ -108,17 +108,22 @@ do_static() {
|
||||
if strglobin $ip '*:*:*'; then
|
||||
# note no ip addr flush for ipv6
|
||||
ip addr add $ip/$mask ${srv:+peer $srv} dev $netif
|
||||
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
|
||||
wait_for_ipv6_dad $netif
|
||||
else
|
||||
if command -v arping2 >/dev/null; then
|
||||
if arping2 -q -C 1 -c 2 -I $netif -0 $ip ; then
|
||||
warn "Duplicate address detected for $ip for interface $netif."
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
if ! arping -f -q -D -c 2 -I $netif $ip ; then
|
||||
warn "Duplicate address detected for $ip for interface $netif."
|
||||
return 1
|
||||
if [ -z "$srv" ]; then
|
||||
if command -v arping2 >/dev/null; then
|
||||
if arping2 -q -C 1 -c 2 -I $netif -0 $ip ; then
|
||||
warn "Duplicate address detected for $ip for interface $netif."
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
if ! arping -f -q -D -c 2 -I $netif $ip ; then
|
||||
warn "Duplicate address detected for $ip for interface $netif."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
ip addr flush dev $netif
|
||||
|
@@ -25,7 +25,10 @@ installkernel() {
|
||||
install() {
|
||||
local _arch _i _dir
|
||||
inst_multiple ip dhclient sed awk
|
||||
|
||||
inst_multiple -o arping arping2
|
||||
strstr "$(arping 2>&1)" "ARPing 2" && mv "$initdir/bin/arping" "$initdir/bin/arping2"
|
||||
|
||||
inst_multiple -o ping ping6
|
||||
inst_multiple -o teamd teamdctl teamnl
|
||||
inst_simple /etc/libnl/classid
|
||||
|
@@ -102,7 +102,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
# Default: We don't know the interface to use, handle all
|
||||
# Fixme: waiting for the interface as well.
|
||||
else
|
||||
cond='ACTION=="add", SUBSYSTEM=="net"'
|
||||
cond='ACTION=="add", SUBSYSTEM=="net", ENV{DEVTYPE}!="wlan|wwan"'
|
||||
# if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh
|
||||
echo "$cond, $runcmd" > /etc/udev/rules.d/91-default-net.rules
|
||||
fi
|
||||
|
@@ -654,6 +654,7 @@ wait_for_ipv6_dad_link() {
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
|
||||
&& [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
|
||||
&& return 0
|
||||
[ -n "$(ip -6 addr show dev "$1" scope link dadfailed)" ] \
|
||||
&& return 1
|
||||
@@ -671,6 +672,7 @@ wait_for_ipv6_dad() {
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -z "$(ip -6 addr show dev "$1" tentative)" ] \
|
||||
&& [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
|
||||
&& return 0
|
||||
[ -n "$(ip -6 addr show dev "$1" dadfailed)" ] \
|
||||
&& return 1
|
||||
@@ -688,7 +690,7 @@ wait_for_ipv6_auto() {
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -z "$(ip -6 addr show dev "$1" tentative)" ] \
|
||||
&& [ -n "$(ip -6 route list proto ra dev "$1")" ] \
|
||||
&& [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
|
||||
&& return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
|
@@ -15,7 +15,7 @@ depends() {
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _dir _crt _found _lib
|
||||
local _dir _crt _found _lib _nssckbi _p11roots _p11root _p11item
|
||||
inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
|
||||
inst_multiple -o ctorrent
|
||||
inst_multiple curl
|
||||
@@ -29,6 +29,7 @@ install() {
|
||||
[[ -d $_dir ]] || continue
|
||||
for _lib in $_dir/libcurl.so.*; do
|
||||
[[ -e $_lib ]] || continue
|
||||
[[ $_nssckbi ]] || _nssckbi=$(grep -F --binary-files=text -z libnssckbi $_lib)
|
||||
_crt=$(grep -F --binary-files=text -z .crt $_lib)
|
||||
[[ $_crt ]] || continue
|
||||
[[ $_crt == /*/* ]] || continue
|
||||
@@ -39,6 +40,39 @@ install() {
|
||||
_found=1
|
||||
done
|
||||
done
|
||||
[[ $_found ]] || dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
|
||||
# If we found no cert bundle files referenced in libcurl but we
|
||||
# *did* find a mention of libnssckbi (checked above), install it.
|
||||
# If its truly NSS libnssckbi, it includes its own trust bundle,
|
||||
# but if it's really p11-kit-trust.so, we need to find the dirs
|
||||
# where it will look for a trust bundle and install them too.
|
||||
if ! [[ $_found ]] && [[ $_nssckbi ]] ; then
|
||||
_found=1
|
||||
inst_libdir_file "libnssckbi.so*" || _found=
|
||||
for _dir in $libdirs; do
|
||||
[[ -e $_dir/libnssckbi.so ]] || continue
|
||||
# this looks for directory-ish strings in the file
|
||||
for _p11roots in $(grep -o --binary-files=text "/[[:alpha:]][[:print:]]*" $_dir/libnssckbi.so) ; do
|
||||
# the string can be a :-separated list of dirs
|
||||
for _p11root in $(echo "$_p11roots" | tr ':' '\n') ; do
|
||||
# check if it's actually a directory (there are
|
||||
# several false positives in the results)
|
||||
[[ -d "$_p11root" ]] || continue
|
||||
# check if it has some specific subdirs that all
|
||||
# p11-kit trust dirs have
|
||||
[[ -d "${_p11root}/anchors" ]] || continue
|
||||
[[ -d "${_p11root}/blacklist" ]] || continue
|
||||
# so now we know it's really a p11-kit trust dir;
|
||||
# install everything in it
|
||||
for _p11item in $(find "$_p11root") ; do
|
||||
if ! inst "$_p11item" ; then
|
||||
dwarn "Couldn't install '$_p11item' from p11-kit trust dir '$_p11root'; HTTPS might not work."
|
||||
continue
|
||||
fi
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
fi
|
||||
[[ $_found ]] || dwarn "Couldn't find SSL CA cert bundle or libnssckbi.so; HTTPS won't work."
|
||||
}
|
||||
|
||||
|
@@ -21,12 +21,11 @@ installkernel() {
|
||||
"=drivers/gpu/drm/i2c" \
|
||||
"=drivers/gpu/drm/panel" \
|
||||
"=drivers/gpu/drm/bridge" \
|
||||
"=drivers/pwm" \
|
||||
"=drivers/video/backlight" \
|
||||
${NULL}
|
||||
fi
|
||||
|
||||
instmods amdkfd hyperv_fb
|
||||
instmods amdkfd hyperv_fb "=drivers/pwm"
|
||||
|
||||
# if the hardware is present, include module even if it is not currently loaded,
|
||||
# as we could e.g. be in the installer; nokmsboot boot parameter will disable
|
||||
|
61
modules.d/80lvmmerge/README.md
Executable file
61
modules.d/80lvmmerge/README.md
Executable file
@@ -0,0 +1,61 @@
|
||||
# lvmmerge - dracut module
|
||||
|
||||
## Preparation
|
||||
- ensure that the lvm thin pool is big enough
|
||||
- backup any (most likely /boot and /boot/efi) device with:
|
||||
```
|
||||
# mkdir /restoredev
|
||||
# dev=<device>; umount $dev; dd if="$dev" of=/restoredev/$(systemd-escape -p "$dev"); mount $dev
|
||||
```
|
||||
- backup the MBR
|
||||
```
|
||||
# dev=<device>; dd if="$dev" of=/restoredev/$(systemd-escape -p "$dev") bs=446 count=1
|
||||
# ls -l /dev/disk/by-path/virtio-pci-0000\:00\:07.0
|
||||
lrwxrwxrwx. 1 root root 9 Jul 24 04:27 /dev/disk/by-path/virtio-pci-0000:00:07.0 -> ../../vda
|
||||
```
|
||||
- backup some partitions
|
||||
```
|
||||
# dev=/dev/disk/by-path/virtio-pci-0000:00:07.0
|
||||
# dd if="$dev" of=/restoredev/$(systemd-escape -p "$dev") bs=446 count=1
|
||||
# umount /boot/efi
|
||||
# dev=/dev/disk/by-partuuid/687177a8-86b3-4e37-a328-91d20db9563c
|
||||
# dd if="$dev" of=/restoredev/$(systemd-escape -p "$dev")
|
||||
# umount /boot
|
||||
# dev=/dev/disk/by-partuuid/4fdf99e9-4f28-4207-a26f-c76546824eaf
|
||||
# dd if="$dev" of=/restoredev/$(systemd-escape -p "$dev")
|
||||
```
|
||||
Final /restoredev
|
||||
```
|
||||
# ls -al /restoredev/
|
||||
total 1253380
|
||||
drwx------. 2 root root 250 Jul 24 04:38 .
|
||||
dr-xr-xr-x. 18 root root 242 Jul 24 04:32 ..
|
||||
-rw-------. 1 root root 209715200 Jul 24 04:34 dev-disk-by\x2dpartuuid-4fdf99e9\x2d4f28\x2d4207\x2da26f\x2dc76546824eaf
|
||||
-rw-------. 1 root root 1073741824 Jul 24 04:34 dev-disk-by\x2dpartuuid-687177a8\x2d86b3\x2d4e37\x2da328\x2d91d20db9563c
|
||||
-rw-------. 1 root root 446 Jul 24 04:38 dev-disk-by\x2dpath-virtio\x2dpci\x2d0000:00:07.0
|
||||
```
|
||||
- make a thin snapshot
|
||||
```
|
||||
# lvm lvcreate -pr -s rhel/root --name reset
|
||||
```
|
||||
|
||||
- mark the snapshot with a tag
|
||||
```
|
||||
# lvm lvchange --addtag reset rhel/reset
|
||||
```
|
||||
|
||||
- remove /restoredev
|
||||
```
|
||||
# rm -fr /restoredev
|
||||
```
|
||||
|
||||
## Operation
|
||||
|
||||
If a boot entry with ```rd.lvm.mergetags=<tag>``` is selected and there are LVs with ```<tag>```
|
||||
dracut will
|
||||
- make a copy of the snapshot
|
||||
- merge it back to the original
|
||||
- rename the copy back to the name of the snapshot
|
||||
- if /restordev appears in the root, then it will restore the images
|
||||
found in that directory. This can be used to restore /boot and /boot/efi and the
|
||||
MBR of the boot device
|
96
modules.d/80lvmmerge/lvmmerge.sh
Executable file
96
modules.d/80lvmmerge/lvmmerge.sh
Executable file
@@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
do_merge() {
|
||||
sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 1/' \
|
||||
/etc/lvm/lvm.conf
|
||||
|
||||
systemctl --no-block stop sysroot.mount
|
||||
swapoff -a
|
||||
umount -R /sysroot
|
||||
|
||||
for tag in $(getargs rd.lvm.mergetags); do
|
||||
lvm vgs --noheadings -o vg_name | \
|
||||
while read -r vg || [[ -n $vg ]]; do
|
||||
unset LVS
|
||||
declare -a LVS
|
||||
lvs=$(lvm lvs --noheadings -o lv_name "$vg")
|
||||
for lv in $lvs; do
|
||||
lvm lvchange -an "$vg/$lv"
|
||||
|
||||
tags=$(trim "$(lvm lvs --noheadings -o lv_tags "$vg/$lv")")
|
||||
strstr ",${tags}," ",${tag}," || continue
|
||||
|
||||
if ! lvm lvs --noheadings -o lv_name "${vg}/${lv}_dracutsnap" &>/dev/null; then
|
||||
info "Creating backup ${lv}_dracutsnap of ${vg}/${lv}"
|
||||
lvm lvcreate -pr -s "${vg}/${lv}" --name "${lv}_dracutsnap"
|
||||
fi
|
||||
lvm lvchange --addtag "$tag" "${vg}/${lv}_dracutsnap"
|
||||
|
||||
info "Merging back ${vg}/${lv} to the original LV"
|
||||
lvm lvconvert --merge "${vg}/${lv}"
|
||||
|
||||
LVS+=($lv)
|
||||
done
|
||||
|
||||
systemctl --no-block stop sysroot.mount
|
||||
udevadm settle
|
||||
|
||||
for ((i=0; i < 100; i++)); do
|
||||
lvm vgchange -an "$vg" && break
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
udevadm settle
|
||||
lvm vgchange -ay "$vg"
|
||||
udevadm settle
|
||||
for lv in "${LVS[@]}"; do
|
||||
info "Renaming ${lv}_dracutsnap backup to ${vg}/${lv}"
|
||||
lvm lvrename "$vg" "${lv}_dracutsnap" "${lv}"
|
||||
done
|
||||
udevadm settle
|
||||
done
|
||||
done
|
||||
|
||||
systemctl --no-block reset-failed systemd-fsck-root
|
||||
systemctl --no-block start systemd-fsck-root
|
||||
systemctl --no-block reset-failed sysroot.mount
|
||||
systemctl --no-block start sysroot.mount
|
||||
|
||||
for ((i=0; i < 100; i++)); do
|
||||
[[ -d /sysroot/dev ]] && break
|
||||
sleep 0.5
|
||||
systemctl --no-block start sysroot.mount
|
||||
done
|
||||
|
||||
if [[ -d /sysroot/restoredev ]]; then
|
||||
(
|
||||
if cd /sysroot/restoredev; then
|
||||
# restore devices and partitions
|
||||
for i in *; do
|
||||
target=$(systemd-escape -pu "$i")
|
||||
if ! [[ -b $target ]]; then
|
||||
warn "Not restoring $target, as the device does not exist"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Just in case
|
||||
umount "$target" &> /dev/null
|
||||
|
||||
info "Restoring $target"
|
||||
dd if="$i" of="$target" |& vinfo
|
||||
done
|
||||
fi
|
||||
)
|
||||
mount -o remount,rw /sysroot
|
||||
rm -fr /sysroot/restoredev
|
||||
fi
|
||||
info "Rebooting"
|
||||
reboot
|
||||
}
|
||||
|
||||
if getarg rd.lvm.mergetags; then
|
||||
do_merge
|
||||
fi
|
||||
|
25
modules.d/80lvmmerge/module-setup.sh
Executable file
25
modules.d/80lvmmerge/module-setup.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
# No point trying to support lvm if the binaries are missing
|
||||
require_binaries lvm dd swapoff || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo lvm
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
hostonly="" instmods dm-snapshot
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple dd swapoff
|
||||
inst_hook cleanup 01 "$moddir/lvmmerge.sh"
|
||||
}
|
@@ -16,6 +16,14 @@ crypttab_contains() {
|
||||
[ "$dev" -ef "$_dev" ] && return 0
|
||||
done
|
||||
fi
|
||||
if [ -e /usr/lib/dracut/modules.d/90crypt/block_uuid.map ]; then
|
||||
# search for line starting with $d
|
||||
_line=$(sed -n "\,^$d .*$,{p}" /usr/lib/dracut/modules.d/90crypt/block_uuid.map)
|
||||
[ -z "$_line" ] && continue
|
||||
# get second column with uuid
|
||||
_uuid="$(echo $_line | sed 's,^.* \(.*$\),\1,')"
|
||||
strstr "$_uuid" "${luks##luks-}" && return 0
|
||||
fi
|
||||
done < /etc/crypttab
|
||||
fi
|
||||
return 1
|
||||
@@ -210,8 +218,7 @@ readkey() {
|
||||
if [ -f /lib/dracut-crypt-loop-lib.sh ]; then
|
||||
. /lib/dracut-crypt-loop-lib.sh
|
||||
loop_decrypt "$mntp" "$keypath" "$keydev" "$device"
|
||||
initqueue --onetime --finished --unique --name "crypt-loop-cleanup-99-${mntp##*/}" \
|
||||
$(command -v umount) "$mntp; " $(command -v rmdir) "$mntp"
|
||||
printf "%s\n" "umount \"$mntp\"; rmdir \"$mntp\";" > ${hookdir}/cleanup/"crypt-loop-cleanup-99-${mntp##*/}".sh
|
||||
return 0
|
||||
else
|
||||
die "No loop file support to decrypt '$keypath' on '$keydev'."
|
||||
|
@@ -75,6 +75,8 @@ install() {
|
||||
[[ $_dev == UUID=* ]] && \
|
||||
_dev="/dev/disk/by-uuid/${_dev#UUID=}"
|
||||
|
||||
echo "$_dev $(blkid $_dev -s UUID -o value)" > /usr/lib/dracut/modules.d/90crypt/block_uuid.map
|
||||
|
||||
for _hdev in "${!host_fs_types[@]}"; do
|
||||
[[ ${host_fs_types[$_hdev]} == "crypto_LUKS" ]] || continue
|
||||
if [[ $_hdev -ef $_dev ]] || [[ /dev/block/$_hdev -ef $_dev ]]; then
|
||||
|
@@ -2,6 +2,30 @@
|
||||
|
||||
type crypttab_contains >/dev/null 2>&1 || . /lib/dracut-crypt-lib.sh
|
||||
|
||||
|
||||
_cryptgetargsname() {
|
||||
debug_off
|
||||
local _o _found _key
|
||||
unset _o
|
||||
unset _found
|
||||
CMDLINE=$(getcmdline)
|
||||
_key="$1"
|
||||
set --
|
||||
for _o in $CMDLINE; do
|
||||
if [ "$_o" = "$_key" ]; then
|
||||
_found=1;
|
||||
elif [ "${_o%=*}" = "${_key%=}" ]; then
|
||||
[ -n "${_o%=*}" ] && set -- "$@" "${_o#*=}";
|
||||
_found=1;
|
||||
fi
|
||||
done
|
||||
if [ -n "$_found" ]; then
|
||||
[ $# -gt 0 ] && printf '%s' "$*"
|
||||
return 0
|
||||
fi
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ! getargbool 1 rd.luks -d -n rd_NO_LUKS; then
|
||||
info "rd.luks=0: removing cryptoluks activation"
|
||||
rm -f -- /etc/udev/rules.d/70-luks.rules
|
||||
@@ -15,8 +39,8 @@ else
|
||||
tout=$(getarg rd.luks.key.tout)
|
||||
|
||||
if [ -e /etc/crypttab ]; then
|
||||
while read _mapper _dev _rest ; do
|
||||
set_systemd_timeout_for_dev $_dev
|
||||
while read -r _ _dev _ || [ -n "$_dev" ]; do
|
||||
set_systemd_timeout_for_dev "$_dev"
|
||||
done < /etc/crypttab
|
||||
fi
|
||||
|
||||
@@ -24,23 +48,29 @@ else
|
||||
for luksid in $LUKS; do
|
||||
|
||||
luksid=${luksid##luks-}
|
||||
if luksname=$(_cryptgetargsname "rd.luks.name=$luksid="); then
|
||||
luksname="${luksname#$luksid=}"
|
||||
else
|
||||
luksname="luks-$luksid"
|
||||
fi
|
||||
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
||||
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
||||
printf -- 'RUN+="%s --settled --unique --onetime ' $(command -v initqueue)
|
||||
printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
|
||||
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
|
||||
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' "$luksid"
|
||||
printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
|
||||
printf -- '--name cryptroot-ask-%%k %s ' "$(command -v cryptroot-ask)"
|
||||
printf -- '$env{DEVNAME} %s %s"\n' "$luksname" "$tout"
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
else
|
||||
luksname=$(dev_unit_name "$luksname")
|
||||
if ! crypttab_contains "$luksid"; then
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
||||
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
||||
printf -- 'RUN+="%s --settled --unique --onetime ' $(command -v initqueue)
|
||||
printf -- '--name systemd-cryptsetup-%%k %s start ' $(command -v systemctl)
|
||||
printf -- 'systemd-cryptsetup@luks$$(dev_unit_name -$env{ID_FS_UUID}).service"\n'
|
||||
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' "$luksid"
|
||||
printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
|
||||
printf -- '--name systemd-cryptsetup-%%k %s start ' "$(command -v systemctl)"
|
||||
printf -- 'systemd-cryptsetup@%s.service"\n' "$luksname"
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
fi
|
||||
fi
|
||||
@@ -48,25 +78,25 @@ else
|
||||
uuid=$luksid
|
||||
while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done
|
||||
printf -- '[ -e /dev/disk/by-id/dm-uuid-CRYPT-LUKS?-*%s*-* ] || exit 1\n' $uuid \
|
||||
>> $hookdir/initqueue/finished/90-crypt.sh
|
||||
>> "$hookdir/initqueue/finished/90-crypt.sh"
|
||||
|
||||
{
|
||||
printf -- '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid
|
||||
printf -- 'warn "crypto LUKS UUID "%s" not found"\n' $luksid
|
||||
} >> $hookdir/emergency/90-crypt.sh
|
||||
} >> "$hookdir/emergency/90-crypt.sh"
|
||||
done
|
||||
elif getargbool 0 rd.auto; then
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' "$(command -v initqueue)"
|
||||
printf -- '--unique --settled --onetime --name cryptroot-ask-%%k '
|
||||
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $(command -v cryptroot-ask) $tout
|
||||
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' "$(command -v cryptroot-ask)" "$tout"
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
else
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' "$(command -v initqueue)"
|
||||
printf -- '--unique --settled --onetime --name crypt-run-generator-%%k '
|
||||
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $(command -v crypt-run-generator)
|
||||
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' "$(command -v crypt-run-generator)"
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
fi
|
||||
fi
|
||||
|
22
modules.d/90dmsquash-live-ntfs/module-setup.sh
Executable file
22
modules.d/90dmsquash-live-ntfs/module-setup.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
command -v
|
||||
|
||||
check() {
|
||||
require_binaries ntfs-3g || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo 90dmsquash-live
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_multiple fusermount ulockmgr_server mount.fuse ntfs-3g
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
hostonly='' instmods fuse
|
||||
}
|
@@ -78,7 +78,20 @@ if [ -f $livedev ]; then
|
||||
esac
|
||||
[ -e /sys/fs/$fstype ] || modprobe $fstype
|
||||
else
|
||||
mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
|
||||
if [ "$(blkid -o value -s TYPE $livedev)" != "ntfs" ]; then
|
||||
mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
|
||||
else
|
||||
# Symlinking /usr/bin/ntfs-3g as /sbin/mount.ntfs seems to boot
|
||||
# at the first glance, but ends with lots and lots of squashfs
|
||||
# errors, because systemd attempts to kill the ntfs-3g process?!
|
||||
if [ -x "$(find_binary "ntfs-3g")" ]; then
|
||||
( exec -a @ntfs-3g ntfs-3g -o ${liverw:-ro} $livedev /run/initramfs/live ) | vwarn
|
||||
else
|
||||
die "Failed to mount block device of live image: Missing NTFS support"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$?" != "0" ]; then
|
||||
die "Failed to mount block device of live image"
|
||||
exit 1
|
||||
@@ -241,7 +254,12 @@ do_live_overlay() {
|
||||
fi
|
||||
|
||||
# Create a device that always points to a ro base image
|
||||
echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create --readonly live-base
|
||||
if [ -n "$overlayfs" ]; then
|
||||
BASE_LOOPDUP=$(losetup -f --show -r $BASE_LOOPDEV)
|
||||
echo 0 $sz linear $BASE_LOOPDUP 0 | dmsetup create --readonly live-base
|
||||
else
|
||||
echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create --readonly live-base
|
||||
fi
|
||||
}
|
||||
|
||||
# we might have a genMinInstDelta delta file for anaconda to take advantage of
|
||||
|
@@ -13,6 +13,7 @@ installkernel() {
|
||||
xhci-hcd xhci-pci xhci-plat-hcd \
|
||||
pinctrl-cherryview \
|
||||
"=drivers/hid" \
|
||||
"=drivers/tty/serial" \
|
||||
"=drivers/input/serio" \
|
||||
"=drivers/input/keyboard" \
|
||||
"=drivers/usb/storage" \
|
||||
@@ -26,20 +27,25 @@ installkernel() {
|
||||
|
||||
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
|
||||
# arm/aarch64 specific modules
|
||||
_blockfuncs+='|dw_mc_probe|dw_mci_pltfm_register'
|
||||
instmods \
|
||||
"=drivers/clk" \
|
||||
"=drivers/dma" \
|
||||
"=drivers/extcon" \
|
||||
"=drivers/i2c/busses" \
|
||||
"=drivers/mfd" \
|
||||
"=drivers/phy" \
|
||||
"=drivers/power" \
|
||||
"=drivers/regulator" \
|
||||
"=drivers/rtc" \
|
||||
"=drivers/soc" \
|
||||
"=drivers/usb/chipidea" \
|
||||
"=drivers/usb/dwc2" \
|
||||
"=drivers/usb/dwc3" \
|
||||
"=drivers/usb/host" \
|
||||
"=drivers/usb/musb" \
|
||||
"=drivers/usb/phy" \
|
||||
"=drivers/scsi/hisi_sas" \
|
||||
${NULL}
|
||||
fi
|
||||
|
||||
|
@@ -43,7 +43,7 @@ cmdline() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods dm-snapshot
|
||||
hostonly='' instmods dm-snapshot
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
|
@@ -1,34 +1,68 @@
|
||||
#!/bin/sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
_md_force_run() {
|
||||
type getargs >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
_md_start() {
|
||||
local _udevinfo
|
||||
local _path_s
|
||||
local _path_d
|
||||
local _md="$1"
|
||||
local _offroot="$2"
|
||||
|
||||
_udevinfo="$(udevadm info --query=env --name="${_md}")"
|
||||
strstr "$_udevinfo" "MD_LEVEL=container" && continue
|
||||
strstr "$_udevinfo" "DEVTYPE=partition" && continue
|
||||
|
||||
_path_s="/sys/$(udevadm info -q path -n "${_md}")/md/array_state"
|
||||
[ ! -r "$_path_s" ] && continue
|
||||
|
||||
# inactive ?
|
||||
[ "$(cat "$_path_s")" != "inactive" ] && continue
|
||||
|
||||
mdadm $_offroot -R "${_md}" 2>&1 | vinfo
|
||||
|
||||
# still inactive ?
|
||||
[ "$(cat "$_path_s")" = "inactive" ] && continue
|
||||
|
||||
_path_d="${_path_s%/*}/degraded"
|
||||
[ ! -r "$_path_d" ] && continue
|
||||
> $hookdir/initqueue/work
|
||||
}
|
||||
|
||||
_md_force_run() {
|
||||
local _offroot
|
||||
local _md
|
||||
local _UUID
|
||||
local _MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
|
||||
[ -n "$_MD_UUID" ] || getargbool 0 rd.auto || return
|
||||
|
||||
_offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
|
||||
# try to force-run anything not running yet
|
||||
for md in /dev/md[0-9_]*; do
|
||||
[ -b "$md" ] || continue
|
||||
_udevinfo="$(udevadm info --query=env --name="$md")"
|
||||
strstr "$_udevinfo" "MD_LEVEL=container" && continue
|
||||
strstr "$_udevinfo" "DEVTYPE=partition" && continue
|
||||
|
||||
_path_s="/sys/$(udevadm info -q path -n "$md")/md/array_state"
|
||||
[ ! -r "$_path_s" ] && continue
|
||||
if [ -n "$_MD_UUID" ]; then
|
||||
for _md in /dev/md[0-9_]*; do
|
||||
[ -b "$_md" ] || continue
|
||||
_UUID=$(
|
||||
/sbin/mdadm -D --export "$_md" \
|
||||
| while read line || [ -n "$line" ]; do
|
||||
str_starts "$line" "MD_UUID=" || continue
|
||||
printf "%s" "${line#MD_UUID=}"
|
||||
done
|
||||
)
|
||||
|
||||
# inactive ?
|
||||
[ "$(cat "$_path_s")" != "inactive" ] && continue
|
||||
[ -z "$_UUID" ] && continue
|
||||
|
||||
mdadm $_offroot -R "$md" 2>&1 | vinfo
|
||||
# check if we should handle this device
|
||||
strstr " $_MD_UUID " " $_UUID " || continue
|
||||
|
||||
# still inactive ?
|
||||
[ "$(cat "$_path_s")" = "inactive" ] && continue
|
||||
|
||||
_path_d="${_path_s%/*}/degraded"
|
||||
[ ! -r "$_path_d" ] && continue
|
||||
> $hookdir/initqueue/work
|
||||
done
|
||||
_md_start "${_md}" "${_offroot}"
|
||||
done
|
||||
else
|
||||
# try to force-run anything not running yet
|
||||
for _md in /dev/md[0-9_]*; do
|
||||
[ -b "$_md" ] || continue
|
||||
_md_start "${_md}" "${_offroot}"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
_md_force_run
|
||||
|
@@ -25,6 +25,9 @@ else
|
||||
done < "${f}" > "${f}.new"
|
||||
mv "${f}.new" "$f"
|
||||
done
|
||||
for uuid in $MD_UUID; do
|
||||
wait_for_dev "/dev/disk/by-id/md-uuid-${uuid}"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
|
53
modules.d/90multipath-hostonly/module-setup.sh
Executable file
53
modules.d/90multipath-hostonly/module-setup.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo multipath
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _f _allow
|
||||
|
||||
is_mpath() {
|
||||
local _dev=$1
|
||||
[ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
|
||||
[[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
majmin_to_mpath_dev() {
|
||||
local _dev
|
||||
for i in /dev/mapper/*; do
|
||||
[[ $i == /dev/mapper/control ]] && continue
|
||||
_dev=$(get_maj_min $i)
|
||||
if [ "$_dev" = "$1" ]; then
|
||||
echo $i
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
add_hostonly_mpath_conf() {
|
||||
is_mpath $1 && {
|
||||
local _dev
|
||||
|
||||
_dev=$(majmin_to_mpath_dev $1)
|
||||
[ -z "$_dev" ] && return
|
||||
strstr "$_allow" "$_dev" && return
|
||||
_allow="$_allow --allow $_dev"
|
||||
}
|
||||
}
|
||||
|
||||
[[ $hostonly ]] && {
|
||||
for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
|
||||
[ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
|
||||
}
|
||||
}
|
||||
|
@@ -7,17 +7,6 @@ is_mpath() {
|
||||
return 1
|
||||
}
|
||||
|
||||
majmin_to_mpath_dev() {
|
||||
local _dev
|
||||
for i in /dev/mapper/*; do
|
||||
[[ $i == /dev/mapper/control ]] && continue
|
||||
_dev=$(get_maj_min $i)
|
||||
if [ "$_dev" = "$1" ]; then
|
||||
echo $i
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
# called by dracut
|
||||
check() {
|
||||
local _rootdev
|
||||
@@ -64,16 +53,6 @@ installkernel() {
|
||||
# called by dracut
|
||||
install() {
|
||||
local _f _allow
|
||||
add_hostonly_mpath_conf() {
|
||||
is_mpath $1 && {
|
||||
local _dev
|
||||
|
||||
_dev=$(majmin_to_mpath_dev $1)
|
||||
[ -z "$_dev" ] && return
|
||||
strstr "$_allow" "$_dev" && return
|
||||
_allow="$_allow --allow $_dev"
|
||||
}
|
||||
}
|
||||
|
||||
inst_multiple -o \
|
||||
dmsetup \
|
||||
@@ -88,11 +67,6 @@ install() {
|
||||
/etc/multipath.conf \
|
||||
/etc/multipath/*
|
||||
|
||||
[[ $hostonly ]] && {
|
||||
for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
|
||||
[ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
|
||||
}
|
||||
|
||||
inst $(command -v partx) /sbin/partx
|
||||
|
||||
inst_libdir_file "libmultipath*" "multipath/*"
|
||||
|
50
modules.d/91crypt-gpg/README
Normal file
50
modules.d/91crypt-gpg/README
Normal file
@@ -0,0 +1,50 @@
|
||||
# Directions for changing a system from password-based gpg keyfile
|
||||
# to smartcard-based gpg keyfile
|
||||
|
||||
# Be sure that you meet the following requirements:
|
||||
# 1. GnuPG >= 2.1 installed with
|
||||
# * Smartcard support enabled (scdaemon must be built)
|
||||
# * Direct CCID access built into scdaemon
|
||||
# 2. A password-based gpg keyfile ${KEYFILE} (e.g. "keyfile.gpg"):
|
||||
# That is, a file containing the slot key for LUKS, which
|
||||
# has been encrypted symmetrically with GnuPG using
|
||||
# a password.
|
||||
# 3. Your public OpenPGP identity ${RECIPIENT} (e.g. "3A696356")
|
||||
# 4. An OpenPGP smartcard holding the decryption key associated
|
||||
# with your public identity
|
||||
# 5. A CCID smartcard reader
|
||||
|
||||
# Notes: Requirement 4. and 5. can of course be one device, e.g.
|
||||
# a USB token with an integrated OpenPGP smartcard
|
||||
|
||||
# Make a backup of your keyfile (assuming it lies on the boot partition)
|
||||
$ cp /boot/${KEYFILE} /safe/place/keyfile.bak.gpg
|
||||
|
||||
# Change your keyfile from purely password-based to both
|
||||
# password-based and key-based (you can then decrypt the keyfile
|
||||
# with either method). As an example aes256 is chosen, the cipher
|
||||
# is not important to this guide, but do note that your kernel
|
||||
# must support it at boot time (be it built into the kernel image
|
||||
# or loaded as a module from the initramfs).
|
||||
$ cat /safe/place/keyfile.bak.gpg | gpg -d | gpg --encrypt --recipient ${RECIPIENT} --cipher-algo aes256 --armor -c > /safe/place/keyfile_sc.gpg
|
||||
|
||||
# Verify that you can decrypt your new keyfile both with the password
|
||||
# and your smartcard.
|
||||
# (with smartcard inserted, you should be prompted for your PIN, unless
|
||||
# you already did so and have not yet timed out)
|
||||
$ gpg -d /safe/place/keyfile_sc.gpg
|
||||
# (with smartcard disconnected, you should be prompted for your password)
|
||||
$ gpg -d /safe/place/keyfile_sc.gpg
|
||||
|
||||
# After verification, replace your old keyfile with your new one
|
||||
$ su -c 'cp /safe/place/keyfile_sc.gpg /boot/${KEYFILE}'
|
||||
|
||||
# Export your public key to where crypt-gpg can find it
|
||||
$ gpg --armor --export-options export-minimal --export ${RECIPIENT} > /safe/place/crypt-public-key.gpg
|
||||
$ su -c 'cp /safe/place/crypt-public-key.gpg /etc/dracut.conf.d/crypt-public-key.gpg'
|
||||
|
||||
# Rebuild your initramfs as usual
|
||||
# When booting with any of the requirements not met, crypt-gpg will default to password-based keyfile unlocking.
|
||||
# If all requirements are met and smartcard support is not disabled by setting the kernel option "rd.luks.smartcard=0"
|
||||
# crypt-gpg will try find and use a connected OpenPGP smartcard by prompting you for the PIN and then
|
||||
# unlocking the gpg keyfile with the smartcard.
|
@@ -4,7 +4,7 @@ command -v ask_for_password >/dev/null || . /lib/dracut-crypt-lib.sh
|
||||
|
||||
# gpg_decrypt mnt_point keypath keydev device
|
||||
#
|
||||
# Decrypts encrypted symmetrically key to standard output.
|
||||
# Decrypts symmetrically encrypted (password or OpenPGP smartcard) key to standard output.
|
||||
#
|
||||
# mnt_point - mount point where <keydev> is already mounted
|
||||
# keypath - GPG encrypted key path relative to <mnt_point>
|
||||
@@ -22,10 +22,40 @@ gpg_decrypt() {
|
||||
|
||||
mkdir -m 0700 -p "$gpghome"
|
||||
|
||||
# Setup GnuPG home and gpg-agent for usage of OpenPGP smartcard.
|
||||
# This requires GnuPG >= 2.1, as it uses the new ,,pinentry-mode´´
|
||||
# feature, which - when set to ,,loopback´´ - allows us to pipe
|
||||
# the smartcard's pin to GnuPG (instead of using a normal pinentry
|
||||
# program needed with GnuPG < 2.1), making for uncomplicated
|
||||
# integration with the existing codebase.
|
||||
local useSmartcard="0"
|
||||
local gpgMajorVersion="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* ([0-9]*).*|\1|p')"
|
||||
local gpgMinorVersion="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* [0-9]*\.([0-9]*).*|\1|p')"
|
||||
|
||||
if [ "${gpgMajorVersion}" -ge 2 ] && [ "${gpgMinorVersion}" -ge 1 ] \
|
||||
&& [ -f /root/crypt-public-key.gpg ] && getargbool 1 rd.luks.smartcard ; then
|
||||
useSmartcard="1"
|
||||
echo "allow-loopback-pinentry" >> "$gpghome/gpg-agent.conf"
|
||||
GNUPGHOME="$gpghome" gpg-agent --quiet --daemon
|
||||
GNUPGHOME="$gpghome" gpg --quiet --no-tty --import < /root/crypt-public-key.gpg
|
||||
local smartcardSerialNumber="$(GNUPGHOME=$gpghome gpg --no-tty --card-status \
|
||||
| sed -n -r -e 's|Serial number.*: ([0-9]*)|\1|p' | tr -d '\n')"
|
||||
if [ -n "${smartcardSerialNumber}" ]; then
|
||||
inputPrompt="PIN (OpenPGP card ${smartcardSerialNumber})"
|
||||
fi
|
||||
GNUPGHOME="$gpghome" gpg-connect-agent 1>/dev/null learn /bye
|
||||
opts="$opts --pinentry-mode=loopback"
|
||||
fi
|
||||
|
||||
ask_for_password \
|
||||
--cmd "gpg $opts --decrypt $mntp/$keypath" \
|
||||
--prompt "Password ($keypath on $keydev for $device)" \
|
||||
--prompt "${inputPrompt:-Password ($keypath on $keydev for $device)}" \
|
||||
--tries 3 --tty-echo-off
|
||||
|
||||
# Clean up the smartcard gpg-agent
|
||||
if [ "${useSmartcard}" == "1" ]; then
|
||||
GNUPGHOME="$gpghome" gpg-connect-agent 1>/dev/null killagent /bye
|
||||
fi
|
||||
|
||||
rm -rf -- "$gpghome"
|
||||
}
|
||||
|
@@ -5,6 +5,14 @@
|
||||
check() {
|
||||
require_binaries gpg || return 1
|
||||
|
||||
if sc_requested; then
|
||||
if ! sc_supported; then
|
||||
dwarning "crypt-gpg: GnuPG >= 2.1 with scdaemon and libusb required for ccid smartcard support"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
@@ -17,4 +25,38 @@ depends() {
|
||||
install() {
|
||||
inst_multiple gpg
|
||||
inst "$moddir/crypt-gpg-lib.sh" "/lib/dracut-crypt-gpg-lib.sh"
|
||||
|
||||
if sc_requested; then
|
||||
inst_multiple gpg-agent
|
||||
inst_multiple gpg-connect-agent
|
||||
inst_multiple /usr/libexec/scdaemon
|
||||
cp "$(sc_public_key)" "${initdir}/root/"
|
||||
fi
|
||||
}
|
||||
|
||||
sc_public_key() {
|
||||
echo -n "/etc/dracut.conf.d/crypt-public-key.gpg"
|
||||
}
|
||||
|
||||
# CCID Smartcard support requires GnuPG >= 2.1 with scdaemon and libusb
|
||||
sc_supported() {
|
||||
local gpgMajor="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* ([0-9]*).*|\1|p')"
|
||||
local gpgMinor="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* [0-9]*\.([0-9]*).*|\1|p')"
|
||||
if [[ "${gpgMajor}" -gt 2 || "${gpgMajor}" -eq 2 && "${gpgMinor}" -ge 1 ]] && \
|
||||
require_binaries gpg-agent &&
|
||||
require_binaries gpg-connect-agent &&
|
||||
require_binaries /usr/libexec/scdaemon &&
|
||||
(ldd /usr/libexec/scdaemon | grep libusb > /dev/null); then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
sc_requested() {
|
||||
if [ -f "$(sc_public_key)" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ loop_decrypt() {
|
||||
local keydev="$3"
|
||||
local device="$4"
|
||||
|
||||
local key="/dev/mapper/${mntp##*/}"
|
||||
local key="/dev/mapper/$(str_replace "loop-$keydev-$mntp-$keypath" '/' '-')"
|
||||
|
||||
if [ ! -b $key ]; then
|
||||
local loopdev=$(losetup -f "${mntp}/${keypath}" --show)
|
||||
@@ -29,10 +29,8 @@ loop_decrypt() {
|
||||
|
||||
[ -b $key ] || die "Failed to unlock $keypath on $keydev for $device."
|
||||
|
||||
initqueue --onetime --finished --unique --name "crypt-loop-cleanup-10-${key##*/}" \
|
||||
$(command -v cryptsetup) "luksClose $key"
|
||||
initqueue --onetime --finished --unique --name "crypt-loop-cleanup-20-${loopdev##*/}" \
|
||||
$(command -v losetup) "-d $loopdev"
|
||||
printf "%s\n" "cryptsetup luksClose \"$key\"" > ${hookdir}/cleanup/"crypt-loop-cleanup-10-${key##*/}".sh
|
||||
printf "%s\n" "losetup -d \"$loopdev\"" > ${hookdir}/cleanup/"crypt-loop-cleanup-20-${loopdev##*/}".sh
|
||||
fi
|
||||
|
||||
cat $key
|
||||
|
@@ -1,8 +1,10 @@
|
||||
#!/bin/sh
|
||||
for dasd_arg in $(getargs rd.dasd= -d rd_DASD= DASD=); do
|
||||
(
|
||||
local OLDIFS="$IFS"
|
||||
IFS=","
|
||||
set -- $dasd_arg
|
||||
IFS="$OLDIFS"
|
||||
echo "$@" | normalize_dasd_arg >> /etc/dasd.conf
|
||||
)
|
||||
done
|
||||
|
@@ -1,10 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
cmdline() {
|
||||
is_dasd() {
|
||||
local _dev=$1
|
||||
local _devpath=$(cd -P /sys/dev/block/$_dev ; echo $PWD)
|
||||
|
||||
[ "${_devpath#*/dasd}" == "$_devpath" ] && return 1
|
||||
_ccw="${_devpath%%/block/*}"
|
||||
echo "rd.dasd=${_ccw##*/}"
|
||||
return 0
|
||||
}
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_and_slaves_all is_dasd || return 255
|
||||
} | sort | uniq
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
local _arch=$(uname -m)
|
||||
local found=0
|
||||
local bdev
|
||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||
require_binaries dasd_configure /usr/lib/udev/collect || return 1
|
||||
require_binaries /usr/lib/udev/collect || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for bdev in /sys/block/* ; do
|
||||
case "${bdev##*/}" in
|
||||
dasd*)
|
||||
found=$(($found+1));
|
||||
break;
|
||||
esac
|
||||
done
|
||||
[ $found -eq 0 ] && return 255
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -18,8 +47,13 @@ depends() {
|
||||
install() {
|
||||
inst_multiple /usr/lib/udev/collect
|
||||
inst_hook cmdline 30 "$moddir/parse-dasd.sh"
|
||||
if [[ $hostonly_cmdline == "yes" ]] ; then
|
||||
local _dasd=$(cmdline)
|
||||
[[ $_dasd ]] && printf "%s\n" "$_dasd" >> "${initdir}/etc/cmdline.d/95dasd.conf"
|
||||
fi
|
||||
if [[ $hostonly ]] ; then
|
||||
inst_rules_wildcard 51-dasd-*.rules
|
||||
inst_rules_wildcard 41-s390x-dasd-*.rules
|
||||
fi
|
||||
inst_rules 59-dasd.rules
|
||||
}
|
||||
|
@@ -1,10 +1,14 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
create_udev_rule() {
|
||||
local ccw=$1
|
||||
local _drv _cu_type _dev_type
|
||||
local _rule=/etc/udev/rules.d/51-dasd-${ccw}.rules
|
||||
|
||||
if [ -x /sbin/cio_ignore ] && cio_ignore -i $ccw > /dev/null ; then
|
||||
cio_ignore -r $ccw
|
||||
fi
|
||||
|
||||
if [ -e /sys/bus/ccw/devices/${ccw} ] ; then
|
||||
read _cu_type < /sys/bus/ccw/devices/${ccw}/cutype
|
||||
read _dev_type < /sys/bus/ccw/devices/${ccw}/devtype
|
||||
@@ -38,17 +42,76 @@ ACTION=="add", ENV{COLLECT_$ccw}=="0", ATTR{[ccw/$ccw]online}="1"
|
||||
EOF
|
||||
}
|
||||
|
||||
if [[ -f /sys/firmware/ipl/ipl_type &&
|
||||
$(</sys/firmware/ipl/ipl_type) = "ccw" ]] ; then
|
||||
(
|
||||
local _ccw=$(cat /sys/firmware/ipl/device)
|
||||
|
||||
create_udev_rule $_ccw
|
||||
)
|
||||
fi
|
||||
|
||||
for dasd_arg in $(getargs root=) $(getargs resume=); do
|
||||
(
|
||||
case $dasd_arg in
|
||||
/dev/disk/by-path/ccw-*)
|
||||
ccw_arg=${dasd_arg##*/}
|
||||
break;
|
||||
;;
|
||||
esac
|
||||
if [ -n "$ccw_arg" ] ; then
|
||||
OLDIFS="$IFS"
|
||||
IFS="-"
|
||||
set -- $ccw_arg
|
||||
IFS="$OLDIFS"
|
||||
create_udev_rule $2
|
||||
fi
|
||||
)
|
||||
done
|
||||
|
||||
for dasd_arg in $(getargs rd.dasd=); do
|
||||
(
|
||||
OLDIFS="$IFS"
|
||||
IFS=","
|
||||
set -- $dasd_arg
|
||||
IFS="$OLDIFS"
|
||||
while (($# > 0)); do
|
||||
case $1 in
|
||||
autodetect|probeonly)
|
||||
shift
|
||||
;;
|
||||
*-*)
|
||||
range=$1
|
||||
OLDIFS="$IFS"
|
||||
IFS="-"
|
||||
set -- $range
|
||||
prefix=${1%.*}
|
||||
start=${1##*.}
|
||||
shift
|
||||
end=${1##.}
|
||||
shift
|
||||
IFS="$OLDIFS"
|
||||
for dev in $(seq $(( 16#$start )) $(( 16#$end )) ) ; do
|
||||
create_udev_rule $(printf "%s.%04x" "$prefix" "$dev")
|
||||
done
|
||||
;;
|
||||
*)
|
||||
dev=${1%(ro)}
|
||||
if [ "$dev" != "$1" ] ; then
|
||||
ro=1
|
||||
fi
|
||||
OLDIFS="$IFS"
|
||||
IFS="."
|
||||
set -- $dev
|
||||
sid=$1
|
||||
shift
|
||||
ssid=$1
|
||||
shift
|
||||
chan=$1
|
||||
IFS="$OLDIFS"
|
||||
create_udev_rule $(printf "%01x.%01x.%04x" $(( 16#$sid )) $(( 16#$ssid )) $(( 16#$chan )) )
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
)
|
||||
done
|
||||
|
@@ -15,7 +15,7 @@ depends() {
|
||||
install() {
|
||||
inst_multiple -o cat ls ps grep more cat rm strace free showmount \
|
||||
ping netstat rpcinfo vi scp ping6 ssh find vi \
|
||||
tcpdump cp less hostname mkdir \
|
||||
tcpdump cp less hostname mkdir systemd-analyze \
|
||||
fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.f2fs fsck.vfat e2fsck
|
||||
|
||||
grep '^tcpdump:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
|
@@ -68,8 +68,10 @@ cmdline() {
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple ip dcbtool fipvlan lldpad readlink lldptool fcoemon fcoeadm
|
||||
inst_libdir_file 'libhbalinux.so*'
|
||||
inst "/etc/hba.conf" "/etc/hba.conf"
|
||||
if [ -e "/etc/hba.conf" ]; then
|
||||
inst_libdir_file 'libhbalinux.so*'
|
||||
inst_simple "/etc/hba.conf"
|
||||
fi
|
||||
|
||||
mkdir -m 0755 -p "$initdir/var/lib/lldpad"
|
||||
mkdir -m 0755 -p "$initdir/etc/fcoe"
|
||||
|
@@ -109,9 +109,25 @@ if strstr "$(nbd-client --help 2>&1)" "systemd-mark"; then
|
||||
fi
|
||||
|
||||
if [ "$nbdport" -gt 0 ] 2>/dev/null; then
|
||||
nbd-client "$nbdserver" $nbdport /dev/nbd0 $preopts $opts || exit 1
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
nbd-client "$nbdserver" $nbdport /dev/nbd0 $preopts $opts || exit 1
|
||||
else
|
||||
systemd-run --no-block --service-type=forking --quiet \
|
||||
--description="nbd nbd0" \
|
||||
-p 'DefaultDependencies=no' \
|
||||
-p 'KillMode=none' \
|
||||
--unit="nbd0" -- nbd-client "$nbdserver" $nbdport /dev/nbd0 $preopts $opts >/dev/null 2>&1 || exit 1
|
||||
fi
|
||||
else
|
||||
nbd-client -name "$nbdport" "$nbdserver" /dev/nbd0 $preopts $opts || exit 1
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
nbd-client -name "$nbdport" "$nbdserver" /dev/nbd0 $preopts $opts || exit 1
|
||||
else
|
||||
systemd-run --no-block --service-type=forking --quiet \
|
||||
--description="nbd nbd0" \
|
||||
-p 'DefaultDependencies=no' \
|
||||
-p 'KillMode=none' \
|
||||
--unit="nbd0" -- nbd-client -name "$nbdport" "$nbdserver" /dev/nbd0 $preopts $opts >/dev/null 2>&1 || exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# NBD doesn't emit uevents when it gets connected, so kick it
|
||||
|
@@ -70,7 +70,7 @@ install() {
|
||||
local _i
|
||||
local _nsslibs
|
||||
inst_multiple -o portmap rpcbind rpc.statd mount.nfs \
|
||||
mount.nfs4 umount rpc.idmapd sed /etc/netconfig chmod
|
||||
mount.nfs4 umount rpc.idmapd sed /etc/netconfig chmod "$tmpfilesdir/rpcbind.conf"
|
||||
inst_multiple /etc/services /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/idmapd.conf
|
||||
|
||||
if [[ $hostonly_cmdline == "yes" ]]; then
|
||||
|
@@ -9,7 +9,10 @@ if modprobe sunrpc || strstr "$(cat /proc/filesystems)" rpc_pipefs; then
|
||||
# Start rpcbind or rpcbind
|
||||
# FIXME occasionally saw 'rpcbind: fork failed: No such device' -- why?
|
||||
command -v portmap >/dev/null && [ -z "$(pidof portmap)" ] && portmap
|
||||
command -v rpcbind >/dev/null && [ -z "$(pidof rpcbind)" ] && rpcbind
|
||||
if command -v rpcbind >/dev/null && [ -z "$(pidof rpcbind)" ]; then
|
||||
mkdir -p /run/rpcbind
|
||||
rpcbind
|
||||
fi
|
||||
|
||||
# Start rpc.statd as mount won't let us use locks on a NFSv4
|
||||
# filesystem without talking to it. NFSv4 does locks internally,
|
||||
|
@@ -1,10 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
cmdline() {
|
||||
is_zfcp() {
|
||||
local _dev=$1
|
||||
local _devpath=$(cd -P /sys/dev/block/$_dev ; echo $PWD)
|
||||
local _sdev _scsiid _hostno _lun _wwpn _ccw _port_type
|
||||
local _allow_lun_scan _is_npiv
|
||||
|
||||
_allow_lun_scan=$(cat /sys/module/zfcp/parameters/allow_lun_scan)
|
||||
[ "${_devpath#*/sd}" == "$_devpath" ] && return 1
|
||||
_sdev="${_devpath%%/block/*}"
|
||||
[ -e ${_sdev}/fcp_lun ] || return 1
|
||||
_scsiid="${_sdev##*/}"
|
||||
_hostno="${_scsiid%%:*}"
|
||||
[ -d /sys/class/fc_host/host${_hostno} ] || return 1
|
||||
_port_type=$(cat /sys/class/fc_host/host${_hostno}/port_type)
|
||||
case "$_port_type" in
|
||||
NPIV*)
|
||||
_is_npiv=1
|
||||
;;
|
||||
esac
|
||||
_ccw=$(cat ${_sdev}/hba_id)
|
||||
if [ "$_is_npiv" ] && [ "$_allow_lun_scan" = "Y" ] ; then
|
||||
echo "rd.zfcp=${_ccw}"
|
||||
else
|
||||
_lun=$(cat ${_sdev}/fcp_lun)
|
||||
_wwpn=$(cat ${_sdev}/wwpn)
|
||||
echo "rd.zfcp=${_ccw},${_wwpn},${_lun}"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_and_slaves_all is_zfcp
|
||||
} | sort | uniq
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
local _arch=$(uname -m)
|
||||
local _ccw
|
||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||
require_binaries zfcp_disk_configure /usr/lib/udev/collect || return 1
|
||||
require_binaries /usr/lib/udev/collect || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
found=0
|
||||
for _ccw in /sys/bus/ccw/devices/*/host* ; do
|
||||
[ -d "$_ccw" ] || continue
|
||||
found=$(($found+1));
|
||||
done
|
||||
[ $found -eq 0 ] && return 255
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -17,7 +63,15 @@ depends() {
|
||||
install() {
|
||||
inst_multiple /usr/lib/udev/collect
|
||||
inst_hook cmdline 30 "$moddir/parse-zfcp.sh"
|
||||
if [[ $hostonly_cmdline == "yes" ]] ; then
|
||||
local _zfcp
|
||||
|
||||
for _zfcp in $(cmdline) ; do
|
||||
printf "%s\n" "$_zfcp" >> "${initdir}/etc/cmdline.d/94zfcp.conf"
|
||||
done
|
||||
fi
|
||||
if [[ $hostonly ]] ; then
|
||||
inst_rules_wildcard 51-zfcp-*.rules
|
||||
inst_rules_wildcard 41-s390x-zfcp-*.rules
|
||||
fi
|
||||
}
|
||||
|
@@ -1,13 +1,15 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
create_udev_rule() {
|
||||
local ccw=$1
|
||||
local wwpn=$2
|
||||
local lun=$3
|
||||
local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules
|
||||
|
||||
local _cu_type _dev_type
|
||||
local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules
|
||||
|
||||
if [ -x /sbin/cio_ignore ] && cio_ignore -i $ccw > /dev/null ; then
|
||||
cio_ignore -r $ccw
|
||||
fi
|
||||
|
||||
if [ -e /sys/bus/ccw/devices/${ccw} ] ; then
|
||||
read _cu_type < /sys/bus/ccw/devices/${ccw}/cutype
|
||||
@@ -29,34 +31,56 @@ ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="zfcp", IMPORT{program}="collect $c
|
||||
ACTION=="add", ENV{COLLECT_$ccw}=="0", ATTR{[ccw/$ccw]online}="1"
|
||||
EOF
|
||||
fi
|
||||
[ -z "$wwpn" -o -z "$lun" ] && return
|
||||
m=$(sed -n "/.*${wwpn}.*${lun}.*/p" $_rule)
|
||||
if [ -z "$m" ] ; then
|
||||
cat >> $_rule <<EOF
|
||||
ACTION=="add", KERNEL=="rport-*", ATTR{port_name}=="$wwpn", SUBSYSTEMS=="ccw", KERNELS=="$ccw", ATTR{[ccw/$ccw]$wwpn/unit_add}="$lun"
|
||||
EOF
|
||||
fi
|
||||
if [ -x /sbin/cio_ignore ] && ! cio_ignore -i $ccw > /dev/null ; then
|
||||
cio_ignore -r $ccw
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ -f /sys/firmware/ipl/ipl_type &&
|
||||
$(</sys/firmware/ipl/ipl_type) = "fcp" ]] ; then
|
||||
(
|
||||
local _wwpn=$(cat /sys/firmware/ipl/wwpn)
|
||||
local _lun=$(cat /sys/firmware/ipl/lun)
|
||||
local _ccw=$(cat /sys/firmware/ipl/device)
|
||||
|
||||
create_udev_rule $_ccw $_wwpn $_lun
|
||||
)
|
||||
fi
|
||||
|
||||
for zfcp_arg in $(getargs rd.zfcp); do
|
||||
(
|
||||
OLDIFS="$IFS"
|
||||
IFS=","
|
||||
set $zfcp_arg
|
||||
IFS="$OLDIFS"
|
||||
create_udev_rule $1 $2 $3
|
||||
)
|
||||
done
|
||||
|
||||
for zfcp_arg in $(getargs root=) $(getargs resume=); do
|
||||
(
|
||||
local _wwpn
|
||||
local _lun
|
||||
|
||||
case $zfcp_arg in
|
||||
/dev/disk/by-path/ccw-*)
|
||||
ccw_arg=${zfcp_arg##*/}
|
||||
break;
|
||||
;;
|
||||
esac
|
||||
if [ -n "$ccw_arg" ] ; then
|
||||
OLDIFS="$IFS"
|
||||
IFS="-"
|
||||
set -- $ccw_arg
|
||||
wwpn=${4%:*}
|
||||
lun=${4#*:}
|
||||
IFS="$OLDIFS"
|
||||
_wwpn=${4%:*}
|
||||
_lun=${4#*:}
|
||||
create_udev_rule $2 $wwpn $lun
|
||||
fi
|
||||
)
|
||||
|
@@ -1,11 +1,6 @@
|
||||
# This file is part of systemd.
|
||||
# This file is part of dracut.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# See systemd.special(7) for details
|
||||
# See dracut.bootup(7) for details
|
||||
|
||||
[Unit]
|
||||
Description=dracut ask for additional cmdline parameters
|
||||
@@ -17,7 +12,6 @@ ConditionPathExists=/usr/lib/initrd-release
|
||||
ConditionKernelCommandLine=|rd.cmdline=ask
|
||||
ConditionPathExistsGlob=|/etc/cmdline.d/*.conf
|
||||
Conflicts=shutdown.target emergency.target
|
||||
Before=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
|
@@ -1,11 +1,6 @@
|
||||
# This file is part of systemd.
|
||||
# This file is part of dracut.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# See systemd.special(7) for details
|
||||
# See dracut.bootup(7) for details
|
||||
|
||||
[Unit]
|
||||
Description=dracut cmdline hook
|
||||
@@ -21,7 +16,6 @@ ConditionKernelCommandLine=|rd.break=cmdline
|
||||
ConditionKernelCommandLine=|resume
|
||||
ConditionKernelCommandLine=|noresume
|
||||
Conflicts=shutdown.target emergency.target
|
||||
Before=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
|
@@ -1,11 +1,6 @@
|
||||
# This file is part of systemd.
|
||||
# This file is part of dracut.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# See systemd.special(7) for details
|
||||
# See dracut.bootup(7) for details
|
||||
|
||||
[Unit]
|
||||
Description=Dracut Emergency Shell
|
||||
@@ -13,7 +8,6 @@ DefaultDependencies=no
|
||||
After=systemd-vconsole-setup.service
|
||||
Wants=systemd-vconsole-setup.service
|
||||
Conflicts=shutdown.target emergency.target
|
||||
Before=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=HOME=/
|
||||
|
@@ -1,11 +1,6 @@
|
||||
# This file is part of systemd.
|
||||
# This file is part of dracut.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# See systemd.special(7) for details
|
||||
# See dracut.bootup(7) for details
|
||||
|
||||
[Unit]
|
||||
Description=dracut initqueue hook
|
||||
@@ -19,7 +14,6 @@ ConditionPathExists=/usr/lib/initrd-release
|
||||
ConditionPathExists=|/lib/dracut/need-initqueue
|
||||
ConditionKernelCommandLine=|rd.break=initqueue
|
||||
Conflicts=shutdown.target emergency.target
|
||||
Before=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
|
@@ -1,11 +1,6 @@
|
||||
# This file is part of systemd.
|
||||
# This file is part of dracut.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# See systemd.special(7) for details
|
||||
# See dracut.bootup(7) for details
|
||||
|
||||
[Unit]
|
||||
Description=dracut mount hook
|
||||
@@ -17,7 +12,6 @@ ConditionDirectoryNotEmpty=|/lib/dracut/hooks/mount
|
||||
ConditionKernelCommandLine=|rd.break=mount
|
||||
DefaultDependencies=no
|
||||
Conflicts=shutdown.target emergency.target
|
||||
Before=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
|
@@ -1,24 +1,17 @@
|
||||
# This file is part of systemd.
|
||||
# This file is part of dracut.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# See systemd.special(7) for details
|
||||
# See dracut.bootup(7) for details
|
||||
|
||||
[Unit]
|
||||
Description=dracut pre-mount hook
|
||||
Documentation=man:dracut-pre-mount.service(8)
|
||||
DefaultDependencies=no
|
||||
Before=initrd-root-fs.target sysroot.mount systemd-fsck-root.service
|
||||
After=dracut-initqueue.service
|
||||
After=cryptsetup.target
|
||||
After=dracut-initqueue.service cryptsetup.target
|
||||
ConditionPathExists=/usr/lib/initrd-release
|
||||
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-mount
|
||||
ConditionKernelCommandLine=|rd.break=pre-mount
|
||||
Conflicts=shutdown.target emergency.target
|
||||
Before=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
|
@@ -1,11 +1,6 @@
|
||||
# This file is part of systemd.
|
||||
# This file is part of dracut.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# See systemd.special(7) for details
|
||||
# See dracut.bootup(7) for details
|
||||
|
||||
[Unit]
|
||||
Description=dracut pre-pivot and cleanup hook
|
||||
@@ -25,7 +20,6 @@ ConditionKernelCommandLine=|rd.break
|
||||
ConditionPathExists=|/dev/root
|
||||
ConditionPathExists=|/dev/nfs
|
||||
Conflicts=shutdown.target emergency.target
|
||||
Before=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
|
@@ -1,11 +1,6 @@
|
||||
# This file is part of systemd.
|
||||
# This file is part of dracut.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# See systemd.special(7) for details
|
||||
# See dracut.bootup(7) for details
|
||||
|
||||
[Unit]
|
||||
Description=dracut pre-trigger hook
|
||||
@@ -18,7 +13,6 @@ ConditionPathExists=/usr/lib/initrd-release
|
||||
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-trigger
|
||||
ConditionKernelCommandLine=|rd.break=pre-trigger
|
||||
Conflicts=shutdown.target emergency.target
|
||||
Before=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
|
@@ -1,11 +1,6 @@
|
||||
# This file is part of systemd.
|
||||
# This file is part of dracut.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# See systemd.special(7) for details
|
||||
# See dracut.bootup(7) for details
|
||||
|
||||
[Unit]
|
||||
Description=dracut pre-udev hook
|
||||
@@ -15,13 +10,13 @@ Before=systemd-udevd.service dracut-pre-trigger.service
|
||||
After=dracut-cmdline.service
|
||||
Wants=dracut-cmdline.service
|
||||
ConditionPathExists=/usr/lib/initrd-release
|
||||
ConditionPathExists=|/etc/cmdline.d/20-force_drivers.conf
|
||||
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-udev
|
||||
ConditionKernelCommandLine=|rd.break=pre-udev
|
||||
ConditionKernelCommandLine=|rd.driver.blacklist
|
||||
ConditionKernelCommandLine=|rd.driver.pre
|
||||
ConditionKernelCommandLine=|rd.driver.post
|
||||
Conflicts=shutdown.target emergency.target
|
||||
Before=shutdown.target emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
|
@@ -1,9 +1,6 @@
|
||||
# This file is part of systemd.
|
||||
# This file is part of dracut.
|
||||
#
|
||||
# systemd 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.
|
||||
# See dracut.bootup(7) for details
|
||||
|
||||
[Unit]
|
||||
Description=Restore /run/initramfs on shutdown
|
||||
|
@@ -1,11 +1,6 @@
|
||||
# This file is part of systemd.
|
||||
# This file is part of dracut.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# See systemd.special(7) for details
|
||||
# See dracut.bootup(7) for details
|
||||
|
||||
[Unit]
|
||||
Description=Emergency Shell
|
||||
|
@@ -13,7 +13,7 @@ load_x509_keys()
|
||||
. ${IMACONFIG}
|
||||
fi
|
||||
|
||||
if [ -z "${IMAKEYDIR}" ]; then
|
||||
if [ -z "${IMAKEYSDIR}" ]; then
|
||||
IMAKEYSDIR="/etc/keys/ima"
|
||||
fi
|
||||
|
||||
|
@@ -152,8 +152,8 @@ getcmdline() {
|
||||
while read -r _line || [ -n "$_line" ]; do
|
||||
CMDLINE_PROC="$CMDLINE_PROC $_line"
|
||||
done </proc/cmdline;
|
||||
CMDLINE="$CMDLINE_ETC_D $CMDLINE_ETC $CMDLINE_PROC"
|
||||
fi
|
||||
CMDLINE="$CMDLINE_ETC_D $CMDLINE_ETC $CMDLINE_PROC"
|
||||
printf "%s" "$CMDLINE"
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,7 @@ test_run() {
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/result \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-m 512M -smp 2 -nographic \
|
||||
-net none \
|
||||
-watchdog i6300esb -watchdog-action poweroff \
|
||||
-no-reboot \
|
||||
@@ -80,7 +80,7 @@ test_setup() {
|
||||
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
|
||||
-m 256M -smp 2 -nographic -net none \
|
||||
-m 512M -smp 2 -nographic -net none \
|
||||
-append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext3 || return 1
|
||||
|
17
test/TEST-02-SYSTEMD/systemd-analyze.sh
Executable file
17
test/TEST-02-SYSTEMD/systemd-analyze.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
cp /usr/bin/true /usr/bin/man
|
||||
|
||||
for i in \
|
||||
sysinit.target \
|
||||
basic.target \
|
||||
initrd-fs.target \
|
||||
initrd.target \
|
||||
initrd-switch-root.target \
|
||||
emergency.target \
|
||||
shutdown.target; do
|
||||
if ! systemd-analyze verify $i; then
|
||||
warn "systemd-analyze verify $i failed"
|
||||
poweroff
|
||||
fi
|
||||
done
|
@@ -4,15 +4,15 @@ TEST_DESCRIPTION="root filesystem on a ext3 filesystem"
|
||||
KVERSION="${KVERSION-$(uname -r)}"
|
||||
|
||||
# Uncomment this to debug failures
|
||||
#DEBUGFAIL="rd.shell=1 rd.break"
|
||||
#DEBUGFAIL="rd.shell=1 rd.break=pre-mount"
|
||||
test_run() {
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-net none \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
|
||||
-m 512M -smp 2 -nographic \
|
||||
-net none \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=LABEL=dracut rw loglevel=77 systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug init=/sbin/init rd.shell=0 $DEBUGFAIL" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
-append "panic=1 root=LABEL=dracut rw loglevel=77 systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.shell=0 $DEBUGFAIL" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext3 || return 1
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@ test_setup() {
|
||||
kernel=$KVERSION
|
||||
# Create what will eventually be our root filesystem onto an overlay
|
||||
(
|
||||
export initdir=$TESTDIR/overlay/source
|
||||
mkdir -p $initdir
|
||||
. $basedir/dracut-init.sh
|
||||
export initdir=$TESTDIR/overlay/source
|
||||
mkdir -p $initdir
|
||||
. $basedir/dracut-init.sh
|
||||
(
|
||||
cd "$initdir"
|
||||
mkdir -p -- dev sys proc etc var/run tmp
|
||||
@@ -36,69 +36,70 @@ test_setup() {
|
||||
done
|
||||
mkdir -p -- var/lib/nfs/rpc_pipefs
|
||||
)
|
||||
inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
|
||||
mount dmesg dhclient mkdir cp ping dhclient \
|
||||
umount strace less setsid
|
||||
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
||||
inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
|
||||
mount dmesg dhclient mkdir cp ping dhclient \
|
||||
umount strace less setsid systemd-analyze
|
||||
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
||||
[ -f ${_terminfodir}/l/linux ] && break
|
||||
done
|
||||
inst_multiple -o ${_terminfodir}/l/linux
|
||||
inst "$basedir/modules.d/40network/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/40network/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep
|
||||
done
|
||||
inst_multiple -o ${_terminfodir}/l/linux
|
||||
inst "$basedir/modules.d/40network/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/40network/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep
|
||||
inst_simple /etc/os-release
|
||||
inst ./test-init.sh /sbin/init
|
||||
find_binary plymouth >/dev/null && inst_multiple plymouth
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
inst ./test-init.sh /sbin/init
|
||||
find_binary plymouth >/dev/null && inst_multiple plymouth
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
# second, install the files needed to make the root filesystem
|
||||
(
|
||||
export initdir=$TESTDIR/overlay
|
||||
. $basedir/dracut-init.sh
|
||||
inst_multiple sfdisk mkfs.ext3 poweroff cp umount
|
||||
inst_hook initqueue 01 ./create-root.sh
|
||||
export initdir=$TESTDIR/overlay
|
||||
. $basedir/dracut-init.sh
|
||||
inst_multiple sfdisk mkfs.ext3 poweroff cp umount
|
||||
inst_hook initqueue 01 ./create-root.sh
|
||||
inst_hook initqueue/finished 01 ./finished-false.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
|
||||
# create an initramfs that will create the target root filesystem.
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
|
||||
-m "dash udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
|
||||
--nomdadmconf \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf -- $TESTDIR/overlay
|
||||
# Invoke KVM and/or QEMU to actually create the target filesystem.
|
||||
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
|
||||
-m 256M -smp 2 -nographic -net none \
|
||||
-append "root=/dev/fakeroot rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
|
||||
-m 512M -smp 2 -nographic -net none \
|
||||
-append "root=/dev/fakeroot rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext3 || return 1
|
||||
|
||||
|
||||
(
|
||||
export initdir=$TESTDIR/overlay
|
||||
. $basedir/dracut-init.sh
|
||||
inst_multiple poweroff shutdown
|
||||
inst_hook shutdown-emergency 000 ./hard-off.sh
|
||||
export initdir=$TESTDIR/overlay
|
||||
. $basedir/dracut-init.sh
|
||||
inst_multiple poweroff shutdown
|
||||
inst_hook shutdown-emergency 000 ./hard-off.sh
|
||||
inst_hook pre-pivot 000 ./systemd-analyze.sh
|
||||
inst_hook emergency 000 ./hard-off.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-a "debug systemd" \
|
||||
-o "network kernel-network-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
|
||||
-a "debug systemd" \
|
||||
-o "network kernel-network-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.testing $KVERSION || return 1
|
||||
-f $TESTDIR/initramfs.testing $KVERSION || return 1
|
||||
|
||||
# -o "plymouth network md dmraid multipath fips caps crypt btrfs resume dmsquash-live dm"
|
||||
# -o "plymouth network md dmraid multipath fips caps crypt btrfs resume dmsquash-live dm"
|
||||
}
|
||||
|
||||
test_cleanup() {
|
||||
|
@@ -18,7 +18,7 @@ client_run() {
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.btrfs \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/usr.btrfs \
|
||||
-drive format=raw,index=2,media=disk,file=$TESTDIR/result \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-m 512M -smp 2 -nographic \
|
||||
-net none \
|
||||
-watchdog i6300esb -watchdog-action poweroff \
|
||||
-no-reboot \
|
||||
@@ -115,7 +115,7 @@ test_setup() {
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.btrfs \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/usr.btrfs \
|
||||
-m 256M -smp 2 -nographic -net none \
|
||||
-m 512M -smp 2 -nographic -net none \
|
||||
-append "root=/dev/dracut/root rw rootfstype=btrfs quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.btrfs || return 1
|
||||
|
@@ -20,7 +20,7 @@ client_run() {
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.btrfs \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/usr.btrfs \
|
||||
-drive format=raw,index=2,media=disk,file=$TESTDIR/result \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-m 512M -smp 2 -nographic \
|
||||
-net none \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=LABEL=dracut $client_opts rd.retry=3 console=ttyS0,115200n81 selinux=0 $DEBUGOUT rd.shell=0 $DEBUGFAIL" \
|
||||
@@ -252,7 +252,7 @@ EOF
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.btrfs \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/usr.btrfs \
|
||||
-m 256M -smp 2 -nographic -net none \
|
||||
-m 512M -smp 2 -nographic -net none \
|
||||
-append "root=/dev/fakeroot rw rootfstype=btrfs quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.btrfs || return 1
|
||||
|
@@ -10,7 +10,7 @@ test_run() {
|
||||
DISKIMAGE=$TESTDIR/TEST-10-RAID-root.img
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$DISKIMAGE \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-m 512M -smp 2 -nographic \
|
||||
-net none \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/dracut/root rd.auto rw rd.retry=10 console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \
|
||||
@@ -77,7 +77,7 @@ test_setup() {
|
||||
# Invoke KVM and/or QEMU to actually create the target filesystem.
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$DISKIMAGE \
|
||||
-m 256M -smp 2 -nographic -net none \
|
||||
-m 512M -smp 2 -nographic -net none \
|
||||
-append "root=/dev/cannotreach rw rootfstype=ext2 console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
grep -F -m 1 -q dracut-root-block-created $DISKIMAGE || return 1
|
||||
|
@@ -7,10 +7,10 @@ rm -f -- /etc/lvm/lvm.conf
|
||||
udevadm control --reload
|
||||
# save a partition at the beginning for future flagging purposes
|
||||
sfdisk /dev/sda <<EOF
|
||||
,1M
|
||||
,10M
|
||||
,10M
|
||||
,10M
|
||||
,2M
|
||||
,20M
|
||||
,20M
|
||||
,20M
|
||||
EOF
|
||||
udevadm settle
|
||||
for i in sda2 sda3 sda4; do
|
||||
|
@@ -9,7 +9,7 @@ KVERSION=${KVERSION-$(uname -r)}
|
||||
test_run() {
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-m 512M -smp 2 -nographic \
|
||||
-net none \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \
|
||||
@@ -19,7 +19,7 @@ test_run() {
|
||||
|
||||
test_setup() {
|
||||
# Create the blank file to use as a root filesystem
|
||||
dd if=/dev/null of=$TESTDIR/root.ext2 bs=1M seek=40
|
||||
dd if=/dev/null of=$TESTDIR/root.ext2 bs=1M seek=80
|
||||
|
||||
kernel=$KVERSION
|
||||
# Create what will eventually be our root filesystem onto an overlay
|
||||
@@ -72,7 +72,7 @@ test_setup() {
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf -- $TESTDIR/overlay
|
||||
# Invoke KVM and/or QEMU to actually create the target filesystem.
|
||||
$testdir/run-qemu -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 256M -smp 2 -nographic -net none \
|
||||
$testdir/run-qemu -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 512M -smp 2 -nographic -net none \
|
||||
-append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
|
||||
|
@@ -8,6 +8,8 @@ for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
|
||||
done
|
||||
rm -f -- /etc/lvm/lvm.conf
|
||||
udevadm control --reload
|
||||
udevadm settle
|
||||
sleep 1
|
||||
# save a partition at the beginning for future flagging purposes
|
||||
sfdisk /dev/sda <<EOF
|
||||
,5M
|
||||
|
@@ -1,3 +1,4 @@
|
||||
#!/bin/sh
|
||||
sleep 10
|
||||
getargbool 0 rd.shell || poweroff -f
|
||||
! getargbool 0 rd.break && getargbool 0 failme && poweroff -f
|
||||
|
@@ -15,16 +15,16 @@ client_run() {
|
||||
cp --sparse=always --reflink=auto $TESTDIR/disk3.img $TESTDIR/disk3.img.new
|
||||
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 256M -nographic -smp 2 \
|
||||
-drive format=raw,index=2,media=disk,file=$TESTDIR/disk2.img.new \
|
||||
-drive format=raw,index=3,media=disk,file=$TESTDIR/disk3.img.new \
|
||||
-net none \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 512M -nographic -smp 2 \
|
||||
-drive format=raw,index=2,media=disk,file=$TESTDIR/disk2.img.new \
|
||||
-drive format=raw,index=3,media=disk,file=$TESTDIR/disk3.img.new \
|
||||
-net none \
|
||||
-no-reboot \
|
||||
-append "panic=1 $* root=LABEL=root rw rd.retry=10 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL " \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
-append "panic=1 $* systemd.log_target=kmsg loglevel=7 root=LABEL=root rw rd.retry=20 rd.info console=ttyS0,115200n81 log_buf_len=2M selinux=0 rd.debug rd.shell=0 $DEBUGFAIL " \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
if ! grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2; then
|
||||
echo "CLIENT TEST END: $@ [FAIL]"
|
||||
return 1;
|
||||
echo "CLIENT TEST END: $@ [FAIL]"
|
||||
return 1;
|
||||
fi
|
||||
|
||||
sed -i -e 's#dracut-root-block-success#dracut-root-block-xxxxxxx#' $TESTDIR/root.ext2
|
||||
@@ -66,9 +66,9 @@ test_setup() {
|
||||
kernel=$KVERSION
|
||||
# Create what will eventually be our root filesystem onto an overlay
|
||||
(
|
||||
export initdir=$TESTDIR/overlay/source
|
||||
. $basedir/dracut-init.sh
|
||||
(
|
||||
export initdir=$TESTDIR/overlay/source
|
||||
. $basedir/dracut-init.sh
|
||||
(
|
||||
cd "$initdir"
|
||||
mkdir -p -- dev sys proc etc var/run tmp
|
||||
mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
|
||||
@@ -76,50 +76,50 @@ test_setup() {
|
||||
ln -sfnr usr/$i $i
|
||||
done
|
||||
)
|
||||
inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
|
||||
mount dmesg dhclient mkdir cp ping dhclient
|
||||
inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
|
||||
mount dmesg dhclient mkdir cp ping dhclient
|
||||
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
||||
[ -f ${_terminfodir}/l/linux ] && break
|
||||
done
|
||||
inst_multiple -o ${_terminfodir}/l/linux
|
||||
inst "$basedir/modules.d/40network/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/40network/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep
|
||||
[ -f ${_terminfodir}/l/linux ] && break
|
||||
done
|
||||
inst_multiple -o ${_terminfodir}/l/linux
|
||||
inst "$basedir/modules.d/40network/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/40network/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep
|
||||
inst_simple /etc/os-release
|
||||
inst ./test-init.sh /sbin/init
|
||||
find_binary plymouth >/dev/null && inst_multiple plymouth
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
inst ./test-init.sh /sbin/init
|
||||
find_binary plymouth >/dev/null && inst_multiple plymouth
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
# second, install the files needed to make the root filesystem
|
||||
(
|
||||
export initdir=$TESTDIR/overlay
|
||||
. $basedir/dracut-init.sh
|
||||
inst_multiple sfdisk mke2fs poweroff cp umount dd grep
|
||||
inst_hook initqueue 01 ./create-root.sh
|
||||
export initdir=$TESTDIR/overlay
|
||||
. $basedir/dracut-init.sh
|
||||
inst_multiple sfdisk mke2fs poweroff cp umount dd grep
|
||||
inst_hook initqueue 01 ./create-root.sh
|
||||
inst_hook initqueue/finished 01 ./finished-false.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
|
||||
# create an initramfs that will create the target root filesystem.
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf -- $TESTDIR/overlay
|
||||
# Invoke KVM and/or QEMU to actually create the target filesystem.
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/disk1.img \
|
||||
-drive format=raw,index=2,media=disk,file=$TESTDIR/disk2.img \
|
||||
-drive format=raw,index=3,media=disk,file=$TESTDIR/disk3.img \
|
||||
-m 256M -smp 2 -nographic -net none \
|
||||
-append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/disk1.img \
|
||||
-drive format=raw,index=2,media=disk,file=$TESTDIR/disk2.img \
|
||||
-drive format=raw,index=3,media=disk,file=$TESTDIR/disk3.img \
|
||||
-m 512M -smp 2 -nographic -net none \
|
||||
-append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
|
||||
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
|
||||
eval $(grep -F --binary-files=text -m 1 MD_UUID $TESTDIR/root.ext2)
|
||||
@@ -127,13 +127,13 @@ test_setup() {
|
||||
echo $ID_FS_UUID > $TESTDIR/luksuuid
|
||||
|
||||
(
|
||||
export initdir=$TESTDIR/overlay
|
||||
. $basedir/dracut-init.sh
|
||||
inst_multiple poweroff shutdown
|
||||
inst_hook shutdown-emergency 000 ./hard-off.sh
|
||||
export initdir=$TESTDIR/overlay
|
||||
. $basedir/dracut-init.sh
|
||||
inst_multiple poweroff shutdown
|
||||
inst_hook shutdown-emergency 000 ./hard-off.sh
|
||||
inst_hook emergency 000 ./hard-off.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
inst ./cryptroot-ask.sh /sbin/cryptroot-ask
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
inst ./cryptroot-ask.sh /sbin/cryptroot-ask
|
||||
mkdir -p $initdir/etc
|
||||
echo "ARRAY /dev/md0 level=raid5 num-devices=3 UUID=$MD_UUID" > $initdir/etc/mdadm.conf
|
||||
echo "luks-$ID_FS_UUID UUID=$ID_FS_UUID /etc/key" > $initdir/etc/crypttab
|
||||
@@ -141,11 +141,11 @@ test_setup() {
|
||||
)
|
||||
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-o "plymouth network kernel-network-modules" \
|
||||
-a "debug" \
|
||||
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.testing $KVERSION || return 1
|
||||
-o "plymouth network kernel-network-modules" \
|
||||
-a "debug" \
|
||||
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.testing $KVERSION || return 1
|
||||
}
|
||||
|
||||
test_cleanup() {
|
||||
|
@@ -17,7 +17,7 @@ test_run() {
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/check-success.img \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-m 512M -smp 2 -nographic \
|
||||
-net none \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/dracut/root rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug rootwait $LUKSARGS rd.shell=0 $DEBUGFAIL" \
|
||||
@@ -31,7 +31,7 @@ test_run() {
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/check-success.img \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-m 512M -smp 2 -nographic \
|
||||
-net none \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/dracut/root rw quiet rd.auto rd.retry=20 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
|
||||
@@ -45,7 +45,7 @@ test_run() {
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/check-success.img \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-m 512M -smp 2 -nographic \
|
||||
-net none \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/dracut/root rw quiet rd.auto rd.retry=10 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL rd.luks.uuid=failme" \
|
||||
@@ -111,7 +111,7 @@ test_setup() {
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf -- $TESTDIR/overlay
|
||||
# Invoke KVM and/or QEMU to actually create the target filesystem.
|
||||
$testdir/run-qemu -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 256M -smp 2 -nographic -net none \
|
||||
$testdir/run-qemu -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 512M -smp 2 -nographic -net none \
|
||||
-append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
|
||||
|
@@ -13,7 +13,7 @@ client_run() {
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/disk1 \
|
||||
-drive format=raw,index=2,media=disk,file=$TESTDIR/disk2 \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-m 512M -smp 2 -nographic \
|
||||
-net none \
|
||||
-no-reboot \
|
||||
-append "panic=1 $* root=LABEL=root rw debug rd.retry=5 rd.debug console=ttyS0,115200n81 selinux=0 rd.info rd.shell=0 $DEBUGFAIL" \
|
||||
@@ -104,7 +104,7 @@ test_setup() {
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/disk1 \
|
||||
-drive format=raw,index=2,media=disk,file=$TESTDIR/disk2 \
|
||||
-m 256M -nographic -net none \
|
||||
-m 512M -nographic -net none \
|
||||
-append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
|
||||
|
@@ -9,7 +9,7 @@ test_run() {
|
||||
DISKIMAGE=$TESTDIR/TEST-15-BTRFSRAID-root.img
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$DISKIMAGE \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-m 512M -smp 2 -nographic \
|
||||
-net none \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=LABEL=root rw rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \
|
||||
@@ -78,7 +78,7 @@ test_setup() {
|
||||
# Invoke KVM and/or QEMU to actually create the target filesystem.
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$DISKIMAGE \
|
||||
-m 256M -smp 2 -nographic -net none \
|
||||
-m 512M -smp 2 -nographic -net none \
|
||||
-append "root=/dev/fakeroot rw quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
|
||||
|
@@ -19,7 +19,7 @@ test_run() {
|
||||
-boot order=d \
|
||||
-drive format=raw,bps=1000000,index=0,media=disk,file="$TESTDIR"/livecd.iso \
|
||||
-drive format=raw,index=1,media=disk,file="$TESTDIR"/root.img \
|
||||
-m 256M -smp 2 \
|
||||
-m 512M -smp 2 \
|
||||
-nographic \
|
||||
-net none \
|
||||
-no-reboot \
|
||||
@@ -30,7 +30,7 @@ test_run() {
|
||||
# "$testdir"/run-qemu \
|
||||
# -drive format=raw,bps=1000000,index=0,media=disk,file="$TESTDIR"/livecd.iso \
|
||||
# -drive format=raw,index=1,media=disk,file="$TESTDIR"/root.img \
|
||||
# -m 256M -smp 2 \
|
||||
# -m 512M -smp 2 \
|
||||
# -net none \
|
||||
# -append "root=live:CDLABEL=LiveCD live quiet rhgb selinux=0 rd.live.check" \
|
||||
# -initrd "$TESTDIR"/initramfs.testing
|
||||
|
@@ -9,7 +9,7 @@ KVERSION=${KVERSION-$(uname -r)}
|
||||
test_run() {
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-m 512M -smp 2 -nographic \
|
||||
-net none \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \
|
||||
@@ -72,7 +72,7 @@ test_setup() {
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf -- $TESTDIR/overlay
|
||||
# Invoke KVM and/or QEMU to actually create the target filesystem.
|
||||
$testdir/run-qemu -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 256M -smp 2 -nographic -net none \
|
||||
$testdir/run-qemu -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 512M -smp 2 -nographic -net none \
|
||||
-append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
|
||||
|
@@ -14,7 +14,7 @@ run_server() {
|
||||
fsck -a $TESTDIR/server.ext3 || return 1
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext3 \
|
||||
-m 256M -smp 2 \
|
||||
-m 512M -smp 2 \
|
||||
-display none \
|
||||
-net socket,listen=127.0.0.1:12320 \
|
||||
-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
|
||||
@@ -52,7 +52,7 @@ client_test() {
|
||||
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/client.img \
|
||||
-m 256M -smp 2 -nographic \
|
||||
-m 512M -smp 2 -nographic \
|
||||
-net nic,macaddr=$mac,model=e1000 \
|
||||
-net socket,connect=127.0.0.1:12320 \
|
||||
-watchdog i6300esb -watchdog-action poweroff \
|
||||
@@ -210,7 +210,7 @@ test_run() {
|
||||
|
||||
test_setup() {
|
||||
# Make server root
|
||||
dd if=/dev/null of=$TESTDIR/server.ext3 bs=1M seek=60
|
||||
dd if=/dev/null of=$TESTDIR/server.ext3 bs=1M seek=120
|
||||
mke2fs -j -F $TESTDIR/server.ext3
|
||||
mkdir $TESTDIR/mnt
|
||||
sudo mount -o loop $TESTDIR/server.ext3 $TESTDIR/mnt
|
||||
|
@@ -73,52 +73,9 @@ do_test_run() {
|
||||
run_client "netroot=iscsi target0"\
|
||||
"root=LABEL=singleroot netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \
|
||||
"ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \
|
||||
"rd.iscsi.firmware" \
|
||||
"rd.iscsi.initiator=$initiator" \
|
||||
|| return 1
|
||||
|
||||
run_client "netroot=iscsi target1 target2" \
|
||||
"root=LABEL=sysroot" \
|
||||
"ip=192.168.50.101:::255.255.255.0::ens3:off" \
|
||||
"ip=192.168.51.101:::255.255.255.0::ens4:off" \
|
||||
"netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
|
||||
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
|
||||
"rd.iscsi.firmware" \
|
||||
"rd.iscsi.initiator=$initiator" \
|
||||
|| return 1
|
||||
|
||||
# run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0" \
|
||||
# "root=LABEL=sysroot" \
|
||||
# "ip=192.168.50.101:::255.255.255.0::ens3:off" \
|
||||
# "ip=192.168.51.101:::255.255.255.0::ens4:off" \
|
||||
# "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
|
||||
# "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
|
||||
# "rd.iscsi.firmware" \
|
||||
# "rd.iscsi.initiator=$initiator" \
|
||||
# "rd.iscsi.waitnet=0" \
|
||||
# || return 1
|
||||
|
||||
run_client "FAILME: netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
|
||||
"root=LABEL=sysroot" \
|
||||
"ip=192.168.50.101:::255.255.255.0::ens3:off" \
|
||||
"ip=192.168.51.101:::255.255.255.0::ens4:off" \
|
||||
"netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
|
||||
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
|
||||
"rd.iscsi.firmware" \
|
||||
"rd.iscsi.initiator=$initiator" \
|
||||
"rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
|
||||
|| :
|
||||
|
||||
run_client "FAILME: netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0 default GW" \
|
||||
"root=LABEL=sysroot" \
|
||||
"ip=192.168.50.101::192.168.50.1:255.255.255.0::ens3:off" \
|
||||
"ip=192.168.51.101::192.168.51.1:255.255.255.0::ens4:off" \
|
||||
"netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
|
||||
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
|
||||
"rd.iscsi.firmware" \
|
||||
"rd.iscsi.initiator=$initiator" \
|
||||
"rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
|
||||
|| :
|
||||
|
||||
echo "All tests passed [OK]"
|
||||
return 0
|
||||
@@ -207,7 +164,7 @@ test_setup() {
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/client.img \
|
||||
-drive format=raw,index=2,media=disk,file=$TESTDIR/iscsidisk2.img \
|
||||
-drive format=raw,index=3,media=disk,file=$TESTDIR/iscsidisk3.img \
|
||||
-smp 2 -m 256M -nographic -net none \
|
||||
-smp 2 -m 512M -nographic -net none \
|
||||
-append "root=/dev/fakeroot rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
grep -F -m 1 -q dracut-root-block-created $TESTDIR/client.img || return 1
|
||||
|
8
test/TEST-31-ISCSI-MULTI/99-idesymlinks.rules
Normal file
8
test/TEST-31-ISCSI-MULTI/99-idesymlinks.rules
Normal file
@@ -0,0 +1,8 @@
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hda", SYMLINK+="sda"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hda*", SYMLINK+="sda$env{MINOR}"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdb", SYMLINK+="sdb"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdb*", SYMLINK+="sdb$env{MINOR}"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdc", SYMLINK+="sdc"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdc*", SYMLINK+="sdc$env{MINOR}"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdd", SYMLINK+="sdd"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdd*", SYMLINK+="sdd$env{MINOR}"
|
1
test/TEST-31-ISCSI-MULTI/Makefile
Normal file
1
test/TEST-31-ISCSI-MULTI/Makefile
Normal file
@@ -0,0 +1 @@
|
||||
-include ../Makefile.testdir
|
115
test/TEST-31-ISCSI-MULTI/client-init.sh
Executable file
115
test/TEST-31-ISCSI-MULTI/client-init.sh
Executable file
@@ -0,0 +1,115 @@
|
||||
#!/bin/sh
|
||||
getcmdline() {
|
||||
while read -r _line || [ -n "$_line" ]; do
|
||||
printf "%s" "$_line"
|
||||
done </proc/cmdline;
|
||||
}
|
||||
|
||||
_dogetarg() {
|
||||
local _o _val _doecho
|
||||
unset _val
|
||||
unset _o
|
||||
unset _doecho
|
||||
CMDLINE=$(getcmdline)
|
||||
|
||||
for _o in $CMDLINE; do
|
||||
if [ "${_o%%=*}" = "${1%%=*}" ]; then
|
||||
if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
|
||||
# if $1 has a "=<value>", we want the exact match
|
||||
if [ "$_o" = "$1" ]; then
|
||||
_val="1";
|
||||
unset _doecho
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "${_o#*=}" = "$_o" ]; then
|
||||
# if cmdline argument has no "=<value>", we assume "=1"
|
||||
_val="1";
|
||||
unset _doecho
|
||||
continue
|
||||
fi
|
||||
|
||||
_val="${_o#*=}"
|
||||
_doecho=1
|
||||
fi
|
||||
done
|
||||
if [ -n "$_val" ]; then
|
||||
[ "x$_doecho" != "x" ] && echo "$_val";
|
||||
return 0;
|
||||
fi
|
||||
return 1;
|
||||
}
|
||||
|
||||
getarg() {
|
||||
local _deprecated _newoption
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
-d) _deprecated=1; shift;;
|
||||
-y) if _dogetarg $2 >/dev/null; then
|
||||
if [ "$_deprecated" = "1" ]; then
|
||||
[ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
|
||||
fi
|
||||
echo 1
|
||||
return 0
|
||||
fi
|
||||
_deprecated=0
|
||||
shift 2;;
|
||||
-n) if _dogetarg $2 >/dev/null; then
|
||||
echo 0;
|
||||
if [ "$_deprecated" = "1" ]; then
|
||||
[ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
_deprecated=0
|
||||
shift 2;;
|
||||
*) if [ -z "$_newoption" ]; then
|
||||
_newoption="$1"
|
||||
fi
|
||||
if _dogetarg $1; then
|
||||
if [ "$_deprecated" = "1" ]; then
|
||||
[ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
|
||||
fi
|
||||
return 0;
|
||||
fi
|
||||
_deprecated=0
|
||||
shift;;
|
||||
esac
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
getargbool() {
|
||||
local _b
|
||||
unset _b
|
||||
local _default
|
||||
_default="$1"; shift
|
||||
_b=$(getarg "$@")
|
||||
[ $? -ne 0 -a -z "$_b" ] && _b="$_default"
|
||||
if [ -n "$_b" ]; then
|
||||
[ $_b = "0" ] && return 1
|
||||
[ $_b = "no" ] && return 1
|
||||
[ $_b = "off" ] && return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
exec >/dev/console 2>&1
|
||||
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
|
||||
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
|
||||
export TERM=linux
|
||||
export PS1='initramfs-test:\w\$ '
|
||||
stty sane
|
||||
echo "made it to the rootfs! Powering down."
|
||||
while read dev fs fstype opts rest || [ -n "$dev" ]; do
|
||||
[ "$fstype" != "ext3" ] && continue
|
||||
echo "iscsi-OK $dev $fstype $opts" > /dev/sda
|
||||
break
|
||||
done < /proc/mounts
|
||||
#sh -i
|
||||
if getargbool 0 rd.shell; then
|
||||
strstr "$(setsid --help)" "control" && CTTY="-c"
|
||||
setsid $CTTY sh -i
|
||||
fi
|
||||
poweroff -f
|
25
test/TEST-31-ISCSI-MULTI/create-root.sh
Executable file
25
test/TEST-31-ISCSI-MULTI/create-root.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
# don't let udev and this script step on eachother's toes
|
||||
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
|
||||
> "/etc/udev/rules.d/$x"
|
||||
done
|
||||
rm -f -- /etc/lvm/lvm.conf
|
||||
udevadm control --reload
|
||||
mkfs.ext3 -j -L singleroot -F /dev/sda && \
|
||||
mkdir -p /sysroot && \
|
||||
mount /dev/sda /sysroot && \
|
||||
cp -a -t /sysroot /source/* && \
|
||||
umount /sysroot && \
|
||||
mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/sdc /dev/sdd && \
|
||||
mdadm -W /dev/md0 || : && \
|
||||
lvm pvcreate -ff -y /dev/md0 && \
|
||||
lvm vgcreate dracut /dev/md0 && \
|
||||
lvm lvcreate -l 100%FREE -n root dracut && \
|
||||
lvm vgchange -ay && \
|
||||
mkfs.ext3 -j -L sysroot /dev/dracut/root && \
|
||||
mount /dev/dracut/root /sysroot && \
|
||||
cp -a -t /sysroot /source/* && \
|
||||
umount /sysroot && \
|
||||
lvm lvchange -a n /dev/dracut/root && \
|
||||
echo "dracut-root-block-created" >/dev/sdb
|
||||
poweroff -f
|
48
test/TEST-31-ISCSI-MULTI/dhcpd.conf
Normal file
48
test/TEST-31-ISCSI-MULTI/dhcpd.conf
Normal file
@@ -0,0 +1,48 @@
|
||||
ddns-update-style none;
|
||||
|
||||
use-host-decl-names true;
|
||||
|
||||
subnet 192.168.50.0 netmask 255.255.255.0 {
|
||||
option subnet-mask 255.255.255.0;
|
||||
option routers 192.168.50.1;
|
||||
next-server 192.168.50.1;
|
||||
server-identifier 192.168.50.1;
|
||||
option domain-name-servers 192.168.50.1;
|
||||
option domain-search "example.com";
|
||||
option domain-name "other.com";
|
||||
|
||||
# MAC numbering scheme:
|
||||
# NFSv3: last octect starts at 0x00 and works up
|
||||
|
||||
group {
|
||||
option root-path "iscsi:192.168.50.1:::1:iqn.2009-06.dracut:target0";
|
||||
|
||||
host iscsi-1 {
|
||||
hardware ethernet 52:54:00:12:34:00;
|
||||
fixed-address 192.168.50.101;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subnet 192.168.51.0 netmask 255.255.255.0 {
|
||||
option subnet-mask 255.255.255.0;
|
||||
option routers 192.168.51.1;
|
||||
next-server 192.168.51.1;
|
||||
server-identifier 192.168.51.1;
|
||||
option domain-name-servers 192.168.51.1;
|
||||
option domain-search "example.com";
|
||||
option domain-name "other.com";
|
||||
|
||||
# MAC numbering scheme:
|
||||
# NFSv3: last octect starts at 0x00 and works up
|
||||
|
||||
group {
|
||||
option root-path "iscsi:192.168.51.1:::1:iqn.2009-06.dracut:target1";
|
||||
|
||||
host iscsi-2 {
|
||||
hardware ethernet 52:54:00:12:34:01;
|
||||
fixed-address 192.168.51.101;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
2
test/TEST-31-ISCSI-MULTI/finished-false.sh
Executable file
2
test/TEST-31-ISCSI-MULTI/finished-false.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exit 1
|
3
test/TEST-31-ISCSI-MULTI/hard-off.sh
Executable file
3
test/TEST-31-ISCSI-MULTI/hard-off.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
getargbool 0 rd.shell || poweroff -f
|
||||
getargbool 0 failme && poweroff -f
|
8
test/TEST-31-ISCSI-MULTI/hosts
Normal file
8
test/TEST-31-ISCSI-MULTI/hosts
Normal file
@@ -0,0 +1,8 @@
|
||||
127.0.0.1 localhost
|
||||
192.168.50.1 server
|
||||
192.168.50.2 server-ip
|
||||
192.168.50.3 server-proto-ip
|
||||
192.168.50.100 workstation1
|
||||
192.168.50.101 workstation2
|
||||
192.168.50.102 workstation3
|
||||
192.168.50.103 workstation4
|
41
test/TEST-31-ISCSI-MULTI/server-init.sh
Executable file
41
test/TEST-31-ISCSI-MULTI/server-init.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
exec </dev/console >/dev/console 2>&1
|
||||
set -x
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export TERM=linux
|
||||
export PS1='nfstest-server:\w\$ '
|
||||
stty sane
|
||||
echo "made it to the rootfs!"
|
||||
echo server > /proc/sys/kernel/hostname
|
||||
ip addr add 127.0.0.1/8 dev lo
|
||||
ip link set lo up
|
||||
ip link set dev eth0 name ens3
|
||||
ip addr add 192.168.50.1/24 dev ens3
|
||||
ip link set ens3 up
|
||||
ip link set dev eth1 name ens4
|
||||
ip addr add 192.168.51.1/24 dev ens4
|
||||
ip link set ens4 up
|
||||
>/var/lib/dhcpd/dhcpd.leases
|
||||
chmod 777 /var/lib/dhcpd/dhcpd.leases
|
||||
dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases &
|
||||
|
||||
tgtd
|
||||
tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2009-06.dracut:target0
|
||||
tgtadm --lld iscsi --mode target --op new --tid 2 --targetname iqn.2009-06.dracut:target1
|
||||
tgtadm --lld iscsi --mode target --op new --tid 3 --targetname iqn.2009-06.dracut:target2
|
||||
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/sdb
|
||||
tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/sdc
|
||||
tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/sdd
|
||||
tgtadm --lld iscsi --mode target --op bind --tid 1 -I 192.168.50.101
|
||||
tgtadm --lld iscsi --mode target --op bind --tid 2 -I 192.168.51.101
|
||||
tgtadm --lld iscsi --mode target --op bind --tid 3 -I 192.168.50.101
|
||||
|
||||
|
||||
# Wait forever for the VM to die
|
||||
echo "Serving iSCSI"
|
||||
while :; do
|
||||
[ -n "$(jobs -rp)" ] && echo > /dev/watchdog
|
||||
sleep 10
|
||||
done
|
||||
mount -n -o remount,ro /
|
||||
poweroff -f
|
243
test/TEST-31-ISCSI-MULTI/test.sh
Executable file
243
test/TEST-31-ISCSI-MULTI/test.sh
Executable file
@@ -0,0 +1,243 @@
|
||||
#!/bin/bash
|
||||
TEST_DESCRIPTION="root filesystem over iSCSI"
|
||||
|
||||
KVERSION=${KVERSION-$(uname -r)}
|
||||
|
||||
DEBUGFAIL="loglevel=1"
|
||||
#DEBUGFAIL="rd.shell rd.break rd.debug loglevel=7 "
|
||||
#DEBUGFAIL="rd.debug loglevel=7 "
|
||||
#SERVER_DEBUG="rd.debug loglevel=7"
|
||||
#SERIAL="tcp:127.0.0.1:9999"
|
||||
|
||||
run_server() {
|
||||
# Start server first
|
||||
echo "iSCSI TEST SETUP: Starting DHCP/iSCSI server"
|
||||
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext3 \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/root.ext3 \
|
||||
-drive format=raw,index=2,media=disk,file=$TESTDIR/iscsidisk2.img \
|
||||
-drive format=raw,index=3,media=disk,file=$TESTDIR/iscsidisk3.img \
|
||||
-m 512M -smp 2 \
|
||||
-display none \
|
||||
${SERIAL:+-serial "$SERIAL"} \
|
||||
${SERIAL:--serial file:"$TESTDIR"/server.log} \
|
||||
-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
|
||||
-net nic,macaddr=52:54:00:12:34:57,model=e1000 \
|
||||
-net socket,listen=127.0.0.1:12330 \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \
|
||||
-initrd $TESTDIR/initramfs.server \
|
||||
-pidfile $TESTDIR/server.pid -daemonize || return 1
|
||||
sudo chmod 644 $TESTDIR/server.pid || return 1
|
||||
|
||||
# Cleanup the terminal if we have one
|
||||
tty -s && stty sane
|
||||
|
||||
echo Sleeping 20 seconds to give the server a head start
|
||||
sleep 20
|
||||
}
|
||||
|
||||
run_client() {
|
||||
local test_name=$1; shift
|
||||
echo "CLIENT TEST START: $test_name"
|
||||
|
||||
dd if=/dev/zero of=$TESTDIR/client.img bs=1M count=1
|
||||
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/client.img \
|
||||
-m 512M -smp 2 -nographic \
|
||||
-net nic,macaddr=52:54:00:12:34:00,model=e1000 \
|
||||
-net nic,macaddr=52:54:00:12:34:01,model=e1000 \
|
||||
-net socket,connect=127.0.0.1:12330 \
|
||||
-no-reboot \
|
||||
-append "panic=1 rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 rd.shell=0 $DEBUGFAIL $*" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
if ! grep -F -m 1 -q iscsi-OK $TESTDIR/client.img; then
|
||||
echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "CLIENT TEST END: $test_name [OK]"
|
||||
return 0
|
||||
}
|
||||
|
||||
do_test_run() {
|
||||
initiator=$(iscsi-iname)
|
||||
run_client "netroot=iscsi target1 target2" \
|
||||
"root=LABEL=sysroot" \
|
||||
"ip=192.168.50.101:::255.255.255.0::ens3:off" \
|
||||
"ip=192.168.51.101:::255.255.255.0::ens4:off" \
|
||||
"netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
|
||||
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
|
||||
"rd.iscsi.initiator=$initiator" \
|
||||
|| return 1
|
||||
|
||||
|
||||
echo "All tests passed [OK]"
|
||||
return 0
|
||||
}
|
||||
|
||||
test_run() {
|
||||
if ! run_server; then
|
||||
echo "Failed to start server" 1>&2
|
||||
return 1
|
||||
fi
|
||||
do_test_run
|
||||
ret=$?
|
||||
if [[ -s $TESTDIR/server.pid ]]; then
|
||||
sudo kill -TERM $(cat $TESTDIR/server.pid)
|
||||
rm -f -- $TESTDIR/server.pid
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
|
||||
test_setup() {
|
||||
if ! command -v tgtd &>/dev/null || ! command -v tgtadm &>/dev/null; then
|
||||
echo "Need tgtd and tgtadm from scsi-target-utils"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Create the blank file to use as a root filesystem
|
||||
dd if=/dev/null of=$TESTDIR/root.ext3 bs=1M seek=20
|
||||
dd if=/dev/null of=$TESTDIR/iscsidisk2.img bs=1M seek=20
|
||||
dd if=/dev/null of=$TESTDIR/iscsidisk3.img bs=1M seek=20
|
||||
|
||||
kernel=$KVERSION
|
||||
# Create what will eventually be our root filesystem onto an overlay
|
||||
(
|
||||
export initdir=$TESTDIR/overlay/source
|
||||
. $basedir/dracut-init.sh
|
||||
(
|
||||
cd "$initdir"
|
||||
mkdir -p -- dev sys proc etc var/run tmp
|
||||
mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
|
||||
for i in bin sbin lib lib64; do
|
||||
ln -sfnr usr/$i $i
|
||||
done
|
||||
mkdir -p -- var/lib/nfs/rpc_pipefs
|
||||
)
|
||||
inst_multiple sh shutdown poweroff stty cat ps ln ip \
|
||||
mount dmesg mkdir cp ping grep setsid
|
||||
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
||||
[ -f ${_terminfodir}/l/linux ] && break
|
||||
done
|
||||
inst_multiple -o ${_terminfodir}/l/linux
|
||||
inst_simple /etc/os-release
|
||||
inst ./client-init.sh /sbin/init
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
# second, install the files needed to make the root filesystem
|
||||
(
|
||||
export initdir=$TESTDIR/overlay
|
||||
. $basedir/dracut-init.sh
|
||||
inst_multiple sfdisk mkfs.ext3 poweroff cp umount setsid
|
||||
inst_hook initqueue 01 ./create-root.sh
|
||||
inst_hook initqueue/finished 01 ./finished-false.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
|
||||
# create an initramfs that will create the target root filesystem.
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf -- $TESTDIR/overlay
|
||||
|
||||
|
||||
# Need this so kvm-qemu will boot (needs non-/dev/zero local disk)
|
||||
if ! dd if=/dev/null of=$TESTDIR/client.img bs=1M seek=1; then
|
||||
echo "Unable to make client sdb image" 1>&2
|
||||
return 1
|
||||
fi
|
||||
# Invoke KVM and/or QEMU to actually create the target filesystem.
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/client.img \
|
||||
-drive format=raw,index=2,media=disk,file=$TESTDIR/iscsidisk2.img \
|
||||
-drive format=raw,index=3,media=disk,file=$TESTDIR/iscsidisk3.img \
|
||||
-smp 2 -m 512M -nographic -net none \
|
||||
-append "root=/dev/fakeroot rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
grep -F -m 1 -q dracut-root-block-created $TESTDIR/client.img || return 1
|
||||
rm -- $TESTDIR/client.img
|
||||
(
|
||||
export initdir=$TESTDIR/overlay
|
||||
. $basedir/dracut-init.sh
|
||||
inst_multiple poweroff shutdown
|
||||
inst_hook shutdown-emergency 000 ./hard-off.sh
|
||||
inst_hook emergency 000 ./hard-off.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-o "dash plymouth dmraid nfs" \
|
||||
-a "debug" \
|
||||
-d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.testing $KVERSION || return 1
|
||||
|
||||
# Make server root
|
||||
dd if=/dev/null of=$TESTDIR/server.ext3 bs=1M seek=60
|
||||
mkfs.ext3 -j -F $TESTDIR/server.ext3
|
||||
mkdir $TESTDIR/mnt
|
||||
sudo mount -o loop $TESTDIR/server.ext3 $TESTDIR/mnt
|
||||
|
||||
kernel=$KVERSION
|
||||
(
|
||||
export initdir=$TESTDIR/mnt
|
||||
. $basedir/dracut-init.sh
|
||||
(
|
||||
cd "$initdir";
|
||||
mkdir -p dev sys proc etc var/run tmp var/lib/dhcpd /etc/iscsi
|
||||
)
|
||||
inst /etc/passwd /etc/passwd
|
||||
inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
|
||||
dmesg mkdir cp ping \
|
||||
modprobe tcpdump setsid \
|
||||
/etc/services sleep mount chmod
|
||||
inst_multiple tgtd tgtadm
|
||||
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
||||
[ -f ${_terminfodir}/l/linux ] && break
|
||||
done
|
||||
inst_multiple -o ${_terminfodir}/l/linux
|
||||
instmods iscsi_tcp crc32c ipv6
|
||||
[ -f /etc/netconfig ] && inst_multiple /etc/netconfig
|
||||
type -P dhcpd >/dev/null && inst_multiple dhcpd
|
||||
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
|
||||
inst_simple /etc/os-release
|
||||
inst ./server-init.sh /sbin/init
|
||||
inst ./hosts /etc/hosts
|
||||
inst ./dhcpd.conf /etc/dhcpd.conf
|
||||
inst_multiple /etc/nsswitch.conf /etc/rpc /etc/protocols
|
||||
inst /etc/group /etc/group
|
||||
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
dracut_kernel_post
|
||||
)
|
||||
|
||||
sudo umount $TESTDIR/mnt
|
||||
rm -fr -- $TESTDIR/mnt
|
||||
|
||||
# Make server's dracut image
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-a "dash udev-rules base rootfs-block fs-lib debug kernel-modules" \
|
||||
-d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 drbg" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.server $KVERSION || return 1
|
||||
|
||||
}
|
||||
|
||||
test_cleanup() {
|
||||
if [[ -s $TESTDIR/server.pid ]]; then
|
||||
sudo kill -TERM $(cat $TESTDIR/server.pid)
|
||||
rm -f -- $TESTDIR/server.pid
|
||||
fi
|
||||
}
|
||||
|
||||
. $testdir/test-functions
|
@@ -5,7 +5,7 @@ TEST_DESCRIPTION="root filesystem on NBD"
|
||||
KVERSION=${KVERSION-$(uname -r)}
|
||||
|
||||
# Uncomment this to debug failures
|
||||
#DEBUGFAIL="rd.shell rd.break rd.debug"
|
||||
#DEBUGFAIL="rd.shell rd.break rd.debug systemd.log_target=console loglevel=7 systemd.log_level=debug"
|
||||
#SERIAL="tcp:127.0.0.1:9999"
|
||||
|
||||
run_server() {
|
||||
@@ -16,7 +16,7 @@ run_server() {
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext2 \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/nbd.ext2 \
|
||||
-drive format=raw,index=2,media=disk,file=$TESTDIR/encrypted.ext2 \
|
||||
-m 256M -smp 2 \
|
||||
-m 512M -smp 2 \
|
||||
-display none \
|
||||
-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
|
||||
-net socket,listen=127.0.0.1:12340 \
|
||||
@@ -187,7 +187,7 @@ client_run() {
|
||||
|
||||
make_encrypted_root() {
|
||||
# Create the blank file to use as a root filesystem
|
||||
dd if=/dev/null of=$TESTDIR/encrypted.ext2 bs=1M seek=20
|
||||
dd if=/dev/null of=$TESTDIR/encrypted.ext2 bs=1M seek=40
|
||||
dd if=/dev/null of=$TESTDIR/flag.img bs=1M seek=1
|
||||
|
||||
kernel=$KVERSION
|
||||
@@ -249,7 +249,7 @@ make_encrypted_root() {
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/flag.img \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/encrypted.ext2 \
|
||||
-m 256M -smp 2\
|
||||
-m 512M -smp 2\
|
||||
-nographic -net none \
|
||||
-append "root=/dev/fakeroot rw quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
@@ -258,7 +258,7 @@ make_encrypted_root() {
|
||||
}
|
||||
|
||||
make_client_root() {
|
||||
dd if=/dev/null of=$TESTDIR/nbd.ext2 bs=1M seek=30
|
||||
dd if=/dev/null of=$TESTDIR/nbd.ext2 bs=1M seek=60
|
||||
mke2fs -F -j $TESTDIR/nbd.ext2
|
||||
mkdir $TESTDIR/mnt
|
||||
sudo mount -o loop $TESTDIR/nbd.ext2 $TESTDIR/mnt
|
||||
@@ -299,7 +299,7 @@ make_client_root() {
|
||||
}
|
||||
|
||||
make_server_root() {
|
||||
dd if=/dev/null of=$TESTDIR/server.ext2 bs=1M seek=30
|
||||
dd if=/dev/null of=$TESTDIR/server.ext2 bs=1M seek=60
|
||||
mke2fs -F $TESTDIR/server.ext2
|
||||
mkdir $TESTDIR/mnt
|
||||
sudo mount -o loop $TESTDIR/server.ext2 $TESTDIR/mnt
|
||||
|
@@ -51,10 +51,12 @@ client_test() {
|
||||
fi
|
||||
|
||||
$testdir/run-qemu -drive format=raw,index=0,media=disk,file="$TESTDIR"/client.img -m 512M -smp 2 -nographic \
|
||||
-net socket,connect=127.0.0.1:12350 \
|
||||
-net nic,macaddr=52:54:00:12:34:$mac1,model=e1000 \
|
||||
-net nic,macaddr=52:54:00:12:34:$mac2,model=e1000 \
|
||||
-net nic,macaddr=52:54:00:12:34:$mac3,model=e1000 \
|
||||
-net socket,vlan=0,connect=127.0.0.1:12350 \
|
||||
-net nic,vlan=0,macaddr=52:54:00:12:34:$mac1,model=e1000 \
|
||||
-net nic,vlan=0,macaddr=52:54:00:12:34:$mac2,model=e1000 \
|
||||
-net nic,vlan=0,macaddr=52:54:00:12:34:$mac3,model=e1000 \
|
||||
-net nic,vlan=1,macaddr=52:54:00:12:34:98,model=e1000 \
|
||||
-net nic,vlan=2,macaddr=52:54:00:12:34:99,model=e1000 \
|
||||
-watchdog i6300esb -watchdog-action poweroff \
|
||||
-no-reboot \
|
||||
-append "panic=1 rd.shell=0 $cmdline $DEBUGFAIL rd.retry=5 ro console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.debug systemd.log_target=console loglevel=7" \
|
||||
@@ -146,14 +148,14 @@ test_client() {
|
||||
|
||||
client_test "MULTINIC bridging" \
|
||||
00 01 02 \
|
||||
"root=nfs:192.168.50.1:/nfs/client ip=bridge0:dhcp bridge=bridge0:ens3,ens4,ens5" \
|
||||
"root=nfs:192.168.50.1:/nfs/client ip=bridge0:dhcp bridge=bridge0:ens3,ens6,ens7" \
|
||||
"bridge0" || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
test_setup() {
|
||||
# Make server root
|
||||
dd if=/dev/null of="$TESTDIR"/server.ext3 bs=1M seek=60
|
||||
dd if=/dev/null of="$TESTDIR"/server.ext3 bs=1M seek=120
|
||||
mke2fs -j -F -- "$TESTDIR"/server.ext3
|
||||
mkdir -- "$TESTDIR"/mnt
|
||||
sudo mount -o loop -- "$TESTDIR"/server.ext3 "$TESTDIR"/mnt
|
||||
|
@@ -18,10 +18,10 @@ run_server() {
|
||||
-hda "$TESTDIR"/server.ext3 \
|
||||
-m 512M -smp 2 \
|
||||
-display none \
|
||||
-net socket,vlan=0,listen=127.0.0.1:12350 \
|
||||
-net socket,vlan=1,listen=127.0.0.1:12351 \
|
||||
-net socket,vlan=2,listen=127.0.0.1:12352 \
|
||||
-net socket,vlan=3,listen=127.0.0.1:12353 \
|
||||
-net socket,vlan=0,listen=127.0.0.1:12370 \
|
||||
-net socket,vlan=1,listen=127.0.0.1:12371 \
|
||||
-net socket,vlan=2,listen=127.0.0.1:12372 \
|
||||
-net socket,vlan=3,listen=127.0.0.1:12373 \
|
||||
-net nic,vlan=0,macaddr=52:54:01:12:34:56,model=e1000 \
|
||||
-net nic,vlan=1,macaddr=52:54:01:12:34:57,model=e1000 \
|
||||
-net nic,vlan=2,macaddr=52:54:01:12:34:58,model=e1000 \
|
||||
@@ -59,11 +59,11 @@ client_test() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
$testdir/run-qemu -hda "$TESTDIR"/client.img -m 256M -smp 2 -nographic \
|
||||
-net socket,vlan=0,connect=127.0.0.1:12350 \
|
||||
${do_vlan13:+-net socket,vlan=1,connect=127.0.0.1:12351} \
|
||||
-net socket,vlan=2,connect=127.0.0.1:12352 \
|
||||
${do_vlan13:+-net socket,vlan=3,connect=127.0.0.1:12353} \
|
||||
$testdir/run-qemu -hda "$TESTDIR"/client.img -m 512M -smp 2 -nographic \
|
||||
-net socket,vlan=0,connect=127.0.0.1:12370 \
|
||||
${do_vlan13:+-net socket,vlan=1,connect=127.0.0.1:12371} \
|
||||
-net socket,vlan=2,connect=127.0.0.1:12372 \
|
||||
${do_vlan13:+-net socket,vlan=3,connect=127.0.0.1:12373} \
|
||||
-net nic,vlan=0,macaddr=52:54:00:12:34:01,model=e1000 \
|
||||
-net nic,vlan=0,macaddr=52:54:00:12:34:02,model=e1000 \
|
||||
-net nic,vlan=1,macaddr=52:54:00:12:34:03,model=e1000 \
|
||||
@@ -160,7 +160,7 @@ root=nfs:192.168.50.1:/nfs/client bootdev=br0
|
||||
|
||||
test_setup() {
|
||||
# Make server root
|
||||
dd if=/dev/null of="$TESTDIR"/server.ext3 bs=1M seek=60
|
||||
dd if=/dev/null of="$TESTDIR"/server.ext3 bs=1M seek=120
|
||||
mke2fs -j -F -- "$TESTDIR"/server.ext3
|
||||
mkdir -- "$TESTDIR"/mnt
|
||||
mount -o loop -- "$TESTDIR"/server.ext3 "$TESTDIR"/mnt
|
||||
|
@@ -8,6 +8,7 @@ $(lsmod | grep -q '^kqemu ') && BIN=/usr/bin/qemu && ARGS="-kernel-kqemu "
|
||||
[[ -c /dev/kvm && -x /usr/bin/kvm ]] && BIN=/usr/bin/kvm && ARGS=""
|
||||
[[ -c /dev/kvm && -x /usr/bin/qemu-kvm ]] && BIN=/usr/bin/qemu-kvm && ARGS=""
|
||||
[[ -c /dev/kvm && -x /usr/libexec/qemu-kvm ]] && BIN=/usr/libexec/qemu-kvm && ARGS=""
|
||||
[[ -c /dev/kvm && -x /usr/bin/qemu-system-$(uname -i) ]] && BIN=/usr/bin/qemu-system-$(uname -i) && ARGS="-enable-kvm"
|
||||
|
||||
[[ $BIN ]] || {
|
||||
echo "Could not find a working KVM or QEMU to test with!" >&2
|
||||
|
Reference in New Issue
Block a user